Easiest Cupertino Modal Dialog

Last reviewed in January 2020 by Frank Treacy

Here is a fully functional Cupertino modal dialog for your iOS projects:

CupertinoButton(
  color: CupertinoColors.activeBlue,
  child: Text('Open popup'),
  onPressed: () {
    showCupertinoDialog(
      context: context,
      builder: (context) => CupertinoAlertDialog(
        title: Text('My message!'),
        actions: [
          CupertinoDialogAction(
            child: Text('Close'),
            onPressed: () => Navigator.pop(context)
          ),
        ],
      )
    );
  },
)

Would like to see it in action? Hit Run!



The best from the Flutter-verse in 3 minutes or less? Join Snacks!

Delivered twice monthly. No link walls. No spam. EVER.