Skip to content

Instantly share code, notes, and snippets.

@hamza39460
Last active March 22, 2020 00:56
Show Gist options
  • Save hamza39460/ab68d8f76aec8eefd50183ea8e53c281 to your computer and use it in GitHub Desktop.
Save hamza39460/ab68d8f76aec8eefd50183ea8e53c281 to your computer and use it in GitHub Desktop.
Flutter Alert Dialog for ask User's confirmation
confirmDialog(String clientSecret,PaymentMethod paymentMethod) {
var confirm = AlertDialog(
title: Text("Confirm Payement"),
content: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"Make Payment",
// style: TextStyle(fontSize: 25),
),
Text("Charge amount:\$100")
],
),
),
actions: <Widget>[
new RaisedButton(
child: new Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop();
final snackBar = SnackBar(content: Text('Payment Cancelled'),);
Scaffold.of(context).showSnackBar(snackBar);
},
),
new RaisedButton(
child: new Text('Confirm'),
onPressed: () {
Navigator.of(context).pop();
confirmPayment(clientSecret, paymentMethod); // function to confirm Payment
},
),
],
);
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return confirm;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment