show<T> method

Future<T?> show<T>({
  1. dynamic title,
  2. dynamic content,
  3. List<Widget>? actions,
  4. bool barrierDismissible = false,
  5. Widget? close,
})

title: Must be a String or Widget. Defaults to ''.

content: Must be a String or Widget. Defaults to ''.

actions: The set of actions that are displaed at bottom of the dialog,

Typically this is a list of BeautifulPopup.button. Defaults to [].

barrierDismissible: Determine whether this dialog can be dismissed. Default to False.

close: Close widget.

Implementation

Future<T?> show<T>({
  dynamic title,
  dynamic content,
  List<Widget>? actions,
  bool barrierDismissible = false,
  Widget? close,
}) {
  this.title = title;
  this.content = content;
  this.actions = actions;
  this.barrierDismissible = barrierDismissible;
  this.close = close ?? instance.close;
  final child = WillPopScope(
    onWillPop: () {
      return Future.value(barrierDismissible);
    },
    child: instance,
  );
  return showGeneralDialog<T>(
    barrierColor: Colors.black38,
    barrierDismissible: barrierDismissible,
    barrierLabel: barrierDismissible ? 'beautiful_popup' : null,
    context: context,
    pageBuilder: (context, animation1, animation2) {
      return child;
    },
    transitionDuration: Duration(milliseconds: 150),
    transitionBuilder: (ctx, a1, a2, child) {
      return Transform.scale(
        scale: a1.value,
        child: Opacity(
          opacity: a1.value,
          child: child,
        ),
      );
    },
  );
}