Skip to content

Instantly share code, notes, and snippets.

@e200
Last active January 3, 2021 20:24
Show Gist options
  • Save e200/100edf703441f1572a2d3061df604e97 to your computer and use it in GitHub Desktop.
Save e200/100edf703441f1572a2d3061df604e97 to your computer and use it in GitHub Desktop.
class _AnimatedRotationButtonState
extends AnimatedWidgetBaseState<AnimatedRotationButton> {
Tween<double> _angleTween;
@override
void forEachTween(visitor) {
_angleTween = visitor(
_angleTween,
widget.angle,
(value) => Tween<double>(begin: value),
);
}
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: _angleTween.evaluate(animation,
child: RaisedButton(
color: Colors.blue,
child: widget.child,
onPressed: widget.onPressed,
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment