page_animation_transition 0.0.3 page_animation_transition: ^0.0.3 copied to clipboard
Using this package, you can add beautiful page transitions to your application.
Using this package, you can add beautiful page transitions to your application.
Usage #
It is really easy to use! You should ensure that you add the page_animation_transition as a dependency in your flutter project
dependencies:
page_animation_transition: ^latest_version
Below are some examples:
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.bottomToTop));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.topToBottom));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.rightToLeft));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.leftToRight));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.fadeAnimation));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.scaleAnimation));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.rotateAnimation));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.topToBottomFaded));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.bottomToTopFaded));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.rightToLeftFaded));
Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: PageAnimationType.leftToRightFaded));
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 '/pageTwo':
return PageTransition(child: PageTwo(), type: PageAnimationType.bottomToTop);
break;
default:
return null;
}
}
After this, the new route can be used like:
Navigator.pushNamed(context, '/pageTwo');
Types of transitions #
bottomToTop
topToBottom
leftToRight
rightToLeft
fadeAnimation
scaleAnimation
rotateAnimation
topToBottomFaded
bottomToTopFaded
leftToRightFaded
rightToLeftFaded