showStickyFlexibleBottomSheet<T> function
- required BuildContext context,
- required FlexibleDraggableScrollableHeaderWidgetBuilder headerBuilder,
- required FlexibleDraggableScrollableWidgetBodyBuilder bodyBuilder,
- DraggableScrollableController? draggableScrollableController,
- double? minHeight,
- double? initHeight,
- double? maxHeight,
- bool isCollapsible = true,
- bool isDismissible = true,
- bool isExpand = true,
- bool isModal = true,
- List<
double> ? anchors, - double? minHeaderHeight,
- double? maxHeaderHeight,
- double? headerHeight,
- Decoration? decoration,
- Color? keyboardBarrierColor,
- Color? bottomSheetColor,
- BorderRadiusGeometry? bottomSheetBorderRadius,
- Color? barrierColor,
- Duration? duration,
- bool isSafeArea = false,
- bool useRootScaffold = true,
Shows a flexible bottom sheet with the ability to scroll content even without a list.
bodyBuilder
- content's builder.
draggableScrollableController
that allow programmatically control bottom sheet.
minHeight
- min height in fractional value for bottom sheet. e.g. 0.1.
initHeight
- init height in fractional value for bottom sheet. e.g. 0.5.
maxHeight
- init height in fractional value for bottom sheet. e.g. 0.5.
isModal
- if true, overlay background with dark color.
isCollapsible
- will the bottom sheet collapse.
isDismissible
- the bottom sheet will be dismissed when user taps on the scrim.
isExpand
- should your bottom sheet expand. By default, isExpand
is true,
which means that the bottom sheet will have the height you specify
(initHeight
and maxHeight
) regardless of the height of the content in it.
If isExpand
is false, maxHeight
and initHeight
must be equal,
in which case the bottom sheet will calculate its height based on the content,
but no more than maxHeight
and initHeight
.
anchors
- list of sizes in fractional value that the bottom sheet can accept.
decoration
- content decoration bottom sheet.
minHeaderHeight
- minimum head size.
maxHeaderHeight
- maximum head size.
headerHeight
- head size.
Set both minHeaderHeight
and maxHeaderHeight
.
Set one (maxHeaderHeight
or headerHeight
).
keyboardBarrierColor
- keyboard color.
bottomSheetBorderRadius
- bottom sheet border radius.
bottomSheetColor
- bottom sheet color.
barrierColor
- barrier color, if you pass barrierColor
- isModal
must be true.
duration
- animation speed when opening bottom sheet.
isSafeArea
- should the bottom sheet provide a SafeArea, false by default.
useRootScaffold
- if true, add Scaffold widget on widget tree. Default true.
Implementation
Future<T?> showStickyFlexibleBottomSheet<T>({
required BuildContext context,
required FlexibleDraggableScrollableHeaderWidgetBuilder headerBuilder,
required FlexibleDraggableScrollableWidgetBodyBuilder bodyBuilder,
DraggableScrollableController? draggableScrollableController,
double? minHeight,
double? initHeight,
double? maxHeight,
bool isCollapsible = true,
bool isDismissible = true,
bool isExpand = true,
bool useRootNavigator = false,
bool isModal = true,
List<double>? anchors,
double? minHeaderHeight,
double? maxHeaderHeight,
double? headerHeight,
Decoration? decoration,
Color? keyboardBarrierColor,
Color? bottomSheetColor,
BorderRadiusGeometry? bottomSheetBorderRadius,
Color? barrierColor,
Duration? duration,
bool isSafeArea = false,
bool useRootScaffold = true,
}) {
assert(maxHeaderHeight != null || headerHeight != null);
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
assert(barrierColor == null || isModal);
return Navigator.of(context, rootNavigator: useRootNavigator).push(
FlexibleBottomSheetRoute<T>(
theme: Theme.of(context),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
minHeight: minHeight ?? 0,
initHeight: initHeight ?? 0.5,
maxHeight: maxHeight ?? 1,
isCollapsible: isCollapsible,
isDismissible: isDismissible,
draggableScrollableController: draggableScrollableController,
isExpand: isExpand,
bodyBuilder: bodyBuilder,
headerBuilder: headerBuilder,
isModal: isModal,
anchors: anchors,
minHeaderHeight: minHeaderHeight ?? headerHeight ?? maxHeaderHeight! / 2,
maxHeaderHeight: maxHeaderHeight ?? headerHeight!,
decoration: decoration,
keyboardBarrierColor: keyboardBarrierColor,
bottomSheetColor: bottomSheetColor,
bottomSheetBorderRadius: bottomSheetBorderRadius,
barrierBottomSheetColor: barrierColor,
duration: duration,
isSafeArea: isSafeArea,
useRootScaffold: useRootScaffold,
),
);
}