showStickyFlexibleBottomSheet<T> function Null safety

Future<T?> showStickyFlexibleBottomSheet<T>(
  1. {required BuildContext context,
  2. required FlexibleDraggableScrollableHeaderWidgetBuilder headerBuilder,
  3. required FlexibleDraggableScrollableWidgetBodyBuilder bodyBuilder,
  4. double? minHeight,
  5. double? initHeight,
  6. double? maxHeight,
  7. bool isCollapsible = true,
  8. bool isDismissible = true,
  9. bool isExpand = true,
  10. bool useRootNavigator = false,
  11. bool isModal = true,
  12. List<double>? anchors,
  13. double? minHeaderHeight,
  14. double? maxHeaderHeight,
  15. double? headerHeight,
  16. Decoration? decoration}
)

Shows a flexible bottom sheet with the ability to scroll content even without a list.

bodyBuilder - content's builder. 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. anchors - list of sizes in fractional value that the bottom sheet can accept. decoration - BottomSheet decoration. minHeaderHeight - minimum head size. maxHeaderHeight - maximum head size. headerHeight - head size. Set both minHeaderHeight and maxHeaderHeight. Set one (maxHeaderHeight or headerHeight).

Implementation

Future<T?> showStickyFlexibleBottomSheet<T>({
  required BuildContext context,
  required FlexibleDraggableScrollableHeaderWidgetBuilder headerBuilder,
  required FlexibleDraggableScrollableWidgetBodyBuilder bodyBuilder,
  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,
}) {
  assert(maxHeaderHeight != null || headerHeight != null);
  assert(debugCheckHasMediaQuery(context));
  assert(debugCheckHasMaterialLocalizations(context));

  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,
      isExpand: isExpand,
      bodyBuilder: bodyBuilder,
      headerBuilder: headerBuilder,
      isModal: isModal,
      anchors: anchors,
      minHeaderHeight: minHeaderHeight ?? headerHeight ?? maxHeaderHeight! / 2,
      maxHeaderHeight: maxHeaderHeight ?? headerHeight!,
      decoration: decoration,
    ),
  );
}