Created
May 25, 2024 09:31
-
-
Save sgruhier/9deec0df9db9f76a6016cb058698e687 to your computer and use it in GitHub Desktop.
Built in animation
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
return Scaffold( | |
body: Center( | |
child: AnimatedContainer( | |
duration: const Duration(seconds: 1), | |
width: _toggled ? 200 : 100, | |
height: _toggled ? 200 : 100, | |
decoration: BoxDecoration( | |
color: _toggled ? Colors.blue : Colors.red, | |
borderRadius: BorderRadius.circular(_toggled ? 20 : 0), | |
), | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
setState(() { | |
_toggled = !_toggled; | |
}); | |
}, | |
child: const Icon(Icons.play_arrow), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment