showFluent2BottomSheet<T> function

Future<T?> showFluent2BottomSheet<T>(
  1. BuildContext context, {
  2. required WidgetBuilder builder,
})

Raises what builder makes (a Fluent2BottomSheet, usually) off the bottom edge over the overlay, at most 600 wide; completes with what it pops with, null when it is dismissed. It is ui_core's bottom sheet (DesignBottomSheetRoute): it rises on a spring that settles in Fluent's durationGentle, rides above the keyboard, follows a drag (a Fluent2BottomSheet's words, scrolled to their top, hand the drag on) and closes when let go low or flung down; focus goes back to what raised it.

showFluent2BottomSheet<void>(context, builder: (context) => Fluent2BottomSheet(title: 'Share', onClose: () => Navigator.of(context).pop(), child: people))

Implementation

Future<T?> showFluent2BottomSheet<T>(
  BuildContext context, {
  required WidgetBuilder builder,
}) {
  final t = context.fluent2Theme;
  final navigator = Fluent2Host.navigatorOf(context);
  final themes = InheritedTheme.capture(from: context, to: navigator.context);
  return navigator.push<T>(
    DesignBottomSheetRoute<T>(
      barrierLabel: DesignLocalizations.of(context).modalBarrierDismissLabel,
      barrierColor: t.overlay,
      dampingRatio: Fluent2Motion.springDamping,
      stiffness: Fluent2Motion.springGentle,
      builder: (sheetContext, details) => themes.wrap(
        fluent2BottomSheetPlace(
          maxHeight: Fluent2Sheet.maxHeight(context),
          child: PrimaryScrollController(
            controller: details.scrollController,
            child: RoutePresentationScope(
              presentation: RoutePresentation.sheet,
              child: builder(sheetContext),
            ),
          ),
        ),
      ),
    ),
  );
}