improving error handling
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:qpay/models/responsive_policy.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ContactScreen extends StatelessWidget {
|
||||
const ContactScreen({super.key});
|
||||
@@ -186,7 +187,10 @@ class ContactScreen extends StatelessWidget {
|
||||
title: 'Instagram',
|
||||
subtitle: 'Follow us for updates',
|
||||
onTap: () {
|
||||
// Instagram link will be added later
|
||||
launchUrl(
|
||||
Uri.parse('https://www.instagram.com/velocityafrica/'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -200,7 +204,10 @@ class ContactScreen extends StatelessWidget {
|
||||
title: 'WhatsApp',
|
||||
subtitle: 'Chat with us directly',
|
||||
onTap: () {
|
||||
// WhatsApp link will be added later
|
||||
launchUrl(
|
||||
Uri.parse('https://wa.me/263787770295'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -293,4 +300,4 @@ class ContactScreen extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,13 +170,28 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
|
||||
final apiResponse = await controller.doTransaction();
|
||||
|
||||
if (!apiResponse.isSuccess) {
|
||||
if (context.mounted) {
|
||||
AppSnackBar.showError(
|
||||
context,
|
||||
String errorMessage =
|
||||
controller.model.errorMessage ??
|
||||
apiResponse.error ??
|
||||
"Transaction failed",
|
||||
);
|
||||
apiResponse.error ??
|
||||
"Transaction failed";
|
||||
if (context.mounted) {
|
||||
if (errorMessage.contains(
|
||||
"We can't process that transaction right now",
|
||||
)) {
|
||||
AppSnackBar.show(
|
||||
context,
|
||||
errorMessage,
|
||||
action: SnackBarAction(
|
||||
label: 'Check uptime',
|
||||
textColor: Colors.yellow, // Optional custom styling
|
||||
onPressed: () {
|
||||
context.push('/uptime');
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
AppSnackBar.showError(context, errorMessage);
|
||||
}
|
||||
}
|
||||
} else if (controller.model.status == "SUCCESS" && context.mounted) {
|
||||
context.push('/confirm');
|
||||
|
||||
Reference in New Issue
Block a user