showSuccessModal method
to show success message of payment to user
Implementation
void showSuccessModal({required BuildContext context, bool success = true}) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
constraints: const BoxConstraints(maxHeight: 190),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
success ? Icons.done_all_rounded : Icons.close_rounded,
color: success ? Colors.green : Colors.red,
size: 40,
),
Text(
success ? "Payment Successful" : "Payment failed",
textAlign: TextAlign.center,
style: TextStyle(
color: success ? Colors.green : Colors.red,
fontSize: 26,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 15,
),
// Ok button to confirm payment status
Row(
children: [
Expanded(
child: Widgets().textButton(
onPressed: () {
Navigator.pop(context);
},
text: getTranslated(context, ["common", "ok"])),
),
],
),
],
),
),
);
});
}