slide transition of menu
This commit is contained in:
parent
9de2d0e7d2
commit
b892cc485f
8 changed files with 113 additions and 15 deletions
114
lib/main.dart
114
lib/main.dart
|
|
@ -84,45 +84,143 @@ final _router = GoRouter(
|
|||
path: '/main',
|
||||
builder: (context, state) => const MainPage(),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'addmanufactorer',
|
||||
// path: '/addmanufactorer',
|
||||
// builder: (context, state) => const AddManufacturerPage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'addmanufactorer',
|
||||
path: '/addmanufactorer',
|
||||
builder: (context, state) => const AddManufacturerPage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddManufacturerPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'addmedicines',
|
||||
// path: '/addmedicines',
|
||||
// builder: (context, state) => const AddMedicinePage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'addmedicines',
|
||||
path: '/addmedicines',
|
||||
builder: (context, state) => const AddMedicinePage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddMedicinePage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'addgenerics',
|
||||
// path: '/addgenerics',
|
||||
// builder: (context, state) => const AddGenericsPage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'addgenerics',
|
||||
path: '/addgenerics',
|
||||
builder: (context, state) => const AddGenericsPage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddGenericsPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'addtype',
|
||||
// path: '/addtype',
|
||||
// builder: (context, state) => const AddTypePage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'addtype',
|
||||
path: '/addtype',
|
||||
builder: (context, state) => const AddTypePage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddTypePage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'addcategory',
|
||||
// path: '/addcategory',
|
||||
// builder: (context, state) => const AddCategoryPage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'addcategory',
|
||||
path: '/addcategory',
|
||||
builder: (context, state) => const AddCategoryPage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddCategoryPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: 'addstock',
|
||||
path: '/addstock',
|
||||
builder: (context, state) => const AddStockPage(),
|
||||
),
|
||||
GoRoute(
|
||||
// GoRoute(
|
||||
// name: 'liststocks',
|
||||
// path: '/liststocks',
|
||||
// builder: (context, state) => const ListStocksPage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'liststocks',
|
||||
path: '/liststocks',
|
||||
builder: (context, state) => const ListStocksPage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const ListStocksPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'deletestock',
|
||||
// path: '/deletestock',
|
||||
// builder: (context, state) => const DeleteStockPage(),
|
||||
// ),
|
||||
GoRoute(
|
||||
name: 'deletestock',
|
||||
path: '/deletestock',
|
||||
builder: (context, state) => const DeleteStockPage(),
|
||||
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
|
||||
key: state.pageKey,
|
||||
child: const DeleteStockPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: 'customer',
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class _AddCategoryPageState extends State<AddCategoryPage> {
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class _AddManufacturerPageState extends State<AddManufacturerPage> {
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class _AddTypePageState extends State<AddTypePage> {
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class _DeleteStockPageState extends State<DeleteStockPage> {
|
|||
final result = await checkResult(context, _stockList, 'Generics');
|
||||
if (result) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
}
|
||||
} else {
|
||||
setState(() => {});
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ class _MainPageState extends State<MainPage> {
|
|||
color: 'yellow'),
|
||||
const Gap(40),
|
||||
ButtonWithProgressWidget(
|
||||
trigger: _isLoading, progressText: 'Logging Out', buttonText: 'Logout', onPressed: signOut)
|
||||
trigger: _isLoading, progressText: 'Logging Out', buttonText: 'Logout', onPressed: signOut),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue