token view pop fix

This commit is contained in:
julian 2023-03-28 16:21:26 -06:00
parent 5e5730d5a5
commit b0d37804fa
2 changed files with 15 additions and 11 deletions

View file

@ -125,7 +125,7 @@ class _MasterWalletCardState extends ConsumerState<MasterWalletCard> {
child: WalletSheetCard( child: WalletSheetCard(
walletId: widget.walletId, walletId: widget.walletId,
contractAddress: e, contractAddress: e,
// popPrevious: true, popPrevious: true,
), ),
), ),
), ),

View file

@ -12,12 +12,11 @@ import 'package:stackwallet/services/ethereum/ethereum_token_service.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart'; import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import '../utilities/show_loading.dart';
class WalletSheetCard extends ConsumerWidget { class WalletSheetCard extends ConsumerWidget {
const WalletSheetCard({ const WalletSheetCard({
Key? key, Key? key,
@ -45,15 +44,17 @@ class WalletSheetCard extends ConsumerWidget {
), ),
), ),
onPressed: () async { onPressed: () async {
final nav = Navigator.of(context);
final manager = final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId); ref.read(walletsChangeNotifierProvider).getManager(walletId);
if (manager.coin == Coin.monero || manager.coin == Coin.wownero) { if (manager.coin == Coin.monero || manager.coin == Coin.wownero) {
await manager.initializeExisting(); await manager.initializeExisting();
} }
if (context.mounted) { if (context.mounted) {
if (popPrevious) Navigator.of(context).pop(); if (popPrevious) nav.pop();
unawaited( unawaited(
Navigator.of(context).pushNamed( nav.pushNamed(
WalletView.routeName, WalletView.routeName,
arguments: Tuple2( arguments: Tuple2(
walletId, walletId,
@ -83,12 +84,15 @@ class WalletSheetCard extends ConsumerWidget {
message: "Loading ${contract.name}", message: "Loading ${contract.name}",
); );
if (context.mounted) { // pop loading
await Navigator.of(context).pushNamed( nav.pop();
TokenView.routeName,
arguments: walletId, // if (context.mounted) {
); await nav.pushNamed(
} TokenView.routeName,
arguments: walletId,
);
// }
} }
} }
}, },