showFormSheet<T> function

Future<T?> showFormSheet<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. SheetProps props = const SheetProps(),
})

Opens a form: a bottom sheet in the mobile layout, and elsewhere a card centered over the navigator, as iPad and macOS present a form sheet.

Implementation

Future<T?> showFormSheet<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  SheetProps props = const SheetProps(),
}) {
  if (context.isMobileView) {
    return _showBottomSheet<T>(context, builder: builder, props: props);
  }
  final navigator = sheetNavigatorOf(context);
  return navigator.push(
    FormSheetRoute<T>(
      builder: builder,
      backgroundColor: props.backgroundColor,
      barrierColor: context.colorScheme.modalScrim,
      barrierLabel: UiLocalizations.of(context).close,
    ),
  );
}