SliverList or SliverAppBar, can be put in the CustomScrollView.slivers Once code has been ported to use CustomScrollView, other slivers, such as The SliverGrid instead be a child of the SliverPadding. The padding property corresponds to having a SliverPadding in theĬustomScrollView.slivers property instead of the grid itself, and having SliverGrid to ease the transition: unt and The unt and GridView.extent constructors createĬustom grid delegates, and have equivalently named constructors on GridView.builder constructor's itemBuilder and childCount argumentsĬorrespond to the childrenDelegate being a SliverChildBuilderDelegate The GridView, unt, and GridView.extentĬonstructors' children arguments correspond to the childrenDelegateīeing a SliverChildListDelegate with that same argument. GridView corresponds to the idDelegate property. legate property, and the gridDelegate property on the The childrenDelegate property on GridView corresponds to the The CustomScrollView.slivers property should be a list containing just a The key, scrollDirection, reverse, controller, primary, physics,Īnd shrinkWrap properties on GridView map directly to the identically GridView to using CustomScrollView directly. With a SliverAppBar, etc, it is straight-forward to port code from using Is to have both a grid and a list, or because the grid is to be combined If GridView is no longer sufficient, for example because the scroll view Transitioning to CustomScrollViewĪ GridView is basically a CustomScrollView with a single SliverGrid in To control the initial scroll offset of the scroll view, provide aĬontroller with its ScrollController.initialScrollOffset property set. To create a linear array of children, use a ListView. To use a custom SliverChildDelegate, use GridView.custom. SliverGridDelegateWithMaxCrossAxisExtent for the gridDelegate. SliverGridDelegateWithFixedCrossAxisCount or a GridView.builder constructor with either a To create a grid with a large (or infinite) number of children, use the A custom SliverGridDelegate can produce an arbitrary 2DĪrrangement of children, including arrangements that are unaligned or GridView.extent, which creates a layout with tiles that have a maximumĬross-axis extent. Layout with a fixed number of tiles in the cross axis, and The most commonly used grid layouts are unt, which creates a The main axis direction of a grid is the direction in which it scrolls (the
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |