Skip to content

Commit dff087e

Browse files
committed
refactor: Simplify navigation by removing main tabs
Removed the main tab navigation, which previously included "Game" and "Mine" tabs. The app now defaults directly to the `GamePage`. - Deleted `MainIndexPage`, `MinePage`, and their associated localization files. - Updated the routing configuration in `lib/route.dart` to remove the `StatefulShellRoute` and direct the root path `/` to `GamePage`. - Moved the settings button from the now-deleted `MinePage` to the `AppBar` of the `GamePage`.
1 parent 7d4ba6f commit dff087e

File tree

5 files changed

+17
-97
lines changed

5 files changed

+17
-97
lines changed

lib/route.dart

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,23 @@ import 'package:escape_wild/ui/game/backpack/backpack.dart';
33
import 'package:escape_wild/ui/game/craft/craft.dart';
44
import 'package:escape_wild/ui/game/index.dart';
55
import 'package:escape_wild/ui/main/game.dart';
6-
import 'package:escape_wild/ui/main/index.dart';
7-
import 'package:escape_wild/ui/main/mine.dart';
86
import 'package:flutter/widgets.dart';
97
import 'package:go_router/go_router.dart';
108

11-
final _$mainGame = GlobalKey<NavigatorState>();
12-
final _$mainMine = GlobalKey<NavigatorState>();
139
final _$gameAction = GlobalKey<NavigatorState>();
1410
final _$gameBackpack = GlobalKey<NavigatorState>();
1511
final _$gameCraft = GlobalKey<NavigatorState>();
1612

1713
RoutingConfig buildRoutingConfig() {
1814
return RoutingConfig(
1915
routes: [
20-
GoRoute(path: "/", redirect: (ctx, state) => "/main/game"),
16+
GoRoute(path: "/", builder: (ctx, state) => GamePage()),
2117
GoRoute(
2218
path: "/main",
2319
redirect: (ctx, state) {
2420
if (state.fullPath == "/main") return "/main/game";
2521
return null;
2622
},
27-
routes: [
28-
StatefulShellRoute.indexedStack(
29-
builder: (ctx, state, navigationShell) {
30-
return MainIndexPage(navigationShell: navigationShell);
31-
},
32-
branches: [
33-
StatefulShellBranch(
34-
navigatorKey: _$mainGame,
35-
routes: [GoRoute(path: "/game", builder: (ctx, state) => const GamePage())],
36-
),
37-
StatefulShellBranch(
38-
navigatorKey: _$mainMine,
39-
routes: [GoRoute(path: "/mine", builder: (ctx, state) => const MinePage())],
40-
),
41-
],
42-
),
43-
],
4423
),
4524
GoRoute(
4625
path: "/game",

lib/ui/main/game.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import 'package:go_router/go_router.dart';
44
import 'package:hive_flutter/adapters.dart';
55
import 'package:rettulf/rettulf.dart';
66
import 'package:easy_localization/easy_localization.dart';
7+
import 'package:tabler_icons/tabler_icons.dart';
8+
9+
import 'settings.dart';
710

811
part 'game.i18n.dart';
912

@@ -18,7 +21,19 @@ class _GamePageState extends State<GamePage> {
1821
@override
1922
Widget build(BuildContext context) {
2023
return Scaffold(
21-
appBar: AppBar(centerTitle: true, elevation: 0, backgroundColor: Colors.transparent),
24+
appBar: AppBar(
25+
centerTitle: true,
26+
elevation: 0,
27+
backgroundColor: Colors.transparent,
28+
actions: [
29+
IconButton(
30+
onPressed: () {
31+
context.navigator.push(MaterialPageRoute(builder: (_) => const SettingsPage()));
32+
},
33+
icon: const Icon(TablerIcons.settings),
34+
),
35+
],
36+
),
2237
body: buildBody(),
2338
);
2439
}

lib/ui/main/index.dart

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/ui/main/index.i18n.dart

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/ui/main/mine.dart

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)