solyanka iz fix for payout page design, ledger wallet now clickable
This commit is contained in:
@@ -13,6 +13,7 @@ class WalletTransactionsProvider extends ChangeNotifier {
|
||||
bool _isLoading = false;
|
||||
String? _error;
|
||||
String? _walletId;
|
||||
int _loadSeq = 0;
|
||||
|
||||
List<WalletTransaction> get transactions => List.unmodifiable(_transactions);
|
||||
bool get isLoading => _isLoading;
|
||||
@@ -20,18 +21,28 @@ class WalletTransactionsProvider extends ChangeNotifier {
|
||||
String? get walletId => _walletId;
|
||||
|
||||
Future<void> load({String? walletId}) async {
|
||||
final targetWalletId = walletId ?? _walletId;
|
||||
final requestSeq = ++_loadSeq;
|
||||
_walletId = targetWalletId;
|
||||
_isLoading = true;
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
_walletId = walletId ?? _walletId;
|
||||
_transactions = await _service.fetchHistory(walletId: _walletId);
|
||||
final fetched = await _service.fetchHistory(walletId: targetWalletId);
|
||||
if (requestSeq != _loadSeq) return;
|
||||
|
||||
_transactions = targetWalletId == null
|
||||
? fetched
|
||||
: fetched.where((tx) => tx.walletId == targetWalletId).toList();
|
||||
} catch (e) {
|
||||
if (requestSeq != _loadSeq) return;
|
||||
_error = e.toString();
|
||||
} finally {
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
if (requestSeq == _loadSeq) {
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user