Unverified Commit 9806865b authored by Juyeong Lee's avatar Juyeong Lee Committed by GitHub

Add dartpad sample for AnimatedPadding (#71050)

parent 508c4b4d
......@@ -813,6 +813,47 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
/// 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.
......
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