show method

Future<ResultType?> show({
  1. bool? useRootNavigator,
})

Implementation

Future<ResultType?> show({bool? useRootNavigator}) async {
  final context = this.context ?? Nav.globalContext;
  if (context is StatefulElement && !context.mounted) {
    return null;
  }

  isShown.value = true;
  switch (animation) {
    case NavAni.Left:
    case NavAni.Right:
    case NavAni.Top:
    case NavAni.Bottom:
      return _showDialogWith<ResultType>(
        animation,
        barrierDismissible: barrierDismissible,
        barrierColor: barrierColor,
        barrierLabel: barrierLabel,
        useRootNavigator: useRootNavigator ?? this.useRootNavigator,
        routeSettings: routeSettings,
        anchorPoint: anchorPoint,
        context: context,
        builder: (context) {
          _builderContext.value = context;
          return this;
        },
      );
    case NavAni.Blink:
      return _showDialogWith<ResultType>(
        animation,
        barrierDismissible: barrierDismissible,
        barrierColor: barrierColor,
        barrierLabel: barrierLabel,
        useRootNavigator: useRootNavigator ?? this.useRootNavigator,
        routeSettings: routeSettings,
        anchorPoint: anchorPoint,
        context: context,
        builder: (context) {
          _builderContext.value = context;
          return this;
        },
        durationMs: 0,
      );
    case NavAni.Ripple:
      return _showDialogWith<ResultType>(
        animation,
        barrierDismissible: barrierDismissible,
        barrierColor: barrierColor,
        barrierLabel: barrierLabel,
        useRootNavigator: useRootNavigator ?? this.useRootNavigator,
        routeSettings: routeSettings,
        anchorPoint: anchorPoint,
        context: context,
        builder: (context) {
          _builderContext.value = context;
          return this;
        },
      );
    case NavAni.Fade:
    default:
      return showDialog<ResultType>(
        context: context,
        barrierDismissible: barrierDismissible,
        barrierColor: barrierColor,
        barrierLabel: barrierLabel,
        useSafeArea: useSafeArea,
        useRootNavigator: useRootNavigator ?? this.useRootNavigator,
        routeSettings: routeSettings,
        anchorPoint: anchorPoint,
        builder: (context) {
          _builderContext.value = context;
          return this;
        },
      );
  }
}