diff --git a/lib/globals.dart b/lib/globals.dart index 8fa51264fc8352725e9a85f55d83b1d744fbf2a9..535f94474b23df6bf0fe151e972576d21088785f 100644 --- a/lib/globals.dart +++ b/lib/globals.dart @@ -52,7 +52,7 @@ const String currencyName = 'ĞD'; const debugPin = false; String indexerEndpoint = ''; -late double balanceRatio; +late int balanceRatio; late int udValue; // Indexer diff --git a/lib/models/transaction.dart b/lib/models/transaction.dart index a74649bc1c5affbd114e6e217106449765883aab..dcb014e54c2a754c4e8c2fc78b4eb60309be837e 100644 --- a/lib/models/transaction.dart +++ b/lib/models/transaction.dart @@ -2,7 +2,7 @@ class Transaction { final DateTime timestamp; final String address; final String username; - final double amount; + final int amount; final String comment; final bool isReceived; diff --git a/lib/providers/duniter_indexer.dart b/lib/providers/duniter_indexer.dart index 7891b545c9e07bdfb225aefd57f7d89bf76470b5..34b795be196f17ad453b50f0b036fb79ea7ff933 100644 --- a/lib/providers/duniter_indexer.dart +++ b/lib/providers/duniter_indexer.dart @@ -8,7 +8,6 @@ import 'package:gecko/globals.dart'; import 'package:gecko/models/queries_indexer.dart'; import 'package:gecko/providers/home.dart'; import 'package:gecko/providers/substrate_sdk.dart'; -import 'package:gecko/utils.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:provider/provider.dart'; import 'package:gecko/models/transaction.dart'; @@ -217,8 +216,7 @@ class DuniterIndexer with ChangeNotifier { final isReceived = transaction['fromId'] != address; // Calculate amount - final amountBrut = transaction['amount']; - final amount = removeDecimalZero(amountBrut / 100); + final amount = transaction['amount'] as int; final comment = transaction['comment']?['remark'] ?? ''; final commentType = transaction['comment']?['type'] ?? ''; @@ -279,11 +277,6 @@ class DuniterIndexer with ChangeNotifier { return opts; } - double removeDecimalZero(double n) { - String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 2); - return double.parse(result); - } - //// Manuals queries Future<bool> isIdtyExist(String name) async { @@ -327,9 +320,6 @@ class DuniterIndexer with ChangeNotifier { } Map computeHistoryView(Transaction transaction, String address) { - final bool isUdUnit = configBox.get('isUdUnit') ?? false; - late double amount; - late String finalAmount; final DateTime date = transaction.timestamp; final dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, {1, 2, 7, 9}.contains(date.month) ? 4 : 3)}"; @@ -365,19 +355,12 @@ class DuniterIndexer with ChangeNotifier { final dateDelimiter = getDateDelimiter(); - amount = transaction.isReceived ? transaction.amount : transaction.amount * -1; - - if (isUdUnit) { - amount = round(amount / balanceRatio); - finalAmount = 'ud'.tr(args: ['$amount ']); - } else { - finalAmount = '$amount $currencyName'; - } + final amount = transaction.isReceived ? transaction.amount : transaction.amount * -1; bool isMigrationTime = startBlockchainInitialized && date.compareTo(startBlockchainTime) < 0; return { - 'finalAmount': finalAmount, + 'finalAmount': amount, 'isMigrationTime': isMigrationTime, 'dateDelimiter': dateDelimiter, 'dateForm': dateForm, diff --git a/lib/providers/my_wallets.dart b/lib/providers/my_wallets.dart index 2c526be9453822601f79d710af52488c1631cb2e..d42fe8f9ffea4805cb3dcb6fde00e144de5edaa0 100644 --- a/lib/providers/my_wallets.dart +++ b/lib/providers/my_wallets.dart @@ -105,18 +105,7 @@ class MyWalletsProvider with ChangeNotifier { return pinCode.isNotEmpty; } - WalletData? getWalletDataByAddress(String address) { - WalletData? targetedWallet; - - walletBox.toMap().forEach((key, value) { - if (value.address == address) { - targetedWallet = value; - return; - } - }); - - return targetedWallet; - } + WalletData? getWalletDataByAddress(String address) => walletBox.toMap().values.firstWhereOrNull((wallet) => wallet.address == address); WalletData getDefaultWallet([int? chest]) { if (chestBox.isEmpty) { diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index eabafb2a812325ec8280fb8edddd4178775df9a0..beb6e3a58c952871c770eebc3fa51c4103239a23 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -257,18 +257,14 @@ class SubstrateSdk with ChangeNotifier { return !(consumers == 0); } - Future<int> getUdValue() async { - udValue = int.parse(await _getStorage('universalDividend.currentUd()')); - return udValue; - } + Future<int> getUdValue() async => int.parse(await _getStorage('universalDividend.currentUd()')); - Future<double> getBalanceRatio() async { + Future<int> getBalanceRatio() async { udValue = await getUdValue(); - balanceRatio = (configBox.get('isUdUnit') ?? false) ? round(udValue / 100, 6) : 1; - return balanceRatio; + return balanceRatio = (configBox.get('isUdUnit') ?? false) ? udValue : 1; } - Future<Map<String, Map<String, double>>> getBalanceMulti(List<String> addresses) async { + Future<Map<String, Map<String, int>>> getBalanceMulti(List<String> addresses) async { List stringifyAddresses = []; for (var element in addresses) { stringifyAddresses.add('"$element"'); @@ -288,7 +284,7 @@ class SubstrateSdk with ChangeNotifier { .toList(); int nbr = 0; - Map<String, Map<String, double>> finalBalancesList = {}; + Map<String, Map<String, int>> finalBalancesList = {}; for (Map account in accountMulti) { final computedBalance = await _computeBalance(idtyDataList[nbr], account); finalBalancesList.putIfAbsent(addresses[nbr], () => computedBalance); @@ -298,7 +294,7 @@ class SubstrateSdk with ChangeNotifier { return finalBalancesList; } - Future<Map<String, double>> getBalance(String address) async { + Future<Map<String, int>> getBalance(String address) async { if (!nodeConnected) { return { 'transferableBalance': 0, @@ -316,7 +312,7 @@ class SubstrateSdk with ChangeNotifier { return _computeBalance(idtyData, account); } - Future<Map<String, double>> _computeBalance(Map? idtyData, Map account) async { + Future<Map<String, int>> _computeBalance(Map? idtyData, Map account) async { final List pastReevals = await _getStorage('universalDividend.pastReevals()'); // Compute amount of claimable UDs currentUdIndex = await getCurrentUdIndex(); @@ -333,10 +329,10 @@ class SubstrateSdk with ChangeNotifier { final int transferableBalance = (account['data']['free'] + unclaimedUds); return { - 'transferableBalance': round((transferableBalance / balanceRatio) / 100), - 'free': round((account['data']['free'] / balanceRatio) / 100), - 'unclaimedUds': round((unclaimedUds / balanceRatio) / 100), - 'reserved': round((account['data']['reserved'] / balanceRatio) / 100), + 'transferableBalance': transferableBalance, + 'free': account['data']['free'], + 'unclaimedUds': unclaimedUds, + 'reserved': account['data']['reserved'], }; } @@ -541,7 +537,11 @@ class SubstrateSdk with ChangeNotifier { if (amount == 0) return 0; final sender = await _setSender(fromAddress); final txInfo = TxInfoData('balances', 'transferKeepAlive', sender); - final amountUnit = (amount * 100).toInt(); + final bigAmount = BigInt.from(amount * 100); + if (bigAmount > BigInt.from(9007199254740991)) { + throw Exception('Amount too large for JavaScript safe integer'); + } + final amountUnit = bigAmount.toInt(); final estimateFees = await sdk.api.tx.estimateFees(txInfo, [destAddress, amountUnit]); diff --git a/lib/providers/wallet_options.dart b/lib/providers/wallet_options.dart index 55c4bb419578ec911592a2dc3bb385b5c1157795..d7aaa7291a7c3bb74fd81adcae6a4e61a98f0830 100644 --- a/lib/providers/wallet_options.dart +++ b/lib/providers/wallet_options.dart @@ -30,7 +30,7 @@ class WalletOptionsProvider with ChangeNotifier { final nameController = TextEditingController(); bool isDefaultWallet = false; bool canValidateNameBool = false; - Map<String, double> balanceCache = {}; + Map<String, int> balanceCache = {}; int getPinLenght(walletNbr) { return pinLength; diff --git a/lib/screens/myWallets/wallet_options.dart b/lib/screens/myWallets/wallet_options.dart index bb6687f83c3b06b36b4870d4f21b6811015b458b..f443814f1d43c21f8277be5e42de814bc5a2406c 100644 --- a/lib/screens/myWallets/wallet_options.dart +++ b/lib/screens/myWallets/wallet_options.dart @@ -257,7 +257,7 @@ class WalletOptions extends StatelessWidget { if (hasConsumers.connectionState != ConnectionState.done || hasConsumers.hasError || !hasConsumers.hasData) { return const SizedBox.shrink(); } - final double balance = walletOptions.balanceCache[walletOptions.address.text] ?? -1; + final int balance = walletOptions.balanceCache[walletOptions.address.text] ?? -1; final bool canDelete = !isDefaultWallet && !hasConsumers.data! && (balance > 2 || balance == 0) && !wallet.hasIdentity; return InkWell( key: keyDeleteWallet, diff --git a/lib/screens/myWallets/wallets_home.dart b/lib/screens/myWallets/wallets_home.dart index 3d541bfe90dd89740d098d7ede990ecf2708695e..4279d9e69510d9577169829c54e78d894c59d68c 100644 --- a/lib/screens/myWallets/wallets_home.dart +++ b/lib/screens/myWallets/wallets_home.dart @@ -28,38 +28,12 @@ class WalletsHome extends StatefulWidget { } class _WalletsHomeState extends State<WalletsHome> with SingleTickerProviderStateMixin { - late final AnimationController _controller; - late final Animation<double> _animation; - - @override - void initState() { - super.initState(); - _controller = AnimationController( - duration: const Duration(milliseconds: 150), - vsync: this, - ); - _animation = CurvedAnimation( - parent: _controller, - curve: Curves.easeIn, - ); - _controller.forward(); - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - @override Widget build(BuildContext context) { final myWalletProvider = Provider.of<MyWalletsProvider>(context, listen: false); return Scaffold( - body: FadeTransition( - opacity: _animation, - child: myWalletProvider.listWallets.length == 1 ? WalletOptions(wallet: myWalletProvider.listWallets[0]) : _WalletsHomeContent(), - ), + body: myWalletProvider.listWallets.length == 1 ? WalletOptions(wallet: myWalletProvider.listWallets[0]) : _WalletsHomeContent(), ); } } diff --git a/lib/utils.dart b/lib/utils.dart index fa9ffd36b1f91c653c8717386ad831e449b26c44..233a3e1049c556710e1b3fdd98d9a2ea7642eb82 100644 --- a/lib/utils.dart +++ b/lib/utils.dart @@ -36,3 +36,8 @@ Uint8List int32bytes(int value) => Uint8List(4)..buffer.asInt32List()[0] = value double round(double number, [int decimal = 2]) { return double.parse((number.toStringAsFixed(decimal))); } + +double removeDecimalZero(double n) { + String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 3); + return double.parse(result); +} diff --git a/lib/widgets/balance.dart b/lib/widgets/balance.dart index a107a904fcd4fbc737e264d091cf9d2c64c70a4e..ed13e99fa89148800d4af95d0d2ef21e3403861d 100644 --- a/lib/widgets/balance.dart +++ b/lib/widgets/balance.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:gecko/models/scale_functions.dart'; import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/wallet_options.dart'; -import 'package:gecko/widgets/ud_unit_display.dart'; +import 'package:gecko/widgets/balance_display.dart'; import 'package:provider/provider.dart'; class Balance extends StatelessWidget { @@ -11,50 +10,23 @@ class Balance extends StatelessWidget { final double size; final Color color; - String formatBalance(double value) { - if (value >= 1000000) { - return '${(value / 1000000).toStringAsFixed(1)}M'; - } - return value.toString(); - } - @override Widget build(BuildContext context) { final walletOptions = Provider.of<WalletOptionsProvider>(context, listen: false); return Consumer<SubstrateSdk>(builder: (context, sdk, _) { return FutureBuilder( future: sdk.getBalance(address), - builder: (BuildContext context, AsyncSnapshot<Map<String, double>> globalBalance) { + builder: (BuildContext context, AsyncSnapshot<Map<String, int>> globalBalance) { if (globalBalance.connectionState != ConnectionState.done || globalBalance.hasError || !globalBalance.hasData) { if (walletOptions.balanceCache[address] != null && walletOptions.balanceCache[address] != -1) { - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - formatBalance(walletOptions.balanceCache[address]!), - style: scaledTextStyle(fontSize: size, color: color), - ), - ScaledSizedBox(width: 5), - UdUnitDisplay(size: scaleSize(size), color: color), - ], - ); + return BalanceDisplay(value: walletOptions.balanceCache[address]!, size: size, color: color); } else { return const SizedBox.shrink(); } } walletOptions.balanceCache[address] = globalBalance.data!['transferableBalance']!; if (walletOptions.balanceCache[address] != -1) { - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - formatBalance(walletOptions.balanceCache[address]!), - style: scaledTextStyle(fontSize: size, color: color), - ), - ScaledSizedBox(width: 5), - UdUnitDisplay(size: scaleSize(size), color: color), - ], - ); + return BalanceDisplay(value: walletOptions.balanceCache[address]!, size: size, color: color); } else { return const Text(''); } diff --git a/lib/widgets/balance_display.dart b/lib/widgets/balance_display.dart new file mode 100644 index 0000000000000000000000000000000000000000..604c1ef8e28188f17bc99bd6485d093d7cdcf5b4 --- /dev/null +++ b/lib/widgets/balance_display.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:gecko/globals.dart'; +import 'package:gecko/models/scale_functions.dart'; +import 'package:gecko/widgets/ud_unit_display.dart'; + +class BalanceDisplay extends StatelessWidget { + final int value; + final double size; + final Color color; + final FontWeight fontWeight; + + const BalanceDisplay({ + super.key, + required this.value, + this.size = 16, + this.color = Colors.black, + this.fontWeight = FontWeight.normal, + }); + + double _removeDecimalZero(double n) { + String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 3); + return double.parse(result); + } + + @override + Widget build(BuildContext context) { + final isUdUnit = configBox.get('isUdUnit') ?? false; + final unitRatio = isUdUnit ? 1 : 100; + final valueRatio = _removeDecimalZero((value / balanceRatio) / unitRatio); + + late String finalValue; + if (valueRatio >= 1000000) { + finalValue = '${(valueRatio / 1000000).toStringAsFixed(2)}M'; + } else { + finalValue = valueRatio.toString(); + } + + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + finalValue, + style: scaledTextStyle(fontSize: size, color: color, fontWeight: fontWeight), + ), + ScaledSizedBox(width: 5), + UdUnitDisplay(size: scaleSize(size), color: color, fontWeight: fontWeight), + ], + ); + } +} diff --git a/lib/widgets/payment_popup.dart b/lib/widgets/payment_popup.dart index ff363a6303aa03c368a170f84b2d18ceee9d69e8..f7ab5d1139772525d77d3b4ac1c32f4b25fdc62b 100644 --- a/lib/widgets/payment_popup.dart +++ b/lib/widgets/payment_popup.dart @@ -68,33 +68,28 @@ void paymentPopup(BuildContext context, String toAddress, String? username) { } bool canValidatePayment() { + // Vérification du montant saisi final payAmount = walletViewProvider.payAmount.text; - if (payAmount.isEmpty) { - return false; - } + if (payAmount.isEmpty) return false; + + // Récupération des soldes final walletOptions = Provider.of<WalletOptionsProvider>(context, listen: false); final defaultWalletBalance = walletOptions.balanceCache[defaultWallet.address] ?? 0; + final toAddressBalance = walletOptions.balanceCache[toAddress] ?? 0; - const existentialDeposit = 2; - final double payAmountValue = double.parse(payAmount); - final double toAddressBalance = walletOptions.balanceCache[toAddress] ?? 0; - - // Prevent sending more than the balance with existential deposit - if (payAmountValue / balanceRatio > defaultWalletBalance - existentialDeposit && defaultWalletBalance != payAmountValue) { - return false; - } + // Conversion du montant en unités de base + final int payAmountValue = balanceRatio == 1 ? (double.parse(payAmount) * balanceRatio * 100).round() : (double.parse(payAmount) * balanceRatio).round(); - // Prevent sending to self - if (toAddress == defaultWallet.address) { - return false; - } + //TODO: get real existential deposit value from Duniter storage + const existentialDeposit = 200; - // Prevent sending to an empty wallet with less than 2 (existential deposit) - if (toAddressBalance == 0 && payAmountValue < existentialDeposit / balanceRatio) { - return false; - } + // Vérifications de validité + final bool isAmountValid = payAmountValue > 0; + final bool isNotSendingToSelf = toAddress != defaultWallet.address; + final bool hasEnoughBalance = payAmountValue <= defaultWalletBalance - existentialDeposit || defaultWalletBalance == payAmountValue; + final bool respectsExistentialDeposit = toAddressBalance > 0 || payAmountValue >= existentialDeposit; - return true; + return isAmountValid && isNotSendingToSelf && hasEnoughBalance && respectsExistentialDeposit; } myWalletProvider.readAllWallets().then((value) => myWalletProvider.listWallets.sort((a, b) => (a.derivation ?? -1).compareTo(b.derivation ?? -1))); diff --git a/lib/widgets/transaction_in_progress_tile.dart b/lib/widgets/transaction_in_progress_tile.dart index d33ec1508da80f49b2da9386808ba4c4ed9e25e9..dc5f833b630de7096fe31e23307e8f5dd62dae6e 100644 --- a/lib/widgets/transaction_in_progress_tile.dart +++ b/lib/widgets/transaction_in_progress_tile.dart @@ -11,6 +11,7 @@ import 'package:gecko/utils.dart'; import 'package:gecko/widgets/datapod_avatar.dart'; import 'package:gecko/widgets/transaction_status.dart'; import 'package:gecko/widgets/transaction_status_icon.dart'; +import 'package:gecko/widgets/ud_unit_display.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:provider/provider.dart'; import 'package:fade_and_translate/fade_and_translate.dart'; @@ -153,8 +154,17 @@ class _TransactionInProgressTuleState extends State<TransactionInProgressTule> { ], ], ), - trailing: Text("$finalAmount $currencyName", - style: scaledTextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.blue[700]), textAlign: TextAlign.justify), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + finalAmount.toString(), + style: scaledTextStyle(fontSize: 15, color: Colors.blue[700], fontWeight: FontWeight.w500), + ), + ScaledSizedBox(width: 5), + UdUnitDisplay(size: scaleSize(15), color: Colors.blue[700]!, fontWeight: FontWeight.w500), + ], + ), dense: !isTall, isThreeLine: false), ], diff --git a/lib/widgets/transaction_tile.dart b/lib/widgets/transaction_tile.dart index 989ec0ed43359b879240a6fe415baf9c396b6b18..077c2dd791d88cc4729ba614dc3182d4b00ad94c 100644 --- a/lib/widgets/transaction_tile.dart +++ b/lib/widgets/transaction_tile.dart @@ -5,6 +5,7 @@ import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/screens/wallet_view.dart'; import 'package:gecko/utils.dart'; +import 'package:gecko/widgets/balance_display.dart'; import 'package:gecko/widgets/datapod_avatar.dart'; import 'package:gecko/widgets/page_route_no_transition.dart'; @@ -24,7 +25,7 @@ class TransactionTile extends StatelessWidget { final double avatarSize; final Transaction transaction; final String dateForm; - final String finalAmount; + final int finalAmount; final DuniterIndexer duniterIndexer; final BuildContext context; @@ -130,13 +131,11 @@ class TransactionTile extends StatelessWidget { ], ], ), - trailing: Text( - finalAmount, - style: scaledTextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - color: transaction.isReceived ? const Color(0xFF4CAF50) : const Color(0xFF2196F3), - ), + trailing: BalanceDisplay( + value: finalAmount, + size: scaleSize(15), + color: transaction.isReceived ? const Color(0xFF4CAF50) : const Color(0xFF2196F3), + fontWeight: FontWeight.w500, ), onTap: () { Navigator.push( diff --git a/lib/widgets/ud_unit_display.dart b/lib/widgets/ud_unit_display.dart index f015a382b080be5f1036975c576cefca497751cf..09b0ec31538005d691c5c126b07d509fc193f7fc 100644 --- a/lib/widgets/ud_unit_display.dart +++ b/lib/widgets/ud_unit_display.dart @@ -7,11 +7,12 @@ class UdUnitDisplay extends StatelessWidget { super.key, required this.size, required this.color, + this.fontWeight = FontWeight.normal, }); final double size; final Color color; - + final FontWeight fontWeight; @override Widget build(BuildContext context) { final bool isUdUnit = configBox.get('isUdUnit') ?? false; @@ -21,22 +22,20 @@ class UdUnitDisplay extends StatelessWidget { children: [ Text( 'ud'.tr(args: ['']), - style: TextStyle(fontSize: size, color: color), + style: TextStyle(fontSize: size, color: color, fontWeight: fontWeight), ), Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( currencyName, - style: TextStyle( - fontSize: size * 0.7, - fontWeight: FontWeight.w500, - color: color), + style: TextStyle(fontSize: size * 0.65, fontWeight: fontWeight, color: color), ), const SizedBox(height: 15) ], ) ], ) - : Text(currencyName, style: TextStyle(fontSize: size, color: color)); + : Text(currencyName, style: TextStyle(fontSize: size, color: color, fontWeight: fontWeight)); } } diff --git a/lib/widgets/wallet_header.dart b/lib/widgets/wallet_header.dart index 83d35a0cb7c17a3458ea25c987230ec5a9d35a5c..c2286aabae7f38af298193c49996ae5d4b27d6af 100644 --- a/lib/widgets/wallet_header.dart +++ b/lib/widgets/wallet_header.dart @@ -3,11 +3,9 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/scale_functions.dart'; -import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/my_wallets.dart'; -import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/screens/certifications.dart'; import 'package:gecko/utils.dart'; @@ -35,10 +33,11 @@ class WalletHeader extends StatelessWidget { Widget build(BuildContext context) { const double avatarSize = 90; final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); - final sub = Provider.of<SubstrateSdk>(context, listen: false); final myWalletProvider = Provider.of<MyWalletsProvider>(context, listen: false); - final isOwner = myWalletProvider.isOwner(address); + final walletData = myWalletProvider.getWalletDataByAddress(address); + final isOwner = walletData != null; + bool isPickerOpen = false; String newCustomImagePath = ''; @@ -192,50 +191,45 @@ class WalletHeader extends StatelessWidget { // Certifications section ScaledSizedBox(height: 12), - FutureBuilder( - future: sub.idtyStatus(address), - builder: (context, idtyStatus) { - return Visibility( - visible: idtyStatus.data != IdtyStatus.none, - child: InkWell( - onTap: () => Navigator.push( - context, - PageNoTransit( - builder: (context) => CertificationsScreen( - address: address, - username: duniterIndexer.walletNameIndexer[address] ?? '', - ), - ), + Visibility( + visible: walletData?.hasIdentity ?? false, + child: InkWell( + onTap: () => Navigator.push( + context, + PageNoTransit( + builder: (context) => CertificationsScreen( + address: address, + username: duniterIndexer.walletNameIndexer[address] ?? '', ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.transparent, + ), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.transparent, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IdentityStatus( + address: address, + color: orangeC, ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IdentityStatus( - address: address, - color: orangeC, - ), - SizedBox(width: scaleSize(8)), - Certifications( - address: address, - size: 13, - ), - Icon( - Icons.chevron_right, - size: scaleSize(15), - color: orangeC.withValues(alpha: 0.5), - ), - ], + SizedBox(width: scaleSize(8)), + Certifications( + address: address, + size: 13, ), - ), + Icon( + Icons.chevron_right, + size: scaleSize(15), + color: orangeC.withValues(alpha: 0.5), + ), + ], ), - ); - }, - ), + ), + ), + ) ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 902fa6e6fb6cba00dc6dc91cf23c853b9206efd7..067656a56fa5687a92d99e1e4db76ba904b1d5e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: gecko description: Pay with G1. publish_to: "none" -version: 0.1.21+93 +version: 0.1.21+94 environment: sdk: ^3.5.3