mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 04:34:34 +00:00
eth token wallet navigation fixes
This commit is contained in:
parent
122430f03c
commit
9c4ccfa7ad
4 changed files with 163 additions and 134 deletions
|
@ -37,12 +37,14 @@ class TokenView extends ConsumerStatefulWidget {
|
||||||
const TokenView({
|
const TokenView({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.walletId,
|
required this.walletId,
|
||||||
|
this.popPrevious = false,
|
||||||
this.eventBus,
|
this.eventBus,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
static const String routeName = "/token";
|
static const String routeName = "/token";
|
||||||
|
|
||||||
final String walletId;
|
final String walletId;
|
||||||
|
final bool popPrevious;
|
||||||
final EventBus? eventBus;
|
final EventBus? eventBus;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -69,13 +71,27 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType");
|
debugPrint("BUILD: $runtimeType");
|
||||||
|
|
||||||
return Background(
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
final nav = Navigator.of(context);
|
||||||
|
if (widget.popPrevious) {
|
||||||
|
nav.pop();
|
||||||
|
}
|
||||||
|
nav.pop();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Background(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: AppBarBackButton(
|
leading: AppBarBackButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
final nav = Navigator.of(context);
|
||||||
|
if (widget.popPrevious) {
|
||||||
|
nav.pop();
|
||||||
|
}
|
||||||
|
nav.pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
@ -223,6 +239,7 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1992,6 +1992,17 @@ class RouteGenerator {
|
||||||
name: settings.name,
|
name: settings.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (args is ({String walletId, bool popPrevious})) {
|
||||||
|
return getRoute(
|
||||||
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||||
|
builder: (_) => TokenView(
|
||||||
|
walletId: args.walletId,
|
||||||
|
popPrevious: args.popPrevious,
|
||||||
|
),
|
||||||
|
settings: RouteSettings(
|
||||||
|
name: settings.name,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import 'package:stackwallet/services/coins/ethereum/ethereum_wallet.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
|
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
|
||||||
import 'package:stackwallet/widgets/expandable.dart';
|
import 'package:stackwallet/widgets/expandable.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
@ -141,7 +142,7 @@ class _MasterWalletCardState extends ConsumerState<MasterWalletCard> {
|
||||||
child: SimpleWalletCard(
|
child: SimpleWalletCard(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
contractAddress: e,
|
contractAddress: e,
|
||||||
popPrevious: true,
|
popPrevious: Util.isDesktop,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -157,7 +157,7 @@ class SimpleWalletCard extends ConsumerWidget {
|
||||||
} else {
|
} else {
|
||||||
await nav.pushNamed(
|
await nav.pushNamed(
|
||||||
TokenView.routeName,
|
TokenView.routeName,
|
||||||
arguments: walletId,
|
arguments: (walletId: walletId, popPrevious: !Util.isDesktop),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue