Skip to content

Instantly share code, notes, and snippets.

@letsar
Last active September 1, 2018 08:01
Show Gist options
  • Save letsar/fbfafe20814a39f605c79b42a8f3e032 to your computer and use it in GitHub Desktop.
Save letsar/fbfafe20814a39f605c79b42a8f3e032 to your computer and use it in GitHub Desktop.
/// Animates the skew of transformed widget.
class SkewTransition extends AnimatedWidget {
/// Creates a skew transition.
///
/// The [skew] argument must not be null.
const SkewTransition({
Key key,
@required Animation<double> skew,
this.child,
}) : super(key: key, listenable: skew);
/// The animation that controls the skew of the child.
Animation<double> get skew => listenable;
/// The widget below this widget in the tree.
///
/// {@macro flutter.widgets.child}
final Widget child;
@override
Widget build(BuildContext context) {
final double skewValue = skew.value;
final Matrix4 transform = new Matrix4.skewX(skewValue);
return new Transform(
transform: transform,
child: child,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment