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

45 lines
1.2 KiB
Dart
Raw Normal View History

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