showDialog<T> method

Future<T?> showDialog<T>({
  1. required WidgetBuilder builder,
  2. bool barrierDismissible = true,
  3. Color? barrierColor,
  4. String? barrierLabel,
  5. bool useSafeArea = true,
  6. bool useRootNavigator = true,
  7. RouteSettings? routeSettings,
})

Shows a modal dialog bound to this BuildContext's navigator and theme.

Implementation

Future<T?> showDialog<T>({
  required WidgetBuilder builder,
  bool barrierDismissible = true,
  Color? barrierColor,
  String? barrierLabel,
  bool useSafeArea = true,
  bool useRootNavigator = true,
  RouteSettings? routeSettings,
}) {
  return showGeneralDialog<T>(
    context: this,
    pageBuilder: (buildContext, animation, secondaryAnimation) {
      final widget = builder(buildContext);
      return useSafeArea ? SafeArea(child: widget) : widget;
    },
    barrierDismissible: barrierDismissible,
    barrierColor: barrierColor ?? const Color(0x80000000),
    barrierLabel: barrierLabel,
    useRootNavigator: useRootNavigator,
    routeSettings: routeSettings,
  );
}