Answers for "cupertinoalertbox flutter example"

0

cupertinoalertbox flutter example

Future<void> _handleClickMe() async {
  return showDialog<void>(
    context: context,
    barrierDismissible: false, // user must tap button!
    builder: (BuildContext context) {
      return CupertinoAlertDialog(
        title: Text('Allow "Maps" to access your location while you use the app?'),
        content: Text('Your current location will be displayed on the map and used for directions, nearby search results, and estimated travel times.'),
        actions: <Widget>[
          CupertinoDialogAction(
            child: Text('Don\'t Allow'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
          CupertinoDialogAction(
            child: Text('Allow'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}

@override
Widget build(BuildContext context) {
  return FlatButton(
    onPressed: () {
      _handleClickMe();
    },
    child: Text(
      "CLICK ME!",
    ),
  );
}
Posted by: Guest on December-14-2020

Code answers related to "Dart"

Browse Popular Code Answers by Language