When starting this project, I've already had experiences with Flutter, so the challenge difficulties will bypass some basic knowledge and the knowledge that I knew it already. 🧑💻
Day 001: Scrolling with DraggableScrollableSheet & ListWheelScrollView
- DraggableScrollableSheet
- Use another sizing widget beside scrolling widget to make sheet affect. Please check demo.
- minChildSize: is for smallest size that sheet can shrink and then opposite is maxChildSize from 0 to 1.
- snap:true: to turn on custom snap, snapSizes: List(double) to define points to snap when users release their finger.
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2023-08-12.at.01.25.08.mp4
- ListWheelScrollView
- Use for fancy scrolling
- useMagnifier & magnification: for zoomed-in rate of the magnifier
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2023-08-12.at.00.56.24.mp4
- SingleChildScrollView is 1 widget, so wrapping another widget with it will cause redundant rebuilds a whole widget tree when scrolling. However, if you have a relatively simple layout and performance isn't a major concern, SingleChildScrollView maybe be more suitable.
- ListView => render a whole list, it doesn't implement lazy loading for UIs.
- ListView.builder => optimize performance better, because of lazy loading UIs (build & render only can-see items). But there is an issue with ListView.builder, it's just able to use for item with the same type.
- Set shrinkWrap: true & physics: const NeverScrollableScrollPhysics() for children list view ? => it will back to ListView mechanism => not good for performance
- Solution: Use Slivers with CustomScrollView.
day002.mp4
There are 2 variants: implicit & explicit.
- Implicit rely on simple setting a new value through Widget property, then Flutter takes care the rest.
- Explicit require an animation controller => mean that you need to handle animation manually. Before deciding what type of animation that you need, answering some question first:
- Question list
Day 004: Implicit animation and TweenAnimationController
- The process between old and the new value is called interpolation.
- There are 2 props need to be highlighted.
- Duration -> Duration that animation will execute.
- Curve -> How transaction works beginning and end values.
- Use case: when can not find any "AnimatedFoo" widget.
- Optimization:
- use child parameter is rather than call directly on builder. Because widget will reconstructed every time builder methods get called.
- set tween as static final when appropriate.