Add limitation to checkout

This commit is contained in:
Moe Poi ~ 2023-11-13 12:24:10 +07:00
parent 52aa043fdb
commit 6622d0340d

View file

@ -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;
},
);
}