Skip to content

Commit 2301570

Browse files
committed
wip; root level route experiment
TODO tests Signed-off-by: Zixuan James Li <[email protected]>
1 parent c3fe62a commit 2301570

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/widgets/app.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ class ChooseAccountPage extends StatelessWidget {
266266
// The default trailing padding with M3 is 24px. Decrease by 12 because
267267
// IconButton (the "…" button) comes with 12px padding on all sides.
268268
contentPadding: const EdgeInsetsDirectional.only(start: 16, end: 12),
269-
onTap: () => Navigator.push(context,
270-
HomePage.buildRoute(accountId: accountId))));
269+
onTap: () async {
270+
final navigator = Navigator.of(context);
271+
navigator.popUntil((route) => route.isFirst);
272+
unawaited(navigator.pushReplacement(
273+
HomePage.buildRoute(accountId: accountId)));
274+
}));
271275
}
272276

273277
@override

lib/widgets/login.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,10 @@ class _LoginPageState extends State<LoginPage> {
395395
return;
396396
}
397397

398-
unawaited(Navigator.of(context).pushAndRemoveUntil(
399-
HomePage.buildRoute(accountId: accountId),
400-
(route) => (route is! _LoginSequenceRoute)),
401-
);
398+
final navigator = Navigator.of(context);
399+
navigator.popUntil((route) => route.isFirst);
400+
unawaited(Navigator.of(context).pushReplacement(
401+
HomePage.buildRoute(accountId: accountId)));
402402
}
403403

404404
Future<int> _getUserId(String email, String apiKey) async {

0 commit comments

Comments
 (0)