Created
October 6, 2021 13:49
-
-
Save rutvik110/58093ea9cbf7c100732822b6608cdd9e to your computer and use it in GitHub Desktop.
Implicit Animation Example
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
class MyAnimatedFoo extends StatefulWidget { | |
const MyAnimatedFoo({Key? key}) : super(key: key); | |
@override | |
State<MyAnimatedFoo> createState() => _MyAnimatedFooState(); | |
} | |
class _MyAnimatedFooState extends State<MyAnimatedFoo> { | |
double height = 100; | |
double width = 100; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
setState(() { | |
height = 200; | |
width = 200; | |
}); | |
}, | |
child: const Icon( | |
Icons.add, | |
color: Colors.white, | |
), | |
), | |
body: Center( | |
child: AnimatedContainer( | |
duration: const Duration(seconds: 1), | |
color: Colors.blue, | |
height: height, | |
width: width, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment