Skip to content

Commit f4f9669

Browse files
committed
feat: show sat/vB fee rate inline next to fee amount
closes #413
1 parent 51db6c7 commit f4f9669

1 file changed

Lines changed: 37 additions & 57 deletions

File tree

lib/pages/send_view/confirm_transaction_view.dart

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,25 @@ class _ConfirmTransactionViewState
10661066
"Transaction fee",
10671067
style: STextStyles.smallMed12(context),
10681068
),
1069-
SelectableText(
1070-
ref.watch(pAmountFormatter(coin)).format(fee!),
1071-
style: STextStyles.itemSubtitle12(context),
1072-
textAlign: TextAlign.right,
1069+
Row(
1070+
mainAxisSize: MainAxisSize.min,
1071+
crossAxisAlignment: CrossAxisAlignment.baseline,
1072+
textBaseline: TextBaseline.alphabetic,
1073+
children: [
1074+
SelectableText(
1075+
ref.watch(pAmountFormatter(coin)).format(fee!),
1076+
style: STextStyles.itemSubtitle12(context),
1077+
textAlign: TextAlign.right,
1078+
),
1079+
if (widget.txData.fee != null &&
1080+
widget.txData.vSize != null &&
1081+
widget.txData.vSize! > 0)
1082+
Text(
1083+
" (~${(fee.raw.toInt() / widget.txData.vSize!).toStringAsFixed(1)} sat/vB)",
1084+
style: STextStyles.smallMed12(context),
1085+
textAlign: TextAlign.right,
1086+
),
1087+
],
10731088
),
10741089
],
10751090
),
@@ -1089,25 +1104,6 @@ class _ConfirmTransactionViewState
10891104
],
10901105
),
10911106
),
1092-
if (widget.txData.fee != null && widget.txData.vSize != null)
1093-
const SizedBox(height: 12),
1094-
if (widget.txData.fee != null && widget.txData.vSize != null)
1095-
RoundedWhiteContainer(
1096-
child: Row(
1097-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1098-
children: [
1099-
Text(
1100-
"sats/vByte",
1101-
style: STextStyles.smallMed12(context),
1102-
),
1103-
const SizedBox(height: 4),
1104-
SelectableText(
1105-
"~${fee!.raw.toInt() ~/ widget.txData.vSize!}",
1106-
style: STextStyles.itemSubtitle12(context),
1107-
),
1108-
],
1109-
),
1110-
),
11111107
if ((coin is Epiccash || coin is Mimblewimblecoin) &&
11121108
widget.txData.noteOnChain!.isNotEmpty)
11131109
const SizedBox(height: 12),
@@ -1641,40 +1637,24 @@ class _ConfirmTransactionViewState
16411637
color: Theme.of(
16421638
context,
16431639
).extension<StackColors>()!.textFieldDefaultBG,
1644-
child: SelectableText(
1645-
ref.watch(pAmountFormatter(coin)).format(fee!),
1646-
style: STextStyles.itemSubtitle(context),
1647-
),
1648-
),
1649-
),
1650-
if (isDesktop &&
1651-
!widget.isPaynymTransaction &&
1652-
widget.txData.fee != null &&
1653-
widget.txData.vSize != null)
1654-
Padding(
1655-
padding: const EdgeInsets.only(left: 32),
1656-
child: Text(
1657-
"sats/vByte",
1658-
style: STextStyles.desktopTextExtraExtraSmall(context),
1659-
),
1660-
),
1661-
if (isDesktop &&
1662-
!widget.isPaynymTransaction &&
1663-
widget.txData.fee != null &&
1664-
widget.txData.vSize != null)
1665-
Padding(
1666-
padding: const EdgeInsets.only(top: 10, left: 32, right: 32),
1667-
child: RoundedContainer(
1668-
padding: const EdgeInsets.symmetric(
1669-
horizontal: 16,
1670-
vertical: 18,
1671-
),
1672-
color: Theme.of(
1673-
context,
1674-
).extension<StackColors>()!.textFieldDefaultBG,
1675-
child: SelectableText(
1676-
"~${fee!.raw.toInt() ~/ widget.txData.vSize!}",
1677-
style: STextStyles.itemSubtitle(context),
1640+
child: Row(
1641+
crossAxisAlignment: CrossAxisAlignment.baseline,
1642+
textBaseline: TextBaseline.alphabetic,
1643+
children: [
1644+
SelectableText(
1645+
ref.watch(pAmountFormatter(coin)).format(fee!),
1646+
style: STextStyles.itemSubtitle(context),
1647+
),
1648+
if (widget.txData.fee != null &&
1649+
widget.txData.vSize != null &&
1650+
widget.txData.vSize! > 0)
1651+
Text(
1652+
" (~${(fee.raw.toInt() / widget.txData.vSize!).toStringAsFixed(1)} sat/vB)",
1653+
style: STextStyles.desktopTextExtraExtraSmall(
1654+
context,
1655+
),
1656+
),
1657+
],
16781658
),
16791659
),
16801660
),

0 commit comments

Comments
 (0)