showCupertinoModalPopup<T> function
- required BuildContext context,
- required WidgetBuilder builder,
- ImageFilter? filter,
- Color barrierColor = _kModalBarrierColor,
- bool barrierDismissible = true,
- bool? semanticsDismissible,
- RouteSettings? routeSettings,
Shows a modal iOS-style popup that slides up from the bottom of the screen.
Such a popup is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app.
The context
argument is used to look up the Navigator for the popup.
It is only used when the method is called. Its corresponding widget can be
safely removed from the tree before the popup is closed.
The barrierColor
argument determines the Color of the barrier underneath
the popup. When unspecified, the barrier color defaults to a light opacity
black scrim based on iOS's dialog screens.
The barrierDismissible
argument determines whether clicking outside the
popup results in dismissal. It is true
by default.
The useRootNavigator
argument is used to determine whether to push the
popup to the Navigator furthest from or nearest to the given context
. It
is false
by default.
The semanticsDismissible
argument is used to determine whether the
semantics of the modal barrier are included in the semantics tree.
The routeSettings
argument is used to provide RouteSettings to the
created Route.
The builder
argument typically builds a CupertinoActionSheet widget.
Content below the widget is dimmed with a ModalBarrier. The widget built
by the builder
does not share a context with the location that
showCupertinoModalPopup
is originally called from. Use a
StatefulBuilder or a custom StatefulWidget if the widget needs to
update dynamically.
Returns a Future
that resolves to the value that was passed to
Navigator.pop when the popup was closed.
See also:
- CupertinoActionSheet, which is the widget usually returned by the
builder
argument to showCupertinoModalPopup. - developer.apple.com/design/human-interface-guidelines/ios/views/action-sheets/
Implementation
Future<T?> showCupertinoModalPopup<T>({
required BuildContext context,
required WidgetBuilder builder,
ImageFilter? filter,
Color barrierColor = _kModalBarrierColor,
bool barrierDismissible = true,
bool useRootNavigator = true,
bool? semanticsDismissible,
RouteSettings? routeSettings,
}) {
assert(useRootNavigator != null);
return Navigator.of(context, rootNavigator: useRootNavigator).push(
_CupertinoModalPopupRoute<T>(
barrierColor: CupertinoDynamicColor.resolve(barrierColor, context),
barrierDismissible: barrierDismissible,
barrierLabel: 'Dismiss',
builder: builder,
filter: filter,
semanticsDismissible: semanticsDismissible,
settings: routeSettings,
),
);
}