import 'package:car_for_her/config/palette.dart'; import 'package:flutter/material.dart'; class ClientDestination extends StatefulWidget { const ClientDestination({Key key}) : super(key: key); @override _ClientDestinationState createState() => _ClientDestinationState(); } class _ClientDestinationState extends State with SingleTickerProviderStateMixin { bool isPressed = false; AnimationController controller; Animation _heightSizeAnimation; @override void initState() { super.initState(); controller = AnimationController( vsync: this, duration: Duration(milliseconds: 1000)); _heightSizeAnimation = Tween(begin: 0, end: 180) .animate(CurvedAnimation(parent: controller, curve: Curves.easeIn)); controller.addListener(() { setState(() {}); }); controller.forward(); } @override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ if (!isPressed) Padding( padding: const EdgeInsets.only(bottom: 18.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 320, decoration: BoxDecoration( color: Palette.primary, border: Border.all(color: Palette.primary)), child: TextButton( onPressed: () { setState(() { isPressed = true; }); }, child: Text("Start", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontFamily: 'MontExtraLight', fontWeight: FontWeight.bold, fontSize: 18)), ), ), ], ), ), if (isPressed) Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Container( height: _heightSizeAnimation.value, width: double.maxFinite, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50), topRight: Radius.circular(50))), child: _heightSizeAnimation.value >= 140 ? Padding( padding: const EdgeInsets.only(top: 18.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Text( "00.0Km", style: TextStyle( fontFamily: 'MontHeavy', fontSize: 22, ), ), Text( "\$000", style: TextStyle( fontFamily: 'MontHeavy', fontSize: 22, ), ), Text( "15min", style: TextStyle( fontFamily: 'MontHeavy', fontSize: 22, ), ), ], ), Padding( padding: const EdgeInsets.only(top: 48.0), child: GestureDetector( onTap: () { Navigator.pushReplacementNamed( context, '/client_trip_date'); }, child: Container( height: 50, width: 300, decoration: BoxDecoration( color: Palette.primary), child: Center( child: Text( "Continue", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'MontExtraLight', fontWeight: FontWeight.bold, ), ), ), ), ), ) ], ), ) : SizedBox(), ), ) ], ), ], ), ), ], ), ); } }