bottom_sheet_bar 1.0.0+1
bottom_sheet_bar: ^1.0.0+1 copied to clipboard
A toolbar that expands into a bottom sheet
bottom_sheet_bar #
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
constructor parameters #
Required
Widget body
Function(ScrollController) expandedBuilder
Optional
Widget collapsed
BottomSheetBarController controller
Color color
default: Colors.whiteColor backdropColor
default: Colors.transparentBorderRadius borderRadius
double height
default: kToolbarHeightbool isDismissable
default: truebool locked
default: trueKey key
BottomSheetBarController
#
A BottomSheetBarController
can be used to expand and collapse the bottom sheet programatically, listen for changes, and query the current state of the BottomSheetBar
bool get isCollapsed
- Returns true if bottom sheet is fully collapsedbool get isExpanded
- Returns true if bottom sheet is fully expandedTickerFuture collapse()
- Collapse the bottom sheet widget defined byexpandedBuilder
TickerFuture expand()
- Expand the bottom sheet widget defined byexpandedBuilder
void addListener(Function listener)
- Add a listener that is called on every frame of animationvoid removeListener(Function listener)
- Removes a previously added listenervoid dispose()
Advanced
void attach(AnimationController animationController)
- Used internally to assign theAnimationController
created byBottomSheetBar
to 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