Skip to content

Commit

Permalink
Merge pull request #53 from pet-sitter/52-메인-mainpage의-nested-navigat…
Browse files Browse the repository at this point in the history
…ion-로직-수정

Feat: [메인] 메인페이지 Nested Navigation 구현
  • Loading branch information
Yellowtoast authored Jan 17, 2024
2 parents 497123f + afd7237 commit 02074e0
Show file tree
Hide file tree
Showing 12 changed files with 564 additions and 242 deletions.
65 changes: 9 additions & 56 deletions lib/app/router/app_router.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:pets_next_door_flutter/app/router/scaffold_with_nested_navigation.dart';
import 'package:pets_next_door_flutter/presentation/main/main_page.dart';
import 'package:pets_next_door_flutter/presentation/pages/chat/chat_view.dart';
import 'package:pets_next_door_flutter/presentation/pages/gather/gather_view.dart';
import 'package:pets_next_door_flutter/presentation/pages/community/community_view.dart';
import 'package:pets_next_door_flutter/presentation/pages/home/home_view.dart';
import 'package:pets_next_door_flutter/presentation/pages/my_info/profile_view.dart';
import 'package:pets_next_door_flutter/presentation/pages/pet/register_pet_page.dart';
Expand All @@ -26,7 +26,7 @@ enum AppRoute {
signUp,
phoneAuth,
home,
gather,
community,
chat,
myInfo,
profile,
Expand Down Expand Up @@ -64,7 +64,6 @@ GoRouter goRouter(GoRouterRef ref) {
child: SignInPage(),
),
),

GoRoute(
path: AppRoute.signUp.path,
name: AppRoute.signUp.name,
Expand All @@ -73,7 +72,6 @@ GoRouter goRouter(GoRouterRef ref) {
child: SignUpPage(),
),
),

GoRoute(
path: AppRoute.registerPet.path,
name: AppRoute.registerPet.name,
Expand All @@ -82,65 +80,41 @@ GoRouter goRouter(GoRouterRef ref) {
child: const RegisterPetPage(),
),
),

// GoRoute(
// path: '/${AppRoute.registerPetDetail.name}',
// name: AppRoute.registerPetDetail.name,
// pageBuilder: (context, state) => MaterialPage(
// key: state.pageKey,
// child: const RegisterPetInitialView(),
// ),
// ),

StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) {
return ScaffoldWithNestedNavigation(navigationShell: navigationShell);
},
builder: (context, state, navigationShell) =>
MainPage(navigationShell: navigationShell),
branches: [
StatefulShellBranch(
navigatorKey: _homeNavigatorKey,
routes: [
// Products
GoRoute(
path: AppRoute.home.path,
name: AppRoute.home.name,
pageBuilder: (context, state) => NoTransitionPage(
key: state.pageKey,
child: const HomeView(),
),
// routes: [
// GoRoute(
// path: 'login',
// name: AppRoute.login.name,
// pageBuilder: (context, state) => NoTransitionPage(
// key: state.pageKey,
// child: LoginView(),
// ),
// )
// ],
),
],
),
StatefulShellBranch(
navigatorKey: _gatherNavigatorKey,
routes: [
// Shopping Cart
GoRoute(
path: '/gather',
name: AppRoute.gather.name,
path: AppRoute.community.path,
name: AppRoute.community.name,
pageBuilder: (context, state) => NoTransitionPage(
key: state.pageKey,
child: GatherView(),
child: CommunityView(),
),
),
],
),
StatefulShellBranch(
navigatorKey: _chatNavigatorKey,
routes: [
// Shopping Cart
GoRoute(
path: '/chat',
path: AppRoute.chat.path,
name: AppRoute.chat.name,
pageBuilder: (context, state) => NoTransitionPage(
key: state.pageKey,
Expand All @@ -164,27 +138,6 @@ GoRouter goRouter(GoRouterRef ref) {
),
],
),
// GoRoute(
// path: '/login',
// name: AppRoute.login.name,
// pageBuilder: (context, state) => const NoTransitionPage(
// child: LoginView(),
// ),
// ),
// GoRoute(
// path: '/phone_auth',
// name: AppRoute.phoneAuth.name,
// pageBuilder: (context, state) => const NoTransitionPage(
// child: PhoneAuthView(),
// ),
// ),
// GoRoute(
// path: '/home',
// name: AppRoute.home.name,
// pageBuilder: (context, state) => const NoTransitionPage(
// child: HomeView(),
// ),
// ),
],
);
}
2 changes: 1 addition & 1 deletion lib/app/router/app_router.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 0 additions & 164 deletions lib/app/router/scaffold_with_nested_navigation.dart

This file was deleted.

17 changes: 0 additions & 17 deletions lib/features/root/root_view.dart

This file was deleted.

11 changes: 11 additions & 0 deletions lib/presentation/main/main_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:go_router/go_router.dart';

mixin class MainEvent {
void onTapBottomNavigationItem(
{required int index, required StatefulNavigationShell navigationShell}) {
navigationShell.goBranch(
index,
initialLocation: navigationShell.currentIndex == index,
);
}
}
Loading

0 comments on commit 02074e0

Please sign in to comment.