Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add card background options: blurred, gradient, or off

Barnabasb3a16af2b712
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 51fff86d..e8d87e44 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -1354,6 +1354,9 @@
"coverPlayPause": "Cover play/pause",
"coverPlayPauseOnSubtitle": "On - tap cover art to play/pause",
"coverPlayPauseOffSubtitle": "Off - dedicated play/pause button in controls",
+ "cardBackground": "Card background",
+ "cardBackgroundBlurred": "Blurred",
+ "cardBackgroundGradient": "Gradient",
"queueModeMergedSubtitle": "Playback stops, manual queue, or auto-plays next item",
"queueModeSeriesLabel": "Series",
"queueModeShowLabel": "Show",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index e1941318..0f5d4295 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -5086,6 +5086,24 @@ abstract class AppLocalizations {
/// **'Off - dedicated play/pause button in controls'**
String get coverPlayPauseOffSubtitle;
+ /// No description provided for @cardBackground.
+ ///
+ /// In en, this message translates to:
+ /// **'Card background'**
+ String get cardBackground;
+
+ /// No description provided for @cardBackgroundBlurred.
+ ///
+ /// In en, this message translates to:
+ /// **'Blurred'**
+ String get cardBackgroundBlurred;
+
+ /// No description provided for @cardBackgroundGradient.
+ ///
+ /// In en, this message translates to:
+ /// **'Gradient'**
+ String get cardBackgroundGradient;
+
/// No description provided for @queueModeMergedSubtitle.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index 64cdbe3c..3a5ceb4e 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -2769,6 +2769,15 @@ class AppLocalizationsDe extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Aus - eigener Play/Pause-Button in den Steuerelementen';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Wiedergabe stoppt, manuelle Warteschlange oder Auto-Absorb des nächsten Elements';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index 4fcb4a8e..52dd1b84 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsEl extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 42410698..30e99342 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsEn extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index ab93927a..c47742cf 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsEs extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index d8dd56f0..dca92003 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -2743,6 +2743,15 @@ class AppLocalizationsFr extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index c72f90f9..c444a47f 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsIt extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index 4a563a36..3dde2b9d 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsJa extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index bed95708..35f0418a 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsNo extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 52dbb403..1bd41451 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsPt extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index ab75eadc..69ba9210 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -2741,6 +2741,15 @@ class AppLocalizationsRo extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index 50d339a6..0dc49c37 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -2744,6 +2744,15 @@ class AppLocalizationsRu extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index ce612461..6722a4da 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -2667,6 +2667,15 @@ class AppLocalizationsZh extends AppLocalizations {
String get coverPlayPauseOffSubtitle =>
'Off - dedicated play/pause button in controls';
+ @override
+ String get cardBackground => 'Card background';
+
+ @override
+ String get cardBackgroundBlurred => 'Blurred';
+
+ @override
+ String get cardBackgroundGradient => 'Gradient';
+
@override
String get queueModeMergedSubtitle =>
'Playback stops, manual queue, or auto-plays next item';
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index e11571c6..136abd73 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -111,6 +111,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool _classicWording = false;
bool _rectangleCovers = false;
bool _coverPlayButton = false;
+ String _cardBackground = 'blurred';
double _progressTextScale = 1.0;
String _themeMode = 'dark';
String _language = '';
@@ -341,7 +342,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
PlayerSettings.getQueuePlaylistId(), // 51
PlayerSettings.getMediaControlsSpeedBookmark(), // 52
PlayerSettings.getLockSeekBar(), // 53
- PlayerSettings.getProgressTextScale(), // 54
+ PlayerSettings.getCardBackground(), // card background
+ PlayerSettings.getProgressTextScale(), // 54 (kept last — read via results.last)
]);
final s = results[0] as AutoRewindSettings;
final progressScale = results.last as double;
@@ -395,6 +397,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
final qpId = results[48] as String?;
final notifSpeedBookmark = results[49] as bool;
final lockSeek = results[50] as bool;
+ final cardBg = results[51] as String;
final rmabBaseUrl = await ScopedPrefs.getString(kRmabBaseUrlKey);
final rmabApiToken = await ScopedPrefs.getString(kRmabApiTokenKey);
final sleepRewind = await PlayerSettings.getSleepRewindSeconds();
@@ -448,6 +451,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
// cardBtnLayout removed (now managed in edit sheet)
_rectangleCovers = rectCovers;
_coverPlayButton = coverPlay;
+ _cardBackground = cardBg;
_progressTextScale = progressScale;
_skipChapterBarrier = skipBarrier;
_trustAllCerts = trustCerts;
@@ -985,6 +989,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
} : null,
),
const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(l.cardBackground, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ const SizedBox(height: 8),
+ SizedBox(width: double.infinity, child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(value: 'blurred', icon: const Icon(Icons.blur_on_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundBlurred))),
+ ButtonSegment(value: 'gradient', icon: const Icon(Icons.gradient_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundGradient))),
+ ButtonSegment(value: 'off', icon: const Icon(Icons.block_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.off))),
+ ],
+ selected: {_cardBackground},
+ onSelectionChanged: _loaded ? (s) {
+ if (s.isEmpty) return;
+ setState(() => _cardBackground = s.first);
+ PlayerSettings.setCardBackground(s.first);
+ } : null,
+ style: const ButtonStyle(visualDensity: VisualDensity.compact),
+ )),
+ ]),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
SwitchListTile(
title: Text(l.fullBookScrubber),
subtitle: Text(
diff --git a/lib/services/player_settings.dart b/lib/services/player_settings.dart
index 1fcb78f4..817e10d5 100644
--- a/lib/services/player_settings.dart
+++ b/lib/services/player_settings.dart
@@ -443,6 +443,11 @@ class PlayerSettings {
static Future<bool> getCoverPlayButton() => _get('coverPlayButton', false);
static Future<void> setCoverPlayButton(bool value) => _set('coverPlayButton', value, notify: true);
+ /// Absorbing-card background style: 'blurred' (cover blur, default), 'gradient'
+ /// (gradient from the extracted cover colors), or 'off' (plain theme surface).
+ static Future<String> getCardBackground() => _get('cardBackground', 'blurred');
+ static Future<void> setCardBackground(String value) => _set('cardBackground', value, notify: true);
+
// ── Self-signed certificates (global, not per-user) ──
static Future<bool> getTrustAllCerts() async {
diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dart
index 3ae8f861..67a83220 100644
--- a/lib/widgets/absorbing_card.dart
+++ b/lib/widgets/absorbing_card.dart
@@ -43,6 +43,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
bool _moreInline = false;
bool _rectangleCovers = false;
bool _coverPlayButton = false;
+ String _cardBackground = 'blurred';
bool _speedAdjustedTime = true;
double _progressTextScale = 1.0; // elapsed/remaining/percent text size (GH #230)
double _savedSpeed = 1.0; // per-book or default speed for inactive display
@@ -177,6 +178,9 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
PlayerSettings.getProgressTextScale().then((v) {
if (mounted && v != _progressTextScale) setState(() => _progressTextScale = v);
});
+ PlayerSettings.getCardBackground().then((v) {
+ if (mounted && v != _cardBackground) setState(() => _cardBackground = v);
+ });
_loadSavedSpeed();
}
@@ -323,13 +327,28 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
void _onCoverLoaded(ImageProvider provider) {
_coverProvider = provider;
_rederiveCoverScheme();
- // Precache the blurred version of the cover
- if (_blurredCover == null) {
+ // Precache the blurred version of the cover, but only when the blurred
+ // background is actually in use (skip the work for gradient / off modes).
+ if (_cardBackground == 'blurred' && _blurredCover == null) {
_blurredCoverUrl = _coverUrl;
_precacheBlur(provider);
}
}
+ /// In gradient/off mode the cover image isn't painted, so resolve it directly
+ /// to keep the extracted [_coverScheme] (accent + gradient colors) available.
+ void _ensureCoverScheme() {
+ if (_coverProvider != null || _coverUrl == null) return;
+ final headers = context.read<LibraryProvider>().mediaHeaders;
+ final ImageProvider provider;
+ if (_isLocalCover) {
+ provider = FileImage(File(_coverUrl!));
+ } else {
+ provider = CachedNetworkImageProvider(_coverUrl!, headers: headers);
+ }
+ _onCoverLoaded(provider);
+ }
+
void _rederiveCoverScheme() {
final provider = _coverProvider;
if (provider == null) return;
@@ -444,6 +463,8 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
_blurredCover?.dispose();
_blurredCover = null;
}
+ // In gradient/off mode the cover image isn't painted, so derive its scheme separately.
+ if (_cardBackground != 'blurred') _ensureCoverScheme();
final showBookBar = (!_isPodcastEpisode || _chapters.isNotEmpty) && (!lib.isPodcastLibrary || _chapters.isNotEmpty);
return GestureDetector(
@@ -461,8 +482,21 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
child: Stack(
fit: StackFit.expand,
children: [
- // Layer 1: Pre-blurred cover background (cached bitmap — no per-frame blur)
- if (_blurredCover != null)
+ // Layer 1: Card background — blurred cover, color gradient, or plain surface
+ if (_cardBackground == 'off')
+ ColoredBox(color: Theme.of(context).colorScheme.surface)
+ else if (_cardBackground == 'gradient')
+ DecoratedBox(
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [cs.primaryContainer, cs.surface],
+ ),
+ ),
+ )
+ // Pre-blurred cover background (cached bitmap — no per-frame blur)
+ else if (_blurredCover != null)
RepaintBoundary(
child: RawImage(
image: _blurredCover,
@@ -506,17 +540,31 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
- colors: isDark
- ? [
- Colors.black.withValues(alpha: 0.3),
- Colors.black.withValues(alpha: 0.6),
- Colors.black.withValues(alpha: 0.85),
- ]
- : [
- Colors.white.withValues(alpha: 0.4),
- Colors.white.withValues(alpha: 0.7),
- Colors.white.withValues(alpha: 0.9),
- ],
+ // Lighter scrim over the gradient/off backgrounds so the cover
+ // tint reads through; the blurred photo still needs the heavier one.
+ colors: _cardBackground == 'blurred'
+ ? (isDark
+ ? [
+ Colors.black.withValues(alpha: 0.3),
+ Colors.black.withValues(alpha: 0.6),
+ Colors.black.withValues(alpha: 0.85),
+ ]
+ : [
+ Colors.white.withValues(alpha: 0.4),
+ Colors.white.withValues(alpha: 0.7),
+ Colors.white.withValues(alpha: 0.9),
+ ])
+ : (isDark
+ ? [
+ Colors.black.withValues(alpha: 0.15),
+ Colors.black.withValues(alpha: 0.4),
+ Colors.black.withValues(alpha: 0.68),
+ ]
+ : [
+ Colors.white.withValues(alpha: 0.25),
+ Colors.white.withValues(alpha: 0.55),
+ Colors.white.withValues(alpha: 0.8),
+ ]),
),
),
),
@@ -961,6 +1009,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
initialCoverScheme: _coverScheme,
initialBlurredCover: _blurredCover,
initialChapters: _fetchedChapters,
+ initialCardBackground: _cardBackground,
),
),
).then((_) => AppShell.setExpandedOpen(false));
diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dart
index ba8386ed..ac03bd77 100644
--- a/lib/widgets/expanded_card.dart
+++ b/lib/widgets/expanded_card.dart
@@ -52,6 +52,7 @@ class ExpandedCard extends StatefulWidget {
final ColorScheme? initialCoverScheme;
final ui.Image? initialBlurredCover;
final List<dynamic>? initialChapters;
+ final String initialCardBackground;
const ExpandedCard({
super.key,
@@ -60,6 +61,7 @@ class ExpandedCard extends StatefulWidget {
this.initialCoverScheme,
this.initialBlurredCover,
this.initialChapters,
+ this.initialCardBackground = 'blurred',
});
@override
@@ -87,6 +89,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
bool _moreInline = false;
bool _rectangleCovers = false;
bool _coverPlayButton = false;
+ String _cardBackground = 'blurred';
bool _speedAdjustedTime = true;
double _progressTextScale = 1.0;
@@ -164,6 +167,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
super.initState();
_item = widget.item;
_coverScheme = widget.initialCoverScheme;
+ _cardBackground = widget.initialCardBackground;
_fetchedChapters = widget.initialChapters;
_currentItemId = widget.player.currentItemId;
_currentEpisodeId = widget.player.currentEpisodeId;
@@ -174,8 +178,10 @@ class _ExpandedCardState extends State<ExpandedCard> {
_reloadButtonOrder();
_startChapterTracking();
_fetchChaptersIfNeeded();
- // Generate our own blurred cover
- _generateBlur();
+ // Always derive the cover scheme (accent + gradient colors); only build the
+ // blurred bitmap when the blurred background is actually in use.
+ _deriveCoverScheme();
+ if (_cardBackground == 'blurred') _generateBlur();
}
void _onCastChanged() {
@@ -220,6 +226,12 @@ class _ExpandedCardState extends State<ExpandedCard> {
PlayerSettings.getProgressTextScale().then((v) {
if (mounted && v != _progressTextScale) setState(() => _progressTextScale = v);
});
+ PlayerSettings.getCardBackground().then((v) {
+ if (!mounted) return;
+ if (v != _cardBackground) setState(() => _cardBackground = v);
+ // Switched to the blurred background after open — build the bitmap now.
+ if (v == 'blurred' && _blurredCover == null) _generateBlur();
+ });
}
@override
@@ -429,6 +441,21 @@ class _ExpandedCardState extends State<ExpandedCard> {
_rederiveCoverScheme();
}
+ /// Resolve the cover image to derive [_coverScheme] without building the blur
+ /// (used by the gradient / off backgrounds, which never paint the cover).
+ void _deriveCoverScheme() {
+ if (_coverScheme != null || _coverProvider != null) return;
+ final url = _coverUrl;
+ if (url == null) return;
+ final ImageProvider provider;
+ if (url.startsWith('/')) {
+ provider = FileImage(File(url));
+ } else {
+ provider = CachedNetworkImageProvider(url, headers: context.read<LibraryProvider>().mediaHeaders);
+ }
+ _onCoverLoaded(provider);
+ }
+
void _rederiveCoverScheme() {
final provider = _coverProvider;
if (provider == null) return;
@@ -553,10 +580,10 @@ class _ExpandedCardState extends State<ExpandedCard> {
body: Stack(
fit: StackFit.expand,
children: [
- // Layer 1: Blurred cover background
+ // Layer 1: Card background (blurred cover / color gradient / plain surface)
AnimatedSwitcher(
duration: const Duration(milliseconds: 600),
- child: _buildBackground(isDark, mediaHeaders),
+ child: _buildBackground(isDark, cs, mediaHeaders),
),
// Layer 2: Scrim
Positioned.fill(
@@ -565,17 +592,31 @@ class _ExpandedCardState extends State<ExpandedCard> {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
- colors: isDark
- ? [
- Colors.black.withValues(alpha: 0.3),
- Colors.black.withValues(alpha: 0.6),
- Colors.black.withValues(alpha: 0.85),
- ]
- : [
- Colors.white.withValues(alpha: 0.4),
- Colors.white.withValues(alpha: 0.7),
- Colors.white.withValues(alpha: 0.9),
- ],
+ // Lighter scrim over the gradient/off backgrounds so the cover
+ // tint reads through; the blurred photo still needs the heavier one.
+ colors: _cardBackground == 'blurred'
+ ? (isDark
+ ? [
+ Colors.black.withValues(alpha: 0.3),
+ Colors.black.withValues(alpha: 0.6),
+ Colors.black.withValues(alpha: 0.85),
+ ]
+ : [
+ Colors.white.withValues(alpha: 0.4),
+ Colors.white.withValues(alpha: 0.7),
+ Colors.white.withValues(alpha: 0.9),
+ ])
+ : (isDark
+ ? [
+ Colors.black.withValues(alpha: 0.15),
+ Colors.black.withValues(alpha: 0.4),
+ Colors.black.withValues(alpha: 0.68),
+ ]
+ : [
+ Colors.white.withValues(alpha: 0.25),
+ Colors.white.withValues(alpha: 0.55),
+ Colors.white.withValues(alpha: 0.8),
+ ]),
),
),
),
@@ -889,7 +930,29 @@ class _ExpandedCardState extends State<ExpandedCard> {
// ── Background builder ──
- Widget _buildBackground(bool isDark, Map<String, String> mediaHeaders) {
+ Widget _buildBackground(bool isDark, ColorScheme cs, Map<String, String> mediaHeaders) {
+ if (_cardBackground == 'off') {
+ // SizedBox.expand: the AnimatedSwitcher's Stack gives loose constraints,
+ // so an unsized box would collapse to 0x0 and never show.
+ return SizedBox.expand(
+ key: const ValueKey('bg-off'),
+ child: ColoredBox(color: Theme.of(context).colorScheme.surface),
+ );
+ }
+ if (_cardBackground == 'gradient') {
+ return SizedBox.expand(
+ key: const ValueKey('bg-gradient'),
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [cs.primaryContainer, cs.surface],
+ ),
+ ),
+ ),
+ );
+ }
if (_blurredCover != null) {
return RepaintBoundary(
key: ValueKey('blur-$_itemId'),