showGeneralDialog<T> function

Future<T> showGeneralDialog <T>(
  1. {@required BuildContext context,
  2. @required RoutePageBuilder pageBuilder,
  3. bool barrierDismissible,
  4. String barrierLabel,
  5. Color barrierColor,
  6. Duration transitionDuration,
  7. RouteTransitionsBuilder transitionBuilder,
  8. bool useRootNavigator: true,
  9. RouteSettings routeSettings}

Displays a dialog above the current contents of the app.

This function allows for customization of aspects of the dialog popup.

This function takes a pageBuilder which is used to build the primary content of the route (typically a dialog widget). Content below the dialog is dimmed with a ModalBarrier. The widget returned by the pageBuilder does not share a context with the location that showGeneralDialog is originally called from. Use a StatefulBuilder or a custom StatefulWidget if the dialog needs to update dynamically. The pageBuilder argument can not be null.

The context argument is used to look up the Navigator 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 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.

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).

The barrierDismissible argument is used to determine whether this route can be dismissed by tapping the modal barrier. This argument defaults to true. If barrierDismissible is true, a non-null barrierLabel must be provided.

The barrierLabel argument is the semantic label used for a dismissible barrier. This argument defaults to "Dismiss".

The barrierColor argument is the color used for the modal barrier. This argument defaults to Color(0x80000000).

The transitionDuration argument is used to determine how long it takes for the route to arrive on or leave off the screen. This argument defaults to 200 milliseconds.

The transitionBuilder argument is used to define how the route arrives on and leaves off the screen. By default, the transition is a linear fade of the page's contents.

The routeSettings will be used in the construction of the dialog's route. See RouteSettings for more details.

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

See also:


Future<T> showGeneralDialog<T>({
  @required BuildContext context,
  @required RoutePageBuilder pageBuilder,
  bool barrierDismissible,
  String barrierLabel,
  Color barrierColor,
  Duration transitionDuration,
  RouteTransitionsBuilder transitionBuilder,
  bool useRootNavigator = true,
  RouteSettings routeSettings,
}) {
  assert(pageBuilder != null);
  assert(useRootNavigator != null);
  assert(!barrierDismissible || barrierLabel != null);
  return Navigator.of(context, rootNavigator: useRootNavigator).push<T>(_DialogRoute<T>(
    pageBuilder: pageBuilder,
    barrierDismissible: barrierDismissible,
    barrierLabel: barrierLabel,
    barrierColor: barrierColor,
    transitionDuration: transitionDuration,
    transitionBuilder: transitionBuilder,
    settings: routeSettings,