diff --git a/lib/widgets/mornye_bottom_bar.dart b/lib/widgets/mornye_bottom_bar.dart index d99194b2..058a51a4 100644 --- a/lib/widgets/mornye_bottom_bar.dart +++ b/lib/widgets/mornye_bottom_bar.dart @@ -324,16 +324,23 @@ class _MornyeBottomBarState extends ConsumerState ), ), ), - ClipRect( - clipBehavior: amount == 0 ? Clip.none : Clip.hardEdge, - child: Align( - alignment: Alignment.bottomCenter, - heightFactor: 1 - amount, - child: IgnorePointer( - ignoring: amount > 0.5, - child: ExcludeSemantics( - excluding: amount > 0.5, - child: amount == 0 ? fullTabs : foldingTabs, + Offstage( + // Retain tab state, but drop its backdrop layers only + // after the last visible frame of the fold. + offstage: amount == 1, + child: ClipRect( + clipBehavior: amount == 0 + ? Clip.none + : Clip.hardEdge, + child: Align( + alignment: Alignment.bottomCenter, + heightFactor: 1 - amount, + child: IgnorePointer( + ignoring: amount > 0.5, + child: ExcludeSemantics( + excluding: amount > 0.5, + child: amount == 0 ? fullTabs : foldingTabs, + ), ), ), ), diff --git a/test/mornye_bottom_bar_test.dart b/test/mornye_bottom_bar_test.dart index 69d50b64..995dda39 100644 --- a/test/mornye_bottom_bar_test.dart +++ b/test/mornye_bottom_bar_test.dart @@ -141,7 +141,10 @@ void main() { 'player and navbar share a backdrop while moving capsules remain isolated', (tester) async { await pumpShell(tester, blur: true, liquidGlass: false); - void expectSharedBackdrop({int movingSurfaces = 2}) { + void expectSharedBackdrop({ + int movingSurfaces = 2, + int sharedSurfaces = 2, + }) { final filters = find.descendant( of: find.byType(MornyeBottomBar), matching: find.byType(BackdropFilter), @@ -155,8 +158,10 @@ void main() { final shared = renderers .where((filter) => filter.backdropKey != null) .toList(); - expect(shared, hasLength(2)); - expect(shared[0].backdropKey, same(shared[1].backdropKey)); + expect(shared, hasLength(sharedSurfaces)); + if (sharedSurfaces == 2) { + expect(shared[0].backdropKey, same(shared[1].backdropKey)); + } // Side capsules overlap the folding tabs and must not join their group. expect( renderers.where((filter) => filter.backdropKey == null), @@ -171,7 +176,7 @@ void main() { await tester.pump(const Duration(milliseconds: 190)); expectSharedBackdrop(); await tester.pumpAndSettle(); - expectSharedBackdrop(); + expectSharedBackdrop(sharedSurfaces: 1); expect(tester.takeException(), isNull); }, ); @@ -817,7 +822,11 @@ void main() { expect(TickerMode.valuesOf(glass).enabled, isTrue); chrome.value = true; await tester.pumpAndSettle(); - expect(tester.element(find.byType(MornyeSelectionPill)), same(glass)); + expect(find.byType(MornyeSelectionPill), findsNothing); + expect( + tester.element(find.byType(MornyeSelectionPill, skipOffstage: false)), + same(glass), + ); expect(TickerMode.valuesOf(glass).enabled, isFalse); chrome.expand(); await tester.pumpAndSettle();