18

+
                    child: widget.child,

19

+
                  ),

6
20

),

7
21

);

8
22

Step 3: Animate the widget

When the widget is released, it should spring back to the center.

Add an Animation<Alignment> field and an _runAnimation method. This
method defines a Tween that interpolates between the point the widget was
dragged to, to the point in the center.

lib/{step2.dart (animation) → step3.dart (animation)}

@@ -1,4 +1,5 @@

1
1

class _DraggableCardState extends State<DraggableCard>

2
2

with SingleTickerProviderStateMixin {