Unverified Commit 2a6ed0a8 authored by Matt Sullivan's avatar Matt Sullivan Committed by GitHub

Added sample code to AnimatedOpacity API docs (#14730)

* Added sample code to AnimatedOpacity docs
parent 31a0a5f4
......@@ -906,6 +906,41 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
///
/// Animating an opacity is relatively expensive because it requires painting
/// the child into an intermediate buffer.
///
/// ## Sample code
///
/// ```dart
/// class LogoFade extends StatefulWidget {
/// @override
/// createState() => new LogoFadeState();
/// }
///
/// class LogoFadeState extends State<LogoFade> {
/// double opacityLevel = 1.0;
///
/// _changeOpacity() {
/// setState(() => opacityLevel = opacityLevel == 0 ? 1.0 : 0.0);
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return new Column(
/// mainAxisAlignment: MainAxisAlignment.center,
/// children: [
/// new AnimatedOpacity(
/// opacity: opacityLevel,
/// duration: new Duration(seconds: 3),
/// child: new FlutterLogo(),
/// ),
/// new RaisedButton(
/// child: new Text('Fade Logo'),
/// onPressed: _changeOpacity,
/// ),
/// ],
/// );
/// }
/// }
/// ```
class AnimatedOpacity extends ImplicitlyAnimatedWidget {
/// Creates a widget that animates its opacity implicitly.
///
......
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