show static method

Future<bool?> show(
  1. BuildContext context, {
  2. String? title,
  3. required String message,
  4. String? confirmLabel,
  5. String? cancelLabel,
})

Show the dialog as a route and return the user's choice:

  • true: confirmed
  • false: cancelled
  • null: dismissed by tapping the barrier

Implementation

static Future<bool?> show(
  BuildContext context, {
  String? title,
  required String message,
  String? confirmLabel,
  String? cancelLabel,
}) {
  return Navigator.of(context).push<bool>(
    PageRouteBuilder<bool>(
      opaque: false,
      barrierDismissible: true,
      barrierColor: const Color(0x99000000),
      pageBuilder: (BuildContext context, Animation<double> animation,
          Animation<double> secondaryAnimation) {
        return FadeTransition(
          opacity: animation,
          child: Center(
            child: MiniDialog(
              title: title,
              message: message,
              confirmLabel: confirmLabel,
              cancelLabel: cancelLabel,
            ),
          ),
        );
      },
    ),
  );
}