2020-02-09 13:29:09 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
//Slide Transition
|
|
|
|
class SlideLeftRoute extends PageRouteBuilder {
|
|
|
|
final Widget page;
|
|
|
|
SlideLeftRoute({this.page})
|
|
|
|
: super(
|
|
|
|
pageBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
) =>
|
|
|
|
page,
|
|
|
|
transitionsBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Widget child,
|
|
|
|
) =>
|
|
|
|
SlideTransition(
|
|
|
|
position: Tween<Offset>(
|
|
|
|
begin: const Offset(1, 0),
|
|
|
|
end: Offset.zero,
|
|
|
|
).animate(animation),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-25 15:50:27 +02:00
|
|
|
class SlideLeftHideRoute extends PageRouteBuilder {
|
|
|
|
final Widget page;
|
2020-06-02 16:05:49 +02:00
|
|
|
final Widget transitionPage;
|
|
|
|
SlideLeftHideRoute({this.page, this.transitionPage})
|
2020-04-25 15:50:27 +02:00
|
|
|
: super(
|
|
|
|
pageBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
) =>
|
|
|
|
page,
|
2020-07-17 17:12:30 +02:00
|
|
|
transitionDuration: Duration(milliseconds: 300),
|
2020-04-25 15:50:27 +02:00
|
|
|
transitionsBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Widget child,
|
2020-06-02 16:05:49 +02:00
|
|
|
) {
|
2020-06-03 14:39:15 +02:00
|
|
|
return SlideTransition(
|
|
|
|
position: Tween<Offset>(
|
|
|
|
begin: const Offset(1, 0),
|
|
|
|
end: Offset.zero,
|
|
|
|
).animate(animation),
|
|
|
|
child: child);
|
2020-06-02 16:05:49 +02:00
|
|
|
},
|
2020-04-25 15:50:27 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-14 14:22:35 +01:00
|
|
|
class SlideUptRoute extends PageRouteBuilder {
|
|
|
|
final Widget page;
|
|
|
|
SlideUptRoute({this.page})
|
|
|
|
: super(
|
|
|
|
pageBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
) =>
|
|
|
|
page,
|
|
|
|
transitionsBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Widget child,
|
|
|
|
) =>
|
|
|
|
SlideTransition(
|
|
|
|
position: Tween<Offset>(
|
|
|
|
begin: const Offset(0, 1),
|
|
|
|
end: Offset.zero,
|
|
|
|
).animate(animation),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-09 13:29:09 +01:00
|
|
|
//Scale Pageroute
|
|
|
|
class ScaleRoute extends PageRouteBuilder {
|
|
|
|
final Widget page;
|
|
|
|
ScaleRoute({this.page})
|
|
|
|
: super(
|
|
|
|
pageBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
) =>
|
|
|
|
page,
|
|
|
|
transitionsBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Widget child,
|
|
|
|
) =>
|
|
|
|
ScaleTransition(
|
|
|
|
scale: Tween<double>(
|
|
|
|
begin: 0.0,
|
|
|
|
end: 1.0,
|
|
|
|
).animate(
|
|
|
|
CurvedAnimation(
|
|
|
|
parent: animation,
|
|
|
|
curve: Curves.fastOutSlowIn,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|