easy_push 1.0.0 easy_push: ^1.0.0 copied to clipboard
A simple router for Dart
Easy Push Package #
This package gives you easy navigation with beautiful transitions
Demo #
Usage #
It is really easy to use!
You should ensure that you add the easy_push
as a dependency in your flutter project.
dependencies:
easy_push: ^0.0.3
Than you can use it with below examples.
Push.to(Home(), context);
Push.to(Home(), context, transitionType: Transition.fadeIn);
Usage for predefined routes #
First, define the onGenerateRoute
property in the MaterialApp
widget like below and in switch cases you can transition to your new routes:
onGenerateRoute: (settings) {
switch (settings.name) {
case '/second':
return PageTransition(child: SecondPage(), type: PageTransitionType.scale);
break;
default:
return null;
}
},
After that you can use your new route like this:
Push.toNamed( '/second',context);
Usage predefined routes with RouteSettings #
First, define the onGenerateRoute
property in the MaterialApp
widget like below and in switch cases you can transition to your new routes:
onGenerateRoute: (settings) {
switch (settings.name) {
case '/second':
return PageTransition(
child: SecondPage(),
type: PageTransitionType.scale,
settings: settings,
);
break;
default:
return null;
}
},
After that you can use your new route like this:
Push.toNamed( '/second', context,arguments: "arguments data");
for more detail you can look example project.
Types of transitions #
- fade
- rightToLeft
- leftToRight
- topToBottom
- bottomToTop
- scale (with alignment)
- rotate (with alignment)
- size (with alignment)
- rightToLeftWithFade,
- leftToRightWithFade,
- leftToRightJoined,
- rightToLeftJoined,
Curves #
You can use any type of CurvedAnimation curves.
Alignments #
You can use size, scale and rotate transform alignment
Contributing #
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.