showSBBModalSheet<T> function
Future<T?>
showSBBModalSheet<T>({
- required BuildContext context,
- required String title,
- required Widget child,
- bool useSafeArea = true,
- bool enableDrag = true,
- bool showCloseButton = true,
- BoxConstraints? constraints,
- Color? backgroundColor,
Shows an SBB Modal Sheet. Use according to documentation.
If you try to close the sheet but the underlying page is navigated back
instead, try using the rootNavigator
parameter of the Navigator
:
Navigator.of(context, rootNavigator: true).pop(result)
See also:
- showCustomSBBModalSheet, variant for custom modal sheet.
- SBBModalSheet, which will be displayed.
- showModalBottomSheet, which is used to display the modal.
- digital.sbb.ch/en/design-system/mobile/components/modal-view/
Implementation
Future<T?> showSBBModalSheet<T>({
required BuildContext context,
required String title,
required Widget child,
bool useRootNavigator = true,
bool useSafeArea = true,
bool enableDrag = true,
bool showCloseButton = true,
BoxConstraints? constraints,
Color? backgroundColor,
}) {
return showModalBottomSheet<T>(
context: context,
isScrollControlled: true,
backgroundColor: SBBColors.transparent,
useRootNavigator: useRootNavigator,
useSafeArea: useSafeArea,
enableDrag: enableDrag,
constraints: constraints,
builder: (BuildContext context) {
return SBBModalSheet(
title: title,
showCloseButton: showCloseButton,
backgroundColor: backgroundColor,
child: useSafeArea ? _wrapWithBottomSafeArea(child) : child,
);
},
barrierColor: SBBInternal.barrierColor,
);
}