diff --git a/app/lib/screens/identity_verification_screen.dart b/app/lib/screens/identity_verification_screen.dart index 0d1c881b..d544b05b 100644 --- a/app/lib/screens/identity_verification_screen.dart +++ b/app/lib/screens/identity_verification_screen.dart @@ -217,6 +217,11 @@ class _IdentityVerificationScreenState } }); }); + getSpending().then((mySpending) => { + setState(() { + spending = mySpending; + }) + }); } @override @@ -1617,18 +1622,23 @@ class _IdentityVerificationScreenState phoneSendDialog(context); } - Future getSpending() async { + Future getSpending() async { try { - final mySpending = await getMySpending(); - setState(() { - spending = mySpending; - }); + return await getMySpending(); } catch (e) { - const loadingSpendingFailure = SnackBar( - content: Text('Failed to load user spending'), - duration: Duration(seconds: 1), + final loadingSpendingFailure = SnackBar( + content: Text( + 'Failed to load user spending', + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(color: Theme.of(context).colorScheme.errorContainer), + ), + duration: Duration(seconds: 2), ); + ScaffoldMessenger.of(context).clearSnackBars(); ScaffoldMessenger.of(context).showSnackBar(loadingSpendingFailure); + return 0.0; } } } diff --git a/app/lib/screens/main_screen.dart b/app/lib/screens/main_screen.dart index 988b4240..75bc7daa 100644 --- a/app/lib/screens/main_screen.dart +++ b/app/lib/screens/main_screen.dart @@ -186,13 +186,22 @@ class _AppState extends State { print(mounted); Navigator.of(context).popUntil((route) => route.isFirst); + updateMessage = 'Fetching user data'; + setState(() {}); try { await loadTwinId(); } catch (e) { - const loadingTwinFailure = SnackBar( - content: Text('Failed to load twin information'), - duration: Duration(seconds: 1), + final loadingTwinFailure = SnackBar( + content: Text( + 'Failed to load twin information', + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(color: Theme.of(context).colorScheme.errorContainer), + ), + duration: Duration(seconds: 2), ); + ScaffoldMessenger.of(context).clearSnackBars(); ScaffoldMessenger.of(context).showSnackBar(loadingTwinFailure); print('Failed to load twin information due to $e'); }