generalDialog<T> method

Future<T?> generalDialog<T>({
  1. required RoutePageBuilder pageBuilder,
  2. bool barrierDismissible = false,
  3. String? barrierLabel,
  4. Color barrierColor = const Color(0x80000000),
  5. Duration transitionDuration = const Duration(milliseconds: 200),
  6. RouteTransitionsBuilder? transitionBuilder,
  7. GlobalKey<NavigatorState>? navigatorKey,
  8. RouteSettings? routeSettings,
  9. String? id,
})

Api from showGeneralDialog with no context

Implementation

Future<T?> generalDialog<T>(
    {required RoutePageBuilder pageBuilder,
    bool barrierDismissible = false,
    String? barrierLabel,
    Color barrierColor = const Color(0x80000000),
    Duration transitionDuration = const Duration(milliseconds: 200),
    RouteTransitionsBuilder? transitionBuilder,
    GlobalKey<NavigatorState>? navigatorKey,
    RouteSettings? routeSettings,
    String? id}) {
  assert(!barrierDismissible || barrierLabel != null);
  final key = navigatorKey ?? Get.nestedKey(id)?.navigatorKey;
  final nav = key?.currentState ??
      Navigator.of(overlayContext!,
          rootNavigator:
              true); //overlay context will always return the root navigator
  return nav.push<T>(
    GetDialogRoute<T>(
      pageBuilder: pageBuilder,
      barrierDismissible: barrierDismissible,
      barrierLabel: barrierLabel,
      barrierColor: barrierColor,
      transitionDuration: transitionDuration,
      transitionBuilder: transitionBuilder,
      settings: routeSettings,
    ),
  );
}