Migration to Flutter Guide
Discover our battle-tested 21-step framework for a smooth and successful migration to Flutter!
Home
Glossary

Sliver in Flutter

What is a Sliver in Flutter?

A Sliver in Flutter is a low-level scrollable building block used inside widgets like CustomScrollView.

Unlike ListView, slivers are rendered lazily and react directly to scroll position, giving you fine-grained control over scrolling behavior. In practice, slivers are used to build complex scroll effects such as collapsing headers or sticky elements.

Why does Sliver matter in Flutter app development?

Slivers enable:

  • Collapsing and pinned headers (flutter sliver app bar).
  • Combining multiple scrollable sections.
  • Better performance for large lists.
  • Advanced scroll-driven UI effects.

Many modern Flutter UIs rely on slivers under the hood.

How does it work?

Slivers live inside a CustomScrollView. Each sliver defines:

  • How much space it occupies.
  • How it reacts to scrolling.
  • When it should appear or disappear.

Only visible slivers are built, which improves performance for long or complex scrollable layouts.

Example of sliver in Flutter

CustomScrollView(
  slivers: [
    SliverAppBar(
      expandedHeight: 200,
      pinned: true,
      flexibleSpace: FlexibleSpaceBar(
        title: Text('Sliver AppBar'),
      ),
    ),
    SliverList(
      delegate: SliverChildBuilderDelegate(
        (context, index) => ListTile(title: Text('Item $index')),
        childCount: 50,
      ),
    ),
  ],
);

This creates a collapsible app bar with a lazily built list.

When to use Sliver?

Sliver is useful when a Flutter app requires dynamic or custom scrolling behavior.

Dynamic and interactive scrolling layouts

Slivers are effective when multiple scrollable areas need to coexist or when different parts of the interface must react differently to scrolling.

With slivers, developers can:

  • Create collapsing headers.
  • Pin or float headers during scrolling.
  • Combine lists, grids, and other scrollable elements in a single layout.

This enables more flexible and interactive scrolling experiences.

Performance in long or complex scroll views

Slivers are also useful when performance is important, particularly in long or complex scrollable views.

They provide precise control over:

  • Which UI elements are built
  • Which widgets remain in memory

This reduces unnecessary widget rebuilding and helps maintain smooth scrolling, even on lower-end devices.

Custom scroll effects

Slivers make it easier to implement scroll-based UI effects such as:

  • Parallax scrolling
  • Sticky headers
  • Progressive loading indicators that react to scroll position

Complex layouts and content feeds

Slivers are best suited for layouts that require flexible and interactive scrolling beyond what standard widgets provide.

They are commonly used in:

  • Complex dashboards
  • Feed-based applications
  • Rich content layouts

In these scenarios, both visual design and performance are important.

When not to use Sliver?

Sliver is not always necessary and can introduce additional complexity.

Simple lists or grids

If a UI contains simple, linear lists or grids without dynamic headers, standard widgets such as ListView or GridView are usually easier to implement and maintain.

Using slivers in these situations can make code less readable, which may be a disadvantage in small projects or teams that prioritize maintainability over fine-grained scroll control.

Mostly static layouts

Slivers should be avoided when the layout is mostly static and does not require advanced scrolling behavior.

In these cases:

  • Additional boilerplate is required.
  • Multiple Sliver components must be coordinated.

This can slow development without providing meaningful benefits.

When simplicity and maintainability matter most

For simple screens where clarity and maintainability are more important than performance tuning or advanced scrolling effects, standard scrollable widgets provide a more predictable and straightforward codebase.

Key sliver widgets in Flutter

  • SliverAppBar – collapsible or pinned app bar
  • SliverList – lazy-loaded list
  • SliverGrid – lazy-loaded grid
  • SliverPersistentHeader – custom sticky headers
  • SliverFillRemaining – fills remaining space (great for empty states)
  • SliverToBoxAdapter – wraps a single normal widget into a sliver

There is no such thing as a “SliverContainer”. Regular widgets must be wrapped using SliverToBoxAdapter.

Common mistakes to avoid

  • Nesting a ListView inside a CustomScrollView
  • This breaks virtualization and can cause scroll conflicts (especially with shrinkWrap: true).
  • Putting large Columns inside SliverToBoxAdapter
  • This disables lazy loading. Use SliverList for lists.
  • Overusing slivers for simple screens
  • Mixing sliver-based and non-sliver scroll views incorrectly

Best practices for Sliver in Flutter

  • Start with ListView; switch to slivers only when needed.
  • Use SliverToBoxAdapter only for single elements (banner, header, button).
  • Use SliverFillRemaining for centered empty or loading states.
  • Test scroll performance on real devices.

Slivers are most valuable when you need advanced, scroll-driven layouts rather than basic lists.

Learn more

Design system Flutter

Building a Design System in a Large Flutter App

Flutter is known for its seamless UI/UX features and robust design elements. It allowed us to deliver a unique customer experience in the “CA24 Mobile” banking app. This article shares some of the learnings and pain points behind implementing it in this large project.

12 Flutter & Dart Code Hacks
by LeanCode

12 Flutter & Dart Code Hacks & Best Practices – How to Write Better Code?

In this article, we’re sharing LeanCode’s 12 practical Flutter and Dart patterns that help you write less boilerplate, make your code cleaner, and catch mistakes earlier. Apply these patterns and you'll find yourself coding faster, communicating more clearly with your teammates, and spending less time debugging issues that the compiler could have caught.

Complex Animations in Flutter

Complex Animations in Flutter

Flutter ships with plenty of high-quality widgets, layouts, and themes that developers can use to speed up the whole creation process. A great example of custom widgets made in Flutter is the Placement Wheel developed for one of our clients. See how to do it.