Skip to content

Instantly share code, notes, and snippets.

@rutvik110
Created October 6, 2021 13:49
Show Gist options
  • Save rutvik110/58093ea9cbf7c100732822b6608cdd9e to your computer and use it in GitHub Desktop.
Save rutvik110/58093ea9cbf7c100732822b6608cdd9e to your computer and use it in GitHub Desktop.
Implicit Animation Example
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