show<T> static method

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

Implementation

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

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

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