From 3100dc512608aa2881c985867384f06b62fe9b62 Mon Sep 17 00:00:00 2001 From: poka Date: Sat, 20 Aug 2022 22:46:21 +0200 Subject: [PATCH] fix: bad rendering canCert if identity is created --- lib/providers/substrate_sdk.dart | 9 +++++---- lib/providers/wallets_profiles.dart | 3 +-- lib/screens/wallet_view.dart | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index 377dc21..13a85cf 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -231,6 +231,8 @@ class SubstrateSdk with ChangeNotifier { Future> certState(String from, String to) async { Map result = {}; + final toStatus = await idtyStatus(to); + if (from != to && await isMemberGet(from)) { final removableOn = await getCertValidityPeriod(from, to); final certMeta = await getCertMeta(from); @@ -244,15 +246,14 @@ class SubstrateSdk with ChangeNotifier { } else if (nextIssuableOn > blocNumber) { final certDelayDuration = (nextIssuableOn - blocNumber) * 6; result.putIfAbsent('certDelay', () => certDelayDuration); + } else if (toStatus == 'Created') { + result.putIfAbsent('toStatus', () => 1); } else { result.putIfAbsent('canCert', () => 0); } } - final toStatus = await idtyStatus(to); - // log.d('certMeta: $toStatus'); - - if (toStatus == 'Created') result.putIfAbsent('toStatus', () => 1); + // if (toStatus == 'Created') result.putIfAbsent('toStatus', () => 1); return result; } diff --git a/lib/providers/wallets_profiles.dart b/lib/providers/wallets_profiles.dart index f1fcc50..ce181c5 100644 --- a/lib/providers/wallets_profiles.dart +++ b/lib/providers/wallets_profiles.dart @@ -138,10 +138,9 @@ class WalletsProfilesProvider with ChangeNotifier { Provider.of(context, listen: false); // SubstrateSdk _sub = Provider.of(context, listen: false); - bool isAccountExist = balanceCache[address] != 0; - return Stack(children: [ Consumer(builder: (context, sub, _) { + bool isAccountExist = balanceCache[address] != 0; return Container( height: 180, decoration: BoxDecoration( diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 994cdec..bbe47d7 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -270,8 +270,8 @@ class WalletViewScreen extends StatelessWidget { fontSize: buttonFontSize, fontWeight: FontWeight.w500), ), - ]), - if (toStatus == 1) + ]) + else if (toStatus == 1) waitToCert('mustConfirmHisIdentity', duration) else if (snapshot.data!['certRenewable'] != null && duration != 'seconds'.tr(args: ['0'])) diff --git a/pubspec.yaml b/pubspec.yaml index 0be3548..2becac7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: Pay with G1. # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.9+24 +version: 0.0.10+26 environment: sdk: '>=2.12.0 <3.0.0'