Skip to content

Instantly share code, notes, and snippets.

@agnamc9
Created August 23, 2020 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agnamc9/99b1d9d76d1da1443b00d8435b825008 to your computer and use it in GitHub Desktop.
Save agnamc9/99b1d9d76d1da1443b00d8435b825008 to your computer and use it in GitHub Desktop.
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