openCupertinoBottomSheet function
Future
openCupertinoBottomSheet({
- required ChildBuilder builder,
- CupertinoBottomSheetRouteArgs? args,
Implementation
Future openCupertinoBottomSheet({
required ChildBuilder builder,
CupertinoBottomSheetRouteArgs? args,
}) async {
if (cupertinoBottomSheetNavigatorKey.currentState == null) {
throw '''
No navigator state has been found. Add cupertinoBottomSheetNavigatorKey as a
navigatorKey argument of your App initialization
example:
@override
Widget build(BuildContext context) {
return CupertinoBottomSheetRepaintBoundary(
child: MaterialApp(
navigatorKey: cupertinoBottomSheetNavigatorKey,
title: 'Flutter Cupertino Bottom Sheet',
theme: ThemeData(
primarySwatch: Colors.red,
),
home: const TestPage(),
),
);
}
''';
}
return cupertinoBottomSheetNavigatorKey.currentState!.push(
CupertinoBottomSheetRoute(
args: args ??
const CupertinoBottomSheetRouteArgs(
swipeSettings: SwipeSettings(
canCloseBySwipe: true,
),
),
builder: builder,
),
);
}