Skip to content

Commit 1d2fa28

Browse files
Revert "Fixed AnimatedSwitcher chain produced duplicates (#106962)" (#107318)
This reverts commit 0d3cc92.
1 parent 750516a commit 1d2fa28

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

packages/flutter/lib/src/widgets/animated_switcher.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ class AnimatedSwitcher extends StatefulWidget {
222222
/// This is an [AnimatedSwitcherTransitionBuilder] function.
223223
static Widget defaultTransitionBuilder(Widget child, Animation<double> animation) {
224224
return FadeTransition(
225-
key: ValueKey<Key?>(child.key),
226225
opacity: animation,
227226
child: child,
228227
);
@@ -395,6 +394,6 @@ class _AnimatedSwitcherState extends State<AnimatedSwitcher> with TickerProvider
395394
@override
396395
Widget build(BuildContext context) {
397396
_rebuildOutgoingWidgetsIfNeeded();
398-
return widget.layoutBuilder(_currentEntry?.transition, _outgoingWidgets!.where((Widget outgoing) => outgoing.key != _currentEntry?.transition.key).toSet().toList());
397+
return widget.layoutBuilder(_currentEntry?.transition, _outgoingWidgets!);
399398
}
400399
}

packages/flutter/test/widgets/animated_switcher_test.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -415,25 +415,6 @@ void main() {
415415
);
416416
}
417417
});
418-
419-
testWidgets('AnimatedSwitcher does not duplicate animations if the same child is entered twice.', (WidgetTester tester) async {
420-
Future<void> pumpChild(Widget child) async {
421-
return tester.pumpWidget(
422-
Directionality(
423-
textDirection: TextDirection.ltr,
424-
child: AnimatedSwitcher(
425-
duration: const Duration(milliseconds: 1000),
426-
child: child,
427-
),
428-
),
429-
);
430-
}
431-
await pumpChild(const Text('1', key: Key('1')));
432-
await pumpChild(const Text('2', key: Key('2')));
433-
await pumpChild(const Text('1', key: Key('1')));
434-
await tester.pump(const Duration(milliseconds: 1000));
435-
expect(find.text('1'), findsOneWidget);
436-
});
437418
}
438419

439420
class StatefulTest extends StatefulWidget {

0 commit comments

Comments
 (0)