Add limitation to checkout
This commit is contained in:
parent
52aa043fdb
commit
6622d0340d
1 changed files with 31 additions and 5 deletions
|
@ -74,11 +74,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
|
|||
onPressed: () {
|
||||
checkSessionExist().then((isLoggedIn) {
|
||||
if (isLoggedIn) {
|
||||
submitForm(context).then((statusCode) {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushReplacementNamed(
|
||||
context, '/transactions');
|
||||
});
|
||||
clearCart()
|
||||
.then((value) => showAlertDialog(context));
|
||||
} else {
|
||||
Navigator.pushNamed(context, '/login');
|
||||
}
|
||||
|
@ -107,3 +104,32 @@ class _CheckoutFormState extends State<CheckoutForm> {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
showAlertDialog(BuildContext context) {
|
||||
Widget okButton = TextButton(
|
||||
child: const Text("OK", style: TextStyle(color: Colors.white)),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushReplacementNamed(context, '/products');
|
||||
},
|
||||
);
|
||||
AlertDialog alert = AlertDialog(
|
||||
backgroundColor: const Color(0xff1b1c1e),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
content: const Text(
|
||||
"Coming Soon",
|
||||
style: TextStyle(color: Colors.white70),
|
||||
),
|
||||
actions: [
|
||||
okButton,
|
||||
],
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue