From 15d42834aaf6b6dbc99c2b7353e273faf2960549 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 12 Apr 2023 07:11:44 -0600 Subject: [PATCH] mobile coin control navigation and amount label fixes --- lib/pages/coin_control/coin_control_view.dart | 40 ++++++++++--------- lib/pages/coin_control/utxo_card.dart | 6 ++- lib/route_generator.dart | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/pages/coin_control/coin_control_view.dart b/lib/pages/coin_control/coin_control_view.dart index d1228f9c7..c322696db 100644 --- a/lib/pages/coin_control/coin_control_view.dart +++ b/lib/pages/coin_control/coin_control_view.dart @@ -49,7 +49,7 @@ class CoinControlView extends ConsumerStatefulWidget { final String walletId; final CoinControlViewType type; - final int? requestedTotal; + final Amount? requestedTotal; final Set? selectedUTXOs; @override @@ -673,7 +673,7 @@ class _CoinControlViewState extends ConsumerState { ), Builder( builder: (context) { - int selectedSum = + final int selectedSumInt = _selectedAvailable.isEmpty ? 0 : _selectedAvailable @@ -682,15 +682,19 @@ class _CoinControlViewState extends ConsumerState { (value, element) => value += element, ); + final selectedSum = + selectedSumInt.toAmountAsRaw( + fractionDigits: coin.decimals, + ); return Text( - "${selectedSum.toAmountAsRaw(fractionDigits: coin.decimals).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + "${selectedSum.localizedStringAsFixed( + locale: ref.watch( + localeServiceChangeNotifierProvider + .select( + (value) => value.locale, + ), + ), + )} ${coin.ticker}", style: widget.requestedTotal == null ? STextStyles.w600_14(context) : STextStyles.w600_14(context).copyWith( @@ -731,14 +735,14 @@ class _CoinControlViewState extends ConsumerState { style: STextStyles.w600_14(context), ), Text( - "${widget.requestedTotal!.toAmountAsRaw(fractionDigits: coin.decimals).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + "${widget.requestedTotal!.localizedStringAsFixed( + locale: ref.watch( + localeServiceChangeNotifierProvider + .select( + (value) => value.locale, + ), + ), + )} ${coin.ticker}", style: STextStyles.w600_14(context), ), ], diff --git a/lib/pages/coin_control/utxo_card.dart b/lib/pages/coin_control/utxo_card.dart index d0cba1f39..309936ee6 100644 --- a/lib/pages/coin_control/utxo_card.dart +++ b/lib/pages/coin_control/utxo_card.dart @@ -124,13 +124,15 @@ class _UtxoCardState extends ConsumerState { mainAxisSize: MainAxisSize.min, children: [ Text( - "${utxo.value.toAmountAsRaw(fractionDigits: coin.decimals).localizedStringAsFixed( + "${utxo.value.toAmountAsRaw( + fractionDigits: coin.decimals, + ).localizedStringAsFixed( locale: ref.watch( localeServiceChangeNotifierProvider.select( (value) => value.locale, ), ), - )}} ${coin.ticker}", + )} ${coin.ticker}", style: STextStyles.w600_14(context), ), const SizedBox( diff --git a/lib/route_generator.dart b/lib/route_generator.dart index 340b7803d..41043f3bb 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -337,7 +337,7 @@ class RouteGenerator { ), ); } else if (args - is Tuple4?>) { + is Tuple4?>) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => CoinControlView(