import 'package:flutter/material.dart'; class LocationDialog extends StatelessWidget { final successMsg; final onPressed; LocationDialog({@required this.successMsg, required this.onPressed}); @override Widget build(BuildContext context) { return AlertDialog( content: Text("To continue turn on device location, which uses Google's location service"), actions: [ ElevatedButton( onPressed: () { Navigator.pop(context); // Close the dialog }, child: Text('No Thanks'), ), ElevatedButton( onPressed: onPressed, child: Text('Ok'), ), ], ); } }