Created
July 13, 2022 00:56
-
-
Save FlutterZeroGit/82eb1f83ea2e79691d80168c39d38112 to your computer and use it in GitHub Desktop.
AnimatedContainer-curves
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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatefulWidget { | |
@override | |
State<MyApp> createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
bool selected = false; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: Text('FlutterZero')), | |
body: Center( | |
child: GestureDetector( | |
onTap: (() => setState(() { | |
selected = !selected; | |
})), | |
child: AnimatedContainer( | |
width: selected ? 150 : 100, | |
height: selected ? 150 : 100, | |
color: selected ? Colors.orange : Colors.yellow, | |
alignment: selected ? Alignment.bottomRight : Alignment.center, | |
duration: Duration(seconds: 1), | |
child: FlutterLogo(size: 50), | |
curve: Curves.bounceIn, | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment