Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add light mode setting with theme-aware colors across all screens

Nathan Poulson1b2d5713970e
diff --git a/lib/main.dart b/lib/main.dart
index bb92cea9..1e0246b6 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -23,6 +23,17 @@ import 'screens/login_screen.dart';
import 'screens/app_shell.dart';
import 'widgets/absorb_wave_icon.dart';
+/// Global notifier so any widget (e.g. settings) can change the theme instantly.
+final ValueNotifier<ThemeMode> themeNotifier = ValueNotifier(ThemeMode.dark);
+
+ThemeMode parseThemeMode(String value) {
+ switch (value) {
+ case 'light': return ThemeMode.light;
+ case 'system': return ThemeMode.system;
+ default: return ThemeMode.dark;
+ }
+}
+
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -32,13 +43,9 @@ void main() async {
DeviceOrientation.portraitDown,
]);
- // Dark status bar to match Absorb theme
- SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
- statusBarColor: Colors.transparent,
- statusBarIconBrightness: Brightness.light,
- systemNavigationBarColor: Colors.black,
- systemNavigationBarIconBrightness: Brightness.light,
- ));
+ // Load saved theme preference
+ final savedTheme = await PlayerSettings.getThemeMode();
+ themeNotifier.value = parseThemeMode(savedTheme);
// Load device info for server identification
await ApiService.initDeviceId();
@@ -87,103 +94,170 @@ class AbsorbApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return DynamicColorBuilder(
- builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
- // Absorb is dark-first — use dynamic dark colors or our custom palette
- ColorScheme darkScheme;
- if (darkDynamic != null) {
- darkScheme = darkDynamic.harmonized();
- } else {
- darkScheme = ColorScheme.fromSeed(
- seedColor: const Color(0xFF7C6FBF), // deep muted purple
- brightness: Brightness.dark,
- );
- }
+ return ValueListenableBuilder<ThemeMode>(
+ valueListenable: themeNotifier,
+ builder: (context, currentMode, _) {
+ // Set system chrome to match active theme
+ final isDark = currentMode == ThemeMode.dark ||
+ (currentMode == ThemeMode.system &&
+ WidgetsBinding.instance.platformDispatcher.platformBrightness ==
+ Brightness.dark);
+ SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ statusBarIconBrightness: isDark ? Brightness.light : Brightness.dark,
+ systemNavigationBarColor: isDark ? Colors.black : const Color(0xFFF5F5F5),
+ systemNavigationBarIconBrightness: isDark ? Brightness.light : Brightness.dark,
+ ));
- // Light scheme for users who prefer it
- ColorScheme lightScheme;
- if (lightDynamic != null) {
- lightScheme = lightDynamic.harmonized();
- } else {
- lightScheme = ColorScheme.fromSeed(
- seedColor: const Color(0xFF7C6FBF),
- brightness: Brightness.light,
- );
- }
+ return DynamicColorBuilder(
+ builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
+ // Absorb is dark-first — use dynamic dark colors or our custom palette
+ ColorScheme darkScheme;
+ if (darkDynamic != null) {
+ darkScheme = darkDynamic.harmonized();
+ } else {
+ darkScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF7C6FBF), // deep muted purple
+ brightness: Brightness.dark,
+ );
+ }
- // Smooth page transition theme
- const pageTransition = PageTransitionsTheme(
- builders: {
- TargetPlatform.android: CupertinoPageTransitionsBuilder(),
- TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
- },
- );
+ // Light scheme for users who prefer it
+ ColorScheme lightScheme;
+ if (lightDynamic != null) {
+ lightScheme = lightDynamic.harmonized();
+ } else {
+ lightScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF7C6FBF),
+ brightness: Brightness.light,
+ );
+ }
- return MaterialApp(
- title: 'Absorb',
- debugShowCheckedModeBanner: false,
- themeMode: ThemeMode.dark, // Absorb: dark by default
- theme: ThemeData(
- useMaterial3: true,
- colorScheme: lightScheme,
- pageTransitionsTheme: pageTransition,
- ),
- darkTheme: ThemeData(
- useMaterial3: true,
- colorScheme: darkScheme,
- scaffoldBackgroundColor: const Color(0xFF0E0E0E),
- cardTheme: CardThemeData(
- color: darkScheme.surfaceContainerHigh,
- elevation: 0,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(16),
- ),
- ),
- navigationBarTheme: NavigationBarThemeData(
- backgroundColor: const Color(0xFF0E0E0E),
- indicatorColor: darkScheme.primary.withValues(alpha: 0.15),
- labelTextStyle: WidgetStatePropertyAll(
- TextStyle(
- fontSize: 11,
- fontWeight: FontWeight.w500,
- color: darkScheme.onSurfaceVariant,
+ // Smooth page transition theme
+ const pageTransition = PageTransitionsTheme(
+ builders: {
+ TargetPlatform.android: CupertinoPageTransitionsBuilder(),
+ TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
+ },
+ );
+
+ return MaterialApp(
+ title: 'Absorb',
+ debugShowCheckedModeBanner: false,
+ themeMode: currentMode,
+ theme: ThemeData(
+ useMaterial3: true,
+ colorScheme: lightScheme,
+ scaffoldBackgroundColor: lightScheme.surface,
+ cardTheme: CardThemeData(
+ color: lightScheme.surfaceContainerHigh,
+ elevation: 0,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(16),
+ ),
),
- ),
- ),
- appBarTheme: AppBarTheme(
- backgroundColor: const Color(0xFF0E0E0E),
- surfaceTintColor: Colors.transparent,
- scrolledUnderElevation: 0,
- ),
- searchBarTheme: SearchBarThemeData(
- backgroundColor: WidgetStatePropertyAll(
- darkScheme.surfaceContainerHigh,
- ),
- elevation: const WidgetStatePropertyAll(0),
- shape: WidgetStatePropertyAll(
- RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(16),
+ navigationBarTheme: NavigationBarThemeData(
+ backgroundColor: lightScheme.surface,
+ indicatorColor: lightScheme.primary.withValues(alpha: 0.15),
+ labelTextStyle: WidgetStatePropertyAll(
+ TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w500,
+ color: lightScheme.onSurfaceVariant,
+ ),
+ ),
),
+ appBarTheme: AppBarTheme(
+ backgroundColor: lightScheme.surface,
+ surfaceTintColor: Colors.transparent,
+ scrolledUnderElevation: 0,
+ ),
+ searchBarTheme: SearchBarThemeData(
+ backgroundColor: WidgetStatePropertyAll(
+ lightScheme.surfaceContainerHigh,
+ ),
+ elevation: const WidgetStatePropertyAll(0),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(16),
+ ),
+ ),
+ ),
+ bottomSheetTheme: BottomSheetThemeData(
+ backgroundColor: lightScheme.surfaceContainerLow,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ ),
+ snackBarTheme: SnackBarThemeData(
+ backgroundColor: lightScheme.inverseSurface,
+ contentTextStyle: TextStyle(color: lightScheme.onInverseSurface),
+ actionTextColor: lightScheme.inversePrimary,
+ behavior: SnackBarBehavior.floating,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ pageTransitionsTheme: pageTransition,
),
- ),
- bottomSheetTheme: const BottomSheetThemeData(
- backgroundColor: Color(0xFF1A1A1A),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
- ),
- ),
- snackBarTheme: SnackBarThemeData(
- backgroundColor: darkScheme.surfaceContainerHighest,
- contentTextStyle: TextStyle(color: darkScheme.onSurface),
- actionTextColor: darkScheme.primary,
- behavior: SnackBarBehavior.floating,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
+ darkTheme: ThemeData(
+ useMaterial3: true,
+ colorScheme: darkScheme,
+ scaffoldBackgroundColor: const Color(0xFF0E0E0E),
+ cardTheme: CardThemeData(
+ color: darkScheme.surfaceContainerHigh,
+ elevation: 0,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(16),
+ ),
+ ),
+ navigationBarTheme: NavigationBarThemeData(
+ backgroundColor: const Color(0xFF0E0E0E),
+ indicatorColor: darkScheme.primary.withValues(alpha: 0.15),
+ labelTextStyle: WidgetStatePropertyAll(
+ TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w500,
+ color: darkScheme.onSurfaceVariant,
+ ),
+ ),
+ ),
+ appBarTheme: AppBarTheme(
+ backgroundColor: const Color(0xFF0E0E0E),
+ surfaceTintColor: Colors.transparent,
+ scrolledUnderElevation: 0,
+ ),
+ searchBarTheme: SearchBarThemeData(
+ backgroundColor: WidgetStatePropertyAll(
+ darkScheme.surfaceContainerHigh,
+ ),
+ elevation: const WidgetStatePropertyAll(0),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(16),
+ ),
+ ),
+ ),
+ bottomSheetTheme: const BottomSheetThemeData(
+ backgroundColor: Color(0xFF1A1A1A),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ ),
+ snackBarTheme: SnackBarThemeData(
+ backgroundColor: darkScheme.surfaceContainerHighest,
+ contentTextStyle: TextStyle(color: darkScheme.onSurface),
+ actionTextColor: darkScheme.primary,
+ behavior: SnackBarBehavior.floating,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ pageTransitionsTheme: pageTransition,
),
- ),
- pageTransitionsTheme: pageTransition,
- ),
- home: const AuthGate(),
+ home: const AuthGate(),
+ );
+ },
);
},
);
diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dart
index cd5c548d..9759edde 100644
--- a/lib/screens/absorbing_screen.dart
+++ b/lib/screens/absorbing_screen.dart
@@ -276,16 +276,20 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
books = books.where((b) => dl.isDownloaded(b['id'] as String? ?? '')).toList();
}
+ final muted = cs.onSurfaceVariant;
+ final subtleBg = cs.onSurface.withValues(alpha: 0.06);
+ final subtleBorder = cs.onSurface.withValues(alpha: 0.08);
+
return Scaffold(
- backgroundColor: Colors.black,
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: Column(
children: [
// ── Header ──
AbsorbPageHeader(
title: 'Absorbing',
- brandingColor: Colors.white38,
- titleColor: Colors.white,
+ brandingColor: muted,
+ titleColor: cs.onSurface,
padding: const EdgeInsets.fromLTRB(20, 12, 12, 0),
actions: [
// Offline mode toggle
@@ -300,22 +304,22 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
curve: Curves.easeOutCubic,
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
- color: effectiveOffline ? Colors.orange.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.06),
+ color: effectiveOffline ? Colors.orange.withValues(alpha: 0.15) : subtleBg,
borderRadius: BorderRadius.circular(20),
- border: Border.all(color: effectiveOffline ? Colors.orange.withValues(alpha: 0.3) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: effectiveOffline ? Colors.orange.withValues(alpha: 0.3) : subtleBorder),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
effectiveOffline ? Icons.airplanemode_active_rounded : Icons.airplanemode_inactive_rounded,
- size: 14, color: effectiveOffline ? Colors.orange : Colors.white38,
+ size: 14, color: effectiveOffline ? Colors.orange : muted,
),
const SizedBox(width: 4),
Text(
effectiveOffline ? 'Offline' : 'Online',
style: TextStyle(
- color: effectiveOffline ? Colors.orange : Colors.white38,
+ color: effectiveOffline ? Colors.orange : muted,
fontSize: 11, fontWeight: FontWeight.w500,
),
),
@@ -342,26 +346,26 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: subtleBg,
borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: subtleBorder),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_isSyncing) ...[
- const SizedBox(width: 12, height: 12, child: CircularProgressIndicator(strokeWidth: 1.5, color: Colors.white38)),
+ SizedBox(width: 12, height: 12, child: CircularProgressIndicator(strokeWidth: 1.5, color: muted)),
const SizedBox(width: 6),
- const Text('Syncing…', style: TextStyle(color: Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Text('Syncing…', style: TextStyle(color: muted, fontSize: 11, fontWeight: FontWeight.w500)),
] else if (_player.hasBook) ...[
- const Icon(Icons.stop_rounded, size: 14, color: Colors.white38),
+ Icon(Icons.stop_rounded, size: 14, color: muted),
const SizedBox(width: 4),
- const Text('Stop & Sync', style: TextStyle(color: Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Text('Stop & Sync', style: TextStyle(color: muted, fontSize: 11, fontWeight: FontWeight.w500)),
] else ...[
- const Icon(Icons.sync_rounded, size: 14, color: Colors.white38),
+ Icon(Icons.sync_rounded, size: 14, color: muted),
const SizedBox(width: 4),
- const Text('Sync', style: TextStyle(color: Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Text('Sync', style: TextStyle(color: muted, fontSize: 11, fontWeight: FontWeight.w500)),
],
],
),
@@ -379,17 +383,17 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: subtleBg,
borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: subtleBorder),
),
- child: const Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
- Icon(Icons.stop_rounded, size: 14, color: Colors.white38),
- SizedBox(width: 4),
- Text('Stop', style: TextStyle(color: Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Icon(Icons.stop_rounded, size: 14, color: muted),
+ const SizedBox(width: 4),
+ Text('Stop', style: TextStyle(color: muted, fontSize: 11, fontWeight: FontWeight.w500)),
],
),
),
@@ -407,7 +411,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
// ── Cards (refreshable) ──
Expanded(
child: lib.isLoading
- ? const Center(child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white24))
+ ? Center(child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurface.withValues(alpha: 0.24)))
: books.isEmpty
? _emptyState(cs, tt, effectiveOffline)
: PageView.builder(
@@ -477,17 +481,17 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
children: [
Icon(isOffline ? Icons.cloud_off_rounded
: isPod ? Icons.podcasts_rounded : Icons.headphones_rounded,
- size: 64, color: Colors.white.withValues(alpha: 0.15)),
+ size: 64, color: cs.onSurface.withValues(alpha: 0.15)),
const SizedBox(height: 16),
Text(isOffline
? (isPod ? 'No downloaded episodes' : 'No downloaded books')
: (isPod ? 'Nothing playing yet' : 'Nothing absorbing yet'),
- style: tt.titleMedium?.copyWith(color: Colors.white38)),
+ style: tt.titleMedium?.copyWith(color: cs.onSurfaceVariant)),
const SizedBox(height: 8),
Text(isOffline
? (isPod ? 'Download episodes to listen offline' : 'Download books to listen offline')
: (isPod ? 'Start an episode from the Shows tab' : 'Start a book from the Library tab'),
- style: tt.bodySmall?.copyWith(color: Colors.white24)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.24))),
],
),
);
@@ -503,6 +507,7 @@ class _PageDots extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
return ListenableBuilder(
listenable: controller,
builder: (_, __) {
@@ -518,7 +523,7 @@ class _PageDots extends StatelessWidget {
width: active ? 20 : 6,
height: 6,
decoration: BoxDecoration(
- color: active ? Colors.white54 : Colors.white.withValues(alpha: 0.15),
+ color: active ? cs.onSurface.withValues(alpha: 0.54) : cs.onSurface.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(3),
),
);
diff --git a/lib/screens/admin_podcasts_screen.dart b/lib/screens/admin_podcasts_screen.dart
index 1252d3d4..9a03e0e8 100644
--- a/lib/screens/admin_podcasts_screen.dart
+++ b/lib/screens/admin_podcasts_screen.dart
@@ -60,7 +60,7 @@ class _AdminPodcastsScreenState extends State<AdminPodcastsScreen> {
final tt = Theme.of(context).textTheme;
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
floatingActionButton: FloatingActionButton.small(
backgroundColor: cs.primary,
onPressed: () => _showSearchSheet(),
@@ -470,7 +470,7 @@ class _PodcastPreviewScreenState extends State<_PodcastPreviewScreen> {
final tt = Theme.of(context).textTheme;
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: Column(
children: [
@@ -756,9 +756,8 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
Future<void> _deleteEpisode(String episodeId, String epTitle) async {
final yes = await showDialog<bool>(context: context, builder: (ctx) => AlertDialog(
- backgroundColor: const Color(0xFF2A2A2A),
- title: const Text('Delete Episode?', style: TextStyle(color: Colors.white)),
- content: Text('Delete "$epTitle"?', style: const TextStyle(color: Colors.white70)),
+ title: const Text('Delete Episode?'),
+ content: Text('Delete "$epTitle"?'),
actions: [TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('Cancel')),
TextButton(onPressed: () => Navigator.pop(ctx, true), child: Text('Delete', style: TextStyle(color: Colors.red.shade300)))],
));
@@ -779,7 +778,7 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
final author = _metadata['author'] as String? ?? '';
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(child: Column(children: [
// Back button
Padding(padding: const EdgeInsets.fromLTRB(4, 4, 8, 0),
@@ -1077,7 +1076,7 @@ class _EpisodeDetailSheet extends StatelessWidget {
return Container(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.75),
- decoration: const BoxDecoration(color: Color(0xFF1A1A1A), borderRadius: BorderRadius.vertical(top: Radius.circular(24))),
+ decoration: BoxDecoration(color: Theme.of(context).bottomSheetTheme.backgroundColor, borderRadius: const BorderRadius.vertical(top: Radius.circular(24))),
child: Column(mainAxisSize: MainAxisSize.min, children: [
// Handle
Center(child: Container(margin: const EdgeInsets.only(top: 12), width: 36, height: 4,
@@ -1231,7 +1230,7 @@ class _DownloadedEpisodeDetailSheet extends StatelessWidget {
return Container(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.75),
- decoration: const BoxDecoration(color: Color(0xFF1A1A1A), borderRadius: BorderRadius.vertical(top: Radius.circular(24))),
+ decoration: BoxDecoration(color: Theme.of(context).bottomSheetTheme.backgroundColor, borderRadius: const BorderRadius.vertical(top: Radius.circular(24))),
child: Column(mainAxisSize: MainAxisSize.min, children: [
Center(child: Container(margin: const EdgeInsets.only(top: 12), width: 36, height: 4,
decoration: BoxDecoration(color: Colors.white12, borderRadius: BorderRadius.circular(2)))),
diff --git a/lib/screens/admin_screen.dart b/lib/screens/admin_screen.dart
index bce2e42a..5d7968c8 100644
--- a/lib/screens/admin_screen.dart
+++ b/lib/screens/admin_screen.dart
@@ -68,7 +68,7 @@ class _AdminScreenState extends State<AdminScreen> {
final tt = Theme.of(context).textTheme;
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: _loading
? const Center(child: CircularProgressIndicator(strokeWidth: 2))
@@ -323,9 +323,8 @@ class _AdminScreenState extends State<AdminScreen> {
Future<void> _matchLib(String id, String name) async {
final api = context.read<AuthProvider>().apiService; if (api == null) return;
final yes = await showDialog<bool>(context: context, builder: (ctx) => AlertDialog(
- backgroundColor: const Color(0xFF2A2A2A),
- title: const Text('Match All Items?', style: TextStyle(color: Colors.white)),
- content: Text('Match metadata for all items in $name? This can take a while.', style: const TextStyle(color: Colors.white70)),
+ title: const Text('Match All Items?'),
+ content: Text('Match metadata for all items in $name? This can take a while.'),
actions: [TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('Cancel')),
TextButton(onPressed: () => Navigator.pop(ctx, true), child: const Text('Match'))],
));
diff --git a/lib/screens/admin_users_screen.dart b/lib/screens/admin_users_screen.dart
index 58fbd2be..66fdba5e 100644
--- a/lib/screens/admin_users_screen.dart
+++ b/lib/screens/admin_users_screen.dart
@@ -31,7 +31,7 @@ class _AdminUsersScreenState extends State<AdminUsersScreen> {
final tt = Theme.of(context).textTheme;
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
floatingActionButton: FloatingActionButton.small(
backgroundColor: cs.primary,
onPressed: () => _showEditor(null),
@@ -237,7 +237,7 @@ class _UserDetailScreenState extends State<_UserDetailScreen> {
final inProgress = _progressItems.where((p) => (p['isFinished'] != true) && (p['progress'] as num? ?? 0) > 0).length;
return Scaffold(
- backgroundColor: const Color(0xFF0E0E0E),
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: Column(children: [
Padding(
@@ -499,7 +499,7 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
final tt = Theme.of(context).textTheme;
return Container(
- decoration: const BoxDecoration(color: Color(0xFF1A1A1A), borderRadius: BorderRadius.vertical(top: Radius.circular(24))),
+ decoration: BoxDecoration(color: Theme.of(context).bottomSheetTheme.backgroundColor, borderRadius: const BorderRadius.vertical(top: Radius.circular(24))),
child: Column(mainAxisSize: MainAxisSize.min, children: [
Center(child: Container(margin: const EdgeInsets.only(top: 12), width: 36, height: 4,
decoration: BoxDecoration(color: Colors.white12, borderRadius: BorderRadius.circular(2)))),
@@ -634,9 +634,8 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
Future<void> _deleteUser() async {
final name = widget.user?['username'] ?? 'this user';
final yes = await showDialog<bool>(context: context, builder: (ctx) => AlertDialog(
- backgroundColor: const Color(0xFF2A2A2A),
- title: const Text('Delete User?', style: TextStyle(color: Colors.white)),
- content: Text('Permanently delete $name?', style: const TextStyle(color: Colors.white70)),
+ title: const Text('Delete User?'),
+ content: Text('Permanently delete $name?'),
actions: [TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('Cancel')),
TextButton(onPressed: () => Navigator.pop(ctx, true), child: Text('Delete', style: TextStyle(color: Colors.red.shade300)))],
));
diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dart
index e3950de5..388a82d1 100644
--- a/lib/screens/library_screen.dart
+++ b/lib/screens/library_screen.dart
@@ -1291,13 +1291,13 @@ class _GridBookTileState extends State<_GridBookTile> {
children: [
if (isFinished) ...[
Icon(Icons.check_circle_rounded,
- size: 10, color: Colors.greenAccent[400]),
+ size: 10, color: Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent[400] : Colors.green.shade700),
const SizedBox(width: 3),
Text('Done',
style: TextStyle(
fontSize: 9,
fontWeight: FontWeight.w600,
- color: Colors.greenAccent[400])),
+ color: Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent[400] : Colors.green.shade700)),
],
if (isFinished && isDownloaded)
const SizedBox(width: 6),
@@ -2186,13 +2186,13 @@ class _SeriesBooksSheetState extends State<_SeriesBooksSheet> {
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.check_circle_rounded,
- size: 10, color: Colors.greenAccent[400]),
+ size: 10, color: Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent[400] : Colors.green.shade700),
const SizedBox(width: 3),
Text('Done',
style: TextStyle(
fontSize: 9,
fontWeight: FontWeight.w600,
- color: Colors.greenAccent[400])),
+ color: Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent[400] : Colors.green.shade700)),
],
),
),
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 3e12f6c6..9ff6ddbc 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -15,6 +15,7 @@ import '../services/log_service.dart';
import '../screens/login_screen.dart';
import '../screens/app_shell.dart';
import '../screens/admin_screen.dart';
+import '../main.dart' show themeNotifier, parseThemeMode;
import '../widgets/absorb_page_header.dart';
import '../widgets/absorb_slider.dart';
@@ -40,6 +41,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool _hideEbookOnly = false;
bool _showGoodreadsButton = false;
bool _loggingEnabled = false;
+ String _themeMode = 'dark';
bool _loaded = false;
String _downloadLocationLabel = 'App Internal Storage (Default)';
int _totalDownloadSizeBytes = 0;
@@ -67,6 +69,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
final hideEbook = await PlayerSettings.getHideEbookOnly();
final showGoodreads = await PlayerSettings.getShowGoodreadsButton();
final logging = await PlayerSettings.getLoggingEnabled();
+ final theme = await PlayerSettings.getThemeMode();
final dlLabel = await DownloadService().downloadLocationLabel;
final dlSize = await DownloadService().totalDownloadSize;
@@ -87,6 +90,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_hideEbookOnly = hideEbook;
_showGoodreadsButton = showGoodreads;
_loggingEnabled = logging;
+ _themeMode = theme;
_downloadLocationLabel = dlLabel;
_totalDownloadSizeBytes = dlSize;
_autoSleepSettings = autoSleep;
@@ -243,8 +247,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
stops: const [0.0, 0.35, 1.0],
colors: [
cs.primary.withValues(alpha: 0.10),
- const Color(0xFF121212),
- const Color(0xFF0E0E0E),
+ Theme.of(context).scaffoldBackgroundColor,
+ Theme.of(context).scaffoldBackgroundColor,
],
),
),
@@ -382,6 +386,45 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 20),
+ // ── Appearance ──
+ _CollapsibleSection(
+ icon: Icons.palette_outlined,
+ title: 'Appearance',
+ cs: cs,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Theme', style: tt.titleSmall),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ segments: const [
+ ButtonSegment(value: 'dark', icon: Icon(Icons.dark_mode_rounded), label: Text('Dark')),
+ ButtonSegment(value: 'light', icon: Icon(Icons.light_mode_rounded), label: Text('Light')),
+ ButtonSegment(value: 'system', icon: Icon(Icons.brightness_auto_rounded), label: Text('System')),
+ ],
+ selected: {_themeMode},
+ onSelectionChanged: _loaded ? (selected) {
+ final mode = selected.first;
+ setState(() => _themeMode = mode);
+ PlayerSettings.setThemeMode(mode);
+ themeNotifier.value = parseThemeMode(mode);
+ } : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 16),
// ── Playback ──
_CollapsibleSection(
@@ -896,7 +939,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: const Text('Notifications'),
subtitle: Text('For download progress and playback controls',
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: const Icon(Icons.chevron_right_rounded, color: Colors.white38),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
onTap: () async {
final status = await Permission.notification.status;
if (status.isGranted) {
@@ -920,7 +963,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: const Text('Unrestricted battery'),
subtitle: Text('Prevents Android from killing background playback',
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: const Icon(Icons.chevron_right_rounded, color: Colors.white38),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
onTap: () async {
if (Platform.isAndroid) {
final status = await Permission.ignoreBatteryOptimizations.status;
diff --git a/lib/screens/stats_screen.dart b/lib/screens/stats_screen.dart
index 27772311..c72fc6e4 100644
--- a/lib/screens/stats_screen.dart
+++ b/lib/screens/stats_screen.dart
@@ -74,7 +74,7 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
final tt = Theme.of(context).textTheme;
return Scaffold(
- backgroundColor: Colors.black,
+ backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@@ -84,14 +84,14 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
colors: [
cs.primary.withValues(alpha: 0.12),
cs.primary.withValues(alpha: 0.04),
- Colors.black,
- Colors.black,
+ Theme.of(context).scaffoldBackgroundColor,
+ Theme.of(context).scaffoldBackgroundColor,
],
),
),
child: SafeArea(
child: _isLoading
- ? const Center(child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white24))
+ ? Center(child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurface.withValues(alpha: 0.24)))
: _stats == null
? _errorState(tt)
: RefreshIndicator(
@@ -100,7 +100,7 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
await _loadStats();
},
color: cs.primary,
- backgroundColor: const Color(0xFF1A1A1A),
+ backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
child: AnimatedBuilder(
animation: _animValue,
builder: (_, __) => _buildContent(cs, tt),
@@ -112,10 +112,11 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
}
Widget _errorState(TextTheme tt) {
+ final cs = Theme.of(context).colorScheme;
return Center(child: Column(mainAxisSize: MainAxisSize.min, children: [
- Icon(Icons.signal_wifi_off_rounded, size: 48, color: Colors.white.withValues(alpha: 0.15)),
+ Icon(Icons.signal_wifi_off_rounded, size: 48, color: cs.onSurface.withValues(alpha: 0.15)),
const SizedBox(height: 12),
- Text('Couldn\'t load stats', style: tt.bodyMedium?.copyWith(color: Colors.white38)),
+ Text('Couldn\'t load stats', style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.38))),
const SizedBox(height: 8),
TextButton(onPressed: () { setState(() => _isLoading = true); _loadStats(); },
child: const Text('Retry')),
@@ -142,57 +143,55 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// Header
const AbsorbPageHeader(
title: 'Your Stats',
- brandingColor: Colors.white38,
- titleColor: Colors.white,
padding: EdgeInsets.only(top: 4),
),
const SizedBox(height: 24),
// ── Hero stat ──
- _heroStat(tt, totalSeconds),
+ _heroStat(tt, cs, totalSeconds),
const SizedBox(height: 24),
// ── Quick stats row ──
Row(children: [
- Expanded(child: _statCard(tt, Icons.local_fire_department_rounded, Colors.orange,
+ Expanded(child: _statCard(tt, cs, Icons.local_fire_department_rounded, Colors.orange,
'${streak}d', 'Current\nStreak')),
const SizedBox(width: 10),
- Expanded(child: _statCard(tt, Icons.emoji_events_rounded, Colors.amber,
+ Expanded(child: _statCard(tt, cs, Icons.emoji_events_rounded, Colors.amber,
'${longestStreak}d', 'Longest\nStreak')),
const SizedBox(width: 10),
- Expanded(child: _statCard(tt, Icons.check_circle_rounded, Colors.green,
+ Expanded(child: _statCard(tt, cs, Icons.check_circle_rounded, Colors.green,
'$booksFinished', 'Books\nFinished')),
]),
const SizedBox(height: 24),
// ── Time periods ──
Row(children: [
- Expanded(child: _periodCard(tt, 'Today', today)),
+ Expanded(child: _periodCard(tt, cs, 'Today', today)),
const SizedBox(width: 10),
- Expanded(child: _periodCard(tt, 'This Week', thisWeek)),
+ Expanded(child: _periodCard(tt, cs, 'This Week', thisWeek)),
const SizedBox(width: 10),
- Expanded(child: _periodCard(tt, 'This Month', thisMonth)),
+ Expanded(child: _periodCard(tt, cs, 'This Month', thisMonth)),
]),
const SizedBox(height: 28),
// ── Last 7 days chart ──
Text('Last 7 Days', style: tt.titleSmall?.copyWith(
- color: Colors.white60, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.6), fontWeight: FontWeight.w600)),
const SizedBox(height: 12),
_barChart(weekData, cs),
const SizedBox(height: 28),
// ── Last 30 days chart ──
Text('Last 30 Days', style: tt.titleSmall?.copyWith(
- color: Colors.white60, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.6), fontWeight: FontWeight.w600)),
const SizedBox(height: 12),
- _heatMap(monthData, tt),
+ _heatMap(monthData, tt, cs),
const SizedBox(height: 28),
// ── Recent Sessions ──
if (_sessions.isNotEmpty) ...[
Text('Recent Sessions', style: tt.titleSmall?.copyWith(
- color: Colors.white60, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.6), fontWeight: FontWeight.w600)),
const SizedBox(height: 12),
..._buildSessions(tt, cs),
],
@@ -202,7 +201,7 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// ─── HERO STAT ──────────────────────────────────────────────
- Widget _heroStat(TextTheme tt, double totalSeconds) {
+ Widget _heroStat(TextTheme tt, ColorScheme cs, double totalSeconds) {
final hours = (totalSeconds / 3600).floor();
final minutes = ((totalSeconds % 3600) / 60).floor();
final anim = _animValue.value;
@@ -214,32 +213,32 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
gradient: LinearGradient(
begin: Alignment.topLeft, end: Alignment.bottomRight,
colors: [
- Colors.white.withValues(alpha: 0.06),
- Colors.white.withValues(alpha: 0.02),
+ cs.onSurface.withValues(alpha: 0.06),
+ cs.onSurface.withValues(alpha: 0.02),
],
),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Column(children: [
Text('Total Listening Time', style: tt.labelMedium?.copyWith(
- color: Colors.white38, letterSpacing: 1.5, fontWeight: FontWeight.w500)),
+ color: cs.onSurface.withValues(alpha: 0.38), letterSpacing: 1.5, fontWeight: FontWeight.w500)),
const SizedBox(height: 12),
Row(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [
Text('${(hours * anim).round()}',
style: tt.displayLarge?.copyWith(
- fontWeight: FontWeight.w800, color: Colors.white, fontSize: 56, height: 1)),
+ fontWeight: FontWeight.w800, color: cs.onSurface, fontSize: 56, height: 1)),
Padding(padding: const EdgeInsets.only(bottom: 8),
- child: Text('h', style: tt.headlineSmall?.copyWith(color: Colors.white38, fontWeight: FontWeight.w300))),
+ child: Text('h', style: tt.headlineSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.38), fontWeight: FontWeight.w300))),
const SizedBox(width: 8),
Text('${(minutes * anim).round()}',
style: tt.displayLarge?.copyWith(
- fontWeight: FontWeight.w800, color: Colors.white, fontSize: 56, height: 1)),
+ fontWeight: FontWeight.w800, color: cs.onSurface, fontSize: 56, height: 1)),
Padding(padding: const EdgeInsets.only(bottom: 8),
- child: Text('m', style: tt.headlineSmall?.copyWith(color: Colors.white38, fontWeight: FontWeight.w300))),
+ child: Text('m', style: tt.headlineSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.38), fontWeight: FontWeight.w300))),
]),
const SizedBox(height: 8),
Text(_daysEquivalent(totalSeconds),
- style: tt.bodySmall?.copyWith(color: Colors.white24)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.24))),
]),
);
}
@@ -253,41 +252,41 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// ─── STAT CARD ──────────────────────────────────────────────
- Widget _statCard(TextTheme tt, IconData icon, Color color, String value, String label) {
+ Widget _statCard(TextTheme tt, ColorScheme cs, IconData icon, Color color, String value, String label) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.04),
+ color: cs.onSurface.withValues(alpha: 0.04),
borderRadius: BorderRadius.circular(16),
- border: Border.all(color: Colors.white.withValues(alpha: 0.06)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.06)),
),
child: Column(children: [
Icon(icon, color: color.withValues(alpha: 0.8), size: 22),
const SizedBox(height: 8),
Text(value, style: tt.headlineSmall?.copyWith(
- fontWeight: FontWeight.w800, color: Colors.white, height: 1)),
+ fontWeight: FontWeight.w800, color: cs.onSurface, height: 1)),
const SizedBox(height: 4),
Text(label, textAlign: TextAlign.center, style: tt.labelSmall?.copyWith(
- color: Colors.white30, fontSize: 10, height: 1.2)),
+ color: cs.onSurface.withValues(alpha: 0.3), fontSize: 10, height: 1.2)),
]),
);
}
// ─── PERIOD CARD ────────────────────────────────────────────
- Widget _periodCard(TextTheme tt, String label, double seconds) {
+ Widget _periodCard(TextTheme tt, ColorScheme cs, String label, double seconds) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 10),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.04),
+ color: cs.onSurface.withValues(alpha: 0.04),
borderRadius: BorderRadius.circular(16),
- border: Border.all(color: Colors.white.withValues(alpha: 0.06)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.06)),
),
child: Column(children: [
Text(_formatDuration(seconds), style: tt.titleMedium?.copyWith(
- fontWeight: FontWeight.w700, color: Colors.white, height: 1)),
+ fontWeight: FontWeight.w700, color: cs.onSurface, height: 1)),
const SizedBox(height: 4),
- Text(label, style: tt.labelSmall?.copyWith(color: Colors.white30, fontSize: 10)),
+ Text(label, style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 10)),
]),
);
}
@@ -303,9 +302,9 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
height: 140,
padding: const EdgeInsets.fromLTRB(0, 8, 0, 0),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.03),
+ color: cs.onSurface.withValues(alpha: 0.03),
borderRadius: BorderRadius.circular(16),
- border: Border.all(color: Colors.white.withValues(alpha: 0.05)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.05)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
@@ -318,19 +317,19 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
if (d.seconds > 0)
Padding(padding: const EdgeInsets.only(bottom: 4),
child: Text(_shortDuration(d.seconds), style: TextStyle(
- color: Colors.white30, fontSize: 9, fontWeight: FontWeight.w500))),
+ color: cs.onSurface.withValues(alpha: 0.3), fontSize: 9, fontWeight: FontWeight.w500))),
AnimatedContainer(
duration: const Duration(milliseconds: 600),
curve: Curves.easeOutCubic,
height: (ratio * 80).clamp(2.0, 80.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
- color: isToday ? Colors.white.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.15),
+ color: isToday ? cs.onSurface.withValues(alpha: 0.5) : cs.onSurface.withValues(alpha: 0.15),
),
),
const SizedBox(height: 6),
Text(d.label, style: TextStyle(
- color: isToday ? Colors.white60 : Colors.white.withValues(alpha: 0.2),
+ color: isToday ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.2),
fontSize: 10, fontWeight: isToday ? FontWeight.w600 : FontWeight.w400)),
const SizedBox(height: 8),
]),
@@ -342,7 +341,7 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// ─── HEAT MAP (30 days) ─────────────────────────────────────
- Widget _heatMap(List<_DayData> data, TextTheme tt) {
+ Widget _heatMap(List<_DayData> data, TextTheme tt, ColorScheme cs) {
final maxVal = data.map((d) => d.seconds).fold(0.0, (a, b) => a > b ? a : b);
return Wrap(
@@ -356,8 +355,8 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: intensity > 0
- ? Colors.white.withValues(alpha: 0.08 + intensity * 0.4)
- : Colors.white.withValues(alpha: 0.03),
+ ? cs.onSurface.withValues(alpha: 0.08 + intensity * 0.4)
+ : cs.onSurface.withValues(alpha: 0.03),
),
),
);
@@ -391,16 +390,16 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// Pick an icon based on client name
final isAbsorb = clientName.toLowerCase().contains('absorb');
final icon = _clientIcon(clientName);
- final iconColor = _clientColor(clientName);
+ final iconColor = _clientColor(clientName, cs);
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.04),
+ color: cs.onSurface.withValues(alpha: 0.04),
borderRadius: BorderRadius.circular(12),
- border: Border.all(color: Colors.white.withValues(alpha: 0.06)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.06)),
),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
// App icon
@@ -420,10 +419,10 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// Title + author + app
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(title, maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.bodySmall?.copyWith(color: Colors.white70, fontWeight: FontWeight.w600)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.7), fontWeight: FontWeight.w600)),
if (author.isNotEmpty)
Text(author, maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.labelSmall?.copyWith(color: Colors.white30, fontSize: 10)),
+ style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 10)),
const SizedBox(height: 4),
Row(children: [
isAbsorb
@@ -433,7 +432,7 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
Flexible(child: Text(
deviceStr.isNotEmpty ? '$appLabel · $deviceStr' : appLabel,
maxLines: 1, overflow: TextOverflow.ellipsis,
- style: TextStyle(color: Colors.white.withValues(alpha: 0.2), fontSize: 9),
+ style: TextStyle(color: cs.onSurface.withValues(alpha: 0.2), fontSize: 9),
)),
]),
])),
@@ -441,10 +440,10 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
// Duration + time
Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Text(_formatDuration(duration),
- style: tt.labelSmall?.copyWith(color: Colors.white38, fontWeight: FontWeight.w600)),
+ style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.38), fontWeight: FontWeight.w600)),
if (updatedAt != null)
Text(_relativeDate(updatedAt),
- style: tt.labelSmall?.copyWith(color: Colors.white.withValues(alpha: 0.2), fontSize: 9)),
+ style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.2), fontSize: 9)),
]),
]),
),
@@ -463,14 +462,14 @@ class _StatsScreenState extends State<StatsScreen> with SingleTickerProviderStat
return Icons.devices_rounded;
}
- Color _clientColor(String clientName) {
+ Color _clientColor(String clientName, ColorScheme cs) {
final lower = clientName.toLowerCase();
if (lower.contains('absorb')) return Colors.tealAccent;
if (lower.contains('audiobookshelf') || lower.contains('abs')) return Colors.deepPurple;
if (lower.contains('web') || lower.contains('browser')) return Colors.blue;
if (lower.contains('ios') || lower.contains('apple')) return Colors.grey;
if (lower.contains('android')) return Colors.green;
- return Colors.white54;
+ return cs.onSurfaceVariant;
}
// ─── HELPERS ────────────────────────────────────────────────
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 6ed992b6..bd416b8d 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -126,6 +126,11 @@ class PlayerSettings {
static Future<bool> getLoggingEnabled() => _get('loggingEnabled', false);
static Future<void> setLoggingEnabled(bool value) => _set('loggingEnabled', value);
+ // ── Appearance ──
+
+ static Future<String> getThemeMode() => _get('themeMode', 'dark');
+ static Future<void> setThemeMode(String value) => _set('themeMode', value);
+
/// Check if an item has no audio content.
/// For minified responses (library list), duration == 0 means no audio files.
/// For full responses (detail sheet), we also check ebookFile + audioFiles.
diff --git a/lib/widgets/absorb_slider.dart b/lib/widgets/absorb_slider.dart
index 485e7661..552f1510 100644
--- a/lib/widgets/absorb_slider.dart
+++ b/lib/widgets/absorb_slider.dart
@@ -175,7 +175,7 @@ class _AbsorbTrackShape extends SliderTrackShape {
canvas.drawCircle(
Offset(trackRect.left + dotRadius + 2, centerY),
dotRadius,
- Paint()..color = Colors.white.withValues(alpha: 0.7),
+ Paint()..color = const Color(0xB3FFFFFF),
);
// Right dot
@@ -273,7 +273,7 @@ class AbsorbProgressPainter extends CustomPainter {
canvas.drawCircle(
Offset(trackLeft + 5, centerY),
3,
- Paint()..color = Colors.white.withValues(alpha: 0.7),
+ Paint()..color = const Color(0xB3FFFFFF),
);
canvas.drawCircle(
Offset(trackRight - 5, centerY),
@@ -433,7 +433,7 @@ class _AbsorbRangeTrackShape extends RangeSliderTrackShape {
final centerY = trackRect.center.dy;
canvas.drawCircle(
Offset(trackRect.left + 5, centerY), 3,
- Paint()..color = Colors.white.withValues(alpha: 0.7),
+ Paint()..color = const Color(0xB3FFFFFF),
);
canvas.drawCircle(
Offset(trackRect.right - 5, centerY), 3,
diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dart
index dfad1ea9..5e7d4f87 100644
--- a/lib/widgets/absorbing_card.dart
+++ b/lib/widgets/absorbing_card.dart
@@ -169,7 +169,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
void _onCoverLoaded(ImageProvider provider) {
if (_coverScheme != null) return;
- ColorScheme.fromImageProvider(provider: provider, brightness: Brightness.dark)
+ ColorScheme.fromImageProvider(provider: provider, brightness: Theme.of(context).brightness)
.then((s) {
if (mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -236,6 +236,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
final cs = _coverScheme ?? Theme.of(context).colorScheme;
final accent = cs.primary;
final bgDark = cs.surface;
+ final isDark = Theme.of(context).brightness == Brightness.dark;
final lib = context.watch<LibraryProvider>();
final mediaHeaders = lib.mediaHeaders;
@@ -300,7 +301,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
return Opacity(
opacity: 0.3,
child: Image.file(File(_coverUrl!), fit: BoxFit.cover,
- errorBuilder: (_, __, ___) => Container(color: Colors.black)),
+ errorBuilder: (_, __, ___) => Container(color: isDark ? Colors.black : Colors.white)),
);
})
: CachedNetworkImage(
@@ -314,8 +315,8 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
child: Image(image: provider, fit: BoxFit.cover),
);
},
- placeholder: (_, __) => Container(color: Colors.black),
- errorWidget: (_, __, ___) => Container(color: Colors.black),
+ placeholder: (_, __) => Container(color: isDark ? Colors.black : Colors.white),
+ errorWidget: (_, __, ___) => Container(color: isDark ? Colors.black : Colors.white),
),
),
// Layer 2: Scrim
@@ -325,11 +326,17 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
- colors: [
- Colors.black.withValues(alpha: 0.3),
- Colors.black.withValues(alpha: 0.6),
- Colors.black.withValues(alpha: 0.85),
- ],
+ 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),
+ ],
),
),
),
@@ -345,16 +352,16 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
children: [
Text('${(bookProgress * 100).clamp(0, 100).toStringAsFixed(1)}%',
style: tt.labelMedium?.copyWith(
- color: Colors.white.withValues(alpha: 0.95),
+ color: isDark ? Colors.white.withValues(alpha: 0.95) : Colors.black.withValues(alpha: 0.85),
fontWeight: FontWeight.w800, fontSize: 15,
- shadows: [Shadow(color: Colors.black.withValues(alpha: 0.6), blurRadius: 4)],
+ shadows: [Shadow(color: isDark ? Colors.black.withValues(alpha: 0.6) : Colors.white.withValues(alpha: 0.6), blurRadius: 4)],
)),
if (totalChapters > 0 && !_isPodcastEpisode)
Text('Ch ${(chapterIdx + 1).clamp(1, totalChapters)} / $totalChapters',
style: tt.labelMedium?.copyWith(
- color: Colors.white.withValues(alpha: 0.85),
+ color: isDark ? Colors.white.withValues(alpha: 0.85) : Colors.black.withValues(alpha: 0.75),
fontWeight: FontWeight.w700, fontSize: 14,
- shadows: [Shadow(color: Colors.black.withValues(alpha: 0.6), blurRadius: 4)],
+ shadows: [Shadow(color: isDark ? Colors.black.withValues(alpha: 0.6) : Colors.white.withValues(alpha: 0.6), blurRadius: 4)],
)),
],
),
@@ -387,7 +394,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
boxShadow: [
- BoxShadow(color: Colors.black.withValues(alpha: 0.5), blurRadius: 20, spreadRadius: -2, offset: const Offset(0, 6)),
+ BoxShadow(color: Colors.black.withValues(alpha: isDark ? 0.5 : 0.15), blurRadius: 20, spreadRadius: -2, offset: const Offset(0, 6)),
BoxShadow(color: accent.withValues(alpha: 0.15), blurRadius: 30, spreadRadius: -5),
],
),
@@ -472,7 +479,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- Icon(Icons.check_circle_rounded, size: 32, color: Colors.green.shade400),
+ Icon(Icons.check_circle_rounded, size: 32, color: isDark ? Colors.green.shade400 : Colors.green.shade700),
const SizedBox(height: 6),
const Text('Finished',
style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w700)),
@@ -589,15 +596,15 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.08),
+ color: cs.onSurface.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- Icon(Icons.more_horiz_rounded, size: 18, color: Colors.white54),
+ Icon(Icons.more_horiz_rounded, size: 18, color: cs.onSurface.withValues(alpha: 0.54)),
const SizedBox(width: 4),
- Text('More', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white54)),
+ Text('More', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: cs.onSurface.withValues(alpha: 0.54))),
],
),
),
@@ -659,10 +666,13 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
return '${m.toString().padLeft(2, '0')}:${sec.toString().padLeft(2, '0')}';
}
- Widget _coverPlaceholder() => Container(
- color: Colors.white.withValues(alpha: 0.05),
- child: Center(child: Icon(Icons.headphones_rounded, size: 48, color: Colors.white.withValues(alpha: 0.15))),
- );
+ Widget _coverPlaceholder() {
+ final cs2 = Theme.of(context).colorScheme;
+ return Container(
+ color: cs2.onSurface.withValues(alpha: 0.05),
+ child: Center(child: Icon(Icons.headphones_rounded, size: 48, color: cs2.onSurface.withValues(alpha: 0.15))),
+ );
+ }
Future<void> _startPlayback() async {
if (_isStarting) return;
@@ -729,14 +739,14 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
expand: false, initialChildSize: 0.6, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: accent.withValues(alpha: 0.2), width: 1)),
),
child: Column(children: [
Padding(padding: const EdgeInsets.symmetric(vertical: 12),
- child: Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
- Text('Chapters', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ child: Container(width: 40, height: 4, decoration: BoxDecoration(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Text('Chapters', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
Expanded(child: ListView.builder(
controller: sc, itemCount: chapters.length,
@@ -753,14 +763,14 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
dense: true, selected: isCurrent,
selectedTileColor: accent.withValues(alpha: 0.1),
leading: SizedBox(width: 28, child: Text('${i + 1}', textAlign: TextAlign.center,
- style: tt.labelMedium?.copyWith(fontWeight: isCurrent ? FontWeight.w700 : FontWeight.w400, color: isCurrent ? accent : Colors.white38))),
+ style: tt.labelMedium?.copyWith(fontWeight: isCurrent ? FontWeight.w700 : FontWeight.w400, color: isCurrent ? accent : Theme.of(context).colorScheme.onSurfaceVariant))),
title: Text(chTitle, maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.bodyMedium?.copyWith(fontWeight: isCurrent ? FontWeight.w600 : FontWeight.w400, color: isCurrent ? Colors.white : Colors.white70)),
+ style: tt.bodyMedium?.copyWith(fontWeight: isCurrent ? FontWeight.w600 : FontWeight.w400, color: isCurrent ? Theme.of(context).colorScheme.onSurface : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7))),
trailing: Row(mainAxisSize: MainAxisSize.min, children: [
Text('$pct%', style: tt.labelSmall?.copyWith(
- color: isCurrent ? accent.withValues(alpha: 0.7) : Colors.white24, fontSize: 10, fontWeight: FontWeight.w600)),
+ color: isCurrent ? accent.withValues(alpha: 0.7) : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.24), fontSize: 10, fontWeight: FontWeight.w600)),
const SizedBox(width: 8),
- Text(_fmtDur(end - start), style: tt.labelSmall?.copyWith(color: Colors.white38)),
+ Text(_fmtDur(end - start), style: tt.labelSmall?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant)),
]),
onTap: _isActive ? () {
widget.player.seekTo(Duration(seconds: start.round()));
@@ -783,21 +793,21 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
expand: false, initialChildSize: 0.6, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: accent.withValues(alpha: 0.2), width: 1)),
),
child: Column(children: [
Padding(padding: const EdgeInsets.symmetric(vertical: 12),
- child: Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
+ child: Container(width: 40, height: 4, decoration: BoxDecoration(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(children: [
const Spacer(),
- Text('Playback History', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Playback History', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
const Spacer(),
IconButton(
- icon: const Icon(Icons.delete_outline_rounded, size: 20, color: Colors.white38),
+ icon: Icon(Icons.delete_outline_rounded, size: 20, color: Theme.of(context).colorScheme.onSurfaceVariant),
onPressed: () async {
await PlaybackHistoryService().clearHistory(_itemId);
Navigator.pop(ctx);
@@ -812,7 +822,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
builder: (ctx, snap) {
if (!snap.hasData) return const Center(child: CircularProgressIndicator(strokeWidth: 2));
final events = snap.data!;
- if (events.isEmpty) return Center(child: Text('No history yet', style: tt.bodyMedium?.copyWith(color: Colors.white38)));
+ if (events.isEmpty) return Center(child: Text('No history yet', style: tt.bodyMedium?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant)));
return ListView.builder(
controller: sc, itemCount: events.length,
itemBuilder: (_, i) {
@@ -822,9 +832,9 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
return ListTile(
dense: true,
leading: Icon(_historyIcon(e.type), size: 18, color: accent.withValues(alpha: 0.7)),
- title: Text(e.label, style: tt.bodySmall?.copyWith(color: Colors.white70)),
- subtitle: Text('at $posLabel', style: tt.labelSmall?.copyWith(color: Colors.white38)),
- trailing: Text(timeAgo, style: tt.labelSmall?.copyWith(color: Colors.white30)),
+ title: Text(e.label, style: tt.bodySmall?.copyWith(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7))),
+ subtitle: Text('at $posLabel', style: tt.labelSmall?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant)),
+ trailing: Text(timeAgo, style: tt.labelSmall?.copyWith(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.3))),
onTap: _isActive ? () {
widget.player.seekTo(Duration(seconds: e.positionSeconds.round()));
Navigator.pop(ctx);
@@ -847,7 +857,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
backgroundColor: Colors.transparent,
builder: (ctx) => Container(
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: accent.withValues(alpha: 0.2), width: 1)),
),
@@ -858,7 +868,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
mainAxisSize: MainAxisSize.min,
children: [
// Drag handle
- Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2))),
+ Container(width: 40, height: 4, decoration: BoxDecoration(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2))),
const SizedBox(height: 16),
// Details option
MoreMenuItem(
@@ -912,7 +922,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
if (cast.isCasting && cast.castingItemId == _itemId) {
showModalBottomSheet(
context: context,
- backgroundColor: const Color(0xFF1A1A1A),
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
diff --git a/lib/widgets/absorbing_shared.dart b/lib/widgets/absorbing_shared.dart
index c1b73f12..1a96817c 100644
--- a/lib/widgets/absorbing_shared.dart
+++ b/lib/widgets/absorbing_shared.dart
@@ -28,13 +28,15 @@ class _DownloadWideButtonState extends State<DownloadWideButton> {
final downloaded = _dl.isDownloaded(widget.itemId);
final progress = _dl.downloadProgress(widget.itemId);
+ final isDark = Theme.of(context).brightness == Brightness.dark;
+ final dlGreen = isDark ? Colors.greenAccent.withValues(alpha: 0.7) : Colors.green.shade700;
final IconData icon;
final String label;
final Color color;
if (downloaded) {
icon = Icons.download_done_rounded;
label = 'Saved';
- color = Colors.greenAccent.withValues(alpha: 0.7);
+ color = dlGreen;
} else if (downloading) {
icon = Icons.downloading_rounded;
label = '${(progress * 100).toStringAsFixed(0)}%';
@@ -42,7 +44,7 @@ class _DownloadWideButtonState extends State<DownloadWideButton> {
} else {
icon = Icons.download_outlined;
label = 'Download';
- color = Colors.white54;
+ color = Theme.of(context).colorScheme.onSurfaceVariant;
}
return GestureDetector(
@@ -51,9 +53,9 @@ class _DownloadWideButtonState extends State<DownloadWideButton> {
height: 36,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
- color: downloaded ? Colors.greenAccent.withValues(alpha: 0.06) : Colors.white.withValues(alpha: 0.06),
+ color: downloaded ? dlGreen.withValues(alpha: 0.06) : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: downloaded ? Colors.greenAccent.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: downloaded ? dlGreen.withValues(alpha: 0.15) : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.08)),
),
child: Stack(children: [
if (downloading)
@@ -85,9 +87,8 @@ class _DownloadWideButtonState extends State<DownloadWideButton> {
if (api == null) return;
if (_dl.isDownloaded(widget.itemId)) {
showDialog(context: context, builder: (ctx) => AlertDialog(
- backgroundColor: const Color(0xFF2A2A2A),
- title: const Text('Remove download?', style: TextStyle(color: Colors.white)),
- content: const Text('This will be removed from your device.', style: TextStyle(color: Colors.white70)),
+ title: const Text('Remove download?'),
+ content: const Text('This will be removed from your device.'),
actions: [
TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Cancel')),
TextButton(onPressed: () { _dl.deleteDownload(widget.itemId); Navigator.pop(ctx); },
diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dart
index 6681918e..36cc57ad 100644
--- a/lib/widgets/book_detail_sheet.dart
+++ b/lib/widgets/book_detail_sheet.dart
@@ -149,7 +149,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
final tt = Theme.of(context).textTheme;
return Container(
clipBehavior: Clip.antiAlias,
- decoration: const BoxDecoration(color: Color(0xFF111111), borderRadius: BorderRadius.vertical(top: Radius.circular(24))),
+ decoration: BoxDecoration(color: Theme.of(context).scaffoldBackgroundColor, borderRadius: const BorderRadius.vertical(top: Radius.circular(24))),
child: Stack(children: [
if (_coverUrl != null)
Positioned.fill(
@@ -167,12 +167,12 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
),
Positioned.fill(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(
begin: Alignment.topCenter, end: Alignment.bottomCenter,
- colors: [const Color(0xFF111111).withValues(alpha: 0.6), const Color(0xFF111111).withValues(alpha: 0.85), const Color(0xFF111111)],
+ colors: [Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.6), Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.85), Theme.of(context).scaffoldBackgroundColor],
)))),
_isLoading
- ? const Center(child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white24))
+ ? Center(child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurface.withValues(alpha: 0.24)))
: _item == null
- ? Center(child: Text('Failed to load', style: tt.bodyMedium?.copyWith(color: Colors.white38)))
+ ? Center(child: Text('Failed to load', style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)))
: AnimatedOpacity(
opacity: 1.0, duration: const Duration(milliseconds: 300),
child: _buildContent(context, cs, tt)),
@@ -207,12 +207,12 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
return ListView(controller: widget.scrollController, padding: EdgeInsets.fromLTRB(20, 8, 20, 32 + MediaQuery.of(context).viewPadding.bottom), children: [
Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
- decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
- Text(title, textAlign: TextAlign.center, style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: Colors.white)),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Text(title, textAlign: TextAlign.center, style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface)),
const SizedBox(height: 4),
- Text(authorName, textAlign: TextAlign.center, style: tt.bodyMedium?.copyWith(color: Colors.white60)),
+ Text(authorName, textAlign: TextAlign.center, style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.6))),
if (narrator.isNotEmpty) ...[const SizedBox(height: 2),
- Text('Narrated by $narrator', textAlign: TextAlign.center, style: tt.bodySmall?.copyWith(color: Colors.white38))],
+ Text('Narrated by $narrator', textAlign: TextAlign.center, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant))],
// ─── AUDIBLE RATING (space always reserved) ─────────
const SizedBox(height: 8),
SizedBox(
@@ -222,9 +222,9 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
..._buildStars((_rating!['rating'] as num).toDouble(), cs),
const SizedBox(width: 6),
Text((_rating!['rating'] as num).toStringAsFixed(1),
- style: tt.labelLarge?.copyWith(fontWeight: FontWeight.w600, color: Colors.white70)),
+ style: tt.labelLarge?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface.withValues(alpha: 0.7))),
const SizedBox(width: 4),
- Text('on Audible', style: tt.labelSmall?.copyWith(color: Colors.white38)),
+ Text('on Audible', style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
])
: null,
),
@@ -232,10 +232,10 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
if (progress > 0 && !isFinished) ...[
ClipRRect(borderRadius: BorderRadius.circular(3),
child: LinearProgressIndicator(value: progress.clamp(0.0, 1.0), minHeight: 4,
- backgroundColor: Colors.white.withValues(alpha: 0.1), valueColor: AlwaysStoppedAnimation(cs.primary))),
+ backgroundColor: cs.onSurface.withValues(alpha: 0.1), valueColor: AlwaysStoppedAnimation(cs.primary))),
const SizedBox(height: 4),
Text('${(progress * 100).toStringAsFixed(1)}% complete', textAlign: TextAlign.center,
- style: tt.labelSmall?.copyWith(color: Colors.white38)),
+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
const SizedBox(height: 12),
],
if (isEbookOnly)
@@ -271,21 +271,21 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
child: Container(
height: 36,
decoration: BoxDecoration(
- color: isFinished ? Colors.green.withValues(alpha: 0.06) : Colors.white.withValues(alpha: 0.06),
+ color: isFinished ? Colors.green.withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Icon(
isFinished ? Icons.check_circle_rounded : Icons.check_circle_outline_rounded,
size: 16,
- color: isFinished ? Colors.green : Colors.white54,
+ color: isFinished ? Colors.green : cs.onSurfaceVariant,
),
const SizedBox(width: 6),
Text(
isFinished ? 'Fully Absorbed' : 'Fully Absorb',
style: TextStyle(
- color: isFinished ? Colors.green : Colors.white54,
+ color: isFinished ? Colors.green : cs.onSurfaceVariant,
fontSize: 12, fontWeight: FontWeight.w500,
),
),
@@ -300,18 +300,18 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
child: Container(
height: 36,
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
_ebookLoading
- ? const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white54))
- : const Icon(Icons.menu_book_rounded, size: 16, color: Colors.white54),
+ ? SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurfaceVariant))
+ : Icon(Icons.menu_book_rounded, size: 16, color: cs.onSurfaceVariant),
const SizedBox(width: 6),
Text(
_ebookLoading ? 'Opening…' : 'Open ePub in Another App',
- style: const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w500),
+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w500),
),
]),
),
@@ -356,22 +356,22 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
));
})],
if (desc.isNotEmpty) ...[const SizedBox(height: 16),
- Text('About', style: tt.titleSmall?.copyWith(color: Colors.white54, fontWeight: FontWeight.w600)),
+ Text('About', style: tt.titleSmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
const SizedBox(height: 6),
- Text(desc, style: tt.bodySmall?.copyWith(color: Colors.white70, height: 1.5))],
+ Text(desc, style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.7), height: 1.5))],
if (chapters.isNotEmpty) ...[const SizedBox(height: 16),
GestureDetector(onTap: () => setState(() => _chaptersExpanded = !_chaptersExpanded),
child: Row(children: [
- Text('Chapters (${chapters.length})', style: tt.titleSmall?.copyWith(color: Colors.white54, fontWeight: FontWeight.w600)),
- const Spacer(), Icon(_chaptersExpanded ? Icons.expand_less : Icons.expand_more, color: Colors.white38, size: 20)])),
+ Text('Chapters (${chapters.length})', style: tt.titleSmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
+ const Spacer(), Icon(_chaptersExpanded ? Icons.expand_less : Icons.expand_more, color: cs.onSurface.withValues(alpha: 0.3), size: 20)])),
if (_chaptersExpanded) ...[const SizedBox(height: 8),
...chapters.asMap().entries.map((e) {
final ch = e.value as Map<String, dynamic>;
return Padding(padding: const EdgeInsets.symmetric(vertical: 3),
child: Row(children: [
- SizedBox(width: 28, child: Text('${e.key + 1}', style: tt.labelSmall?.copyWith(color: Colors.white30))),
- Expanded(child: Text(ch['title'] as String? ?? 'Chapter ${e.key + 1}', maxLines: 1, overflow: TextOverflow.ellipsis, style: tt.bodySmall?.copyWith(color: Colors.white60))),
- Text(_fmtDur(((ch['end'] as num?)?.toDouble() ?? 0) - ((ch['start'] as num?)?.toDouble() ?? 0)), style: tt.labelSmall?.copyWith(color: Colors.white30)),
+ SizedBox(width: 28, child: Text('${e.key + 1}', style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.3)))),
+ Expanded(child: Text(ch['title'] as String? ?? 'Chapter ${e.key + 1}', maxLines: 1, overflow: TextOverflow.ellipsis, style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.6)))),
+ Text(_fmtDur(((ch['end'] as num?)?.toDouble() ?? 0) - ((ch['start'] as num?)?.toDouble() ?? 0)), style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.3))),
]));
})]],
// ─── Metadata lookup (bottom of sheet) ─────────────────
@@ -403,24 +403,26 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
}
Widget _sheetBtn({required IconData icon, required String label, required VoidCallback onTap}) {
+ final cs = Theme.of(context).colorScheme;
return GestureDetector(onTap: onTap, child: Container(height: 44,
- decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.white.withValues(alpha: 0.1))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.1))),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
- Icon(icon, size: 16, color: Colors.white54), const SizedBox(width: 6),
- Text(label, style: const TextStyle(color: Colors.white54, fontSize: 12, fontWeight: FontWeight.w500))])));
+ Icon(icon, size: 16, color: cs.onSurfaceVariant), const SizedBox(width: 6),
+ Text(label, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w500))])));
}
Widget _chip(IconData icon, String text) {
+ final cs = Theme.of(context).colorScheme;
return Container(
constraints: const BoxConstraints(maxWidth: 200),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
- decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08))),
child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(icon, size: 12, color: Colors.white38), const SizedBox(width: 4),
+ Icon(icon, size: 12, color: cs.onSurface.withValues(alpha: 0.3)), const SizedBox(width: 4),
Flexible(child: Text(text, overflow: TextOverflow.ellipsis, maxLines: 1,
- style: const TextStyle(color: Colors.white54, fontSize: 11)))]));
+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 11)))]));
}
String _fmtDur(double s) {
@@ -439,7 +441,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
} else if (i == fullStars && hasHalf) {
stars.add(Icon(Icons.star_half_rounded, size: 16, color: cs.primary));
} else {
- stars.add(Icon(Icons.star_outline_rounded, size: 16, color: Colors.white24));
+ stars.add(Icon(Icons.star_outline_rounded, size: 16, color: cs.onSurface.withValues(alpha: 0.24)));
}
}
return stars;
diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dart
index afae4e39..5b20bdc9 100644
--- a/lib/widgets/card_buttons.dart
+++ b/lib/widgets/card_buttons.dart
@@ -38,23 +38,24 @@ class CardWideButton extends StatelessWidget {
@override Widget build(BuildContext context) {
if (child != null) return child!;
+ final cs = Theme.of(context).colorScheme;
final enabled = isActive || alwaysEnabled;
return GestureDetector(
onTap: enabled ? onTap : () => showInactiveToast(context),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(12),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- Icon(icon, size: 15, color: enabled ? Colors.white54 : Colors.white24),
+ Icon(icon, size: 15, color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24)),
const SizedBox(width: 6),
Text(label, style: TextStyle(
- color: enabled ? Colors.white54 : Colors.white24,
+ color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24),
fontSize: 11, fontWeight: FontWeight.w500)),
],
),
@@ -79,23 +80,24 @@ class MoreMenuItem extends StatelessWidget {
});
@override Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
return GestureDetector(
onTap: enabled ? onTap : () => showInactiveToast(context),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 16),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(
children: [
- Icon(icon, size: 20, color: enabled ? accent.withValues(alpha: 0.7) : Colors.white24),
+ Icon(icon, size: 20, color: enabled ? accent.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24)),
const SizedBox(width: 14),
Expanded(child: Text(label, style: TextStyle(
- color: enabled ? Colors.white.withValues(alpha: 0.8) : Colors.white24,
+ color: enabled ? cs.onSurface.withValues(alpha: 0.8) : cs.onSurface.withValues(alpha: 0.24),
fontSize: 14, fontWeight: FontWeight.w500))),
- Icon(Icons.chevron_right_rounded, size: 18, color: enabled ? Colors.white24 : Colors.white12),
+ Icon(Icons.chevron_right_rounded, size: 18, color: enabled ? cs.onSurface.withValues(alpha: 0.24) : cs.onSurface.withValues(alpha: 0.12)),
],
),
),
@@ -113,6 +115,7 @@ class CardSleepButtonInline extends StatelessWidget {
return ListenableBuilder(
listenable: SleepTimerService(),
builder: (_, __) {
+ final cs = Theme.of(context).colorScheme;
final sleep = SleepTimerService();
// Only show timer state on the card that's actually playing
final active = isActive && sleep.isActive;
@@ -138,9 +141,9 @@ class CardSleepButtonInline extends StatelessWidget {
height: 36,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
- color: active ? accent.withValues(alpha: 0.1) : Colors.white.withValues(alpha: 0.06),
+ color: active ? accent.withValues(alpha: 0.1) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: active ? accent.withValues(alpha: 0.3) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: active ? accent.withValues(alpha: 0.3) : cs.onSurface.withValues(alpha: 0.08)),
),
child: Stack(children: [
if (active && isTime)
@@ -157,10 +160,10 @@ class CardSleepButtonInline extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.bedtime_outlined, size: 16,
- color: active ? accent : (isActive ? Colors.white54 : Colors.white24)),
+ color: active ? accent : (isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24))),
const SizedBox(width: 8),
Text(label, style: TextStyle(
- color: active ? accent : (isActive ? Colors.white54 : Colors.white24),
+ color: active ? accent : (isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24)),
fontSize: active && isTime ? 13 : 12,
fontWeight: active ? FontWeight.w700 : FontWeight.w500,
fontFeatures: active && isTime ? const [FontFeature.tabularFigures()] : null,
@@ -194,24 +197,25 @@ class _CardBookmarkButtonInlineState extends State<CardBookmarkButtonInline> {
}
@override Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
return GestureDetector(
onTap: widget.isActive ? () => _showBookmarks(context) : () => showInactiveToast(context),
onLongPress: widget.isActive ? () => _quickAdd(context) : null,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(12),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.bookmark_outline_rounded, size: 18,
- color: widget.isActive ? Colors.white54 : Colors.white24),
+ color: widget.isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24)),
const SizedBox(width: 8),
Text(_count > 0 ? 'Bookmarks ($_count)' : 'Bookmark', style: TextStyle(
- color: widget.isActive ? Colors.white54 : Colors.white24,
+ color: widget.isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24),
fontSize: 12, fontWeight: FontWeight.w500)),
],
),
@@ -255,6 +259,7 @@ class CardSpeedButtonInline extends StatelessWidget {
const CardSpeedButtonInline({super.key, required this.player, required this.accent, required this.isActive});
@override Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
return GestureDetector(
onTap: isActive ? () {
showModalBottomSheet(context: context, backgroundColor: Colors.transparent,
@@ -264,18 +269,18 @@ class CardSpeedButtonInline extends StatelessWidget {
child: Container(
height: 36,
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.speed_rounded, size: 16,
- color: isActive ? accent : Colors.white24),
+ color: isActive ? accent : cs.onSurface.withValues(alpha: 0.24)),
const SizedBox(width: 8),
Text('${player.speed.toStringAsFixed(2)}x', style: TextStyle(
- color: isActive ? accent : Colors.white24,
+ color: isActive ? accent : cs.onSurface.withValues(alpha: 0.24),
fontSize: 13, fontWeight: FontWeight.w700)),
],
),
@@ -304,12 +309,12 @@ class _CardSpeedSheetState extends State<CardSpeedSheet> {
final navBarPad = MediaQuery.of(context).viewPadding.bottom;
return Container(
padding: EdgeInsets.fromLTRB(24, 16, 24, 24 + navBarPad),
- decoration: BoxDecoration(color: const Color(0xFF1A1A1A), borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
+ decoration: BoxDecoration(color: Theme.of(context).bottomSheetTheme.backgroundColor, borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: widget.accent.withValues(alpha: 0.2), width: 1))),
child: Column(mainAxisSize: MainAxisSize.min, children: [
- Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2))),
+ Container(width: 40, height: 4, decoration: BoxDecoration(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2))),
const SizedBox(height: 20),
- Text('Playback Speed', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Playback Speed', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
const SizedBox(height: 4),
Text('${_speed.toStringAsFixed(2)}x', style: tt.headlineMedium?.copyWith(fontWeight: FontWeight.w700, color: widget.accent)),
const SizedBox(height: 16),
@@ -318,18 +323,18 @@ class _CardSpeedSheetState extends State<CardSpeedSheet> {
return GestureDetector(onTap: () => _setSpeed(s), child: AnimatedContainer(
duration: const Duration(milliseconds: 150),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
- decoration: BoxDecoration(color: a ? widget.accent : Colors.white.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(20),
- border: Border.all(color: a ? widget.accent : Colors.white.withValues(alpha: 0.12))),
- child: Text('${s}x', style: TextStyle(color: a ? Colors.black : Colors.white70, fontSize: 13, fontWeight: a ? FontWeight.w700 : FontWeight.w500)),
+ decoration: BoxDecoration(color: a ? widget.accent : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: a ? widget.accent : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.12))),
+ child: Text('${s}x', style: TextStyle(color: a ? Theme.of(context).colorScheme.surface : Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7), fontSize: 13, fontWeight: a ? FontWeight.w700 : FontWeight.w500)),
));
}).toList()),
const SizedBox(height: 16),
AbsorbSlider(value: _speed, min: 0.5, max: 3.0, divisions: 50, activeColor: widget.accent, onChanged: _setSpeed),
Padding(padding: const EdgeInsets.symmetric(horizontal: 12), child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: const [
- Text('0.5x', style: TextStyle(color: Colors.white30, fontSize: 11)),
- Text('3.0x', style: TextStyle(color: Colors.white30, fontSize: 11)),
+ children: [
+ Text('0.5x', style: TextStyle(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.3), fontSize: 11)),
+ Text('3.0x', style: TextStyle(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.3), fontSize: 11)),
],
)),
]),
@@ -356,18 +361,19 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
@override Widget build(BuildContext context) {
final tt = Theme.of(context).textTheme;
+ final cs = Theme.of(context).colorScheme;
return Container(
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: widget.accent.withValues(alpha: 0.2), width: 1)),
),
child: Column(children: [
Padding(padding: const EdgeInsets.symmetric(vertical: 12),
- child: Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
+ child: Container(width: 40, height: 4, decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
Padding(padding: const EdgeInsets.symmetric(horizontal: 20), child: Row(children: [
const Spacer(),
- Text('Bookmarks', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Bookmarks', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
const Spacer(),
GestureDetector(onTap: () => _addBookmark(), child: Container(
width: 36, height: 36,
@@ -380,11 +386,11 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
? const Center(child: CircularProgressIndicator(strokeWidth: 2))
: _bookmarks!.isEmpty
? Center(child: Column(mainAxisSize: MainAxisSize.min, children: [
- Icon(Icons.bookmark_outline_rounded, size: 48, color: Colors.white.withValues(alpha: 0.1)),
+ Icon(Icons.bookmark_outline_rounded, size: 48, color: cs.onSurface.withValues(alpha: 0.1)),
const SizedBox(height: 12),
- Text('No bookmarks yet', style: tt.bodyMedium?.copyWith(color: Colors.white38)),
+ Text('No bookmarks yet', style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
const SizedBox(height: 4),
- Text('Long-press the bookmark button to quick save', style: tt.bodySmall?.copyWith(color: Colors.white24, fontSize: 11)),
+ Text('Long-press the bookmark button to quick save', style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.24), fontSize: 11)),
]))
: ListView.builder(
controller: widget.scrollController, padding: const EdgeInsets.only(bottom: 24), itemCount: _bookmarks!.length,
@@ -404,20 +410,20 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
const SizedBox(width: 12),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(bm.title, maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.bodyMedium?.copyWith(color: Colors.white70)),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.7))),
const SizedBox(height: 2),
- Text(bm.formattedPosition, style: tt.labelSmall?.copyWith(color: Colors.white38)),
+ Text(bm.formattedPosition, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
if (hasNote) ...[
const SizedBox(height: 4),
Container(
width: double.infinity,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.04),
+ color: cs.onSurface.withValues(alpha: 0.04),
borderRadius: BorderRadius.circular(8),
),
child: Text(bm.note!, maxLines: 3, overflow: TextOverflow.ellipsis,
- style: tt.bodySmall?.copyWith(color: Colors.white38, fontSize: 11, height: 1.4)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11, height: 1.4)),
),
],
])),
@@ -427,9 +433,9 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
await BookmarkService().deleteBookmark(itemId: widget.itemId, bookmarkId: bm.id);
_load();
},
- child: const Padding(
- padding: EdgeInsets.all(4),
- child: Icon(Icons.close_rounded, size: 16, color: Colors.white24),
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Icon(Icons.close_rounded, size: 16, color: cs.onSurface.withValues(alpha: 0.24)),
),
),
]),
diff --git a/lib/widgets/card_playback_controls.dart b/lib/widgets/card_playback_controls.dart
index 9d195713..5381240a 100644
--- a/lib/widgets/card_playback_controls.dart
+++ b/lib/widgets/card_playback_controls.dart
@@ -48,28 +48,30 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
}
Widget _skipIcon(int seconds, bool isForward, {bool active = true}) {
+ final cs = Theme.of(context).colorScheme;
final hasBuiltIn = [5, 10, 30].contains(seconds);
if (hasBuiltIn) {
IconData icon;
if (isForward) { icon = seconds == 5 ? Icons.forward_5_rounded : seconds == 10 ? Icons.forward_10_rounded : Icons.forward_30_rounded; }
else { icon = seconds == 5 ? Icons.replay_5_rounded : seconds == 10 ? Icons.replay_10_rounded : Icons.replay_30_rounded; }
- return Icon(icon, size: 38, color: active ? Colors.white70 : Colors.white24);
+ return Icon(icon, size: 38, color: active ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24));
}
return Stack(alignment: Alignment.center, children: [
- Icon(isForward ? Icons.rotate_right_rounded : Icons.rotate_left_rounded, size: 38, color: active ? Colors.white70 : Colors.white24),
- Padding(padding: const EdgeInsets.only(top: 2), child: Text('$seconds', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w900, color: active ? Colors.white : Colors.white24))),
+ Icon(isForward ? Icons.rotate_right_rounded : Icons.rotate_left_rounded, size: 38, color: active ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24)),
+ Padding(padding: const EdgeInsets.only(top: 2), child: Text('$seconds', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w900, color: active ? cs.onSurface : cs.onSurface.withValues(alpha: 0.24)))),
]);
}
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
if (widget.isStarting) {
return SizedBox(height: 64,
child: Center(child: SizedBox(width: 64, height: 64,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
- color: Colors.white,
+ color: cs.onSurface,
boxShadow: [BoxShadow(color: widget.accent.withValues(alpha: 0.4), blurRadius: 25, spreadRadius: -5)],
),
child: Center(child: SizedBox(width: 28, height: 28, child: CircularProgressIndicator(strokeWidth: 2, color: widget.accent))),
@@ -98,6 +100,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
/// Controls that route to ChromecastService
Widget _buildCastControls(ChromecastService cast) {
+ final cs = Theme.of(context).colorScheme;
final isPlaying = cast.isPlaying;
if (isPlaying) {
@@ -112,7 +115,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
GestureDetector(
onTap: cast.skipToPreviousChapter,
child: SizedBox(width: 40, height: 40, child: Center(
- child: Icon(Icons.skip_previous_rounded, size: 24, color: Colors.white38),
+ child: Icon(Icons.skip_previous_rounded, size: 24, color: cs.onSurfaceVariant),
)),
),
const SizedBox(width: 4),
@@ -132,7 +135,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
width: 64, height: 64,
decoration: BoxDecoration(
shape: BoxShape.circle,
- color: Colors.white,
+ color: cs.onSurface,
boxShadow: [BoxShadow(color: widget.accent.withValues(alpha: 0.4), blurRadius: 25, spreadRadius: -5)],
),
child: Center(
@@ -140,7 +143,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
icon: AnimatedIcons.play_pause,
progress: _playPauseController,
size: 34,
- color: Colors.black87,
+ color: cs.surface,
),
),
),
@@ -162,7 +165,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
GestureDetector(
onTap: cast.skipToNextChapter,
child: SizedBox(width: 40, height: 40, child: Center(
- child: Icon(Icons.skip_next_rounded, size: 24, color: Colors.white38),
+ child: Icon(Icons.skip_next_rounded, size: 24, color: cs.onSurfaceVariant),
)),
),
],
@@ -171,6 +174,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
/// Original local player controls
Widget _buildLocalControls() {
+ final cs = Theme.of(context).colorScheme;
return StreamBuilder<PlayerState>(
stream: widget.isActive ? widget.player.playerStateStream : const Stream.empty(),
builder: (_, snapshot) {
@@ -189,7 +193,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
GestureDetector(
onTap: widget.isActive ? widget.player.skipToPreviousChapter : null,
child: SizedBox(width: 40, height: 40, child: Center(
- child: Icon(Icons.skip_previous_rounded, size: 24, color: widget.isActive ? Colors.white38 : Colors.white12),
+ child: Icon(Icons.skip_previous_rounded, size: 24, color: widget.isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12)),
)),
),
const SizedBox(width: 4),
@@ -209,7 +213,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
width: 64, height: 64,
decoration: BoxDecoration(
shape: BoxShape.circle,
- color: Colors.white,
+ color: cs.onSurface,
boxShadow: [BoxShadow(color: widget.accent.withValues(alpha: 0.4), blurRadius: 25, spreadRadius: -5)],
),
child: isLoading
@@ -219,7 +223,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
icon: AnimatedIcons.play_pause,
progress: _playPauseController,
size: 34,
- color: Colors.black87,
+ color: cs.surface,
),
),
),
@@ -236,7 +240,7 @@ class _CardPlaybackControlsState extends State<CardPlaybackControls> with Single
GestureDetector(
onTap: widget.isActive ? widget.player.skipToNextChapter : null,
child: SizedBox(width: 40, height: 40, child: Center(
- child: Icon(Icons.skip_next_rounded, size: 24, color: widget.isActive ? Colors.white38 : Colors.white12),
+ child: Icon(Icons.skip_next_rounded, size: 24, color: widget.isActive ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12)),
)),
),
],
diff --git a/lib/widgets/card_progress_bar.dart b/lib/widgets/card_progress_bar.dart
index 1fb5fcf3..a81bd489 100644
--- a/lib/widgets/card_progress_bar.dart
+++ b/lib/widgets/card_progress_bar.dart
@@ -136,6 +136,7 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with TickerPr
@override
Widget build(BuildContext context) {
final tt = Theme.of(context).textTheme;
+ final cs = Theme.of(context).colorScheme;
final player = widget.player;
final active = widget.isActive;
@@ -209,18 +210,18 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with TickerPr
Padding(padding: const EdgeInsets.only(top: 2, bottom: 6), child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : posS), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? Colors.white70 : Colors.white54, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Colors.black.withValues(alpha: 0.5), blurRadius: 3)])),
- Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? Colors.white70 : Colors.white54, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Colors.black.withValues(alpha: 0.5), blurRadius: 3)])),
+ Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : posS), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),
+ Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),
],
)),
] else ...[
Row(children: [
- Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : posS), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? Colors.white60 : Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : posS), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.38), fontSize: 11, fontWeight: FontWeight.w500)),
const SizedBox(width: 8),
Expanded(child: ClipRRect(borderRadius: BorderRadius.circular(4),
- child: LinearProgressIndicator(value: bookProgress, minHeight: 3, backgroundColor: Colors.white.withValues(alpha: 0.08), valueColor: AlwaysStoppedAnimation(widget.accent.withValues(alpha: 0.5))))),
+ child: LinearProgressIndicator(value: bookProgress, minHeight: 3, backgroundColor: cs.onSurface.withValues(alpha: 0.08), valueColor: AlwaysStoppedAnimation(widget.accent.withValues(alpha: 0.5))))),
const SizedBox(width: 8),
- Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? Colors.white60 : Colors.white38, fontSize: 11, fontWeight: FontWeight.w500)),
+ Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.38), fontSize: 11, fontWeight: FontWeight.w500)),
]),
const SizedBox(height: 10),
],
@@ -250,6 +251,7 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with TickerPr
wavePhase: 0,
isPlaying: isPlaying,
isDragging: isDragging,
+ backgroundColor: cs.surfaceContainerHighest,
),
child: Center(
child: Padding(
@@ -258,7 +260,7 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with TickerPr
? MarqueeText(
text: chName,
style: TextStyle(
- color: Colors.white.withValues(alpha: 0.9),
+ color: cs.onSurface.withValues(alpha: 0.9),
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: 0.2,
@@ -276,12 +278,12 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with TickerPr
children: [
Text(_fmt(_chapterDragValue != null ? (_chapterDragValue! * chapterDur) / speedDiv : chapterElapsed),
style: tt.labelSmall?.copyWith(
- color: _chapterDragValue != null ? widget.accent : Colors.white54,
+ color: _chapterDragValue != null ? widget.accent : cs.onSurface.withValues(alpha: 0.54),
fontSize: 11, fontWeight: FontWeight.w600,
fontFeatures: const [FontFeature.tabularFigures()])),
Text('-${_fmt(_chapterDragValue != null ? ((1.0 - _chapterDragValue!) * chapterDur) / speedDiv : chapterRemaining)}',
style: tt.labelSmall?.copyWith(
- color: _chapterDragValue != null ? widget.accent : Colors.white38,
+ color: _chapterDragValue != null ? widget.accent : cs.onSurface.withValues(alpha: 0.38),
fontSize: 11, fontWeight: FontWeight.w500,
fontFeatures: const [FontFeature.tabularFigures()])),
],
@@ -323,6 +325,7 @@ class ChapterPillPainter extends CustomPainter {
final double wavePhase;
final bool isPlaying;
final bool isDragging;
+ final Color backgroundColor;
ChapterPillPainter({
required this.progress,
@@ -330,6 +333,7 @@ class ChapterPillPainter extends CustomPainter {
required this.wavePhase,
required this.isPlaying,
required this.isDragging,
+ required this.backgroundColor,
});
@override
@@ -346,7 +350,7 @@ class ChapterPillPainter extends CustomPainter {
);
// Background
- canvas.drawRRect(pillRect, Paint()..color = const Color(0xFF1A1A1A));
+ canvas.drawRRect(pillRect, Paint()..color = backgroundColor);
// Border
canvas.drawRRect(
@@ -428,7 +432,8 @@ class ChapterPillPainter extends CustomPainter {
@override
bool shouldRepaint(covariant ChapterPillPainter old) =>
old.progress != progress ||
- old.isDragging != isDragging;
+ old.isDragging != isDragging ||
+ old.backgroundColor != backgroundColor;
}
// ─── MARQUEE TEXT ────────────────────────────────────────────
diff --git a/lib/widgets/chromecast_button.dart b/lib/widgets/chromecast_button.dart
index 2539834c..12232d1f 100644
--- a/lib/widgets/chromecast_button.dart
+++ b/lib/widgets/chromecast_button.dart
@@ -21,19 +21,21 @@ void showCastDevicePicker(
final cast = ChromecastService();
showModalBottomSheet(
context: context,
- backgroundColor: const Color(0xFF1A1A1A),
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
- builder: (ctx) => SafeArea(
+ builder: (ctx) {
+ final cs = Theme.of(ctx).colorScheme;
+ return SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
- Container(width: 36, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2))),
+ Container(width: 36, height: 4, decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2))),
const SizedBox(height: 16),
- const Text('Cast to Device', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Cast to Device', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: cs.onSurface)),
const SizedBox(height: 16),
SizedBox(
height: 200,
@@ -42,13 +44,13 @@ void showCastDevicePicker(
builder: (_, snap) {
final devices = snap.data ?? [];
if (devices.isEmpty) {
- return const Center(
+ return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
- SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white38)),
- SizedBox(height: 12),
- Text('Searching for Cast devices...', style: TextStyle(color: Colors.white38, fontSize: 13)),
+ SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurfaceVariant)),
+ const SizedBox(height: 12),
+ Text('Searching for Cast devices...', style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13)),
],
),
);
@@ -59,9 +61,9 @@ void showCastDevicePicker(
itemBuilder: (_, i) {
final device = devices[i];
return ListTile(
- leading: const Icon(Icons.cast_rounded, color: Colors.white54),
- title: Text(device.friendlyName, style: const TextStyle(color: Colors.white)),
- subtitle: Text(device.modelName ?? '', style: const TextStyle(color: Colors.white38, fontSize: 12)),
+ leading: Icon(Icons.cast_rounded, color: cs.onSurfaceVariant),
+ title: Text(device.friendlyName, style: TextStyle(color: cs.onSurface)),
+ subtitle: Text(device.modelName ?? '', style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
onTap: () {
Navigator.pop(ctx);
cast.connectToDevice(device);
@@ -81,7 +83,8 @@ void showCastDevicePicker(
],
),
),
- ),
+ );
+ },
);
}
diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dart
index 9a2fae73..c344a735 100644
--- a/lib/widgets/episode_list_sheet.dart
+++ b/lib/widgets/episode_list_sheet.dart
@@ -210,15 +210,16 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
final tt = Theme.of(context).textTheme;
final lib = context.watch<LibraryProvider>();
final coverUrl = _coverUrl;
return Container(
clipBehavior: Clip.antiAlias,
- decoration: const BoxDecoration(
- color: Color(0xFF111111),
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ decoration: BoxDecoration(
+ color: Theme.of(context).scaffoldBackgroundColor,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Stack(children: [
// Blurred cover background
@@ -240,16 +241,16 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
Positioned.fill(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(
begin: Alignment.topCenter, end: Alignment.bottomCenter,
colors: [
- const Color(0xFF111111).withValues(alpha: 0.6),
- const Color(0xFF111111).withValues(alpha: 0.85),
- const Color(0xFF111111),
+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.6),
+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.85),
+ Theme.of(context).scaffoldBackgroundColor,
],
)))),
// Content
Column(children: [
// Drag handle
Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(top: 8, bottom: 4),
- decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
// ── Header (non-scrollable) ──
Padding(
@@ -257,11 +258,11 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
child: Column(children: [
// Show title (centered)
Text(_title, textAlign: TextAlign.center,
- style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: Colors.white)),
+ style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface)),
if (_author.isNotEmpty) ...[
const SizedBox(height: 4),
Text(_author, textAlign: TextAlign.center,
- style: tt.bodyMedium?.copyWith(color: Colors.white60)),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.6))),
],
// Description
@@ -273,7 +274,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
maxLines: _descriptionExpanded ? 100 : 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
- style: tt.bodySmall?.copyWith(color: Colors.white38, height: 1.4)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, height: 1.4)),
),
],
@@ -313,15 +314,15 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
return GestureDetector(
child: Container(height: 44,
decoration: BoxDecoration(
- color: Colors.greenAccent.withValues(alpha: 0.06),
+ color: (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.greenAccent.withValues(alpha: 0.15)),
+ border: Border.all(color: (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.15)),
),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
- Icon(Icons.download_done_rounded, size: 16, color: Colors.greenAccent.withValues(alpha: 0.7)),
+ Icon(Icons.download_done_rounded, size: 16, color: (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7)),
const SizedBox(width: 6),
Text('All Episodes Downloaded',
- style: TextStyle(color: Colors.greenAccent.withValues(alpha: 0.7), fontSize: 12, fontWeight: FontWeight.w500)),
+ style: TextStyle(color: (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7), fontSize: 12, fontWeight: FontWeight.w500)),
])),
);
}
@@ -331,9 +332,9 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
child: Container(height: 44,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: Colors.white.withValues(alpha: 0.1)),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.1)),
),
child: Stack(children: [
if (anyActive)
@@ -352,7 +353,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
child: CircularProgressIndicator(strokeWidth: 2,
color: Theme.of(context).colorScheme.primary))
else
- const Icon(Icons.download_rounded, size: 16, color: Colors.white54),
+ Icon(Icons.download_rounded, size: 16, color: cs.onSurfaceVariant),
const SizedBox(width: 6),
Text(
anyActive
@@ -361,7 +362,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
? 'Download Remaining (${_episodes.length - downloaded})'
: 'Download All Episodes',
style: TextStyle(
- color: anyActive ? Theme.of(context).colorScheme.primary : Colors.white54,
+ color: anyActive ? Theme.of(context).colorScheme.primary : cs.onSurfaceVariant,
fontSize: 12, fontWeight: FontWeight.w500)),
])),
]),
@@ -375,7 +376,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
const SizedBox(height: 16),
Align(
alignment: Alignment.centerLeft,
- child: Text('Episodes', style: tt.titleSmall?.copyWith(color: Colors.white54, fontWeight: FontWeight.w600)),
+ child: Text('Episodes', style: tt.titleSmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
),
const SizedBox(height: 4),
]),
@@ -384,15 +385,15 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
// ── Scrollable episode list ──
Expanded(
child: _isLoading
- ? const Center(child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white24))
+ ? Center(child: CircularProgressIndicator(strokeWidth: 2, color: cs.onSurface.withValues(alpha: 0.24)))
: _episodes.isEmpty
? Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
- Icon(Icons.podcasts_rounded, size: 48, color: Colors.white.withValues(alpha: 0.15)),
+ Icon(Icons.podcasts_rounded, size: 48, color: cs.onSurface.withValues(alpha: 0.15)),
const SizedBox(height: 12),
- Text('No episodes found', style: tt.bodyMedium?.copyWith(color: Colors.white38)),
+ Text('No episodes found', style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
],
),
)
@@ -419,15 +420,16 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
}
Widget _chip(IconData icon, String text) {
+ final cs = Theme.of(context).colorScheme;
return Container(
constraints: const BoxConstraints(maxWidth: 200),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
- decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08))),
child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(icon, size: 12, color: Colors.white38), const SizedBox(width: 4),
+ Icon(icon, size: 12, color: cs.onSurfaceVariant), const SizedBox(width: 4),
Flexible(child: Text(text, overflow: TextOverflow.ellipsis, maxLines: 1,
- style: const TextStyle(color: Colors.white54, fontSize: 11)))]));
+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 11)))]));
}
}
@@ -634,9 +636,9 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
return Container(
clipBehavior: Clip.antiAlias,
- decoration: const BoxDecoration(
- color: Color(0xFF111111),
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ decoration: BoxDecoration(
+ color: Theme.of(context).scaffoldBackgroundColor,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Stack(children: [
// Blurred cover background
@@ -658,9 +660,9 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
Positioned.fill(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(
begin: Alignment.topCenter, end: Alignment.bottomCenter,
colors: [
- const Color(0xFF111111).withValues(alpha: 0.6),
- const Color(0xFF111111).withValues(alpha: 0.85),
- const Color(0xFF111111),
+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.6),
+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.85),
+ Theme.of(context).scaffoldBackgroundColor,
],
)))),
// Content
@@ -670,17 +672,17 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
children: [
// Drag handle
Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
- decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
// Episode title (centered)
Text(_episodeTitle, textAlign: TextAlign.center,
- style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: Colors.white)),
+ style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface)),
const SizedBox(height: 4),
// Show title
if (_showTitle.isNotEmpty)
Text(_showTitle, textAlign: TextAlign.center,
- style: tt.bodyMedium?.copyWith(color: Colors.white60)),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.6))),
const SizedBox(height: 12),
@@ -689,13 +691,13 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
ClipRRect(borderRadius: BorderRadius.circular(3),
child: LinearProgressIndicator(
value: progress.clamp(0.0, 1.0), minHeight: 4,
- backgroundColor: Colors.white.withValues(alpha: 0.1),
+ backgroundColor: cs.onSurface.withValues(alpha: 0.1),
valueColor: AlwaysStoppedAnimation(
isFinished ? cs.primary.withValues(alpha: 0.4) : cs.primary),
)),
const SizedBox(height: 4),
Text('${(progress * 100).toStringAsFixed(1)}% complete', textAlign: TextAlign.center,
- style: tt.labelSmall?.copyWith(color: Colors.white38)),
+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
const SizedBox(height: 12),
],
@@ -732,7 +734,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
if (downloaded) {
icon = Icons.download_done_rounded;
label = 'Downloaded';
- color = Colors.greenAccent.withValues(alpha: 0.7);
+ color = (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7);
} else if (downloading) {
icon = Icons.downloading_rounded;
label = '${(dlProgress * 100).toStringAsFixed(0)}%';
@@ -740,7 +742,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
} else {
icon = Icons.download_outlined;
label = 'Download';
- color = Colors.white54;
+ color = cs.onSurfaceVariant;
}
return GestureDetector(
@@ -749,9 +751,9 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
height: 36,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
- color: downloaded ? Colors.greenAccent.withValues(alpha: 0.06) : Colors.white.withValues(alpha: 0.06),
+ color: downloaded ? (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: downloaded ? Colors.greenAccent.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: downloaded ? (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),
),
child: Stack(children: [
if (downloading)
@@ -780,21 +782,21 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
child: Container(
height: 36,
decoration: BoxDecoration(
- color: isFinished ? Colors.green.withValues(alpha: 0.06) : Colors.white.withValues(alpha: 0.06),
+ color: isFinished ? Colors.green.withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(14),
- border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.08)),
+ border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),
),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Icon(
isFinished ? Icons.check_circle_rounded : Icons.check_circle_outline_rounded,
size: 16,
- color: isFinished ? Colors.green : Colors.white54,
+ color: isFinished ? Colors.green : cs.onSurfaceVariant,
),
const SizedBox(width: 6),
Text(
isFinished ? 'Finished' : 'Mark Finished',
style: TextStyle(
- color: isFinished ? Colors.green : Colors.white54,
+ color: isFinished ? Colors.green : cs.onSurfaceVariant,
fontSize: 12, fontWeight: FontWeight.w500,
),
),
@@ -839,14 +841,14 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
// Description
if (_cleanDescription.isNotEmpty) ...[
const SizedBox(height: 16),
- Text('About This Episode', style: tt.titleSmall?.copyWith(color: Colors.white54, fontWeight: FontWeight.w600)),
+ Text('About This Episode', style: tt.titleSmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
const SizedBox(height: 6),
GestureDetector(
onTap: () => setState(() => _descriptionExpanded = !_descriptionExpanded),
child: Text(_cleanDescription,
maxLines: _descriptionExpanded ? 200 : 4,
overflow: TextOverflow.ellipsis,
- style: tt.bodySmall?.copyWith(color: Colors.white70, height: 1.5)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.7), height: 1.5)),
),
if (_cleanDescription.length > 200)
Padding(
@@ -867,15 +869,16 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
}
Widget _chip(IconData icon, String text) {
+ final cs = Theme.of(context).colorScheme;
return Container(
constraints: const BoxConstraints(maxWidth: 200),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
- decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
- border: Border.all(color: Colors.white.withValues(alpha: 0.08))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08))),
child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(icon, size: 12, color: Colors.white38), const SizedBox(width: 4),
+ Icon(icon, size: 12, color: cs.onSurfaceVariant), const SizedBox(width: 4),
Flexible(child: Text(text, overflow: TextOverflow.ellipsis, maxLines: 1,
- style: const TextStyle(color: Colors.white54, fontSize: 11)))]));
+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 11)))]));
}
}
@@ -996,7 +999,7 @@ class _EpisodeRowState extends State<_EpisodeRow> {
fontWeight: FontWeight.w500,
color: isFinished
? cs.onSurfaceVariant.withValues(alpha: 0.5)
- : Colors.white,
+ : cs.onSurface,
),
maxLines: 2, overflow: TextOverflow.ellipsis,
),
@@ -1052,7 +1055,7 @@ class _EpisodeRowState extends State<_EpisodeRow> {
return Padding(
padding: const EdgeInsets.all(8),
child: Icon(Icons.download_done_rounded, size: 20,
- color: Colors.greenAccent.withValues(alpha: 0.7)),
+ color: (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7)),
);
}
if (downloading) {
diff --git a/lib/widgets/equalizer_sheet.dart b/lib/widgets/equalizer_sheet.dart
index ce33a295..6b4b4e9e 100644
--- a/lib/widgets/equalizer_sheet.dart
+++ b/lib/widgets/equalizer_sheet.dart
@@ -50,12 +50,13 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
final tt = Theme.of(context).textTheme;
final accent = widget.accent;
return Container(
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: accent.withValues(alpha: 0.2), width: 1)),
),
@@ -66,7 +67,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
padding: const EdgeInsets.symmetric(vertical: 12),
child: Container(
width: 40, height: 4,
- decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2)),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)),
),
),
// Header with toggle
@@ -76,7 +77,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
children: [
Icon(Icons.equalizer_rounded, size: 22, color: accent),
const SizedBox(width: 10),
- Text('Audio Enhancements', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Audio Enhancements', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
const Spacer(),
// Master toggle
Transform.scale(
@@ -100,7 +101,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
const SizedBox(height: 8),
// ── Presets ──
Text('PRESETS', style: tt.labelSmall?.copyWith(
- color: Colors.white30, letterSpacing: 1.5, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.3), letterSpacing: 1.5, fontWeight: FontWeight.w600)),
const SizedBox(height: 10),
Wrap(
spacing: 8, runSpacing: 8,
@@ -112,18 +113,18 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
duration: const Duration(milliseconds: 150),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
decoration: BoxDecoration(
- color: isActive ? accent.withValues(alpha: 0.2) : Colors.white.withValues(alpha: 0.06),
+ color: isActive ? accent.withValues(alpha: 0.2) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(20),
border: Border.all(
- color: isActive ? accent.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.1),
+ color: isActive ? accent.withValues(alpha: 0.5) : cs.onSurface.withValues(alpha: 0.1),
),
),
child: Text(
name[0].toUpperCase() + name.substring(1),
style: TextStyle(
color: _eq.enabled
- ? (isActive ? accent : Colors.white70)
- : Colors.white24,
+ ? (isActive ? accent : cs.onSurface.withValues(alpha: 0.7))
+ : cs.onSurface.withValues(alpha: 0.24),
fontSize: 12,
fontWeight: isActive ? FontWeight.w700 : FontWeight.w500,
),
@@ -153,7 +154,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
// ── EQ Bands ──
Text('EQUALIZER', style: tt.labelSmall?.copyWith(
- color: Colors.white30, letterSpacing: 1.5, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.3), letterSpacing: 1.5, fontWeight: FontWeight.w600)),
const SizedBox(height: 12),
SizedBox(
height: 200,
@@ -178,7 +179,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
// ── Audio Effects ──
Text('EFFECTS', style: tt.labelSmall?.copyWith(
- color: Colors.white30, letterSpacing: 1.5, fontWeight: FontWeight.w600)),
+ color: cs.onSurface.withValues(alpha: 0.3), letterSpacing: 1.5, fontWeight: FontWeight.w600)),
const SizedBox(height: 12),
// Bass Boost
@@ -220,9 +221,9 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {
child: TextButton.icon(
onPressed: _eq.enabled ? () => _eq.resetAll() : null,
icon: Icon(Icons.refresh_rounded, size: 18,
- color: _eq.enabled ? Colors.white38 : Colors.white12),
+ color: _eq.enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12)),
label: Text('Reset All', style: TextStyle(
- color: _eq.enabled ? Colors.white38 : Colors.white12,
+ color: _eq.enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12),
fontSize: 13)),
),
),
@@ -259,6 +260,7 @@ class _EQBandSlider extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
final eq = EqualizerService();
final label = eq.freqLabel(frequency);
final normalized = ((level - minLevel) / (maxLevel - minLevel)).clamp(0.0, 1.0);
@@ -267,7 +269,7 @@ class _EQBandSlider extends StatelessWidget {
children: [
Text('${level >= 0 ? "+" : ""}${level.toStringAsFixed(0)}',
style: TextStyle(
- color: enabled ? Colors.white54 : Colors.white.withValues(alpha: 0.2),
+ color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.2),
fontSize: 10, fontWeight: FontWeight.w600)),
const SizedBox(height: 4),
Expanded(
@@ -278,9 +280,9 @@ class _EQBandSlider extends StatelessWidget {
trackHeight: 4,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 7),
overlayShape: const RoundSliderOverlayShape(overlayRadius: 14),
- activeTrackColor: enabled ? accent : Colors.white24,
- inactiveTrackColor: Colors.white.withValues(alpha: 0.08),
- thumbColor: enabled ? accent : Colors.white30,
+ activeTrackColor: enabled ? accent : cs.onSurface.withValues(alpha: 0.24),
+ inactiveTrackColor: cs.onSurface.withValues(alpha: 0.08),
+ thumbColor: enabled ? accent : cs.onSurface.withValues(alpha: 0.3),
overlayColor: accent.withValues(alpha: 0.15),
),
child: Slider(
@@ -294,7 +296,7 @@ class _EQBandSlider extends StatelessWidget {
),
const SizedBox(height: 4),
Text(label, style: TextStyle(
- color: enabled ? Colors.white38 : Colors.white.withValues(alpha: 0.15),
+ color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.15),
fontSize: 10, fontWeight: FontWeight.w500)),
],
);
@@ -322,20 +324,21 @@ class _EffectRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.04),
+ color: cs.onSurface.withValues(alpha: 0.04),
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
- Icon(icon, size: 18, color: enabled ? accent.withValues(alpha: 0.7) : Colors.white.withValues(alpha: 0.2)),
+ Icon(icon, size: 18, color: enabled ? accent.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.2)),
const SizedBox(width: 10),
SizedBox(
width: 72,
child: Text(label, style: TextStyle(
- color: enabled ? Colors.white70 : Colors.white24,
+ color: enabled ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24),
fontSize: 12, fontWeight: FontWeight.w500)),
),
Expanded(
@@ -344,9 +347,9 @@ class _EffectRow extends StatelessWidget {
trackHeight: 3,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6),
overlayShape: const RoundSliderOverlayShape(overlayRadius: 12),
- activeTrackColor: enabled ? accent : Colors.white24,
- inactiveTrackColor: Colors.white.withValues(alpha: 0.06),
- thumbColor: enabled ? accent : Colors.white30,
+ activeTrackColor: enabled ? accent : cs.onSurface.withValues(alpha: 0.24),
+ inactiveTrackColor: cs.onSurface.withValues(alpha: 0.06),
+ thumbColor: enabled ? accent : cs.onSurface.withValues(alpha: 0.3),
overlayColor: accent.withValues(alpha: 0.15),
),
child: Slider(
@@ -362,7 +365,7 @@ class _EffectRow extends StatelessWidget {
child: Text('${(value * 100).round()}%',
textAlign: TextAlign.right,
style: TextStyle(
- color: enabled ? Colors.white38 : Colors.white.withValues(alpha: 0.15),
+ color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.15),
fontSize: 11, fontWeight: FontWeight.w600)),
),
],
diff --git a/lib/widgets/metadata_lookup_sheet.dart b/lib/widgets/metadata_lookup_sheet.dart
index de9e2c06..394159f3 100644
--- a/lib/widgets/metadata_lookup_sheet.dart
+++ b/lib/widgets/metadata_lookup_sheet.dart
@@ -146,9 +146,9 @@ class _MetadataLookupSheetState extends State<MetadataLookupSheet> {
final tt = Theme.of(context).textTheme;
return Container(
- decoration: const BoxDecoration(
- color: Color(0xFF1A1A1A),
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ decoration: BoxDecoration(
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Column(
children: [
@@ -217,7 +217,7 @@ class _MetadataLookupSheetState extends State<MetadataLookupSheet> {
child: DropdownButton<String>(
value: _provider,
isExpanded: true,
- dropdownColor: const Color(0xFF2A2A2A),
+ dropdownColor: Theme.of(context).colorScheme.surfaceContainerHigh,
style: tt.bodySmall
?.copyWith(color: Colors.white70),
icon: Icon(Icons.expand_more_rounded,
diff --git a/lib/widgets/sleep_timer_sheet.dart b/lib/widgets/sleep_timer_sheet.dart
index c4490ed7..d9230d73 100644
--- a/lib/widgets/sleep_timer_sheet.dart
+++ b/lib/widgets/sleep_timer_sheet.dart
@@ -41,6 +41,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
@override
Widget build(BuildContext context) {
final tt = Theme.of(context).textTheme;
+ final cs = Theme.of(context).colorScheme;
final accent = widget.accent;
return ListenableBuilder(
@@ -54,15 +55,15 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
return Container(
padding: EdgeInsets.fromLTRB(20, 16, 20, 24 + navBarPad),
decoration: BoxDecoration(
- color: const Color(0xFF1A1A1A),
+ color: Theme.of(context).bottomSheetTheme.backgroundColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(top: BorderSide(color: accent.withValues(alpha: 0.2), width: 1)),
),
child: SingleChildScrollView(
child: Column(mainAxisSize: MainAxisSize.min, children: [
- Container(width: 40, height: 4, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(2))),
+ Container(width: 40, height: 4, decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2))),
const SizedBox(height: 16),
- Text('Sleep Timer', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: Colors.white)),
+ Text('Sleep Timer', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
const SizedBox(height: 16),
if (isActive)
@@ -71,7 +72,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
// Tab bar
Container(
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: 0.06),
+ color: cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.all(3),
@@ -88,7 +89,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
else _buildChapterTab(accent, tt),
const SizedBox(height: 16),
- Container(height: 0.5, color: Colors.white.withValues(alpha: 0.08)),
+ Container(height: 0.5, color: cs.onSurface.withValues(alpha: 0.08)),
const SizedBox(height: 12),
// Shake toggle
@@ -102,6 +103,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
}
Widget _buildActiveState(SleepTimerService sleep, Color accent, TextTheme tt) {
+ final cs = Theme.of(context).colorScheme;
final isTime = sleep.mode == SleepTimerMode.time;
String countdownLabel;
@@ -127,7 +129,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
child: LinearProgressIndicator(
value: sleep.timeProgress,
minHeight: 4,
- backgroundColor: Colors.white.withValues(alpha: 0.08),
+ backgroundColor: cs.onSurface.withValues(alpha: 0.08),
valueColor: AlwaysStoppedAnimation(accent.withValues(alpha: 0.6)),
),
),
@@ -140,7 +142,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
const SizedBox(height: 20),
// Quick add buttons
- Text('Add more time', style: TextStyle(color: Colors.white38, fontSize: 12)),
+ Text('Add more time', style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
const SizedBox(height: 10),
if (isTime)
Wrap(spacing: 8, runSpacing: 8, alignment: WrapAlignment.center, children: [
@@ -163,8 +165,8 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
icon: const Icon(Icons.close_rounded, size: 18),
label: const Text('Cancel timer'),
style: OutlinedButton.styleFrom(
- foregroundColor: Colors.white54,
- side: BorderSide(color: Colors.white.withValues(alpha: 0.12)),
+ foregroundColor: cs.onSurfaceVariant,
+ side: BorderSide(color: cs.onSurface.withValues(alpha: 0.12)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
onPressed: () {
@@ -174,13 +176,14 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
)),
const SizedBox(height: 12),
- Container(height: 0.5, color: Colors.white.withValues(alpha: 0.08)),
+ Container(height: 0.5, color: cs.onSurface.withValues(alpha: 0.08)),
const SizedBox(height: 12),
_buildShakeToggle(accent, tt),
]);
}
Widget _tab(String label, IconData icon, int index, Color accent) {
+ final cs = Theme.of(context).colorScheme;
final selected = _tabIndex == index;
return Expanded(
child: GestureDetector(
@@ -193,10 +196,10 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
borderRadius: BorderRadius.circular(10),
),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
- Icon(icon, size: 15, color: selected ? accent : Colors.white38),
+ Icon(icon, size: 15, color: selected ? accent : cs.onSurfaceVariant),
const SizedBox(width: 6),
Text(label, style: TextStyle(
- color: selected ? accent : Colors.white38,
+ color: selected ? accent : cs.onSurfaceVariant,
fontSize: 12, fontWeight: selected ? FontWeight.w600 : FontWeight.w400,
)),
]),
@@ -206,6 +209,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
}
Widget _buildTimerTab(Color accent, TextTheme tt) {
+ final cs = Theme.of(context).colorScheme;
return Column(children: [
// Custom slider
Text('${_customMinutes.round()} min',
@@ -215,7 +219,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
SliderTheme(
data: SliderThemeData(
activeTrackColor: accent,
- inactiveTrackColor: Colors.white.withValues(alpha: 0.1),
+ inactiveTrackColor: cs.onSurface.withValues(alpha: 0.1),
thumbColor: accent,
overlayColor: accent.withValues(alpha: 0.1),
trackHeight: 4,
@@ -228,9 +232,9 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
- child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [
- Text('1m', style: TextStyle(color: Colors.white30, fontSize: 11)),
- Text('120m', style: TextStyle(color: Colors.white30, fontSize: 11)),
+ child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
+ Text('1m', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
+ Text('120m', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
]),
),
const SizedBox(height: 12),
@@ -244,7 +248,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
const SizedBox(height: 16),
// Start button
SizedBox(width: double.infinity, height: 44, child: FilledButton(
- style: FilledButton.styleFrom(backgroundColor: accent, foregroundColor: Colors.black,
+ style: FilledButton.styleFrom(backgroundColor: accent, foregroundColor: cs.surface,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
onPressed: () {
SleepTimerService().setTimeSleep(Duration(minutes: _customMinutes.round()));
@@ -257,6 +261,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
}
Widget _buildChapterTab(Color accent, TextTheme tt) {
+ final cs = Theme.of(context).colorScheme;
return Column(children: [
Text('$_customChapters ${_customChapters == 1 ? 'chapter' : 'chapters'}',
style: TextStyle(color: accent, fontSize: 28, fontWeight: FontWeight.w700)),
@@ -282,7 +287,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
const SizedBox(height: 16),
// Start button
SizedBox(width: double.infinity, height: 44, child: FilledButton(
- style: FilledButton.styleFrom(backgroundColor: accent, foregroundColor: Colors.black,
+ style: FilledButton.styleFrom(backgroundColor: accent, foregroundColor: cs.surface,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
onPressed: () {
SleepTimerService().setChapterSleep(_customChapters);
@@ -295,16 +300,17 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
}
Widget _buildShakeToggle(Color accent, TextTheme tt) {
+ final cs = Theme.of(context).colorScheme;
return Row(children: [
- Icon(Icons.vibration_rounded, size: 18, color: _shakeEnabled ? accent : Colors.white24),
+ Icon(Icons.vibration_rounded, size: 18, color: _shakeEnabled ? accent : cs.onSurface.withValues(alpha: 0.24)),
const SizedBox(width: 10),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text('Shake to add time',
- style: TextStyle(color: _shakeEnabled ? Colors.white70 : Colors.white38, fontSize: 13, fontWeight: FontWeight.w500)),
+ style: TextStyle(color: _shakeEnabled ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 13, fontWeight: FontWeight.w500)),
Text(_shakeEnabled
? (_tabIndex == 0 ? 'Adds $_shakeAddMinutes min' : 'Adds 1 chapter')
: 'Off',
- style: TextStyle(color: Colors.white.withValues(alpha: 0.3), fontSize: 11)),
+ style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
])),
SizedBox(
height: 28,
@@ -321,32 +327,34 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
}
Widget _circleButton(IconData icon, Color accent, VoidCallback? onTap) {
+ final cs = Theme.of(context).colorScheme;
final enabled = onTap != null;
return GestureDetector(
onTap: onTap,
child: Container(
width: 48, height: 48,
decoration: BoxDecoration(
- color: enabled ? accent.withValues(alpha: 0.15) : Colors.white.withValues(alpha: 0.04),
+ color: enabled ? accent.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.04),
shape: BoxShape.circle,
- border: Border.all(color: enabled ? accent.withValues(alpha: 0.3) : Colors.white.withValues(alpha: 0.06)),
+ border: Border.all(color: enabled ? accent.withValues(alpha: 0.3) : cs.onSurface.withValues(alpha: 0.06)),
),
- child: Icon(icon, color: enabled ? accent : Colors.white24, size: 24),
+ child: Icon(icon, color: enabled ? accent : cs.onSurface.withValues(alpha: 0.24), size: 24),
),
);
}
Widget _presetChip(Color accent, String label, bool active, VoidCallback onTap) {
+ final cs = Theme.of(context).colorScheme;
return GestureDetector(onTap: onTap, child: AnimatedContainer(
duration: const Duration(milliseconds: 150),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
- color: active ? accent.withValues(alpha: 0.2) : Colors.white.withValues(alpha: 0.06),
+ color: active ? accent.withValues(alpha: 0.2) : cs.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(20),
- border: Border.all(color: active ? accent.withValues(alpha: 0.4) : Colors.white.withValues(alpha: 0.1)),
+ border: Border.all(color: active ? accent.withValues(alpha: 0.4) : cs.onSurface.withValues(alpha: 0.1)),
),
child: Text(label, style: TextStyle(
- color: active ? accent : Colors.white54,
+ color: active ? accent : cs.onSurfaceVariant,
fontSize: 13, fontWeight: active ? FontWeight.w600 : FontWeight.w400)),
));
}