50.1 InheritedWidgetFirst, we will introduce the InheritedWidget component and then focus on the relationship between the didChangeDependencies callback in the State class and the InheritedWidget.1. I···
To prevent users from accidentally exiting the app by pressing the back button, many apps intercept the back button click and implement some validation to avoid misclicks. For example, they may only c···
48.1 NestedScrollViewIn the previous section, we learned that CustomScrollView can only combine Slivers. If there are child components that are also scrollable (embedded through SliverToBoxAdapter) an···
In this section, we will explain the Sliver layout protocol and the process of creating custom Slivers by customizing two Slivers.47.1 Sliver Layout ProtocolThe layout protocol for Sliver is as follow···
46.1 CustomScrollViewPreviously introduced widgets like ListView, GridView, and PageView are all complete scrollable components. "Complete" means that they include Scrollable, Viewport, and ···
The TabBarView is a layout component provided by the Material widget library, often used in conjunction with the TabBar.45.1 TabBarViewTabBarView encapsulates PageView, and its constructor is straight···
General Solution for Caching Specific Items in Scrollable WidgetsIn this section, we’ll introduce a general solution for caching specific items within scrollable widgets.First, let’s recall that whe···
43.1 PageViewIf you want to implement page transitions and tab layouts, you can use the PageView widget. It’s important to note that PageView is a very significant widget, especially in mobile develo···
A grid layout is a common layout type, and the GridView widget is used to implement this layout in Flutter. This section focuses on its usage.42.1 Default ConstructorGridView can build a two-dimension···
AnimatedList and ListView have similar functionalities, but the key difference is that AnimatedList can perform animations when inserting or deleting items in the list. This feature enhances the user ···
In the previous sections, we introduced commonly used scrollable components in Flutter and mentioned that the scroll position of these components can be controlled using ScrollController. This section···
ListView is one of the most commonly used scrollable widgets. It can arrange all child widgets linearly in one direction, and it also supports lazy loading of list items (only creating them when neede···
38.1 IntroductionThe SingleChildScrollView is similar to the ScrollView in Android; it can only accept a single child widget. Its definition is as follows:SingleChildScrollView({this.scrollDirection=A···
37.1 Sliver Layout ModelIn Section 4.2, we introduced that Flutter has two layout models:The box model layout based on RenderBox.The list layout based on Sliver (RenderSliver), which supports lazy loa···
The Material component library offers a variety of rich components. This section introduces the most commonly used Scaffold component. For the others, readers can refer to the documentation or explore···
35.1 FittedBoxWhen a child component's size exceeds that of its parent component, Flutter will display an overflow warning and print an error log to the console unless handled properly. For exampl···