Last active
December 9, 2019 22:11
-
-
Save cerberodev/9ad2bc61947526378c40aed7a4fcdc42 to your computer and use it in GitHub Desktop.
Animated Container - Air Plane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Animated Container - cerbero.dev'), | |
centerTitle: true, | |
backgroundColor: Colors.black45, | |
), | |
body: Center( | |
child: Avion(), | |
), | |
), | |
); | |
} | |
} | |
class Avion extends StatefulWidget { | |
@override | |
AvionState createState() { | |
return AvionState(); | |
} | |
} | |
class AvionState extends State<Avion> { | |
var _alignment = Alignment.bottomCenter; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: AnimatedContainer( | |
padding: EdgeInsets.all(10.0), | |
duration: Duration(seconds: 5), | |
alignment: _alignment, | |
child: Container( | |
height: 80, | |
child: Icon( | |
Icons.airplanemode_active, | |
size: 55, | |
color: Colors.white, | |
), | |
), | |
), | |
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, | |
floatingActionButton: | |
FloatingActionButton.extended( | |
elevation: 10, | |
backgroundColor: Colors.white, | |
onPressed: () { | |
setState(() { | |
_alignment = Alignment.topCenter; | |
}); | |
}, | |
icon: Icon(Icons.airplanemode_active), | |
label: Text("Go in Tech Talks"), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment