From 2a6ed0a8692d2a3a9e29ae19836eca81e89f7b1f Mon Sep 17 00:00:00 2001 From: Matt Sullivan Date: Fri, 16 Feb 2018 08:56:44 -0800 Subject: [PATCH] Added sample code to AnimatedOpacity API docs (#14730) * Added sample code to AnimatedOpacity docs --- .../lib/src/widgets/implicit_animations.dart | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index f03bbc66a0..1ae0e04777 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -906,6 +906,41 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState new LogoFadeState(); +/// } +/// +/// class LogoFadeState extends State { +/// 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. ///