Unverified Commit 9c963572 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[framework] ensure flexible space bar fades when scrolling. (#129527)

This was missing the actual opacity rendering, oops
parent 8d837062
......@@ -451,4 +451,21 @@ class _RenderFlexibleSpaceHeaderOpacity extends RenderOpacity {
@override
bool get isRepaintBoundary => false;
@override
void paint(PaintingContext context, Offset offset) {
if (child == null) {
return;
}
if (opacity == 0) {
layer = null;
return;
}
assert(needsCompositing);
layer = context.pushOpacity(offset, (opacity * 255).round(), super.paint, oldLayer: layer as OpacityLayer?);
assert(() {
layer!.debugCreator = debugCreator;
return true;
}());
}
}
......@@ -801,14 +801,29 @@ void main() {
));
expect(RenderRebuildTracker.count, 1);
expect(
tester.layers.lastWhere((Layer element) => element is OpacityLayer),
isA<OpacityLayer>().having((OpacityLayer p0) => p0.alpha, 'alpha', 255),
);
// We drag up to fully collapse the space bar.
for (int i = 0; i < 20; i++) {
for (int i = 0; i < 9; i++) {
await tester.drag(find.byKey(SubCategoryScreenView.scrollKey), const Offset(0, -50.0));
await tester.pumpAndSettle();
}
expect(
tester.layers.lastWhere((Layer element) => element is OpacityLayer),
isA<OpacityLayer>().having((OpacityLayer p0) => p0.alpha, 'alpha', lessThan(255)),
);
for (int i = 0; i < 11; i++) {
await tester.drag(find.byKey(SubCategoryScreenView.scrollKey), const Offset(0, -50.0));
await tester.pumpAndSettle();
}
expect(RenderRebuildTracker.count, greaterThan(1));
expect(tester.layers.whereType<OpacityLayer>(), isEmpty);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment