show<T> method

Future<T> show<T>(
  1. BuildContext context,
  2. {@required AdaptiveState adaptiveState,
  3. Widget title,
  4. Widget content,
  5. List<AdaptiveAlertDialogButton> actions}
)

Show the dialog, having title and content set. Also, you can set actions. To get a type or data returned, use T to set. A Future is returned.

Implementation

static Future<T> show<T>(BuildContext context,
    {@required AdaptiveState adaptiveState,
    Widget title,
    Widget content,
    List<AdaptiveAlertDialogButton> actions}) {
  assert(
      (adaptiveState == AdaptiveState.Cupertino && actions != null) ||
          adaptiveState == AdaptiveState.Material,
      'It is recommended to provide buttons on Cupertino styled alerts, because iOS devices have no native "back" button like Android devices do. You can of course provide an empty array via []');
  return adaptiveState == AdaptiveState.Material
      ? showDialog<T>(
          context: context,
          builder: (_) => AdaptiveAlertDialog(
            title: title,
            content: content,
            actions: actions ?? [],
          ),
        )
      : showCupertinoDialog<T>(
          context: context,
          builder: (_) => AdaptiveAlertDialog(
            title: title,
            content: content,
            actions: actions ?? [],
          ),
        );
}