Last active
March 22, 2020 00:56
-
-
Save hamza39460/ab68d8f76aec8eefd50183ea8e53c281 to your computer and use it in GitHub Desktop.
Flutter Alert Dialog for ask User's confirmation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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