Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Beautify your list with sliver

Beautify your list with sliver

In this session, we will learn about what sliver is. After that, we have a look into ListView and GridView and learn how the technical implementation of slivers work. In the live coding session, we will implement some slivers together and at the end, we will hear about some best practices.

Mahtab Tadayon

January 27, 2021
Tweet

More Decks by Mahtab Tadayon

Other Decks in Programming

Transcript

  1. Mahtab Tadayon š Software Engineer at MediaMarktSaturn Retail Group š

    Founder & content creator of Flutter Explained š Member of Flutteristas community
  2. Sliver š A portion of a scrollable area š All

    scrollable Widgets using Sliver š Build lazily each item š Efficiently scrolling through large number of children
  3. ListView & GridView š ListView: Scrollable list of Widget š

    GridView: 2D array of widgets š A ListView is a CustomScrollView with a SliverList š A GridView is a CustomScrollView with a SliverGrid
  4. When to use Sliver? š Efficiently scrolling through large number

    of children š Have app bar with customized scroll behavior š Scroll a list of items and a grid of item all together
  5. SliverList š Place children along main axis š Parameter: š

    delegate š SliverChildListDelegate š SliverChildBuilderDelegate š childCount
  6. SliverList š Place children along main axis š Parameter: š

    delegate š SliverChildListDelegate š SliverChildBuilderDelegate š childCount
  7. SliverGrid š Place children in two-dimensional arrangement š Parameter: š

    Delegate š SliverChildListDelegate š SliverChildBuilderDelegate š gridDelegate š SliverGridDelegateWithFixedCrossAxisCount š SliverGridDelegateWithMaxCrossAxisExtent
  8. SliverGrid Constructors š .count š Alternative to FixedCrossAxisCount š .extend

    š Alternative to MaxCrossAxisExtent š No builder method only children
  9. Best Practices š Know your requirement before using Slivers š

    Use ListView & GridView as much as possible š For dynamic AppBars you will need a CustomScrollView and Slivers š For better performance consider using SliverFixedExtentList