showCustomSBBModalSheet<T> function
Future<T?>
showCustomSBBModalSheet<T>({
- required BuildContext context,
- required Widget header,
- required Widget child,
- bool useSafeArea = true,
- bool enableDrag = true,
- bool showCloseButton = true,
- Color? backgroundColor,
- BoxConstraints? constraints,
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:
- showSBBModalSheet, which is used to display the modal.
- 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?> showCustomSBBModalSheet<T>({
required BuildContext context,
required Widget header,
required Widget child,
bool useRootNavigator = true,
bool useSafeArea = true,
bool enableDrag = true,
bool showCloseButton = true,
Color? backgroundColor,
BoxConstraints? constraints,
}) {
return showModalBottomSheet<T>(
context: context,
isScrollControlled: true,
backgroundColor: SBBColors.transparent,
useRootNavigator: useRootNavigator,
useSafeArea: useSafeArea,
enableDrag: enableDrag,
constraints: constraints,
builder: (BuildContext context) {
return SBBModalSheet.custom(
header: header,
showCloseButton: showCloseButton,
backgroundColor: backgroundColor,
child: useSafeArea ? _wrapWithBottomSafeArea(child) : child,
);
},
barrierColor: SBBInternal.barrierColor,
);
}