showRModalBottomSheet<T> function

Future<T> showRModalBottomSheet <T>(
  1. {@required WidgetBuilder builder,
  2. Color backgroundColor,
  3. double elevation,
  4. ShapeBorder shape,
  5. Clip clipBehavior,
  6. bool isScrollControlled: false,
  7. bool isDismissible: true}
)

Shows a modal material design bottom sheet.

A modal bottom sheet is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app.

A closely related widget is a persistent bottom sheet, which shows information that supplements the primary content of the app without preventing the use from interacting with the app. Persistent bottom sheets can be created and displayed with the showBottomSheet function or the ScaffoldState.showBottomSheet method.

The context argument is used to look up the Navigator and Theme for the bottom sheet. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the bottom sheet is closed.

The isScrollControlled parameter specifies whether this is a route for a bottom sheet that will utilize DraggableScrollableSheet. If you wish to have a bottom sheet that has a scrollable child such as a ListView or a GridView and have the bottom sheet be draggable, you should set this parameter to true.

The useRootNavigator parameter ensures that the root navigator is used to display the BottomSheet when set to true. This is useful in the case that a modal BottomSheet needs to be displayed above all other content but the caller is inside another Navigator.

The isDismissible parameter specifies whether the bottom sheet will be dismissed when user taps on the scrim.

The optional backgroundColor, elevation, shape, and clipBehavior parameters can be passed in to customize the appearance and behavior of modal bottom sheets.

Returns a Future that resolves to the value (if any) that was passed to Navigator.pop when the modal bottom sheet was closed.

See also:

Implementation

Future<T> showRModalBottomSheet<T>({
  @required WidgetBuilder builder,
  Color backgroundColor,
  double elevation,
  ShapeBorder shape,
  Clip clipBehavior,
  bool isScrollControlled = false,
  bool isDismissible = true,
}) {
  BuildContext context = RRouter.context;
  assert(builder != null);
  assert(isScrollControlled != null);
  assert(isDismissible != null);
  assert(debugCheckHasMediaQuery(context));
  assert(debugCheckHasMaterialLocalizations(context));

  return RRouter.navigator.push(_ModalBottomSheetRoute<T>(
    builder: builder,
    theme: Theme.of(context, shadowThemeOnly: true),
    isScrollControlled: isScrollControlled,
    barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
    backgroundColor: backgroundColor,
    elevation: elevation,
    shape: shape,
    clipBehavior: clipBehavior,
    isDismissible: isDismissible,
  ));
}