From 71fa330931dc037840409e6235367f1b1b8347f9 Mon Sep 17 00:00:00 2001 From: TheBiirb <67576036+TheBiirb@users.noreply.github.com> Date: Thu, 17 Sep 2020 02:27:04 +0300 Subject: [PATCH] Added sample code to AnimatedAlign (#64698) --- .../lib/src/widgets/implicit_animations.dart | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index ea2c8ef57c..dacc5f9c56 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -861,6 +861,40 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState { /// it also requires more development overhead as you have to manually manage /// the lifecycle of the underlying [AnimationController]. /// +/// {@tool dartpad --template=stateful_widget_scaffold} +/// +/// The following code implements the [AnimatedAlign] widget, using a [curve] of +/// [Curves.fastOutSlowIn]. +/// +/// ```dart +/// bool selected = false; +/// +/// @override +/// Widget build(BuildContext context) { +/// return GestureDetector( +/// onTap: () { +/// setState(() { +/// selected = !selected; +/// }); +/// }, +/// child: Center( +/// child: Container( +/// width: 250.0, +/// height: 250.0, +/// color: Colors.red, +/// child: AnimatedAlign( +/// alignment: selected ? Alignment.topRight : Alignment.bottomLeft, +/// duration: const Duration(seconds: 1), +/// curve: Curves.fastOutSlowIn, +/// child: const FlutterLogo(size: 50.0), +/// ), +/// ), +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// /// See also: /// /// * [AnimatedContainer], which can transition more values at once.