fix: bad screen view canCert state
This commit is contained in:
parent
d7731504c7
commit
a28df90c18
|
@ -53,3 +53,5 @@ late int udValue;
|
|||
|
||||
// Indexer
|
||||
late DateTime startBlockchainTime;
|
||||
|
||||
late int currentUdIndex;
|
||||
|
|
|
@ -180,7 +180,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<Map<String, double>> getBalance(String address) async {
|
||||
// log.d('currencyParameters: $currencyParameters');
|
||||
log.d('BALANCE: $address');
|
||||
|
||||
if (!nodeConnected) {
|
||||
return {
|
||||
|
@ -198,13 +198,11 @@ class SubstrateSdk with ChangeNotifier {
|
|||
final Map? idtyData = idtyIndex == null
|
||||
? null
|
||||
: await _getStorage('identity.identities($idtyIndex)');
|
||||
final int currentUdIndex =
|
||||
int.parse(await _getStorage('universalDividend.currentUdIndex()'));
|
||||
final List pastReevals =
|
||||
await _getStorage('universalDividend.pastReevals()');
|
||||
|
||||
// Compute amount of claimable UDs
|
||||
final int unclaimedUds = _computeUnclaimUds(currentUdIndex,
|
||||
final int unclaimedUds = _computeUnclaimUds(
|
||||
idtyData?['data']?['firstEligibleUd'] ?? 0, pastReevals);
|
||||
|
||||
// Calculate transferable and potential balance
|
||||
|
@ -226,8 +224,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return finalBalances;
|
||||
}
|
||||
|
||||
int _computeUnclaimUds(
|
||||
int currentUdIndex, int firstEligibleUd, List pastReevals) {
|
||||
int _computeUnclaimUds(int firstEligibleUd, List pastReevals) {
|
||||
int totalAmount = 0;
|
||||
|
||||
if (firstEligibleUd == 0) return 0;
|
||||
|
@ -256,7 +253,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
final walletData = walletBox.get(address) ?? WalletData(address: address);
|
||||
walletData.isMember = isMember;
|
||||
walletBox.put(address, walletData);
|
||||
notifyListeners();
|
||||
// notifyListeners();
|
||||
return isMember;
|
||||
}
|
||||
|
||||
|
@ -541,7 +538,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
notifyListeners();
|
||||
});
|
||||
|
||||
currentUdIndex =
|
||||
int.parse(await _getStorage('universalDividend.currentUdIndex()'));
|
||||
await getBalanceRatio();
|
||||
|
||||
notifyListeners();
|
||||
|
|
|
@ -94,7 +94,10 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
]);
|
||||
}
|
||||
|
||||
List listWallets = myWalletProvider.listWallets;
|
||||
List<WalletData> listWallets = myWalletProvider.listWallets;
|
||||
listWallets.sort((p1, p2) {
|
||||
return Comparable.compare(p1.number!, p2.number!);
|
||||
});
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
int nTule = 2;
|
||||
|
||||
|
@ -113,7 +116,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
crossAxisSpacing: 0,
|
||||
mainAxisSpacing: 0,
|
||||
children: <Widget>[
|
||||
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||
for (WalletData repository in listWallets)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: GestureDetector(
|
||||
|
|
|
@ -270,10 +270,8 @@ class ImportG1v1 extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
sub.migrateCsToV2(
|
||||
sub.csSalt.text,
|
||||
sub.csPassword.text,
|
||||
selectedWallet.address,
|
||||
sub.migrateCsToV2(sub.csSalt.text,
|
||||
sub.csPassword.text, selectedWallet.address,
|
||||
destPassword:
|
||||
pin ?? myWalletProvider.pinCode,
|
||||
balance: balance,
|
||||
|
|
|
@ -26,7 +26,6 @@ class SearchScreen extends StatelessWidget {
|
|||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
||||
appBar: AppBar(
|
||||
elevation: 1,
|
||||
toolbarHeight: 60 * ratio,
|
||||
|
|
|
@ -41,13 +41,13 @@ class WalletViewScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
WalletsProfilesProvider walletProfile =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
walletProfile.address = address;
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
||||
walletProfile.address = address;
|
||||
sub.setCurrentWallet(defaultWallet);
|
||||
|
||||
log.d('aaaaaaaaaaaaaaaaaaa: $username');
|
||||
|
@ -157,8 +157,6 @@ class WalletViewScreen extends StatelessWidget {
|
|||
]),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
final duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
return FutureBuilder(
|
||||
future: sub.certState(defaultWallet.address, address),
|
||||
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
||||
|
|
Loading…
Reference in New Issue