diff --git a/lib/widgets/material_player_backdrop.dart b/lib/widgets/material_player_backdrop.dart index 7e0e3e49..a3582ab6 100644 --- a/lib/widgets/material_player_backdrop.dart +++ b/lib/widgets/material_player_backdrop.dart @@ -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), ], ), diff --git a/test/player_presentation_settings_test.dart b/test/player_presentation_settings_test.dart index 6367bad0..4d0d1e6f 100644 --- a/test/player_presentation_settings_test.dart +++ b/test/player_presentation_settings_test.dart @@ -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(); }