1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| class GMExampleAnimatedPaddingTest extends StatefulWidget { GMExampleAnimatedPaddingTest({Key key}) : super(key: key);
@override _GMExampleAnimatedPaddingTestState createState() => _GMExampleAnimatedPaddingTestState(); }
class _GMExampleAnimatedPaddingTestState extends State<GMExampleAnimatedPaddingTest> { var _padding = 0.0;
@override Widget build(BuildContext context) { return Scaffold( body: Center( child: AnimatedPadding( padding: EdgeInsets.symmetric(horizontal: _padding), duration: Duration(seconds: 2), child: Container( height: 50, color: Colors.red, ), ), ), floatingActionButton: FloatingActionButton( child: Text("test"), onPressed: () { setState(() { _padding = 50; }); }, ), ); return Column( children: <Widget>[ Container( width: 300, height: 30, color: Colors.blue, ), SizedBox( height: 50, ), SizedBox( height: 100, ), RaisedButton( color: Colors.orange, onPressed: () {}, ), ], ); } }
|