Answers for "flutter dialog screen class"

7

flutter show dialog

Future<void> _showMyDialog() async {
  return showDialog<void>(
    context: context,
    barrierDismissible: false, // user must tap button!
    builder: (BuildContext context) {
      return AlertDialog(
        title: const Text('AlertDialog Title'),
        content: SingleChildScrollView(
          child: ListBody(
            children: const <Widget>[
              Text('This is a demo alert dialog.'),
              Text('Would you like to approve of this message?'),
            ],
          ),
        ),
        actions: <Widget>[
          TextButton(
            child: const Text('Approve'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}
Posted by: Guest on August-07-2021
1

Flutter AlertDialog Navigator pop black screen

just adding this to the pop of the Dialog 
rootNavigator: true

ex:
Navigator.of(context, rootNavigator: true).pop();
Posted by: Guest on September-19-2021

Browse Popular Code Answers by Language