Package selection guidance compiled from public package information, community data, and project usage.
SliverSnap is a Flutter package that enables developers to create dynamic, snapping slivers with expandable and collapsible header bars. It enhances scroll interactions by allowing smooth transitions between expanded and collapsed states, ideal for creating immersive app interfaces. The package integrates seamlessly with CustomScrollView and supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux. It's particularly useful for implementing modern UI patterns like parallax headers and interactive navigation bars.
Use cases
Creating interactive app headers
Implementing parallax scrolling effects
Building responsive navigation bars
Designing immersive user experiences
Developing scroll-driven animations
Enhancing content discovery interfaces
Key features
Smooth snapping behavior
Support for expanded and collapsed states
Seamless integration with CustomScrollView
Cross-platform compatibility
Customizable snap points
Real-time scroll feedback
Suitable for
Developers building modern Flutter apps
UI designers implementing dynamic headers
Apps requiring scroll-based interactions
Projects with complex scroll layouts
Teams focused on polished user experiences
Considerations
Requires understanding of CustomScrollView
May need performance tuning for large lists
Limited documentation beyond basic usage
Not ideal for simple static headers
Best suited for advanced UI components
Potential complexity in nested scroll scenarios
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Sliver Snap
🚀 Sliver Snap is a Flutter package that simplifies the process of adding collapsible and expandable
app bars to your app. It offers smooth transitions that respond seamlessly to user scrolling and
snaps to the appropriate mode when the user stops scrolling midway. 💻 It's highly customizable and
provides a user-friendly experience.
Say goodbye to manual implementation and make your Flutter app
more interactive and intuitive with Sliver Snap. 🤯
The content that is shown when expanded. It is a required property.
collapsedContent
Widget
N/A
The appbar Which is shown when collapsed. It is a required property.
body
Widget
N/A
The content shown below the appbar. It is a required property.
pinned
boolean
true
Whether the appbar will be fixed at the top of the scroll view. For more information check the documentation For more information check the flutter docs.
collapsedBarHeight
double
60.0
The height of the collapsedContent.
animationDuration
Duration
300 milliseconds
The duration of the scroll animation which happens when automatically snapping to the collapsed or the expanded widgets.
animationCurve
Curve
Curves.easeInOut
The Curve of the scroll animation which happens when automatically snapping to the collapsed or the expanded widgets.
snap
boolean
false
Whether the app bar behave in a smooth or a rigid way as the it is scrolling. For more information check the documentation flutter docs.
floating
boolean
false
Whether the app bar should become visible as soon as the user scrolls towards the app bar. For more information check the flutter docs.
stretch
boolean
false
Whether the app bar should stretch to fill the over-scroll area. For more information check the flutter docs.
expandedContentHeight
double?
N/A
The height of the expandedContent.
bottom
PreferredSizeWidget?
N/A
The widget that appears across the bottom of the appbar. For example a TabBar. This widget has to implement a PreferredSizeWidget.
automaticallyImplyLeading
bool?
false
Provides Control of the AppBar's leading widget. When set to true, the framework will automatically add a leading widget When set to false , no leading widget will be added automatically. For more information check the flutter docs.
leading
Widget?
N/A
The leading widget at the start both the expandedContent and the collapsedContent, typically an Icon or an IconButton. It can also be a BackButton.
actions
List?
N/A
A list of action widgets to display in a row after the collapsedContent widget.
backdropWidget
Widget?
N/A
The content that is shown below the appbar. In most cases it's just the page content.
expandedBackgroundColor
Color?
N/A
The background Color of the expandedContent widget.
collapsedBackgroundColor
Color?
N/A
The background Color of the collapsedContent widget.
scrollController
ScrollController?
N/A
Can be used to pass your own scrollController to customize the appbar even more.
scrollBehavior
ScrollBehaviour?
N/A
How the scrollable widgets behave, either Material or Cupertino Scrolling behaviors.
onCollapseStateChanged
CollapsingStateCallback?
N/A
This is a callback function that is triggered when the bar is either collapsed or expanded. It can be used to customize the animation and behavior of the widget to better suit your needs.
elevation
double
0.0
The elevation of the app bar
forceElevated
bool
false
Whether to show the shadow appropriate for the elevation even if the content is not scrolled under the app bar. Defaults to false, meaning that the elevation is only applied when the app bar is being displayed over content that is scrolled under it.
Extra Components
The below are supplementary widgets that can help you build the appbar faster.
1. Collapsed AppBar Content widget
This can be used to create a custom collapsedContent widget. It has the following properties:
leading: This is the leading widget specifically for the collapsedContent Appbar. Don't add the leading widget to the ExpandedContent widget or the SliverSnap widget, as they might overlap.
title: The middle widget between the leading and the trailing of the collapsedContent Appbar.,
trailing: The widget that is displayed at the rightmost part of the collapsedContent.
This can be used to create a custom expanded widget. It has the following properties:
leading: This is the leading widget specifically for the expandedContent Appbar. Don't add the leading widget to the CollapsedAppBarContent widget or the SliverSnap widget, as they might overlap.
Feel free to check the example for more usage info.
Bugs or Requests
If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket. Pull request are also welcome.