selfprivacy.org.app/lib/utils/route_transitions/slide_right.dart

49 lines
1.2 KiB
Dart
Raw Normal View History

2020-11-29 22:07:46 +02:00
import 'package:flutter/material.dart';
2022-06-05 22:36:32 +03:00
Function pageBuilder = (final Widget widget) => (
final BuildContext context,
final Animation<double> animation,
final Animation<double> secondaryAnimation,
2020-11-29 22:07:46 +02:00
) =>
widget;
Function transitionsBuilder = (
2022-06-05 22:36:32 +03:00
final BuildContext context,
final Animation<double> animation,
final Animation<double> secondaryAnimation,
final Widget child,
2022-06-10 00:13:06 +03:00
) =>
SlideTransition(
position: Tween<Offset>(
begin: const Offset(-1, 0),
end: Offset.zero,
).animate(animation),
child: Container(
decoration: animation.isCompleted
? null
: const BoxDecoration(
border: Border(
right: BorderSide(
color: Colors.black,
),
2020-11-29 22:07:46 +02:00
),
),
2022-06-10 00:13:06 +03:00
child: child,
),
);
2020-11-29 22:07:46 +02:00
class SlideRightRoute extends PageRouteBuilder {
SlideRightRoute(this.widget)
: super(
pageBuilder: pageBuilder(widget),
2021-12-06 20:31:19 +02:00
transitionsBuilder: transitionsBuilder as Widget Function(
2022-06-10 00:13:06 +03:00
BuildContext,
Animation<double>,
Animation<double>,
Widget,
),
2020-11-29 22:07:46 +02:00
);
final Widget widget;
}