Skip to content

Commit 08462b5

Browse files
committed
Router: Modifying parameters to retrieve 'BungieAccountData' object
1 parent ef88161 commit 08462b5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/src/router.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import 'package:flutter/material.dart';
33

44
import 'package:go_router/go_router.dart';
5+
import 'package:guardian_dock/api/models/bungie_account.dart';
56

67
import 'package:guardian_dock/api/models/news_article.dart';
78
import 'package:guardian_dock/src/views/article_view.dart';
@@ -37,10 +38,10 @@ final mainRoutes = [
3738
GoRoute(
3839
path: '/stats/:bungieId',
3940
pageBuilder: (context, state) {
40-
int bungieId = int.parse(state.pathParameters['bungieId']!);
41+
BungieAccountData playerBungieAccount = state.extra as BungieAccountData;
4142

4243
return CustomTransitionPage(
43-
child: Text(bungieId.toString()),
44+
child: Text(playerBungieAccount.fullBungieId),
4445
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget? widget) => SlideTransition(
4546
position: animation.drive(
4647
Tween<Offset>(

lib/src/widgets/persistent_search_bar.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ class _PersistentSearchBarState extends State<PersistentSearchBar> {
8787
color: Theme.of(context).colorScheme.onSurface.withOpacity(.15)
8888
),
8989
onSelected: (BungieAccountData value) {
90-
GoRouter.of(context).push('/stats/${value.bungieNetMembershipId}');
90+
GoRouter
91+
.of(context)
92+
.push('/stats/${value.bungieNetMembershipId}', extra: value);
9193
},
9294
),
9395
),

0 commit comments

Comments
 (0)