Unverified Commit ad9b30b3 authored by Shi-Hao Hong's avatar Shi-Hao Hong Committed by GitHub

Center the AnimatedPositioned code sample (#69644)

parent 2f611f14
...@@ -1058,7 +1058,7 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> { ...@@ -1058,7 +1058,7 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
/// it also requires more development overhead as you have to manually manage /// it also requires more development overhead as you have to manually manage
/// the lifecycle of the underlying [AnimationController]. /// the lifecycle of the underlying [AnimationController].
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold} /// {@tool dartpad --template=stateful_widget_scaffold_center}
/// ///
/// The following example transitions an AnimatedPositioned /// The following example transitions an AnimatedPositioned
/// between two states. It adjusts the `height`, `width`, and /// between two states. It adjusts the `height`, `width`, and
...@@ -1069,28 +1069,31 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> { ...@@ -1069,28 +1069,31 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
/// ///
/// @override /// @override
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return Stack( /// return Container(
/// children: [ /// width: 200,
/// AnimatedPositioned( /// height: 350,
/// width: selected ? 200.0 : 50.0, /// child: Stack(
/// height: selected ? 50.0 : 200.0, /// children: [
/// top: selected ? 50.0 : 150.0, /// AnimatedPositioned(
/// right: 150.0, /// width: selected ? 200.0 : 50.0,
/// duration: Duration(seconds: 2), /// height: selected ? 50.0 : 200.0,
/// curve: Curves.fastOutSlowIn, /// top: selected ? 50.0 : 150.0,
/// child: GestureDetector( /// duration: Duration(seconds: 2),
/// onTap: () { /// curve: Curves.fastOutSlowIn,
/// setState(() { /// child: GestureDetector(
/// selected = !selected; /// onTap: () {
/// }); /// setState(() {
/// }, /// selected = !selected;
/// child: Container( /// });
/// color: Colors.blue, /// },
/// child: Text('Tap me to start the animated transition'), /// child: Container(
/// color: Colors.blue,
/// child: Center(child: Text('Tap me')),
/// ),
/// ), /// ),
/// ), /// ),
/// ), /// ],
/// ], /// ),
/// ); /// );
/// } /// }
///``` ///```
......
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