Last active
September 1, 2018 08:01
-
-
Save letsar/fbfafe20814a39f605c79b42a8f3e032 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/// 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