Skip to content

Commit c60cb47

Browse files
committed
🔧 Update Pack 2 #9
1 parent 981369f commit c60cb47

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/src/animated_group_effect.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Widget _defaultRemovedChildBuilder(BuildContext context, Widget child) => child
6363

6464
Widget _defaultAddedChildBuilder(
6565
BuildContext context, Widget child, BooleanCallback skipIf) =>
66-
child.slideInFromTop().fadeIn().oneShot(
67-
duration: const Duration(milliseconds: 500),
66+
child.slideInFromTop(value: -50).fadeIn().oneShot(
67+
duration: const Duration(milliseconds: 300),
6868
curve: Curves.easeInOutQuart,
6969
skipIf: skipIf,
7070
);
@@ -73,9 +73,9 @@ Widget _defaultSwappedChildBuilder(
7373
BuildContext context,
7474
Widget child,
7575
) =>
76-
child.roll(multiplier: 2).animate(
76+
child.roll(multiplier: 2).clip(0).animate(
7777
trigger: child.key,
78-
duration: const Duration(milliseconds: 500),
78+
duration: const Duration(milliseconds: 300),
7979
curve: Curves.easeInOutQuart,
8080
);
8181

@@ -105,8 +105,8 @@ class AnimatedGroup extends StatefulWidget {
105105
/// Whether to trigger the addition of the children immediately when the
106106
/// widget is built for the first time, or only for subsequent insertions
107107
/// of children. For example, you may want a row of widgets
108-
/// to appear as normal without animating when your screen renders for the first
109-
/// time, but subsequent insertions should animate.
108+
/// to appear as normal without animating when your screen renders for the
109+
/// first time, but subsequent insertions should animate.
110110
final bool triggerAddImmediately;
111111

112112
/// Whether to use the swap animation when possible. If set to `false`, the
@@ -221,6 +221,7 @@ class _AnimatedChildState extends State<AnimatedChild> {
221221
final SnapshotController controller =
222222
SnapshotController(allowSnapshotting: true);
223223
Widget? prevChild;
224+
GlobalKey removedKey = GlobalKey();
224225

225226
@override
226227
void dispose() {
@@ -233,6 +234,7 @@ class _AnimatedChildState extends State<AnimatedChild> {
233234
super.didUpdateWidget(oldWidget);
234235

235236
if (oldWidget.child != widget.child) {
237+
removedKey = GlobalKey();
236238
if (widget.useSnapshots) {
237239
prevChild = oldWidget.child == null
238240
? null
@@ -256,7 +258,7 @@ class _AnimatedChildState extends State<AnimatedChild> {
256258
if (widget.child == null)
257259
if (prevChild case Widget prev)
258260
KeyedSubtree(
259-
key: UniqueKey(),
261+
key: removedKey,
260262
child: widget.removeBuilder(context, prev),
261263
),
262264
if (widget.child case Widget child)

0 commit comments

Comments
 (0)