Line data Source code
1 : import 'package:flutter/material.dart'; 2 : 3 : /// this class build an Up to down animation 4 : class UpToDownTransition { 5 : // ignore: public_member_api_docs 6 1 : Widget buildTransition({ 7 : Curve curve = Curves.ease, 8 : required Animation<double> animation, 9 : required Widget child, 10 : }) { 11 : const begin = Offset(0, -1); 12 : const end = Offset.zero; 13 2 : final tween = Tween(begin: begin, end: end).chain( 14 1 : CurveTween(curve: curve), 15 : ); 16 1 : return SlideTransition( 17 1 : position: animation.drive(tween), 18 : child: child, 19 : ); 20 : } 21 : }