Created
August 23, 2020 12:00
-
-
Save agnamc9/99b1d9d76d1da1443b00d8435b825008 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
import 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
class TweenAnimationTest extends StatefulWidget { | |
@override | |
_TweenAnimationTestState createState() => _TweenAnimationTestState(); | |
} | |
class _TweenAnimationTestState extends State<TweenAnimationTest> { | |
double endValue = 0.0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SafeArea( | |
child: Column( | |
children: [ | |
Expanded( | |
child: Center( | |
child: TweenAnimationBuilder( | |
duration: Duration(seconds: 1), | |
tween: Tween<double>(begin: 0.0, end: endValue), | |
builder: (context, value, child) { | |
return Transform.rotate( | |
angle: value, | |
child: FlutterLogo( | |
size: 100, | |
), | |
); | |
}, | |
), | |
), | |
), | |
RaisedButton( | |
onPressed: () { | |
setState(() { | |
endValue = 2 * math.pi; | |
}); | |
}, | |
child: Text('Animate'), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment