showDialog<T> function Null safety

  1. @Deprecated('Use `Asuka.showDialog` instead')
Future<T?> showDialog<T>(
  1. {required WidgetBuilder builder,
  2. bool barrierDismissible = true,
  3. Color? barrierColor,
  4. bool useSafeArea = true,
  5. bool useRootNavigator = true,
  6. RouteSettings? routeSettings,
  7. bool callback = false}
)

Displays a Material dialog above the current contents of the app, with Material entrance and exit animations, modal barrier color, and modal barrier behavior (dialog is dismissible with a tap on the barrier).

This function takes a builder which typically builds a Dialog widget. Content below the dialog is dimmed with a ModalBarrier. The widget returned by the builder does not share a context with the location that showDialog is originally called from. Use a StatefulBuilder or a custom StatefulWidget if the dialog needs to update dynamically.

The child argument is deprecated, and should be replaced with builder.

The context argument is used to look up the Navigator and Theme for the dialog. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the dialog is closed.

The barrierDismissible argument is used to indicate whether tapping on the barrier will dismiss the dialog. It is true by default and can not be null.

The barrierColor argument is used to specify the color of the modal barrier that darkens everything the dialog. If null the default color Colors.black54 is used.

The useSafeArea argument is used to indicate if the dialog should only display in 'safe' areas of the screen not used by the operating system (see SafeArea for more details). It is true by default which will mean the dialog will not overlap operating system areas. If it is set to false the dialog will only be constrained by the screen size. It can not be 'null. TheuseRootNavigatorargument is used to determine whether to push the dialog to the [Navigator] furthest from or nearest to the givencontext. By default,useRootNavigatoristrueand the dialog route created by this method is pushed to the root navigator. It can not benull`.

The routeSettings argument is passed to showGeneralDialog, see RouteSettings for details.

If the application has multiple Navigator objects, it may be necessary to call Navigator.of(context, rootNavigator: true).pop(result) to close the dialog rather than just Navigator.pop(context, result).

Returns a Future that resolves to the value (if any) that was passed to Navigator.pop when the dialog was closed.

See also:

Implementation

//
/// The `useRootNavigator` argument is used to determine whether to push the
/// dialog to the [Navigator] furthest from or nearest to the given `context`.
/// By default, `useRootNavigator` is `true` and the dialog route created by
/// this method is pushed to the root navigator. It can not be `null`.
///
/// The `routeSettings` argument is passed to [showGeneralDialog],
/// see [RouteSettings] for details.
///
/// If the application has multiple [Navigator] objects, it may be necessary to
/// call `Navigator.of(context, rootNavigator: true).pop(result)` to close the
/// dialog rather than just `Navigator.pop(context, result)`.
///
/// Returns a [Future] that resolves to the value (if any) that was passed to
/// [Navigator.pop] when the dialog was closed.
///
/// See also:
///
///  * [AlertDialog], for dialogs that have a row of buttons below a body.
///  * [SimpleDialog], which handles the scrolling of the contents and does
///    not show buttons below its body.
///  * [Dialog], on which [SimpleDialog] and [AlertDialog] are based.
///  * [showCupertinoDialog], which displays an iOS-style dialog.
///  * [showGeneralDialog], which allows for customization of the dialog popup.
///  * <https://material.io/design/components/dialogs.html>
@Deprecated('Use `Asuka.showDialog` instead')
Future<T?> showDialog<T>(
    {required WidgetBuilder builder,
    bool barrierDismissible = true,
    Color? barrierColor,
    bool useSafeArea = true,
    bool useRootNavigator = true,
    RouteSettings? routeSettings,
    bool callback = false}) {
  return Asuka.showDialog(
    builder: builder,
    barrierColor: barrierColor,
    barrierDismissible: barrierDismissible,
    callback: callback,
    routeSettings: routeSettings,
    useRootNavigator: useRootNavigator,
    useSafeArea: useSafeArea,
  );
}