Skip to content

Instantly share code, notes, and snippets.

@Rahiche
Created December 13, 2018 19:48
Show Gist options
  • Save Rahiche/553c8f4ac236db6cfc38415ed33001ed to your computer and use it in GitHub Desktop.
Save Rahiche/553c8f4ac236db6cfc38415ed33001ed to your computer and use it in GitHub Desktop.
bool isVisible = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Animated Switcher")),
floatingActionButton: FloatingActionButton(onPressed: () {
setState(() {
isVisible = !isVisible;
});
}),
body: Center(
child: AnimatedSwitcher(
child: isVisible
? Container(
height: 100.0,
width: 100.0,
color: Colors.red,
)
: SizedBox(),
duration: Duration(seconds: 2),
)),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment