From 69615fa4b628c08956c39bb60fdc239edabdfd8e Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 2 Apr 2025 14:40:44 +0800 Subject: [PATCH] slide animation on login and register --- lib/main.dart | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 21f83c9..9bc75e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -54,12 +54,30 @@ final _router = GoRouter( GoRoute( name: 'login', path: '/login', - builder: (context, state) => const LoginPage(), + pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage( + key: state.pageKey, + child: const LoginPage(), + transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, + Widget child) => + SlideTransition( + position: animation.drive( + Tween(begin: Offset(0, 0.95), end: Offset.zero).chain(CurveTween(curve: Curves.easeOut))), + child: child), + ), ), GoRoute( name: 'register', path: '/register', - builder: (context, state) => const RegisterPage(), + pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage( + key: state.pageKey, + child: const RegisterPage(), + transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, + Widget child) => + SlideTransition( + position: animation.drive( + Tween(begin: Offset(0, 0.95), end: Offset.zero).chain(CurveTween(curve: Curves.easeOut))), + child: child), + ), ), GoRoute( name: 'main', @@ -117,6 +135,7 @@ final _router = GoRouter( builder: (context, state) => const CustomerItemviewPage(), ), GoRoute( + name: 'languagesetting', path: '/languagesetting', pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage( key: state.pageKey, @@ -128,7 +147,6 @@ final _router = GoRouter( Tween(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))), child: child), ), - // builder: (context, state) => const LanguageSettingPage(), ), ], );