Skip to content

Commit

Permalink
WIP: fix refreshing state
Browse files Browse the repository at this point in the history
  • Loading branch information
AlaaElattar committed Jan 16, 2025
1 parent 0262cce commit e2721b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/lib/providers/wallets_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ class WalletsNotifier extends StateNotifier<List<Wallet>> {
}

Future<void> verifyWallet(String walletName) async {
final idenfyServiceUrl = Globals().idenfyServiceUrl;
await _mutex.protect(() async {
final idenfyServiceUrl = Globals().idenfyServiceUrl;
final wallet = state.where((w) => w.name == walletName).firstOrNull;
final updatedVerificationStatus = await getVerificationStatus(
address: wallet!.tfchainAddress, idenfyServiceUrl: idenfyServiceUrl);

if (wallet.verificationStatus != updatedVerificationStatus.status.name) {
wallet.verificationStatus = updatedVerificationStatus.status.name;
} else {}
}
state = [...state];
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/kyc_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ Future<dynamic> showIdentityDetails(BuildContext context, String walletSeed) {
final firstName =
utf8.decode(latin1.encode(data.orgFirstName!));
final lastName = utf8.decode(latin1.encode(data.orgLastName!));
final fullName = '$firstName $lastName';
final fullName = '$lastName $firstName';
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
5 changes: 3 additions & 2 deletions app/lib/widgets/wallets/wallet_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class _WalletCardWidgetState extends ConsumerState<WalletCardWidget> {
Widget build(BuildContext context) {
List<Widget> cardContent = [];
wallets = ref.watch(walletsNotifier);
final wallet = wallets.where((w) => w.name == widget.wallet.name).firstOrNull;
if (widget.wallet.type == WalletType.NATIVE &&
widget.wallet.stellarBalance == '-1') {
cardContent = [
Expand Down Expand Up @@ -173,8 +174,8 @@ class _WalletCardWidgetState extends ConsumerState<WalletCardWidget> {
),
const Spacer(),
Text(
widget.wallet.verificationStatus,
style: widget.wallet.verificationStatus == 'VERIFIED'
wallet!.verificationStatus,
style: wallet.verificationStatus == 'VERIFIED'
? Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
Expand Down

0 comments on commit e2721b6

Please sign in to comment.