mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
dynamic fee type checks
This commit is contained in:
parent
cefbc42715
commit
cd6c057f8c
3 changed files with 59 additions and 44 deletions
|
@ -359,10 +359,16 @@ class _ConfirmChangeNowSendViewState
|
|||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"${(transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: ref.watch(
|
||||
managerProvider
|
||||
.select((value) => value.coin.decimals),
|
||||
"${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: ref.watch(
|
||||
managerProvider
|
||||
.select((value) => value.coin.decimals),
|
||||
),
|
||||
)).localizedStringAsFixed(
|
||||
locale: ref.watch(
|
||||
localeServiceChangeNotifierProvider.select(
|
||||
(value) => value.locale,
|
||||
),
|
||||
),
|
||||
)} ${ref.watch(
|
||||
managerProvider.select((value) => value.coin),
|
||||
|
@ -401,10 +407,12 @@ class _ConfirmChangeNowSendViewState
|
|||
final coin = ref.watch(
|
||||
managerProvider.select((value) => value.coin),
|
||||
);
|
||||
final fee =
|
||||
(transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final fee = transactionInfo["fee"] is Amount
|
||||
? transactionInfo["fee"] as Amount
|
||||
: (transactionInfo["fee"] as int)
|
||||
.toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final amount =
|
||||
transactionInfo["recipientAmt"] as Amount;
|
||||
final total = amount + fee;
|
||||
|
@ -637,17 +645,17 @@ class _ConfirmChangeNowSendViewState
|
|||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
Text(
|
||||
"${(transactionInfo["fee"] as int).toAmountAsRaw(fractionDigits: ref.watch(
|
||||
managerProvider.select(
|
||||
(value) => value.coin.decimals,
|
||||
),
|
||||
)).localizedStringAsFixed(
|
||||
locale: ref.watch(
|
||||
localeServiceChangeNotifierProvider.select(
|
||||
(value) => value.locale,
|
||||
),
|
||||
),
|
||||
)} ${ref.watch(
|
||||
"${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw(fractionDigits: ref.watch(
|
||||
managerProvider.select(
|
||||
(value) => value.coin.decimals,
|
||||
),
|
||||
))).localizedStringAsFixed(
|
||||
locale: ref.watch(
|
||||
localeServiceChangeNotifierProvider.select(
|
||||
(value) => value.locale,
|
||||
),
|
||||
),
|
||||
)} ${ref.watch(
|
||||
managerProvider.select((value) => value.coin),
|
||||
).ticker}",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
|
@ -733,10 +741,11 @@ class _ConfirmChangeNowSendViewState
|
|||
final coin = ref.watch(
|
||||
managerProvider.select((value) => value.coin),
|
||||
);
|
||||
final fee =
|
||||
(transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final fee = transactionInfo["fee"] is Amount
|
||||
? transactionInfo["fee"] as Amount
|
||||
: (transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final amount =
|
||||
transactionInfo["recipientAmt"] as Amount;
|
||||
final total = amount + fee;
|
||||
|
|
|
@ -427,18 +427,18 @@ class _ConfirmTransactionViewState
|
|||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
Text(
|
||||
"${(transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: ref.watch(
|
||||
managerProvider.select(
|
||||
(value) => value.coin.decimals,
|
||||
),
|
||||
"${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: ref.watch(
|
||||
managerProvider.select(
|
||||
(value) => value.coin.decimals,
|
||||
),
|
||||
).localizedStringAsFixed(
|
||||
locale: ref.watch(
|
||||
localeServiceChangeNotifierProvider
|
||||
.select((value) => value.locale),
|
||||
),
|
||||
)} ${ref.watch(
|
||||
),
|
||||
)).localizedStringAsFixed(
|
||||
locale: ref.watch(
|
||||
localeServiceChangeNotifierProvider
|
||||
.select((value) => value.locale),
|
||||
),
|
||||
)} ${ref.watch(
|
||||
managerProvider.select((value) => value.coin),
|
||||
).ticker}",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
|
@ -678,10 +678,12 @@ class _ConfirmTransactionViewState
|
|||
value.getManager(walletId)))
|
||||
.coin;
|
||||
|
||||
final fee = (transactionInfo["fee"] as int)
|
||||
.toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final fee = transactionInfo["fee"] is Amount
|
||||
? transactionInfo["fee"] as Amount
|
||||
: (transactionInfo["fee"] as int)
|
||||
.toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
|
||||
return Text(
|
||||
"${fee.localizedStringAsFixed(
|
||||
|
@ -857,9 +859,11 @@ class _ConfirmTransactionViewState
|
|||
.select((value) => value.getManager(walletId)))
|
||||
.coin;
|
||||
|
||||
final fee = (transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
final fee = transactionInfo["fee"] is Amount
|
||||
? transactionInfo["fee"] as Amount
|
||||
: (transactionInfo["fee"] as int).toAmountAsRaw(
|
||||
fractionDigits: coin.decimals,
|
||||
);
|
||||
|
||||
return Text(
|
||||
"${fee.localizedStringAsFixed(
|
||||
|
@ -916,8 +920,10 @@ class _ConfirmTransactionViewState
|
|||
Builder(builder: (context) {
|
||||
final coin = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(walletId).coin));
|
||||
final fee = (transactionInfo["fee"] as int)
|
||||
.toAmountAsRaw(fractionDigits: coin.decimals);
|
||||
final fee = transactionInfo["fee"] is Amount
|
||||
? transactionInfo["fee"] as Amount
|
||||
: (transactionInfo["fee"] as int)
|
||||
.toAmountAsRaw(fractionDigits: coin.decimals);
|
||||
final locale = ref.watch(
|
||||
localeServiceChangeNotifierProvider
|
||||
.select((value) => value.locale),
|
||||
|
|
|
@ -305,7 +305,7 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
|
|||
padding: const EdgeInsets.only(
|
||||
right: 32,
|
||||
),
|
||||
child: Text(
|
||||
child: SelectableText(
|
||||
e.toString(),
|
||||
textAlign: TextAlign.left,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
||||
|
|
Loading…
Reference in a new issue