Unverified Commit 9e7e6e7c authored by matthew-carroll's avatar matthew-carroll Committed by GitHub

Add docs to Opacity recommending AnimatedOpacity for opacity animatio… (#18092)

* Add docs to Opacity recommending AnimatedOpacity for opacity animations (#15464)
parent 9a8c4dfe
...@@ -143,11 +143,24 @@ class Directionality extends InheritedWidget { ...@@ -143,11 +143,24 @@ class Directionality extends InheritedWidget {
/// This is more efficient than adding and removing the child widget from the /// This is more efficient than adding and removing the child widget from the
/// tree on demand. /// tree on demand.
/// ///
/// ## Opacity Animation
///
/// [Opacity] animations should be built using [AnimatedOpacity] rather than
/// manually rebuilding the [Opacity] widget.
///
/// Animating an [Opacity] widget directly causes the widget (and possibly its
/// subtree) to rebuild each frame, which is not very efficient. Consider using
/// an [AnimatedOpacity] instead.
///
/// See also: /// See also:
/// ///
/// * [ShaderMask], which can apply more elaborate effects to its child. /// * [ShaderMask], which can apply more elaborate effects to its child.
/// * [Transform], which applies an arbitrary transform to its child widget at /// * [Transform], which applies an arbitrary transform to its child widget at
/// paint time. /// paint time.
/// * [AnimatedOpacity], which uses an animation internally to efficiently
/// animate opacity.
/// * [FadeTransition], which uses a provided animation to efficiently animate
/// opacity.
class Opacity extends SingleChildRenderObjectWidget { class Opacity extends SingleChildRenderObjectWidget {
/// Creates a widget that makes its child partially transparent. /// Creates a widget that makes its child partially transparent.
/// ///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment