show<T> static method

Future<T?> show<T>(
  1. BuildContext context, {
  2. Widget? title,
  3. Widget? content,
  4. List<UIAction>? actions,
  5. UIAction? cancel,
  6. bool forceAndroid = false,
  7. bool forceIos = false,
})

Implementation

static Future<T?> show<T>(
  BuildContext context, {
  Widget? title,
  Widget? content,
  List<UIAction>? actions,
  UIAction? cancel,
  bool forceAndroid = false,
  bool forceIos = false,
}) {
  ///
  /// Define a generic [IDialog]
  IActionSheet dialogData;

  ///
  /// [dialogData] will be either a [IosDialog] or [AndroidDialog]
  ///
  if ((Platform.isIOS || forceIos || Platform.isMacOS) && !forceAndroid) {
    dialogData = IosActionSheet();
  } else if ((Platform.isAndroid || forceAndroid) && !forceIos) {
    dialogData = AndroidActionSheet();
  } else {
    dialogData = AndroidActionSheet();
  }

  ///
  /// Show Dialog [dialogData]
  ///
  return showCupertinoModalPopup(
    context: context,
    builder: (context) => dialogData.create(
      context,
      title ?? Text('Untitled'),
      content ?? Text('Content missing.'),
      actions ?? [],
      cancel,
    ),
  );
}