mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +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)))
|
if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin)))
|
||||||
ConditionalParent(
|
ConditionalParent(
|
||||||
condition: coin.isElectrumXCoin,
|
condition: coin.isElectrumXCoin &&
|
||||||
|
!(((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
|
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||||
|
"Private")),
|
||||||
builder: (child) => Row(
|
builder: (child) => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
@ -1421,7 +1424,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
),
|
),
|
||||||
if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin)))
|
if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin)))
|
||||||
if (!isCustomFee)
|
if (!isCustomFee)
|
||||||
(feeSelectionResult?.$2 == null)
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: (feeSelectionResult?.$2 == null)
|
||||||
? FutureBuilder(
|
? FutureBuilder(
|
||||||
future: ref.watch(
|
future: ref.watch(
|
||||||
walletsChangeNotifierProvider.select(
|
walletsChangeNotifierProvider.select(
|
||||||
|
@ -1435,6 +1440,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
feeObject: snapshot.data,
|
feeObject: snapshot.data,
|
||||||
feeRateType: FeeRateType.average,
|
feeRateType: FeeRateType.average,
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
|
isButton: false,
|
||||||
feeFor: ({
|
feeFor: ({
|
||||||
required Amount amount,
|
required Amount amount,
|
||||||
required FeeRateType feeRateType,
|
required FeeRateType feeRateType,
|
||||||
|
@ -1449,8 +1455,10 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
.read(walletsChangeNotifierProvider)
|
.read(walletsChangeNotifierProvider)
|
||||||
.getManager(walletId);
|
.getManager(walletId);
|
||||||
|
|
||||||
if (coin == Coin.monero || coin == Coin.wownero) {
|
if (coin == Coin.monero ||
|
||||||
final fee = await manager.estimateFeeFor(amount,
|
coin == Coin.wownero) {
|
||||||
|
final fee = await manager.estimateFeeFor(
|
||||||
|
amount,
|
||||||
MoneroTransactionPriority.regular.raw!);
|
MoneroTransactionPriority.regular.raw!);
|
||||||
ref
|
ref
|
||||||
.read(feeSheetSessionCacheProvider)
|
.read(feeSheetSessionCacheProvider)
|
||||||
|
@ -1465,8 +1473,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
"Private") {
|
"Private") {
|
||||||
ref
|
ref
|
||||||
.read(feeSheetSessionCacheProvider)
|
.read(feeSheetSessionCacheProvider)
|
||||||
.average[amount] =
|
.average[amount] = await (manager.wallet
|
||||||
await (manager.wallet as FiroWallet)
|
as FiroWallet)
|
||||||
.estimateFeeForPublic(amount, feeRate);
|
.estimateFeeForPublic(amount, feeRate);
|
||||||
} else {
|
} else {
|
||||||
ref
|
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(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
feeSelectionResult?.$2 ?? "",
|
feeSelectionResult?.$2 ?? "",
|
||||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
style: STextStyles.desktopTextExtraExtraSmall(
|
||||||
|
context)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -1515,7 +1546,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
feeSelectionResult?.$3 ?? "",
|
feeSelectionResult?.$3 ?? "",
|
||||||
style: STextStyles.desktopTextExtraExtraSmall(context)
|
style: STextStyles.desktopTextExtraExtraSmall(
|
||||||
|
context)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -1524,6 +1556,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
if (isCustomFee)
|
if (isCustomFee)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
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/enums/fee_rate_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/widgets/animated_text.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.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||||
|
|
||||||
|
@ -234,6 +235,7 @@ class DesktopFeeItem extends ConsumerStatefulWidget {
|
||||||
required this.walletId,
|
required this.walletId,
|
||||||
required this.feeFor,
|
required this.feeFor,
|
||||||
required this.isSelected,
|
required this.isSelected,
|
||||||
|
this.isButton = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final FeeObject? feeObject;
|
final FeeObject? feeObject;
|
||||||
|
@ -246,6 +248,7 @@ class DesktopFeeItem extends ConsumerStatefulWidget {
|
||||||
required Coin coin,
|
required Coin coin,
|
||||||
}) feeFor;
|
}) feeFor;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
|
final bool isButton;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ConsumerState<DesktopFeeItem> createState() => _DesktopFeeItemState();
|
ConsumerState<DesktopFeeItem> createState() => _DesktopFeeItemState();
|
||||||
|
@ -291,7 +294,9 @@ class _DesktopFeeItemState extends ConsumerState<DesktopFeeItem> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType : ${widget.feeRateType}");
|
debugPrint("BUILD: $runtimeType : ${widget.feeRateType}");
|
||||||
|
|
||||||
return MaterialButton(
|
return ConditionalParent(
|
||||||
|
condition: widget.isButton,
|
||||||
|
builder: (child) => MaterialButton(
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop(
|
Navigator.of(context).pop(
|
||||||
|
@ -302,8 +307,37 @@ class _DesktopFeeItemState extends ConsumerState<DesktopFeeItem> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
child: Builder(
|
child: Builder(
|
||||||
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) {
|
if (widget.feeRateType == FeeRateType.custom) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|
Loading…
Reference in a new issue