@@ -25,6 +25,7 @@ import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_pr
2525import 'package:on_time_front/presentation/schedule_create/screens/schedule_create_screen.dart' ;
2626import 'package:on_time_front/presentation/schedule_create/screens/schedule_edit_screen.dart' ;
2727import 'package:on_time_front/presentation/shared/components/bottom_nav_bar_scaffold.dart' ;
28+ import 'package:on_time_front/presentation/shared/router/app_route_transition.dart' ;
2829import 'package:on_time_front/presentation/shared/router/route_arguments.dart' ;
2930import 'package:on_time_front/presentation/shared/utils/stream_to_listenable.dart' ;
3031import 'package:on_time_front/presentation/startup/screens/startup_screen.dart' ;
@@ -87,25 +88,43 @@ GoRouter goRouterConfig(
8788 routes: [
8889 GoRoute (
8990 path: '/startup' ,
90- builder: (context, state) => const StartupScreen (),
91+ pageBuilder: (context, state) => _buildAppRoutePage (
92+ state: state,
93+ transition: AppRouteTransition .fade,
94+ child: const StartupScreen (),
95+ ),
9196 ),
9297 GoRoute (
9398 path: '/allowNotification' ,
94- builder: (context, state) {
95- return NotificationAllowScreen ();
96- },
99+ pageBuilder: (context, state) => _buildAppRoutePage (
100+ state: state,
101+ transition: AppRouteTransition .fade,
102+ child: NotificationAllowScreen (),
103+ ),
97104 ),
98105 GoRoute (
99106 path: '/allowAlarm' ,
100- builder: (context, state) => const AlarmAllowScreen (),
107+ pageBuilder: (context, state) => _buildAppRoutePage (
108+ state: state,
109+ transition: AppRouteTransition .fade,
110+ child: const AlarmAllowScreen (),
111+ ),
101112 ),
102113 GoRoute (
103114 path: '/onboarding' ,
104- builder: (context, state) => OnboardingScreen (),
115+ pageBuilder: (context, state) => _buildAppRoutePage (
116+ state: state,
117+ transition: AppRouteTransition .fade,
118+ child: OnboardingScreen (),
119+ ),
105120 routes: [
106121 GoRoute (
107122 path: '/start' ,
108- builder: (context, state) => OnboardingStartScreen (),
123+ pageBuilder: (context, state) => _buildAppRoutePage (
124+ state: state,
125+ transition: AppRouteTransition .fade,
126+ child: OnboardingStartScreen (),
127+ ),
109128 ),
110129 ],
111130 ),
@@ -114,58 +133,86 @@ GoRouter goRouterConfig(
114133 routes: [
115134 GoRoute (
116135 path: '/home' ,
117- pageBuilder: (context, state) => _buildBottomNavSlidePage (
136+ pageBuilder: (context, state) => _buildAppRoutePage (
118137 state: state,
119- beginOffset : const Offset ( - 1 , 0 ) ,
138+ transition : AppRouteTransition .bottomNavFromLeft ,
120139 child: HomeScreenTmp (),
121140 ),
122141 ),
123142 GoRoute (
124143 path: '/myPage' ,
125- pageBuilder: (context, state) => _buildBottomNavSlidePage (
144+ pageBuilder: (context, state) => _buildAppRoutePage (
126145 state: state,
127- beginOffset : const Offset ( 1 , 0 ) ,
146+ transition : AppRouteTransition .bottomNavFromRight ,
128147 child: MyPageScreen (),
129148 ),
130149 ),
131150 ],
132151 ),
133152 GoRoute (
134153 path: '/defaultPreparationSpareTimeEdit' ,
135- builder: (context, state) => PreparationSpareTimeEditScreen (),
154+ pageBuilder: (context, state) => _buildAppRoutePage (
155+ state: state,
156+ child: PreparationSpareTimeEditScreen (),
157+ ),
158+ ),
159+ GoRoute (
160+ path: '/signIn' ,
161+ pageBuilder: (context, state) => _buildAppRoutePage (
162+ state: state,
163+ transition: AppRouteTransition .fade,
164+ child: SignInMainScreen (),
165+ ),
136166 ),
137- GoRoute (path: '/signIn' , builder: (context, state) => SignInMainScreen ()),
138167 GoRoute (
139168 path: '/calendar' ,
140- builder: (context, state) =>
141- CalendarScreen (initialDate: calendarInitialDateFromState (state)),
169+ pageBuilder: (context, state) => _buildAppRoutePage (
170+ state: state,
171+ child: CalendarScreen (
172+ initialDate: calendarInitialDateFromState (state),
173+ ),
174+ ),
142175 ),
143176 GoRoute (
144177 path: '/scheduleCreate' ,
145- builder: (context, state) => ScheduleCreateScreen (),
178+ pageBuilder: (context, state) =>
179+ _buildAppRoutePage (state: state, child: ScheduleCreateScreen ()),
146180 ),
147181 GoRoute (
148182 path: '/scheduleEdit/:scheduleId' ,
149- builder: (context, state) =>
150- ScheduleEditScreen (scheduleId: state.pathParameters['scheduleId' ]! ),
183+ pageBuilder: (context, state) => _buildAppRoutePage (
184+ state: state,
185+ child: ScheduleEditScreen (
186+ scheduleId: state.pathParameters['scheduleId' ]! ,
187+ ),
188+ ),
151189 ),
152190 GoRoute (
153191 path: '/preparationEdit' ,
154- builder: (context, state) => const PreparationEditForm (),
192+ pageBuilder: (context, state) => _buildAppRoutePage (
193+ state: state,
194+ child: const PreparationEditForm (),
195+ ),
155196 ),
156197 GoRoute (
157198 path: '/scheduleStart' ,
158199 name: 'scheduleStart' ,
159- builder : (context, state) {
200+ pageBuilder : (context, state) {
160201 final extra = scheduleStartRouteExtraFromState (state);
161- return _ScheduleStartRouteGate (extra: extra);
202+ return _buildAppRoutePage (
203+ state: state,
204+ transition: AppRouteTransition .scheduleFlow,
205+ child: _ScheduleStartRouteGate (extra: extra),
206+ );
162207 },
163208 ),
164209 GoRoute (
165210 path: '/alarmScreen' ,
166- builder: (context, state) {
167- return AlarmScreen ();
168- },
211+ pageBuilder: (context, state) => _buildAppRoutePage (
212+ state: state,
213+ transition: AppRouteTransition .scheduleFlow,
214+ child: AlarmScreen (),
215+ ),
169216 ),
170217 GoRoute (
171218 path: '/earlyLate' ,
@@ -174,51 +221,44 @@ GoRouter goRouterConfig(
174221 ? '/home'
175222 : null ;
176223 },
177- builder : (context, state) {
224+ pageBuilder : (context, state) {
178225 final arguments = earlyLateRouteArgumentsFromState (state);
179226 if (arguments == null ) {
180- return const LoadingScreen ();
227+ return _buildAppRoutePage (
228+ state: state,
229+ transition: AppRouteTransition .scheduleFlow,
230+ child: const LoadingScreen (),
231+ );
181232 }
182233
183- return EarlyLateScreen (
184- earlyLateTime: arguments.earlyLateTime,
185- isLate: arguments.isLate,
234+ return _buildAppRoutePage (
235+ state: state,
236+ transition: AppRouteTransition .scheduleFlow,
237+ child: EarlyLateScreen (
238+ earlyLateTime: arguments.earlyLateTime,
239+ isLate: arguments.isLate,
240+ ),
186241 );
187242 },
188243 ),
189- GoRoute (path: '/moving' , builder: (context, state) => MovingScreen ()),
244+ GoRoute (
245+ path: '/moving' ,
246+ pageBuilder: (context, state) =>
247+ _buildAppRoutePage (state: state, child: MovingScreen ()),
248+ ),
190249 ],
191250 );
192251}
193252
194- CustomTransitionPage <void > _buildBottomNavSlidePage ({
253+ CustomTransitionPage <void > _buildAppRoutePage ({
195254 required GoRouterState state,
196- required Offset beginOffset ,
255+ AppRouteTransition transition = AppRouteTransition .standard ,
197256 required Widget child,
198257}) {
199- final slideTween = Tween <Offset >(
200- begin: beginOffset,
201- end: Offset .zero,
202- ).chain (CurveTween (curve: Curves .easeOutCubic));
203- final secondarySlideTween = Tween <Offset >(
204- begin: Offset .zero,
205- end: beginOffset,
206- ).chain (CurveTween (curve: Curves .easeOutCubic));
207-
208- return CustomTransitionPage <void >(
258+ return buildAppRoutePage <void >(
209259 key: state.pageKey,
210- transitionDuration: const Duration (milliseconds: 280 ),
211- reverseTransitionDuration: const Duration (milliseconds: 280 ),
260+ transition: transition,
212261 child: child,
213- transitionsBuilder: (context, animation, secondaryAnimation, child) {
214- return SlideTransition (
215- position: secondaryAnimation.drive (secondarySlideTween),
216- child: SlideTransition (
217- position: animation.drive (slideTween),
218- child: child,
219- ),
220- );
221- },
222262 );
223263}
224264
0 commit comments