Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add the web version and desktop browser layout

Barnabased4c3d68d3c5
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..678f5abe
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,11 @@
+.dart_tool
+.git
+.github
+.idea
+battery-reports
+build
+coverage
+screenshots
+test
+*.iml
+*.log
diff --git a/.metadata b/.metadata
index 45dedd14..e39b9c73 100644
--- a/.metadata
+++ b/.metadata
@@ -18,6 +18,9 @@ migration:
- platform: ios
create_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a
base_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a
+ - platform: web
+ create_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
+ base_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
# User provided section
diff --git a/Dockerfile.web b/Dockerfile.web
new file mode 100644
index 00000000..35b44274
--- /dev/null
+++ b/Dockerfile.web
@@ -0,0 +1,40 @@
+FROM debian:bookworm-slim AS build
+
+ARG FLUTTER_VERSION=3.44.0
+
+ENV PATH="/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:${PATH}" \
+ PUB_CACHE=/tmp/pub-cache
+
+RUN apt-get update \
+ && apt-get install --yes --no-install-recommends \
+ ca-certificates \
+ curl \
+ git \
+ unzip \
+ xz-utils \
+ && rm -rf /var/lib/apt/lists/* \
+ && curl --fail --location --silent --show-error \
+ "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
+ | tar --extract --xz --directory /opt \
+ && git config --global --add safe.directory /opt/flutter \
+ && flutter config --enable-web \
+ && flutter precache --web
+
+WORKDIR /src
+COPY . .
+
+RUN flutter pub get \
+ && flutter build web \
+ --release \
+ --base-href /absorb/ \
+ --no-web-resources-cdn \
+ --no-wasm-dry-run
+
+FROM nginx:1.28-alpine
+
+ENV ABS_UPSTREAM=http://audiobookshelf:80
+
+COPY deploy/nginx/default.conf.template /etc/nginx/templates/default.conf.template
+COPY --from=build /src/build/web /usr/share/nginx/html/absorb
+
+EXPOSE 80
diff --git a/compose.web.yml b/compose.web.yml
new file mode 100644
index 00000000..b6a8fc32
--- /dev/null
+++ b/compose.web.yml
@@ -0,0 +1,13 @@
+services:
+ absorb-web:
+ build:
+ context: .
+ dockerfile: Dockerfile.web
+ image: absorb-web:browser-workspace
+ environment:
+ ABS_UPSTREAM: ${ABS_UPSTREAM:-http://host.docker.internal:13378}
+ extra_hosts:
+ - "host.docker.internal:host-gateway"
+ ports:
+ - "${ABSORB_WEB_PORT:-8080}:80"
+ restart: unless-stopped
diff --git a/deploy/nginx/default.conf.template b/deploy/nginx/default.conf.template
new file mode 100644
index 00000000..cf4ea64f
--- /dev/null
+++ b/deploy/nginx/default.conf.template
@@ -0,0 +1,49 @@
+map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+}
+
+map $http_x_forwarded_proto $forwarded_proto {
+ default $http_x_forwarded_proto;
+ '' $scheme;
+}
+
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+ server_name _;
+
+ root /usr/share/nginx/html;
+ client_max_body_size 10240M;
+
+ location = /absorb {
+ return 308 /absorb/;
+ }
+
+ location = /absorb/index.html {
+ add_header Cache-Control "no-cache";
+ }
+
+ location = /absorb/flutter_service_worker.js {
+ add_header Cache-Control "no-cache";
+ }
+
+ location ^~ /absorb/ {
+ try_files $uri $uri/ /absorb/index.html;
+ }
+
+ location / {
+ proxy_pass ${ABS_UPSTREAM};
+ proxy_http_version 1.1;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Host $http_host;
+ proxy_set_header X-Forwarded-Proto $forwarded_proto;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_read_timeout 3600s;
+ proxy_send_timeout 3600s;
+ proxy_buffering off;
+ }
+}
diff --git a/lib/main.dart b/lib/main.dart
index d4e173c9..76edcf0e 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -37,6 +37,7 @@ import 'services/log_service.dart';
import 'services/quick_actions_service.dart';
import 'services/setup_link_service.dart';
import 'services/wording.dart';
+import 'utils/app_platform.dart';
import 'screens/login_screen.dart';
import 'screens/app_shell.dart';
import 'widgets/auth_loading_screen.dart';
@@ -147,6 +148,7 @@ void applyUseColorEverywhere(bool value) => useColorEverywhereNotifier.value = v
/// pinned to portrait; otherwise all orientations are allowed (the default).
/// Safe to call any time the setting changes.
Future<void> applyOrientationLock() async {
+ if (AppPlatform.isWeb) return;
final lock = await PlayerSettings.getLockPortrait();
await SystemChrome.setPreferredOrientations(lock
? const [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]
@@ -159,17 +161,19 @@ Future<void> applyOrientationLock() async {
}
void main() async {
- HttpOverrides.global = _CertOverrides();
+ if (!AppPlatform.isWeb) HttpOverrides.global = _CertOverrides();
final widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
- final appLinks = AppLinks();
+ final setupLinkStream = AppPlatform.isWeb ? null : AppLinks().uriLinkStream;
// These calls use platform channels that require an Activity. When Android
// Auto cold-starts the app for the MediaBrowserService, no Activity exists
// and these calls can hang forever - blocking runApp() and freezing on the
// splash screen. Wrap in try-catch with a timeout so we always reach runApp().
- try {
- FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
- } catch (_) {}
+ if (!AppPlatform.isWeb) {
+ try {
+ FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
+ } catch (_) {}
+ }
try {
await applyOrientationLock().timeout(const Duration(seconds: 2));
@@ -228,9 +232,11 @@ void main() async {
};
// Remove native splash — Flutter will render the AuthGate splash immediately
- try {
- FlutterNativeSplash.remove();
- } catch (_) {}
+ if (!AppPlatform.isWeb) {
+ try {
+ FlutterNativeSplash.remove();
+ } catch (_) {}
+ }
runApp(
MultiProvider(
@@ -241,7 +247,7 @@ void main() async {
update: (_, auth, lib) => lib!..updateAuth(auth),
),
],
- child: AbsorbApp(setupLinkStream: appLinks.uriLinkStream),
+ child: AbsorbApp(setupLinkStream: setupLinkStream),
),
);
}
@@ -562,12 +568,12 @@ class _AuthGateState extends State<AuthGate> {
// app version and device model instead of fallback values.
await ApiService.initVersion();
try {
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
final info = await DeviceInfoPlugin().androidInfo;
ApiService.deviceManufacturer = info.manufacturer;
ApiService.deviceModel = info.model;
ApiService.deviceSdkInt = info.version.sdkInt;
- } else if (Platform.isIOS) {
+ } else if (AppPlatform.isIOS) {
final info = await DeviceInfoPlugin().iosInfo;
ApiService.deviceManufacturer = 'Apple';
ApiService.deviceModel = info.utsname.machine;
@@ -620,8 +626,10 @@ class _AuthGateState extends State<AuthGate> {
} catch (_) {}
// Background new-episode notifications: re-register the periodic job
// (self-healing after OEM kills) and wire up notification taps.
- EpisodeNotificationService.syncRegistration();
- EpisodeNotificationService.initTapHandling();
+ if (!AppPlatform.isWeb) {
+ EpisodeNotificationService.syncRegistration();
+ EpisodeNotificationService.initTapHandling();
+ }
// Restore cover seed color
{
final seedInt = await PlayerSettings.getCoverSeedColor();
@@ -652,13 +660,15 @@ class _AuthGateState extends State<AuthGate> {
// Downloads must be loaded before the audio handler so getChildren()
// can serve the Android Auto browse tree immediately.
- debugPrint('[Init] DownloadService... (${sw.elapsedMilliseconds}ms)');
- try {
- await DownloadService().init().timeout(const Duration(seconds: 8));
- } catch (e) {
- debugPrint('[Init] DownloadService.init timed out or failed: $e');
+ if (!AppPlatform.isWeb) {
+ debugPrint('[Init] DownloadService... (${sw.elapsedMilliseconds}ms)');
+ try {
+ await DownloadService().init().timeout(const Duration(seconds: 8));
+ } catch (e) {
+ debugPrint('[Init] DownloadService.init timed out or failed: $e');
+ }
+ debugPrint('[Init] DownloadService done (${sw.elapsedMilliseconds}ms)');
}
- debugPrint('[Init] DownloadService done (${sw.elapsedMilliseconds}ms)');
// Timeout guards against AudioService.init() hanging when Android killed
// the app process but kept the MediaBrowserService alive.
@@ -672,18 +682,22 @@ class _AuthGateState extends State<AuthGate> {
// the UI has bootstrapped the current item) through the existing
// home-widget restore path. Registered as a static callback to avoid a
// circular import between AudioPlayerService and HomeWidgetService.
- AudioPlayerService.onColdStartPlayRequested =
- HomeWidgetService().resumeLastPlayedIfAvailable;
+ if (!AppPlatform.isWeb) {
+ AudioPlayerService.onColdStartPlayRequested =
+ HomeWidgetService().resumeLastPlayedIfAvailable;
+ }
debugPrint('[Init] AudioPlayerService done (${sw.elapsedMilliseconds}ms)');
- try {
- await Permission.notification.request();
- } catch (e) {
- debugPrint('[Init] Permission request failed: $e');
+ if (!AppPlatform.isWeb) {
+ try {
+ await Permission.notification.request();
+ } catch (e) {
+ debugPrint('[Init] Permission request failed: $e');
+ }
}
// Initialize Chromecast (Android only)
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
try {
await ChromecastService().init();
} catch (e) {
@@ -699,17 +713,17 @@ class _AuthGateState extends State<AuthGate> {
// fold it into the offline ledger so the normal flush ships it.
await ProgressSyncService().migrateOrphanStreamingTime();
await LocalSessionService().init();
- await EqualizerService().init();
+ if (!AppPlatform.isWeb) await EqualizerService().init();
await SleepTimerService().loadAutoSleepSettings();
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
// Pre-populate Android Auto browse tree in background.
Future.microtask(() => AndroidAutoService().refresh());
}
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
// Initialize CarPlay browse tree.
CarPlayService().init();
}
- if (Platform.isAndroid || Platform.isIOS) {
+ if (AppPlatform.isMobile) {
// Initialize homescreen widget
await HomeWidgetService().init();
}
@@ -719,7 +733,7 @@ class _AuthGateState extends State<AuthGate> {
// (so we get real UIKit system icon types like `.play`, `.search`).
// Depends on AudioPlayerService + HomeWidgetService so they're ready
// when the shortcut handler fires.
- await QuickActionsService().init();
+ if (!AppPlatform.isWeb) await QuickActionsService().init();
} catch (e) {
debugPrint('[Init] Service init failed: $e');
}
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dart
index cccddde5..b77a8167 100644
--- a/lib/providers/_lp_core.dart
+++ b/lib/providers/_lp_core.dart
@@ -123,6 +123,11 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
// ── Offline mode ──
Future<void> setManualOffline(bool value) async {
+ if (AppPlatform.isWeb) {
+ _manualOffline = false;
+ _networkOffline = false;
+ return;
+ }
debugPrint('[Library] setManualOffline($value)');
_manualOffline = value;
final prefs = await SharedPreferences.getInstance();
@@ -158,6 +163,11 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> restoreOfflineMode() async {
+ if (AppPlatform.isWeb) {
+ _manualOffline = false;
+ _networkOffline = false;
+ return;
+ }
final prefs = await SharedPreferences.getInstance();
_manualOffline = prefs.getBool('manual_offline_mode') ?? false;
}
@@ -217,6 +227,11 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
void setNetworkOffline(bool offline) {
+ if (AppPlatform.isWeb) {
+ _networkOffline = false;
+ AudioPlayerService().setKnownOffline(false);
+ return;
+ }
final wasOffline = _networkOffline;
_networkOffline = offline;
// Mirror into AudioPlayerService so playback start can skip server session
@@ -258,6 +273,12 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
void _buildOfflineSections() {
+ if (AppPlatform.isWeb) {
+ _personalizedSections = [];
+ _errorMessage = null;
+ _isLoading = false;
+ return;
+ }
final isPodcast = isPodcastLibrary;
final allDownloads = DownloadService().downloadedItems;
final downloads = allDownloads.where((dl) {
@@ -377,6 +398,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
void _injectDownloadedSection() {
+ if (AppPlatform.isWeb) return;
final isPodcast = isPodcastLibrary;
final allDownloads = DownloadService().downloadedItems;
final downloads = allDownloads.where((dl) {
@@ -1255,7 +1277,9 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
registerUpdatedAt(id, ts.toInt());
// Mirror into AA/CarPlay so the next browse-tree refresh hands out a
// ts-suffixed cover URI and the native cover cache can invalidate.
- AndroidAutoService.notifyItemUpdated(id, ts.toInt());
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService.notifyItemUpdated(id, ts.toInt());
+ }
}
if (id != null) {
final coverPath = (data['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
@@ -2111,7 +2135,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> _downloadSubscribedEpisodes(String podcastId) async {
- if (_api == null || isOffline) return;
+ if (AppPlatform.isWeb || _api == null || isOffline) return;
final wifiOnly = await PlayerSettings.getWifiOnlyDownloads();
if (wifiOnly) {
final connectivity = await Connectivity().checkConnectivity();
@@ -2178,7 +2202,12 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> catchUpSubscribedPodcasts() async {
- if (_subscribedPodcasts.isEmpty || _api == null || isOffline) return;
+ if (AppPlatform.isWeb ||
+ _subscribedPodcasts.isEmpty ||
+ _api == null ||
+ isOffline) {
+ return;
+ }
for (final podcastId in _subscribedPodcasts) {
await _downloadSubscribedEpisodes(podcastId);
}
@@ -2187,7 +2216,12 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
// ── Rolling auto-download ──
void _catchUpRollingDownloads() async {
- if (_api == null || isOffline || _rollingDownloadSeries.isEmpty) return;
+ if (AppPlatform.isWeb ||
+ _api == null ||
+ isOffline ||
+ _rollingDownloadSeries.isEmpty) {
+ return;
+ }
final wifiOnly = await PlayerSettings.getWifiOnlyDownloads();
if (wifiOnly) {
@@ -2233,6 +2267,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
void _checkRollingDownloads(String playingKey) async {
+ if (AppPlatform.isWeb) return;
final api = _api;
if (api == null || isOffline) return;
// With the "auto series download" default on, a book in a series enables
@@ -2340,6 +2375,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> _checkQueueAutoDownloads(String playingKey) async {
+ if (AppPlatform.isWeb) return;
try {
final self = this as LibraryProvider;
final planGeneration = ++_queueDownloadPlanGeneration;
@@ -2565,6 +2601,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> _catchUpQueueAutoDownloads() async {
+ if (AppPlatform.isWeb) return;
final itemId = AudioPlayerService().currentItemId;
if (itemId == null) {
_queueDownloadPlanGeneration++;
@@ -2578,7 +2615,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
Future<void> syncQueueAutoDownloads() => _catchUpQueueAutoDownloads();
void _checkAutoDownloadOnStream(String playingKey) async {
- if (_api == null || isOffline) {
+ if (AppPlatform.isWeb || _api == null || isOffline) {
return;
}
final enabled = await PlayerSettings.getAutoDownloadOnStream();
@@ -2611,6 +2648,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> _rollingDownloadBook(String bookId, int count) async {
+ if (AppPlatform.isWeb) return;
var data = _itemDataWithSeries(bookId);
var (seriesId, currentSeq) =
data != null ? _StateMixin._extractSeries(data) : (null, null);
@@ -2702,6 +2740,7 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
Future<void> _rollingDownloadPodcast(String compoundKey, int count) async {
+ if (AppPlatform.isWeb) return;
final showId = compoundKey.substring(0, 36);
final episodeId = compoundKey.substring(37);
diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart
index 38a36fe8..165a4fe1 100644
--- a/lib/providers/auth_provider.dart
+++ b/lib/providers/auth_provider.dart
@@ -18,6 +18,7 @@ import '../services/wear_auth_service.dart';
import '../l10n/app_localizations.dart';
import '../main.dart' show rootNavigatorKey;
import '../widgets/overlay_toast.dart';
+import '../utils/app_platform.dart';
import '../utils/server_url.dart';
class AuthProvider extends ChangeNotifier {
@@ -290,6 +291,7 @@ class AuthProvider extends ChangeNotifier {
/// to call unconditionally — the service is a no-op on non-Android
/// platforms and when no watch is connected.
void _pushSessionToWear() {
+ if (AppPlatform.isWeb) return;
final url = _serverUrl;
final token = _accessToken;
if (url == null || token == null) return;
@@ -465,6 +467,11 @@ class AuthProvider extends ChangeNotifier {
);
}
_serverReachable = reachable;
+ if (AppPlatform.isWeb && !reachable) {
+ _accessToken = null;
+ _refreshToken = null;
+ _isLegacyToken = false;
+ }
// Fetch full user info (needed for isAdmin, permissions, etc.)
if (reachable) {
@@ -656,6 +663,7 @@ class AuthProvider extends ChangeNotifier {
_isLegacyToken = tokens.isLegacy;
_accessToken = tokens.token;
_refreshToken = tokens.refreshToken;
+ _serverReachable = true;
debugPrint('[Auth] Login response keys: ${result.keys.toList()}');
debugPrint('[Auth] Login user keys: ${user.keys.toList()}');
debugPrint(
@@ -721,11 +729,11 @@ class AuthProvider extends ChangeNotifier {
await _onAccountActivated();
- // Wipe any previous user's stats from the widget and pull this user's.
- await HomeWidgetService().clearStats();
- HomeWidgetService().refreshStats(force: true);
-
- _pushSessionToWear();
+ if (!AppPlatform.isWeb) {
+ await HomeWidgetService().clearStats();
+ HomeWidgetService().refreshStats(force: true);
+ _pushSessionToWear();
+ }
_startOnAbsorbingAfterAccountChange = true;
_isLoading = false;
notifyListeners();
@@ -778,6 +786,7 @@ class AuthProvider extends ChangeNotifier {
_defaultLibraryId = null;
_userJson = user;
_serverSettings = null;
+ _serverReachable = true;
_customHeaders = customHeaders;
_fetchServerVersion(url);
@@ -812,10 +821,11 @@ class AuthProvider extends ChangeNotifier {
await _onAccountActivated();
- await HomeWidgetService().clearStats();
- HomeWidgetService().refreshStats(force: true);
-
- _pushSessionToWear();
+ if (!AppPlatform.isWeb) {
+ await HomeWidgetService().clearStats();
+ HomeWidgetService().refreshStats(force: true);
+ _pushSessionToWear();
+ }
_startOnAbsorbingAfterAccountChange = true;
_isLoading = false;
notifyListeners();
@@ -921,11 +931,11 @@ class AuthProvider extends ChangeNotifier {
await _onAccountActivated();
- // Wipe any previous user's stats from the widget and pull this user's.
- await HomeWidgetService().clearStats();
- HomeWidgetService().refreshStats(force: true);
-
- _pushSessionToWear();
+ if (!AppPlatform.isWeb) {
+ await HomeWidgetService().clearStats();
+ HomeWidgetService().refreshStats(force: true);
+ _pushSessionToWear();
+ }
_startOnAbsorbingAfterAccountChange = true;
_isLoading = false;
notifyListeners();
@@ -954,7 +964,9 @@ class AuthProvider extends ChangeNotifier {
/// local URL with the new account's token, producing 401s.
Future<void> _onAccountActivated() async {
PlayerSettings.notifySettingsChanged();
- await EqualizerService().reloadForActiveAccount();
+ if (!AppPlatform.isWeb) {
+ await EqualizerService().reloadForActiveAccount();
+ }
await _loadLocalServerSettings();
_useLocalServer = false;
@@ -1072,15 +1084,15 @@ class AuthProvider extends ChangeNotifier {
}
} catch (_) {}
- // Clear Android Auto / CarPlay browse tree cache so it doesn't show stale data
- AndroidAutoService().clearCache();
- CarPlayService().clearAndRefresh();
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService().clearCache();
+ CarPlayService().clearAndRefresh();
+ }
// Drop the per-library search index so the next account can't reuse it.
BookSearchIndex().clear();
- // Clear the stats widget so the previous user's numbers don't linger.
- await HomeWidgetService().clearStats();
+ if (!AppPlatform.isWeb) await HomeWidgetService().clearStats();
// Clear cached session metadata for this user (track URLs would be invalid
// on next login anyway)
@@ -1145,8 +1157,7 @@ class AuthProvider extends ChangeNotifier {
await prefs.remove('default_library_id');
} catch (_) {}
- // Sign the paired watch out too.
- WearAuthService.instance.clear();
+ if (!AppPlatform.isWeb) WearAuthService.instance.clear();
notifyListeners();
}
@@ -1167,9 +1178,10 @@ class AuthProvider extends ChangeNotifier {
}
} catch (_) {}
- // Clear Android Auto / CarPlay browse tree cache so it refreshes for the new user
- AndroidAutoService().clearCache();
- CarPlayService().clearAndRefresh();
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService().clearCache();
+ CarPlayService().clearAndRefresh();
+ }
// Set the new account as active in the account service. It may have been
// removed since the caller loaded its saved-account row.
@@ -1195,7 +1207,9 @@ class AuthProvider extends ChangeNotifier {
// Reload EQ settings from the new account's scope. Without this the
// EqualizerService singleton keeps the previous account's in-memory
// state and would write it back into the new scope on any change.
- await EqualizerService().reloadForActiveAccount();
+ if (!AppPlatform.isWeb) {
+ await EqualizerService().reloadForActiveAccount();
+ }
// Set credentials
_serverUrl = selected.serverUrl;
@@ -1236,10 +1250,10 @@ class AuthProvider extends ChangeNotifier {
}
} catch (_) {}
- // Clear the stats widget so the previous account's numbers don't linger
- // while the new user's data is fetched, then force a refresh.
- await HomeWidgetService().clearStats();
- HomeWidgetService().refreshStats(force: true);
+ if (!AppPlatform.isWeb) {
+ await HomeWidgetService().clearStats();
+ HomeWidgetService().refreshStats(force: true);
+ }
// Verify the token still works and get user info
try {
diff --git a/lib/providers/library_provider.dart b/lib/providers/library_provider.dart
index 72e2e881..0eef049a 100644
--- a/lib/providers/library_provider.dart
+++ b/lib/providers/library_provider.dart
@@ -23,6 +23,7 @@ import '../services/book_search_index.dart';
import '../services/home_widget_service.dart';
import '../services/queue_download_policy.dart';
import '../utils/absorbing_inclusion.dart';
+import '../utils/app_platform.dart';
import '../l10n/app_localizations.dart';
import '../main.dart' show rootNavigatorKey;
import '../widgets/overlay_toast.dart';
@@ -60,6 +61,7 @@ class LibraryProvider extends ChangeNotifier
AudioPlayerService.setOnPeekNextItemCallback(peekNextQueueItemForPreBuffer);
AudioPlayerService.setOnPlayStartedCallback((key, duration) async {
await _prepareAbsorbingForPlayback(key, duration);
+ if (AppPlatform.isWeb) return;
// Auto-download the book/episode you're listening to kicks off quickly so
// it doesn't feel broken; the short wait still skips it if you stop or
// switch right away. Rolling/queue look-ahead stays deferred to keep the
@@ -101,7 +103,7 @@ class LibraryProvider extends ChangeNotifier
}
void updateAuth(AuthProvider auth) {
- if (!_listeningToDownloads) {
+ if (!AppPlatform.isWeb && !_listeningToDownloads) {
_listeningToDownloads = true;
DownloadService().addListener(_onDownloadsChanged);
}
@@ -198,7 +200,7 @@ class LibraryProvider extends ChangeNotifier
_buildProgressMap(auth);
- if (!auth.serverReachable) {
+ if (!AppPlatform.isWeb && !auth.serverReachable) {
debugPrint('[Library] Server not reachable — going offline');
_networkOffline = true;
_buildOfflineSections();
@@ -213,7 +215,7 @@ class LibraryProvider extends ChangeNotifier
ProgressSyncService().flushPendingSync(api: _api!);
ProgressSyncService().flushOfflineListeningTime(api: _api!);
LocalSessionService().flushPending(api: _api!);
- DownloadService().enrichMetadata(_api!);
+ if (!AppPlatform.isWeb) DownloadService().enrichMetadata(_api!);
// Start proactive reachability verification so the cloud icon
// reflects actual server state, not just the initial login result.
_startHealthCheckTimer();
@@ -385,8 +387,10 @@ class LibraryProvider extends ChangeNotifier
await _loadSectionPrefs();
notifyListeners();
await loadPersonalizedView(force: true);
- AndroidAutoService().refresh(force: true);
- CarPlayService().refreshTemplates();
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService().refresh(force: true);
+ CarPlayService().refreshTemplates();
+ }
}
/// Library switch for the dedicated Podcasts tab flips. Never stops
@@ -405,8 +409,10 @@ class LibraryProvider extends ChangeNotifier
await _loadSectionPrefs();
notifyListeners();
await loadPersonalizedView();
- AndroidAutoService().refresh(force: true);
- CarPlayService().refreshTemplates();
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService().refresh(force: true);
+ CarPlayService().refreshTemplates();
+ }
}
bool isPodcastLibraryId(String libraryId) {
diff --git a/lib/screens/admin_users_screen.dart b/lib/screens/admin_users_screen.dart
index 96c93bf8..66c17eed 100644
--- a/lib/screens/admin_users_screen.dart
+++ b/lib/screens/admin_users_screen.dart
@@ -16,6 +16,7 @@ import '../widgets/overlay_toast.dart';
import '../widgets/setup_link_share_sheet.dart';
import '../l10n/app_localizations.dart';
import '../utils/duration_format.dart';
+import '../utils/app_platform.dart';
class AdminUsersScreen extends StatefulWidget {
final List<dynamic> users;
@@ -905,7 +906,7 @@ class _UserDetailScreenState extends State<_UserDetailScreen> {
);
if (result == null) return;
- if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
+ if (AppPlatform.isDesktop) {
await File(result).writeAsString(jsonStr);
}
if (mounted) {
diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dart
index 1884bcda..aec45288 100644
--- a/lib/screens/app_shell.dart
+++ b/lib/screens/app_shell.dart
@@ -15,13 +15,19 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:palette_generator/palette_generator.dart';
import '../utils/cover_accent.dart';
import '../main.dart'
- show snappyTransitionsNotifier, coverSchemeNotifier, rootNavigatorKey, applyOrientationLock;
+ show
+ snappyTransitionsNotifier,
+ coverSchemeNotifier,
+ rootNavigatorKey,
+ applyOrientationLock;
import '../l10n/app_localizations.dart';
import '../services/wording.dart';
import '../services/android_auto_service.dart';
import '../services/carplay_service.dart';
import '../widgets/expanded_card.dart';
+import '../widgets/desktop_now_playing_bar.dart';
import 'absorbing_screen.dart';
+import 'admin_screen.dart';
import 'home_screen.dart';
import 'library_screen.dart';
import 'stats_screen.dart';
@@ -33,6 +39,7 @@ import '../services/review_service.dart';
import '../services/update_checker_service.dart';
import '../widgets/update_dialog.dart';
import '../widgets/overlay_toast.dart';
+import '../utils/app_platform.dart';
class AppShell extends StatefulWidget {
final bool startOnAbsorbing;
@@ -325,7 +332,11 @@ class _AppShellState extends State<AppShell>
void initState() {
super.initState();
_instance = this;
- if (!widget.startOnAbsorbing) _loadStartScreen();
+ if (AppPlatform.isWeb) {
+ _currentIndex = 0;
+ } else if (!widget.startOnAbsorbing) {
+ _loadStartScreen();
+ }
_ensurePageBuilt(_currentIndex);
_playerHadBook = _player.hasBook;
_wasPlaying = _player.isPlaying;
@@ -346,7 +357,7 @@ class _AppShellState extends State<AppShell>
context.read<LibraryProvider>().addListener(_onLibraryChanged);
_loadPodcastTabPrefs();
PlayerSettings.settingsChanged.addListener(_loadPodcastTabPrefs);
- WelcomeSheet.showIfNeeded(context);
+ if (!AppPlatform.isWeb) WelcomeSheet.showIfNeeded(context);
_checkForUpdate();
}
@@ -424,7 +435,7 @@ class _AppShellState extends State<AppShell>
static const _isGithubBuild = bool.fromEnvironment('GITHUB_BUILD');
void _checkForUpdate() async {
- if (!_isGithubBuild) return;
+ if (AppPlatform.isWeb || !_isGithubBuild) return;
final includePreReleases = await PlayerSettings.getIncludePreReleases();
final info = await UpdateCheckerService.check(
includePreReleases: includePreReleases,
@@ -544,12 +555,18 @@ class _AppShellState extends State<AppShell>
}
Future<void> _maybeAutoExpand() async {
+ if (AppPlatform.isWeb) return;
// Only auto-open the full-screen player from the Absorbing tab - starting
// playback from elsewhere (another tab, the nav long-press) shouldn't
// yank the user into the player.
if (_currentIndex != 2) return;
final enabled = await PlayerSettings.getFullScreenPlayer();
- if (!enabled || !mounted || !_player.hasBook) return;
+ if (!enabled) return;
+ await _openExpandedPlayer();
+ }
+
+ Future<void> _openExpandedPlayer() async {
+ if (!mounted || !_player.hasBook || _expandedIsOpen) return;
// Synthesize item data from player state
final itemId = _player.currentItemId;
@@ -647,8 +664,10 @@ class _AppShellState extends State<AppShell>
context.read<LibraryProvider>().onAppForegrounded();
SleepTimerService().onAppForegrounded();
AudioPlayerService.onAppForegrounded();
- HomeWidgetService().onAppForegrounded();
- ReviewService.onAppForegrounded();
+ if (!AppPlatform.isWeb) {
+ HomeWidgetService().onAppForegrounded();
+ ReviewService.onAppForegrounded();
+ }
_refreshDataForTab(_currentIndex);
// Check auto sleep in case we resumed into the window
SleepTimerService().checkAutoSleep();
@@ -661,7 +680,7 @@ class _AppShellState extends State<AppShell>
context.read<LibraryProvider>().onAppBackgrounded();
SleepTimerService().onAppBackgrounded();
AudioPlayerService.onAppBackgrounded();
- HomeWidgetService().onAppBackgrounded();
+ if (!AppPlatform.isWeb) HomeWidgetService().onAppBackgrounded();
}
@override
@@ -695,61 +714,339 @@ class _AppShellState extends State<AppShell>
_lastRefresh = now;
lib.refresh();
// Keep Android Auto / CarPlay browse tree in sync
- AndroidAutoService().refresh();
- CarPlayService().refreshTemplates();
+ if (!AppPlatform.isWeb) {
+ AndroidAutoService().refresh();
+ CarPlayService().refreshTemplates();
+ }
}
}
@override
Widget build(BuildContext context) {
- return PopScope(
- canPop: false,
- onPopInvokedWithResult: (didPop, _) {
- if (didPop) return;
-
- // If on Library tab with active search, clear search first
- if (_currentIndex == 1 &&
- _libraryKey.currentState?.isSearchActive == true) {
- _libraryKey.currentState?.clearSearch();
- return;
- }
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final useDesktopWorkspace =
+ AppPlatform.isWeb && constraints.maxWidth >= 960;
+ return PopScope(
+ canPop: false,
+ onPopInvokedWithResult: _handleBack,
+ child: useDesktopWorkspace
+ ? _buildDesktopWorkspace(context)
+ : Scaffold(
+ body: _buildPageStack(context),
+ bottomNavigationBar: _buildBottomNav(context),
+ ),
+ );
+ },
+ );
+ }
- // If already on Absorbing tab, require double-back to exit
- if (_currentIndex == 2) {
- final now = DateTime.now();
- if (_lastBackPress != null &&
- now.difference(_lastBackPress!) < const Duration(seconds: 2)) {
- SystemChannels.platform.invokeMethod('SystemNavigator.pop', true);
- return;
- }
- _lastBackPress = now;
- showOverlayToast(
- context,
- AppLocalizations.of(context)!.appShellPressBackToExit,
- icon: Icons.exit_to_app_rounded,
- );
- return;
- }
+ void _handleBack(bool didPop, Object? _) {
+ if (didPop) return;
- // From any other tab, go to Absorbing
- _switchToAbsorbing();
- },
- child: Scaffold(
- body: FadeTransition(
- opacity: _fadeController,
- child: IndexedStack(
- index: _currentIndex,
- children: List<Widget>.generate(
- _pages.length,
- (i) => _pages[i] ?? const SizedBox.shrink(),
+ if (_currentIndex == 1 &&
+ _libraryKey.currentState?.isSearchActive == true) {
+ _libraryKey.currentState?.clearSearch();
+ return;
+ }
+
+ if (AppPlatform.isWeb) {
+ if (_currentIndex != 0) _navigateTo(0);
+ return;
+ }
+
+ if (_currentIndex == 2) {
+ final now = DateTime.now();
+ if (_lastBackPress != null &&
+ now.difference(_lastBackPress!) < const Duration(seconds: 2)) {
+ SystemChannels.platform.invokeMethod('SystemNavigator.pop', true);
+ return;
+ }
+ _lastBackPress = now;
+ showOverlayToast(
+ context,
+ AppLocalizations.of(context)!.appShellPressBackToExit,
+ icon: Icons.exit_to_app_rounded,
+ );
+ return;
+ }
+
+ _switchToAbsorbing();
+ }
+
+ Widget _buildPageStack(BuildContext context, {Size? viewportSize}) {
+ Widget stack = FadeTransition(
+ opacity: _fadeController,
+ child: IndexedStack(
+ index: _currentIndex,
+ children: List<Widget>.generate(
+ _pages.length,
+ (i) => _pages[i] ?? const SizedBox.shrink(),
+ ),
+ ),
+ );
+ if (viewportSize != null) {
+ stack = MediaQuery(
+ data: MediaQuery.of(context).copyWith(size: viewportSize),
+ child: stack,
+ );
+ }
+ return stack;
+ }
+
+ Widget _buildDesktopWorkspace(BuildContext context) {
+ final lib = context.watch<LibraryProvider>();
+ final podcastsShown = _podcastsShown(lib);
+ final destinations = _buildDestinations(context, podcastsShown);
+
+ return Scaffold(
+ body: Row(
+ children: [
+ _buildDesktopSidebar(
+ context,
+ lib: lib,
+ podcastsShown: podcastsShown,
+ destinations: destinations,
+ ),
+ VerticalDivider(
+ width: 1,
+ thickness: 1,
+ color: Theme.of(
+ context,
+ ).colorScheme.outlineVariant.withValues(alpha: 0.45),
+ ),
+ Expanded(
+ child: LayoutBuilder(
+ builder: (context, constraints) => _buildPageStack(
+ context,
+ viewportSize: Size(constraints.maxWidth, constraints.maxHeight),
+ ),
),
),
+ ],
+ ),
+ bottomNavigationBar: DesktopNowPlayingBar(
+ player: _player,
+ library: lib,
+ onOpenFullPlayer: _openExpandedPlayer,
+ ),
+ );
+ }
+
+ Widget _buildDesktopSidebar(
+ BuildContext context, {
+ required LibraryProvider lib,
+ required bool podcastsShown,
+ required List<NavigationDestination> destinations,
+ }) {
+ final theme = Theme.of(context);
+ final cs = theme.colorScheme;
+ final l = AppLocalizations.of(context)!;
+ final auth = context.watch<AuthProvider>();
+ final libraryName =
+ lib.selectedLibrary?['name'] as String? ?? l.libraryFallback;
+ final username = auth.username?.trim();
+ final accountName = username == null || username.isEmpty
+ ? 'Account'
+ : username;
+ final serverUrl = auth.serverUrl ?? '';
+ final parsedServer = Uri.tryParse(serverUrl);
+ final serverLabel = parsedServer?.host.isNotEmpty == true
+ ? parsedServer!.host
+ : serverUrl;
+
+ return SafeArea(
+ child: SizedBox(
+ width: 248,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 18, 16, 12),
+ child: Row(
+ children: [
+ Container(
+ width: 38,
+ height: 38,
+ decoration: BoxDecoration(
+ color: cs.primaryContainer,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Icon(
+ Icons.graphic_eq_rounded,
+ color: cs.onPrimaryContainer,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Text(
+ l.appTitle,
+ style: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w800,
+ letterSpacing: 1.4,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(12, 4, 12, 10),
+ child: Tooltip(
+ message: l.switchLibraryTooltip,
+ child: InkWell(
+ onTap: lib.libraries.length > 1
+ ? () => showLibraryPickerSheet(context, lib)
+ : null,
+ borderRadius: BorderRadius.circular(12),
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 10,
+ ),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerLow,
+ borderRadius: BorderRadius.circular(12),
+ border: Border.all(
+ color: cs.outlineVariant.withValues(alpha: 0.45),
+ ),
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.library_books_rounded,
+ size: 20,
+ color: cs.primary,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(
+ libraryName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: theme.textTheme.labelLarge,
+ ),
+ ),
+ if (lib.libraries.length > 1)
+ const Icon(Icons.expand_more_rounded, size: 20),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ child: FilledButton.tonalIcon(
+ onPressed: () {
+ if (podcastsShown) _syncTabLibrary(1, true);
+ _openSearch();
+ },
+ icon: const Icon(Icons.search_rounded, size: 20),
+ label: Text(l.search),
+ style: FilledButton.styleFrom(
+ alignment: Alignment.centerLeft,
+ minimumSize: const Size.fromHeight(44),
+ ),
+ ),
+ ),
+ const SizedBox(height: 8),
+ Expanded(
+ child: NavigationRail(
+ extended: true,
+ minWidth: 72,
+ minExtendedWidth: 248,
+ groupAlignment: -1,
+ backgroundColor: Colors.transparent,
+ selectedIndex: _selectedDest(lib, podcastsShown),
+ onDestinationSelected: (dest) =>
+ _selectDestination(dest, podcastsShown),
+ destinations: [
+ for (final destination in destinations)
+ NavigationRailDestination(
+ icon: destination.icon,
+ selectedIcon: destination.selectedIcon,
+ label: Text(destination.label),
+ ),
+ ],
+ ),
+ ),
+ if (auth.isAdmin)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ child: TextButton.icon(
+ onPressed: () => Navigator.of(context).push(
+ MaterialPageRoute<void>(
+ builder: (_) => const AdminScreen(),
+ ),
+ ),
+ icon: const Icon(Icons.admin_panel_settings_outlined),
+ label: Text(l.serverAdmin),
+ style: TextButton.styleFrom(
+ alignment: Alignment.centerLeft,
+ minimumSize: const Size.fromHeight(42),
+ ),
+ ),
+ ),
+ Divider(
+ height: 1,
+ color: cs.outlineVariant.withValues(alpha: 0.45),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: Row(
+ children: [
+ CircleAvatar(
+ radius: 18,
+ backgroundColor: cs.secondaryContainer,
+ foregroundColor: cs.onSecondaryContainer,
+ child: Text(accountName.characters.first.toUpperCase()),
+ ),
+ const SizedBox(width: 11),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ accountName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: theme.textTheme.labelLarge,
+ ),
+ if (serverLabel.isNotEmpty)
+ Text(
+ serverLabel,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
),
- bottomNavigationBar: _buildBottomNav(context),
),
);
}
+ void _selectDestination(int dest, bool podcastsShown) {
+ final lib = context.read<LibraryProvider>();
+ final page = _pageForDest(dest, podcastsShown);
+ if (page == 1 &&
+ _currentIndex == 1 &&
+ dest == _selectedDest(lib, podcastsShown) &&
+ _libraryKey.currentState?.isSearchActive == true) {
+ _libraryKey.currentState?.clearSearch();
+ return;
+ }
+ _syncTabLibrary(dest, podcastsShown);
+ _navigateTo(page);
+ if (page >= 0 && page <= 3) _refreshDataForTab(page);
+ }
+
Widget _buildBottomNav(BuildContext context) {
// Determine the *correct* notifier for the active tab so we can detect
// both "no listener" and "listener attached to the wrong tab" — the
@@ -818,23 +1115,8 @@ class _AppShellState extends State<AppShell>
labelBehavior: isPhoneLandscape
? NavigationDestinationLabelBehavior.alwaysHide
: NavigationDestinationLabelBehavior.alwaysShow,
- onDestinationSelected: (dest) {
- final page = _pageForDest(dest, podcastsShown);
- // Re-tapping the active library-ish destination clears search
- if (page == 1 &&
- _currentIndex == 1 &&
- dest == _selectedDest(lib, podcastsShown) &&
- _libraryKey.currentState?.isSearchActive == true) {
- _libraryKey.currentState?.clearSearch();
- return;
- }
- _syncTabLibrary(dest, podcastsShown);
- _navigateTo(page);
- // Refresh data on switching to Library, Home, Absorbing, or Stats
- if (page == 0 || page == 1 || page == 2 || page == 3) {
- _refreshDataForTab(page);
- }
- },
+ onDestinationSelected: (dest) =>
+ _selectDestination(dest, podcastsShown),
destinations: destinations,
),
),
diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart
index 814b1dee..ea26eefc 100644
--- a/lib/screens/login_screen.dart
+++ b/lib/screens/login_screen.dart
@@ -20,6 +20,7 @@ import '../services/audio_player_service.dart';
import '../main.dart' show applyTrustAllCerts, flatNotifier;
import '../l10n/app_localizations.dart';
import '../services/wording.dart';
+import '../utils/app_platform.dart';
class LoginScreen extends StatefulWidget {
final SavedAccount? prefillAccount;
@@ -150,10 +151,12 @@ class _LoginScreenState extends State<LoginScreen>
final info = await PackageInfo.fromPlatform();
if (mounted) setState(() => _appVersion = 'v${info.version}');
} catch (_) {}
- try {
- final trust = await PlayerSettings.getTrustAllCerts();
- if (mounted) setState(() => _trustAllCerts = trust);
- } catch (_) {}
+ if (!AppPlatform.isWeb) {
+ try {
+ final trust = await PlayerSettings.getTrustAllCerts();
+ if (mounted) setState(() => _trustAllCerts = trust);
+ } catch (_) {}
+ }
}
@override
@@ -166,7 +169,7 @@ class _LoginScreenState extends State<LoginScreen>
_apiKeyController.dispose();
_usernameFocus.dispose();
for (final (k, v) in _headerControllers) { k.dispose(); v.dispose(); }
- OidcService().cancel();
+ if (!AppPlatform.isWeb) OidcService().cancel();
super.dispose();
}
@@ -252,8 +255,7 @@ class _LoginScreenState extends State<LoginScreen>
}
});
- if (ok) {
- // Also check if OIDC is available
+ if (ok && !AppPlatform.isWeb) {
OidcService.checkOidcEnabled(fullUrl, customHeaders: headers).then((config) {
if (mounted && _serverController.text.trim() == text) {
setState(() => _oidcConfig = config);
@@ -336,7 +338,7 @@ class _LoginScreenState extends State<LoginScreen>
}
Future<void> _handleOidcLogin() async {
- if (!_serverValid) return;
+ if (AppPlatform.isWeb || !_serverValid) return;
setState(() {
_isOidcLoading = true;
@@ -418,14 +420,30 @@ class _LoginScreenState extends State<LoginScreen>
),
child: SafeArea(
child: LayoutBuilder(
- builder: (context, constraints) => SingleChildScrollView(
- padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 24),
- child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: constraints.maxHeight - 48),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: [
+ builder: (context, constraints) {
+ final isWide = constraints.maxWidth >= 720;
+ final horizontalPadding = isWide ? 40.0 : 28.0;
+ final verticalPadding = isWide ? 32.0 : 24.0;
+ final availableHeight =
+ constraints.maxHeight - (verticalPadding * 2);
+ return SingleChildScrollView(
+ padding: EdgeInsets.symmetric(
+ horizontal: horizontalPadding,
+ vertical: verticalPadding,
+ ),
+ child: Align(
+ alignment: Alignment.topCenter,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: 520,
+ minHeight: availableHeight > 0 ? availableHeight : 0,
+ ),
+ child: SizedBox(
+ width: double.infinity,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ mainAxisSize: MainAxisSize.min,
+ children: [
// ── Logo + Tagline ──
FadeTransition(
opacity: _fadeAnim,
@@ -703,32 +721,34 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
- const SizedBox(height: 8),
- const Divider(height: 1),
- const SizedBox(height: 4),
- Text(l.loginSelfSignedCertificates, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: cs.onSurfaceVariant.withValues(alpha: 0.7))),
- Row(
- children: [
- Expanded(
- child: Text(
- l.loginTrustAllCertificates,
- style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ if (!AppPlatform.isWeb) ...[
+ const SizedBox(height: 8),
+ const Divider(height: 1),
+ const SizedBox(height: 4),
+ Text(l.loginSelfSignedCertificates, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: cs.onSurfaceVariant.withValues(alpha: 0.7))),
+ Row(
+ children: [
+ Expanded(
+ child: Text(
+ l.loginTrustAllCertificates,
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ ),
),
- ),
- Transform.scale(
- scale: 0.8,
- child: Switch(
- value: _trustAllCerts,
- onChanged: (v) async {
- setState(() => _trustAllCerts = v);
- await PlayerSettings.setTrustAllCerts(v);
- applyTrustAllCerts(v);
- _revalidateServer();
- },
+ Transform.scale(
+ scale: 0.8,
+ child: Switch(
+ value: _trustAllCerts,
+ onChanged: (v) async {
+ setState(() => _trustAllCerts = v);
+ await PlayerSettings.setTrustAllCerts(v);
+ applyTrustAllCerts(v);
+ _revalidateServer();
+ },
+ ),
),
- ),
- ],
- ),
+ ],
+ ),
+ ],
const SizedBox(height: 8),
const Divider(height: 1),
const SizedBox(height: 8),
@@ -794,20 +814,21 @@ class _LoginScreenState extends State<LoginScreen>
spacing: 8,
runSpacing: 8,
children: [
- ActionChip(
- avatar: Icon(Icons.restore_rounded, size: 16,
- color: cs.onSurfaceVariant.withValues(alpha: 0.6)),
- label: Text(l.loginRestoreFromBackup,
- style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.6),
- )),
- backgroundColor: cs.surfaceContainerHighest.withValues(alpha: 0.3),
- side: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.15)),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
+ if (!AppPlatform.isWeb)
+ ActionChip(
+ avatar: Icon(Icons.restore_rounded, size: 16,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.6)),
+ label: Text(l.loginRestoreFromBackup,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.6),
+ )),
+ backgroundColor: cs.surfaceContainerHighest.withValues(alpha: 0.3),
+ side: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.15)),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ ),
+ onPressed: _restoreFromBackup,
),
- onPressed: _restoreFromBackup,
- ),
ActionChip(
key: const Key('paste-login-link'),
avatar: Icon(Icons.content_paste_rounded, size: 16,
@@ -831,13 +852,16 @@ class _LoginScreenState extends State<LoginScreen>
// ── Saved accounts quick-switch ──
_buildSavedAccounts(cs, tt),
- ],
- ),
- ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ },
),
),
),
- ),
);
}
@@ -927,6 +951,8 @@ class _LoginScreenState extends State<LoginScreen>
}
Future<void> _restoreFromBackup() async {
+ if (AppPlatform.isWeb) return;
+
try {
final result = await FilePicker.platform.pickFiles(type: FileType.any);
if (result == null || result.files.isEmpty) return;
@@ -1338,7 +1364,8 @@ class _LoginScreenState extends State<LoginScreen>
duration: const Duration(milliseconds: 350),
curve: Curves.easeOutCubic,
alignment: Alignment.topCenter,
- child: _serverValid && _oidcConfig != null && _oidcConfig!.enabled
+ child: !AppPlatform.isWeb &&
+ _serverValid && _oidcConfig != null && _oidcConfig!.enabled
? _buildOidcButton(cs, tt)
: const SizedBox.shrink(),
),
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index f635c261..5d64418f 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -43,11 +43,169 @@ import '../widgets/overlay_toast.dart';
import '../widgets/tips_sheet.dart';
import '../widgets/feature_hint.dart';
import '../widgets/welcome_sheet.dart';
+import '../utils/app_platform.dart';
import '../widgets/rmab_config_sheet.dart';
import '../widgets/server_connection_editor.dart';
import '../widgets/server_admin_status_badges.dart';
import '../l10n/app_localizations.dart';
+class _SettingsSectionDestination {
+ final String id;
+ final IconData icon;
+ final String label;
+
+ const _SettingsSectionDestination(this.id, this.icon, this.label);
+}
+
+Future<T?> _showAdaptiveSettingsSurface<T>({
+ required BuildContext context,
+ required Widget Function(BuildContext context, bool desktopMode) builder,
+ double maxWidth = 620,
+}) {
+ final desktopMode =
+ AppPlatform.isWeb && MediaQuery.sizeOf(context).width >= 960;
+ final cs = Theme.of(context).colorScheme;
+ if (desktopMode) {
+ return showDialog<T>(
+ context: context,
+ builder: (dialogContext) => Dialog(
+ backgroundColor: cs.surfaceContainerHigh,
+ clipBehavior: Clip.antiAlias,
+ insetPadding: const EdgeInsets.all(24),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ side: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.4)),
+ ),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: maxWidth,
+ maxHeight: MediaQuery.sizeOf(dialogContext).height * 0.86,
+ ),
+ child: builder(dialogContext, true),
+ ),
+ ),
+ );
+ }
+ return showModalBottomSheet<T>(
+ context: context,
+ isScrollControlled: true,
+ useSafeArea: true,
+ backgroundColor: cs.surfaceContainerHigh,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
+ ),
+ builder: (sheetContext) => builder(sheetContext, false),);
+}
+
+class _SettingsAdaptiveFrame extends StatelessWidget {
+ final bool desktopMode;
+ final String? selectedSection;
+ final List<_SettingsSectionDestination> destinations;
+ final ValueChanged<String> onSectionSelected;
+ final Widget child;
+
+ const _SettingsAdaptiveFrame({
+ required this.desktopMode,
+ required this.selectedSection,
+ required this.destinations,
+ required this.onSectionSelected,
+ required this.child,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ if (!desktopMode) return child;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ SizedBox(
+ width: 224,
+ child: Material(
+ color: cs.surface.withValues(alpha: 0.38),
+ child: ListView(
+ padding: const EdgeInsets.fromLTRB(14, 20, 14, 20),
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
+ child: Text(
+ AppLocalizations.of(context)!.settingsTitle,
+ style: tt.labelMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontWeight: FontWeight.w700,
+ letterSpacing: 0.8,
+ ),
+ ),
+ ),
+ for (final destination in destinations)
+ Padding(
+ padding: const EdgeInsets.only(bottom: 4),
+ child: Material(
+ color: selectedSection == destination.id
+ ? cs.primary.withValues(alpha: 0.14)
+ : Colors.transparent,
+ borderRadius: BorderRadius.circular(11),
+ clipBehavior: Clip.antiAlias,
+ child: InkWell(
+ onTap: () => onSectionSelected(destination.id),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 11,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ destination.icon,
+ size: 19,
+ color: selectedSection == destination.id
+ ? cs.primary
+ : cs.onSurfaceVariant,
+ ),
+ const SizedBox(width: 11),
+ Expanded(
+ child: Text(
+ destination.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: tt.bodyMedium?.copyWith(
+ color: selectedSection == destination.id
+ ? cs.onSurface
+ : cs.onSurfaceVariant,
+ fontWeight:
+ selectedSection == destination.id
+ ? FontWeight.w700
+ : FontWeight.w500,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ VerticalDivider(
+ width: 1,
+ thickness: 1,
+ color: cs.outlineVariant.withValues(alpha: 0.35),
+ ),
+ Expanded(child: Align(
+ alignment: Alignment.topCenter, child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 880),
+ child: SizedBox.expand(child: child),
+ ),
+ ),),
+ ],
+ );
+ }
+}
+
class SettingsScreen extends StatefulWidget {
const SettingsScreen({super.key});
@@ -184,6 +342,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
AutoSleepSettings _autoSleepSettings = const AutoSleepSettings();
String _appVersion = '';
String? _expandedSection;
+ final ScrollController _settingsScrollController = ScrollController();
final Map<String, GlobalKey> _sectionKeys = {};
GlobalKey _keyFor(String section) => _sectionKeys.putIfAbsent(section, () => GlobalKey());
@@ -202,7 +361,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Future.delayed(const Duration(milliseconds: 350), () {
final ctx = _keyFor(section).currentContext;
if (ctx != null && mounted) {
- Scrollable.ensureVisible(ctx, duration: const Duration(milliseconds: 250), curve: Curves.easeOut, alignment: 0.3);
+ Scrollable.ensureVisible(ctx, duration: const Duration(milliseconds: 250), curve: Curves.easeOut, alignment: 0.3,);
}
});
}
@@ -229,7 +388,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
void _onServerItemsChanged() {
if (!mounted || !context.read<AuthProvider>().isAdmin) return;
_issueBadgeDebounce?.cancel();
- _issueBadgeDebounce = Timer(const Duration(seconds: 3), _loadAdminIssueCount);
+ _issueBadgeDebounce = Timer(const Duration(seconds: 3), _loadAdminIssueCount,);
}
/// Sum missing/invalid item counts across all libraries so the Server Admin
@@ -256,7 +415,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Future<void> _loadServerUpdate(String currentVersion) async {
_serverUpdateCheckedFor = currentVersion;
_serverUpdateCheckRunning = true;
- final update = await AudiobookshelfUpdateService.check(currentVersion: currentVersion);
+ final update = await AudiobookshelfUpdateService.check(currentVersion: currentVersion,);
_serverUpdateCheckRunning = false;
if (!mounted || _serverUpdateCheckedFor != currentVersion) return;
setState(() => _serverUpdate = update);
@@ -268,6 +427,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_issueBadgeDebounce?.cancel();
PlayerSettings.settingsChanged.removeListener(_onExternalSettingsChange);
_localServerController.dispose();
+ _settingsScrollController.dispose();
super.dispose();
}
@@ -290,7 +450,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (!mounted) return;
final l = AppLocalizations.of(context)!;
showOverlayToast(context, l.queueModePlaylistHint,
- icon: Icons.playlist_play_rounded);
+ icon: Icons.playlist_play_rounded,);
return;
}
await PlayerSettings.setQueueModePlaylist(id);
@@ -382,10 +542,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
gradient: const SweepGradient(colors: [
Color(0xFFFF0000), Color(0xFFFFFF00), Color(0xFF00FF00),
Color(0xFF00FFFF), Color(0xFF0000FF), Color(0xFFFF00FF), Color(0xFFFF0000),
- ]),
+ ],),
border: Border.all(color: cs.outlineVariant),
),
- child: Icon(Icons.add_rounded, size: 20, color: Colors.white.withValues(alpha: 0.9)),
+ child: Icon(Icons.add_rounded, size: 20, color: Colors.white.withValues(alpha: 0.9),),
),
),
),
@@ -393,7 +553,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
- Widget _swatch({required Color color, required bool selected, required String tooltip, required VoidCallback onTap}) {
+ Widget _swatch({required Color color, required bool selected, required String tooltip, required VoidCallback onTap,}) {
final cs = Theme.of(context).colorScheme;
return Tooltip(
message: tooltip,
@@ -413,7 +573,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
child: selected
? Icon(Icons.check_rounded, size: 20,
- color: ThemeData.estimateBrightnessForColor(color) == Brightness.dark ? Colors.white : Colors.black)
+ color: ThemeData.estimateBrightnessForColor(color) == Brightness.dark ? Colors.white : Colors.black,)
: null,
),
),
@@ -436,7 +596,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
actions: [
- TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel)),
+ TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel),),
FilledButton(
onPressed: () {
_setManualColor(picked.withValues(alpha: 1.0).toARGB32());
@@ -451,9 +611,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
Widget _statsStepperRow(ColorScheme cs, TextTheme tt, String label, String value,
- {VoidCallback? onMinus, VoidCallback? onPlus, VoidCallback? onTapValue}) {
+ {VoidCallback? onMinus, VoidCallback? onPlus, VoidCallback? onTapValue,}) {
return Row(children: [
- Expanded(child: Text(label, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant))),
+ Expanded(child: Text(label, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
+ ),),
IconButton(
onPressed: _loaded ? onMinus : null,
icon: const Icon(Icons.remove_circle_outline_rounded),
@@ -469,7 +630,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.symmetric(vertical: 6),
child: Text(value,
textAlign: TextAlign.center,
- style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w700)),
+ style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w700),),
),
),
),
@@ -479,7 +640,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
color: cs.primary,
visualDensity: VisualDensity.compact,
),
- ]);
+ ],);
}
String _statsMinutesLabel(AppLocalizations l, int minutes) {
@@ -522,8 +683,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
onSubmitted: (v) => Navigator.pop(ctx, v),
),
actions: [
- TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel)),
- FilledButton(onPressed: () => Navigator.pop(ctx, ctrl.text), child: Text(l.save)),
+ TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel),),
+ FilledButton(onPressed: () => Navigator.pop(ctx, ctrl.text), child: Text(l.save),),
],
),
);
@@ -531,7 +692,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Future<void> _editStatsTimeTarget() async {
final l = AppLocalizations.of(context)!;
- final input = await _promptStatsValue(l.statsGoalEnterTimeHint, TextInputType.datetime);
+ final input = await _promptStatsValue(l.statsGoalEnterTimeHint, TextInputType.datetime,);
if (input == null) return;
final minutes = _parseGoalMinutes(input);
if (minutes == null) return;
@@ -615,7 +776,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
leading: Icon(_statsSectionIcon(id), size: 18,
color: isHidden
? cs.onSurfaceVariant.withValues(alpha: 0.3)
- : cs.onSurfaceVariant),
+ : cs.onSurfaceVariant,),
title: Text(_statsSectionLabel(l, id),
style: TextStyle(
fontSize: 13,
@@ -623,7 +784,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
color: isHidden
? cs.onSurface.withValues(alpha: 0.35)
: cs.onSurface,
- )),
+ ),),
trailing: Row(mainAxisSize: MainAxisSize.min, children: [
GestureDetector(
onTap: () {
@@ -651,10 +812,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.all(8),
child: Icon(Icons.drag_handle_rounded,
size: 18,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),),
),
),
- ]),
+ ],),
),
);
},
@@ -696,7 +857,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (picked > 0) await Permission.notification.request();
}
- Future<void> _pickPodcastTabLibrary(List<Map<String, dynamic>> podcastLibs) async {
+ Future<void> _pickPodcastTabLibrary(List<Map<String, dynamic>> podcastLibs,) async {
final l = AppLocalizations.of(context)!;
final picked = await showDialog<String>(
context: context,
@@ -744,9 +905,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
PlayerSettings.getFullScreenPlayer(), // 21
PlayerSettings.getThemeMode(), // 22
PlayerSettings.getSnappyTransitions(), // 23
- DownloadService().downloadLocationLabel, // 24
- DownloadService().totalDownloadSize, // 25
- DownloadService.getDeviceStorage(), // 26
+ AppPlatform.isWeb
+ ? Future.value('Streaming only')
+ : DownloadService().downloadLocationLabel, // 24
+ AppPlatform.isWeb
+ ? Future.value(0)
+ : DownloadService().totalDownloadSize, // 25
+ AppPlatform.isWeb
+ ? Future<Map<String, int>?>.value(null)
+ : DownloadService.getDeviceStorage(), // 26
AutoSleepSettings.load(), // 27
PackageInfo.fromPlatform(), // 29
PlayerSettings.getStreamingCacheSizeMb(), // 30
@@ -930,7 +1097,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_sleepChimeVolume = chimeVol;
_shakeSensitivity = shakeSens;
_language = language;
- _canPickDownloadLocation = true;
+ _canPickDownloadLocation = !AppPlatform.isWeb;
_statsGoalType = statsGoalType;
_statsGoalMinutes = statsGoalMinutes;
_statsBookGoal = statsBookGoal;
@@ -977,18 +1144,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
final tt = Theme.of(context).textTheme;
final l = AppLocalizations.of(context)!;
- final picked = await showModalBottomSheet<String>(
+ final picked = await _showAdaptiveSettingsSurface<String>(
context: context,
- isScrollControlled: true,
- useSafeArea: true,
- backgroundColor: cs.surfaceContainerLow,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
- ),
- builder: (ctx) => SafeArea(
+ maxWidth: 520,
+ builder: (ctx, desktopMode) => SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
+ if (desktopMode)
+ Align(
+ alignment: Alignment.centerRight,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(8, 6, 8, 0),
+ child: IconButton(
+ tooltip: MaterialLocalizations.of(ctx).closeButtonTooltip,
+ onPressed: () => Navigator.pop(ctx),
+ icon: const Icon(Icons.close_rounded),
+ ),
+ ),
+ )
+ else ...[
const SizedBox(height: 8),
Container(
width: 40, height: 4,
@@ -997,15 +1172,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
borderRadius: BorderRadius.circular(2),
),
),
+ ],
const SizedBox(height: 16),
- Text(l.coverShapeLabel, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
+ Text(l.coverShapeLabel, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
const SizedBox(height: 8),
RadioListTile<String>(
value: 'default',
groupValue: _curLibCoverShape,
onChanged: (v) => Navigator.pop(ctx, v),
title: Text(l.coverShapeDefault),
- subtitle: Text(_rectangleCovers ? l.coverShapeRectangle : l.coverShapeSquare),
+ subtitle: Text(_rectangleCovers ? l.coverShapeRectangle : l.coverShapeSquare,),
),
RadioListTile<String>(
value: 'square',
@@ -1026,10 +1202,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
if (picked == null || picked == _curLibCoverShape) return;
setState(() => _curLibCoverShape = picked);
- await PlayerSettings.setRectangleCoversOverride(libId, picked == 'default' ? null : picked);
+ await PlayerSettings.setRectangleCoversOverride(libId, picked == 'default' ? null : picked,);
}
- static const _shakeSensitivityKeys = ['veryLow', 'low', 'medium', 'high', 'veryHigh'];
+ static const _shakeSensitivityKeys = ['veryLow', 'low', 'medium', 'high', 'veryHigh',];
int _shakeSensitivityIndex(String key) {
final i = _shakeSensitivityKeys.indexOf(key);
@@ -1067,18 +1243,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
final l = AppLocalizations.of(context)!;
const codes = ['', 'en', 'de', 'zh'];
- final picked = await showModalBottomSheet<String>(
+ final picked = await _showAdaptiveSettingsSurface<String>(
context: context,
- isScrollControlled: true,
- useSafeArea: true,
- backgroundColor: cs.surfaceContainerLow,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
- ),
- builder: (ctx) => SafeArea(
+ maxWidth: 520,
+ builder: (ctx, desktopMode) => SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
+ if (desktopMode)
+ Align(
+ alignment: Alignment.centerRight,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(8, 6, 8, 0),
+ child: IconButton(
+ tooltip: MaterialLocalizations.of(ctx).closeButtonTooltip,
+ onPressed: () => Navigator.pop(ctx),
+ icon: const Icon(Icons.close_rounded),
+ ),
+ ),
+ )
+ else ...[
const SizedBox(height: 8),
Container(
width: 40, height: 4,
@@ -1087,9 +1271,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
borderRadius: BorderRadius.circular(2),
),
),
+ ],
const SizedBox(height: 16),
Text(l.languageLabel,
- style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
const SizedBox(height: 8),
for (final code in codes)
RadioListTile<String>(
@@ -1136,12 +1321,13 @@ class _SettingsScreenState extends State<SettingsScreen> {
builder: (ctx) => AlertDialog(
title: Text(title),
content: Text(content),
- actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt))],
+ actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt),
+ ),],
),
),
child: Padding(
padding: const EdgeInsets.only(left: 4),
- child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant),
+ child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant,),
),
);
}
@@ -1161,15 +1347,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
: l.sleepTimerSheetMinShort(m);
}
- Future<void> _saveLocalServerUrl(AuthProvider auth, AppLocalizations l) async {
+ Future<void> _saveLocalServerUrl(AuthProvider auth, AppLocalizations l,) async {
final url = _localServerController.text.trim();
if (url.isEmpty) return;
_localServerUrl = url;
- await auth.setLocalServerConfig(enabled: _localServerEnabled, url: _localServerUrl);
+ await auth.setLocalServerConfig(enabled: _localServerEnabled, url: _localServerUrl,);
if (!mounted) return;
FocusScope.of(context).unfocus();
showOverlayToast(context, l.localServerUrlSetSnackbar,
- icon: Icons.check_circle_outline_rounded);
+ icon: Icons.check_circle_outline_rounded,);
await auth.checkLocalServer();
if (mounted) setState(() {});
}
@@ -1210,55 +1396,120 @@ class _SettingsScreenState extends State<SettingsScreen> {
end: Alignment.bottomCenter,
stops: const [0.0, 0.35, 1.0],
colors: [
- cs.primary.withValues(alpha: gradientIntensityNotifier.value),
+ cs.primary.withValues(alpha: gradientIntensityNotifier.value,),
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor,
],
),
),
child: SafeArea(
- child: CustomScrollView(
- slivers: [
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ final isDesktopSettings =
+ AppPlatform.isWeb && constraints.maxWidth >= 960;
+ final expandedSection = _expandedSection ??
+ (isDesktopSettings ? 'Account' : null);
+ final destinations = <_SettingsSectionDestination>[
+ _SettingsSectionDestination(
+ 'Account',
+ Icons.person_outline_rounded,
+ l.userFallback,
+ ),
+ _SettingsSectionDestination(
+ 'Appearance',
+ Icons.palette_outlined,
+ l.sectionAppearance,
+ ),
+ _SettingsSectionDestination(
+ 'Customize Stats',
+ Icons.bar_chart_rounded,
+ l.settingsCustomizeStats,
+ ),
+ _SettingsSectionDestination(
+ 'Absorbing Cards',
+ Icons.style_rounded,
+ Wording.of(context).sectionAbsorbingCards,
+ ),
+ _SettingsSectionDestination(
+ 'Playback',
+ Icons.play_circle_outline_rounded,
+ l.sectionPlayback,
+ ),
+ _SettingsSectionDestination(
+ 'Media Controls',
+ Icons.dvr_rounded,
+ l.sectionMediaControls,
+ ),
+ _SettingsSectionDestination(
+ 'Sleep Timer',
+ Icons.bedtime_outlined,
+ l.sectionSleepTimer,
+ ),
+ _SettingsSectionDestination(
+ 'Library',
+ Icons.auto_stories_outlined,
+ l.sectionLibrary,
+ ),
+ _SettingsSectionDestination(
+ 'Issues & Support',
+ Icons.support_agent_rounded,
+ l.sectionIssuesAndSupport,
+ ),
+ _SettingsSectionDestination(
+ 'Advanced',
+ Icons.tune_rounded,
+ l.sectionAdvanced,
+ ),
+ ];
+ final content = CustomScrollView(
+ controller: _settingsScrollController,
+ slivers: [
SliverToBoxAdapter(
child: AbsorbPageHeader(
title: l.settingsTitle,
+ showBranding: !isDesktopSettings,
padding: const EdgeInsets.fromLTRB(20, 12, 20, 8),
),
),
SliverToBoxAdapter(
child: Column(
children: [
+ if (!isDesktopSettings)
const SizedBox(height: 8),
// ── Tips & Tricks ──
+ if (!isDesktopSettings)
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4,),
child: GestureDetector(
onTap: () => showTipsSheet(context),
child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14,),
decoration: BoxDecoration(
gradient: flatNotifier.value ? null : LinearGradient(
- colors: [cs.primaryContainer, cs.tertiaryContainer],
+ colors: [cs.primaryContainer, cs.tertiaryContainer,],
),
color: flatNotifier.value ? cs.surfaceContainerHigh : null,
borderRadius: BorderRadius.circular(16),
),
child: Row(
children: [
- Icon(Icons.auto_awesome_rounded, color: cs.onPrimaryContainer, size: 22),
+ Icon(Icons.auto_awesome_rounded, color: cs.onPrimaryContainer, size: 22,),
const SizedBox(width: 12),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(l.tipsAndHiddenFeatures, style: tt.titleSmall?.copyWith(
- fontWeight: FontWeight.w600, color: cs.onPrimaryContainer)),
+ fontWeight: FontWeight.w600, color: cs.onPrimaryContainer,
+ ),),
const SizedBox(height: 2),
Text(l.tipsSubtitle, style: tt.bodySmall?.copyWith(
- color: cs.onPrimaryContainer.withValues(alpha: 0.7))),
+ color: cs.onPrimaryContainer.withValues(alpha: 0.7),
+ ),),
],
- )),
- Icon(Icons.chevron_right_rounded, color: cs.onPrimaryContainer.withValues(alpha: 0.5)),
+ ),),
+ Icon(Icons.chevron_right_rounded, color: cs.onPrimaryContainer.withValues(alpha: 0.5,
+ ),),
],
),
),
@@ -1267,7 +1518,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 8),
// ── User Profile ──
+ if (!isDesktopSettings || expandedSection == 'Account')
Padding(
+ key: _keyFor('Account'),
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: GestureDetector(
onTap: () => _showAccountSheet(context),
@@ -1283,49 +1536,53 @@ class _SettingsScreenState extends State<SettingsScreen> {
cs.primary.withValues(alpha: 0.04),
],
),
- border: Border.all(color: cs.primary.withValues(alpha: 0.15)),
+ border: Border.all(color: cs.primary.withValues(alpha: 0.15),),
),
child: Row(children: [
Container(
width: 40, height: 40,
decoration: BoxDecoration(
- color: cs.primary.withValues(alpha: 0.15),
+ color: cs.primary.withValues(alpha: 0.15,),
borderRadius: BorderRadius.circular(12),
),
- child: Icon(Icons.person_rounded, size: 22, color: cs.primary),
+ child: Icon(Icons.person_rounded, size: 22, color: cs.primary,),
),
const SizedBox(width: 14),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(children: [
- Flexible(child: Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700),
- overflow: TextOverflow.ellipsis)),
+ Flexible(child: Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700,),
+ overflow: TextOverflow.ellipsis,
+ ),),
if (auth.isAdmin) ...[
const SizedBox(width: 8),
Container(
- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1,),
decoration: BoxDecoration(
- color: auth.isRoot ? Colors.amber.withValues(alpha: 0.12) : cs.primary.withValues(alpha: 0.12),
- borderRadius: BorderRadius.circular(4),
+ color: auth.isRoot ? Colors.amber.withValues(alpha: 0.12,) : cs.primary.withValues(alpha: 0.12,),
+ borderRadius: BorderRadius.circular(4,),
),
child: Text(auth.isRoot ? l.root : l.admin, style: tt.labelSmall?.copyWith(
- color: auth.isRoot ? Colors.amber : cs.primary, fontWeight: FontWeight.w600, fontSize: 9)),
+ color: auth.isRoot ? Colors.amber : cs.primary, fontWeight: FontWeight.w600, fontSize: 9,
+ ),),
),
],
- ]),
+ ],),
const SizedBox(height: 2),
Text(
- auth.serverUrl?.replaceAll(RegExp(r'^https?://'), '').replaceAll(RegExp(r'/+$'), '') ?? '',
+ auth.serverUrl?.replaceAll(RegExp(r'^https?://'), '',).replaceAll(RegExp(r'/+$'), '',) ?? '',
maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6))),
- ])),
- Icon(Icons.chevron_right_rounded, size: 20, color: cs.primary.withValues(alpha: 0.5)),
- ]),
+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6),
+ ),),
+ ],
+ ),),
+ Icon(Icons.chevron_right_rounded, size: 20, color: cs.primary.withValues(alpha: 0.5),),
+ ],),
),
),
),
// ── Admin Controls ──
- if (auth.isAdmin)
+ if (!isDesktopSettings &&auth.isAdmin)
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
child: Material(
@@ -1336,35 +1593,38 @@ class _SettingsScreenState extends State<SettingsScreen> {
onTap: () async {
await Navigator.push(context, MaterialPageRoute(
builder: (_) => const AdminScreen(),
- ));
+ ),);
_loadAdminIssueCount();
},
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14,),
child: Row(
children: [
- Icon(Icons.admin_panel_settings_rounded, color: cs.primary, size: 22),
+ Icon(Icons.admin_panel_settings_rounded, color: cs.primary, size: 22,),
const SizedBox(width: 14),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(l.serverAdmin, style: tt.titleSmall?.copyWith(
- fontWeight: FontWeight.w600)),
+ fontWeight: FontWeight.w600,
+ ),),
Text(l.serverAdminSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
],
- )),
+ ),),
if (_adminIssueCount > 0 || _serverUpdate != null) ...[
ServerAdminStatusBadges(
issueCount: _adminIssueCount,
updateVersion: _serverUpdate?.latestVersion,
updateTooltip: _serverUpdate == null
? ''
- : l.serverUpdateAvailable(_serverUpdate!.latestVersion),
+ : l.serverUpdateAvailable(_serverUpdate!.latestVersion,),
),
const SizedBox(width: 10),
],
- Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
],
),
),
@@ -1380,29 +1640,32 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.palette_outlined,
title: l.sectionAppearance,
cs: cs,
- isExpanded: _expandedSection == 'Appearance',
+ isExpanded: expandedSection == 'Appearance',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Appearance', v),
children: [
InkWell(
onTap: _loaded ? () => _pickLanguage() : null,
child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
+ padding: const EdgeInsets.fromLTRB(16, 14, 16, 14,),
child: Row(
children: [
- Expanded(child: Text(l.languageLabel, style: tt.titleSmall)),
+ Expanded(child: Text(l.languageLabel, style: tt.titleSmall,
+ ),),
Text(
_languageDisplayName(_language, l),
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,),
),
Icon(Icons.chevron_right_rounded,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
],
),
),
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -1413,9 +1676,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'dark', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeDark, maxLines: 1))),
- ButtonSegment(value: 'light', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeLight, maxLines: 1))),
- ButtonSegment(value: 'system', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeAuto, maxLines: 1))),
+ ButtonSegment(value: 'dark', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeDark, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'light', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeLight, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'system', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeAuto, maxLines: 1,
+ ),
+ ),),
],
selected: {_themeMode},
onSelectionChanged: _loaded ? (selected) {
@@ -1431,8 +1700,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
SwitchListTile.adaptive(
contentPadding: EdgeInsets.zero,
- title: Text(l.flatBackgroundLabel, style: tt.bodyLarge),
- subtitle: Text(l.flatBackgroundSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ title: Text(l.flatBackgroundLabel, style: tt.bodyLarge,),
+ subtitle: Text(l.flatBackgroundSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _flatBackground,
onChanged: _loaded ? (v) {
setState(() => _flatBackground = v);
@@ -1442,16 +1712,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
if (!_flatBackground) ...[
const SizedBox(height: 4),
- Text(l.backgroundIntensityLabel, style: tt.bodyMedium),
+ Text(l.backgroundIntensityLabel, style: tt.bodyMedium,),
Slider(
- value: _gradientIntensity.clamp(0.0, 0.45),
+ value: _gradientIntensity.clamp(0.0, 0.45,),
min: 0.0,
max: 0.45,
onChanged: _loaded ? (v) {
- setState(() => _gradientIntensity = v);
+ setState(() => _gradientIntensity = v,);
applyGradientIntensity(v);
} : null,
- onChangeEnd: (v) => PlayerSettings.setGradientIntensity(v),
+ onChangeEnd: (v) => PlayerSettings.setGradientIntensity(v,),
),
],
],
@@ -1459,25 +1729,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.colorSourceLabel, style: tt.titleSmall),
+ Text(l.colorSourceLabel, style: tt.titleSmall,),
const SizedBox(height: 12),
SizedBox(
width: double.infinity,
child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'dynamic', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceDynamic, maxLines: 1))),
- ButtonSegment(value: 'manual', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceManual, maxLines: 1))),
+ ButtonSegment(value: 'dynamic', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceDynamic, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'manual', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceManual, maxLines: 1,
+ ),
+ ),),
],
selected: {_colorSource},
onSelectionChanged: _loaded ? (selected) {
final src = selected.first;
- setState(() => _colorSource = src);
- PlayerSettings.setColorSource(src);
+ setState(() => _colorSource = src,);
+ PlayerSettings.setColorSource(src,);
applyColorSource(src);
} : null,
style: const ButtonStyle(
@@ -1488,19 +1762,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 6),
Text(
_colorSource == 'manual' ? l.colorSourceManualDescription : l.colorSourceCoverDescription,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
if (_colorSource == 'manual') ...[
const SizedBox(height: 14),
_buildColorSwatches(cs),
SwitchListTile.adaptive(
contentPadding: EdgeInsets.zero,
- title: Text(l.useColorEverywhereLabel, style: tt.bodyLarge),
- subtitle: Text(l.useColorEverywhereSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ title: Text(l.useColorEverywhereLabel, style: tt.bodyLarge,),
+ subtitle: Text(l.useColorEverywhereSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _useColorEverywhere,
onChanged: _loaded ? (v) {
- setState(() => _useColorEverywhere = v);
- PlayerSettings.setUseColorEverywhere(v);
+ setState(() => _useColorEverywhere = v,);
+ PlayerSettings.setUseColorEverywhere(v,);
applyUseColorEverywhere(v);
} : null,
),
@@ -1510,15 +1785,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.startScreenLabel, style: tt.titleSmall),
+ Text(l.startScreenLabel, style: tt.titleSmall,),
const SizedBox(height: 4),
Text(
l.startScreenSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
const SizedBox(height: 12),
SizedBox(
@@ -1526,16 +1801,24 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<int>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenHome, maxLines: 1))),
- ButtonSegment(value: 1, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenLibrary, maxLines: 1))),
- ButtonSegment(value: 2, label: FittedBox(fit: BoxFit.scaleDown, child: Text(Wording.of(context).startScreenAbsorb, maxLines: 1))),
- ButtonSegment(value: 3, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenStats, maxLines: 1))),
+ ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenHome, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 1, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenLibrary, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 2, label: FittedBox(fit: BoxFit.scaleDown, child: Text(Wording.of(context,).startScreenAbsorb, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 3, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenStats, maxLines: 1,
+ ),
+ ),),
],
selected: {_startScreen},
onSelectionChanged: _loaded ? (selected) {
final idx = selected.first;
- setState(() => _startScreen = idx);
- PlayerSettings.setStartScreen(idx);
+ setState(() => _startScreen = idx,);
+ PlayerSettings.setStartScreen(idx,);
} : null,
style: const ButtonStyle(
visualDensity: VisualDensity.compact,
@@ -1547,26 +1830,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.progressTextSize, style: tt.titleSmall),
+ Text(l.progressTextSize, style: tt.titleSmall,),
const SizedBox(height: 12),
SizedBox(
width: double.infinity,
child: SegmentedButton<double>(
showSelectedIcon: false,
segments: const [
- ButtonSegment(value: 1.0, label: Text('A', style: TextStyle(fontSize: 13))),
- ButtonSegment(value: 1.5, label: Text('A', style: TextStyle(fontSize: 17))),
- ButtonSegment(value: 2.0, label: Text('A', style: TextStyle(fontSize: 21))),
+ ButtonSegment(value: 1.0, label: Text('A', style: TextStyle(fontSize: 13),
+ ),),
+ ButtonSegment(value: 1.5, label: Text('A', style: TextStyle(fontSize: 17),
+ ),),
+ ButtonSegment(value: 2.0, label: Text('A', style: TextStyle(fontSize: 21),
+ ),),
],
selected: {_progressTextScale},
onSelectionChanged: _loaded ? (selected) {
final v = selected.first;
- setState(() => _progressTextScale = v);
- PlayerSettings.setProgressTextScale(v);
+ setState(() => _progressTextScale = v,);
+ PlayerSettings.setProgressTextScale(v,);
} : null,
style: const ButtonStyle(
visualDensity: VisualDensity.compact,
@@ -1581,7 +1867,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.disablePageFade),
subtitle: Text(
_snappyTransitions ? l.disablePageFadeOnSubtitle : l.disablePageFadeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _snappyTransitions,
onChanged: _loaded ? (v) {
setState(() => _snappyTransitions = v);
@@ -1594,7 +1881,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.rectangleBookCovers),
subtitle: Text(
_rectangleCovers ? l.rectangleBookCoversOnSubtitle : l.rectangleBookCoversOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _rectangleCovers,
onChanged: _loaded ? (v) {
setState(() => _rectangleCovers = v);
@@ -1608,7 +1896,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_classicWording
? 'Using "Play", "Now Playing", "Finished"'
: 'Using "Absorb", "Absorbing", "Fully Absorbed"',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _classicWording,
onChanged: _loaded ? (v) {
setState(() => _classicWording = v);
@@ -1618,15 +1907,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
// iPadOS ignores orientation preferences for multitasking
// apps, so the lock can't work there - hide it on iPad.
- if (!(Platform.isIOS && MediaQuery.sizeOf(context).shortestSide >= 600)) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ if (!AppPlatform.isWeb &&
+ !(AppPlatform.isIOS && MediaQuery.sizeOf(context).shortestSide >= 600)) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: const Text('Lock rotation'),
subtitle: Text(
_lockPortrait
? 'Screen stays in portrait'
: 'Screen can rotate with the device',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _lockPortrait,
onChanged: _loaded ? (v) {
setState(() => _lockPortrait = v);
@@ -1637,6 +1928,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
],
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Appearance')
const SizedBox(height: 16),
// ── Customize Stats ──
@@ -1645,11 +1938,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.bar_chart_rounded,
title: l.settingsCustomizeStats,
cs: cs,
- isExpanded: _expandedSection == 'Customize Stats',
+ isExpanded: expandedSection == 'Customize Stats',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Customize Stats', v),
children: [
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -1660,17 +1954,25 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'off', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalOff, maxLines: 1))),
- ButtonSegment(value: 'daily', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalDaily, maxLines: 1))),
- ButtonSegment(value: 'weekly', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalWeekly, maxLines: 1))),
- ButtonSegment(value: 'monthly', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalMonthly, maxLines: 1))),
+ ButtonSegment(value: 'off', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalOff, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'daily', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalDaily, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'weekly', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalWeekly, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'monthly', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsGoalMonthly, maxLines: 1,
+ ),
+ ),),
],
selected: {_statsGoalType},
onSelectionChanged: _loaded ? (selected) {
- setState(() => _statsGoalType = selected.first);
- PlayerSettings.setStatsGoalType(_statsGoalType);
+ setState(() => _statsGoalType = selected.first,);
+ PlayerSettings.setStatsGoalType(_statsGoalType,);
} : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,),
),
),
if (_statsGoalType != 'off')
@@ -1679,47 +1981,47 @@ class _SettingsScreenState extends State<SettingsScreen> {
onTapValue: _editStatsTimeTarget,
onMinus: _statsGoalMinutes > 5
? () {
- setState(() => _statsGoalMinutes -= 5);
- PlayerSettings.setStatsGoalMinutes(_statsGoalMinutes);
+ setState(() => _statsGoalMinutes -= 5,);
+ PlayerSettings.setStatsGoalMinutes(_statsGoalMinutes,);
}
: null,
onPlus: _statsGoalMinutes < 600
? () {
- setState(() => _statsGoalMinutes += 5);
- PlayerSettings.setStatsGoalMinutes(_statsGoalMinutes);
+ setState(() => _statsGoalMinutes += 5,);
+ PlayerSettings.setStatsGoalMinutes(_statsGoalMinutes,);
}
- : null),
+ : null,),
],
),
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.statsBookChallengeTitle, style: tt.titleSmall),
+ Text(l.statsBookChallengeTitle, style: tt.titleSmall,),
_statsStepperRow(cs, tt, l.statsBookChallengeDesc,
_statsBookGoal == 0 ? l.statsGoalOff : l.statsBooksShort(_statsBookGoal),
onTapValue: _editStatsBookTarget,
onMinus: _statsBookGoal > 0
? () {
setState(() => _statsBookGoal--);
- PlayerSettings.setStatsBookGoal(_statsBookGoal);
+ PlayerSettings.setStatsBookGoal(_statsBookGoal,);
}
: null,
onPlus: _statsBookGoal < 500
? () {
setState(() => _statsBookGoal++);
- PlayerSettings.setStatsBookGoal(_statsBookGoal);
+ PlayerSettings.setStatsBookGoal(_statsBookGoal,);
}
- : null),
+ : null,),
],
),
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -1730,15 +2032,19 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'bar', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartBar, maxLines: 1))),
- ButtonSegment(value: 'line', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartLine, maxLines: 1))),
+ ButtonSegment(value: 'bar', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartBar, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 'line', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartLine, maxLines: 1,
+ ),
+ ),),
],
selected: {_statsChartStyle},
onSelectionChanged: _loaded ? (selected) {
- setState(() => _statsChartStyle = selected.first);
- PlayerSettings.setStatsChartStyle(_statsChartStyle);
+ setState(() => _statsChartStyle = selected.first,);
+ PlayerSettings.setStatsChartStyle(_statsChartStyle,);
} : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,),
),
),
const SizedBox(height: 8),
@@ -1747,15 +2053,19 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<int>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 7, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays7, maxLines: 1))),
- ButtonSegment(value: 30, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays30, maxLines: 1))),
+ ButtonSegment(value: 7, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays7, maxLines: 1,
+ ),
+ ),),
+ ButtonSegment(value: 30, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays30, maxLines: 1,
+ ),
+ ),),
],
selected: {_statsChartRange},
onSelectionChanged: _loaded ? (selected) {
- setState(() => _statsChartRange = selected.first);
- PlayerSettings.setStatsChartRange(_statsChartRange);
+ setState(() => _statsChartRange = selected.first,);
+ PlayerSettings.setStatsChartRange(_statsChartRange,);
} : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,),
),
),
],
@@ -1763,15 +2073,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.statsSectionsTitle, style: tt.titleSmall),
+ Text(l.statsSectionsTitle, style: tt.titleSmall,),
const SizedBox(height: 4),
Text(
l.dragToReorderTapEye,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
const SizedBox(height: 8),
_statsSectionsList(cs, tt, l),
@@ -1780,6 +2090,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Customize Stats')
const SizedBox(height: 16),
// ── Absorbing Cards ──
@@ -1788,14 +2100,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.style_rounded,
title: Wording.of(context).sectionAbsorbingCards,
cs: cs,
- isExpanded: _expandedSection == 'Absorbing Cards',
+ isExpanded: expandedSection == 'Absorbing Cards',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Absorbing Cards', v),
children: [
SwitchListTile(
title: Text(l.fullScreenPlayer),
subtitle: Text(
_fullScreenPlayer ? l.fullScreenPlayerOnSubtitle : l.fullScreenPlayerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _fullScreenPlayer,
onChanged: _loaded ? (v) {
setState(() => _fullScreenPlayer = v);
@@ -1807,7 +2121,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.coverPlayPause),
subtitle: Text(
_coverPlayButton ? l.coverPlayPauseOnSubtitle : l.coverPlayPauseOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _coverPlayButton,
onChanged: _loaded ? (v) {
setState(() => _coverPlayButton = v);
@@ -1816,30 +2131,37 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.cardBackground, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ Text(l.cardBackground, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'blurred', icon: const Icon(Icons.blur_on_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundBlurred))),
- ButtonSegment(value: 'gradient', icon: const Icon(Icons.gradient_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundGradient))),
- ButtonSegment(value: 'off', icon: const Icon(Icons.block_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.off))),
+ ButtonSegment(value: 'blurred', icon: const Icon(Icons.blur_on_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundBlurred,
+ ),
+ ),),
+ ButtonSegment(value: 'gradient', icon: const Icon(Icons.gradient_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundGradient,
+ ),
+ ),),
+ ButtonSegment(value: 'off', icon: const Icon(Icons.block_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.off),
+ ),),
],
selected: {_cardBackground},
onSelectionChanged: _loaded ? (s) {
if (s.isEmpty) return;
- setState(() => _cardBackground = s.first);
- PlayerSettings.setCardBackground(s.first);
+ setState(() => _cardBackground = s.first,);
+ PlayerSettings.setCardBackground(s.first,);
} : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
- )),
- ]),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,
+ ),
+ ),),
+ ],),
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 14),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 14,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -1880,7 +2202,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.speedAdjustedTime),
subtitle: Text(
_speedAdjustedTime ? l.speedAdjustedTimeOnSubtitle : l.speedAdjustedTimeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _speedAdjustedTime,
onChanged: _loaded ? (v) {
setState(() => _speedAdjustedTime = v);
@@ -1899,19 +2222,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
return SwitchListTile(
title: Row(children: [
Flexible(child: Text(w.mergeLibraries)),
- _infoIcon(w.mergeLibrariesInfoTitle, w.mergeLibrariesInfoContent),
- ]),
+ _infoIcon(w.mergeLibrariesInfoTitle, w.mergeLibrariesInfoContent,),
+ ],),
subtitle: Text(
_podcastTabEnabled
? l.settingsMergeImpliedByPodcastTab
: effectiveMerge
? w.mergeLibrariesOnSubtitle
: w.mergeLibrariesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: effectiveMerge,
onChanged: (_loaded && !_podcastTabEnabled) ? (v) async {
- setState(() => _mergeAbsorbingLibraries = v);
- await PlayerSettings.setMergeAbsorbingLibraries(v);
+ setState(() => _mergeAbsorbingLibraries = v,);
+ await PlayerSettings.setMergeAbsorbingLibraries(v,);
unawaited(lib.syncQueueAutoDownloads());
} : null,
);
@@ -1922,7 +2246,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(children: [
- Text(l.queueMode, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ Text(l.queueMode, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
const SizedBox(width: 4),
GestureDetector(
onTap: () => showDialog(
@@ -1933,85 +2258,111 @@ class _SettingsScreenState extends State<SettingsScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.queueModeInfoOff, style: const TextStyle(fontWeight: FontWeight.w600)),
+ Text(l.queueModeInfoOff, style: const TextStyle(fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
Text(l.queueModeInfoOffDesc),
const SizedBox(height: 12),
- Text(l.queueModeInfoManual, style: const TextStyle(fontWeight: FontWeight.w600)),
+ Text(l.queueModeInfoManual, style: const TextStyle(fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
- Text(Wording.of(ctx).queueModeInfoManualDesc),
+ Text(Wording.of(ctx,).queueModeInfoManualDesc,),
const SizedBox(height: 12),
- Text(l.queueModeInfoSeries, style: const TextStyle(fontWeight: FontWeight.w600)),
+ Text(l.queueModeInfoSeries, style: const TextStyle(fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
Text(l.queueModeInfoSeriesDesc),
const SizedBox(height: 12),
- Text(l.queueModeInfoPlaylist, style: const TextStyle(fontWeight: FontWeight.w600)),
+ Text(l.queueModeInfoPlaylist, style: const TextStyle(fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
- Text(l.queueModeInfoPlaylistDesc),
+ Text(l.queueModeInfoPlaylistDesc,),
],
),
- actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt))],
+ actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt),
+ ),],
),
),
- child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant),
+ child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant,),
),
- ]),
+ ],),
const SizedBox(height: 8),
// When libraries are merged, show a single unified control
if (_mergeAbsorbingLibraries || _podcastTabEnabled) ...[
Text(l.queueModeMergedSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff))),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual))),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeAuto))),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist))),
+ ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
+ ),),
+ ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
+ ),),
+ ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeAuto),
+ ),),
+ ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist),
+ ),),
],
selected: {_mergedQueueMode},
onSelectionChanged: _loaded
? (s) { if (s.isNotEmpty) _setMergedQueueMode(s.first); }
: null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
- )),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,
+ ),
+ ),),
] else ...[
// Separate controls per type
- Text(l.queueModeBooks, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
+ Text(l.queueModeBooks, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
SizedBox(width: double.infinity, child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff))),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual))),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeSeriesLabel))),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist))),
+ ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
+ ),),
+ ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
+ ),),
+ ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeSeriesLabel,
+ ),
+ ),),
+ ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist),
+ ),),
],
selected: {_bookQueueMode},
onSelectionChanged: _loaded
? (s) { if (s.isNotEmpty) _setBookQueueMode(s.first); }
: null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
- )),
- if (lib.libraries.any((lib) => lib['mediaType'] == 'podcast')) ...[
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,
+ ),
+ ),),
+ if (lib.libraries.any((lib) => lib['mediaType'] == 'podcast',)) ...[
const SizedBox(height: 8),
- Text(l.queueModePodcasts, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600)),
+ Text(l.queueModePodcasts, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 4),
SizedBox(width: double.infinity, child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff))),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual))),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeShowLabel))),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist))),
+ ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
+ ),),
+ ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
+ ),),
+ ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeShowLabel,
+ ),
+ ),),
+ ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist,
+ ),
+ ),),
],
selected: {_podcastQueueMode},
onSelectionChanged: _loaded
- ? (s) { if (s.isNotEmpty) _setPodcastQueueMode(s.first); }
+ ? (s) { if (s.isNotEmpty) _setPodcastQueueMode(s.first,); }
: null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact),
- )),
+ style: const ButtonStyle(visualDensity: VisualDensity.compact,
+ ),
+ ),),
],
],
if (_bookQueueMode != 'off' || _podcastQueueMode != 'off') ...[
@@ -2020,50 +2371,55 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.autoDownloadQueue),
subtitle: Text(
_queueAutoDownload
- ? l.autoDownloadQueueOnSubtitle(_rollingDownloadCount)
+ ? l.autoDownloadQueueOnSubtitle(_rollingDownloadCount,)
: l.autoDownloadQueueOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _queueAutoDownload,
onChanged: _loaded ? (v) async {
- setState(() => _queueAutoDownload = v);
- await PlayerSettings.setQueueAutoDownload(v);
+ setState(() => _queueAutoDownload = v,);
+ await PlayerSettings.setQueueAutoDownload(v,);
unawaited(lib.syncQueueAutoDownloads());
} : null,
dense: true,
contentPadding: EdgeInsets.zero,
),
],
- ]),
+ ],),
),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10,),
child: Center(child: TextButton.icon(
onPressed: _loaded ? () async {
final confirmed = await showDialog<bool>(
context: context,
builder: (ctx) => AlertDialog(
- title: Text(l.resetButtonGridQuestion),
- content: Text(l.resetButtonGridContent),
+ title: Text(l.resetButtonGridQuestion,),
+ content: Text(l.resetButtonGridContent,),
actions: [
- TextButton(onPressed: () => Navigator.pop(ctx, false), child: Text(l.cancel)),
- TextButton(onPressed: () => Navigator.pop(ctx, true), child: Text(l.reset)),
+ TextButton(onPressed: () => Navigator.pop(ctx, false,), child: Text(l.cancel),),
+ TextButton(onPressed: () => Navigator.pop(ctx, true,), child: Text(l.reset),),
],
),
);
if (confirmed != true || !mounted) return;
- await PlayerSettings.setCardButtonOrder(PlayerSettings.defaultButtonOrder);
- await PlayerSettings.setCardButtonVisibleCount(PlayerSettings.defaultButtonVisibleCount);
- await PlayerSettings.setCardIconsOnly(false);
- await PlayerSettings.setCardMoreInline(false);
- if (mounted) showOverlayToast(context, l.buttonGridReset, icon: Icons.restart_alt_rounded);
+ await PlayerSettings.setCardButtonOrder(PlayerSettings.defaultButtonOrder,);
+ await PlayerSettings.setCardButtonVisibleCount(PlayerSettings.defaultButtonVisibleCount,);
+ await PlayerSettings.setCardIconsOnly(false,);
+ await PlayerSettings.setCardMoreInline(false,);
+ if (mounted) showOverlayToast(context, l.buttonGridReset, icon: Icons.restart_alt_rounded,);
} : null,
- icon: Icon(Icons.restart_alt_rounded, size: 16, color: cs.onSurfaceVariant),
- label: Text(l.resetButtonGrid, style: TextStyle(fontSize: 13, color: cs.onSurfaceVariant)),
- )),
+ icon: Icon(Icons.restart_alt_rounded, size: 16, color: cs.onSurfaceVariant,),
+ label: Text(l.resetButtonGrid, style: TextStyle(fontSize: 13, color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),),
),
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Absorbing Cards')
const SizedBox(height: 16),
// ── Playback ──
@@ -2072,7 +2428,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.play_circle_outline_rounded,
title: l.sectionPlayback,
cs: cs,
- isExpanded: _expandedSection == 'Playback',
+ isExpanded: expandedSection == 'Playback',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Playback', v),
children: [
// Default speed
@@ -2082,26 +2439,30 @@ class _SettingsScreenState extends State<SettingsScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(l.defaultSpeed, style: tt.bodyMedium),
- Text(l.speedValue(_defaultSpeed.toStringAsFixed(2)),
+ Text(l.speedValue(_defaultSpeed.toStringAsFixed(2),),
style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w700, color: cs.primary)),
+ fontWeight: FontWeight.w700, color: cs.primary,
+ ),),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
child: Text(l.defaultSpeedSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11,
+ ),),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
child: Row(children: [
GestureDetector(
- onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed - 0.05) : null,
+ onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed - 0.05,) : null,
child: Container(
width: 36, height: 36,
- decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08)),
- child: Icon(Icons.remove_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7)),
+ decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08,
+ ),),
+ child: Icon(Icons.remove_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7,
+ ),),
),
),
Expanded(child: AbsorbSlider(
@@ -2111,24 +2472,28 @@ class _SettingsScreenState extends State<SettingsScreen> {
divisions: 50,
activeColor: cs.primary,
onChanged: _loaded ? _setDefaultSpeed : null,
- )),
+ ),),
GestureDetector(
- onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed + 0.05) : null,
+ onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed + 0.05,) : null,
child: Container(
width: 36, height: 36,
- decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08)),
- child: Icon(Icons.add_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7)),
+ decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08,
+ ),),
+ child: Icon(Icons.add_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7,
+ ),),
),
),
- ]),
+ ],),
),
Padding(
padding: const EdgeInsets.fromLTRB(52, 0, 52, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('0.5x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
- Text('3.0x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
+ Text('0.5x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
+ ),),
+ Text('3.0x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
+ ),),
],
),
),
@@ -2136,7 +2501,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: Wrap(
spacing: 6, runSpacing: 4,
- children: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0].map((s) {
+ children: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0,].map((s) {
final isActive = (_defaultSpeed - s).abs() < 0.01;
return ActionChip(
label: Text(l.speedValue(s.toString()),
@@ -2144,7 +2509,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
fontSize: 12,
fontWeight: isActive ? FontWeight.w700 : FontWeight.w400,
color: isActive ? cs.onPrimary : cs.onSurface,
- )),
+ ),),
backgroundColor: isActive ? cs.primary : cs.surfaceContainerHighest,
side: BorderSide.none,
onPressed: _loaded ? () => _setDefaultSpeed(s) : null,
@@ -2154,15 +2519,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
ListTile(
- leading: Icon(Icons.refresh_rounded, color: cs.onSurfaceVariant),
+ leading: Icon(Icons.refresh_rounded, color: cs.onSurfaceVariant,),
title: Text(l.resetSpeedPresets),
subtitle: Text(l.resetSpeedPresetsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
onTap: () async {
await PlayerSettings.resetSpeedPresets();
if (!mounted) return;
showOverlayToast(context, l.speedPresetsReset,
- icon: Icons.refresh_rounded);
+ icon: Icons.refresh_rounded,);
},
),
const Divider(height: 1, indent: 16, endIndent: 16),
@@ -2172,9 +2538,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.skipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.skipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Text(l.secondsValue(_backSkip.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2191,9 +2559,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.skipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.skipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Text(l.secondsValue(_forwardSkip.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2207,25 +2577,27 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
SwitchListTile(
title: Row(children: [
- Expanded(child: Text(l.chapterBarrierOnRewind)),
+ Expanded(child: Text(l.chapterBarrierOnRewind),),
GestureDetector(
onTap: () => showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text(l.chapterBarrierInfoTitle),
- content: Text(l.chapterBarrierInfoContent),
- actions: [TextButton(onPressed: () => Navigator.pop(context), child: Text(l.gotIt))],
+ content: Text(l.chapterBarrierInfoContent,),
+ actions: [TextButton(onPressed: () => Navigator.pop(context), child: Text(l.gotIt),
+ ),],
),
),
child: Padding(
padding: const EdgeInsets.all(4),
- child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
),
),
- ]),
+ ],),
subtitle: Text(
_skipChapterBarrier ? l.chapterBarrierOnRewindOnSubtitle : l.chapterBarrierOnRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
value: _skipChapterBarrier,
onChanged: _loaded ? (v) {
@@ -2238,7 +2610,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.longSkipButtons),
subtitle: Text(
_longSkipButtons ? l.longSkipButtonsOnSubtitle : l.longSkipButtonsOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
value: _longSkipButtons,
onChanged: _loaded ? (v) {
@@ -2248,13 +2620,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
if (_longSkipButtons) ...[
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.longSkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.longSkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Text(l.minutesValue(_longBackSkip ~/ 60), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2262,18 +2636,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: (_longBackSkip ~/ 60).toDouble(),
min: 1, max: 10, divisions: 9,
onChanged: _loaded ? (v) {
- setState(() => _longBackSkip = v.round() * 60);
- PlayerSettings.setLongBackSkip(v.round() * 60);
+ setState(() => _longBackSkip = v.round() * 60,);
+ PlayerSettings.setLongBackSkip(v.round() * 60,);
} : null,
),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.longSkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.longSkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Text(l.minutesValue(_longForwardSkip ~/ 60), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2281,8 +2657,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: (_longForwardSkip ~/ 60).toDouble(),
min: 1, max: 10, divisions: 9,
onChanged: _loaded ? (v) {
- setState(() => _longForwardSkip = v.round() * 60);
- PlayerSettings.setLongForwardSkip(v.round() * 60);
+ setState(() => _longForwardSkip = v.round() * 60,);
+ PlayerSettings.setLongForwardSkip(v.round() * 60,);
} : null,
),
],
@@ -2292,9 +2668,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.autoRewindOnResume),
subtitle: Text(
_rewindSettings.enabled
- ? l.autoRewindOnSubtitleFormat(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString())
+ ? l.autoRewindOnSubtitleFormat(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString(),)
: l.autoRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _rewindSettings.enabled,
onChanged: _loaded ? (v) => _saveRewind(
AutoRewindSettings(
@@ -2308,68 +2685,75 @@ class _SettingsScreenState extends State<SettingsScreen> {
) : null,
),
if (_rewindSettings.enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.rewindRange, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
- Text(l.rewindRangeValue(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString()),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.rewindRange, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ Text(l.rewindRangeValue(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString(),),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
AbsorbRangeSlider(
- values: RangeValues(_rewindSettings.minRewind, _rewindSettings.maxRewind),
+ values: RangeValues(_rewindSettings.minRewind, _rewindSettings.maxRewind,),
min: 0, max: 60, divisions: 60,
onChanged: (v) => _saveRewind(AutoRewindSettings(
enabled: true, minRewind: v.start, maxRewind: v.end,
activationDelay: _rewindSettings.activationDelay,
chapterBarrier: _rewindSettings.chapterBarrier,
sessionStartRewind: _rewindSettings.sessionStartRewind,
- )),
+ ),),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: Text(l.rewindAfterPausedFor,
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant))),
- Text(_rewindSettings.activationDelay == 0 ? l.rewindAnyPause : l.rewindActivationDelayValue(_rewindSettings.activationDelay.round().toString()),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),
+ ),),
+ Text(_rewindSettings.activationDelay == 0 ? l.rewindAnyPause : l.rewindActivationDelayValue(_rewindSettings.activationDelay.round().toString(),),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8),
+ padding: const EdgeInsets.symmetric(horizontal: 8,),
child: Slider(
value: _rewindSettings.activationDelay, min: 0, max: 10, divisions: 10,
- label: _rewindSettings.activationDelay == 0 ? l.rewindAlwaysLabel : l.secondsValue(_rewindSettings.activationDelay.round().toString()),
+ label: _rewindSettings.activationDelay == 0 ? l.rewindAlwaysLabel : l.secondsValue(_rewindSettings.activationDelay.round().toString(),),
onChanged: (v) => _saveRewind(AutoRewindSettings(
enabled: true, minRewind: _rewindSettings.minRewind,
maxRewind: _rewindSettings.maxRewind, activationDelay: v,
chapterBarrier: _rewindSettings.chapterBarrier,
sessionStartRewind: _rewindSettings.sessionStartRewind,
- )),
+ ),),
),
),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
child: Text(
_rewindSettings.activationDelay == 0
? l.rewindAlwaysDescription
- : l.rewindAfterDescription(_rewindSettings.activationDelay.round().toString()),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
+ : l.rewindAfterDescription(_rewindSettings.activationDelay.round().toString(),),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11,
+ ),),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Text(l.chapterBarrier),
subtitle: Text(
l.chapterBarrierSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _rewindSettings.chapterBarrier,
onChanged: (v) => _saveRewind(AutoRewindSettings(
enabled: true,
@@ -2378,32 +2762,35 @@ class _SettingsScreenState extends State<SettingsScreen> {
activationDelay: _rewindSettings.activationDelay,
chapterBarrier: v,
sessionStartRewind: _rewindSettings.sessionStartRewind,
- )),
+ ),),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Row(children: [
- Expanded(child: Text(l.rewindOnSessionStart)),
+ Expanded(child: Text(l.rewindOnSessionStart),),
GestureDetector(
onTap: () => showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text(l.rewindOnSessionStart),
- content: Text(l.rewindOnSessionStartInfoContent),
- actions: [TextButton(onPressed: () => Navigator.pop(context), child: Text(l.gotIt))],
+ content: Text(l.rewindOnSessionStartInfoContent,),
+ actions: [TextButton(onPressed: () => Navigator.pop(context), child: Text(l.gotIt),
+ ),],
),
),
child: Padding(
padding: const EdgeInsets.all(4),
- child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
),
),
- ]),
+ ],),
subtitle: Text(
_rewindSettings.sessionStartRewind
- ? l.rewindOnSessionStartOnSubtitle(_rewindSettings.maxRewind.round().toString())
+ ? l.rewindOnSessionStartOnSubtitle(_rewindSettings.maxRewind.round().toString(),)
: l.autoRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _rewindSettings.sessionStartRewind,
onChanged: (v) => _saveRewind(AutoRewindSettings(
enabled: true,
@@ -2412,20 +2799,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
activationDelay: _rewindSettings.activationDelay,
chapterBarrier: _rewindSettings.chapterBarrier,
sessionStartRewind: v,
- )),
+ ),),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 12),
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 12,),
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
- borderRadius: BorderRadius.circular(12)),
+ borderRadius: BorderRadius.circular(12),),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(l.preview, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.preview, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
const SizedBox(height: 4),
..._buildRewindPreviews(cs, tt, l),
],
@@ -2435,6 +2823,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
],
],
),
+ if (!isDesktopSettings || expandedSection == 'Playback')
const SizedBox(height: 16),
// ── Media Controls ──
@@ -2443,24 +2832,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.dvr_rounded,
title: l.sectionMediaControls,
cs: cs,
- isExpanded: _expandedSection == 'Media Controls',
+ isExpanded: expandedSection == 'Media Controls',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Media Controls', v),
children: [
SwitchListTile(
- title: Text(Platform.isIOS
+ title: Text(AppPlatform.isIOS
? l.chapterProgressInNotificationIos
- : l.chapterProgressInNotification),
+ : l.chapterProgressInNotification,),
subtitle: Text(
_notifChapterProgress
- ? (Platform.isIOS
+ ? (AppPlatform.isIOS
? l.chapterProgressOnSubtitleIos
: l.chapterProgressOnSubtitle)
: l.chapterProgressOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _notifChapterProgress,
onChanged: _loaded ? (v) {
setState(() => _notifChapterProgress = v);
- PlayerSettings.setNotificationChapterProgress(v);
+ PlayerSettings.setNotificationChapterProgress(v,);
} : null,
),
const Divider(height: 1, indent: 16, endIndent: 16),
@@ -2470,7 +2861,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.lockSeekBar),
subtitle: Text(
_lockSeekBar ? l.lockSeekBarOnSubtitle : l.lockSeekBarOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _lockSeekBar,
onChanged: _loaded ? (v) {
setState(() => _lockSeekBar = v);
@@ -2479,38 +2871,42 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
// Android only: chooses which pair fills the phone media
// player's two extra slots. iOS uses CarPlay's own buttons.
- if (Platform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: const Text('Duck brief interruptions'),
subtitle: Text(
_duckBriefInterruptions
? 'Notifications and prompts lower the volume instead of pausing'
: 'Notifications and prompts pause playback',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _duckBriefInterruptions,
onChanged: _loaded ? (v) {
- setState(() => _duckBriefInterruptions = v);
- PlayerSettings.setDuckBriefInterruptions(v);
+ setState(() => _duckBriefInterruptions = v,);
+ PlayerSettings.setDuckBriefInterruptions(v,);
} : null,
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Text(l.speedBookmarkInControls),
subtitle: Text(
_notifSpeedBookmark
? l.speedBookmarkOnSubtitle
: l.speedBookmarkOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _notifSpeedBookmark,
onChanged: _loaded ? (v) {
setState(() => _notifSpeedBookmark = v);
- PlayerSettings.setMediaControlsSpeedBookmark(v);
+ PlayerSettings.setMediaControlsSpeedBookmark(v,);
} : null,
),
],
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Media Controls')
const SizedBox(height: 16),
// ── Sleep Timer ──
@@ -2519,12 +2915,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.bedtime_outlined,
title: l.sectionSleepTimer,
cs: cs,
- isExpanded: _expandedSection == 'Sleep Timer',
+ isExpanded: expandedSection == 'Sleep Timer',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Sleep Timer', v),
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
- child: Text(l.shakeDuringSleepTimer, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ child: Text(l.shakeDuringSleepTimer, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
@@ -2533,9 +2931,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: SegmentedButton<String>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 'off', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeOff))),
- ButtonSegment(value: 'addTime', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeAddTime))),
- ButtonSegment(value: 'resetTimer', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeReset))),
+ ButtonSegment(value: 'off', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeOff),
+ ),),
+ ButtonSegment(value: 'addTime', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeAddTime),
+ ),),
+ ButtonSegment(value: 'resetTimer', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeReset),
+ ),),
],
selected: {_shakeMode},
onSelectionChanged: _loaded ? (v) {
@@ -2547,23 +2948,25 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
if (_shakeMode != 'off') ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.shakeSensitivity, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
- Text(_shakeSensitivityLabel(l, _shakeSensitivity),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.shakeSensitivity, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ Text(_shakeSensitivityLabel(l, _shakeSensitivity,),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
AbsorbSlider(
- value: _shakeSensitivityIndex(_shakeSensitivity).toDouble(),
+ value: _shakeSensitivityIndex(_shakeSensitivity,).toDouble(),
min: 0, max: 4, divisions: 4,
onChanged: _loaded ? (v) {
- final key = _shakeSensitivityKey(v.round());
+ final key = _shakeSensitivityKey(v.round(),);
setState(() => _shakeSensitivity = key);
PlayerSettings.setShakeSensitivity(key);
SleepTimerService().restartShakeDetection();
@@ -2572,15 +2975,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 4),
],
if (_shakeMode == 'addTime') ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.shakeAdds, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.shakeAdds, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Text(l.shakeAddsValue(_shakeAddMinutes),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2588,8 +2993,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: _shakeAddMinutes.toDouble(),
min: 1, max: 30, divisions: 29,
onChanged: _loaded ? (v) {
- setState(() => _shakeAddMinutes = v.round());
- PlayerSettings.setShakeAddMinutes(v.round());
+ setState(() => _shakeAddMinutes = v.round(),);
+ PlayerSettings.setShakeAddMinutes(v.round(),);
} : null,
),
const SizedBox(height: 4),
@@ -2601,7 +3006,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_resetSleepOnPause
? l.resetTimerOnPauseOnSubtitle
: l.resetTimerOnPauseOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _resetSleepOnPause,
onChanged: _loaded ? (v) {
setState(() => _resetSleepOnPause = v);
@@ -2613,25 +3019,28 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Row(children: [
Icon(Icons.replay_rounded, size: 18,
- color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant),
+ color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant,),
const SizedBox(width: 10),
Expanded(child: Text(l.sleepTimerSheetRewindOnSleep,
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant))),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),
+ ),),
Text(_rewindLabel(_sleepRewindSeconds, l),
style: tt.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
- color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant)),
- ]),
+ color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant,
+ ),),
+ ],),
),
AbsorbSlider(
- value: (_sleepRewindSeconds / 60).clamp(0.0, _maxRewindMinutes.toDouble()),
+ value: (_sleepRewindSeconds / 60).clamp(0.0, _maxRewindMinutes.toDouble(),),
min: 0,
max: _maxRewindMinutes.toDouble(),
divisions: _maxRewindMinutes,
onChanged: _loaded ? (v) {
final seconds = (v * 60).round();
- setState(() => _sleepRewindSeconds = seconds);
- PlayerSettings.setSleepRewindSeconds(seconds);
+ setState(() => _sleepRewindSeconds = seconds,);
+ PlayerSettings.setSleepRewindSeconds(seconds,);
} : null,
),
Padding(
@@ -2639,9 +3048,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.off, style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
- Text(l.sleepTimerSheetMinShort(_maxRewindMinutes),
- style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
+ Text(l.off, style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
+ ),),
+ Text(l.sleepTimerSheetMinShort(_maxRewindMinutes,),
+ style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
+ ),),
],
),
),
@@ -2650,9 +3061,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: Text(l.fadeVolumeBeforeSleep),
subtitle: Text(
_sleepFadeOut
- ? l.fadeVolumeOnSubtitleDynamic(_sleepFadeDuration)
+ ? l.fadeVolumeOnSubtitleDynamic(_sleepFadeDuration,)
: l.fadeVolumeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _sleepFadeOut,
onChanged: _loaded ? (v) {
setState(() => _sleepFadeOut = v);
@@ -2666,7 +3078,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_sleepChime
? l.chimeBeforeSleepOnSubtitle
: l.chimeBeforeSleepOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _sleepChime,
onChanged: _loaded ? (v) {
setState(() => _sleepChime = v);
@@ -2675,44 +3088,46 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
if (_sleepChime) ...[
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Row(children: [
- Icon(Icons.volume_down_rounded, size: 18, color: cs.onSurfaceVariant),
+ Icon(Icons.volume_down_rounded, size: 18, color: cs.onSurfaceVariant,),
Expanded(child: Slider(
value: _sleepChimeVolume,
min: 0.5, max: 3.0, divisions: 10,
label: '${(_sleepChimeVolume * 100 / 3).round()}%',
onChanged: _loaded ? (v) {
- setState(() => _sleepChimeVolume = v);
- PlayerSettings.setSleepChimeVolume(v);
+ setState(() => _sleepChimeVolume = v,);
+ PlayerSettings.setSleepChimeVolume(v,);
} : null,
- )),
- Icon(Icons.volume_up_rounded, size: 18, color: cs.onSurfaceVariant),
- ]),
+ ),),
+ Icon(Icons.volume_up_rounded, size: 18, color: cs.onSurfaceVariant,),
+ ],),
),
],
if (_sleepFadeOut || _sleepChime) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
title: Text(l.windDownDuration),
subtitle: Text(
- l.windDownDurationSubtitle(_sleepFadeDuration),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ l.windDownDurationSubtitle(_sleepFadeDuration,),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Row(children: [
- Text(l.secondsValue(_sleepFadeDuration.toString()), style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ Text(l.secondsValue(_sleepFadeDuration.toString(),), style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Expanded(child: Slider(
value: _sleepFadeDuration.toDouble(),
min: 10, max: 60, divisions: 10,
- label: l.secondsValue(_sleepFadeDuration.toString()),
+ label: l.secondsValue(_sleepFadeDuration.toString(),),
onChanged: _loaded ? (v) {
- setState(() => _sleepFadeDuration = v.round());
- PlayerSettings.setSleepFadeDuration(v.round());
+ setState(() => _sleepFadeDuration = v.round(),);
+ PlayerSettings.setSleepFadeDuration(v.round(),);
} : null,
- )),
- ]),
+ ),),
+ ],),
),
],
const Divider(height: 1, indent: 16, endIndent: 16),
@@ -2726,57 +3141,61 @@ class _SettingsScreenState extends State<SettingsScreen> {
_autoSleepSettings.endLabel,
_autoSleepSettings.useEndOfChapter
? l.endOfChapterShort
- : l.shakeAddsValue(_autoSleepSettings.durationMinutes))
+ : l.shakeAddsValue(_autoSleepSettings.durationMinutes,
+ ),)
: l.autoSleepTimerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _autoSleepSettings.enabled,
onChanged: _loaded ? (v) {
final updated = _autoSleepSettings.copyWith(enabled: v);
- setState(() => _autoSleepSettings = updated);
+ setState(() => _autoSleepSettings = updated,);
updated.save();
SleepTimerService().updateAutoSleepSettings(updated);
} : null,
),
if (_autoSleepSettings.enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
// Start time picker
ListTile(
title: Text(l.windowStart),
trailing: Text(_autoSleepSettings.startLabel,
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
onTap: () async {
final picked = await showTimePicker(
context: context,
- initialTime: TimeOfDay(hour: _autoSleepSettings.startHour, minute: _autoSleepSettings.startMinute),
+ initialTime: TimeOfDay(hour: _autoSleepSettings.startHour, minute: _autoSleepSettings.startMinute,),
);
if (picked != null) {
- final updated = _autoSleepSettings.copyWith(startHour: picked.hour, startMinute: picked.minute);
- setState(() => _autoSleepSettings = updated);
+ final updated = _autoSleepSettings.copyWith(startHour: picked.hour, startMinute: picked.minute,);
+ setState(() => _autoSleepSettings = updated,);
updated.save();
- SleepTimerService().updateAutoSleepSettings(updated);
+ SleepTimerService().updateAutoSleepSettings(updated,);
}
},
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
// End time picker
ListTile(
title: Text(l.windowEnd),
trailing: Text(_autoSleepSettings.endLabel,
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
onTap: () async {
final picked = await showTimePicker(
context: context,
- initialTime: TimeOfDay(hour: _autoSleepSettings.endHour, minute: _autoSleepSettings.endMinute),
+ initialTime: TimeOfDay(hour: _autoSleepSettings.endHour, minute: _autoSleepSettings.endMinute,),
);
if (picked != null) {
- final updated = _autoSleepSettings.copyWith(endHour: picked.hour, endMinute: picked.minute);
- setState(() => _autoSleepSettings = updated);
+ final updated = _autoSleepSettings.copyWith(endHour: picked.hour, endMinute: picked.minute,);
+ setState(() => _autoSleepSettings = updated,);
updated.save();
- SleepTimerService().updateAutoSleepSettings(updated);
+ SleepTimerService().updateAutoSleepSettings(updated,);
}
},
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
// End of chapter toggle
SwitchListTile(
title: Text(l.endOfChapterShort),
@@ -2784,26 +3203,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
_autoSleepSettings.useEndOfChapter
? l.endOfChapterOnSubtitle
: l.endOfChapterOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _autoSleepSettings.useEndOfChapter,
onChanged: _loaded ? (v) {
final updated = _autoSleepSettings.copyWith(useEndOfChapter: v);
- setState(() => _autoSleepSettings = updated);
+ setState(() => _autoSleepSettings = updated,);
updated.save();
SleepTimerService().updateAutoSleepSettings(updated);
} : null,
),
// Duration slider (only for timed mode)
if (!_autoSleepSettings.useEndOfChapter) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.timerDuration, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
- Text(l.shakeAddsValue(_autoSleepSettings.durationMinutes),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.timerDuration, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ Text(l.shakeAddsValue(_autoSleepSettings.durationMinutes,),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -2811,8 +3233,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: _autoSleepSettings.durationMinutes.toDouble(),
min: 5, max: 120, divisions: 23,
onChanged: _loaded ? (v) {
- final updated = _autoSleepSettings.copyWith(durationMinutes: v.round());
- setState(() => _autoSleepSettings = updated);
+ final updated = _autoSleepSettings.copyWith(durationMinutes: v.round(),);
+ setState(() => _autoSleepSettings = updated,);
updated.save();
SleepTimerService().updateAutoSleepSettings(updated);
} : null,
@@ -2822,163 +3244,178 @@ class _SettingsScreenState extends State<SettingsScreen> {
],
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Sleep Timer')
const SizedBox(height: 16),
// ── Downloads & Storage ──
- CollapsibleSection(
+ if (!AppPlatform.isWeb)
+ CollapsibleSection(
key: _keyFor('Downloads & Storage'),
icon: Icons.download_outlined,
title: l.sectionDownloadsAndStorage,
cs: cs,
- isExpanded: _expandedSection == 'Downloads & Storage',
+ isExpanded:
+ expandedSection == 'Downloads & Storage',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Downloads & Storage', v),
children: [
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
- Text(l.downloadOverWifiOnly, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ Text(l.downloadOverWifiOnly, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<bool>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: true, label: Text(l.downloadOverWifiOnSubtitle)),
- ButtonSegment(value: false, label: Text(l.downloadOverWifiOffSubtitle)),
+ ButtonSegment(value: true, label: Text(l.downloadOverWifiOnSubtitle,
+ ),),
+ ButtonSegment(value: false, label: Text(l.downloadOverWifiOffSubtitle,
+ ),),
],
selected: {_wifiOnlyDownloads},
onSelectionChanged: _loaded ? (v) {
- setState(() => _wifiOnlyDownloads = v.first);
- PlayerSettings.setWifiOnlyDownloads(v.first);
+ setState(() => _wifiOnlyDownloads = v.first,);
+ PlayerSettings.setWifiOnlyDownloads(v.first,);
} : null,
- )),
+ ),),
const SizedBox(height: 8),
],
),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Row(children: [
Flexible(child: Text(l.autoDownloadOnWifi)),
- _infoIcon(l.autoDownloadOnWifiInfoTitle, l.autoDownloadOnWifiInfoContent),
- ]),
+ _infoIcon(l.autoDownloadOnWifiInfoTitle, l.autoDownloadOnWifiInfoContent,),
+ ],),
subtitle: Text(
_autoDownloadOnStream
? l.autoDownloadOnWifiOnSubtitle
: l.autoDownloadOnWifiOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _autoDownloadOnStream,
onChanged: _loaded ? (v) {
- setState(() => _autoDownloadOnStream = v);
- PlayerSettings.setAutoDownloadOnStream(v);
+ setState(() => _autoDownloadOnStream = v,);
+ PlayerSettings.setAutoDownloadOnStream(v,);
} : null,
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: const Text('Auto-download series'),
subtitle: Text(
_autoSeriesDownloadDefault
? 'Starting a book in a series keeps the next books downloaded'
: 'Turn on series downloads yourself from the series menu',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _autoSeriesDownloadDefault,
onChanged: _loaded ? (v) {
- setState(() => _autoSeriesDownloadDefault = v);
- PlayerSettings.setAutoSeriesDownloadDefault(v);
+ setState(() => _autoSeriesDownloadDefault = v,);
+ PlayerSettings.setAutoSeriesDownloadDefault(v,);
} : null,
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
- Text(l.concurrentDownloads, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ Text(l.concurrentDownloads, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<int>(
showSelectedIcon: false,
segments: const [
- ButtonSegment(value: 1, label: Text('1')),
- ButtonSegment(value: 2, label: Text('2')),
- ButtonSegment(value: 3, label: Text('3')),
- ButtonSegment(value: 4, label: Text('4')),
- ButtonSegment(value: 5, label: Text('5')),
+ ButtonSegment(value: 1, label: Text('1'),),
+ ButtonSegment(value: 2, label: Text('2'),),
+ ButtonSegment(value: 3, label: Text('3'),),
+ ButtonSegment(value: 4, label: Text('4'),),
+ ButtonSegment(value: 5, label: Text('5'),),
],
selected: {_maxConcurrentDownloads},
onSelectionChanged: (v) {
- setState(() => _maxConcurrentDownloads = v.first);
- PlayerSettings.setMaxConcurrentDownloads(v.first);
+ setState(() => _maxConcurrentDownloads = v.first,);
+ PlayerSettings.setMaxConcurrentDownloads(v.first,);
},
- )),
+ ),),
const SizedBox(height: 8),
],
),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
title: Text(l.autoDownload),
subtitle: Text(
l.autoDownloadSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- leading: Icon(Icons.downloading_rounded, color: cs.primary),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ leading: Icon(Icons.downloading_rounded, color: cs.primary,),
),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
- Text(l.keepNext, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
- _infoIcon(l.keepNextInfoTitle, l.keepNextInfoContent),
- ]),
+ Text(l.keepNext, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
+ _infoIcon(l.keepNextInfoTitle, l.keepNextInfoContent,),
+ ],),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<int>(
showSelectedIcon: false,
segments: const [
- ButtonSegment(value: 2, label: Text('2')),
- ButtonSegment(value: 3, label: Text('3')),
- ButtonSegment(value: 4, label: Text('4')),
- ButtonSegment(value: 5, label: Text('5')),
+ ButtonSegment(value: 2, label: Text('2'),),
+ ButtonSegment(value: 3, label: Text('3'),),
+ ButtonSegment(value: 4, label: Text('4'),),
+ ButtonSegment(value: 5, label: Text('5'),),
],
selected: {_rollingDownloadCount},
onSelectionChanged: (v) async {
- setState(() => _rollingDownloadCount = v.first);
- await PlayerSettings.setRollingDownloadCount(v.first);
+ setState(() => _rollingDownloadCount = v.first,);
+ await PlayerSettings.setRollingDownloadCount(v.first,);
if (_queueAutoDownload) {
unawaited(lib.syncQueueAutoDownloads());
}
},
- )),
+ ),),
const SizedBox(height: 8),
],
),
),
SwitchListTile(
title: Row(children: [
- Flexible(child: Text(Wording.of(context).deleteAbsorbedDownloads)),
- _infoIcon(Wording.of(context).deleteAbsorbedDownloadsInfoTitle, l.deleteAbsorbedDownloadsInfoContent),
- ]),
+ Flexible(child: Text(Wording.of(context,).deleteAbsorbedDownloads,
+ ),),
+ _infoIcon(Wording.of(context,).deleteAbsorbedDownloadsInfoTitle, l.deleteAbsorbedDownloadsInfoContent,),
+ ],),
subtitle: Text(
_rollingDownloadDeleteFinished
? l.deleteAbsorbedOnSubtitle
: l.deleteAbsorbedOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _rollingDownloadDeleteFinished,
onChanged: _loaded ? (v) {
- setState(() => _rollingDownloadDeleteFinished = v);
- PlayerSettings.setRollingDownloadDeleteFinished(v);
+ setState(() => _rollingDownloadDeleteFinished = v,);
+ PlayerSettings.setRollingDownloadDeleteFinished(v,);
} : null,
),
- const Divider(height: 1, indent: 16, endIndent: 16),
- if (!Platform.isIOS && _canPickDownloadLocation)
+ const Divider(height: 1, indent: 16, endIndent: 16,),
+ if (!AppPlatform.isIOS && _canPickDownloadLocation)
ListTile(
- leading: Icon(Icons.folder_outlined, color: cs.primary),
+ leading: Icon(Icons.folder_outlined, color: cs.primary,),
title: Text(l.downloadLocation),
subtitle: Text(
_downloadLocationLabel,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -2986,63 +3423,71 @@ class _SettingsScreenState extends State<SettingsScreen> {
onTap: () => _pickDownloadLocation(context, cs, tt),
),
if (_totalDownloadSizeBytes > 0 || _deviceTotalBytes > 0) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: Icon(Icons.data_usage_rounded, color: cs.onSurfaceVariant),
+ leading: Icon(Icons.data_usage_rounded, color: cs.onSurfaceVariant,),
title: Text(l.storageUsed),
subtitle: Text(
[
- if (_totalDownloadSizeBytes > 0) l.storageUsedByDownloads(_formatBytes(_totalDownloadSizeBytes)),
- if (_deviceTotalBytes > 0) l.storageFreeOfTotal(_formatBytes(_deviceAvailableBytes), _formatBytes(_deviceTotalBytes)),
+ if (_totalDownloadSizeBytes > 0) l.storageUsedByDownloads(_formatBytes(_totalDownloadSizeBytes),),
+ if (_deviceTotalBytes > 0) l.storageFreeOfTotal(_formatBytes(_deviceAvailableBytes), _formatBytes(_deviceTotalBytes),),
].join('\n'),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
isThreeLine: _totalDownloadSizeBytes > 0 && _deviceTotalBytes > 0,
),
],
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: Icon(Icons.storage_rounded, color: cs.primary),
+ leading: Icon(Icons.storage_rounded, color: cs.primary,),
title: Text(l.manageDownloads),
trailing: const Icon(Icons.chevron_right),
onTap: () => Navigator.push(context,
- MaterialPageRoute(builder: (_) => const DownloadsScreen())),
+ MaterialPageRoute(builder: (_) => const DownloadsScreen(),
+ ),),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 16,),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
Row(children: [
- Text(l.streamingCache, style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
- _infoIcon(l.streamingCacheInfoTitle, l.streamingCacheInfoContent),
- ]),
+ Text(l.streamingCache, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
+ ),),
+ _infoIcon(l.streamingCacheInfoTitle, l.streamingCacheInfoContent,),
+ ],),
const SizedBox(height: 4),
Text(
_streamingCacheSizeMb == 0
? l.streamingCacheOffSubtitle
- : l.streamingCacheOnSubtitle(_streamingCacheSizeMb),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ : l.streamingCacheOnSubtitle(_streamingCacheSizeMb,),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
const SizedBox(height: 8),
SizedBox(width: double.infinity, child: SegmentedButton<int>(
showSelectedIcon: false,
segments: [
- ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.streamingCacheOff))),
- const ButtonSegment(value: 128, label: FittedBox(fit: BoxFit.scaleDown, child: Text('128 MB'))),
- const ButtonSegment(value: 256, label: FittedBox(fit: BoxFit.scaleDown, child: Text('256 MB'))),
- const ButtonSegment(value: 512, label: FittedBox(fit: BoxFit.scaleDown, child: Text('512 MB'))),
+ ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.streamingCacheOff),
+ ),),
+ const ButtonSegment(value: 128, label: FittedBox(fit: BoxFit.scaleDown, child: Text('128 MB'),
+ ),),
+ const ButtonSegment(value: 256, label: FittedBox(fit: BoxFit.scaleDown, child: Text('256 MB'),
+ ),),
+ const ButtonSegment(value: 512, label: FittedBox(fit: BoxFit.scaleDown, child: Text('512 MB'),
+ ),),
],
selected: {_streamingCacheSizeMb},
onSelectionChanged: (v) {
- setState(() => _streamingCacheSizeMb = v.first);
- PlayerSettings.setStreamingCacheSizeMb(v.first);
+ setState(() => _streamingCacheSizeMb = v.first,);
+ PlayerSettings.setStreamingCacheSizeMb(v.first,);
},
- )),
+ ),),
if (_streamingCacheSizeMb > 0) ...[
const SizedBox(height: 8),
TextButton.icon(
- icon: const Icon(Icons.delete_sweep_outlined, size: 18),
+ icon: const Icon(Icons.delete_sweep_outlined, size: 18,),
label: Text(l.clearCache),
onPressed: () async {
try {
@@ -3050,7 +3495,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
} catch (_) {}
if (mounted) {
showOverlayToast(context, l.streamingCacheCleared,
- icon: Icons.delete_outline_rounded);
+ icon: Icons.delete_outline_rounded,);
}
},
),
@@ -3061,6 +3506,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Downloads & Storage')
const SizedBox(height: 16),
// ── Library ──
@@ -3069,13 +3516,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.auto_stories_outlined,
title: l.sectionLibrary,
cs: cs,
- isExpanded: _expandedSection == 'Library',
+ isExpanded: expandedSection == 'Library',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Library', v),
children: [
Consumer<LibraryProvider>(builder: (context, lib, _) {
final podcastLibs = lib.libraries
.whereType<Map<String, dynamic>>()
- .where((l) => (l['mediaType'] as String? ?? 'book') == 'podcast')
+ .where((l) => (l['mediaType'] as String? ?? 'book') == 'podcast',)
.toList();
if (podcastLibs.isEmpty) return const SizedBox.shrink();
final currentName = podcastLibs.firstWhere(
@@ -3086,58 +3534,63 @@ class _SettingsScreenState extends State<SettingsScreen> {
SwitchListTile(
title: Text(l.settingsPodcastTab),
subtitle: Text(l.settingsPodcastTabDesc,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _podcastTabEnabled,
onChanged: _loaded ? (v) async {
var libId = _podcastTabLibraryId;
- if (v && !podcastLibs.any((p) => p['id'] == libId)) {
+ if (v && !podcastLibs.any((p) => p['id'] == libId,)) {
libId = podcastLibs.first['id'] as String;
- await PlayerSettings.setPodcastTabLibraryId(libId);
+ await PlayerSettings.setPodcastTabLibraryId(libId,);
}
setState(() {
_podcastTabEnabled = v;
_podcastTabLibraryId = libId;
});
- await PlayerSettings.setPodcastTabEnabled(v);
+ await PlayerSettings.setPodcastTabEnabled(v,);
} : null,
),
if (_podcastTabEnabled && podcastLibs.length > 1)
ListTile(
- title: Text(l.settingsPodcastTabLibrary),
+ title: Text(l.settingsPodcastTabLibrary,),
subtitle: Text(currentName,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
onTap: () => _pickPodcastTabLibrary(podcastLibs),
),
- if (Platform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
title: Text(l.settingsEpisodeNotifs),
subtitle: Text(
'${l.settingsEpisodeNotifsDesc} - ${_episodeNotifLabel(l)}',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
onTap: _loaded ? _pickEpisodeNotifInterval : null,
),
if (_episodeNotifMinutes > 0)
ListTile(
- title: Text(l.settingsBatteryUnrestricted),
+ title: Text(l.settingsBatteryUnrestricted,),
subtitle: Text(l.settingsBatteryUnrestrictedDesc,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.battery_saver_rounded, color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.battery_saver_rounded, color: cs.onSurfaceVariant,),
onTap: () => Permission.ignoreBatteryOptimizations.request(),
),
],
- const Divider(height: 1, indent: 16, endIndent: 16),
- ]);
- }),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
+ ],);
+ },),
SwitchListTile(
title: Text(l.hideEbookOnlyTitles),
subtitle: Text(
_hideEbookOnly
? l.hideEbookOnlyOnSubtitle
: l.hideEbookOnlyOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _hideEbookOnly,
onChanged: _loaded ? (v) {
setState(() => _hideEbookOnly = v);
@@ -3151,7 +3604,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_showGoodreadsButton
? l.showGoodreadsOnSubtitle
: l.showGoodreadsOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _showGoodreadsButton,
onChanged: _loaded ? (v) {
setState(() => _showGoodreadsButton = v);
@@ -3165,7 +3619,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_showExplicitBadge
? l.showExplicitBadgeOnSubtitle
: l.showExplicitBadgeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _showExplicitBadge,
onChanged: _loaded ? (v) {
setState(() => _showExplicitBadge = v);
@@ -3173,7 +3628,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
} : null,
),
if (lib.libraries.length > 1) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
...lib.libraries
.map((library) {
final id = library['id'] as String;
@@ -3183,64 +3638,68 @@ class _SettingsScreenState extends State<SettingsScreen> {
return ListTile(
leading: Icon(
mediaType == 'podcast' ? Icons.podcasts_rounded : Icons.auto_stories_rounded,
- color: isSelected ? cs.primary : cs.onSurfaceVariant),
+ color: isSelected ? cs.primary : cs.onSurfaceVariant,),
title: Text(name),
- trailing: isSelected ? Icon(Icons.check_circle_rounded, color: cs.primary) : null,
+ trailing: isSelected ? Icon(Icons.check_circle_rounded, color: cs.primary,) : null,
onTap: () { if (!isSelected) lib.selectLibrary(id); },
);
}),
],
if (_curLibId != null) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 2),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 2,),
child: Text(
- l.currentLibrarySettingsTitle(lib.selectedLibrary?['name'] as String? ?? l.libraryFallback),
+ l.currentLibrarySettingsTitle(lib.selectedLibrary?['name'] as String? ?? l.libraryFallback,),
style: tt.titleSmall,
),
),
InkWell(
onTap: _loaded ? () => _pickCurrentLibraryCoverShape() : null,
child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
+ padding: const EdgeInsets.fromLTRB(16, 14, 16, 14,),
child: Row(children: [
Expanded(child: Text(l.coverShapeLabel)),
- Text(_coverShapeValueLabel(l, _curLibCoverShape),
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ Text(_coverShapeValueLabel(l, _curLibCoverShape,),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
Icon(Icons.chevron_right_rounded,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
- ]),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
+ ],),
),
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Text(l.currentLibrarySkipOverride),
subtitle: Text(
_curLibSkipOverride
? l.currentLibrarySkipOverrideOnSubtitle
: l.currentLibrarySkipOverrideOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
),
value: _curLibSkipOverride,
onChanged: _loaded ? (v) {
setState(() => _curLibSkipOverride = v);
if (v) {
PlayerSettings.setSkipOverride(_curLibId!,
- forward: _curLibSkipForward, back: _curLibSkipBack);
+ forward: _curLibSkipForward, back: _curLibSkipBack,);
} else {
- PlayerSettings.setSkipOverride(_curLibId!, forward: null, back: null);
+ PlayerSettings.setSkipOverride(_curLibId!, forward: null, back: null,);
}
} : null,
),
if (_curLibSkipOverride) ...[
Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.currentLibrarySkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
- Text(l.secondsValue(_curLibSkipBack.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.currentLibrarySkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ Text(l.secondsValue(_curLibSkipBack.toString(),), style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -3248,19 +3707,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: _curLibSkipBack.toDouble(),
min: 5, max: 60, divisions: 11,
onChanged: _loaded ? (v) {
- setState(() => _curLibSkipBack = v.round());
+ setState(() => _curLibSkipBack = v.round(),);
PlayerSettings.setSkipOverride(_curLibId!,
- forward: _curLibSkipForward, back: v.round());
+ forward: _curLibSkipForward, back: v.round(),);
} : null,
),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(l.currentLibrarySkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
- Text(l.secondsValue(_curLibSkipForward.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.currentLibrarySkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ Text(l.secondsValue(_curLibSkipForward.toString(),), style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
],
),
),
@@ -3268,38 +3729,42 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: _curLibSkipForward.toDouble(),
min: 5, max: 60, divisions: 11,
onChanged: _loaded ? (v) {
- setState(() => _curLibSkipForward = v.round());
+ setState(() => _curLibSkipForward = v.round(),);
PlayerSettings.setSkipOverride(_curLibId!,
- forward: v.round(), back: _curLibSkipBack);
+ forward: v.round(), back: _curLibSkipBack,);
} : null,
),
],
],
],
),
+ if (!isDesktopSettings || expandedSection == 'Library')
const SizedBox(height: 16),
// ── Permissions ──
- CollapsibleSection(
+ if (!AppPlatform.isWeb)
+ CollapsibleSection(
key: _keyFor('Permissions'),
icon: Icons.shield_outlined,
title: l.sectionPermissions,
cs: cs,
- isExpanded: _expandedSection == 'Permissions',
+ isExpanded: expandedSection == 'Permissions',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Permissions', v),
children: [
ListTile(
- leading: const Icon(Icons.notifications_outlined),
+ leading: const Icon(Icons.notifications_outlined,),
title: Text(l.notifications),
subtitle: Text(l.notificationsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
onTap: () async {
final status = await Permission.notification.status;
if (status.isGranted) {
if (mounted) {
showOverlayToast(context, l.notificationsAlreadyEnabled,
- icon: Icons.notifications_active_outlined);
+ icon: Icons.notifications_active_outlined,);
}
} else {
final result = await Permission.notification.request();
@@ -3307,20 +3772,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
},
),
- if (Platform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: const Icon(Icons.battery_saver_outlined),
+ leading: const Icon(Icons.battery_saver_outlined,),
title: Text(l.unrestrictedBattery),
subtitle: Text(l.unrestrictedBatterySubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
onTap: () async {
final status = await Permission.ignoreBatteryOptimizations.status;
if (status.isGranted) {
if (mounted) {
showOverlayToast(context, l.batteryAlreadyUnrestricted,
- icon: Icons.battery_saver_outlined);
+ icon: Icons.battery_saver_outlined,);
}
} else {
final result = await Permission.ignoreBatteryOptimizations.request();
@@ -3331,6 +3797,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
],
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Permissions')
const SizedBox(height: 16),
// ── Issues & Support ──
@@ -3339,20 +3807,22 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.support_agent_rounded,
title: l.sectionIssuesAndSupport,
cs: cs,
- isExpanded: _expandedSection == 'Issues & Support',
+ isExpanded: expandedSection == 'Issues & Support',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Issues & Support', v),
children: [
ListTile(
leading: Icon(Icons.lightbulb_outline_rounded,
- color: cs.onSurfaceVariant),
+ color: cs.onSurfaceVariant,),
title: Text(l.showTipsAgain),
subtitle: Text(l.showTipsAgainSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
onTap: () async {
await FeatureHint.resetAll();
if (!mounted) return;
showOverlayToast(context, l.tipsRestored,
- icon: Icons.lightbulb_outline_rounded);
+ icon: Icons.lightbulb_outline_rounded,);
// Re-trigger the welcome dialog without an app
// restart. resetAll() already cleared the flag.
WelcomeSheet.showIfNeeded(context);
@@ -3360,34 +3830,37 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const Divider(height: 1, indent: 16, endIndent: 16),
ListTile(
- leading: Icon(Icons.bug_report_outlined, color: cs.onSurfaceVariant),
+ leading: Icon(Icons.bug_report_outlined, color: cs.onSurfaceVariant,),
title: Text(l.bugsAndFeatureRequests),
subtitle: Text(l.bugsAndFeatureRequestsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
trailing: Icon(Icons.open_in_new_rounded,
- size: 18, color: cs.onSurfaceVariant),
+ size: 18, color: cs.onSurfaceVariant,),
onTap: () => launchUrl(
- Uri.parse('https://github.com/pounat/absorb/issues'),
- mode: LaunchMode.externalApplication),
+ Uri.parse('https://github.com/pounat/absorb/issues',),
+ mode: LaunchMode.externalApplication,),
),
const Divider(height: 1, indent: 16, endIndent: 16),
ListTile(
- leading: Icon(Icons.discord, color: cs.onSurfaceVariant),
+ leading: Icon(Icons.discord, color: cs.onSurfaceVariant,),
title: Text(l.joinDiscord),
subtitle: Text(l.joinDiscordSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
trailing: Icon(Icons.open_in_new_rounded,
- size: 18, color: cs.onSurfaceVariant),
+ size: 18, color: cs.onSurfaceVariant,),
onTap: () => launchUrl(
Uri.parse('https://discord.gg/bwH6hdvzZ4'),
- mode: LaunchMode.externalApplication),
+ mode: LaunchMode.externalApplication,),
),
const Divider(height: 1, indent: 16, endIndent: 16),
ListTile(
- leading: Icon(Icons.email_outlined, color: cs.primary),
+ leading: Icon(Icons.email_outlined, color: cs.primary,),
title: Text(l.contact),
subtitle: Text(l.contactSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
trailing: const Icon(Icons.chevron_right_rounded),
onTap: () {
LogService().contactEmail(
@@ -3402,7 +3875,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_loggingEnabled
? l.enableLoggingOnSubtitle
: l.enableLoggingOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _loggingEnabled,
onChanged: _loaded ? (v) {
setState(() => _loggingEnabled = v);
@@ -3417,13 +3891,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
} : null,
),
if (_loggingEnabled && LogService().enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: Icon(Icons.attach_file_rounded, color: cs.primary),
+ leading: Icon(Icons.attach_file_rounded, color: cs.primary,),
title: Text(l.sendLogs),
subtitle: Text(l.sendLogsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: const Icon(Icons.chevron_right_rounded),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: const Icon(Icons.chevron_right_rounded,),
onTap: () async {
try {
final box = context.findRenderObject() as RenderBox?;
@@ -3445,21 +3920,23 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
},
),
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: Icon(Icons.delete_outline_rounded, color: cs.error),
+ leading: Icon(Icons.delete_outline_rounded, color: cs.error,),
title: Text(l.clearLogs),
onTap: () async {
await LogService().clearLogs();
if (mounted) {
showOverlayToast(context, l.logsCleared,
- icon: Icons.delete_outline_rounded);
+ icon: Icons.delete_outline_rounded,);
}
},
),
],
],
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Issues & Support')
const SizedBox(height: 16),
// ── Advanced ──
@@ -3468,92 +3945,98 @@ class _SettingsScreenState extends State<SettingsScreen> {
icon: Icons.tune_rounded,
title: l.sectionAdvanced,
cs: cs,
- isExpanded: _expandedSection == 'Advanced',
+ isExpanded: expandedSection == 'Advanced',
+ desktopMode: isDesktopSettings,
onExpansionChanged: (v) => _onSectionExpanded('Advanced', v),
children: [
SwitchListTile(
title: Row(children: [
Flexible(child: Text(l.localServer)),
- _infoIcon(l.localServerInfoTitle, l.localServerInfoContent),
- ]),
+ _infoIcon(l.localServerInfoTitle, l.localServerInfoContent,),
+ ],),
subtitle: Text(
_localServerEnabled
? (auth.useLocalServer
? l.localServerOnConnectedSubtitle
: l.localServerOnRemoteSubtitle)
: l.localServerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _localServerEnabled,
onChanged: _loaded ? (v) {
setState(() => _localServerEnabled = v);
- auth.setLocalServerConfig(enabled: v, url: _localServerUrl);
+ auth.setLocalServerConfig(enabled: v, url: _localServerUrl,);
} : null,
),
if (_localServerEnabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 0,),
child: TextField(
controller: _localServerController,
decoration: InputDecoration(
labelText: l.localServerUrlLabel,
hintText: l.localServerUrlHint,
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(12),),
),
onSubmitted: (_) => _saveLocalServerUrl(auth, l),
),
),
Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 8,),
child: Align(
alignment: Alignment.centerRight,
child: FilledButton.icon(
- icon: const Icon(Icons.check_rounded, size: 18),
+ icon: const Icon(Icons.check_rounded, size: 18,),
label: Text(l.setTooltip),
onPressed: () => _saveLocalServerUrl(auth, l),
),
),
),
if (auth.useLocalServer) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
ListTile(
- leading: Icon(Icons.check_circle_rounded, color: Colors.greenAccent.shade400),
+ leading: Icon(Icons.check_circle_rounded, color: Colors.greenAccent.shade400,),
title: Text(l.localServerOnConnectedSubtitle),
subtitle: Text(_localServerUrl,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
),
],
],
const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
+ if (!AppPlatform.isWeb)
+ SwitchListTile(
title: Row(children: [
- Flexible(child: Text(l.trustAllCertificates)),
- _infoIcon(l.trustAllCertificatesInfoTitle, l.trustAllCertificatesInfoContent),
- ]),
+ Flexible(child: Text(l.trustAllCertificates),),
+ _infoIcon(l.trustAllCertificatesInfoTitle, l.trustAllCertificatesInfoContent,),
+ ],),
subtitle: Text(
_trustAllCerts
? l.trustAllCertificatesOnSubtitle
: l.trustAllCertificatesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _trustAllCerts,
onChanged: _loaded ? (v) async {
setState(() => _trustAllCerts = v);
- await PlayerSettings.setTrustAllCerts(v);
+ await PlayerSettings.setTrustAllCerts(v,);
applyTrustAllCerts(v);
} : null,
),
- if (Platform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Row(children: [
Flexible(child: Text(l.mp3IndexSeeking)),
- _infoIcon(l.mp3IndexSeekingInfoTitle, l.mp3IndexSeekingInfoContent),
- ]),
+ _infoIcon(l.mp3IndexSeekingInfoTitle, l.mp3IndexSeekingInfoContent,),
+ ],),
subtitle: Text(
_mp3IndexSeeking
? l.mp3IndexSeekingOnSubtitle
: l.mp3IndexSeekingOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _mp3IndexSeeking,
onChanged: _loaded ? (v) {
setState(() => _mp3IndexSeeking = v);
@@ -3562,41 +4045,47 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
],
if (_isGithubBuild) ...[
- const Divider(height: 1, indent: 16, endIndent: 16),
+ const Divider(height: 1, indent: 16, endIndent: 16,),
SwitchListTile(
title: Row(children: [
Flexible(child: Text(l.includePreReleases)),
- _infoIcon(l.preReleaseUpdatesInfoTitle, l.preReleaseUpdatesInfoContent),
- ]),
+ _infoIcon(l.preReleaseUpdatesInfoTitle, l.preReleaseUpdatesInfoContent,),
+ ],),
subtitle: Text(
_includePreReleases
? l.includePreReleasesOnSubtitle
: l.includePreReleasesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
value: _includePreReleases,
onChanged: _loaded ? (v) async {
setState(() => _includePreReleases = v);
- await PlayerSettings.setIncludePreReleases(v);
+ await PlayerSettings.setIncludePreReleases(v,);
} : null,
),
],
const Divider(height: 1, indent: 16, endIndent: 16),
ListTile(
- leading: Icon(Icons.menu_book_rounded, color: cs.primary),
+ leading: Icon(Icons.menu_book_rounded, color: cs.primary,),
title: Text(l.adminRmab),
subtitle: Text(
((_rmabBaseUrl ?? '').isNotEmpty && (_rmabApiToken ?? '').isNotEmpty)
? l.adminRmabConnected
: l.adminRmabAskAdmin,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
onTap: _openRmabSheetFromSettings,
),
],
),
+ if (!isDesktopSettings || expandedSection == 'Advanced')
const SizedBox(height: 16),
// ── Support the Dev ──
+ if (!isDesktopSettings ||
+ expandedSection == 'Issues & Support')
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
@@ -3604,92 +4093,111 @@ class _SettingsScreenState extends State<SettingsScreen> {
Card(
color: cs.surfaceContainerHigh,
shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(14)),
+ borderRadius: BorderRadius.circular(14),),
clipBehavior: Clip.antiAlias,
child: ListTile(
leading: Icon(Icons.coffee_rounded,
- color: Colors.amber.shade600),
+ color: Colors.amber.shade600,),
title: Text(l.supportTheDev),
subtitle: Text(l.buyMeACoffee,
style: tt.bodySmall
- ?.copyWith(color: cs.onSurfaceVariant)),
+ ?.copyWith(color: cs.onSurfaceVariant,
+ ),),
trailing: Icon(Icons.favorite_rounded,
- size: 18, color: Colors.amber.shade600),
+ size: 18, color: Colors.amber.shade600,),
onTap: () => launchUrl(
Uri.parse(
- 'https://www.buymeacoffee.com/BarnabasApps'),
- mode: LaunchMode.externalApplication),
+ 'https://www.buymeacoffee.com/BarnabasApps',),
+ mode: LaunchMode.externalApplication,),
),
),
],
),
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Issues & Support')
+
const SizedBox(height: 16),
// ── Backup & Restore ──
+ if (!isDesktopSettings || expandedSection == 'Advanced')
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Card(
elevation: 0,
color: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
- Icon(Icons.settings_backup_restore_rounded, color: cs.primary, size: 22),
+ Icon(Icons.settings_backup_restore_rounded, color: cs.primary, size: 22,),
const SizedBox(width: 10),
- Text(l.backupAndRestore, style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w600)),
- ]),
+ Text(l.backupAndRestore, style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w600,
+ ),),
+ ],),
const SizedBox(height: 4),
Text(l.backupAndRestoreSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
const SizedBox(height: 14),
Row(children: [
Expanded(child: FilledButton.tonalIcon(
- icon: const Icon(Icons.upload_rounded, size: 18),
+ icon: const Icon(Icons.upload_rounded, size: 18,),
label: Text(l.backUp),
- onPressed: () => _backupSettings(context, cs, tt),
- )),
- const SizedBox(width: 10),
- Expanded(child: OutlinedButton.icon(
- icon: const Icon(Icons.download_rounded, size: 18),
- label: Text(l.restore),
- onPressed: () => _restoreSettings(context, cs, tt),
- )),
- ]),
+ onPressed: () => _backupSettings(context, cs, tt,
+ ),
+ ),),
+ if (!AppPlatform.isWeb) ...[
+ const SizedBox(width: 10),
+ Expanded(child: OutlinedButton.icon(
+ icon: const Icon(Icons.download_rounded, size: 18,),
+ label: Text(l.restore),
+ onPressed: () => _restoreSettings(context, cs, tt,
+ ),
+ ),),
+ ],
+ ],),
],
),
),
),
),
+ if (!isDesktopSettings ||
+ expandedSection == 'Advanced' ||
+ expandedSection == 'Library')
+
const SizedBox(height: 10),
// ── All Bookmarks ──
+ if (!isDesktopSettings || expandedSection == 'Library')
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Card(
elevation: 0,
color: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
child: ListTile(
- leading: Icon(Icons.bookmarks_rounded, color: cs.primary),
+ leading: Icon(Icons.bookmarks_rounded, color: cs.primary,),
title: Text(l.allBookmarks),
subtitle: Text(l.allBookmarksSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
onTap: () => Navigator.push(context,
- MaterialPageRoute(builder: (_) => const BookmarksScreen())),
+ MaterialPageRoute(builder: (_) => const BookmarksScreen(),
+ ),),
),
),
),
// ── Version Info ──
+ if (!isDesktopSettings || expandedSection == 'Advanced')
Center(child: Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -3697,43 +4205,45 @@ class _SettingsScreenState extends State<SettingsScreen> {
// Flavor prefix is an Android distribution concept
// (GitHub / Play Store / F-Droid). iOS has no flavor, so
// it keeps the plain version.
- Platform.isIOS
+ AppPlatform.isIOS || AppPlatform.isWeb
? l.appVersionFormat(_appVersion)
: '$_flavorLabel - $_appVersion',
style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4,
+ ),),
),
const SizedBox(width: 4),
Icon(
_isGithubBuild ? Icons.code_rounded : Icons.store_rounded,
size: 14,
- color: cs.onSurfaceVariant.withValues(alpha: 0.3),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.3,),
),
if (auth.serverVersion != null)
Text(
- l.appVersionServerSuffix(auth.serverVersion!),
+ l.appVersionServerSuffix(auth.serverVersion!,),
style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4,
+ ),),
),
],
- )),
+ ),),
- if (_isGithubBuild) ...[
+ if (_isGithubBuild && !AppPlatform.isWeb) ...[
const SizedBox(height: 4),
Center(child: TextButton.icon(
onPressed: () async {
- final info = await UpdateCheckerService.check(force: true, includePreReleases: _includePreReleases);
+ final info = await UpdateCheckerService.check(force: true, includePreReleases: _includePreReleases,);
if (!mounted) return;
if (info == null || !info.hasUpdate) {
showOverlayToast(context, l.onLatestVersion,
- icon: Icons.check_circle_outline_rounded);
+ icon: Icons.check_circle_outline_rounded,);
return;
}
await UpdateDialog.show(context, info);
},
- icon: const Icon(Icons.system_update_rounded, size: 16),
+ icon: const Icon(Icons.system_update_rounded, size: 16,),
label: Text(l.checkForUpdate),
- )),
+ ),),
],
const SizedBox(height: 100),
@@ -3741,13 +4251,34 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
],
+ );
+ return _SettingsAdaptiveFrame(
+ desktopMode: isDesktopSettings,
+ selectedSection: expandedSection,
+ destinations: destinations,
+ onSectionSelected: (section) {
+ setState(() => _expandedSection = section);
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted || !_settingsScrollController.hasClients) {
+ return;
+ }
+ _settingsScrollController.animateTo(
+ 0,
+ duration: const Duration(milliseconds: 180),
+ curve: Curves.easeOut,
+ );
+ });
+ },
+ child: content,
+ );
+ },
),
),
),
);
}
- List<Widget> _buildRewindPreviews(ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ List<Widget> _buildRewindPreviews(ColorScheme cs, TextTheme tt, AppLocalizations l,) {
final s = _rewindSettings;
final delay = s.activationDelay.round();
@@ -3788,7 +4319,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
for (final entry in durations.entries) {
final rewind = AudioPlayerService.calculateAutoRewind(
Duration(seconds: entry.key), s.minRewind, s.maxRewind,
- activationDelay: s.activationDelay);
+ activationDelay: s.activationDelay,);
rows.add(_rewindPreviewRow(entry.value, rewind, cs, tt, l));
}
@@ -3796,7 +4327,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
Widget _rewindPreviewRow(
- String label, double rewind, ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ String label, double rewind, ColorScheme cs, TextTheme tt, AppLocalizations l,) {
final isSkipped = rewind < 0;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
@@ -3804,11 +4335,13 @@ class _SettingsScreenState extends State<SettingsScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: tt.bodySmall?.copyWith(
- color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.4) : cs.onSurfaceVariant)),
+ color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.4) : cs.onSurfaceVariant,
+ ),),
Text(isSkipped ? '→ ${l.rewindNoRewind}' : '→ ${l.rewindSeconds(rewind.toStringAsFixed(1))}',
style: tt.bodySmall?.copyWith(
fontWeight: FontWeight.w600,
- color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.3) : cs.primary)),
+ color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.3) : cs.primary,
+ ),),
],
),
);
@@ -3821,7 +4354,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(2)} GB';
}
- Future<void> _pickDownloadLocation(BuildContext context, ColorScheme cs, TextTheme tt) async {
+ Future<void> _pickDownloadLocation(BuildContext context, ColorScheme cs, TextTheme tt,) async {
final l = AppLocalizations.of(context)!;
final dl = DownloadService();
final hasExistingDownloads = dl.downloadedItems.isNotEmpty;
@@ -3842,13 +4375,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
Container(width: 40, height: 4,
decoration: BoxDecoration(
color: cs.onSurfaceVariant.withValues(alpha: 0.3),
- borderRadius: BorderRadius.circular(2))),
+ borderRadius: BorderRadius.circular(2),
+ ),),
const SizedBox(height: 16),
Text(l.downloadLocationSheetTitle,
- style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
const SizedBox(height: 4),
Text(l.downloadLocationSheetSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),),
const SizedBox(height: 20),
// Current location display
@@ -3869,15 +4403,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
children: [
Text(l.currentLocation,
style: tt.labelSmall?.copyWith(
- color: cs.primary, fontWeight: FontWeight.w600)),
+ color: cs.primary, fontWeight: FontWeight.w600,
+ ),),
const SizedBox(height: 2),
Text(_downloadLocationLabel,
style: tt.bodySmall?.copyWith(color: cs.onSurface),
- maxLines: 2, overflow: TextOverflow.ellipsis),
+ maxLines: 2, overflow: TextOverflow.ellipsis,),
],
),
),
- ]),
+ ],),
),
const SizedBox(height: 16),
@@ -3894,13 +4429,13 @@ class _SettingsScreenState extends State<SettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
- Icon(Icons.warning_amber_rounded, size: 18, color: cs.error),
+ Icon(Icons.warning_amber_rounded, size: 18, color: cs.error,),
const SizedBox(width: 10),
Expanded(
child: Text(l.legacyDownloadsNotice(legacyCount),
- style: tt.bodySmall?.copyWith(color: cs.onSurface)),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface),),
),
- ]),
+ ],),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -3922,7 +4457,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
await dl.redownloadAllLegacy(api);
if (mounted) {
showOverlayToast(context, l.redownloadStarted,
- icon: Icons.download_rounded);
+ icon: Icons.download_rounded,);
}
},
child: Text(l.redownload),
@@ -3940,23 +4475,23 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.only(bottom: 12),
child: Container(
width: double.infinity,
- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10,),
decoration: BoxDecoration(
color: cs.errorContainer.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.error.withValues(alpha: 0.2)),
),
child: Row(children: [
- Icon(Icons.info_outline_rounded, size: 16, color: cs.error),
+ Icon(Icons.info_outline_rounded, size: 16, color: cs.error,),
const SizedBox(width: 10),
Expanded(
child: Text(
l.existingDownloadsWarning,
style: tt.bodySmall?.copyWith(
- color: cs.error.withValues(alpha: 0.8), fontSize: 11),
+ color: cs.error.withValues(alpha: 0.8), fontSize: 11,),
),
),
- ]),
+ ],),
),
),
@@ -3979,7 +4514,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
} catch (e) {
if (mounted) {
showOverlayToast(context, l.cannotWriteToFolder,
- icon: Icons.error_outline_rounded);
+ icon: Icons.error_outline_rounded,);
}
return;
}
@@ -3988,12 +4523,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
try {
final probe = await FileDownloader()
.uri
- .createDirectory(treeUri, '.absorb_write_test');
+ .createDirectory(treeUri, '.absorb_write_test',);
await FileDownloader().uri.deleteFile(probe);
} catch (e) {
if (mounted) {
showOverlayToast(context, l.cannotWriteToFolder,
- icon: Icons.error_outline_rounded);
+ icon: Icons.error_outline_rounded,);
}
return;
}
@@ -4002,7 +4537,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (mounted) {
setState(() => _downloadLocationLabel = label);
showOverlayToast(context, l.downloadLocationSetTo(label),
- icon: Icons.folder_outlined);
+ icon: Icons.folder_outlined,);
}
},
),
@@ -4023,7 +4558,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (mounted) {
setState(() => _downloadLocationLabel = label);
showOverlayToast(context, l.resetToDefaultStorage,
- icon: Icons.restart_alt_rounded);
+ icon: Icons.restart_alt_rounded,);
}
},
),
@@ -4062,10 +4597,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
- Future<void> _performBackup(BuildContext context, {required bool includeAccounts}) async {
+ Future<void> _performBackup(BuildContext context, {required bool includeAccounts,}) async {
final l = AppLocalizations.of(context)!;
try {
- final data = await BackupService.exportSettings(includeAccounts: includeAccounts);
+ final data = await BackupService.exportSettings(includeAccounts: includeAccounts,);
final jsonStr = const JsonEncoder.withIndent(' ').convert(data);
final now = DateTime.now();
final datePart = '${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}';
@@ -4082,7 +4617,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (result != null) {
// Desktop platforms need manual file write; mobile writes via bytes param
- if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
+ if (AppPlatform.isDesktop) {
await File(result).writeAsString(jsonStr);
}
if (mounted) {
@@ -4098,12 +4633,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
} catch (e) {
if (mounted) {
showOverlayToast(context, l.backupFailed(e.toString()),
- icon: Icons.error_outline_rounded);
+ icon: Icons.error_outline_rounded,);
}
}
}
- void _restoreSettings(BuildContext context, ColorScheme cs, TextTheme tt) async {
+ void _restoreSettings(BuildContext context, ColorScheme cs, TextTheme tt,) async {
final l = AppLocalizations.of(context)!;
try {
final result = await FilePicker.platform.pickFiles(type: FileType.any);
@@ -4116,7 +4651,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (data['version'] == null) {
if (mounted) {
showOverlayToast(context, l.invalidBackupFile,
- icon: Icons.error_outline_rounded);
+ icon: Icons.error_outline_rounded,);
}
return;
}
@@ -4151,7 +4686,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Text(l.restoreBackupContent),
if (details.isNotEmpty) ...[
const SizedBox(height: 12),
- Text(details, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
+ Text(details, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12),),
],
if (hasAccounts || hasCustomHeaders) ...[
const SizedBox(height: 12),
@@ -4160,9 +4695,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
runSpacing: 8,
children: [
if (hasAccounts)
- _restoreChip(Icons.people_rounded, l.restoreAccountsChip(accounts.length), cs),
+ _restoreChip(Icons.people_rounded, l.restoreAccountsChip(accounts.length), cs,),
if (hasCustomHeaders)
- _restoreChip(Icons.vpn_key_rounded, l.restoreCustomHeadersChip, cs),
+ _restoreChip(Icons.vpn_key_rounded, l.restoreCustomHeadersChip, cs,),
],
),
],
@@ -4194,7 +4729,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (settings?['flatBackground'] is bool) applyFlatBackground(settings!['flatBackground'] as bool);
if (settings?['colorSource'] is String) applyColorSource(settings!['colorSource'] as String);
if (settings?['manualSeedColor'] is int) applyManualSeed(settings!['manualSeedColor'] as int);
- if (settings?['gradientIntensity'] is num) applyGradientIntensity((settings!['gradientIntensity'] as num).toDouble());
+ if (settings?['gradientIntensity'] is num) applyGradientIntensity((settings!['gradientIntensity'] as num).toDouble(),);
if (settings?['useColorEverywhere'] is bool) applyUseColorEverywhere(settings!['useColorEverywhere'] as bool);
await applyOrientationLock();
@@ -4203,12 +4738,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (mounted) {
showOverlayToast(context, l.settingsRestoredSuccessfully,
- icon: Icons.check_circle_outline_rounded);
+ icon: Icons.check_circle_outline_rounded,);
}
} catch (e) {
if (mounted) {
showOverlayToast(context, l.restoreFailed(e.toString()),
- icon: Icons.error_outline_rounded);
+ icon: Icons.error_outline_rounded,);
}
}
}
@@ -4224,7 +4759,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Icon(icon, size: 16, color: cs.primary),
const SizedBox(width: 8),
Text(label, style: TextStyle(fontSize: 12, color: cs.primary)),
- ]),
+ ],),
);
}
@@ -4236,7 +4771,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
final lib = context.read<LibraryProvider>();
final accounts = UserAccountService().accounts;
final otherAccounts = accounts.where((a) =>
- !(a.serverUrl == auth.serverUrl && a.username == auth.username)
+ !(a.serverUrl == auth.serverUrl && a.username == auth.username),
).toList();
SavedAccount? activeAccount;
for (final a in accounts) {
@@ -4250,81 +4785,101 @@ class _SettingsScreenState extends State<SettingsScreen> {
final userType = auth.isRoot ? l.rootAdmin : auth.isAdmin ? l.admin : l.userFallback;
final libraryCount = lib.libraries.length;
- showModalBottomSheet(
+ _showAdaptiveSettingsSurface<void>(
context: context,
- isScrollControlled: true,
- useSafeArea: true,
- backgroundColor: cs.surfaceContainerHigh,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
- ),
- builder: (ctx) => SafeArea(
+ builder: (ctx, desktopMode) => SafeArea(
child: SingleChildScrollView(
child: Column(mainAxisSize: MainAxisSize.min, children: [
+ if (desktopMode)
+ Align(
+ alignment: Alignment.centerRight,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
+ child: IconButton(
+ tooltip: MaterialLocalizations.of(ctx).closeButtonTooltip,
+ onPressed: () => Navigator.pop(ctx),
+ icon: const Icon(Icons.close_rounded),
+ ),
+ ),
+ )
+ else ...[
Center(child: Container(margin: const EdgeInsets.only(top: 12), width: 36, height: 4,
- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2)))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2),
+ ),
+ ),),
const SizedBox(height: 16),
+ ],
// Current user info
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700)),
+ Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700,
+ ),),
const SizedBox(height: 6),
Row(children: [
- Icon(Icons.dns_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ Icon(Icons.dns_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
const SizedBox(width: 6),
Expanded(child: Text(shortServer, style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.5)), maxLines: 1, overflow: TextOverflow.ellipsis)),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),), maxLines: 1, overflow: TextOverflow.ellipsis,
+ ),),
if (activeAccount != null)
InkResponse(
onTap: () { Navigator.pop(ctx); _editServerConnection(context, activeAccount!); },
radius: 22,
child: Padding(padding: const EdgeInsets.all(6),
- child: Icon(Icons.edit_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.7))),
+ child: Icon(Icons.edit_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.7,
+ ),
+ ),),
),
- ]),
+ ],),
const SizedBox(height: 3),
Row(children: [
- Icon(Icons.shield_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ Icon(Icons.shield_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
const SizedBox(width: 6),
- Text(userType, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
+ Text(userType, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),),
const SizedBox(width: 12),
- Icon(Icons.library_books_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ Icon(Icons.library_books_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
const SizedBox(width: 6),
Text(libraryCount == 1 ? l.libraryCountOne(libraryCount) : l.libraryCountOther(libraryCount),
- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
- ]),
+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),),
+ ],),
if (auth.serverVersion != null) ...[
const SizedBox(height: 3),
Row(children: [
- Icon(Icons.info_outline_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ Icon(Icons.info_outline_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
const SizedBox(width: 6),
Text(l.serverVersionLabel(auth.serverVersion!), style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
- ]),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),),
+ ],),
],
- ]),
+ ],),
),
const SizedBox(height: 12),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06)),
+ Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
InkWell(
onTap: () {
Navigator.pop(ctx);
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => const ChangePasswordScreen(),
- ));
+ ),);
},
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
child: Row(children: [
- Icon(Icons.password_rounded, size: 20, color: cs.onSurfaceVariant),
+ Icon(Icons.password_rounded, size: 20, color: cs.onSurfaceVariant,),
const SizedBox(width: 14),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.changePasswordTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
- Text(l.changePasswordSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
- ])),
- Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant),
- ]),
+ Text(l.changePasswordTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
+ ),),
+ Text(l.changePasswordSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ ],
+ ),),
+ Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant,),
+ ],),
),
),
InkWell(
@@ -4332,22 +4887,25 @@ class _SettingsScreenState extends State<SettingsScreen> {
Navigator.pop(ctx);
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => const AuthSessionsScreen(),
- ));
+ ),);
},
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
child: Row(children: [
- Icon(Icons.devices_rounded, size: 20, color: cs.onSurfaceVariant),
+ Icon(Icons.devices_rounded, size: 20, color: cs.onSurfaceVariant,),
const SizedBox(width: 14),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.manageSessionsTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
- Text(l.manageSessionsSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
- ])),
- Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant),
- ]),
+ Text(l.manageSessionsTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
+ ),),
+ Text(l.manageSessionsSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
+ ),),
+ ],
+ ),),
+ Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant,),
+ ],),
),
),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06)),
+ Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
// Other accounts
if (otherAccounts.isNotEmpty) ...[
const SizedBox(height: 4),
@@ -4355,7 +4913,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.fromLTRB(20, 8, 20, 4),
child: Align(alignment: Alignment.centerLeft,
child: Text(l.switchAccount, style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4), fontWeight: FontWeight.w600, letterSpacing: 0.5))),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4), fontWeight: FontWeight.w600, letterSpacing: 0.5,
+ ),
+ ),),
),
...otherAccounts.map((account) {
final shortUrl = account.serverUrl
@@ -4365,49 +4925,66 @@ class _SettingsScreenState extends State<SettingsScreen> {
onTap: () { Navigator.pop(ctx); _switchAccount(context, account); },
onLongPress: () { Navigator.pop(ctx); _accountOptions(context, account); },
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10,),
child: Row(children: [
- Icon(Icons.person_rounded, size: 20, color: cs.onSurfaceVariant.withValues(alpha: 0.4)),
+ Icon(Icons.person_rounded, size: 20, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
const SizedBox(width: 12),
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(account.username, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
- Text(shortUrl, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
- maxLines: 1, overflow: TextOverflow.ellipsis),
- ])),
- Icon(Icons.swap_horiz_rounded, size: 18, color: cs.onSurface.withValues(alpha: 0.15)),
- ]),
+ Text(account.username, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
+ ),),
+ Text(shortUrl, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5,
+ ),),
+ maxLines: 1, overflow: TextOverflow.ellipsis,),
+ ],
+ ),),
+ Icon(Icons.swap_horiz_rounded, size: 18, color: cs.onSurface.withValues(alpha: 0.15),
+ ),
+ const SizedBox(width: 4),
+ IconButton(
+ tooltip: MaterialLocalizations.of(
+ ctx,
+ ).moreButtonTooltip,
+ onPressed: () {
+ Navigator.pop(ctx);
+ _accountOptions(context, account);
+ },
+ icon: const Icon(Icons.more_vert_rounded, size: 19),
+ color: cs.onSurfaceVariant,),
+ ],),
),
);
}),
const SizedBox(height: 4),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06)),
+ Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
],
// Add account
InkWell(
onTap: () { Navigator.pop(ctx); _addAccount(context); },
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
child: Row(children: [
- Icon(Icons.person_add_rounded, size: 20, color: cs.primary),
+ Icon(Icons.person_add_rounded, size: 20, color: cs.primary,),
const SizedBox(width: 14),
- Text(l.addAccount, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary)),
- ]),
+ Text(l.addAccount, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
+ ),),
+ ],),
),
),
// Sign out
InkWell(
onTap: () { Navigator.pop(ctx); _confirmLogout(context); },
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
child: Row(children: [
Icon(Icons.logout_rounded, size: 20, color: cs.error),
const SizedBox(width: 14),
- Text(l.signOut, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.error)),
- ]),
+ Text(l.signOut, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.error,
+ ),),
+ ],),
),
),
const SizedBox(height: 12),
- ]),
+ ],),
),
),
);
@@ -4461,7 +5038,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx),
- child: Text(l.stay),
+ child: Text(l.stay)
),
FilledButton(
onPressed: () async {
@@ -4515,32 +5092,48 @@ class _SettingsScreenState extends State<SettingsScreen> {
void _accountOptions(BuildContext context, SavedAccount account) {
final cs = Theme.of(context).colorScheme;
final l = AppLocalizations.of(context)!;
- showModalBottomSheet(
+ _showAdaptiveSettingsSurface<void>(
context: context,
- backgroundColor: cs.surfaceContainerHigh,
- shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20))),
- builder: (ctx) => SafeArea(child: Column(mainAxisSize: MainAxisSize.min, children: [
+ maxWidth: 460,
+ builder: (ctx, desktopMode) => SafeArea(child: Column(mainAxisSize: MainAxisSize.min, children: [
+ if (desktopMode)
+ Align(
+ alignment: Alignment.centerRight,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(8, 6, 8, 0),
+ child: IconButton(
+ tooltip: MaterialLocalizations.of(ctx).closeButtonTooltip,
+ onPressed: () => Navigator.pop(ctx),
+ icon: const Icon(Icons.close_rounded),
+ ),
+ ),
+ )
+ else ...[
const SizedBox(height: 10),
Center(child: Container(width: 36, height: 4,
- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2)))),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2),
+ ),
+ ),),
const SizedBox(height: 8),
+ ],
ListTile(
leading: Icon(Icons.dns_rounded, color: cs.primary),
title: Text(l.editServerConnectionAction),
- onTap: () { Navigator.pop(ctx); _editServerConnection(context, account); }),
+ onTap: () { Navigator.pop(ctx); _editServerConnection(context, account); },),
ListTile(
leading: Icon(Icons.delete_outline_rounded, color: cs.error),
- title: Text(l.removeAccountAction, style: TextStyle(color: cs.error)),
- onTap: () { Navigator.pop(ctx); _removeAccount(context, account); }),
+ title: Text(l.removeAccountAction, style: TextStyle(color: cs.error),),
+ onTap: () { Navigator.pop(ctx); _removeAccount(context, account); },),
const SizedBox(height: 8),
- ])),
+ ],
+ ),),
);
}
/// Edit the URL and custom proxy headers for one saved account without
/// losing its scoped data.
Future<void> _editServerConnection(
- BuildContext context, SavedAccount account) async {
+ BuildContext context, SavedAccount account,) async {
final l = AppLocalizations.of(context)!;
final result = await showDialog<ServerConnectionSettings>(
context: context,
@@ -4583,21 +5176,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
content: Text(l.removeAccountContent(
account.username,
account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
- )),
+ ),),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
- child: Text(l.cancel)),
+ child: Text(l.cancel),),
FilledButton(
onPressed: () => Navigator.pop(ctx, true),
style: FilledButton.styleFrom(
- backgroundColor: Theme.of(ctx).colorScheme.error),
- child: Text(l.remove)),
+ backgroundColor: Theme.of(ctx).colorScheme.error,),
+ child: Text(l.remove),),
],
),
);
if (confirmed != true || !context.mounted) return;
- await UserAccountService().removeAccount(account.serverUrl, account.username);
+ await UserAccountService().removeAccount(account.serverUrl, account.username,);
if (context.mounted) setState(() {});
}
@@ -4610,14 +5203,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
content: Text(l.switchAccountContent(
account.username,
account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
- )),
+ ),),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
- child: Text(l.cancel)),
+ child: Text(l.cancel),),
FilledButton(
onPressed: () => Navigator.pop(ctx, true),
- child: Text(l.switchButton)),
+ child: Text(l.switchButton),),
],
),
);
diff --git a/lib/screens/stats_screen.dart b/lib/screens/stats_screen.dart
index 2481f704..1e435fcc 100644
--- a/lib/screens/stats_screen.dart
+++ b/lib/screens/stats_screen.dart
@@ -9,6 +9,7 @@ import '../providers/library_provider.dart';
import '../services/audio_player_service.dart';
import '../services/scoped_prefs.dart';
import '../services/user_account_service.dart';
+import '../utils/app_platform.dart';
import '../widgets/absorb_page_header.dart';
import '../widgets/finished_books_this_year_sheet.dart';
import '../widgets/stats_charts.dart';
@@ -493,84 +494,56 @@ class _StatsScreenState extends State<StatsScreen>
'activity': [
_sectionTitle(tt, cs, l.statsActivity),
const SizedBox(height: 10),
- Row(children: [
- Expanded(
- child: _accentStatCard(
- tt,
- cs,
- Icons.local_fire_department_rounded,
- Colors.orange,
- l.statsScreenStreakDays(streak),
- l.statsCurrentStreak)),
- const SizedBox(width: 8),
- Expanded(
- child: _accentStatCard(tt, cs, Icons.emoji_events_rounded,
- Colors.amber.shade600, l.statsScreenStreakDays(longestStreak), l.statsBestStreak)),
- ]),
- const SizedBox(height: 8),
- Row(children: [
- Expanded(
- child: _accentStatCard(tt, cs, Icons.menu_book_rounded,
- Colors.green, '$_booksFinished', l.statsBooksFinished)),
- if (_episodesFinished > 0) ...[
- const SizedBox(width: 8),
- Expanded(
- child: _accentStatCard(tt, cs, Icons.podcasts_rounded,
- Colors.purple, '$_episodesFinished', l.statsEpisodesFinished)),
- ],
- ]),
- const SizedBox(height: 8),
- Row(children: [
- Expanded(
- child: _accentStatCard(tt, cs, Icons.auto_stories_rounded,
- Colors.teal, '$_booksFinishedThisYear', l.statsBooksThisYear,
- onTap: _booksFinishedThisYear > 0
- ? () async {
- await showFinishedBooksThisYearSheet(context);
- if (mounted) {
- setState(() => _booksFinishedThisYear = context
- .read<LibraryProvider>()
- .finishedBooksThisYearCount);
- }
- }
- : null)),
- if (_episodesFinishedThisYear > 0) ...[
- const SizedBox(width: 8),
- Expanded(
- child: _accentStatCard(tt, cs, Icons.graphic_eq_rounded,
- Colors.deepPurple, '$_episodesFinishedThisYear',
- l.statsEpisodesThisYear)),
- ],
- ]),
- const SizedBox(height: 8),
- Row(children: [
- Expanded(
- child: _accentStatCard(tt, cs, Icons.calendar_today_rounded,
- cs.primary, '$activeDays', l.statsDaysActive)),
- const SizedBox(width: 8),
- Expanded(
- child: _accentStatCard(tt, cs, Icons.speed_rounded, cs.tertiary,
- _formatDuration(avgDaily), l.statsDailyAverage)),
+ _responsiveStatsGrid([
+ _accentStatCard(
+ tt,
+ cs,
+ Icons.local_fire_department_rounded,
+ Colors.orange,
+ l.statsScreenStreakDays(streak),
+ l.statsCurrentStreak),
+ _accentStatCard(tt, cs, Icons.emoji_events_rounded,
+ Colors.amber.shade600, l.statsScreenStreakDays(longestStreak), l.statsBestStreak),
+ _accentStatCard(tt, cs, Icons.menu_book_rounded,
+ Colors.green, '$_booksFinished', l.statsBooksFinished),
+ if (_episodesFinished > 0)
+ _accentStatCard(tt, cs, Icons.podcasts_rounded,
+ Colors.purple, '$_episodesFinished', l.statsEpisodesFinished),
+ _accentStatCard(tt, cs, Icons.auto_stories_rounded,
+ Colors.teal, '$_booksFinishedThisYear', l.statsBooksThisYear,
+ onTap: _booksFinishedThisYear > 0
+ ? () async {
+ await showFinishedBooksThisYearSheet(context);
+ if (mounted) {
+ setState(() => _booksFinishedThisYear = context
+ .read<LibraryProvider>()
+ .finishedBooksThisYearCount);
+ }
+ }
+ : null),
+ if (_episodesFinishedThisYear > 0)
+ _accentStatCard(tt, cs, Icons.graphic_eq_rounded,
+ Colors.deepPurple, '$_episodesFinishedThisYear',
+ l.statsEpisodesThisYear),
+ _accentStatCard(tt, cs, Icons.calendar_today_rounded,
+ cs.primary, '$activeDays', l.statsDaysActive),
+ _accentStatCard(tt, cs, Icons.speed_rounded, cs.tertiary,
+ _formatDuration(avgDaily), l.statsDailyAverage),
+ if (_timeSavedSeconds >= 60)
+ _accentStatCard(tt, cs, Icons.fast_forward_rounded,
+ Colors.cyan, _formatDuration(_timeSavedSeconds),
+ l.statsTimeSavedLabel,
+ subtitle: _timeSavedSince != null
+ ? l.statsTimeSavedSince(
+ MaterialLocalizations.of(context).formatMediumDate(_timeSavedSince!))
+ : null,
+ trailing: IconButton(
+ icon: Icon(Icons.restart_alt_rounded,
+ size: 20, color: cs.onSurfaceVariant),
+ tooltip: l.statsTimeSavedReset,
+ onPressed: _confirmResetTimeSaved,
+ )),
]),
- if (_timeSavedSeconds >= 60) ...[
- const SizedBox(height: 8),
- Row(children: [
- Expanded(
- child: _accentStatCard(tt, cs, Icons.fast_forward_rounded,
- Colors.cyan, _formatDuration(_timeSavedSeconds),
- l.statsTimeSavedLabel,
- subtitle: _timeSavedSince != null
- ? l.statsTimeSavedSince(
- MaterialLocalizations.of(context).formatMediumDate(_timeSavedSince!))
- : null,
- trailing: IconButton(
- icon: Icon(Icons.restart_alt_rounded,
- size: 20, color: cs.onSurfaceVariant),
- tooltip: l.statsTimeSavedReset,
- onPressed: _confirmResetTimeSaved,
- ))),
- ]),
- ],
const SizedBox(height: 28),
],
'chart': [
@@ -598,7 +571,9 @@ class _StatsScreenState extends State<StatsScreen>
if (topItems.isNotEmpty) ...[
_sectionTitle(tt, cs, l.statsMostListened),
const SizedBox(height: 10),
- ...topItems.map((item) => _topItemCard(tt, cs, l, item)),
+ _responsiveTwoColumnList(
+ topItems.map((item) => _topItemCard(tt, cs, l, item)).toList(),
+ ),
const SizedBox(height: 28),
],
],
@@ -610,36 +585,100 @@ class _StatsScreenState extends State<StatsScreen>
..._defaultSectionOrder.where((id) => !_statsOrder.contains(id)),
];
- return ListView(
- controller: _scrollController,
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 32),
- children: [
- AbsorbPageHeader(
- title: l.statsTitle,
- padding: const EdgeInsets.only(top: 12),
- ),
- const SizedBox(height: 24),
- for (final id in order)
- if (!_statsHidden.contains(id)) ...sections[id]!,
- if (_sessions.isNotEmpty) ...[
- _sectionTitle(tt, cs, l.statsRecentSessions),
- const SizedBox(height: 10),
- ..._buildSessions(),
- if (_isLoadingMoreSessions)
- Padding(
- padding: const EdgeInsets.symmetric(vertical: 16),
- child: Center(
- child: SizedBox(
- width: 20,
- height: 20,
- child: CircularProgressIndicator(
- strokeWidth: 2,
- color: cs.onSurface.withValues(alpha: 0.24)),
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final isWide = constraints.maxWidth >= 900;
+ final isDesktopWorkspace =
+ AppPlatform.isWeb && constraints.maxWidth >= 960;
+ final horizontalPadding = isWide ? 32.0 : 20.0;
+ return ListView(
+ controller: _scrollController,
+ physics: const AlwaysScrollableScrollPhysics(),
+ padding: EdgeInsets.fromLTRB(
+ horizontalPadding, 0, horizontalPadding, 32),
+ children: [
+ Align(
+ alignment: Alignment.topCenter,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 1180),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ AbsorbPageHeader(
+ title: l.statsTitle,
+ showBranding: !isDesktopWorkspace,
+ padding: EdgeInsets.only(top: isWide ? 24 : 12),
+ ),
+ const SizedBox(height: 24),
+ for (final id in order)
+ if (!_statsHidden.contains(id)) ...sections[id]!,
+ if (_sessions.isNotEmpty) ...[
+ _sectionTitle(tt, cs, l.statsRecentSessions),
+ const SizedBox(height: 10),
+ _responsiveTwoColumnList(_buildSessions()),
+ if (_isLoadingMoreSessions)
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ child: Center(
+ child: SizedBox(
+ width: 20,
+ height: 20,
+ child: CircularProgressIndicator(
+ strokeWidth: 2,
+ color: cs.onSurface.withValues(alpha: 0.24)),
+ ),
+ ),
+ ),
+ ],
+ ],
),
),
),
- ],
- ],
+ ],
+ );
+ },
+ );
+ }
+
+ Widget _responsiveStatsGrid(List<Widget> cards) {
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final columns = constraints.maxWidth >= 1080
+ ? 4
+ : constraints.maxWidth >= 900
+ ? 3
+ : 2;
+ const spacing = 12.0;
+ final cardWidth =
+ (constraints.maxWidth - (spacing * (columns - 1))) / columns;
+ return Wrap(
+ spacing: spacing,
+ runSpacing: spacing,
+ children: [
+ for (final card in cards)
+ SizedBox(width: cardWidth, child: card),
+ ],
+ );
+ },
+ );
+ }
+
+ Widget _responsiveTwoColumnList(List<Widget> cards) {
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ if (constraints.maxWidth < 900) {
+ return Column(children: cards);
+ }
+ const spacing = 12.0;
+ final cardWidth = (constraints.maxWidth - spacing) / 2;
+ return Wrap(
+ spacing: spacing,
+ children: [
+ for (final card in cards)
+ SizedBox(width: cardWidth, child: card),
+ ],
+ );
+ },
);
}
diff --git a/lib/services/_audio_player.dart b/lib/services/_audio_player.dart
index fa0b0fcc..2c4e8a62 100644
--- a/lib/services/_audio_player.dart
+++ b/lib/services/_audio_player.dart
@@ -1,7 +1,7 @@
import 'dart:async';
-import 'dart:io';
import 'package:just_audio/just_audio.dart' as ja;
import 'native_ios_audio_player.dart';
+import '../utils/app_platform.dart';
// Re-export just_audio's data types so consumers don't need a second import.
export 'package:just_audio/just_audio.dart'
@@ -25,7 +25,7 @@ class AudioPlayer {
bool useProxyForRequestHeaders = true,
ja.AudioLoadConfiguration? audioLoadConfiguration,
}) {
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
_native = NativeIosAudioPlayer();
} else {
_ja = ja.AudioPlayer(
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 41568378..4c179961 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:convert';
-import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '_audio_player.dart';
@@ -27,6 +26,7 @@ import 'session_cache.dart';
import 'home_widget_service.dart';
import 'bookmark_service.dart';
import 'review_service.dart';
+import '../utils/app_platform.dart';
export 'player_settings.dart';
String playbackDownloadKey(String itemId, String? episodeId) =>
@@ -84,7 +84,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
/// when the channel is unavailable. Used by click() to also read the
/// keycode for intent disambiguation, not just to log it.
static Future<Map<String, dynamic>?> _absorbDiagSnapshot() async {
- if (!Platform.isAndroid) return null;
+ if (!AppPlatform.isAndroid) return null;
try {
return await _absorbDiagChannel.invokeMapMethod<String, dynamic>(
'snapshot',
@@ -304,7 +304,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
// phone player caps at 5 buttons, makes the two chapter buttons push speed +
// bookmark to AA-only for every item type. iOS uses the CarPlay Now Playing
// buttons instead, so these are never added on iOS (lock screen stays as-is).
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
final prevChapter = MediaControl.custom(
androidIcon: 'drawable/ic_widget_prev_chapter',
label: 'Previous chapter',
@@ -350,8 +350,8 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
MediaAction.seekForward,
MediaAction.seekBackward,
MediaAction.skipToQueueItem,
- if (Platform.isIOS) MediaAction.skipToNext,
- if (Platform.isIOS) MediaAction.skipToPrevious,
+ if (AppPlatform.isIOS) MediaAction.skipToNext,
+ if (AppPlatform.isIOS) MediaAction.skipToPrevious,
},
androidCompactActionIndices: compactIndices,
processingState: () {
@@ -915,7 +915,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
title: (chTitle != null && chTitle.isNotEmpty) ? chTitle : 'Bookmark',
api: svc.currentApi,
);
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
// Flash a checkmark on the Android Auto bookmark button for ~2s. iOS gets
// its confirmation via the CarPlay banner instead.
_bookmarkSavedFlash = true;
@@ -1215,7 +1215,7 @@ class AudioPlayerService extends ChangeNotifier {
/// Called when a new item starts playing. Used by LibraryProvider to trigger
/// rolling downloads for the next items in a series/podcast.
static Future<void> Function(String key, double duration)?
- _onPlayStartedCallback;
+ _onPlayStartedCallback;
static void setOnPlayStartedCallback(
Future<void> Function(String key, double duration)? cb,
) {
@@ -1324,7 +1324,7 @@ class AudioPlayerService extends ChangeNotifier {
Timer? _coverRepushTimer;
void _beginAdvanceBuffering() {
- if (!Platform.isAndroid) return;
+ if (!AppPlatform.isAndroid) return;
_handler?.setAdvanceBuffering(
true,
minimumDuration: const Duration(milliseconds: 900),
@@ -1337,7 +1337,7 @@ class AudioPlayerService extends ChangeNotifier {
}
void _endAdvanceBuffering() {
- if (!Platform.isAndroid) return;
+ if (!AppPlatform.isAndroid) return;
_advanceBufferingBackstop?.cancel();
_advanceBufferingBackstop = null;
_handler?.setAdvanceBuffering(false);
@@ -1435,7 +1435,7 @@ class AudioPlayerService extends ChangeNotifier {
_handler!.refreshPlaybackState();
}
});
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
PlayerSettings.getDuckBriefInterruptions().then((v) async {
if (v == _duckBriefInterruptions) return;
final previousVolume = _volumeBeforeInterruptionDuck;
@@ -1647,7 +1647,7 @@ class AudioPlayerService extends ChangeNotifier {
_nextBookPreloading = false;
_preloadedNextBook = null;
_iosResyncPending = false;
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
_queueAdvancerChannel.invokeMethod('clear').catchError((Object e) {
debugPrint('[QueueAdvance] clear failed: $e');
return null;
@@ -1733,7 +1733,7 @@ class AudioPlayerService extends ChangeNotifier {
return;
}
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
// Native engine owns the cross-book swap. Skip concat.add entirely.
final source = nextTrackSources.length == 1
? nextTrackSources.first
@@ -1768,7 +1768,7 @@ class AudioPlayerService extends ChangeNotifier {
'[PreBuffer] Pre-loaded next item: ${next['title']} ($nextItemId)',
);
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
// Legacy native queue advancer kick (flag-off path).
unawaited(
_primeNativeQueueAdvancer(
@@ -1898,7 +1898,7 @@ class AudioPlayerService extends ChangeNotifier {
),
);
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
unawaited(_iosAutoAdvanceKick());
}
@@ -1924,7 +1924,7 @@ class AudioPlayerService extends ChangeNotifier {
Future<void> _iosAutoAdvanceKick() async {
final speed = _player?.speed ?? 1.0;
try {
- await (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (e) {
debugPrint('[QueueAdvance] setActive failed: $e');
}
@@ -2002,7 +2002,7 @@ class AudioPlayerService extends ChangeNotifier {
/// stopped or holds a different book, leave the existing paths to handle it
/// (the idle-on-resume re-init in play(), or a fresh playItem).
Future<void> _iosReconcileEngineOnForeground() async {
- if (!Platform.isIOS) return;
+ if (!AppPlatform.isIOS) return;
final player = _player;
final itemId = _currentItemId;
if (player == null || itemId == null) return;
@@ -2055,7 +2055,7 @@ class AudioPlayerService extends ChangeNotifier {
required double elapsed,
String? chapter,
}) async {
- if (!Platform.isIOS) return;
+ if (!AppPlatform.isIOS) return;
// GH #298: match the lock screen — chapter as title, "Author · Book" beneath.
final labels = nowPlayingLabels(title, artist, chapter);
try {
@@ -2097,7 +2097,7 @@ class AudioPlayerService extends ChangeNotifier {
'ep=$_currentEpisodeId',
];
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
try {
final info = await _eqChannelForDiag
.invokeMethod<Map<dynamic, dynamic>>('getAudioDiagnostics');
@@ -2340,7 +2340,7 @@ class AudioPlayerService extends ChangeNotifier {
_handler!.bindService(_instance);
// Wire the EQ service's skip-silence toggle through to just_audio.
// Android-only: just_audio's setSkipSilenceEnabled is a no-op on iOS.
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
EqualizerService().setSkipSilenceApplier((enabled) {
try {
_handler?.player.setSkipSilenceEnabled(enabled);
@@ -2351,7 +2351,7 @@ class AudioPlayerService extends ChangeNotifier {
}
// iOS native engine: keep the processing tap attached whenever any
// EQ/effect is active so effects work with the band EQ off.
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
EqualizerService().setTapApplier((active) {
try {
if (active) {
@@ -2374,7 +2374,7 @@ class AudioPlayerService extends ChangeNotifier {
// Configure streaming cache if enabled
final cacheSizeMb = await PlayerSettings.getStreamingCacheSizeMb();
debugPrint('[Player] Streaming cache setting: $cacheSizeMb MB');
- if (cacheSizeMb > 0) {
+ if (!AppPlatform.isWeb && cacheSizeMb > 0) {
try {
await AudioPlayer.configureStreamingCache(cacheSizeMb);
debugPrint('[Player] Streaming cache configured: $cacheSizeMb MB');
@@ -2427,6 +2427,7 @@ class AudioPlayerService extends ChangeNotifier {
/// Check if BT audio (A2DP/SCO) is currently connected via native AudioManager.
static Future<bool> _isBluetoothAudioConnected() async {
+ if (AppPlatform.isWeb) return false;
try {
final result = await _eqChannel.invokeMethod<bool>(
'isBluetoothAudioConnected',
@@ -2443,9 +2444,11 @@ class AudioPlayerService extends ChangeNotifier {
static bool get wasNoisyPause => _noisyPause;
static Future<void> _configureAudioSession() async {
+ if (AppPlatform.isWeb) return;
final session = await AudioSession.instance;
_duckBriefInterruptions =
- Platform.isAndroid && await PlayerSettings.getDuckBriefInterruptions();
+ AppPlatform.isAndroid &&
+ await PlayerSettings.getDuckBriefInterruptions();
await session.configure(
AudioSessionConfiguration(
@@ -2455,7 +2458,7 @@ class AudioPlayerService extends ChangeNotifier {
avAudioSessionMode: AVAudioSessionMode.spokenAudio,
avAudioSessionRouteSharingPolicy:
AVAudioSessionRouteSharingPolicy.longFormAudio,
- avAudioSessionCategoryOptions: Platform.isIOS
+ avAudioSessionCategoryOptions: AppPlatform.isIOS
? AVAudioSessionCategoryOptions.none
: AVAudioSessionCategoryOptions.duckOthers,
// Android: speech content type enables OS voice-intelligibility
@@ -2617,7 +2620,7 @@ class AudioPlayerService extends ChangeNotifier {
// route loss. Tradeoff: a rare false pause if you power off a second output
// you weren't actually listening on, undone with a single tap on play.
_devicesSub?.cancel();
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
_devicesSub = session.devicesChangedEventStream.listen(
(event) async {
try {
@@ -2696,13 +2699,13 @@ class AudioPlayerService extends ChangeNotifier {
'sincePrevPlayMs=$sincePrevPlayMs, aaDisconnectSuspect=$aaDisconnectSuspect',
);
service._positionSyncFailures = 0; // retry on foreground
- if (Platform.isIOS && service._iosResyncPending) {
+ if (AppPlatform.isIOS && service._iosResyncPending) {
unawaited(service._iosForegroundResyncIfNeeded());
}
// After a widget-driven session the shared engine may have kept playing
// (or advanced) while Flutter was suspended. Adopt its live state rather
// than reloading - reloading would restart the same stream (bug #285).
- if (Platform.isIOS && service.hasBook) {
+ if (AppPlatform.isIOS && service.hasBook) {
await service._iosReconcileEngineOnForeground();
}
if (!service.hasBook) return;
@@ -2745,7 +2748,7 @@ class AudioPlayerService extends ChangeNotifier {
// require it, and play()/startLocalPlayback reacquire focus themselves.
if (service.isPlaying) {
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
}
// Re-push playback state so the system re-registers the MediaSession
@@ -3158,6 +3161,11 @@ class AudioPlayerService extends ChangeNotifier {
}
}
+ static Future<bool?> _setAudioSessionActive(bool active) async {
+ if (AppPlatform.isWeb) return null;
+ return (await AudioSession.instance).setActive(active);
+ }
+
Future<void> _switchHotSwapReportingToLocal({
required Duration position,
required int streamingSeconds,
@@ -3166,10 +3174,7 @@ class AudioPlayerService extends ChangeNotifier {
final api = _api;
final streamingSessionId = _playbackSessionId;
- final progressKey = playbackDownloadKey(
- _currentItemId!,
- _currentEpisodeId,
- );
+ final progressKey = playbackDownloadKey(_currentItemId!, _currentEpisodeId);
final currentTime = position.inMilliseconds / 1000.0;
try {
@@ -3200,8 +3205,9 @@ class AudioPlayerService extends ChangeNotifier {
if (api == null || streamingSessionId == null) return;
try {
- final pendingBefore =
- await _progressSync.getStreamingPendingTime(progressKey);
+ final pendingBefore = await _progressSync.getStreamingPendingTime(
+ progressKey,
+ );
final synced = await api.syncPlaybackSession(
streamingSessionId,
currentTime: currentTime,
@@ -3213,9 +3219,11 @@ class AudioPlayerService extends ChangeNotifier {
unawaited(
_progressSync.addTimeSaved(streamingSeconds, _player?.speed ?? 1.0),
);
- unawaited(
- HomeWidgetService().addLocalListeningSeconds(streamingSeconds),
- );
+ if (!AppPlatform.isWeb) {
+ unawaited(
+ HomeWidgetService().addLocalListeningSeconds(streamingSeconds),
+ );
+ }
}
if (pendingBefore > 0) {
unawaited(
@@ -3393,7 +3401,7 @@ class AudioPlayerService extends ChangeNotifier {
await _configureAudioSession();
try {
- final activated = await (await AudioSession.instance).setActive(true);
+ final activated = await _setAudioSessionActive(true);
debugPrint('[Player] Pre-source setActive(true)=$activated (local)');
} catch (e) {
debugPrint('[Player] Pre-source setActive failed (local): $e');
@@ -3468,7 +3476,7 @@ class AudioPlayerService extends ChangeNotifier {
_handler?.refreshPlaybackState();
await Future.delayed(const Duration(milliseconds: 200));
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
_player!.play();
_scheduleAudioDiagnostics('local');
@@ -3604,7 +3612,7 @@ class AudioPlayerService extends ChangeNotifier {
await _configureAudioSession();
try {
- final activated = await (await AudioSession.instance).setActive(true);
+ final activated = await _setAudioSessionActive(true);
debugPrint(
'[Player] Pre-source setActive(true)=$activated (cached-session)',
);
@@ -3648,7 +3656,7 @@ class AudioPlayerService extends ChangeNotifier {
_handler?.refreshPlaybackState();
await Future.delayed(const Duration(milliseconds: 200));
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
_cachedStartReconcileGeneration = playbackGeneration;
_player!.play();
@@ -3836,7 +3844,7 @@ class AudioPlayerService extends ChangeNotifier {
// decoder and iOS AVPlayer handles EAC3 natively, so only force transcode
// on other Android devices where the software codec often fails or outputs silence.
if (!forceTranscode &&
- Platform.isAndroid &&
+ AppPlatform.isAndroid &&
!ApiService.deviceManufacturer.toLowerCase().contains('samsung')) {
final needsTranscode = audioTracks.any((t) {
final mime = ((t as Map<String, dynamic>)['mimeType'] as String? ?? '')
@@ -4005,7 +4013,7 @@ class AudioPlayerService extends ChangeNotifier {
await _configureAudioSession();
try {
- final activated = await (await AudioSession.instance).setActive(true);
+ final activated = await _setAudioSessionActive(true);
debugPrint('[Player] Pre-source setActive(true)=$activated (stream)');
} catch (e) {
debugPrint('[Player] Pre-source setActive failed (stream): $e');
@@ -4048,7 +4056,7 @@ class AudioPlayerService extends ChangeNotifier {
_handler?.refreshPlaybackState();
await Future.delayed(const Duration(milliseconds: 200));
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
_player!.play();
_scheduleAudioDiagnostics('stream');
@@ -4211,7 +4219,7 @@ class AudioPlayerService extends ChangeNotifier {
await EqualizerService().switchItem(itemId);
debugPrint('[Player] Transcoded playback starting at ${speed}x');
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
_player!.play();
_scheduleAudioDiagnostics('transcoded');
@@ -4302,7 +4310,7 @@ class AudioPlayerService extends ChangeNotifier {
// screen shows artwork even when the user is offline. Fall back to the
// remote HTTP URL when there's no local cover (streaming).
String? effectiveCoverUrl;
- if (Platform.isIOS) {
+ if (AppPlatform.isIOS) {
final localCover = DownloadService().getInfo(itemId).localCoverPath;
if (localCover != null && localCover.isNotEmpty) {
effectiveCoverUrl = Uri.file(localCover).toString();
@@ -4669,7 +4677,7 @@ class AudioPlayerService extends ChangeNotifier {
// current item ends. The native handover swaps the player item in one
// step, keeping the AVPlayer rate continuous so iOS doesn't drop the
// background route. Foreground still uses the regular auto-advance path.
- if (Platform.isIOS &&
+ if (AppPlatform.isIOS &&
_isBackgrounded &&
_preloadedNextBook != null &&
!_autoQueueAdvancing &&
@@ -4760,7 +4768,9 @@ class AudioPlayerService extends ChangeNotifier {
// ─── Completion detection (fallback) ───────────────────
// processingStateStream is the primary signal; this is a safety net.
if (_totalDuration > 0 && posSec >= _totalDuration - 1.0) {
- if (_preloadedNextBook != null && _isBackgrounded && Platform.isIOS) {
+ if (_preloadedNextBook != null &&
+ _isBackgrounded &&
+ AppPlatform.isIOS) {
debugPrint(
'[PreBuffer] Position-fallback near end with pre-buffer loaded — firing auto-queue advance',
);
@@ -4844,7 +4854,9 @@ class AudioPlayerService extends ChangeNotifier {
unawaited(
_progressSync.addTimeSaved(secs, _player?.speed ?? 1.0),
);
- unawaited(HomeWidgetService().addLocalListeningSeconds(secs));
+ if (!AppPlatform.isWeb) {
+ unawaited(HomeWidgetService().addLocalListeningSeconds(secs));
+ }
if (online) await LocalSessionService().pushActive(api: _api!);
_lastServerSync = DateTime.now();
} else if (manualOffline ||
@@ -4854,7 +4866,9 @@ class AudioPlayerService extends ChangeNotifier {
_progressSync.addTimeSaved(secs, _player?.speed ?? 1.0),
);
// Widget ticks forward even when the server is unreachable.
- unawaited(HomeWidgetService().addLocalListeningSeconds(secs));
+ if (!AppPlatform.isWeb) {
+ unawaited(HomeWidgetService().addLocalListeningSeconds(secs));
+ }
_lastServerSync = DateTime.now();
}
@@ -4926,7 +4940,7 @@ class AudioPlayerService extends ChangeNotifier {
/// the player isn't playing and isn't loading, re-seek and retry.
void _schedulePlayVerify() {
_playVerifyTimer?.cancel();
- if (!Platform.isIOS) return; // only needed on iOS
+ if (!AppPlatform.isIOS) return; // only needed on iOS
final posAtPlay = _lastKnownPositionSec;
_playVerifyTimer = Timer(const Duration(seconds: 3), () async {
if (_player == null || _currentItemId == null) return;
@@ -4959,7 +4973,7 @@ class AudioPlayerService extends ChangeNotifier {
// Stuck detection is only needed on iOS (xHE-AAC/USAC decoder freeze).
// Skip on Android to reduce background CPU wakeups.
- if (!Platform.isIOS) return;
+ if (!AppPlatform.isIOS) return;
_stuckCheckTimer = Timer.periodic(const Duration(seconds: 10), (_) async {
// Only check while actively playing
@@ -5032,7 +5046,7 @@ class AudioPlayerService extends ChangeNotifier {
// because the position-getter math (trackRel + offset[last]) lands at
// total duration. Recovery: seek a hair into the last track and resume,
// which forces AVPlayer to reload that single item correctly.
- if (!userRequested && Platform.isIOS && _trackStartOffsets.length > 2) {
+ if (!userRequested && AppPlatform.isIOS && _trackStartOffsets.length > 2) {
final lastIdx = _trackStartOffsets.length - 2;
final lastTrackStart = _trackStartOffsets[lastIdx];
final lastTrackDur = _trackStartOffsets[lastIdx + 1] - lastTrackStart;
@@ -5120,7 +5134,7 @@ class AudioPlayerService extends ChangeNotifier {
// platform player + session — paired with darwinLoadControl's
// automaticallyWaitsToMinimizeStalling=false this gives gapless
// background auto-advance. GH #244.
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
await _player?.stop();
} else {
await _player?.pause();
@@ -5334,7 +5348,9 @@ class AudioPlayerService extends ChangeNotifier {
if (ok && elapsed > 0) {
// Tick the StatsWidget forward locally so "today" stays fresh between
// 15-min authoritative refreshes (which Android Doze throttles).
- unawaited(HomeWidgetService().addLocalListeningSeconds(elapsed));
+ if (!AppPlatform.isWeb) {
+ unawaited(HomeWidgetService().addLocalListeningSeconds(elapsed));
+ }
}
if (ok && streamKey != null && pendingBefore > 0) {
unawaited(
@@ -5530,7 +5546,7 @@ class AudioPlayerService extends ChangeNotifier {
_lastAccrual = DateTime.now();
// Re-activate audio session in case a prior stop released it.
try {
- (await AudioSession.instance).setActive(true);
+ await _setAudioSessionActive(true);
} catch (_) {}
// If the player is idle (source was disposed), we need to fully re-initialize
// playback instead of just calling play() on an empty player.
@@ -6072,7 +6088,7 @@ class AudioPlayerService extends ChangeNotifier {
if (!ChromecastService().isCasting) {
debugPrint('[Battery] AudioSession DEACTIVATED (stop)');
try {
- (await AudioSession.instance).setActive(false);
+ await _setAudioSessionActive(false);
} catch (_) {}
}
}
diff --git a/lib/services/download_service.dart b/lib/services/download_service.dart
index 2d6d6659..8caf264a 100644
--- a/lib/services/download_service.dart
+++ b/lib/services/download_service.dart
@@ -15,6 +15,7 @@ import 'api_service.dart';
import 'audio_player_service.dart';
import 'ebook_cache.dart';
import 'offline_source.dart';
+import '../utils/app_platform.dart';
enum DownloadStatus { none, downloading, downloaded, error }
@@ -584,6 +585,10 @@ class DownloadService extends ChangeNotifier {
_queue.map((q) => _downloads[q.itemId]).whereType<DownloadInfo>().toList();
Future<void> init() {
+ if (AppPlatform.isWeb) {
+ _initialized = true;
+ return Future.value();
+ }
if (_initialized) return Future.value();
final inFlight = _initFuture;
if (inFlight != null) return inFlight;
@@ -1266,6 +1271,9 @@ class DownloadService extends ChangeNotifier {
String? libraryId,
bool Function()? shouldStart,
}) async {
+ if (AppPlatform.isWeb) {
+ return 'Downloads are not available in the browser.';
+ }
if (shouldStart?.call() == false) return null;
try {
await init().timeout(const Duration(seconds: 8));
diff --git a/lib/utils/app_platform.dart b/lib/utils/app_platform.dart
new file mode 100644
index 00000000..7d5c7ee7
--- /dev/null
+++ b/lib/utils/app_platform.dart
@@ -0,0 +1,15 @@
+import 'dart:io';
+
+import 'package:flutter/foundation.dart';
+
+abstract final class AppPlatform {
+ static bool get isWeb => kIsWeb;
+ static bool get isAndroid => !kIsWeb && Platform.isAndroid;
+ static bool get isIOS => !kIsWeb && Platform.isIOS;
+ static bool get isMacOS => !kIsWeb && Platform.isMacOS;
+ static bool get isWindows => !kIsWeb && Platform.isWindows;
+ static bool get isLinux => !kIsWeb && Platform.isLinux;
+
+ static bool get isDesktop => isMacOS || isWindows || isLinux;
+ static bool get isMobile => isAndroid || isIOS;
+}
diff --git a/lib/widgets/absorb_page_header.dart b/lib/widgets/absorb_page_header.dart
index b2616761..eefd5b8c 100644
--- a/lib/widgets/absorb_page_header.dart
+++ b/lib/widgets/absorb_page_header.dart
@@ -13,6 +13,7 @@ class AbsorbPageHeader extends StatelessWidget {
final Color? titleColor;
final List<Widget>? actions;
final Widget? trailing;
+ final bool showBranding;
final EdgeInsetsGeometry padding;
const AbsorbPageHeader({
@@ -22,6 +23,7 @@ class AbsorbPageHeader extends StatelessWidget {
this.titleColor,
this.actions,
this.trailing,
+ this.showBranding = true,
this.padding = const EdgeInsets.fromLTRB(20, 12, 20, 0),
});
@@ -39,46 +41,51 @@ class AbsorbPageHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Branding row — ABSORB + optional actions
- LayoutBuilder(
- builder: (ctx, lc) {
- return ConstrainedBox(
- constraints: const BoxConstraints(minHeight: 32),
- child: Row(
- children: [
- Text(
- l.appTitle,
- style: tt.labelSmall?.copyWith(
- color: bColor,
- letterSpacing: 4,
- fontWeight: FontWeight.w300,
- ),
- ),
- if (trailing != null) ...[
- const SizedBox(width: 8),
- trailing!,
- ],
- const Spacer(),
- if (actions != null)
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: (lc.maxWidth - 140).clamp(0.0, double.infinity),
+ if (showBranding) ...[
+ LayoutBuilder(
+ builder: (ctx, lc) {
+ return ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 32),
+ child: Row(
+ children: [
+ Text(
+ l.appTitle,
+ style: tt.labelSmall?.copyWith(
+ color: bColor,
+ letterSpacing: 4,
+ fontWeight: FontWeight.w300,
),
- child: FittedBox(
- fit: BoxFit.scaleDown,
- alignment: Alignment.centerRight,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- spacing: 8,
- children: actions!,
+ ),
+ if (trailing != null) ...[
+ const SizedBox(width: 8),
+ trailing!,
+ ],
+ const Spacer(),
+ if (actions != null)
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: (lc.maxWidth - 140).clamp(
+ 0.0,
+ double.infinity,
+ ),
+ ),
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ alignment: Alignment.centerRight,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ spacing: 8,
+ children: actions!,
+ ),
),
),
- ),
- ],
- ),
- );
- },
- ),
- const SizedBox(height: 4),
+ ],
+ ),
+ );
+ },
+ ),
+ const SizedBox(height: 4),
+ ],
// Page title
Text(
title,
diff --git a/lib/widgets/absorbing_shared.dart b/lib/widgets/absorbing_shared.dart
index 76f0944e..e40a1122 100644
--- a/lib/widgets/absorbing_shared.dart
+++ b/lib/widgets/absorbing_shared.dart
@@ -7,6 +7,7 @@ import '../providers/auth_provider.dart';
import '../providers/library_provider.dart';
import '../services/download_service.dart';
import '../services/playback_history_service.dart';
+import '../utils/app_platform.dart';
import 'overlay_toast.dart';
String dateLabel(DateTime dt, [AppLocalizations? l]) {
@@ -172,16 +173,26 @@ class DownloadWideButton extends StatefulWidget {
}
class _DownloadWideButtonState extends State<DownloadWideButton> {
- final _dl = DownloadService();
+ DownloadService? _dl;
- @override void initState() { super.initState(); _dl.addListener(_rebuild); }
- @override void dispose() { _dl.removeListener(_rebuild); super.dispose(); }
+ @override void initState() {
+ super.initState();
+ if (!AppPlatform.isWeb) {
+ _dl = DownloadService()..addListener(_rebuild);
+ }
+ }
+ @override void dispose() {
+ _dl?.removeListener(_rebuild);
+ super.dispose();
+ }
void _rebuild() { if (mounted) setState(() {}); }
@override Widget build(BuildContext context) {
- final downloading = _dl.isDownloading(widget.itemId);
- final downloaded = _dl.isDownloaded(widget.itemId);
- final progress = _dl.downloadProgress(widget.itemId);
+ final dl = _dl;
+ if (dl == null) return const SizedBox.shrink();
+ final downloading = dl.isDownloading(widget.itemId);
+ final downloaded = dl.isDownloaded(widget.itemId);
+ final progress = dl.downloadProgress(widget.itemId);
final l = AppLocalizations.of(context)!;
final isDark = Theme.of(context).brightness == Brightness.dark;
@@ -238,28 +249,30 @@ class _DownloadWideButtonState extends State<DownloadWideButton> {
}
void _handleTap(BuildContext context) async {
+ final dl = _dl;
+ if (dl == null) return;
final auth = context.read<AuthProvider>();
final api = auth.apiService;
if (api == null) return;
final l = AppLocalizations.of(context)!;
- if (_dl.isDownloaded(widget.itemId)) {
+ if (dl.isDownloaded(widget.itemId)) {
showDialog(context: context, builder: (ctx) => AlertDialog(
title: Text(l.removeDownloadQuestion),
content: Text(l.removeDownloadContent),
actions: [
TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel)),
TextButton(onPressed: () {
- _dl.deleteDownload(widget.itemId);
+ dl.deleteDownload(widget.itemId);
Navigator.pop(ctx);
showOverlayToast(context, l.downloadRemoved, icon: Icons.delete_outline_rounded);
},
child: Text(l.remove, style: const TextStyle(color: Colors.redAccent))),
],
));
- } else if (_dl.isDownloading(widget.itemId)) {
- _dl.cancelDownload(widget.itemId);
+ } else if (dl.isDownloading(widget.itemId)) {
+ dl.cancelDownload(widget.itemId);
} else {
- final error = await _dl.downloadItem(api: api, itemId: widget.itemId, title: widget.title, author: widget.author, coverUrl: widget.coverUrl, libraryId: context.read<LibraryProvider>().selectedLibraryId);
+ final error = await dl.downloadItem(api: api, itemId: widget.itemId, title: widget.title, author: widget.author, coverUrl: widget.coverUrl, libraryId: context.read<LibraryProvider>().selectedLibraryId);
if (error != null && context.mounted) {
showOverlayToast(context, error, icon: Icons.error_outline_rounded);
}
diff --git a/lib/widgets/audible_series_sheet.dart b/lib/widgets/audible_series_sheet.dart
index c0d7b48d..fe04d0bb 100644
--- a/lib/widgets/audible_series_sheet.dart
+++ b/lib/widgets/audible_series_sheet.dart
@@ -1,4 +1,3 @@
-import 'dart:io';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -8,6 +7,7 @@ import '../services/player_settings.dart';
import '../services/rmab_service.dart';
import '../services/scoped_prefs.dart';
import '../services/upcoming_releases_service.dart';
+import '../utils/app_platform.dart';
import 'overlay_toast.dart';
import 'rmab_book_detail_sheet.dart';
import 'rmab_config_sheet.dart' show kRmabBaseUrlKey, kRmabApiTokenKey;
@@ -693,7 +693,7 @@ Future<void> _addToCalendar(BuildContext context, String title, String seriesNam
final eventTitle = '$title - $seriesName';
final description = l.audibleSeriesCalendarDescription(seriesName);
- if (Platform.isAndroid) {
+ if (AppPlatform.isAndroid) {
final begin = DateTime(date.year, date.month, date.day).millisecondsSinceEpoch;
final end = DateTime(date.year, date.month, date.day, 23, 59).millisecondsSinceEpoch;
final uri = Uri.parse(
diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dart
index dd4ec2e8..d407aff5 100644
--- a/lib/widgets/book_detail_sheet.dart
+++ b/lib/widgets/book_detail_sheet.dart
@@ -11,6 +11,7 @@ import 'overlay_toast.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:palette_generator/palette_generator.dart';
import '../utils/cover_accent.dart';
+import '../utils/app_platform.dart';
import 'package:path_provider/path_provider.dart';
import 'package:file_picker/file_picker.dart';
import 'package:http/http.dart' as http;
@@ -622,7 +623,15 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
const SizedBox(height: 12),
],
- if (isEbookOnly && ebookFile != null && canReadEbook(ebookFile))
+ if (isEbookOnly && AppPlatform.isWeb)
+ SizedBox(height: 52, child: FilledButton.icon(
+ onPressed: null,
+ icon: const Icon(Icons.menu_book_rounded, size: 24),
+ label: Text(l.ebookOnlyNoAudio,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
+ style: FilledButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),
+ ))
+ else if (isEbookOnly && ebookFile != null && canReadEbook(ebookFile))
SizedBox(height: 52, child: FilledButton.icon(
onPressed: () => _openEbookReader(context, auth, ebookFile, title),
icon: const Icon(Icons.menu_book_rounded, size: 24),
@@ -712,7 +721,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
// Primary action row: Download | Fully Absorb | Read (when ebook)
const SizedBox(height: 12),
Row(children: [
- if (!isEbookOnly) ...[
+ if (!isEbookOnly && !AppPlatform.isWeb) ...[
Expanded(child: DownloadWideButton(itemId: widget.itemId, coverUrl: _coverUrl, title: title, author: authorName, accent: accent)),
const SizedBox(width: 8),
],
@@ -744,7 +753,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
]),
),
)),
- if (ebookFile != null && canReadEbook(ebookFile)) ...[
+ if (!AppPlatform.isWeb && ebookFile != null && canReadEbook(ebookFile)) ...[
const SizedBox(width: 8),
// For ebook-only books the big button above is already "Read", so this
// slot is the offline download (matching the audiobook download
@@ -1025,8 +1034,10 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
if (!isEbookOnly)
Row(children: [
Expanded(child: _quickAbsorbButton(context, cs, tt, auth, accent, onAccent, title, authorName, duration, chapters, isFinished)),
- const SizedBox(width: 10),
- Expanded(child: DownloadWideButton(itemId: widget.itemId, coverUrl: _coverUrl, title: title, author: authorName, accent: accent)),
+ if (!AppPlatform.isWeb) ...[
+ const SizedBox(width: 10),
+ Expanded(child: DownloadWideButton(itemId: widget.itemId, coverUrl: _coverUrl, title: title, author: authorName, accent: accent)),
+ ],
])
else
SizedBox(height: 44, child: Center(child: Text(l.ebookOnlyNoAudio,
@@ -1108,14 +1119,14 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
if (!lib.isOffline && !lib.isPodcastLibrary && auth.isAdmin) {
add(Icons.collections_bookmark_rounded, l.addToCollection, () => CollectionPickerSheet.show(context, widget.itemId));
}
- if (ebookFile != null && canReadEbook(ebookFile)) {
+ if (!AppPlatform.isWeb && ebookFile != null && canReadEbook(ebookFile)) {
add(Icons.menu_book_rounded, l.readEbook, () => _openEbookReader(context, auth, ebookFile, title));
}
- if (ebookFile != null) {
+ if (!AppPlatform.isWeb && ebookFile != null) {
add(_ebookSaved ? Icons.download_done_rounded : Icons.save_alt_rounded,
l.ebookSaveToDevice, () => _saveEbook(context, auth, ebookFile, title));
}
- if (ebookFile != null && auth.ereaderDevices.isNotEmpty) {
+ if (!AppPlatform.isWeb && ebookFile != null && auth.ereaderDevices.isNotEmpty) {
add(Icons.send_to_mobile_rounded, l.sendToEreader, () => _sendToEreader(context, auth));
}
if (progress > 0 || isFinished) {
diff --git a/lib/widgets/bookmark_detail_dialog.dart b/lib/widgets/bookmark_detail_dialog.dart
index e0e032da..26c2391f 100644
--- a/lib/widgets/bookmark_detail_dialog.dart
+++ b/lib/widgets/bookmark_detail_dialog.dart
@@ -1,5 +1,3 @@
-import 'dart:io';
-
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -9,6 +7,7 @@ import '../services/api_service.dart';
import '../services/bookmark_service.dart';
import '../services/bookmark_preview_player.dart';
import '../services/download_service.dart';
+import '../utils/app_platform.dart';
import 'clip_editor_sheet.dart';
import 'overlay_toast.dart';
@@ -105,7 +104,7 @@ class _BookmarkDetailSheetState extends State<BookmarkDetailSheet> {
// iOS can't export from a streaming book, so prompt to download up front
// rather than letting the user trim a clip and only fail at Save. Android
// exports streamed clips fine, so it always opens the editor.
- if (Platform.isIOS && !DownloadService().isDownloaded(widget.itemId)) {
+ if (AppPlatform.isIOS && !DownloadService().isDownloaded(widget.itemId)) {
await _promptDownload();
return;
}
@@ -287,15 +286,17 @@ class _BookmarkDetailSheetState extends State<BookmarkDetailSheet> {
),
),
const SizedBox(height: 8),
- SizedBox(
- width: double.infinity,
- child: OutlinedButton.icon(
- icon: const Icon(Icons.content_cut_rounded, size: 18),
- label: Text(l.clipExport),
- onPressed: _saving ? null : _openClipEditor,
+ if (!AppPlatform.isWeb) ...[
+ SizedBox(
+ width: double.infinity,
+ child: OutlinedButton.icon(
+ icon: const Icon(Icons.content_cut_rounded, size: 18),
+ label: Text(l.clipExport),
+ onPressed: _saving ? null : _openClipEditor,
+ ),
),
- ),
- const SizedBox(height: 16),
+ const SizedBox(height: 16),
+ ],
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
diff --git a/lib/widgets/card_button_config.dart b/lib/widgets/card_button_config.dart
index 2cabaa25..7aff5a7f 100644
--- a/lib/widgets/card_button_config.dart
+++ b/lib/widgets/card_button_config.dart
@@ -1,8 +1,8 @@
-import 'dart:io';
import 'package:flutter/material.dart';
import '../l10n/app_localizations.dart';
import '../services/chromecast_service.dart';
import '../services/wording.dart';
+import '../utils/app_platform.dart';
class CardButtonDef {
final String id;
@@ -52,10 +52,16 @@ String localizedCardButtonLabel(AppLocalizations l, CardButtonDef def) {
/// - F-Droid (GMS-free): Chromecast needs Google Play Services, so the stub
/// service reports castSupported=false and the button is dropped entirely.
final Set<String> _hiddenButtons = {
- if (Platform.isIOS) 'cast',
+ if (AppPlatform.isWeb || AppPlatform.isIOS) 'cast',
if (!ChromecastService.castSupported) 'cast',
// AirPlay is iOS-only (Chromecast covers Android).
- if (!Platform.isIOS) 'airplay',
+ if (AppPlatform.isWeb || !AppPlatform.isIOS) 'airplay',
+ if (AppPlatform.isWeb) ...{
+ 'car',
+ 'download',
+ 'ebook',
+ 'equalizer',
+ },
};
const _allCardButtons = [
diff --git a/lib/widgets/collapsible_section.dart b/lib/widgets/collapsible_section.dart
index c3bd8907..01343ca5 100644
--- a/lib/widgets/collapsible_section.dart
+++ b/lib/widgets/collapsible_section.dart
@@ -6,6 +6,7 @@ class CollapsibleSection extends StatefulWidget {
final ColorScheme cs;
final List<Widget> children;
final bool isExpanded;
+ final bool desktopMode;
final ValueChanged<bool>? onExpansionChanged;
const CollapsibleSection({
@@ -15,6 +16,7 @@ class CollapsibleSection extends StatefulWidget {
required this.cs,
required this.children,
this.isExpanded = false,
+ this.desktopMode = false,
this.onExpansionChanged,
});
@@ -29,7 +31,10 @@ class _CollapsibleSectionState extends State<CollapsibleSection> {
@override
void didUpdateWidget(covariant CollapsibleSection oldWidget) {
super.didUpdateWidget(oldWidget);
- if (_isBuilt && widget.isExpanded != oldWidget.isExpanded) {
+ if (_isBuilt &&
+ !widget.desktopMode &&
+ !oldWidget.desktopMode &&
+ widget.isExpanded != oldWidget.isExpanded) {
if (widget.isExpanded) {
_controller.expand();
} else {
@@ -38,17 +43,79 @@ class _CollapsibleSectionState extends State<CollapsibleSection> {
}
}
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
_isBuilt = true;
final isDark = Theme.of(context).brightness == Brightness.dark;
+ if (widget.desktopMode) {
+ if (!widget.isExpanded) return const SizedBox.shrink();
+ return Card(
+ elevation: isDark ? 0 : 1,
+ margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
+ color: widget.cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(18),
+ side: BorderSide(
+ color: widget.cs.outlineVariant.withValues(alpha: 0.35),
+ ),
+ ),
+ clipBehavior: Clip.antiAlias,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 18, 20, 16),
+ child: Row(
+ children: [
+ Container(
+ width: 38,
+ height: 38,
+ decoration: BoxDecoration(
+ color: widget.cs.primary.withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(11),
+ ),
+ child: Icon(
+ widget.icon,
+ color: widget.cs.primary,
+ size: 21,
+ ),
+ ),
+ const SizedBox(width: 13),
+ Expanded(
+ child: Text(
+ widget.title,
+ style: Theme.of(context).textTheme.titleLarge?.copyWith(
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Divider(
+ height: 1,
+ color: widget.cs.outlineVariant.withValues(alpha: 0.35),
+ ),
+ ...widget.children,
+ ],
+ ),
+ );
+ }
return Card(
elevation: isDark ? 0 : 2,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
color: widget.cs.surfaceContainerHighest,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
- side: isDark ? BorderSide(color: widget.cs.outlineVariant.withValues(alpha: 0.3)) : BorderSide.none,
+ side: isDark
+ ? BorderSide(color: widget.cs.outlineVariant.withValues(alpha: 0.3))
+ : BorderSide.none,
),
clipBehavior: Clip.antiAlias,
child: Theme(
@@ -58,7 +125,10 @@ class _CollapsibleSectionState extends State<CollapsibleSection> {
initiallyExpanded: widget.isExpanded,
onExpansionChanged: widget.onExpansionChanged,
leading: Icon(widget.icon, color: widget.cs.primary, size: 22),
- title: Text(widget.title, style: TextStyle(fontWeight: FontWeight.w600)),
+ title: Text(
+ widget.title,
+ style: TextStyle(fontWeight: FontWeight.w600),
+ ),
childrenPadding: EdgeInsets.zero,
tilePadding: const EdgeInsets.symmetric(horizontal: 16),
children: widget.children,
diff --git a/lib/widgets/desktop_now_playing_bar.dart b/lib/widgets/desktop_now_playing_bar.dart
new file mode 100644
index 00000000..27314219
--- /dev/null
+++ b/lib/widgets/desktop_now_playing_bar.dart
@@ -0,0 +1,623 @@
+import 'dart:async';
+
+import 'package:cached_network_image/cached_network_image.dart';
+import 'package:flutter/material.dart';
+
+import '../providers/library_provider.dart';
+import '../services/audio_player_service.dart';
+
+class DesktopNowPlayingBar extends StatefulWidget {
+ final AudioPlayerService player;
+ final LibraryProvider library;
+ final VoidCallback onOpenFullPlayer;
+
+ const DesktopNowPlayingBar({
+ super.key,
+ required this.player,
+ required this.library,
+ required this.onOpenFullPlayer,
+ });
+
+ @override
+ State<DesktopNowPlayingBar> createState() => _DesktopNowPlayingBarState();
+}
+
+class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {
+ int _backSkip = 10;
+ int _forwardSkip = 30;
+ List<double> _speedPresets = List<double>.from(
+ PlayerSettings.defaultSpeedPresets,
+ );
+ String? _lastItemId;
+ String? _lastLibraryId;
+ double? _dragPositionSeconds;
+ double _volume = 1;
+ double _volumeBeforeMute = 1;
+
+ @override
+ void initState() {
+ super.initState();
+ _lastItemId = widget.player.currentItemId;
+ _lastLibraryId = widget.player.currentLibraryId;
+ _volume = widget.player.volume.clamp(0.0, 1.0);
+ if (_volume > 0) _volumeBeforeMute = _volume;
+ widget.player.addListener(_onPlayerChanged);
+ PlayerSettings.settingsChanged.addListener(_loadControlSettings);
+ _loadControlSettings();
+ }
+
+ @override
+ void didUpdateWidget(DesktopNowPlayingBar oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (!identical(oldWidget.player, widget.player)) {
+ oldWidget.player.removeListener(_onPlayerChanged);
+ widget.player.addListener(_onPlayerChanged);
+ _lastItemId = widget.player.currentItemId;
+ _lastLibraryId = widget.player.currentLibraryId;
+ _volume = widget.player.volume.clamp(0.0, 1.0);
+ _loadControlSettings();
+ }
+ }
+
+ @override
+ void dispose() {
+ widget.player.removeListener(_onPlayerChanged);
+ PlayerSettings.settingsChanged.removeListener(_loadControlSettings);
+ super.dispose();
+ }
+
+ void _onPlayerChanged() {
+ if (!mounted) return;
+ final itemId = widget.player.currentItemId;
+ final libraryId = widget.player.currentLibraryId;
+ final itemChanged = itemId != _lastItemId;
+ final libraryChanged = libraryId != _lastLibraryId;
+ _lastItemId = itemId;
+ _lastLibraryId = libraryId;
+ if (itemChanged) _dragPositionSeconds = null;
+ if (libraryChanged) _loadControlSettings();
+ setState(() {});
+ }
+
+ Future<void> _loadControlSettings() async {
+ final libraryId = widget.player.currentLibraryId;
+ final results = await Future.wait<Object>([
+ PlayerSettings.getEffectiveBackSkip(libraryId: libraryId),
+ PlayerSettings.getEffectiveForwardSkip(libraryId: libraryId),
+ PlayerSettings.getSpeedPresets(),
+ ]);
+ if (!mounted) return;
+ setState(() {
+ _backSkip = results[0] as int;
+ _forwardSkip = results[1] as int;
+ _speedPresets = results[2] as List<double>;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final player = widget.player;
+ if (!player.hasBook) return const SizedBox.shrink();
+
+ final cs = Theme.of(context).colorScheme;
+ final title = player.currentTitle?.trim();
+ final author = player.currentAuthor?.trim();
+ final displayTitle = title == null || title.isEmpty
+ ? 'Unknown title'
+ : title;
+ final displayAuthor = author == null || author.isEmpty
+ ? 'Unknown author'
+ : author;
+ final totalSeconds = _safeTotalSeconds(player.totalDuration);
+
+ return Material(
+ color: cs.surfaceContainerLow,
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ border: Border(
+ top: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.4)),
+ ),
+ ),
+ child: SizedBox(
+ height: 94,
+ child: Column(
+ children: [
+ SizedBox(
+ height: 28,
+ child: StreamBuilder<Duration>(
+ stream: player.absolutePositionStream,
+ initialData: player.position,
+ builder: (context, snapshot) {
+ final streamSeconds =
+ (snapshot.data ?? player.position).inMilliseconds /
+ 1000.0;
+ final positionSeconds = _effectivePosition(
+ streamSeconds,
+ totalSeconds,
+ );
+ return _PositionControl(
+ positionSeconds: positionSeconds,
+ totalSeconds: totalSeconds,
+ enabled: totalSeconds > 0,
+ accent: cs.primary,
+ onChangeStart: (value) {
+ setState(() => _dragPositionSeconds = value);
+ },
+ onChanged: (value) {
+ setState(() => _dragPositionSeconds = value);
+ },
+ onChangeEnd: (value) async {
+ setState(() => _dragPositionSeconds = value);
+ await player.seekTo(
+ Duration(milliseconds: (value * 1000).round()),
+ );
+ if (mounted) {
+ setState(() => _dragPositionSeconds = null);
+ }
+ },
+ );
+ },
+ ),
+ ),
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
+ child: Row(
+ children: [
+ Expanded(
+ flex: 4,
+ child: _NowPlayingIdentity(
+ coverUrl: _coverUrl(),
+ mediaHeaders: widget.library.mediaHeaders,
+ title: displayTitle,
+ author: displayAuthor,
+ onTap: widget.onOpenFullPlayer,
+ ),
+ ),
+ const SizedBox(width: 16),
+ ConstrainedBox(
+ constraints: const BoxConstraints(minWidth: 210),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ _SkipButton(
+ seconds: _backSkip,
+ forward: false,
+ onPressed: player.hasActiveSession
+ ? () => player.skipBackward(_backSkip)
+ : null,
+ ),
+ const SizedBox(width: 8),
+ Tooltip(
+ message: player.isPlaying ? 'Pause' : 'Play',
+ child: IconButton.filled(
+ onPressed:
+ player.isLoadingOrBuffering &&
+ !player.isPlaying
+ ? null
+ : player.togglePlayPause,
+ icon:
+ player.isLoadingOrBuffering &&
+ !player.isPlaying
+ ? SizedBox(
+ width: 20,
+ height: 20,
+ child: CircularProgressIndicator(
+ strokeWidth: 2,
+ color: cs.onPrimary,
+ ),
+ )
+ : Icon(
+ player.isPlaying
+ ? Icons.pause_rounded
+ : Icons.play_arrow_rounded,
+ ),
+ iconSize: 27,
+ style: IconButton.styleFrom(
+ minimumSize: const Size.square(46),
+ maximumSize: const Size.square(46),
+ ),
+ ),
+ ),
+ const SizedBox(width: 8),
+ _SkipButton(
+ seconds: _forwardSkip,
+ forward: true,
+ onPressed: player.hasActiveSession
+ ? () => player.skipForward(_forwardSkip)
+ : null,
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: 24),
+ Expanded(
+ flex: 3,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ _SpeedControl(
+ speed: player.speed,
+ presets: _speedPresets,
+ onSelected: player.setSpeed,
+ ),
+ const SizedBox(width: 12),
+ Tooltip(
+ message: _volume <= 0 ? 'Unmute' : 'Mute',
+ child: IconButton(
+ onPressed: _toggleMute,
+ icon: Icon(
+ _volumeIcon,
+ size: 20,
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ Flexible(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(
+ minWidth: 72,
+ maxWidth: 130,
+ ),
+ child: SliderTheme(
+ data: SliderTheme.of(context).copyWith(
+ trackHeight: 3,
+ thumbShape: const RoundSliderThumbShape(
+ enabledThumbRadius: 5,
+ ),
+ overlayShape: const RoundSliderOverlayShape(
+ overlayRadius: 12,
+ ),
+ ),
+ child: Slider(
+ value: _volume,
+ onChanged: _setVolume,
+ semanticFormatterCallback: (value) =>
+ 'Volume ${(value * 100).round()} percent',
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ String? _coverUrl() {
+ final itemId = widget.player.currentItemId;
+ final providerUrl = widget.library.getCoverUrl(itemId, width: 160);
+ if (providerUrl != null && providerUrl.isNotEmpty) return providerUrl;
+ final playerUrl = widget.player.currentCoverUrl;
+ return playerUrl == null || playerUrl.isEmpty ? null : playerUrl;
+ }
+
+ double _effectivePosition(double streamSeconds, double totalSeconds) {
+ final raw = _dragPositionSeconds ?? streamSeconds;
+ if (!raw.isFinite || raw <= 0 || totalSeconds <= 0) return 0;
+ return raw.clamp(0.0, totalSeconds).toDouble();
+ }
+
+ static double _safeTotalSeconds(double value) {
+ if (!value.isFinite || value <= 0) return 0;
+ return value;
+ }
+
+ IconData get _volumeIcon {
+ if (_volume <= 0) return Icons.volume_off_rounded;
+ if (_volume < 0.5) return Icons.volume_down_rounded;
+ return Icons.volume_up_rounded;
+ }
+
+ void _setVolume(double value) {
+ setState(() {
+ _volume = value;
+ if (value > 0) _volumeBeforeMute = value;
+ });
+ unawaited(widget.player.setVolume(value));
+ }
+
+ void _toggleMute() {
+ _setVolume(_volume <= 0 ? _volumeBeforeMute : 0);
+ }
+}
+
+class _PositionControl extends StatelessWidget {
+ final double positionSeconds;
+ final double totalSeconds;
+ final bool enabled;
+ final Color accent;
+ final ValueChanged<double> onChangeStart;
+ final ValueChanged<double> onChanged;
+ final ValueChanged<double> onChangeEnd;
+
+ const _PositionControl({
+ required this.positionSeconds,
+ required this.totalSeconds,
+ required this.enabled,
+ required this.accent,
+ required this.onChangeStart,
+ required this.onChanged,
+ required this.onChangeEnd,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final tt = Theme.of(context).textTheme;
+ final cs = Theme.of(context).colorScheme;
+ final max = enabled ? totalSeconds : 1.0;
+ final value = enabled ? positionSeconds.clamp(0.0, max).toDouble() : 0.0;
+ final remaining = enabled ? totalSeconds - value : 0.0;
+ final timeStyle = tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontSize: 10,
+ fontFeatures: const [FontFeature.tabularFigures()],
+ );
+
+ return Row(
+ children: [
+ const SizedBox(width: 12),
+ SizedBox(
+ width: 50,
+ child: Text(
+ _formatTime(value),
+ textAlign: TextAlign.right,
+ style: timeStyle,
+ ),
+ ),
+ Expanded(
+ child: SliderTheme(
+ data: SliderTheme.of(context).copyWith(
+ activeTrackColor: accent,
+ inactiveTrackColor: cs.onSurface.withValues(alpha: 0.12),
+ trackHeight: 3,
+ thumbColor: accent,
+ thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 5),
+ overlayShape: const RoundSliderOverlayShape(overlayRadius: 12),
+ ),
+ child: Slider(
+ value: value,
+ max: max,
+ onChangeStart: enabled ? onChangeStart : null,
+ onChanged: enabled ? onChanged : null,
+ onChangeEnd: enabled ? onChangeEnd : null,
+ semanticFormatterCallback: (value) =>
+ '${_formatTime(value)} of ${_formatTime(totalSeconds)}',
+ ),
+ ),
+ ),
+ SizedBox(
+ width: 50,
+ child: Text('-${_formatTime(remaining)}', style: timeStyle),
+ ),
+ const SizedBox(width: 12),
+ ],
+ );
+ }
+}
+
+class _NowPlayingIdentity extends StatelessWidget {
+ final String? coverUrl;
+ final Map<String, String> mediaHeaders;
+ final String title;
+ final String author;
+ final VoidCallback onTap;
+
+ const _NowPlayingIdentity({
+ required this.coverUrl,
+ required this.mediaHeaders,
+ required this.title,
+ required this.author,
+ required this.onTap,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final placeholder = ColoredBox(
+ color: cs.surfaceContainerHighest,
+ child: Icon(
+ Icons.auto_stories_rounded,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.55),
+ ),
+ );
+
+ return Semantics(
+ button: true,
+ label: 'Open full-screen player for $title',
+ child: Tooltip(
+ message: 'Open full-screen player',
+ child: InkWell(
+ onTap: onTap,
+ borderRadius: BorderRadius.circular(10),
+ child: Padding(
+ padding: const EdgeInsets.only(right: 8),
+ child: Row(
+ children: [
+ ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: SizedBox.square(
+ dimension: 54,
+ child: coverUrl == null
+ ? placeholder
+ : CachedNetworkImage(
+ imageUrl: coverUrl!,
+ httpHeaders: mediaHeaders,
+ fit: BoxFit.cover,
+ placeholder: (_, __) => placeholder,
+ errorWidget: (_, __, ___) => placeholder,
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: tt.titleSmall?.copyWith(
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ const SizedBox(height: 2),
+ Text(
+ author,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _SkipButton extends StatelessWidget {
+ final int seconds;
+ final bool forward;
+ final VoidCallback? onPressed;
+
+ const _SkipButton({
+ required this.seconds,
+ required this.forward,
+ required this.onPressed,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final direction = forward ? 'forward' : 'back';
+ return Tooltip(
+ message: 'Skip $direction $seconds seconds',
+ child: IconButton(onPressed: onPressed, icon: _icon(context)),
+ );
+ }
+
+ Widget _icon(BuildContext context) {
+ final color = onPressed == null
+ ? Theme.of(context).disabledColor
+ : Theme.of(context).colorScheme.onSurfaceVariant;
+ final builtIn = switch ((seconds, forward)) {
+ (5, true) => Icons.forward_5_rounded,
+ (10, true) => Icons.forward_10_rounded,
+ (30, true) => Icons.forward_30_rounded,
+ (5, false) => Icons.replay_5_rounded,
+ (10, false) => Icons.replay_10_rounded,
+ (30, false) => Icons.replay_30_rounded,
+ _ => null,
+ };
+ if (builtIn != null) return Icon(builtIn, color: color);
+ return Stack(
+ alignment: Alignment.center,
+ children: [
+ Icon(
+ forward ? Icons.rotate_right_rounded : Icons.rotate_left_rounded,
+ color: color,
+ ),
+ Text(
+ '$seconds',
+ style: TextStyle(
+ color: color,
+ fontSize: 8,
+ fontWeight: FontWeight.w800,
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+class _SpeedControl extends StatelessWidget {
+ final double speed;
+ final List<double> presets;
+ final ValueChanged<double> onSelected;
+
+ const _SpeedControl({
+ required this.speed,
+ required this.presets,
+ required this.onSelected,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final label = '${_formatSpeed(speed)}x';
+ return Semantics(
+ button: true,
+ label: 'Playback speed, $label',
+ child: PopupMenuButton<double>(
+ tooltip: 'Playback speed',
+ onSelected: onSelected,
+ itemBuilder: (context) => [
+ for (final preset in presets)
+ PopupMenuItem<double>(
+ value: preset,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text('${_formatSpeed(preset)}x'),
+ if ((preset - speed).abs() < 0.001)
+ Icon(Icons.check_rounded, size: 18, color: cs.primary),
+ ],
+ ),
+ ),
+ ],
+ child: Container(
+ height: 34,
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHighest,
+ borderRadius: BorderRadius.circular(18),
+ border: Border.all(color: cs.outlineVariant.withValues(alpha: 0.5)),
+ ),
+ alignment: Alignment.center,
+ child: Text(
+ label,
+ style: TextStyle(
+ color: cs.onSurface,
+ fontSize: 12,
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+String _formatTime(double seconds) {
+ final duration = Duration(seconds: seconds.isFinite ? seconds.round() : 0);
+ final hours = duration.inHours;
+ final minutes = duration.inMinutes.remainder(60).toString().padLeft(2, '0');
+ final secs = duration.inSeconds.remainder(60).toString().padLeft(2, '0');
+ if (hours > 0) return '$hours:$minutes:$secs';
+ return '${duration.inMinutes}:$secs';
+}
+
+String _formatSpeed(double speed) {
+ final fixed = speed.toStringAsFixed(2);
+ return fixed
+ .replaceFirst(RegExp(r'0+$'), '')
+ .replaceFirst(RegExp(r'\.$'), '');
+}
diff --git a/lib/widgets/episode_detail_sheet.dart b/lib/widgets/episode_detail_sheet.dart
index c89ce8ce..a084087b 100644
--- a/lib/widgets/episode_detail_sheet.dart
+++ b/lib/widgets/episode_detail_sheet.dart
@@ -20,6 +20,7 @@ import '../main.dart' show rootNavigatorKey;
import 'stackable_sheet.dart';
import 'episode_list_sheet.dart';
import '../utils/duration_format.dart';
+import '../utils/app_platform.dart';
class EpisodeDetailSheet extends StatefulWidget {
static final Set<String> _openEpisodeKeys = <String>{};
@@ -195,6 +196,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
}
Future<void> _download() async {
+ if (AppPlatform.isWeb) return;
final auth = context.read<AuthProvider>();
final api = auth.apiService;
if (api == null) return;
@@ -398,8 +400,10 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
// Download + Finished row
Row(children: [
- Expanded(child: _downloadCell(cs, l, dlKey)),
- const SizedBox(width: 8),
+ if (!AppPlatform.isWeb) ...[
+ Expanded(child: _downloadCell(cs, l, dlKey)),
+ const SizedBox(width: 8),
+ ],
Expanded(child: _finishedCell(cs, isFinished)),
const SizedBox(width: 8),
GestureDetector(
@@ -662,8 +666,10 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
_playButton(cs, tt, l, progress, isFinished),
const SizedBox(height: 10),
Row(children: [
- Expanded(child: _downloadCell(cs, l, dlKey)),
- const SizedBox(width: 8),
+ if (!AppPlatform.isWeb) ...[
+ Expanded(child: _downloadCell(cs, l, dlKey)),
+ const SizedBox(width: 8),
+ ],
Expanded(child: _finishedCell(cs, isFinished)),
]),
const SizedBox(height: 18),
diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dart
index f137cd95..9233bf8d 100644
--- a/lib/widgets/episode_list_sheet.dart
+++ b/lib/widgets/episode_list_sheet.dart
@@ -15,6 +15,7 @@ import '../services/chromecast_service.dart';
import '../providers/auth_provider.dart';
import '../screens/admin_podcasts_screen.dart';
import '../services/socket_service.dart';
+import '../utils/app_platform.dart';
import 'card_buttons.dart';
import 'html_description.dart';
import 'stackable_sheet.dart';
@@ -393,6 +394,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
}
Future<void> _downloadEpisode(Map<String, dynamic> episode) async {
+ if (AppPlatform.isWeb) return;
final auth = context.read<AuthProvider>();
final api = auth.apiService;
if (api == null) return;
@@ -419,6 +421,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
}
Future<void> _downloadAll() async {
+ if (AppPlatform.isWeb) return;
final auth = context.read<AuthProvider>();
final api = auth.apiService;
if (api == null) return;
@@ -469,14 +472,16 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
}
Widget _buildOverflowMenu(ColorScheme cs) {
- final dl = DownloadService();
int downloaded = 0;
- for (final ep in _episodes) {
- final eid = ep['id'] as String? ?? '';
- final key = '$_itemId-$eid';
- if (dl.isDownloaded(key)) downloaded++;
+ if (!AppPlatform.isWeb) {
+ final dl = DownloadService();
+ for (final ep in _episodes) {
+ final eid = ep['id'] as String? ?? '';
+ final key = '$_itemId-$eid';
+ if (dl.isDownloaded(key)) downloaded++;
+ }
}
- final allDownloaded = downloaded == _episodes.length;
+ final allDownloaded = !AppPlatform.isWeb && downloaded == _episodes.length;
if (_isDownloadingAll) {
return Padding(
@@ -511,12 +516,12 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
ActionPillGrid(items: [
- if (!allDownloaded)
+ if (!AppPlatform.isWeb && !allDownloaded)
ActionPillData(
icon: Icons.download_rounded,
label: downloaded > 0 ? l.downloadRemainingCount(_episodes.length - downloaded) : l.downloadAll,
onTap: () { Navigator.pop(ctx); _downloadAll(); }),
- if (_itemId.isNotEmpty)
+ if (!AppPlatform.isWeb && _itemId.isNotEmpty)
ActionPillData(
icon: _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,
label: _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,
@@ -743,7 +748,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {
return Wrap(spacing: 8, runSpacing: 8, alignment: WrapAlignment.center, children: [
if (!_isLoading) _chip(Icons.podcasts_rounded, l.episodeListEpisodeCount(_episodes.length)),
if (unfinishedCount > 0) _chip(Icons.fiber_new_rounded, l.episodeListUnfinishedCount(unfinishedCount), highlight: true),
- if (_autoDownloadEnabled) _chip(Icons.downloading_rounded, l.episodeListAutoDownloadChip),
+ if (!AppPlatform.isWeb && _autoDownloadEnabled) _chip(Icons.downloading_rounded, l.episodeListAutoDownloadChip),
if (_subscribed) _chip(Icons.notifications_active_rounded, l.episodeListSubscribedChip, highlight: true),
..._genres.take(3).map((g) => _chip(Icons.tag_rounded, g)),
..._tags.take(5).map((t) => _chip(Icons.local_offer_outlined, t)),
diff --git a/lib/widgets/episode_row.dart b/lib/widgets/episode_row.dart
index 2ee9c4e4..111b0f76 100644
--- a/lib/widgets/episode_row.dart
+++ b/lib/widgets/episode_row.dart
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
import '../l10n/app_localizations.dart';
import '../providers/library_provider.dart';
import '../services/download_service.dart';
+import '../utils/app_platform.dart';
import 'episode_detail_sheet.dart';
class EpisodeRow extends StatefulWidget {
@@ -175,7 +176,7 @@ class _EpisodeRowState extends State<EpisodeRow> {
style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant.withValues(alpha: 0.6)),
),
),
- ListenableBuilder(
+ if (!AppPlatform.isWeb) ListenableBuilder(
listenable: DownloadService(),
builder: (_, __) {
final downloaded = DownloadService().isDownloaded(dlKey);
@@ -197,7 +198,7 @@ class _EpisodeRowState extends State<EpisodeRow> {
mainAxisSize: MainAxisSize.min,
children: [
// Download button (reactive)
- ListenableBuilder(
+ if (!AppPlatform.isWeb) ListenableBuilder(
listenable: DownloadService(),
builder: (_, __) {
final dl = DownloadService();
diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dart
index a17956d0..c02e85b6 100644
--- a/lib/widgets/expanded_card.dart
+++ b/lib/widgets/expanded_card.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import '../l10n/app_localizations.dart';
@@ -18,6 +19,7 @@ import 'ebook_router.dart';
import 'overlay_toast.dart';
import '../services/ebook_cache.dart';
import '../main.dart' show colorSourceNotifier, useColorEverywhereNotifier, manualSeedNotifier, manualColorScheme;
+import '../utils/app_platform.dart';
// ─── Custom route: slide-up + fade ────────────────────────────
@@ -175,10 +177,12 @@ class _ExpandedCardState extends State<ExpandedCard> {
}
String? get _coverUrl {
- final episodeId = _episodeId;
- final downloadKey = episodeId == null ? _itemId : '$_itemId-$episodeId';
- final localCover = DownloadService().getInfo(downloadKey).localCoverPath;
- if (localCover != null && File(localCover).existsSync()) return localCover;
+ if (!AppPlatform.isWeb) {
+ final episodeId = _episodeId;
+ final downloadKey = episodeId == null ? _itemId : '$_itemId-$episodeId';
+ final localCover = DownloadService().getInfo(downloadKey).localCoverPath;
+ if (localCover != null && File(localCover).existsSync()) return localCover;
+ }
if (_isActive) {
final playingCover = widget.player.currentCoverUrl;
@@ -188,7 +192,8 @@ class _ExpandedCardState extends State<ExpandedCard> {
final lib = context.read<LibraryProvider>();
return lib.getCoverUrl(_itemId, width: 800);
}
- bool get _isLocalCover => _coverUrl != null && _coverUrl!.startsWith('/');
+ bool get _isLocalCover =>
+ !AppPlatform.isWeb && _coverUrl != null && _coverUrl!.startsWith('/');
@override
void initState() {
@@ -509,7 +514,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
final url = _coverUrl;
if (url == null) return;
final ImageProvider provider;
- if (url.startsWith('/')) {
+ if (!AppPlatform.isWeb && url.startsWith('/')) {
provider = FileImage(File(url));
} else {
provider = CachedNetworkImageProvider(url, headers: context.read<LibraryProvider>().mediaHeaders);
@@ -541,7 +546,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
try {
final ImageProvider provider;
- if (url.startsWith('/')) {
+ if (!AppPlatform.isWeb && url.startsWith('/')) {
provider = FileImage(File(url));
} else {
final lib = context.read<LibraryProvider>();
@@ -634,7 +639,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
bookProgress = progress;
}
- return GestureDetector(
+ final player = GestureDetector(
onVerticalDragEnd: (details) {
final vy = details.primaryVelocity ?? 0;
if (vy > 300) _dismissExpanded(); // swipe down to collapse
@@ -690,8 +695,10 @@ class _ExpandedCardState extends State<ExpandedCard> {
child: LayoutBuilder(
builder: (context, outerConstraints) {
final compact = outerConstraints.maxHeight < 600;
- // Landscape: split into left (cover) + right (controls/info).
- final wide = outerConstraints.maxWidth > outerConstraints.maxHeight;
+ final wide = AppPlatform.isWeb
+ ? outerConstraints.maxWidth >= 900
+ : outerConstraints.maxWidth >
+ outerConstraints.maxHeight;
final statsRow = Padding(
padding: EdgeInsets.fromLTRB(24, compact ? 4 : 12, 24, 0),
@@ -730,7 +737,8 @@ class _ExpandedCardState extends State<ExpandedCard> {
coverH = s;
}
final dlKey = _episodeId != null ? '$_itemId-$_episodeId' : _itemId;
- final isDownloaded = DownloadService().isDownloaded(dlKey);
+ final isDownloaded = !AppPlatform.isWeb &&
+ DownloadService().isDownloaded(dlKey);
final castService = ChromecastService();
final isCastingThis = castService.isCasting && castService.castingItemId == _itemId;
final coverPlaying = isCastingThis ? castService.isPlaying : (_isActive && widget.player.isPlaying);
@@ -987,10 +995,38 @@ class _ExpandedCardState extends State<ExpandedCard> {
);
}),
),
+ if (AppPlatform.isWeb)
+ Positioned(
+ top: 16,
+ right: 20,
+ child: Material(
+ color: cs.surface.withValues(alpha: 0.9),
+ elevation: 6,
+ shape: CircleBorder(
+ side: BorderSide(
+ color: cs.outlineVariant.withValues(alpha: 0.7),
+ ),
+ ),
+ child: IconButton(
+ tooltip:
+ MaterialLocalizations.of(context).closeButtonTooltip,
+ onPressed: _dismissExpanded,
+ icon: const Icon(Icons.close_rounded),
+ ),
+ ),
+ ),
],
),
),
);
+
+ if (!AppPlatform.isWeb) return player;
+ return CallbackShortcuts(
+ bindings: <ShortcutActivator, VoidCallback>{
+ const SingleActivator(LogicalKeyboardKey.escape): _dismissExpanded,
+ },
+ child: Focus(autofocus: true, child: player),
+ );
}
// ── Background builder ──
@@ -1204,4 +1240,3 @@ class _ExpandedCardState extends State<ExpandedCard> {
void _showMoreMenu(BuildContext context, Color accent, TextTheme tt) => _makeActions().showMoreMenu(accent, tt);
}
-
diff --git a/lib/widgets/library_sort_filter_sheet.dart b/lib/widgets/library_sort_filter_sheet.dart
index 96b81414..a41a9167 100644
--- a/lib/widgets/library_sort_filter_sheet.dart
+++ b/lib/widgets/library_sort_filter_sheet.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import '../l10n/app_localizations.dart';
import '../screens/library_screen.dart';
+import '../utils/app_platform.dart';
/// Which library tab the sort/filter sheet is being shown for.
enum LibraryTab { library, series, authors, narrators, lists }
@@ -389,7 +390,8 @@ class _SortFilterSheetState extends State<SortFilterSheet> with SingleTickerProv
(LibraryFilter.inProgress, l.inProgress, Icons.play_circle_outline_rounded),
(LibraryFilter.finished, l.filterFinished, Icons.check_circle_outline_rounded),
(LibraryFilter.notStarted, l.notStarted, Icons.circle_outlined),
- (LibraryFilter.downloaded, l.downloaded, Icons.download_done_rounded),
+ if (!AppPlatform.isWeb)
+ (LibraryFilter.downloaded, l.downloaded, Icons.download_done_rounded),
(LibraryFilter.hasEbook, l.hasEbook, Icons.menu_book_rounded),
(LibraryFilter.noEbook, l.noEbook, Icons.menu_book_outlined),
(
diff --git a/lib/widgets/offline_status_icon.dart b/lib/widgets/offline_status_icon.dart
index 323bd520..81da47f3 100644
--- a/lib/widgets/offline_status_icon.dart
+++ b/lib/widgets/offline_status_icon.dart
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
import '../l10n/app_localizations.dart';
import '../providers/auth_provider.dart';
import '../providers/library_provider.dart';
+import '../utils/app_platform.dart';
import 'overlay_toast.dart';
/// Cloud icon in page headers showing online/offline state.
@@ -17,6 +18,7 @@ class OfflineStatusIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ if (AppPlatform.isWeb) return const SizedBox.shrink();
final lib = context.watch<LibraryProvider>();
final auth = context.watch<AuthProvider>();
final l = AppLocalizations.of(context)!;
diff --git a/lib/widgets/podcast_episode_feed.dart b/lib/widgets/podcast_episode_feed.dart
index 87242497..c2ce34fd 100644
--- a/lib/widgets/podcast_episode_feed.dart
+++ b/lib/widgets/podcast_episode_feed.dart
@@ -11,6 +11,7 @@ import '../services/audio_player_service.dart';
import '../services/chromecast_service.dart';
import '../services/download_service.dart';
import '../services/scoped_prefs.dart';
+import '../utils/app_platform.dart';
import 'card_buttons.dart' show showErrorToast;
import 'episode_list_sheet.dart';
import 'episode_row.dart';
@@ -299,7 +300,7 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
child: url == null
? placeholder
// Downloaded shows resolve to a local file path.
- : url.startsWith('/')
+ : !AppPlatform.isWeb && url.startsWith('/')
? Image.file(
File(url),
width: 48,
@@ -328,7 +329,8 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
_filter,
progress: progress,
finished: finished,
- downloaded: DownloadService().isDownloaded('$showId-$epId'),
+ downloaded: !AppPlatform.isWeb &&
+ DownloadService().isDownloaded('$showId-$epId'),
subscribed: lib.isPodcastSubscribed(showId),
);
}
@@ -379,6 +381,7 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
}
Future<void> _downloadEpisode(Map<String, dynamic> ep) async {
+ if (AppPlatform.isWeb) return;
final api = context.read<AuthProvider>().apiService;
if (api == null) return;
final showId = _showIdOf(ep);
@@ -484,7 +487,7 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
('unplayed', l.filterUnplayed),
('inprogress', l.inProgress),
('finished', l.filterFinished),
- ('downloaded', l.downloaded),
+ if (!AppPlatform.isWeb) ('downloaded', l.downloaded),
]) ...[
ChoiceChip(
label: Text(label),
@@ -542,6 +545,9 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
true;
return Dismissible(
key: ValueKey('feed-$showId-$epId'),
+ direction: AppPlatform.isWeb
+ ? DismissDirection.startToEnd
+ : DismissDirection.horizontal,
// Swipes act without dismissing the row.
confirmDismiss: (direction) async {
if (direction == DismissDirection.startToEnd) {
@@ -562,15 +568,17 @@ class _PodcastEpisodeFeedState extends State<PodcastEpisodeFeed> {
color: cs.onPrimaryContainer,
),
),
- secondaryBackground: Container(
- color: cs.secondaryContainer,
- alignment: Alignment.centerRight,
- padding: const EdgeInsets.only(right: 24),
- child: Icon(
- Icons.download_rounded,
- color: cs.onSecondaryContainer,
- ),
- ),
+ secondaryBackground: AppPlatform.isWeb
+ ? null
+ : Container(
+ color: cs.secondaryContainer,
+ alignment: Alignment.centerRight,
+ padding: const EdgeInsets.only(right: 24),
+ child: Icon(
+ Icons.download_rounded,
+ color: cs.onSecondaryContainer,
+ ),
+ ),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index a7ae1f11..c00765a0 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -20,6 +20,7 @@ import 'action_pill.dart';
import 'books_sheet_shared.dart';
import '../services/api_service.dart';
import '../utils/duration_format.dart';
+import '../utils/app_platform.dart';
/// Show a bottom sheet with all books in a series, sorted by sequence.
/// Can be called from any screen.
@@ -748,13 +749,15 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
Widget _buildOverflowMenu(ColorScheme cs) {
final allDone = _allFinished;
- final dl = DownloadService();
int downloaded = 0;
- for (final book in _books) {
- final bookId = book['id'] as String? ?? '';
- if (dl.isDownloaded(bookId)) downloaded++;
+ if (!AppPlatform.isWeb) {
+ final dl = DownloadService();
+ for (final book in _books) {
+ final bookId = book['id'] as String? ?? '';
+ if (dl.isDownloaded(bookId)) downloaded++;
+ }
}
- final allDownloaded = downloaded == _books.length;
+ final allDownloaded = !AppPlatform.isWeb && downloaded == _books.length;
final hasSeriesId = widget.seriesId != null && widget.seriesId!.isNotEmpty;
if (_isMarkingAll || _isDownloadingAll) {
@@ -789,7 +792,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
ActionPillGrid(items: [
- if (!allDownloaded)
+ if (!AppPlatform.isWeb && !allDownloaded)
ActionPillData(
icon: Icons.download_rounded,
label: downloaded > 0 ? l.downloadRemainingCount((_totalBooks > 0 ? _totalBooks : _books.length) - downloaded) : l.downloadAll,
@@ -827,7 +830,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
if (confirmed == true) _markAllFinished();
}
}),
- if (hasSeriesId)
+ if (!AppPlatform.isWeb && hasSeriesId)
ActionPillData(
icon: _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,
label: _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,
@@ -848,6 +851,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
}
Future<void> _downloadAll() async {
+ if (AppPlatform.isWeb) return;
final auth = context.read<AuthProvider>();
final api = auth.apiService;
if (api == null) return;
@@ -963,7 +967,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
: base;
}(),
),
- if (_autoDownloadEnabled) ...[
+ if (!AppPlatform.isWeb && _autoDownloadEnabled) ...[
const TextSpan(text: ' · '),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
@@ -1099,9 +1103,15 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
final isExplicit = PlayerSettings.showExplicitBadge && metadata['explicit'] == true;
final progress = lib.getProgress(bookId);
final isFinished = lib.getProgressData(bookId)?['isFinished'] == true;
- final isDownloaded = DownloadService().isDownloaded(bookId);
- final isDownloading = DownloadService().isDownloading(bookId);
- final downloadPct = (DownloadService().downloadProgress(bookId) * 100).clamp(0, 100).round();
+ final isDownloaded =
+ !AppPlatform.isWeb && DownloadService().isDownloaded(bookId);
+ final isDownloading =
+ !AppPlatform.isWeb && DownloadService().isDownloading(bookId);
+ final downloadPct = AppPlatform.isWeb
+ ? 0
+ : (DownloadService().downloadProgress(bookId) * 100)
+ .clamp(0, 100)
+ .round();
final coverUrl = lib.getCoverUrl(bookId);
final isOnAbsorbing = lib.isOnAbsorbingList(bookId);
@@ -1152,7 +1162,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
child: Stack(children: [
Positioned.fill(
child: coverUrl != null
- ? (coverUrl.startsWith('/')
+ ? (!AppPlatform.isWeb && coverUrl.startsWith('/')
? Image.file(File(coverUrl), fit: BoxFit.cover,
errorBuilder: (_, __, ___) => _placeholder(cs))
: CachedNetworkImage(
diff --git a/lib/widgets/tips_sheet.dart b/lib/widgets/tips_sheet.dart
index 4f796c97..ecef7000 100644
--- a/lib/widgets/tips_sheet.dart
+++ b/lib/widgets/tips_sheet.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../l10n/app_localizations.dart';
import '../services/wording.dart';
+import '../utils/app_platform.dart';
void showTipsSheet(BuildContext context) {
final cs = Theme.of(context).colorScheme;
@@ -51,11 +52,12 @@ void showTipsSheet(BuildContext context) {
title: w.tipsSheetQuickAddAbsorbingTitle,
desc: w.tipsSheetQuickAddAbsorbingDesc,
),
- _tipCard(cs, tt,
- icon: Icons.vibration_rounded,
- title: l.tipsSheetShakeExtendSleepTitle,
- desc: l.tipsSheetShakeExtendSleepDesc,
- ),
+ if (!AppPlatform.isWeb)
+ _tipCard(cs, tt,
+ icon: Icons.vibration_rounded,
+ title: l.tipsSheetShakeExtendSleepTitle,
+ desc: l.tipsSheetShakeExtendSleepDesc,
+ ),
_tipCard(cs, tt,
icon: Icons.auto_stories_rounded,
title: l.tipsSheetSeriesNavigationTitle,
@@ -91,21 +93,23 @@ void showTipsSheet(BuildContext context) {
title: l.tipsSheetSeriesQueueModeTitle,
desc: l.tipsSheetSeriesQueueModeDesc,
),
- _tipCard(cs, tt,
- icon: Icons.airplanemode_active_rounded,
- title: l.tipsSheetOfflineModeTitle,
- desc: l.tipsSheetOfflineModeDesc,
- ),
+ if (!AppPlatform.isWeb)
+ _tipCard(cs, tt,
+ icon: Icons.airplanemode_active_rounded,
+ title: l.tipsSheetOfflineModeTitle,
+ desc: l.tipsSheetOfflineModeDesc,
+ ),
_tipCard(cs, tt,
icon: Icons.upcoming_rounded,
title: l.tipsSheetUpcomingReleasesTitle,
desc: l.tipsSheetUpcomingReleasesDesc,
),
- _tipCard(cs, tt,
- icon: Icons.equalizer_rounded,
- title: l.tipsSheetPerBookEqTitle,
- desc: l.tipsSheetPerBookEqDesc,
- ),
+ if (!AppPlatform.isWeb)
+ _tipCard(cs, tt,
+ icon: Icons.equalizer_rounded,
+ title: l.tipsSheetPerBookEqTitle,
+ desc: l.tipsSheetPerBookEqDesc,
+ ),
_tipCard(cs, tt,
icon: Icons.speed_rounded,
title: l.tipsSheetPerBookSpeedTitle,
@@ -121,11 +125,12 @@ void showTipsSheet(BuildContext context) {
title: l.tipsSheetSleepFadeChimeTitle,
desc: l.tipsSheetSleepFadeChimeDesc,
),
- _tipCard(cs, tt,
- icon: Icons.directions_car_rounded,
- title: l.tipsSheetCarModeTitle,
- desc: l.tipsSheetCarModeDesc,
- ),
+ if (!AppPlatform.isWeb)
+ _tipCard(cs, tt,
+ icon: Icons.directions_car_rounded,
+ title: l.tipsSheetCarModeTitle,
+ desc: l.tipsSheetCarModeDesc,
+ ),
_tipCard(cs, tt,
icon: Icons.search_rounded,
title: l.tipsSheetAudibleSeriesTitle,
diff --git a/web/favicon.png b/web/favicon.png
new file mode 100644
index 00000000..8aaa46ac
Binary files /dev/null and b/web/favicon.png differ
diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png
new file mode 100644
index 00000000..b749bfef
Binary files /dev/null and b/web/icons/Icon-192.png differ
diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png
new file mode 100644
index 00000000..88cfd48d
Binary files /dev/null and b/web/icons/Icon-512.png differ
diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png
new file mode 100644
index 00000000..eb9b4d76
Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ
diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png
new file mode 100644
index 00000000..d69c5669
Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 00000000..ceb90959
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <!--
+ If you are serving your web app in a path other than the root, change the
+ href value below to reflect the base path you are serving from.
+
+ The path provided below has to start and end with a slash "/" in order for
+ it to work correctly.
+
+ For more details:
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
+
+ This is a placeholder for base href that will be replaced by the value of
+ the `--base-href` argument provided to `flutter build`.
+ -->
+ <base href="$FLUTTER_BASE_HREF">
+
+ <meta charset="UTF-8">
+ <meta content="IE=Edge" http-equiv="X-UA-Compatible">
+ <meta name="description" content="Listen to your Audiobookshelf library with Absorb.">
+ <meta name="theme-color" content="#111318">
+
+ <!-- iOS meta tags & icons -->
+ <meta name="mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
+ <meta name="apple-mobile-web-app-title" content="Absorb">
+ <link rel="apple-touch-icon" href="assets/assets/icon/app_icon.png">
+
+ <!-- Favicon -->
+ <link rel="icon" type="image/png" href="assets/assets/icon/app_icon.png"/>
+
+ <title>Absorb</title>
+ <link rel="manifest" href="manifest.json">
+</head>
+<body>
+ <!--
+ You can customize the "flutter_bootstrap.js" script.
+ This is useful to provide a custom configuration to the Flutter loader
+ or to give the user feedback during the initialization process.
+
+ For more details:
+ * https://docs.flutter.dev/platform-integration/web/initialization
+ -->
+ <script src="flutter_bootstrap.js" async></script>
+</body>
+</html>
diff --git a/web/manifest.json b/web/manifest.json
new file mode 100644
index 00000000..f7b69950
--- /dev/null
+++ b/web/manifest.json
@@ -0,0 +1,18 @@
+{
+ "name": "Absorb for Audiobookshelf",
+ "short_name": "Absorb",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#111318",
+ "theme_color": "#111318",
+ "description": "Listen to your Audiobookshelf library with Absorb.",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "assets/assets/icon/app_icon.png",
+ "sizes": "1024x1024",
+ "type": "image/png",
+ "purpose": "any maskable"
+ }
+ ]
+}