Merge branch 'implementUdUnit' into 'master'
Implement ud unit See merge request clients/gecko!30
This commit is contained in:
commit
7f5dbf04ee
|
@ -191,5 +191,7 @@
|
||||||
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
||||||
"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",
|
||||||
|
"ud": "{}UD"
|
||||||
}
|
}
|
|
@ -191,5 +191,7 @@
|
||||||
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
||||||
"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",
|
||||||
|
"ud": "{}UD"
|
||||||
}
|
}
|
|
@ -192,5 +192,7 @@
|
||||||
"someoneCreatedYourIdentity": "Quelqu'un a créé votre identité {} !",
|
"someoneCreatedYourIdentity": "Quelqu'un a créé votre identité {} !",
|
||||||
"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",
|
||||||
|
"ud": "{}DU"
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:gecko/globals.dart';
|
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
import '../utility/general_actions.dart';
|
import '../utility/general_actions.dart';
|
||||||
|
@ -33,9 +32,9 @@ void main() async {
|
||||||
// Background pay 25
|
// Background pay 25
|
||||||
await bkPay(
|
await bkPay(
|
||||||
fromAddress: test1.address, destAddress: test5.address, amount: 25);
|
fromAddress: test1.address, destAddress: test5.address, amount: 25);
|
||||||
await waitFor('25.0 $currencyName');
|
await waitFor('25.0', exactMatch: true);
|
||||||
await spawnBlock();
|
await spawnBlock();
|
||||||
await waitFor('22.0 $currencyName');
|
await waitFor('22.0', exactMatch: true);
|
||||||
await bkCertify(
|
await bkCertify(
|
||||||
fromAddress: test1.address,
|
fromAddress: test1.address,
|
||||||
destAddress: test5.address,
|
destAddress: test5.address,
|
||||||
|
@ -53,10 +52,10 @@ void main() async {
|
||||||
await waitFor('4', exactMatch: true);
|
await waitFor('4', exactMatch: true);
|
||||||
// await bkPay(
|
// await bkPay(
|
||||||
// fromAddress: test2.address, destAddress: test5.address, amount: 40);
|
// fromAddress: test2.address, destAddress: test5.address, amount: 40);
|
||||||
await waitFor('21.99 $currencyName');
|
await waitFor('21.99', exactMatch: true);
|
||||||
await spawnBlock(until: 30);
|
await spawnBlock(until: 30);
|
||||||
await waitFor('121.99 $currencyName');
|
await waitFor('121.99', exactMatch: true);
|
||||||
await spawnBlock(until: 40);
|
await spawnBlock(until: 40);
|
||||||
await waitFor('221.99 $currencyName');
|
await waitFor('221.99', exactMatch: true);
|
||||||
}, timeout: testTimeout());
|
}, timeout: testTimeout());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ Future payTest2() async {
|
||||||
await waitFor(endAddress);
|
await waitFor(endAddress);
|
||||||
await tapKey(keySearchResult(addressToSearch));
|
await tapKey(keySearchResult(addressToSearch));
|
||||||
await waitFor(endAddress);
|
await waitFor(endAddress);
|
||||||
await waitFor('0.0 ĞD');
|
await waitFor('0.0', exactMatch: true);
|
||||||
await tapKey(keyPay);
|
await tapKey(keyPay);
|
||||||
await enterText(keyAmountField, '12.14');
|
await enterText(keyAmountField, '12.14');
|
||||||
await tapKey(keyConfirmPayment);
|
await tapKey(keyConfirmPayment);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:gecko/globals.dart';
|
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
import '../utility/general_actions.dart';
|
import '../utility/general_actions.dart';
|
||||||
|
@ -28,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 $currencyName');
|
await waitFor('100.0');
|
||||||
await waitFor('3', exactMatch: true);
|
await waitFor('3', exactMatch: true);
|
||||||
|
|
||||||
isObscureText();
|
isObscureText();
|
||||||
|
@ -51,7 +50,7 @@ void main() async {
|
||||||
await waitFor('3', exactMatch: true);
|
await waitFor('3', exactMatch: true);
|
||||||
await waitFor('Membre validé !');
|
await waitFor('Membre validé !');
|
||||||
|
|
||||||
await waitFor('99.98 $currencyName');
|
await waitFor('99.98', exactMatch: true);
|
||||||
}, timeout: testTimeout());
|
}, timeout: testTimeout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:gecko/globals.dart';
|
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
import '../utility/general_actions.dart';
|
import '../utility/general_actions.dart';
|
||||||
|
@ -20,10 +19,10 @@ void main() async {
|
||||||
|
|
||||||
// Go to test1 options and check if balance growup with UDs creations
|
// Go to test1 options and check if balance growup with UDs creations
|
||||||
await tapKey(keyOpenWallet(test1.address));
|
await tapKey(keyOpenWallet(test1.address));
|
||||||
await waitFor('100.0 $currencyName');
|
await waitFor('100.0', exactMatch: true);
|
||||||
await spawnBlock(until: 10);
|
await spawnBlock(until: 10);
|
||||||
await waitFor('200.0 $currencyName');
|
await waitFor('200.0', exactMatch: true);
|
||||||
await spawnBlock(until: 20);
|
await spawnBlock(until: 20);
|
||||||
await waitFor('300.0 $currencyName');
|
await waitFor('300.0', exactMatch: true);
|
||||||
}, timeout: testTimeout());
|
}, timeout: testTimeout());
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,12 @@ Future deleteAllWallets() async {
|
||||||
if (await isPresent('Rechercher')) {
|
if (await isPresent('Rechercher')) {
|
||||||
await tapKey(keyDrawerMenu);
|
await tapKey(keyDrawerMenu);
|
||||||
await tapKey(keyParameters);
|
await tapKey(keyParameters);
|
||||||
|
|
||||||
|
// Check if ud unit checkbox is checked
|
||||||
|
final isUdUnit = await isIconPresent(Icons.check_box);
|
||||||
|
// If yes, tap on to use currency value
|
||||||
|
if (isUdUnit) await tapKey(keyUdUnit, duration: 0);
|
||||||
|
|
||||||
await tapKey(keyDeleteAllWallets);
|
await tapKey(keyDeleteAllWallets);
|
||||||
await tapKey(keyConfirm);
|
await tapKey(keyConfirm);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
@ -142,9 +148,9 @@ Future onboardingNewChest() async {
|
||||||
// Go to wallets home
|
// Go to wallets home
|
||||||
await tapKey(keyGoWalletsHome, duration: 0);
|
await tapKey(keyGoWalletsHome, duration: 0);
|
||||||
|
|
||||||
// Check if string "ĞD" is present in screen
|
// Check if string "Mon portefeuille co" is present in screen
|
||||||
await waitFor('Mon portefeuille co');
|
await waitFor('Mon portefeuille co');
|
||||||
await waitFor('0.0 $currencyName');
|
await waitFor('0.0', exactMatch: true);
|
||||||
// await waitFor('Scanner un');
|
// await waitFor('Scanner un');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,5 +165,5 @@ Future firstOpenChest() async {
|
||||||
final isCached = await isIconPresent(Icons.check_box);
|
final isCached = await isIconPresent(Icons.check_box);
|
||||||
if (!isCached) await tapKey(keyCachePassword, duration: 0);
|
if (!isCached) await tapKey(keyCachePassword, duration: 0);
|
||||||
await enterText(keyPinForm, 'AAAAA', 0);
|
await enterText(keyPinForm, 'AAAAA', 0);
|
||||||
await waitFor('100.0 $currencyName');
|
await waitFor('100.0', exactMatch: true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,7 @@ Future bkDeleteAllWallets() async {
|
||||||
await walletBox.clear();
|
await walletBox.clear();
|
||||||
await chestBox.clear();
|
await chestBox.clear();
|
||||||
await configBox.delete('defaultWallet');
|
await configBox.delete('defaultWallet');
|
||||||
|
await configBox.delete('isUdUnit');
|
||||||
await sub.deleteAllAccounts();
|
await sub.deleteAllAccounts();
|
||||||
myWalletProvider.pinCode = '';
|
myWalletProvider.pinCode = '';
|
||||||
myWalletProvider.reload();
|
myWalletProvider.reload();
|
||||||
|
|
|
@ -70,6 +70,7 @@ const keyDeleteAllWallets = Key('keyDeleteAllWallets');
|
||||||
const keySelectDuniterNodeDropDown = Key('keySelectDuniterNodeDropDown');
|
const keySelectDuniterNodeDropDown = Key('keySelectDuniterNodeDropDown');
|
||||||
const keyCustomDuniterEndpoint = Key('keyCustomDuniterEndpoint');
|
const keyCustomDuniterEndpoint = Key('keyCustomDuniterEndpoint');
|
||||||
const keyConnectToEndpoint = Key('keyConnectToEndpoint');
|
const keyConnectToEndpoint = Key('keyConnectToEndpoint');
|
||||||
|
const keyUdUnit = Key('keyUdUnit');
|
||||||
|
|
||||||
// Onboarding
|
// Onboarding
|
||||||
const keyPastMnemonic = Key('keyPastMnemonic');
|
const keyPastMnemonic = Key('keyPastMnemonic');
|
||||||
|
|
|
@ -313,9 +313,18 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
]),
|
]),
|
||||||
trailing: Column(
|
trailing: SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
width: 110,
|
||||||
children: [balance(context, profile['id'], 16)]),
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
balance(context, profile['id'], 16),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
subtitle: Row(children: <Widget>[
|
subtitle: Row(children: <Widget>[
|
||||||
Text(profile['name'] ?? '',
|
Text(profile['name'] ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -360,16 +369,16 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
transBC[i] = [];
|
transBC[i] = [];
|
||||||
transBC[i].add(DateTime.parse(transaction['created_at']));
|
transBC[i].add(DateTime.parse(transaction['created_at']));
|
||||||
final int amountBrut = transaction['amount'];
|
final int amountBrut = transaction['amount'];
|
||||||
final num amount = removeDecimalZero(amountBrut / 100);
|
final double amount = removeDecimalZero(amountBrut / 100);
|
||||||
if (direction == "RECEIVED") {
|
if (direction == "RECEIVED") {
|
||||||
transBC[i].add(transaction['issuer_id']);
|
transBC[i].add(transaction['issuer_id']);
|
||||||
transBC[i].add(transaction['issuer']['identity']?['name'] ?? '');
|
transBC[i].add(transaction['issuer']['identity']?['name'] ?? '');
|
||||||
transBC[i].add(amount.toString());
|
|
||||||
} else if (direction == "SENT") {
|
} else if (direction == "SENT") {
|
||||||
transBC[i].add(transaction['receiver_id']);
|
transBC[i].add(transaction['receiver_id']);
|
||||||
transBC[i].add(transaction['receiver']['identity']?['name'] ?? '');
|
transBC[i].add(transaction['receiver']['identity']?['name'] ?? '');
|
||||||
transBC[i].add('- $amount');
|
|
||||||
}
|
}
|
||||||
|
transBC[i].add(amount);
|
||||||
|
transBC[i].add(direction);
|
||||||
// transBC[i].add(''); //transaction comment
|
// transBC[i].add(''); //transaction comment
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -429,9 +438,9 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
num removeDecimalZero(double n) {
|
double removeDecimalZero(double n) {
|
||||||
String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 2);
|
String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 2);
|
||||||
return num.parse(result);
|
return double.parse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkHistoryResult(
|
// checkHistoryResult(
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||||
|
@ -63,6 +64,13 @@ class HomeProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future changeCurrencyUnit() async {
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
await configBox.put('isUdUnit', !isUdUnit);
|
||||||
|
balanceCache = {};
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getAppVersion() async {
|
Future<String> getAppVersion() async {
|
||||||
String version;
|
String version;
|
||||||
String buildNumber;
|
String buildNumber;
|
||||||
|
|
|
@ -41,6 +41,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
String g1V1NewAddress = '';
|
String g1V1NewAddress = '';
|
||||||
bool isCesiumIDVisible = false;
|
bool isCesiumIDVisible = false;
|
||||||
bool isCesiumAddresLoading = false;
|
bool isCesiumAddresLoading = false;
|
||||||
|
late int udValue;
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
////////// 1: API METHODS ///////////
|
////////// 1: API METHODS ///////////
|
||||||
|
@ -154,20 +155,10 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return consumers == 0 ? false : true;
|
return consumers == 0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<double> getBalance(String address) async {
|
Future<int> getUdValue() async {
|
||||||
// double balance = 0.0;
|
udValue = int.parse(await _getStorage('universalDividend.currentUd()'));
|
||||||
|
return udValue;
|
||||||
// if (nodeConnected) {
|
}
|
||||||
// final brutBalance = await sdk.api.account.queryBalance(address);
|
|
||||||
// // log.d(brutBalance?.toJson());
|
|
||||||
// balance = int.parse(brutBalance!.freeBalance) / 100;
|
|
||||||
// } else {
|
|
||||||
// balance = -1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// await getUnclaimedUd(address);
|
|
||||||
// return balance;
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<Map<String, double>> getBalance(String address) async {
|
Future<Map<String, double>> getBalance(String address) async {
|
||||||
// log.d('currencyParameters: $currencyParameters');
|
// log.d('currencyParameters: $currencyParameters');
|
||||||
|
@ -201,11 +192,18 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
final int transferableBalance =
|
final int transferableBalance =
|
||||||
(balanceGlobal['data']['free'] + unclaimedUds);
|
(balanceGlobal['data']['free'] + unclaimedUds);
|
||||||
|
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
final udValue = await getUdValue();
|
||||||
|
final double balanceRatio = isUdUnit ? round(udValue / 100, 6) : 1;
|
||||||
|
|
||||||
|
// log.d('udValue: $udValue');
|
||||||
|
|
||||||
Map<String, double> finalBalances = {
|
Map<String, double> finalBalances = {
|
||||||
'transferableBalance': transferableBalance / 100,
|
'transferableBalance': round((transferableBalance / balanceRatio) / 100),
|
||||||
'free': balanceGlobal['data']['free'] / 100,
|
'free': round((balanceGlobal['data']['free'] / balanceRatio) / 100),
|
||||||
'unclaimedUds': unclaimedUds / 100,
|
'unclaimedUds': round((unclaimedUds / balanceRatio) / 100),
|
||||||
'reserved': balanceGlobal['data']['reserved'] / 100,
|
'reserved':
|
||||||
|
round((balanceGlobal['data']['reserved'] / balanceRatio) / 100),
|
||||||
};
|
};
|
||||||
|
|
||||||
// log.i(finalBalances);
|
// log.i(finalBalances);
|
||||||
|
@ -701,11 +699,30 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
TxInfoData txInfo;
|
TxInfoData txInfo;
|
||||||
List txOptions = [];
|
List txOptions = [];
|
||||||
String? rawParams;
|
String? rawParams;
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
late String palette;
|
||||||
|
late String call;
|
||||||
|
late String tx2;
|
||||||
|
|
||||||
|
if (amount == -1) {
|
||||||
|
palette = 'balances';
|
||||||
|
call = 'transferAll';
|
||||||
|
txOptions = [destAddress, false];
|
||||||
|
tx2 = 'api.tx.balances.transferAll("$destAddress", false)';
|
||||||
|
} else {
|
||||||
|
if (isUdUnit) {
|
||||||
|
palette = 'universalDividend';
|
||||||
|
call = 'transferUd';
|
||||||
|
} else {
|
||||||
|
palette = 'balances';
|
||||||
|
call = 'transferKeepAlive';
|
||||||
|
}
|
||||||
|
txOptions = [destAddress, amountUnit];
|
||||||
|
tx2 = 'api.tx.$palette.$call("$destAddress", $amountUnit)';
|
||||||
|
}
|
||||||
|
|
||||||
if (globalBalance['unclaimedUds'] == 0) {
|
if (globalBalance['unclaimedUds'] == 0) {
|
||||||
txInfo = TxInfoData('balances',
|
txInfo = TxInfoData(palette, call, sender);
|
||||||
amount == -1 ? 'transferAll' : 'transferKeepAlive', sender);
|
|
||||||
txOptions = [destAddress, amount == -1 ? false : amountUnit];
|
|
||||||
} else {
|
} else {
|
||||||
txInfo = TxInfoData(
|
txInfo = TxInfoData(
|
||||||
'utility',
|
'utility',
|
||||||
|
@ -713,14 +730,9 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
sender,
|
sender,
|
||||||
);
|
);
|
||||||
const tx1 = 'api.tx.universalDividend.claimUds()';
|
const tx1 = 'api.tx.universalDividend.claimUds()';
|
||||||
final tx2 = amount == -1
|
|
||||||
? 'api.tx.balances.transferAll("$destAddress", false)'
|
|
||||||
: 'api.tx.balances.transferKeepAlive("$destAddress", $amountUnit)';
|
|
||||||
|
|
||||||
rawParams = '[[$tx1, $tx2]]';
|
rawParams = '[[$tx1, $tx2]]';
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.d('pay args: ${txInfo.module}, ${txInfo.call}, $txOptions, $rawParams');
|
|
||||||
return await _executeCall(txInfo, txOptions, password, rawParams);
|
return await _executeCall(txInfo, txOptions, password, rawParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1013,3 +1025,7 @@ class PasswordException implements Exception {
|
||||||
|
|
||||||
Uint8List _int32bytes(int value) =>
|
Uint8List _int32bytes(int value) =>
|
||||||
Uint8List(4)..buffer.asInt32List()[0] = value;
|
Uint8List(4)..buffer.asInt32List()[0] = value;
|
||||||
|
|
||||||
|
double round(double number, [int decimal = 2]) {
|
||||||
|
return double.parse((number.toStringAsFixed(decimal)));
|
||||||
|
}
|
||||||
|
|
|
@ -541,10 +541,13 @@ Widget balance(BuildContext context, String address, double size,
|
||||||
globalBalance.hasError) {
|
globalBalance.hasError) {
|
||||||
if (balanceCache[address] != null &&
|
if (balanceCache[address] != null &&
|
||||||
balanceCache[address] != -1) {
|
balanceCache[address] != -1) {
|
||||||
return Text(
|
return Row(children: [
|
||||||
"${balanceCache[address]!.toString()} $currencyName",
|
Text(balanceCache[address]!.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? size : size * 0.9, color: color));
|
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
udUnitDisplay(size, color),
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
|
@ -558,13 +561,17 @@ Widget balance(BuildContext context, String address, double size,
|
||||||
}
|
}
|
||||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||||
if (balanceCache[address] != -1) {
|
if (balanceCache[address] != -1) {
|
||||||
return Text(
|
return Row(children: [
|
||||||
"${balanceCache[address]!.toString()} $currencyName",
|
Text(
|
||||||
style: TextStyle(
|
balanceCache[address]!.toString(),
|
||||||
fontSize: isTall ? size : size * 0.9,
|
style: TextStyle(
|
||||||
color: color,
|
fontSize: isTall ? size : size * 0.9,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(width: 5),
|
||||||
|
udUnitDisplay(size, color),
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
|
@ -601,3 +608,32 @@ Widget getCerts(BuildContext context, String address, double size,
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget udUnitDisplay(double size, [Color color = Colors.black]) {
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
return isUdUnit
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'ud'.tr(args: ['']),
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: isTall ? size : size * 0.9, color: color),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
currencyName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: (isTall ? size : size * 0.9) * 0.7,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: color),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Text(currencyName,
|
||||||
|
style: TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
|
||||||
|
}
|
||||||
|
|
|
@ -195,6 +195,8 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
BuildContext context, DuniterIndexer duniterIndexer) {
|
BuildContext context, DuniterIndexer duniterIndexer) {
|
||||||
CesiumPlusProvider cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
String? dateDelimiter;
|
String? dateDelimiter;
|
||||||
String? lastDateDelimiter;
|
String? lastDateDelimiter;
|
||||||
|
@ -273,6 +275,18 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
dateDelimiter = null;
|
dateDelimiter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
late double amount;
|
||||||
|
late String finalAmount;
|
||||||
|
amount = repository[4] == 'RECEIVED' ? repository[3] : repository[3] * -1;
|
||||||
|
|
||||||
|
if (isUdUnit) {
|
||||||
|
amount = round(amount / (sub.udValue / 100));
|
||||||
|
finalAmount = 'ud'.tr(args: ['$amount ']);
|
||||||
|
} else {
|
||||||
|
finalAmount = '$amount $currencyName';
|
||||||
|
}
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
if (dateDelimiter != null)
|
if (dateDelimiter != null)
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -328,7 +342,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trailing: Text("${repository[3]} $currencyName",
|
trailing: Text(finalAmount,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18, fontWeight: FontWeight.w500),
|
fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
textAlign: TextAlign.justify),
|
textAlign: TextAlign.justify),
|
||||||
|
|
|
@ -31,8 +31,8 @@ class HomeScreen extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
|
||||||
homeContext = context;
|
homeContext = context;
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
Provider.of<ChestProvider>(context);
|
Provider.of<ChestProvider>(context);
|
||||||
|
|
|
@ -218,7 +218,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: isDefault ? orangeC : yellowC,
|
color: isDefault ? orangeC : yellowC,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 25,
|
height: 30,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// Text(
|
// Text(
|
||||||
|
@ -226,7 +226,10 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
// textAlign: TextAlign.center,
|
// textAlign: TextAlign.center,
|
||||||
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
||||||
// ),
|
// ),
|
||||||
balance(context, address, 15, isDefault ? Colors.white : Colors.black)
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
|
balance(
|
||||||
|
context, address, 16, isDefault ? Colors.white : Colors.black),
|
||||||
|
])
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -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),
|
||||||
),
|
),
|
||||||
|
|
|
@ -293,12 +293,17 @@ class WalletsHome extends StatelessWidget {
|
||||||
color: isDefault ? orangeC : yellowC,
|
color: isDefault ? orangeC : yellowC,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
||||||
child: balance(
|
child: Row(
|
||||||
context,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
address,
|
children: [
|
||||||
15,
|
balance(
|
||||||
isDefault ? Colors.white : Colors.black,
|
context,
|
||||||
isDefault ? yellowC : orangeC)),
|
address,
|
||||||
|
15,
|
||||||
|
isDefault ? Colors.white : Colors.black,
|
||||||
|
isDefault ? yellowC : orangeC)
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,21 @@ class ContactsScreen extends StatelessWidget {
|
||||||
trailing: Column(
|
trailing: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
balance(context, g1Wallet.pubkey!, 16)
|
SizedBox(
|
||||||
|
width: 110,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
balance(context,
|
||||||
|
g1Wallet.pubkey!, 16),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
subtitle: Row(children: <Widget>[
|
subtitle: Row(children: <Widget>[
|
||||||
duniterIndexer.getNameByAddress(
|
duniterIndexer.getNameByAddress(
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.only(left: 15, right: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -111,8 +111,24 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
balance(
|
SizedBox(
|
||||||
context, g1Wallet.pubkey!, 16)
|
width: 110,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.center,
|
||||||
|
children: [
|
||||||
|
balance(
|
||||||
|
context,
|
||||||
|
g1Wallet.pubkey!,
|
||||||
|
16),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
subtitle: Row(children: <Widget>[
|
subtitle: Row(children: <Widget>[
|
||||||
duniterIndexer.getNameByAddress(
|
duniterIndexer.getNameByAddress(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
import 'package:gecko/providers/duniter_indexer.dart';
|
import 'package:gecko/providers/duniter_indexer.dart';
|
||||||
|
import 'package:gecko/providers/home.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/providers/settings_provider.dart';
|
import 'package:gecko/providers/settings_provider.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
|
@ -33,9 +34,21 @@ class SettingsScreen extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
body: Column(children: <Widget>[
|
body: Column(children: <Widget>[
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
'Connectivité réseau',
|
||||||
|
style: TextStyle(color: Colors.grey[500], fontSize: 22),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
duniterEndpointSelection(context),
|
duniterEndpointSelection(context),
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 30),
|
||||||
indexerEndpointSelection(context),
|
indexerEndpointSelection(context),
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
Text(
|
||||||
|
'Affichage',
|
||||||
|
style: TextStyle(color: Colors.grey[500], fontSize: 22),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
chooseCurrencyUnit(context),
|
||||||
|
|
||||||
// SizedBox(height: isTall ? 80 : 120),
|
// SizedBox(height: isTall ? 80 : 120),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
@ -66,6 +79,36 @@ class SettingsScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget chooseCurrencyUnit(BuildContext context) {
|
||||||
|
HomeProvider homeProvider =
|
||||||
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
return InkWell(
|
||||||
|
key: keyUdUnit,
|
||||||
|
onTap: () async {
|
||||||
|
await homeProvider.changeCurrencyUnit();
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Text('showUdAmounts'.tr()),
|
||||||
|
const Spacer(),
|
||||||
|
Consumer<HomeProvider>(builder: (context, homeProvider, _) {
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
return Icon(
|
||||||
|
isUdUnit ? Icons.check_box : Icons.check_box_outline_blank,
|
||||||
|
color: orangeC,
|
||||||
|
size: 32,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(width: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget duniterEndpointSelection(BuildContext context) {
|
Widget duniterEndpointSelection(BuildContext context) {
|
||||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
String? selectedDuniterEndpoint;
|
String? selectedDuniterEndpoint;
|
||||||
|
|
|
@ -41,6 +41,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
final to = toAddress ?? getShortPubkey(walletViewProvider.address!);
|
final to = toAddress ?? getShortPubkey(walletViewProvider.address!);
|
||||||
final amount = walletViewProvider.payAmount.text;
|
final amount = walletViewProvider.payAmount.text;
|
||||||
String actionName = '';
|
String actionName = '';
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
|
|
||||||
switch (transType) {
|
switch (transType) {
|
||||||
case 'pay':
|
case 'pay':
|
||||||
|
@ -196,7 +197,9 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
if (transType == 'pay')
|
if (transType == 'pay')
|
||||||
Text(
|
Text(
|
||||||
'$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),
|
||||||
|
|
|
@ -403,9 +403,9 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
// WalletsProfilesProvider _walletViewProvider =
|
// WalletsProfilesProvider _walletViewProvider =
|
||||||
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
MyWalletsProvider myWalletProvider =
|
final myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
// SubstrateSdk _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;
|
||||||
|
@ -438,6 +444,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
} else {
|
} else {
|
||||||
canValidate = false;
|
canValidate = false;
|
||||||
}
|
}
|
||||||
|
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: MediaQuery.of(context).viewInsets.bottom),
|
bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||||
|
@ -524,44 +531,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Text(defaultWallet.name!),
|
Text(defaultWallet.name!),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
FutureBuilder(
|
balance(context, defaultWallet.address!, 20)
|
||||||
future:
|
|
||||||
sub.getBalance(defaultWallet.address!),
|
|
||||||
builder: (BuildContext context,
|
|
||||||
AsyncSnapshot<Map<String, double>>
|
|
||||||
globalBalance) {
|
|
||||||
if (globalBalance.connectionState !=
|
|
||||||
ConnectionState.done ||
|
|
||||||
globalBalance.hasError) {
|
|
||||||
if (balanceCache[
|
|
||||||
defaultWallet.address!] !=
|
|
||||||
null) {
|
|
||||||
return Text(
|
|
||||||
"${balanceCache[defaultWallet.address!]} $currencyName",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
return SizedBox(
|
|
||||||
height: 15,
|
|
||||||
width: 15,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: orangeC,
|
|
||||||
strokeWidth: 2,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
balanceCache[defaultWallet.address!] =
|
|
||||||
globalBalance
|
|
||||||
.data!['transferableBalance']!;
|
|
||||||
return Text(
|
|
||||||
"${balanceCache[defaultWallet.address!]} $currencyName",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -597,7 +567,9 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
// onChanged: (v) => _searchProvider.reload(),
|
// onChanged: (v) => _searchProvider.reload(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: '0.00',
|
hintText: '0.00',
|
||||||
suffix: Text(currencyName),
|
suffix: Text(isUdUnit
|
||||||
|
? 'ud'.tr(args: [''])
|
||||||
|
: currencyName), // udUnitDisplay(40),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.transparent,
|
fillColor: Colors.transparent,
|
||||||
// border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
|
|
Loading…
Reference in New Issue