1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-22 03:46:21 +01:00
tsacdop-podcast-app-android/lib/util/pageroute.dart
stonegate 5d43a7e641 modified: lib/class/sqflite_localpodcast.dart
modified:   lib/episodes/episodedetail.dart
	modified:   lib/home/appbar/addpodcast.dart
	modified:   lib/home/audio_player.dart
	modified:   lib/home/audiopanel.dart
	modified:   lib/home/home.dart
	modified:   lib/util/pageroute.dart
2020-02-14 21:22:35 +08:00

87 lines
2.3 KiB
Dart

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,
),
);
}
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,
),
);
}
//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,
),
);
}