showDialog<T> method

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

推入一个可撤销的dialog

Implementation

Future<T?> showDialog<T>({
  required WidgetBuilder builder,
  Cancellable? cancellable,
  bool barrierDismissible = true,
  Color? barrierColor = Colors.black54,
  String? barrierLabel,
  bool useSafeArea = true,
  bool useRootNavigator = true,
  RouteSettings? routeSettings,
  Offset? anchorPoint,
  // TraversalEdgeBehavior? traversalEdgeBehavior,
}) {
  assert(debugCheckHasMaterialLocalizations(context));

  final CapturedThemes themes = InheritedTheme.capture(
    from: context,
    to: context,
  );

  final route = DialogRoute<T>(
    context: context,
    builder: builder,
    barrierColor: barrierColor,
    barrierDismissible: barrierDismissible,
    barrierLabel: barrierLabel,
    useSafeArea: useSafeArea,
    settings: routeSettings,
    themes: themes,
    anchorPoint: anchorPoint,
    // traversalEdgeBehavior:
    //     traversalEdgeBehavior ?? TraversalEdgeBehavior.closedLoop,
  );
  return pushCancellableRoute(route, cancellable);
}