show<T> static method

Future<T?> show<T>(
  1. BuildContext context,
  2. TModalWidgetBuilder<T> builder, {
  3. TModalWidgetBuilder? header,
  4. TModalWidgetBuilder? footer,
  5. bool persistent = false,
  6. double width = 500,
  7. String? title,
  8. bool? showCloseButton,
})

Implementation

static Future<T?> show<T>(
  BuildContext context,
  TModalWidgetBuilder<T> builder, {
  TModalWidgetBuilder? header,
  TModalWidgetBuilder? footer,
  bool persistent = false,
  double width = 500,
  String? title,
  bool? showCloseButton,
}) {
  final colors = context.colors;

  return showDialog<T>(
    context: context,
    barrierDismissible: persistent,
    barrierColor: colors.scrim,
    builder: (BuildContext dialogContext) {
      final mContext = TModalContext<T>(dialogContext);

      return TModal(
        builder.call(mContext),
        header: header?.call(mContext),
        footer: footer?.call(mContext),
        persistent: persistent,
        width: width,
        title: title,
        showCloseButton: showCloseButton,
        onClose: () {
          Navigator.of(dialogContext).pop();
        },
      );
    },
  );
}