Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
isSpark: wallet is FiroWallet && !firoPublicSend,
onCancel: () {
wasCancelled = true;
Navigator.of(context).pop();
},
);
},
Expand Down
41 changes: 20 additions & 21 deletions lib/pages/exchange_view/send_from_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class _SendFromViewState extends ConsumerState<SendFromView> {
builder: (child) {
return Background(
child: Scaffold(
backgroundColor: Theme.of(
context,
).extension<StackColors>()!.background,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
Expand Down Expand Up @@ -225,9 +225,8 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
Future<void> _send({bool? shouldSendPublicFiroFunds}) async {
final coin = ref.read(pWalletCoin(walletId));

bool wasCancelled = false;
try {
bool wasCancelled = false;

final wallet = ref.read(pWallets).getWallet(walletId);

unawaited(
Expand Down Expand Up @@ -362,7 +361,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
}
} catch (e, s) {
Logging.instance.e("$e\n$s", error: e, stackTrace: s);
if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context, rootNavigator: Util.isDesktop).pop();

Expand All @@ -381,9 +380,9 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
child: Text(
"Ok",
style: STextStyles.button(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.buttonTextSecondary,
color: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondary,
),
),
onPressed: () {
Expand Down Expand Up @@ -427,9 +426,9 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
children: [
if (!trade.exchangeName.startsWith(TrocadorExchange.exchangeName))
MaterialButton(
splashColor: Theme.of(
context,
).extension<StackColors>()!.highlight,
splashColor: Theme.of(context)
.extension<StackColors>()!
.highlight,
key: Key("walletsSheetItemButtonFiroPrivateKey_$walletId"),
padding: const EdgeInsets.all(0),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
Expand Down Expand Up @@ -481,19 +480,19 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
Assets.svg.chevronRight,
height: 14,
width: 7,
color: Theme.of(
context,
).extension<StackColors>()!.infoItemLabel,
color: Theme.of(context)
.extension<StackColors>()!
.infoItemLabel,
),
],
),
),
),
),
MaterialButton(
splashColor: Theme.of(
context,
).extension<StackColors>()!.highlight,
splashColor: Theme.of(context)
.extension<StackColors>()!
.highlight,
key: Key("walletsSheetItemButtonFiroPublicKey_$walletId"),
padding: const EdgeInsets.all(0),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
Expand Down Expand Up @@ -543,9 +542,9 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
Assets.svg.chevronRight,
height: 14,
width: 7,
color: Theme.of(
context,
).extension<StackColors>()!.infoItemLabel,
color: Theme.of(context)
.extension<StackColors>()!
.infoItemLabel,
),
],
),
Expand Down
17 changes: 6 additions & 11 deletions lib/pages/namecoin_names/sub_widgets/transfer_option_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
FocusScope.of(context).unfocus();
await Future<void>.delayed(const Duration(milliseconds: 100));

bool wasCancelled = false;
try {
final wallet = ref.read(pWallets).getWallet(walletId) as NamecoinWallet;

bool wasCancelled = false;

if (mounted) {
if (Util.isDesktop) {
unawaited(
Expand Down Expand Up @@ -194,7 +193,7 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
stackTrace: s,
);

if (mounted) {
if (mounted && !wasCancelled) {
String err = e.toString();
if (err.startsWith("Exception: ")) {
err = err.replaceFirst("Exception: ", "");
Expand Down Expand Up @@ -361,8 +360,7 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
children: [
_addressController.text.isNotEmpty
? TextFieldIconButton(
semanticsLabel:
"Clear Button. Clears The Address Field Input.",
semanticsLabel: "Clear Button. Clears The Address Field Input.",
key: const Key(
"nameTransferClearAddressFieldButtonKey",
),
Expand All @@ -375,8 +373,7 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
child: const XIcon(),
)
: TextFieldIconButton(
semanticsLabel:
"Paste Button. Pastes From Clipboard To Address Field Input.",
semanticsLabel: "Paste Button. Pastes From Clipboard To Address Field Input.",
key: const Key(
"nameTransferPasteAddressFieldButtonKey",
),
Expand Down Expand Up @@ -405,8 +402,7 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
),
if (_addressController.text.isEmpty)
TextFieldIconButton(
semanticsLabel:
"Address Book Button. Opens Address Book For Address Field.",
semanticsLabel: "Address Book Button. Opens Address Book For Address Field.",
key: const Key(
"nameTransferAddressBookButtonKey",
),
Expand All @@ -420,8 +416,7 @@ class _TransferOptionWidgetState extends ConsumerState<TransferOptionWidget> {
),
if (_addressController.text.isEmpty)
TextFieldIconButton(
semanticsLabel:
"Scan QR Button. Opens Camera For Scanning QR Code.",
semanticsLabel: "Scan QR Button. Opens Camera For Scanning QR Code.",
key: const Key("nameTransferScanQrButtonKey"),
onTap: _scanQr,
child: const QrCodeIcon(),
Expand Down
55 changes: 26 additions & 29 deletions lib/pages/namecoin_names/sub_widgets/update_option_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
Future<void> _previewUpdate() async {
if (_previewLock) return;
_previewLock = true;
bool wasCancelled = false;
try {
final newValue = _getNewValue();
if (newValue == _currentValue) {
Expand All @@ -86,8 +87,6 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
final wallet =
ref.read(pWallets).getWallet(widget.walletId) as NamecoinWallet;

bool wasCancelled = false;

if (mounted) {
if (Util.isDesktop) {
unawaited(
Expand Down Expand Up @@ -183,16 +182,15 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
if (Util.isDesktop) {
await showDialog<void>(
context: context,
builder:
(context) => SDialog(
child: SizedBox(
width: 580,
child: ConfirmNameTransactionView(
txData: txData,
walletId: widget.walletId,
),
),
builder: (context) => SDialog(
child: SizedBox(
width: 580,
child: ConfirmNameTransactionView(
txData: txData,
walletId: widget.walletId,
),
),
),
);
} else {
await Navigator.of(context).pushNamed(
Expand All @@ -214,16 +212,15 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
err = "Contains invalid characters";
}

if (mounted) {
if (mounted && !wasCancelled) {
await showDialog<void>(
context: context,
builder:
(_) => StackOkDialog(
title: "Update failed",
message: err,
desktopPopRootNavigator: Util.isDesktop,
maxWidth: Util.isDesktop ? 600 : null,
),
builder: (_) => StackOkDialog(
title: "Update failed",
message: err,
desktopPopRootNavigator: Util.isDesktop,
maxWidth: Util.isDesktop ? 600 : null,
),
);
}
} finally {
Expand Down Expand Up @@ -260,10 +257,9 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
Util.isDesktop
? CrossAxisAlignment.start
: CrossAxisAlignment.stretch,
crossAxisAlignment: Util.isDesktop
? CrossAxisAlignment.start
: CrossAxisAlignment.stretch,
children: [
Text("Edit value", style: STextStyles.label(context)),
const SizedBox(height: 6),
Expand Down Expand Up @@ -293,10 +289,9 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
return Text(
"$length/$valueMaxLength",
style: STextStyles.w500_10(context).copyWith(
color:
Theme.of(
context,
).extension<StackColors>()!.textSubtitle2,
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle2,
),
);
},
Expand All @@ -311,8 +306,10 @@ class _BuyDomainWidgetState extends ConsumerState<UpdateOptionWidget> {
child: SecondaryButton(
label: "Cancel",
buttonHeight: Util.isDesktop ? ButtonHeight.l : null,
onPressed:
Navigator.of(context, rootNavigator: Util.isDesktop).pop,
onPressed: Navigator.of(
context,
rootNavigator: Util.isDesktop,
).pop,
),
),
const SizedBox(width: 16),
Expand Down
5 changes: 2 additions & 3 deletions lib/pages/salvium_stake/salvium_create_stake_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ class _SalviumCreateStakeViewState
if (_lock) return;
_lock = true;

bool wasCancelled = false;
try {
bool wasCancelled = false;

unawaited(
showDialog<dynamic>(
context: context,
Expand Down Expand Up @@ -170,7 +169,7 @@ class _SalviumCreateStakeViewState
} catch (e, s) {
Logging.instance.e("Salvium stake preview: ", error: e, stackTrace: s);

if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context, rootNavigator: Util.isDesktop).pop();

Expand Down
5 changes: 2 additions & 3 deletions lib/pages/send_view/send_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,8 @@ class _SendViewState extends ConsumerState<SendView> {
}
}

bool wasCancelled = false;
try {
bool wasCancelled = false;

if (mounted) {
unawaited(
showDialog<void>(
Expand Down Expand Up @@ -1167,7 +1166,7 @@ class _SendViewState extends ConsumerState<SendView> {
}
} catch (e, s) {
Logging.instance.e("$e\n$s", error: e, stackTrace: s);
if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context, rootNavigator: true).pop();

Expand Down
5 changes: 2 additions & 3 deletions lib/pages/send_view/sol_token_send_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,8 @@ class _SolTokenSendViewState extends ConsumerState<SolTokenSendView> {
final wallet = ref.read(pWallets).getWallet(walletId);
final Amount amount = _amountToSend!;

bool wasCancelled = false;
try {
bool wasCancelled = false;

if (mounted) {
unawaited(
showDialog<void>(
Expand Down Expand Up @@ -543,7 +542,7 @@ class _SolTokenSendViewState extends ConsumerState<SolTokenSendView> {
}
} catch (e, s) {
Logging.instance.e("$e\n$s", error: e, stackTrace: s);
if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context).pop();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../../themes/coin_image_provider.dart';
import '../../../themes/stack_colors.dart';
import '../../../utilities/text_styles.dart';
Expand Down Expand Up @@ -115,7 +116,6 @@ class _RestoringDialogState extends ConsumerState<BuildingTransactionDialog> {
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context).pop();
onCancel.call();
},
),
Expand All @@ -140,7 +140,6 @@ class _RestoringDialogState extends ConsumerState<BuildingTransactionDialog> {
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context).pop();
onCancel.call();
},
),
Expand Down
5 changes: 2 additions & 3 deletions lib/pages/send_view/token_send_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ class _TokenSendViewState extends ConsumerState<TokenSendView> {
// }
// }

bool wasCancelled = false;
try {
bool wasCancelled = false;

if (mounted) {
unawaited(
showDialog<void>(
Expand Down Expand Up @@ -538,7 +537,7 @@ class _TokenSendViewState extends ConsumerState<TokenSendView> {
}
} catch (e, s) {
Logging.instance.e("$e\n$s", error: e, stackTrace: s);
if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context).pop();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
}
}

bool wasCancelled = false;
try {
bool wasCancelled = false;

if (mounted) {
unawaited(
showDialog<dynamic>(
Expand Down Expand Up @@ -793,7 +792,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
}
} catch (e, s) {
Logging.instance.e("Desktop send: ", error: e, stackTrace: s);
if (mounted) {
if (mounted && !wasCancelled) {
// pop building dialog
Navigator.of(context, rootNavigator: true).pop();

Expand Down
Loading
Loading