From a236d728468594ee1fb9bf0ae3e153a25f0ec991 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 6 Dec 2022 08:36:03 -0600 Subject: [PATCH] don't show fee selection for epic --- lib/pages/send_view/send_view.dart | 390 +++++++++--------- .../wallet_view/sub_widgets/desktop_send.dart | 31 +- 2 files changed, 218 insertions(+), 203 deletions(-) diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index a89a20d85..b129c4467 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -307,36 +307,37 @@ class _SendViewState extends ConsumerState { _addressToggleFlag = true; } - _cryptoFocus.addListener(() { - if (!_cryptoFocus.hasFocus && !_baseFocus.hasFocus) { - if (_amountToSend == null) { - setState(() { - _calculateFeesFuture = calculateFees(0); - }); - } else { - setState(() { - _calculateFeesFuture = calculateFees( - Format.decimalAmountToSatoshis(_amountToSend!, coin)); - }); + if (coin != Coin.epicCash) { + _cryptoFocus.addListener(() { + if (!_cryptoFocus.hasFocus && !_baseFocus.hasFocus) { + if (_amountToSend == null) { + setState(() { + _calculateFeesFuture = calculateFees(0); + }); + } else { + setState(() { + _calculateFeesFuture = calculateFees( + Format.decimalAmountToSatoshis(_amountToSend!, coin)); + }); + } } - } - }); + }); - _baseFocus.addListener(() { - if (!_cryptoFocus.hasFocus && !_baseFocus.hasFocus) { - if (_amountToSend == null) { - setState(() { - _calculateFeesFuture = calculateFees(0); - }); - } else { - setState(() { - _calculateFeesFuture = calculateFees( - Format.decimalAmountToSatoshis(_amountToSend!, coin)); - }); + _baseFocus.addListener(() { + if (!_cryptoFocus.hasFocus && !_baseFocus.hasFocus) { + if (_amountToSend == null) { + setState(() { + _calculateFeesFuture = calculateFees(0); + }); + } else { + setState(() { + _calculateFeesFuture = calculateFees( + Format.decimalAmountToSatoshis(_amountToSend!, coin)); + }); + } } - } - }); - + }); + } super.initState(); } @@ -1324,172 +1325,183 @@ class _SendViewState extends ConsumerState { const SizedBox( height: 12, ), - Text( - "Transaction fee (estimated)", - style: STextStyles.smallMed12(context), - textAlign: TextAlign.left, - ), - const SizedBox( - height: 8, - ), - Stack( - children: [ - TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: - Util.isDesktop ? false : true, - controller: feeController, - readOnly: true, - textInputAction: TextInputAction.none, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 12, + if (coin != Coin.epicCash) + Text( + "Transaction fee (estimated)", + style: STextStyles.smallMed12(context), + textAlign: TextAlign.left, + ), + if (coin != Coin.epicCash) + const SizedBox( + height: 8, + ), + if (coin != Coin.epicCash) + Stack( + children: [ + TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: + Util.isDesktop ? false : true, + controller: feeController, + readOnly: true, + textInputAction: TextInputAction.none, ), - child: RawMaterialButton( - splashColor: Theme.of(context) - .extension()! - .highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, ), - onPressed: (coin == Coin.firo || - coin == Coin.firoTestNet) && - ref - .watch( - publicPrivateBalanceStateProvider - .state) - .state == - "Private" - ? null - : () { - showModalBottomSheet( - backgroundColor: Colors.transparent, - context: context, - shape: const RoundedRectangleBorder( - borderRadius: - BorderRadius.vertical( - top: Radius.circular(20), + child: RawMaterialButton( + splashColor: Theme.of(context) + .extension()! + .highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: (coin == Coin.firo || + coin == Coin.firoTestNet) && + ref + .watch( + publicPrivateBalanceStateProvider + .state) + .state == + "Private" + ? null + : () { + showModalBottomSheet( + backgroundColor: + Colors.transparent, + context: context, + shape: + const RoundedRectangleBorder( + borderRadius: + BorderRadius.vertical( + top: Radius.circular(20), + ), ), - ), - builder: (_) => - TransactionFeeSelectionSheet( - walletId: walletId, - amount: Decimal.tryParse( - cryptoAmountController - .text) ?? - Decimal.zero, - updateChosen: (String fee) { - setState(() { - _calculateFeesFuture = - Future(() => fee); - }); - }, - ), - ); - }, - child: ((coin == Coin.firo || - coin == Coin.firoTestNet) && - ref - .watch( - publicPrivateBalanceStateProvider - .state) - .state == - "Private") - ? Row( - children: [ - FutureBuilder( - future: _calculateFeesFuture, - builder: (context, snapshot) { - if (snapshot.connectionState == - ConnectionState.done && - snapshot.hasData) { - return Text( - "~${snapshot.data! as String} ${coin.ticker}", + builder: (_) => + TransactionFeeSelectionSheet( + walletId: walletId, + amount: Decimal.tryParse( + cryptoAmountController + .text) ?? + Decimal.zero, + updateChosen: (String fee) { + setState(() { + _calculateFeesFuture = + Future(() => fee); + }); + }, + ), + ); + }, + child: ((coin == Coin.firo || + coin == Coin.firoTestNet) && + ref + .watch( + publicPrivateBalanceStateProvider + .state) + .state == + "Private") + ? Row( + children: [ + FutureBuilder( + future: _calculateFeesFuture, + builder: (context, snapshot) { + if (snapshot.connectionState == + ConnectionState + .done && + snapshot.hasData) { + return Text( + "~${snapshot.data! as String} ${coin.ticker}", + style: STextStyles + .itemSubtitle( + context), + ); + } else { + return AnimatedText( + stringsToLoopThrough: const [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ], + style: STextStyles + .itemSubtitle( + context), + ); + } + }, + ), + ], + ) + : Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Text( + ref + .watch( + feeRateTypeStateProvider + .state) + .state + .prettyName, style: STextStyles - .itemSubtitle(context), - ); - } else { - return AnimatedText( - stringsToLoopThrough: const [ - "Calculating", - "Calculating.", - "Calculating..", - "Calculating...", - ], - style: STextStyles - .itemSubtitle(context), - ); - } - }, - ), - ], - ) - : Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - ref - .watch( - feeRateTypeStateProvider - .state) - .state - .prettyName, - style: STextStyles - .itemSubtitle12(context), - ), - const SizedBox( - width: 10, - ), - FutureBuilder( - future: _calculateFeesFuture, - builder: (context, snapshot) { - if (snapshot.connectionState == - ConnectionState - .done && - snapshot.hasData) { - return Text( - "~${snapshot.data! as String} ${coin.ticker}", - style: STextStyles - .itemSubtitle( - context), - ); - } else { - return AnimatedText( - stringsToLoopThrough: const [ - "Calculating", - "Calculating.", - "Calculating..", - "Calculating...", - ], - style: STextStyles - .itemSubtitle( - context), - ); - } - }, - ), - ], - ), - SvgPicture.asset( - Assets.svg.chevronDown, - width: 8, - height: 4, - color: Theme.of(context) - .extension()! - .textSubtitle2, - ), - ], - ), - ), - ) - ], - ), + .itemSubtitle12( + context), + ), + const SizedBox( + width: 10, + ), + FutureBuilder( + future: + _calculateFeesFuture, + builder: + (context, snapshot) { + if (snapshot.connectionState == + ConnectionState + .done && + snapshot.hasData) { + return Text( + "~${snapshot.data! as String} ${coin.ticker}", + style: STextStyles + .itemSubtitle( + context), + ); + } else { + return AnimatedText( + stringsToLoopThrough: const [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ], + style: STextStyles + .itemSubtitle( + context), + ); + } + }, + ), + ], + ), + SvgPicture.asset( + Assets.svg.chevronDown, + width: 8, + height: 4, + color: Theme.of(context) + .extension()! + .textSubtitle2, + ), + ], + ), + ), + ) + ], + ), const Spacer(), const SizedBox( height: 12, diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 42890400c..f1b967471 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -1364,21 +1364,24 @@ class _DesktopSendState extends ConsumerState { const SizedBox( height: 20, ), - Text( - "Transaction fee (estimated)", - style: STextStyles.desktopTextExtraSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .textFieldActiveSearchIconRight, + if (coin != Coin.epicCash) + Text( + "Transaction fee (estimated)", + style: STextStyles.desktopTextExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + textAlign: TextAlign.left, + ), + if (coin != Coin.epicCash) + const SizedBox( + height: 10, + ), + if (coin != Coin.epicCash) + DesktopFeeDropDown( + walletId: walletId, ), - textAlign: TextAlign.left, - ), - const SizedBox( - height: 10, - ), - DesktopFeeDropDown( - walletId: walletId, - ), const SizedBox( height: 36, ),