diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index 2b68e6ebd5..2935369062 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -813,6 +813,47 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState /// of [Curves.fastOutSlowIn]. /// {@animation 250 266 https://flutter.github.io/assets-for-api-docs/assets/widgets/animated_padding.mp4} /// +/// {@tool dartpad --template=stateful_widget_scaffold} +/// +/// The following code implements the [AnimatedPadding] widget, using a [curve] of +/// [Curves.easeInOut]. +/// +/// ```dart +/// double padValue = 0.0; +/// _updatePadding(double value) { +/// setState(() { +/// padValue = value; +/// }); +/// } +/// +/// @override +/// Widget build(BuildContext context) { +/// return Column( +/// mainAxisAlignment: MainAxisAlignment.center, +/// children: [ +/// AnimatedPadding( +/// padding: EdgeInsets.all(padValue), +/// duration: const Duration(seconds: 2), +/// curve: Curves.easeInOut, +/// child: Container( +/// width: MediaQuery.of(context).size.width, +/// height: MediaQuery.of(context).size.height / 5, +/// color: Colors.blue, +/// ), +/// ), +/// Text('Padding: $padValue'), +/// ElevatedButton( +/// child: Text('Change padding'), +/// onPressed: () { +/// _updatePadding(padValue == 0.0 ? 100.0 : 0.0); +/// } +/// ), +/// ], +/// ); +/// } +/// ``` +/// {@end-tool} +/// /// See also: /// /// * [AnimatedContainer], which can transition more values at once.