26 lines
778 B
Dart
26 lines
778 B
Dart
import 'package:flutter/material.dart';
|
|
class RouteAnimation extends PageRouteBuilder{
|
|
final Widget page;
|
|
final Offset offset;
|
|
RouteAnimation(this.page, this.offset):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: offset,
|
|
end: Offset.zero,
|
|
).animate(animation),
|
|
child: child,
|
|
),
|
|
);
|
|
} |