-
-
Save Rahiche/553c8f4ac236db6cfc38415ed33001ed to your computer and use it in GitHub Desktop.
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
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