dialogResponsive<T> static method

Future<T?> dialogResponsive<T>({
  1. required Widget child,
  2. Widget? title,
  3. bool barrierDismissible = true,
  4. bool useRootNavigator = true,
  5. Color? barrierColor,
  6. RouteSettings? settings,
  7. VoidCallback? onDismiss,
  8. double initialChildSize = 0.5,
  9. double minChildSize = 0.25,
  10. double maxChildSize = 0.9,
  11. bool expand = false,
})

Implementation

static Future<T?> dialogResponsive<T>({
  required Widget child,
  Widget? title,
  bool barrierDismissible = true,
  bool useRootNavigator = true,
  Color? barrierColor,
  RouteSettings? settings,
  VoidCallback? onDismiss,
  double initialChildSize = 0.5,
  double minChildSize = 0.25,
  double maxChildSize = 0.9,
  bool expand = false,
}) {
  if (UApp.isMobileSize()) {
    return showModalBottomSheet<T>(
      context: navigatorKey.currentContext!,
      isScrollControlled: true,
      useRootNavigator: useRootNavigator,
      builder: (BuildContext context) => DraggableScrollableSheet(
        expand: expand,
        initialChildSize: initialChildSize,
        minChildSize: minChildSize,
        maxChildSize: maxChildSize,
        builder: (BuildContext context, ScrollController controller) => UScaffold(
          appBar: AppBar(title: title),
          body: SingleChildScrollView(controller: controller, child: child),
        ),
      ),
    ).then((T? value) {
      onDismiss?.call();
      return value;
    });
  }
  return dialog(
    AlertDialog(title: title, content: child),
    barrierDismissible: barrierDismissible,
    useRootNavigator: useRootNavigator,
    barrierColor: barrierColor,
    settings: settings,
    onDismiss: onDismiss,
  );
}