Flutter › Flutter Slivers & Custom Scroll Effects
What is a sliver in Flutter, and how does using a CustomScrollView built from several individual slivers let you create a genuinely more complex, custom scrolling effect than a simple regular ListView could achieve on its own?
BeginnerAnswer
A sliver is a genuinely special kind of scrollable area specifically designed to work together within a larger overall scrolling container, and combining several different individual slivers together within a single CustomScrollView lets you build genuinely more complex scrolling effects, such as a large header image that visually shrinks or fades away as a user scrolls, a grid section immediately followed by a completely separate list section within that exact same single continuous scroll, or a pinned persistent section header, effects that would be genuinely quite difficult or even simply impossible to properly achieve using just one single regular basic ListView alone.
CustomScrollView(
slivers: [
SliverAppBar(expandedHeight: 200, flexibleSpace: FlexibleSpaceBar(title: Text('Profile'))),
SliverList(delegate: SliverChildBuilderDelegate((context, index) => ListTile(title: Text('Item $index')))),
],
)Real-world example A social media profile screen uses a CustomScrollView combining a SliverAppBar featuring a large expandable header photo together with a SliverList displaying the user's own individual posts, all working together seamlessly within one single continuous, unified scrolling experience.