mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-20 22:41:38 +02:00
fix(player): restore the lighter full-screen cover scrim
Shade the app bar lightly and ease it out so white icons stay legible without darkening the top of the cover.
This commit is contained in:
1 parent
7c0b275f9f
commit
2ede99bef8
2 files changed
+18
-9
No files matched your search
@@ -91,12 +91,12 @@ class MaterialPlayerBackdrop extends StatelessWidget {
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
// Keep the entire bar readable, then fade below it. Fading
|
||||
// from the top left too little shade behind white icons.
|
||||
// A light shade that eases out across the bar: enough for
|
||||
// white icons without darkening the top of the cover.
|
||||
stops: [0, appBarHeight / (appBarHeight + 32), 1],
|
||||
colors: const [
|
||||
Color(0x99000000),
|
||||
Color(0x99000000),
|
||||
Color(0x40000000),
|
||||
Color(0x14000000),
|
||||
Color(0x00000000),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -68,17 +68,26 @@ void main() {
|
||||
final bytes = (await image.toByteData(
|
||||
format: ui.ImageByteFormat.rawRgba,
|
||||
))!;
|
||||
for (final y in [24, 52, 78]) {
|
||||
double luminanceAt(int y) {
|
||||
final offset = (y * image.width + 20) * 4;
|
||||
final background = Color.fromARGB(
|
||||
return Color.fromARGB(
|
||||
bytes.getUint8(offset + 3),
|
||||
bytes.getUint8(offset),
|
||||
bytes.getUint8(offset + 1),
|
||||
bytes.getUint8(offset + 2),
|
||||
);
|
||||
final contrast = 1.05 / (background.computeLuminance() + 0.05);
|
||||
expect(contrast, greaterThanOrEqualTo(4.5), reason: 'App bar y=$y');
|
||||
).computeLuminance();
|
||||
}
|
||||
|
||||
// The shade is darkest under the status bar, eases out across the
|
||||
// app bar, stays light enough not to hide the cover, and is gone
|
||||
// below the bar (24 inset + 56 toolbar + 32 fade).
|
||||
final top = luminanceAt(2);
|
||||
final bar = luminanceAt(52);
|
||||
final below = luminanceAt(130);
|
||||
expect(top, lessThan(bar));
|
||||
expect(bar, lessThan(below));
|
||||
expect(top, greaterThan(below * 0.5));
|
||||
expect(below, closeTo(luminanceAt(200), 0.01));
|
||||
} finally {
|
||||
image.dispose();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user