mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-09-29 09:51:09 +00:00
fix: disable fee selection for firo private send on desktop
This commit is contained in:
parent
3a9f567150
commit
c784d2cf04
2 changed files with 167 additions and 100 deletions
|
@ -1369,7 +1369,10 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
),
|
||||
if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin)))
|
||||
ConditionalParent(
|
||||
condition: coin.isElectrumXCoin,
|
||||
condition: coin.isElectrumXCoin &&
|
||||
!(((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private")),
|
||||
builder: (child) => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
@ -1421,7 +1424,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
),
|
||||
if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin)))
|
||||
if (!isCustomFee)
|
||||
(feeSelectionResult?.$2 == null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: (feeSelectionResult?.$2 == null)
|
||||
? FutureBuilder(
|
||||
future: ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
|
@ -1435,6 +1440,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
feeObject: snapshot.data,
|
||||
feeRateType: FeeRateType.average,
|
||||
walletId: walletId,
|
||||
isButton: false,
|
||||
feeFor: ({
|
||||
required Amount amount,
|
||||
required FeeRateType feeRateType,
|
||||
|
@ -1449,8 +1455,10 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(walletId);
|
||||
|
||||
if (coin == Coin.monero || coin == Coin.wownero) {
|
||||
final fee = await manager.estimateFeeFor(amount,
|
||||
if (coin == Coin.monero ||
|
||||
coin == Coin.wownero) {
|
||||
final fee = await manager.estimateFeeFor(
|
||||
amount,
|
||||
MoneroTransactionPriority.regular.raw!);
|
||||
ref
|
||||
.read(feeSheetSessionCacheProvider)
|
||||
|
@ -1465,8 +1473,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
"Private") {
|
||||
ref
|
||||
.read(feeSheetSessionCacheProvider)
|
||||
.average[amount] =
|
||||
await (manager.wallet as FiroWallet)
|
||||
.average[amount] = await (manager.wallet
|
||||
as FiroWallet)
|
||||
.estimateFeeForPublic(amount, feeRate);
|
||||
} else {
|
||||
ref
|
||||
|
@ -1500,12 +1508,35 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
}
|
||||
},
|
||||
)
|
||||
: (coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref
|
||||
.watch(
|
||||
publicPrivateBalanceStateProvider.state)
|
||||
.state ==
|
||||
"Private"
|
||||
? Text(
|
||||
"~${ref.watch(pAmountFormatter(coin)).format(
|
||||
Amount(
|
||||
rawValue: BigInt.parse("3794"),
|
||||
fractionDigits: coin.decimals,
|
||||
),
|
||||
indicatePrecisionLoss: false,
|
||||
)}",
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldActiveText,
|
||||
),
|
||||
textAlign: TextAlign.left,
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
feeSelectionResult?.$2 ?? "",
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
||||
style: STextStyles.desktopTextExtraExtraSmall(
|
||||
context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -1515,7 +1546,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
),
|
||||
Text(
|
||||
feeSelectionResult?.$3 ?? "",
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
||||
style: STextStyles.desktopTextExtraExtraSmall(
|
||||
context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -1524,6 +1556,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isCustomFee)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/animated_text.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
|
||||
|
@ -234,6 +235,7 @@ class DesktopFeeItem extends ConsumerStatefulWidget {
|
|||
required this.walletId,
|
||||
required this.feeFor,
|
||||
required this.isSelected,
|
||||
this.isButton = true,
|
||||
}) : super(key: key);
|
||||
|
||||
final FeeObject? feeObject;
|
||||
|
@ -246,6 +248,7 @@ class DesktopFeeItem extends ConsumerStatefulWidget {
|
|||
required Coin coin,
|
||||
}) feeFor;
|
||||
final bool isSelected;
|
||||
final bool isButton;
|
||||
|
||||
@override
|
||||
ConsumerState<DesktopFeeItem> createState() => _DesktopFeeItemState();
|
||||
|
@ -291,7 +294,9 @@ class _DesktopFeeItemState extends ConsumerState<DesktopFeeItem> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType : ${widget.feeRateType}");
|
||||
|
||||
return MaterialButton(
|
||||
return ConditionalParent(
|
||||
condition: widget.isButton,
|
||||
builder: (child) => MaterialButton(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(
|
||||
|
@ -302,8 +307,37 @@ class _DesktopFeeItemState extends ConsumerState<DesktopFeeItem> {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: child,
|
||||
),
|
||||
child: Builder(
|
||||
builder: (_) {
|
||||
if (!widget.isButton) {
|
||||
final coin = ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value.getManager(widget.walletId).coin,
|
||||
),
|
||||
);
|
||||
if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.watch(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
return Text(
|
||||
"~${ref.watch(pAmountFormatter(coin)).format(
|
||||
Amount(
|
||||
rawValue: BigInt.parse("3794"),
|
||||
fractionDigits: coin.decimals,
|
||||
),
|
||||
indicatePrecisionLoss: false,
|
||||
)}",
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldActiveText,
|
||||
),
|
||||
textAlign: TextAlign.left,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (widget.feeRateType == FeeRateType.custom) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
|
|
Loading…
Reference in a new issue