minor bug fixes
This commit is contained in:
@@ -31,6 +31,10 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
String initials = '';
|
||||
String _selectedCurrency = 'USD';
|
||||
|
||||
/// Incremented to force [AccountBalanceWidget] to recreate and re-read
|
||||
/// auth state from disk (e.g. after logout or manual refresh).
|
||||
int _balanceWidgetRefreshKey = 0;
|
||||
|
||||
late AnimationController _providersAnimController;
|
||||
late Animation<Offset> _providersSlideAnimation;
|
||||
late Animation<double> _providersFadeAnimation;
|
||||
@@ -143,6 +147,9 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
}
|
||||
|
||||
Future<void> _onRefresh() async {
|
||||
setState(() {
|
||||
_balanceWidgetRefreshKey++;
|
||||
});
|
||||
await homeController.getAccounts();
|
||||
await homeController.getCategories();
|
||||
await homeController.getProviders(_selectedCurrency);
|
||||
@@ -394,6 +401,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AccountBalanceWidget(
|
||||
key: ValueKey(_balanceWidgetRefreshKey),
|
||||
selectedCurrency: _selectedCurrency,
|
||||
onCurrencySelected: _onCurrencySelected,
|
||||
),
|
||||
@@ -691,6 +699,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
prefs.clear();
|
||||
setState(() {
|
||||
_isLoggedIn = false;
|
||||
_balanceWidgetRefreshKey++;
|
||||
});
|
||||
authState.refresh();
|
||||
setupDataAndTransitions();
|
||||
|
||||
@@ -61,27 +61,6 @@ class _PhoneScreenState extends State<PhoneScreen> {
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
// Pre-fill the email field if it has already been captured.
|
||||
final existingEmail = onboardingController.model.email;
|
||||
if (existingEmail != null && existingEmail.isNotEmpty) {
|
||||
_emailController.text = existingEmail;
|
||||
}
|
||||
// Pre-fill the password field if it has already been captured.
|
||||
final existingPassword = onboardingController.model.password;
|
||||
if (existingPassword != null && existingPassword.isNotEmpty) {
|
||||
_passwordController.text = existingPassword;
|
||||
_confirmPasswordController.text = existingPassword;
|
||||
}
|
||||
// Pre-fill the full name from firstName + lastName if previously captured.
|
||||
final firstName = onboardingController.model.firstName;
|
||||
final lastName = onboardingController.model.lastName;
|
||||
final combined = [
|
||||
if (firstName != null && firstName.isNotEmpty) firstName,
|
||||
if (lastName != null && lastName.isNotEmpty) lastName,
|
||||
].join(' ');
|
||||
if (combined.isNotEmpty) {
|
||||
_fullNameController.text = combined;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -129,14 +130,20 @@ class PayController extends ChangeNotifier {
|
||||
return ApiResponse.failure(model.errorMessage!);
|
||||
}
|
||||
} on DioException catch (e, s) {
|
||||
logger.e(s);
|
||||
if (kDebugMode) {
|
||||
logger.e(e);
|
||||
logger.e(s);
|
||||
}
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
return ApiResponse.failure(
|
||||
"Network error. Please try again or contact support",
|
||||
);
|
||||
} catch (e, s) {
|
||||
logger.e(s);
|
||||
if (kDebugMode) {
|
||||
logger.e(e);
|
||||
logger.e(s);
|
||||
}
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
return ApiResponse.failure(
|
||||
|
||||
Reference in New Issue
Block a user