fix bad balance displayed
This commit is contained in:
parent
0233816f68
commit
57cdc23436
|
@ -192,5 +192,6 @@
|
||||||
"confirmMyIdentity": "Confirm my identity",
|
"confirmMyIdentity": "Confirm my identity",
|
||||||
"revokeMyIdentity": "Revoke my identity",
|
"revokeMyIdentity": "Revoke my identity",
|
||||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||||
"showUdAmounts": "Show amounts in UD"
|
"showUdAmounts": "Show amounts in UD",
|
||||||
|
"ud": "{}UD"
|
||||||
}
|
}
|
|
@ -192,5 +192,6 @@
|
||||||
"confirmMyIdentity": "Confirm my identity",
|
"confirmMyIdentity": "Confirm my identity",
|
||||||
"revokeMyIdentity": "Revoke my identity",
|
"revokeMyIdentity": "Revoke my identity",
|
||||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||||
"showUdAmounts": "Show amounts in UD"
|
"showUdAmounts": "Show amounts in UD",
|
||||||
|
"ud": "{}UD"
|
||||||
}
|
}
|
|
@ -193,5 +193,6 @@
|
||||||
"confirmMyIdentity": "Confirmer mon identité",
|
"confirmMyIdentity": "Confirmer mon identité",
|
||||||
"revokeMyIdentity": "Révoquer mon identité",
|
"revokeMyIdentity": "Révoquer mon identité",
|
||||||
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons",
|
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons",
|
||||||
"showUdAmounts": "Afficher les montants en DU"
|
"showUdAmounts": "Afficher les montants en DU",
|
||||||
|
"ud": "{}DU"
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ void main() async {
|
||||||
await enterText(keyCesiumId, 'test');
|
await enterText(keyCesiumId, 'test');
|
||||||
await enterText(keyCesiumPassword, 'test');
|
await enterText(keyCesiumPassword, 'test');
|
||||||
await waitFor(cesiumTest1.shortAddress());
|
await waitFor(cesiumTest1.shortAddress());
|
||||||
await waitFor('100.0', exactMatch: true);
|
await waitFor('100.0');
|
||||||
await waitFor('3', exactMatch: true);
|
await waitFor('3', exactMatch: true);
|
||||||
|
|
||||||
isObscureText();
|
isObscureText();
|
||||||
|
|
|
@ -194,7 +194,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
final udValue = await getUdValue();
|
final udValue = await getUdValue();
|
||||||
final double balanceRatio = isUdUnit ? round(udValue / 100, 4) : 1;
|
final double balanceRatio = isUdUnit ? round(udValue / 100, 6) : 1;
|
||||||
|
|
||||||
// log.d('udValue: $udValue');
|
// log.d('udValue: $udValue');
|
||||||
|
|
||||||
|
|
|
@ -616,7 +616,7 @@ Widget udUnitDisplay(double size, [Color color = Colors.black]) {
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'DU',
|
'ud'.tr(args: ['']),
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: isTall ? size : size * 0.9, color: color),
|
TextStyle(fontSize: isTall ? size : size * 0.9, color: color),
|
||||||
),
|
),
|
||||||
|
|
|
@ -282,7 +282,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
|
||||||
if (isUdUnit) {
|
if (isUdUnit) {
|
||||||
amount = round(amount / (sub.udValue / 100));
|
amount = round(amount / (sub.udValue / 100));
|
||||||
finalAmount = "$amount DU";
|
finalAmount = 'ud'.tr(args: ['$amount ']);
|
||||||
} else {
|
} else {
|
||||||
finalAmount = '$amount $currencyName';
|
finalAmount = '$amount $currencyName';
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,9 @@ class ImportG1v1 extends StatelessWidget {
|
||||||
validationStatus = '';
|
validationStatus = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName;
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
|
@ -195,7 +198,7 @@ class ImportG1v1 extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
'${balance['transferableBalance']} $currencyName',
|
'${balance['transferableBalance']} $unit',
|
||||||
style: const TextStyle(fontSize: 17),
|
style: const TextStyle(fontSize: 17),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
|
|
@ -129,6 +129,9 @@ class MigrateIdentityScreen extends StatelessWidget {
|
||||||
.removeWhere((element) => element.address == fromAddress);
|
.removeWhere((element) => element.address == fromAddress);
|
||||||
// walletsList.add(WalletData(address: 'custom', name: 'custom'));
|
// walletsList.add(WalletData(address: 'custom', name: 'custom'));
|
||||||
|
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName;
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Row(children: const []),
|
Row(children: const []),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
@ -139,7 +142,7 @@ class MigrateIdentityScreen extends StatelessWidget {
|
||||||
data: 'areYouSureMigrateIdentity'.tr(args: [
|
data: 'areYouSureMigrateIdentity'.tr(args: [
|
||||||
duniterIndexer.walletNameIndexer[fromAddress] ??
|
duniterIndexer.walletNameIndexer[fromAddress] ??
|
||||||
'???',
|
'???',
|
||||||
'${balance['transferableBalance']} $currencyName'
|
'${balance['transferableBalance']} $unit'
|
||||||
]),
|
]),
|
||||||
styleSheet: mdStyle),
|
styleSheet: mdStyle),
|
||||||
),
|
),
|
||||||
|
|
|
@ -197,7 +197,9 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
if (transType == 'pay')
|
if (transType == 'pay')
|
||||||
Text(
|
Text(
|
||||||
isUdUnit ? '$amount DU' : '$amount $currencyName',
|
isUdUnit
|
||||||
|
? 'ud'.tr(args: ['$amount '])
|
||||||
|
: '$amount $currencyName',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18, fontWeight: FontWeight.w600),
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
|
|
|
@ -405,7 +405,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
|
|
||||||
final myWalletProvider =
|
final myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
// final _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
const double shapeSize = 20;
|
const double shapeSize = 20;
|
||||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
@ -413,6 +413,10 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
|
|
||||||
bool canValidate = false;
|
bool canValidate = false;
|
||||||
|
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
final udValue = sub.udValue;
|
||||||
|
final double balanceRatio = isUdUnit ? round(udValue / 100, 6) : 1;
|
||||||
|
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
|
@ -426,11 +430,13 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
if (walletViewProvider.payAmount.text != '' &&
|
if (walletViewProvider.payAmount.text != '' &&
|
||||||
(double.parse(walletViewProvider.payAmount.text) + 2) <=
|
(double.parse(walletViewProvider.payAmount.text) +
|
||||||
|
2 / balanceRatio) <=
|
||||||
(balanceCache[defaultWallet.address] ?? 0) &&
|
(balanceCache[defaultWallet.address] ?? 0) &&
|
||||||
walletViewProvider.address != defaultWallet.address) {
|
walletViewProvider.address != defaultWallet.address) {
|
||||||
if ((balanceCache[pubkey] == 0 || balanceCache[pubkey] == null) &&
|
if ((balanceCache[pubkey] == 0 || balanceCache[pubkey] == null) &&
|
||||||
double.parse(walletViewProvider.payAmount.text) < 5) {
|
double.parse(walletViewProvider.payAmount.text) <
|
||||||
|
5 / balanceRatio) {
|
||||||
canValidate = false;
|
canValidate = false;
|
||||||
} else {
|
} else {
|
||||||
canValidate = true;
|
canValidate = true;
|
||||||
|
@ -562,7 +568,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: '0.00',
|
hintText: '0.00',
|
||||||
suffix: Text(isUdUnit
|
suffix: Text(isUdUnit
|
||||||
? 'DU'
|
? 'ud'.tr(args: [''])
|
||||||
: currencyName), // udUnitDisplay(40),
|
: currencyName), // udUnitDisplay(40),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.transparent,
|
fillColor: Colors.transparent,
|
||||||
|
|
Loading…
Reference in New Issue