bottom_sheet_bar
A toolbar that aligns to the bottom of a widget and expands into a bottom sheet.
| Short content | Long content | Scrollable content |
|---|---|---|
![]() |
![]() |
![]() |
import 'package:bottom_sheet_bar/bottom_sheet_bar.dart';
BottomSheetBar(
expandedBuilder: (scrollController) => ListView.builder(
controller: scrollController,
itemBuilder: (context, index) => ListTile(title: index.toString()),
itemCount: 50,
),
collapsed: Text('Collapsed toolbar widget'),
body: Text('Content overlayed by toolbar and bottom sheet'),
);
BottomSheetBar
Required
Widget body- The toolbar will be aligned to the bottom of the bodyWidget. Padding equal toheightis added to the bottom of this widget.Function(ScrollController) expandedBuilder- A function to build the widget displayed when the bottom sheet is expanded. If the expanded content is scrollable, pass the providedScrollControllerto the scrollable widget.
Optional
Widget collapsed- AWidgetto be displayed on the toolbar in its collapsed stateBottomSheetBarController controller- A controller can be used to listen to events, and expand and collapse the bottom sheet.Color color- The background color of the toolbar and bottom sheet. Defaults toColors.whiteColor backdropColor- The backdrop color that overlays thebodywidget when the bottom sheet is expanded. Defaults toColors.transparent(no backdrop)BorderRadius borderRadius- Provide a border-radius to adjust the shape of the toolbarBorderRadius borderRadiusExpanded- Provide a border-radius to adjust the shape of the bottom-sheet when expandedList<BoxShadow> boxShadows- Provide shadow decoration to the bottom sheetdouble height- The height of the collapsed toolbar. Default tokToolbarHeight(56.0)bool isDismissable- Iftrue, the bottom sheet can be dismissed by tapping elsewhere. Defaults totruebool locked- Iftrue, the bottom sheet cannot be opened or closed with a swipe gesture. Defaults totruebool willPopScope- Iftrue, the bottom sheet widget will be wrapped in aWillPopScopewidget to handle back-gestures. Defaults tofalsebool backButtonListener- Iftrue, the bottom sheet widget will be wrapped in aBackButtonListenerwidget to handle back-gestures. Defaults tofalse
BottomSheetBarController
A controller used to expand or collapse the bottom sheet of a BottomSheetBar. Listeners can be added to respond to expand and collapse events. The expanded or collapsed state can also be determined through this controller.
bool get isCollapsed- Only returnstrueif the bottom sheet if fully collapsedbool get isExpanded- Only returnstrueif the bottom sheet if fully expandedTickerFuture collapse()- Collapse the bottom sheet built byBottomSheetBar.expandedBuilderTickerFuture expand()- Expand the bottom sheet built byBottomSheetBar.expandedBuildervoid addListener(Function listener)- Adds a function to be called on every animation framevoid removeListener(Function listener)- Removes a previously added listenervoid dispose()- Removes all previously added listenersvoid attach(AnimationController animationController)- Used internally to assign theAnimationControllercreated byBottomSheetBarto the controller. Unless you're using advanced animation techniques, you probably won't ever need to use this method.
Example
A quick demonstration can be found in the example directory. To run the example:
flutter run example/main.dart


