mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-19 14:07:26 +02:00
perf(glass): omit collapsed navbar backdrop layers
This commit is contained in:
1 parent
fec2f86cfc
commit
963eaa5fd5
2 files changed
+31
-15
No files matched your search
@@ -324,16 +324,23 @@ class _MornyeBottomBarState extends ConsumerState<MornyeBottomBar>
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user