A cross platform Audiobookshelf client for Android and iOS
Dart
Open pages and sheets inside the desktop pane and add hover actions to covers
Barnabas9c6fd17c5f03
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arbindex 41961be3..f126734d 100644--- a/lib/l10n/app_en.arb+++ b/lib/l10n/app_en.arb@@ -1677,6 +1677,10 @@"saved": "Downloaded","selectLibrary": "Select Library","switchLibraryTooltip": "Switch library",+ "refreshTooltip": "Refresh",+ "openNowPlayingTooltip": "Open Now Playing",+ "previousChapterTooltip": "Previous chapter",+ "nextChapterTooltip": "Next chapter","noBooksFound": "No books found","userFallback": "User","rootAdmin": "Root Admin",diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dartindex d8fca852..17529238 100644--- a/lib/l10n/app_localizations.dart+++ b/lib/l10n/app_localizations.dart@@ -6310,6 +6310,30 @@ abstract class AppLocalizations {/// **'Switch library'**String get switchLibraryTooltip;+ /// No description provided for @refreshTooltip.+ ///+ /// In en, this message translates to:+ /// **'Refresh'**+ String get refreshTooltip;++ /// No description provided for @openNowPlayingTooltip.+ ///+ /// In en, this message translates to:+ /// **'Open Now Playing'**+ String get openNowPlayingTooltip;++ /// No description provided for @previousChapterTooltip.+ ///+ /// In en, this message translates to:+ /// **'Previous chapter'**+ String get previousChapterTooltip;++ /// No description provided for @nextChapterTooltip.+ ///+ /// In en, this message translates to:+ /// **'Next chapter'**+ String get nextChapterTooltip;+/// No description provided for @noBooksFound.////// In en, this message translates to:diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dartindex 627f8f37..b7a0600a 100644--- a/lib/l10n/app_localizations_de.dart+++ b/lib/l10n/app_localizations_de.dart@@ -3488,6 +3488,18 @@ class AppLocalizationsDe extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Bibliothek wechseln';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'Keine Bücher gefunden';diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dartindex d5491894..a6c22f40 100644--- a/lib/l10n/app_localizations_el.dart+++ b/lib/l10n/app_localizations_el.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsEl extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dartindex 5db0d290..141c0c14 100644--- a/lib/l10n/app_localizations_en.dart+++ b/lib/l10n/app_localizations_en.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dartindex 7cdd38e9..d358ef92 100644--- a/lib/l10n/app_localizations_es.dart+++ b/lib/l10n/app_localizations_es.dart@@ -3450,6 +3450,18 @@ class AppLocalizationsEs extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dartindex d9ac2240..634c1a7c 100644--- a/lib/l10n/app_localizations_fr.dart+++ b/lib/l10n/app_localizations_fr.dart@@ -3468,6 +3468,18 @@ class AppLocalizationsFr extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dartindex 733ed2a2..b411c2cf 100644--- a/lib/l10n/app_localizations_it.dart+++ b/lib/l10n/app_localizations_it.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsIt extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dartindex 19d69e20..6f88b156 100644--- a/lib/l10n/app_localizations_ja.dart+++ b/lib/l10n/app_localizations_ja.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsJa extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dartindex 09e8db55..fbe1dd3d 100644--- a/lib/l10n/app_localizations_no.dart+++ b/lib/l10n/app_localizations_no.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsNo extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dartindex 51d3278c..72b7fc6f 100644--- a/lib/l10n/app_localizations_pt.dart+++ b/lib/l10n/app_localizations_pt.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsPt extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dartindex 63ee7609..3d72a00a 100644--- a/lib/l10n/app_localizations_ro.dart+++ b/lib/l10n/app_localizations_ro.dart@@ -3448,6 +3448,18 @@ class AppLocalizationsRo extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dartindex 4b0b98cc..636ee9c5 100644--- a/lib/l10n/app_localizations_ru.dart+++ b/lib/l10n/app_localizations_ru.dart@@ -3452,6 +3452,18 @@ class AppLocalizationsRu extends AppLocalizations {@overrideString get switchLibraryTooltip => 'Switch library';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => 'No books found';diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dartindex 461313a1..12e3a0cc 100644--- a/lib/l10n/app_localizations_zh.dart+++ b/lib/l10n/app_localizations_zh.dart@@ -3373,6 +3373,18 @@ class AppLocalizationsZh extends AppLocalizations {@overrideString get switchLibraryTooltip => '切换媒体库';+ @override+ String get refreshTooltip => 'Refresh';++ @override+ String get openNowPlayingTooltip => 'Open Now Playing';++ @override+ String get previousChapterTooltip => 'Previous chapter';++ @override+ String get nextChapterTooltip => 'Next chapter';+@overrideString get noBooksFound => '未找到书籍';diff --git a/lib/main.dart b/lib/main.dartindex 76edcf0e..e3f6b73c 100644--- a/lib/main.dart+++ b/lib/main.dart@@ -365,6 +365,8 @@ class AbsorbApp extends StatelessWidget {navigatorKey: rootNavigatorKey,title: 'Absorb',debugShowCheckedModeBanner: false,+ scrollBehavior:+ AppPlatform.isWeb ? const _AppScrollBehavior() : null,locale: overrideLocale,localizationsDelegates: AppLocalizations.localizationsDelegates,supportedLocales: AppLocalizations.supportedLocales,@@ -423,6 +425,9 @@ class AbsorbApp extends StatelessWidget {shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),+ constraints: AppPlatform.isWeb+ ? const BoxConstraints(maxWidth: 640)+ : null,),snackBarTheme: SnackBarThemeData(backgroundColor: lightScheme.inverseSurface,@@ -479,6 +484,9 @@ class AbsorbApp extends StatelessWidget {shape: RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),+ constraints: AppPlatform.isWeb+ ? const BoxConstraints(maxWidth: 640)+ : null,),snackBarTheme: SnackBarThemeData(backgroundColor: darkScheme.surfaceContainerHighest,@@ -763,3 +771,17 @@ class _AuthGateState extends State<AuthGate> {return const LoginScreen();}}++/// Web ships without mouse in the default drag devices, which leaves every+/// horizontal list unscrollable with a mouse.+class _AppScrollBehavior extends MaterialScrollBehavior {+ const _AppScrollBehavior();++ @override+ Set<PointerDeviceKind> get dragDevices => {+ PointerDeviceKind.touch,+ PointerDeviceKind.mouse,+ PointerDeviceKind.trackpad,+ PointerDeviceKind.stylus,+ };+}diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dartindex 676489a0..bf87dfd8 100644--- a/lib/screens/absorbing_screen.dart+++ b/lib/screens/absorbing_screen.dart@@ -1,4 +1,5 @@import 'dart:async';+import 'package:flutter/foundation.dart' show listEquals;import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:provider/provider.dart';@@ -20,6 +21,7 @@ import '../widgets/collection_detail_sheet.dart';import '../widgets/episode_list_sheet.dart';import '../l10n/app_localizations.dart';import '../services/wording.dart';+import '../utils/desktop_workspace.dart';class AbsorbingScreen extends StatefulWidget {const AbsorbingScreen({super.key});@@ -178,9 +180,12 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {_cast.removeListener(_rebuild);PlayerSettings.settingsChanged.removeListener(_loadQueueMode);_pageController.dispose();+ _desktopQueueScrollController.dispose();super.dispose();}+ final _desktopQueueScrollController = ScrollController();+String? _lastPlayingId;String? _lastPlayingEpisodeId;String? _lastFinishedId;@@ -653,6 +658,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {),child: SafeArea(child: Builder(builder: (context) {+ final desktopWorkspace = isDesktopWorkspace(context);final offlineIcon = OfflineStatusIcon(onTapWhenOnline: () {lib.setManualOffline(true);@@ -714,7 +720,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {: Icon(Icons.refresh_rounded, size: 18, color: muted),),),- if (books.isNotEmpty) ...[+ if (!desktopWorkspace && books.isNotEmpty) ...[const SizedBox(width: 8),GestureDetector(onTap: () => _showReorderSheet(context, lib, books),@@ -783,11 +789,84 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {final portraitHeader = AbsorbPageHeader(title: Wording.of(context).absorbingTitle,+ showBranding: !desktopWorkspace,padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),trailing: offlineIcon,actions: headerActions,);+ if (desktopWorkspace) {+ return Column(+ children: [+ portraitHeader,+ Expanded(+ child: showBlockingLoader+ ? Center(+ child: CircularProgressIndicator(+ strokeWidth: 2,+ color: cs.onSurface.withValues(alpha: 0.24)))+ : LayoutBuilder(builder: (context, constraints) {+ final queueWidth =+ (constraints.maxWidth * 0.34).clamp(340.0, 420.0);+ return Row(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(+ child: books.isEmpty+ ? _emptyState(cs, tt, effectiveOffline, l)+ : Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(+ maxWidth: 980),+ child: SizedBox.expand(+ child: Padding(+ padding: const EdgeInsets.fromLTRB(+ 12, 8, 12, 16),+ child: RepaintBoundary(+ child: AbsorbingCard(+ key: _cardKey(+ _absorbingKey(books[0])),+ item: books[0],+ player: _player,+ ),+ ),+ ),+ ),+ ),+ ),+ ),+ VerticalDivider(+ width: 1,+ thickness: 1,+ color:+ cs.outlineVariant.withValues(alpha: 0.45),+ ),+ SizedBox(+ width: queueWidth,+ child: _AbsorbingQueuePanel(+ embedded: true,+ keys: books.map(_absorbingKey).toList(),+ books: books,+ lib: lib,+ scrollController:+ _desktopQueueScrollController,+ absorbingKeyFn: _absorbingKey,+ queueMode: _queueMode,+ isMerged: _mergeLibraries,+ isPodcast: lib.isPodcastLibrary,+ currentItemId: _currentPlayerKey,+ onQueueModeChanged: (mode) =>+ _handleQueueModeChanged(lib, mode),+ ),+ ),+ ],+ );+ }),+ ),+ ],+ );+ }+return Column(children: [// ── Header ──@@ -934,6 +1013,41 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {);}+ Future<void> _handleQueueModeChanged(LibraryProvider lib, String mode) async {+ if (mode == 'playlist') {+ final pid = await PlayerSettings.getQueuePlaylistId();+ if (pid == null) {+ if (mounted) {+ final hint = AppLocalizations.of(context)!.queueModePlaylistHint;+ showOverlayToast(context, hint, icon: Icons.playlist_play_rounded);+ }+ return;+ }+ await PlayerSettings.setQueueModePlaylist(pid);+ unawaited(lib.syncQueueAutoDownloads());+ return;+ }+ if (_mergeLibraries || _queueMode == 'playlist') {+ await PlayerSettings.setBookQueueMode(mode);+ await PlayerSettings.setPodcastQueueMode(mode);+ } else {+ final isPod = _player.currentItemId == null+ ? lib.isPodcastLibrary+ : _player.currentEpisodeId != null;+ if (isPod) {+ await PlayerSettings.setPodcastQueueMode(mode);+ } else {+ await PlayerSettings.setBookQueueMode(mode);+ }+ }+ PlayerSettings.notifySettingsChanged();+ unawaited(lib.syncQueueAutoDownloads());+ }++ String? get _currentPlayerKey => _player.currentEpisodeId != null+ ? '${_player.currentItemId}-${_player.currentEpisodeId}'+ : _player.currentItemId;+void _showReorderSheet(BuildContext context, LibraryProvider lib, List<Map<String, dynamic>> books) {final keys = books.map((b) => _absorbingKey(b)).toList();final media = MediaQuery.of(context);@@ -949,7 +1063,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {initialChildSize: needsMoreRoom ? 0.9 : 0.7,minChildSize: needsMoreRoom ? 0.85 : 0.5,maxChildSize: 1.0,- builder: (_, scrollController) => _ReorderAbsorbingSheet(+ builder: (_, scrollController) => _AbsorbingQueuePanel(keys: keys,books: books,lib: lib,@@ -958,40 +1072,8 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {queueMode: _queueMode,isMerged: _mergeLibraries,isPodcast: lib.isPodcastLibrary,- currentItemId: _player.currentEpisodeId != null- ? '${_player.currentItemId}-${_player.currentEpisodeId}'- : _player.currentItemId,- onQueueModeChanged: (mode) async {- if (mode == 'playlist') {- final pid = await PlayerSettings.getQueuePlaylistId();- if (pid == null) {- if (context.mounted) {- final hint = AppLocalizations.of(context)!.queueModePlaylistHint;- showOverlayToast(context, hint,- icon: Icons.playlist_play_rounded);- }- return;- }- await PlayerSettings.setQueueModePlaylist(pid);- unawaited(lib.syncQueueAutoDownloads());- return;- }- if (_mergeLibraries || _queueMode == 'playlist') {- await PlayerSettings.setBookQueueMode(mode);- await PlayerSettings.setPodcastQueueMode(mode);- } else {- final isPod = _player.currentItemId == null- ? lib.isPodcastLibrary- : _player.currentEpisodeId != null;- if (isPod) {- await PlayerSettings.setPodcastQueueMode(mode);- } else {- await PlayerSettings.setBookQueueMode(mode);- }- }- PlayerSettings.notifySettingsChanged();- unawaited(lib.syncQueueAutoDownloads());- },+ currentItemId: _currentPlayerKey,+ onQueueModeChanged: (mode) => _handleQueueModeChanged(lib, mode),),),);@@ -1056,7 +1138,7 @@ class _PageDots extends StatelessWidget {// ─── REORDER ABSORBING SHEET ──────────────────────────────────-class _ReorderAbsorbingSheet extends StatefulWidget {+class _AbsorbingQueuePanel extends StatefulWidget {final List<String> keys;final List<Map<String, dynamic>> books;final LibraryProvider lib;@@ -1068,7 +1150,11 @@ class _ReorderAbsorbingSheet extends StatefulWidget {final ValueChanged<String> onQueueModeChanged;final String? currentItemId;- const _ReorderAbsorbingSheet({+ /// True when the panel lives inline in the desktop workspace instead of a+ /// bottom sheet: no sheet chrome, no self-pops, reorders commit instantly.+ final bool embedded;++ const _AbsorbingQueuePanel({required this.keys,required this.books,required this.lib,@@ -1079,13 +1165,14 @@ class _ReorderAbsorbingSheet extends StatefulWidget {required this.isPodcast,required this.onQueueModeChanged,required this.currentItemId,+ this.embedded = false,});@override- State<_ReorderAbsorbingSheet> createState() => _ReorderAbsorbingSheetState();+ State<_AbsorbingQueuePanel> createState() => _AbsorbingQueuePanelState();}-class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {+class _AbsorbingQueuePanelState extends State<_AbsorbingQueuePanel> {late List<String> _order;late Map<String, Map<String, dynamic>> _booksByKey;late String _queueMode;@@ -1126,6 +1213,19 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {int _rollingDownloadCount = 3;String _podcastAdvanceDir = 'oldest_first';+ @override+ void didUpdateWidget(_AbsorbingQueuePanel oldWidget) {+ super.didUpdateWidget(oldWidget);+ // The embedded panel is long-lived; pick up queue changes from the+ // parent (playback advancing, items added or removed elsewhere).+ if (widget.embedded && !listEquals(widget.keys, oldWidget.keys)) {+ _order = List.from(widget.keys);+ _booksByKey = {+ for (final b in widget.books) widget.absorbingKeyFn(b): b,+ };+ }+ }+void _onDownloadsChanged() {if (mounted) setState(() {});}@@ -1433,33 +1533,38 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {final bottomInset = MediaQuery.of(context).viewPadding.bottom;return Container(- decoration: BoxDecoration(- color: cs.surface,- borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),- ),+ decoration: widget.embedded+ ? null+ : BoxDecoration(+ color: cs.surface,+ borderRadius:+ const BorderRadius.vertical(top: Radius.circular(20)),+ ),child: Column(children: [// Handle- Center(child: Container(- margin: const EdgeInsets.only(top: 8),- width: 32, height: 4,- decoration: BoxDecoration(- color: cs.onSurface.withValues(alpha: 0.2),- borderRadius: BorderRadius.circular(2),- ),- )),+ if (!widget.embedded)+ Center(child: Container(+ margin: const EdgeInsets.only(top: 8),+ width: 32, height: 4,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.2),+ borderRadius: BorderRadius.circular(2),+ ),+ )),// HeaderPadding(padding: const EdgeInsets.fromLTRB(16, 8, 8, 4),child: Row(children: [Expanded(child: Text(l.absorbingManageQueue,style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600))),- TextButton(- onPressed: () {- widget.lib.reorderAbsorbing(_order);- Navigator.pop(context);- },- child: Text(l.absorbingDone),- ),+ if (!widget.embedded)+ TextButton(+ onPressed: () {+ widget.lib.reorderAbsorbing(_order);+ Navigator.pop(context);+ },+ child: Text(l.absorbingDone),+ ),]),),// Queue mode toggle@@ -1594,7 +1699,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {onTap: () {final auth = context.read<AuthProvider>();final outer = rootNavigatorKey.currentContext ?? context;- Navigator.pop(context);+ if (!widget.embedded) Navigator.pop(context);showSeriesBooksSheet(outer,seriesName: _seriesName ?? '',@@ -1614,7 +1719,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {icon: Icons.podcasts_rounded,onTap: () {final outer = rootNavigatorKey.currentContext ?? context;- Navigator.pop(context);+ if (!widget.embedded) Navigator.pop(context);EpisodeListSheet.show(outer, _showItem!);},),@@ -1626,7 +1731,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {icon: Icons.playlist_play_rounded,onTap: () {final outer = rootNavigatorKey.currentContext ?? context;- Navigator.pop(context);+ if (!widget.embedded) Navigator.pop(context);PlaylistDetailSheet.show(outer, _playlistId!);},),@@ -1638,7 +1743,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {icon: Icons.collections_bookmark_rounded,onTap: () {final outer = rootNavigatorKey.currentContext ?? context;- Navigator.pop(context);+ if (!widget.embedded) Navigator.pop(context);CollectionDetailSheet.show(outer, _collectionId!);},),@@ -1897,7 +2002,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {// Tapping a series book or playlist item plays it. For playlist// items the user expects this to be the same as opening the item// from the playlist sheet; closing the manage queue sheet first.- Navigator.pop(context);+ if (!widget.embedded) Navigator.pop(context);final api = context.read<AuthProvider>().apiService;if (api == null) return;late Future<String?> playback;@@ -2031,6 +2136,8 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {final item = _order.removeAt(oldIdx);_order.insert(newIdx, item);});+ // The sheet commits on Done; the embedded panel has no Done.+ if (widget.embedded) widget.lib.reorderAbsorbing(_order);},itemBuilder: (context, i) {final key = _order[i];@@ -2117,7 +2224,7 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {)),_downloadStatus(key, cs),// Drag handle (long-press to avoid conflict with system home gesture)- _DragHandle(index: i, color: cs.onSurface),+ _DragHandle(index: i, color: cs.onSurface, immediate: widget.embedded),]),),),@@ -2132,7 +2239,9 @@ class _ReorderAbsorbingSheetState extends State<_ReorderAbsorbingSheet> {class _DragHandle extends StatefulWidget {final int index;final Color color;- const _DragHandle({required this.index, required this.color});+ // Immediate drag for mouse-driven surfaces; long-press hold on touch.+ final bool immediate;+ const _DragHandle({required this.index, required this.color, this.immediate = false});@overrideState<_DragHandle> createState() => _DragHandleState();@@ -2171,6 +2280,19 @@ class _DragHandleState extends State<_DragHandle> with SingleTickerProviderState@overrideWidget build(BuildContext context) {+ if (widget.immediate) {+ return ReorderableDragStartListener(+ index: widget.index,+ child: MouseRegion(+ cursor: SystemMouseCursors.grab,+ child: Padding(+ padding: const EdgeInsets.all(6),+ child: Icon(Icons.drag_handle_rounded, size: 20,+ color: widget.color.withValues(alpha: 0.5)),+ ),+ ),+ );+ }return Listener(onPointerDown: _onDown,onPointerUp: _onUp,diff --git a/lib/screens/admin_api_keys_screen.dart b/lib/screens/admin_api_keys_screen.dartindex d9e842f2..ea024390 100644--- a/lib/screens/admin_api_keys_screen.dart+++ b/lib/screens/admin_api_keys_screen.dart@@ -5,6 +5,7 @@ import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/overlay_toast.dart';class AdminApiKeysScreen extends StatefulWidget {@@ -183,7 +184,8 @@ class _AdminApiKeysScreenState extends State<AdminApiKeysScreen> {}void _showEditor() {- showModalBottomSheet(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ showAdaptiveActionMenu(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ desktopWidth: 560, desktopScrollWrap: false,builder: (_) => _ApiKeyEditorSheet(users: widget.users, onCreated: _load));}@@ -323,7 +325,8 @@ class _ApiKeyEditorSheetState extends State<_ApiKeyEditorSheet> {if (created != null && token != null) {widget.onCreated();Navigator.pop(context);- showModalBottomSheet(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ showAdaptiveActionMenu(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ desktopWidth: 560,builder: (_) => _ApiKeyCreatedSheet(name: name, token: token));} else {showOverlayToast(context, l.adminApiKeysFailedCreate, icon: Icons.error_outline_rounded);diff --git a/lib/screens/admin_email_screen.dart b/lib/screens/admin_email_screen.dartindex 53f70c23..6674392a 100644--- a/lib/screens/admin_email_screen.dart+++ b/lib/screens/admin_email_screen.dart@@ -6,6 +6,7 @@ import 'package:url_launcher/url_launcher.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/overlay_toast.dart';class AdminEmailScreen extends StatefulWidget {@@ -160,13 +161,15 @@ class _AdminEmailScreenState extends State<AdminEmailScreen> {...((existing?['users'] as List<dynamic>?) ?? []).cast<String>(),};- return showModalBottomSheet<Map<String, dynamic>>(+ return showAdaptiveActionMenu<Map<String, dynamic>>(context: context,isScrollControlled: true,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),+ desktopWidth: 560,+ desktopScrollWrap: false,builder: (ctx) {return StatefulBuilder(builder: (ctx, setSheet) {return SafeArea(diff --git a/lib/screens/admin_podcasts_screen.dart b/lib/screens/admin_podcasts_screen.dartindex 71b09b2f..61930576 100644--- a/lib/screens/admin_podcasts_screen.dart+++ b/lib/screens/admin_podcasts_screen.dart@@ -7,6 +7,7 @@ import '../providers/auth_provider.dart';import '../services/socket_service.dart';import 'podcast_edit_screen.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/html_description.dart';import '../widgets/overlay_toast.dart';import '../l10n/app_localizations.dart';@@ -23,11 +24,13 @@ Future<void> showAddPodcastSheet(required VoidCallback onAdded,String initialQuery = '',}) {- return showModalBottomSheet<void>(+ return showAdaptiveActionMenu<void>(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 640,+ desktopScrollWrap: false,builder: (_) => _PodcastSearchSheet(libraryId: libraryId,folderId: folderId,@@ -2079,11 +2082,13 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT}void _showMatchSheet(ColorScheme cs, TextTheme tt) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 640,+ desktopScrollWrap: false,builder: (_) => _PodcastMatchSheet(podcastId: _podcastId,initialQuery: _title,@@ -2097,11 +2102,13 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleTvoid _showEpisodeDetail(Map<String, dynamic> ep, bool alreadyDownloaded) {final canDownload = context.read<AuthProvider>().isAdmin;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 640,+ desktopScrollWrap: false,builder: (_) => _EpisodeDetailSheet(episode: ep,alreadyDownloaded: alreadyDownloaded,@@ -2117,11 +2124,13 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleTvoid _showDownloadedEpisodeDetail(Map<String, dynamic> ep) {final epId = ep['id']?.toString() ?? '';final epTitle = ep['title']?.toString() ?? AppLocalizations.of(context)!.adminPodcastsEpisodeFallback;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 640,+ desktopScrollWrap: false,builder: (_) => _DownloadedEpisodeDetailSheet(episode: ep,isDeleting: _deleting.contains(epId),diff --git a/lib/screens/admin_screen.dart b/lib/screens/admin_screen.dartindex 9f19fd84..0fe51752 100644--- a/lib/screens/admin_screen.dart+++ b/lib/screens/admin_screen.dart@@ -10,6 +10,8 @@ import '../widgets/absorb_page_header.dart';import '../widgets/rmab_config_sheet.dart';import '../widgets/overlay_toast.dart';import '../l10n/app_localizations.dart';+import '../utils/desktop_workspace.dart';+import '../widgets/desktop_page_body.dart';import 'admin_users_screen.dart';import 'admin_upload_screen.dart';import 'admin_podcasts_screen.dart';@@ -170,10 +172,14 @@ class _AdminScreenState extends State<AdminScreen> with WidgetsBindingObserver {body: SafeArea(child: _loading? const Center(child: CircularProgressIndicator(strokeWidth: 2))- : RefreshIndicator(+ : DesktopPageBody(+ child: RefreshIndicator(onRefresh: _loadAll,+ notificationPredicate: (n) =>+ !isDesktopWorkspace(context) && n.depth == 0,child: ListView(- padding: const EdgeInsets.only(bottom: 80),+ padding: EdgeInsets.only(+ bottom: isDesktopWorkspace(context) ? 24 : 80),children: [// ── Header ──Padding(@@ -187,6 +193,12 @@ class _AdminScreenState extends State<AdminScreen> with WidgetsBindingObserver {onPressed: () => showAdminTasksSheet(context, _taskTracker),),),+ if (isDesktopWorkspace(context))+ IconButton(+ tooltip: l.refreshTooltip,+ icon: Icon(Icons.refresh_rounded, color: cs.onSurfaceVariant),+ onPressed: _loadAll,+ ),IconButton(icon: Icon(Icons.close_rounded, color: cs.onSurfaceVariant), onPressed: () => Navigator.pop(context)),]),),@@ -350,6 +362,7 @@ class _AdminScreenState extends State<AdminScreen> with WidgetsBindingObserver {],),),+ ),),);}diff --git a/lib/screens/admin_sessions_screen.dart b/lib/screens/admin_sessions_screen.dartindex 8b658603..6b4665fe 100644--- a/lib/screens/admin_sessions_screen.dart+++ b/lib/screens/admin_sessions_screen.dart@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import 'stats_screen.dart' show SessionDetailsSheet;/// Admin view of every user's listening sessions. View + delete any session;@@ -91,10 +92,11 @@ class _AdminSessionsScreenState extends State<AdminSessionsScreen> {final myId = context.read<AuthProvider>().userId;final ownerId = s['userId'] as String? ??(s['user'] as Map<String, dynamic>?)?['id'] as String?;- final changed = await showModalBottomSheet<bool>(+ final changed = await showAdaptiveActionMenu<bool>(context: context,isScrollControlled: true,backgroundColor: Colors.transparent,+ desktopWidth: 520,builder: (_) =>SessionDetailsSheet(session: s, allowEdit: ownerId == myId),);diff --git a/lib/screens/admin_users_screen.dart b/lib/screens/admin_users_screen.dartindex 66c17eed..8dd72e7b 100644--- a/lib/screens/admin_users_screen.dart+++ b/lib/screens/admin_users_screen.dart@@ -12,6 +12,7 @@ import '../services/backup_service.dart';import '../services/setup_link_service.dart';import '../widgets/absorb_page_header.dart';import '../widgets/absorb_wave_icon.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/overlay_toast.dart';import '../widgets/setup_link_share_sheet.dart';import '../l10n/app_localizations.dart';@@ -209,7 +210,8 @@ class _AdminUsersScreenState extends State<AdminUsersScreen> {}void _showEditor(Map<String, dynamic>? user) {- showModalBottomSheet(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ showAdaptiveActionMenu(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ desktopWidth: 560, desktopScrollWrap: false,builder: (_) => _UserEditorSheet(user: user, libraries: widget.libraries, onSaved: _reload));}}@@ -740,10 +742,12 @@ class _UserDetailScreenState extends State<_UserDetailScreen> {}void _showSessionDetails(Map<String, dynamic> session) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,backgroundColor: Colors.transparent,+ desktopWidth: 560,+ desktopScrollWrap: false,builder: (_) => _AdminSessionDetailsSheet(session: session),);}@@ -780,7 +784,8 @@ class _UserDetailScreenState extends State<_UserDetailScreen> {);void _showEditor() {- showModalBottomSheet(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ showAdaptiveActionMenu(context: context, isScrollControlled: true, useSafeArea: true, backgroundColor: Colors.transparent,+ desktopWidth: 560, desktopScrollWrap: false,builder: (_) => _UserEditorSheet(user: widget.user, libraries: widget.libraries, onSaved: () {widget.onChanged();_load();@@ -855,11 +860,13 @@ class _UserDetailScreenState extends State<_UserDetailScreen> {final setupLink = SetupLinkService.createLink(payload);if (!mounted) return;- await showModalBottomSheet<void>(+ await showAdaptiveActionMenu<void>(context: context,isScrollControlled: true,useSafeArea: true,showDragHandle: false,+ desktopWidth: 560,+ desktopScrollWrap: false,builder: (sheetContext) => SetupLinkShareSheet(username: username,setupLink: setupLink,diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dartindex aec45288..e9e72f46 100644--- a/lib/screens/app_shell.dart+++ b/lib/screens/app_shell.dart@@ -40,6 +40,7 @@ import '../services/update_checker_service.dart';import '../widgets/update_dialog.dart';import '../widgets/overlay_toast.dart';import '../utils/app_platform.dart';+import '../utils/desktop_workspace.dart';class AppShell extends StatefulWidget {final bool startOnAbsorbing;@@ -174,6 +175,10 @@ class _AppShellState extends State<AppShell>// work until the user actually visits those tabs.final List<Widget?> _pages = List<Widget?>.filled(5, null, growable: false);+ // Desktop workspace content-pane navigator: full-page pushes land here so+ // the sidebar and now-playing bar stay visible around them.+ final _paneNavigatorKey = GlobalKey<NavigatorState>();+void _openSearch() {if (!mounted) return;// If the user triggered Search while a pushed route (Downloads, Bookmarks,@@ -183,6 +188,7 @@ class _AppShellState extends State<AppShell>if (nav != null && nav.canPop()) {nav.popUntil((r) => r.isFirst);}+ _paneNavigatorKey.currentState?.popUntil((r) => r.isFirst);_navigateTo(1);// Library tab may need a frame to mount its state before we can focus// the search field. Retry up to a few frames to cover fade transitions.@@ -213,6 +219,8 @@ class _AppShellState extends State<AppShell>}void _navigateTo(int index) {+ // A tab click while a pushed page fills the pane should reveal the tab.+ _paneNavigatorKey.currentState?.popUntil((r) => r.isFirst);if (index == _currentIndex) {// Already on this tab — handle re-tap actionsif (index == 2) {@@ -332,6 +340,7 @@ class _AppShellState extends State<AppShell>void initState() {super.initState();_instance = this;+ DesktopWorkspaceNavigator.register(() => _paneNavigatorKey.currentState);if (AppPlatform.isWeb) {_currentIndex = 0;} else if (!widget.startOnAbsorbing) {@@ -455,7 +464,10 @@ class _AppShellState extends State<AppShell>try {context.read<LibraryProvider>().removeListener(_onLibraryChanged);} catch (_) {}- if (_instance == this) _instance = null;+ if (_instance == this) {+ _instance = null;+ DesktopWorkspaceNavigator.unregister();+ }WidgetsBinding.instance.removeObserver(this);super.dispose();}@@ -725,8 +737,8 @@ class _AppShellState extends State<AppShell>Widget build(BuildContext context) {return LayoutBuilder(builder: (context, constraints) {- final useDesktopWorkspace =- AppPlatform.isWeb && constraints.maxWidth >= 960;+ final useDesktopWorkspace = AppPlatform.isWeb &&+ constraints.maxWidth >= kDesktopWorkspaceBreakpoint;return PopScope(canPop: false,onPopInvokedWithResult: _handleBack,@@ -751,6 +763,11 @@ class _AppShellState extends State<AppShell>}if (AppPlatform.isWeb) {+ final pane = _paneNavigatorKey.currentState;+ if (pane != null && pane.canPop()) {+ pane.pop();+ return;+ }if (_currentIndex != 0) _navigateTo(0);return;}@@ -774,8 +791,8 @@ class _AppShellState extends State<AppShell>_switchToAbsorbing();}- Widget _buildPageStack(BuildContext context, {Size? viewportSize}) {- Widget stack = FadeTransition(+ Widget _buildPageStack(BuildContext context) {+ return FadeTransition(opacity: _fadeController,child: IndexedStack(index: _currentIndex,@@ -785,13 +802,6 @@ class _AppShellState extends State<AppShell>),),);- if (viewportSize != null) {- stack = MediaQuery(- data: MediaQuery.of(context).copyWith(size: viewportSize),- child: stack,- );- }- return stack;}Widget _buildDesktopWorkspace(BuildContext context) {@@ -817,9 +827,23 @@ class _AppShellState extends State<AppShell>),Expanded(child: LayoutBuilder(- builder: (context, constraints) => _buildPageStack(- context,- viewportSize: Size(constraints.maxWidth, constraints.maxHeight),+ // The MediaQuery override sits outside the pane Navigator so+ // pushed pages also lay out against the pane, not the window.+ // The tab stack is a declarative page so it keeps rebuilding+ // with this State; pushed routes stack on top imperatively.+ builder: (context, constraints) => MediaQuery(+ data: MediaQuery.of(context).copyWith(+ size: Size(constraints.maxWidth, constraints.maxHeight),+ ),+ child: ClipRect(+ child: Navigator(+ key: _paneNavigatorKey,+ onDidRemovePage: (page) {},+ pages: [+ MaterialPage(child: _buildPageStack(context)),+ ],+ ),+ ),),),),@@ -828,7 +852,7 @@ class _AppShellState extends State<AppShell>bottomNavigationBar: DesktopNowPlayingBar(player: _player,library: lib,- onOpenFullPlayer: _openExpandedPlayer,+ onOpenNowPlaying: _switchToAbsorbing,),);}@@ -973,7 +997,7 @@ class _AppShellState extends State<AppShell>Padding(padding: const EdgeInsets.symmetric(horizontal: 12),child: TextButton.icon(- onPressed: () => Navigator.of(context).push(+ onPressed: () => _paneNavigatorKey.currentState?.push(MaterialPageRoute<void>(builder: (_) => const AdminScreen(),),diff --git a/lib/screens/auth_sessions_screen.dart b/lib/screens/auth_sessions_screen.dartindex 77f245ff..9c50b8d4 100644--- a/lib/screens/auth_sessions_screen.dart+++ b/lib/screens/auth_sessions_screen.dart@@ -5,6 +5,7 @@ import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../models/auth_session.dart';import '../providers/auth_provider.dart';+import '../widgets/desktop_page_body.dart';import '../widgets/overlay_toast.dart';class AuthSessionsScreen extends StatefulWidget {@@ -129,7 +130,9 @@ class _AuthSessionsScreenState extends State<AuthSessionsScreen> {appBar: AppBar(title: Text(l.manageSessionsTitle)),body: _loading? const Center(child: CircularProgressIndicator())- : RefreshIndicator(+ : DesktopPageBody(+ maxWidth: 720,+ child: RefreshIndicator(onRefresh: _load,child: ListView(physics: const AlwaysScrollableScrollPhysics(),@@ -194,6 +197,7 @@ class _AuthSessionsScreenState extends State<AuthSessionsScreen> {],],),+ ),),);}diff --git a/lib/screens/bookmarks_screen.dart b/lib/screens/bookmarks_screen.dartindex b57301d1..36c95937 100644--- a/lib/screens/bookmarks_screen.dart+++ b/lib/screens/bookmarks_screen.dart@@ -14,6 +14,8 @@ import '../widgets/bookmark_detail_dialog.dart';import '../widgets/card_buttons.dart';import '../services/download_service.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';+import '../widgets/desktop_page_body.dart';import '../widgets/overlay_toast.dart';import '../l10n/app_localizations.dart';@@ -242,7 +244,7 @@ class _BookmarksScreenState extends State<BookmarksScreen> {Future<void> _jumpToBookmark(String itemId, Bookmark bookmark, String bookTitle) async {final l = AppLocalizations.of(context)!;final api = context.read<AuthProvider>().apiService;- final result = await showModalBottomSheet<BookmarkDetailResult>(+ final result = await showAdaptiveActionMenu<BookmarkDetailResult>(context: context,isScrollControlled: true,showDragHandle: true,@@ -250,6 +252,8 @@ class _BookmarksScreenState extends State<BookmarksScreen> {shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),+ desktopWidth: 560,+ desktopScrollWrap: false,builder: (ctx) => BookmarkDetailSheet(itemId: itemId,bookmark: bookmark,@@ -343,7 +347,8 @@ class _BookmarksScreenState extends State<BookmarksScreen> {body: SafeArea(child: _loading? const Center(child: CircularProgressIndicator())- : Column(+ : DesktopPageBody(+ child: Column(children: [// HeaderPadding(@@ -480,6 +485,7 @@ class _BookmarksScreenState extends State<BookmarksScreen> {),],),+ ),),);}diff --git a/lib/screens/change_password_screen.dart b/lib/screens/change_password_screen.dartindex 4a1a293a..ee962e0c 100644--- a/lib/screens/change_password_screen.dart+++ b/lib/screens/change_password_screen.dart@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../services/api_service.dart';+import '../widgets/desktop_page_body.dart';import '../widgets/overlay_toast.dart';class ChangePasswordScreen extends StatefulWidget {@@ -95,7 +96,9 @@ class _ChangePasswordScreenState extends State<ChangePasswordScreen> {final l = AppLocalizations.of(context)!;return Scaffold(appBar: AppBar(title: Text(l.changePasswordTitle)),- body: ListView(+ body: DesktopPageBody(+ maxWidth: 560,+ child: ListView(padding: const EdgeInsets.all(20),children: [Text(@@ -143,6 +146,7 @@ class _ChangePasswordScreenState extends State<ChangePasswordScreen> {label: Text(l.changePasswordTitle),),],+ ),),);}diff --git a/lib/screens/chapter_editor_screen.dart b/lib/screens/chapter_editor_screen.dartindex a0da5661..fb6d2256 100644--- a/lib/screens/chapter_editor_screen.dart+++ b/lib/screens/chapter_editor_screen.dart@@ -8,6 +8,7 @@ import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../services/api_service.dart';import '../services/audio_player_service.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/overlay_toast.dart';/// Mutable working copy of one chapter. [uid] is a stable identity that@@ -681,12 +682,13 @@ class _ChapterEditBodyState extends State<ChapterEditBody>Future<void> _openLookup() async {final api = context.read<AuthProvider>().apiService;if (api == null) return;- final result = await showModalBottomSheet<_LookupResult>(+ final result = await showAdaptiveActionMenu<_LookupResult>(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Theme.of(context).scaffoldBackgroundColor,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20))),+ desktopScrollWrap: false,builder: (_) => _ChapterLookupSheet(api: api, initialAsin: _asin, mediaDuration: _duration),);if (result == null || !mounted) return;diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dartindex 1e947bdd..b8f65a44 100644--- a/lib/screens/home_screen.dart+++ b/lib/screens/home_screen.dart@@ -23,11 +23,13 @@ import '../widgets/playlist_detail_sheet.dart';import '../widgets/collection_detail_sheet.dart';import '../widgets/section_detail_sheet.dart';import '../widgets/feature_hint.dart';+import '../widgets/hover_cover_actions.dart';import '../widgets/offline_status_icon.dart';import '../widgets/scroll_reveal.dart';import '../widgets/section_labels.dart';import 'app_shell.dart';import '../l10n/app_localizations.dart';+import '../utils/desktop_workspace.dart';import '../utils/duration_format.dart';class HomeScreen extends StatefulWidget {@@ -216,11 +218,34 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi'downloaded-books': Icons.download_done_rounded,};+ Widget _refreshWrapper({+ required bool desktop,+ required LibraryProvider lib,+ required Widget child,+ }) {+ if (desktop) {+ return Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 1200),+ child: child,+ ),+ );+ }+ return RefreshIndicator(+ onRefresh: () async {+ await lib.refresh();+ },+ child: child,+ );+ }+@overrideWidget build(BuildContext context) {final cs = Theme.of(context).colorScheme;final tt = Theme.of(context).textTheme;final l = AppLocalizations.of(context)!;+ final desktop = isDesktopWorkspace(context);+ _revealDriver.setEnabled(!desktop);final scaffoldBg = Theme.of(context).scaffoldBackgroundColor;final lowerFade = Color.lerp(cs.surface, scaffoldBg, 0.55) ?? scaffoldBg;final lib = context.watch<LibraryProvider>();@@ -265,10 +290,9 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMiif (n is ScrollEndNotification) _revealDriver.settle();return false;},- child: RefreshIndicator(- onRefresh: () async {- await lib.refresh();- },+ child: _refreshWrapper(+ desktop: desktop,+ lib: lib,child: CustomScrollView(controller: _scrollController,slivers: [@@ -276,6 +300,7 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMiSliverToBoxAdapter(child: AbsorbPageHeader(title: l.homeTitle,+ showBranding: !desktop,trailing: OfflineStatusIcon(onTapWhenOnline: () {lib.setManualOffline(true);@@ -341,6 +366,22 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi),),),+ if (desktop && !lib.isOffline)+ Tooltip(+ message: l.refreshTooltip,+ child: GestureDetector(+ onTap: () => lib.refresh(),+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.06),+ borderRadius: BorderRadius.circular(20),+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: SizedBox(height: 20, child: Icon(Icons.refresh_rounded, size: 18, color: cs.onSurfaceVariant)),+ ),+ ),+ ),if (!lib.isOffline)GestureDetector(onTap: () => HomeCustomizeSheet.show(context),@@ -481,34 +522,51 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi),),),- const SliverToBoxAdapter(- child: FeatureHint(- prefKey: 'hint_continue_listening_gestures',- message:- 'Tap a card to resume. Press and hold to see details.',+ if (!desktop)+ const SliverToBoxAdapter(+ child: FeatureHint(+ prefKey: 'hint_continue_listening_gestures',+ message:+ 'Tap a card to resume. Press and hold to see details.',+ ),),- ),SliverToBoxAdapter(child: Padding(padding: const EdgeInsets.only(top: 12),child: SizedBox(// Taller row when 2:3 covers are on; the card's// cover alone is ~225 with rectangle covers.- height: _rectangleCovers ? 320 : 250,- child: ListView.separated(- scrollDirection: Axis.horizontal,- padding: const EdgeInsets.symmetric(horizontal: 20),- physics: const BouncingScrollPhysics(),- itemCount: clItems.length,- separatorBuilder: (_, __) => const SizedBox(width: 10),- itemBuilder: (context, i) {- final item = clItems[i] as Map<String, dynamic>;- return RepaintBoundary(child: _ContinueListeningCard(- item: item, lib: lib, player: _player,- rectangleCovers: _rectangleCovers,- ));- },- ),+ height: (_rectangleCovers ? 320 : 250) *+ (desktop ? 1.2 : 1.0),+ child: desktop+ ? SnapScrollList(+ cardWidth: 180,+ desktop: true,+ itemCount: clItems.length,+ itemBuilder: (context, i) {+ final item =+ clItems[i] as Map<String, dynamic>;+ return RepaintBoundary(+ child: _ContinueListeningCard(+ item: item, lib: lib, player: _player,+ rectangleCovers: _rectangleCovers,+ ));+ },+ )+ : ListView.separated(+ scrollDirection: Axis.horizontal,+ padding: const EdgeInsets.symmetric(horizontal: 20),+ physics: const BouncingScrollPhysics(),+ itemCount: clItems.length,+ separatorBuilder: (_, __) => const SizedBox(width: 10),+ itemBuilder: (context, i) {+ final item = clItems[i] as Map<String, dynamic>;+ return RepaintBoundary(child: _ContinueListeningCard(+ item: item, lib: lib, player: _player,+ rectangleCovers: _rectangleCovers,+ ));+ },+ ),),),),@@ -575,7 +633,7 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMi];}),- const SliverPadding(padding: EdgeInsets.only(bottom: 100)),+ SliverPadding(padding: EdgeInsets.only(bottom: desktop ? 24 : 100)),],),),@@ -809,7 +867,14 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {}}- return Material(+ final canEdit = !lib.isPodcastLibrary &&+ !lib.isOffline &&+ recentEpisode == null &&+ context.watch<AuthProvider>().canUpdateMetadata;+ return HoverCoverActions(+ onMenu: openQuickActions,+ editItemId: canEdit ? itemId : null,+ child: Material(color: Colors.transparent,borderRadius: BorderRadius.circular(14),clipBehavior: Clip.antiAlias,@@ -827,7 +892,7 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {onLongPress: openQuickActions,borderRadius: BorderRadius.circular(14),child: SizedBox(- width: 150,+ width: isDesktopWorkspace(context) ? 180 : 150,child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [@@ -946,6 +1011,7 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {),),),+ ),);}diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dartindex 10f87c92..1f2c84ed 100644--- a/lib/screens/library_screen.dart+++ b/lib/screens/library_screen.dart@@ -14,6 +14,7 @@ import '../services/socket_service.dart';import '../services/download_service.dart';import '../services/audio_player_service.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/library_picker_sheet.dart';import '../widgets/library_search_results.dart';import '../widgets/podcast_episode_feed.dart';@@ -38,11 +39,16 @@ import '../widgets/scroll_reveal.dart';import '../services/scoped_prefs.dart';import '../services/user_account_service.dart';import '../l10n/app_localizations.dart';+import '../utils/desktop_workspace.dart';/// Responsive grid column count based on available width.-/// Returns 3 on phones, scales up on tablets/iPads.+/// Returns 3 on phones, scales up on tablets/iPads. The desktop workspace+/// targets larger ~200px tiles instead of packing phone-sized thumbnails.int responsiveGridCount(BuildContext context) {final width = MediaQuery.of(context).size.width;+ if (isDesktopWorkspace(context)) {+ return (width / 200).floor().clamp(3, 8);+ }return (width / 130).floor().clamp(3, 10);}@@ -51,8 +57,9 @@ int responsiveGridCount(BuildContext context) {/// `NavigationBar` once both reappear at the end of a scroll. When the bars/// hide-on-scroll then snap back, the viewport shrinks but the scroll offset/// stays put, so the bottom items end up closer to the pill than steady-state-/// math would suggest. This value keeps a comfortable gap even in that case.-const double libraryGridBottomPadding = 180;+/// math would suggest. The desktop workspace has neither bar.+double libraryGridBottomPadding(BuildContext context) =>+ isDesktopWorkspace(context) ? 24 : 180;// ─── Sort modes ──────────────────────────────────────────────enum LibrarySort {@@ -2213,11 +2220,13 @@ class LibraryScreenState extends State<LibraryScreen>currentSortAsc = _sortAsc;break;}- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 480,+ desktopScrollWrap: false,builder: (ctx) => SortFilterSheet(currentSort: currentSort,sortAsc: currentSortAsc,@@ -2357,6 +2366,8 @@ class LibraryScreenState extends State<LibraryScreen>final cs = Theme.of(context).colorScheme;final tt = Theme.of(context).textTheme;final l = AppLocalizations.of(context)!;+ final desktopWorkspace = isDesktopWorkspace(context);+ _revealDriver.setEnabled(!desktopWorkspace);final scaffoldBg = Theme.of(context).scaffoldBackgroundColor;final lowerFade = Color.lerp(cs.surface, scaffoldBg, 0.55) ?? scaffoldBg;// Watch LibraryProvider so this screen rebuilds when the active library@@ -2458,7 +2469,7 @@ class LibraryScreenState extends State<LibraryScreen>},),),- if (hasTabs && !_isInSearchMode)+ if (hasTabs && !_isInSearchMode && !desktopWorkspace)Positioned(left: 0,right: 0,@@ -2481,7 +2492,7 @@ class LibraryScreenState extends State<LibraryScreen>child: RepaintBoundary(child: _buildFloatingTabBar(cs)),),),- if (!hasTabs && !_isInSearchMode)+ if (!hasTabs && !_isInSearchMode && !desktopWorkspace)Positioned(left: 0,right: 0,@@ -2579,9 +2590,11 @@ class LibraryScreenState extends State<LibraryScreen>),),);+ final desktop = isDesktopWorkspace(context);return SliverAppBar(- floating: true,- snap: true,+ floating: !desktop,+ snap: !desktop,+ pinned: desktop,// primary: false disables Material's automatic status// bar padding so the header doesn't get inset twice// (we already wrap the whole NestedScrollView in@@ -2607,6 +2620,7 @@ class LibraryScreenState extends State<LibraryScreen>children: [AbsorbPageHeader(title: l.libraryTitle,+ showBranding: !isDesktopWorkspace(context),trailing: OfflineStatusIcon(onTapWhenOnline: () {lib.setManualOffline(true);@@ -2680,9 +2694,8 @@ class LibraryScreenState extends State<LibraryScreen>]: null,),- Padding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),- child: SearchBar(+ Builder(builder: (context) {+ final searchBar = SearchBar(// Same GlobalKey on whichever SearchBar gets the shared// focus, so when _isInSearchMode toggles and the tree// swaps from tabbed -> search results, Flutter re-parents@@ -2722,8 +2735,53 @@ class LibraryScreenState extends State<LibraryScreen>side: WidgetStatePropertyAll(BorderSide(color: cs.onSurface.withValues(alpha: 0.08)),),- ),- ),+ );+ if (!desktop) {+ return Padding(+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),+ child: searchBar,+ );+ }+ final hasBookTabs =+ _tabController != null && !_isInSearchMode;+ final showsPodcastPill =+ !hasBookTabs && lib.isPodcastLibrary && !_isInSearchMode;+ return Padding(+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),+ child: Row(+ children: [+ Flexible(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 560),+ child: searchBar,+ ),+ ),+ if (hasBookTabs) ...[+ const SizedBox(width: 12),+ _buildFloatingTabBar(cs, floating: false),+ ],+ if (showsPodcastPill) ...[+ const SizedBox(width: 12),+ _buildPodcastViewPill(cs, floating: false),+ if (context.read<AuthProvider>().isAdmin) ...[+ const SizedBox(width: 8),+ _buildFloatingManageButton(cs),+ ],+ ],+ const Spacer(),+ if (!lib.isOffline)+ Tooltip(+ message: l.refreshTooltip,+ child: IconButton(+ onPressed: _refreshCurrentTab,+ icon: Icon(Icons.refresh_rounded,+ color: cs.onSurfaceVariant),+ ),+ ),+ ],+ ),+ );+ }),// Item count + filter badge rowif (!_isInSearchMode) _buildInfoRow(cs, tt, l),],@@ -2736,19 +2794,21 @@ class LibraryScreenState extends State<LibraryScreen>// Shows | Episodes switcher for podcast libraries, styled like the book// libraries' floating tab pills.- Widget _buildPodcastViewPill(ColorScheme cs) {+ Widget _buildPodcastViewPill(ColorScheme cs, {bool floating = true}) {final l = AppLocalizations.of(context)!;final labels = [l.appShellShowsTab, l.libraryTabEpisodes];- return ClipRRect(- borderRadius: BorderRadius.circular(24),- child: BackdropFilter(- filter: ui.ImageFilter.blur(sigmaX: 20, sigmaY: 20),- child: Container(+ final pill = Container(padding: const EdgeInsets.all(4),decoration: BoxDecoration(- color: cs.surface.withValues(alpha: 0.6),+ color: floating+ ? cs.surface.withValues(alpha: 0.6)+ : cs.surfaceContainerLow,borderRadius: BorderRadius.circular(24),- border: Border.all(color: cs.primary.withValues(alpha: 0.25)),+ border: Border.all(+ color: floating+ ? cs.primary.withValues(alpha: 0.25)+ : cs.outlineVariant.withValues(alpha: 0.45),+ ),),child: Row(mainAxisSize: MainAxisSize.min,@@ -2807,12 +2867,18 @@ class LibraryScreenState extends State<LibraryScreen>);}),),- ),+ );+ if (!floating) return pill;+ return ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: BackdropFilter(+ filter: ui.ImageFilter.blur(sigmaX: 20, sigmaY: 20),+ child: pill,),);}- Widget _buildFloatingTabBar(ColorScheme cs) {+ Widget _buildFloatingTabBar(ColorScheme cs, {bool floating = true}) {final l = AppLocalizations.of(context)!;final labels = [l.libraryTabLibrary,@@ -2821,6 +2887,84 @@ class LibraryScreenState extends State<LibraryScreen>l.libraryTabNarrators,if (_showLists) 'Lists',];+ final pill = Container(+ padding: const EdgeInsets.all(4),+ decoration: BoxDecoration(+ color: floating+ ? cs.surface.withValues(alpha: 0.6)+ : cs.surfaceContainerLow,+ borderRadius: BorderRadius.circular(24),+ border: Border.all(+ color: floating+ ? cs.primary.withValues(alpha: 0.25)+ : cs.outlineVariant.withValues(alpha: 0.45),+ ),+ ),+ child: FittedBox(+ fit: BoxFit.scaleDown,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: List.generate(labels.length, (i) {+ final active = _currentTab == i;+ return GestureDetector(+ onTap: () {+ if (active) {+ _showSortFilterSheet(+ context,+ cs,+ Theme.of(context).textTheme,+ );+ } else {+ _tabController?.animateTo(i);+ }+ },+ child: AnimatedContainer(+ duration: const Duration(milliseconds: 200),+ curve: Curves.easeInOut,+ padding: EdgeInsets.symmetric(+ horizontal: active ? 14 : 12,+ vertical: 8,+ ),+ decoration: BoxDecoration(+ color: active+ ? cs.primary.withValues(alpha: 0.15)+ : Colors.transparent,+ borderRadius: BorderRadius.circular(20),+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ labels[i],+ maxLines: 1,+ softWrap: false,+ style: TextStyle(+ fontSize: 13,+ fontWeight: active+ ? FontWeight.w700+ : FontWeight.w500,+ color: active+ ? cs.primary+ : cs.onSurfaceVariant,+ ),+ ),+ if (active) ...[+ const SizedBox(width: 4),+ Icon(+ Icons.sort_rounded,+ size: 14,+ color: cs.primary,+ ),+ ],+ ],+ ),+ ),+ );+ }),+ ),+ ),+ );+ if (!floating) return pill;return Center(child: Padding(// Inset from the screen edges; the FittedBox below scales the whole@@ -2831,77 +2975,7 @@ class LibraryScreenState extends State<LibraryScreen>borderRadius: BorderRadius.circular(24),child: BackdropFilter(filter: ui.ImageFilter.blur(sigmaX: 20, sigmaY: 20),- child: Container(- padding: const EdgeInsets.all(4),- decoration: BoxDecoration(- color: cs.surface.withValues(alpha: 0.6),- borderRadius: BorderRadius.circular(24),- border: Border.all(color: cs.primary.withValues(alpha: 0.25)),- ),- child: FittedBox(- fit: BoxFit.scaleDown,- child: Row(- mainAxisSize: MainAxisSize.min,- children: List.generate(labels.length, (i) {- final active = _currentTab == i;- return GestureDetector(- onTap: () {- if (active) {- _showSortFilterSheet(- context,- cs,- Theme.of(context).textTheme,- );- } else {- _tabController?.animateTo(i);- }- },- child: AnimatedContainer(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOut,- padding: EdgeInsets.symmetric(- horizontal: active ? 14 : 12,- vertical: 8,- ),- decoration: BoxDecoration(- color: active- ? cs.primary.withValues(alpha: 0.15)- : Colors.transparent,- borderRadius: BorderRadius.circular(20),- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Text(- labels[i],- maxLines: 1,- softWrap: false,- style: TextStyle(- fontSize: 13,- fontWeight: active- ? FontWeight.w700- : FontWeight.w500,- color: active- ? cs.primary- : cs.onSurfaceVariant,- ),- ),- if (active) ...[- const SizedBox(width: 4),- Icon(- Icons.sort_rounded,- size: 14,- color: cs.primary,- ),- ],- ],- ),- ),- );- }),- ),- ),- ),+ child: pill,),),),@@ -3121,6 +3195,22 @@ class LibraryScreenState extends State<LibraryScreen>}// ── Pull-to-refresh ──+ Future<void> _refreshCurrentTab() {+ if (_tabController == null) return _refreshAll();+ switch (_currentTab) {+ case 1:+ return _refreshSeries();+ case 2:+ return _refreshAuthors();+ case 3:+ return _refreshNarrators();+ case 4:+ return _refreshLists();+ default:+ return _refreshAll();+ }+ }+Future<void> _refreshAll() async {final lib = context.read<LibraryProvider>();await lib.refresh();diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dartindex 5d64418f..5fd22f77 100644--- a/lib/screens/settings_screen.dart+++ b/lib/screens/settings_screen.dart@@ -44,6 +44,8 @@ import '../widgets/tips_sheet.dart';import '../widgets/feature_hint.dart';import '../widgets/welcome_sheet.dart';import '../utils/app_platform.dart';+import '../utils/desktop_workspace.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/rmab_config_sheet.dart';import '../widgets/server_connection_editor.dart';import '../widgets/server_admin_status_badges.dart';@@ -62,39 +64,20 @@ Future<T?> _showAdaptiveSettingsSurface<T>({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>(+ return showAdaptiveActionMenu<T>(context: context,+ desktopWidth: maxWidth,+ desktopMaxHeightFraction: 0.86,+ desktopScrollWrap: false,isScrollControlled: true,useSafeArea: true,backgroundColor: cs.surfaceContainerHigh,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20)),),- builder: (sheetContext) => builder(sheetContext, false),);+ builder: (ctx) => builder(ctx, ModalSurface.isDesktopOf(ctx)),+ );}class _SettingsAdaptiveFrame extends StatelessWidget {@@ -1405,8 +1388,7 @@ class _SettingsScreenState extends State<SettingsScreen> {child: SafeArea(child: LayoutBuilder(builder: (context, constraints) {- final isDesktopSettings =- AppPlatform.isWeb && constraints.maxWidth >= 960;+ final isDesktopSettings = isDesktopWorkspace(context);final expandedSection = _expandedSection ??(isDesktopSettings ? 'Account' : null);final destinations = <_SettingsSectionDestination>[@@ -4246,7 +4228,7 @@ class _SettingsScreenState extends State<SettingsScreen> {),),],- const SizedBox(height: 100),+ SizedBox(height: isDesktopSettings ? 24 : 100),],),),@@ -4361,7 +4343,7 @@ class _SettingsScreenState extends State<SettingsScreen> {final api = context.read<AuthProvider>().apiService;final legacyCount = dl.legacyExternalDownloads.length;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: cs.surface,shape: const RoundedRectangleBorder(diff --git a/lib/screens/stats_screen.dart b/lib/screens/stats_screen.dartindex 1e435fcc..0fcccfdb 100644--- a/lib/screens/stats_screen.dart+++ b/lib/screens/stats_screen.dart@@ -9,8 +9,9 @@ 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 '../utils/desktop_workspace.dart';import '../widgets/absorb_page_header.dart';+import '../widgets/adaptive_modal.dart';import '../widgets/finished_books_this_year_sheet.dart';import '../widgets/stats_charts.dart';import '../widgets/day_sessions_sheet.dart';@@ -588,8 +589,7 @@ class _StatsScreenState extends State<StatsScreen>return LayoutBuilder(builder: (context, constraints) {final isWide = constraints.maxWidth >= 900;- final isDesktopWorkspace =- AppPlatform.isWeb && constraints.maxWidth >= 960;+ final desktopWorkspace = isDesktopWorkspace(context);final horizontalPadding = isWide ? 32.0 : 20.0;return ListView(controller: _scrollController,@@ -606,7 +606,7 @@ class _StatsScreenState extends State<StatsScreen>children: [AbsorbPageHeader(title: l.statsTitle,- showBranding: !isDesktopWorkspace,+ showBranding: !desktopWorkspace,padding: EdgeInsets.only(top: isWide ? 24 : 12),),const SizedBox(height: 24),@@ -1594,10 +1594,12 @@ class _StatsScreenState extends State<StatsScreen>}Future<void> _showDaySessions(DateTime day) async {- final changed = await showModalBottomSheet<bool>(+ final changed = await showAdaptiveActionMenu<bool>(context: context,isScrollControlled: true,backgroundColor: Colors.transparent,+ desktopWidth: 520,+ desktopScrollWrap: false,builder: (_) => DaySessionsSheet(initialDate: day,loadSessions: _loadSessionsForDay,@@ -1617,10 +1619,12 @@ class _StatsScreenState extends State<StatsScreen>Map<String, dynamic> s, {bool refreshStats = true,}) async {- final changed = await showModalBottomSheet<bool>(+ final changed = await showAdaptiveActionMenu<bool>(context: context,isScrollControlled: true,backgroundColor: Colors.transparent,+ desktopWidth: 520,+ desktopScrollWrap: false,builder: (_) => SessionDetailsSheet(session: s),);if (changed == true && mounted && refreshStats) {diff --git a/lib/utils/desktop_workspace.dart b/lib/utils/desktop_workspace.dartnew file mode 100644index 00000000..f7e676fb--- /dev/null+++ b/lib/utils/desktop_workspace.dart@@ -0,0 +1,34 @@+import 'package:flutter/widgets.dart';+import 'app_platform.dart';++const double kDesktopWorkspaceBreakpoint = 960;++/// Registration point for the desktop workspace's content-pane navigator.+/// AppShell registers a resolver on mount; anything that pushes full pages+/// resolves through [contentNavigator] so pages land inside the pane on+/// desktop and on the root navigator everywhere else.+abstract final class DesktopWorkspaceNavigator {+ static NavigatorState? Function()? _resolver;++ static void register(NavigatorState? Function() resolver) =>+ _resolver = resolver;++ static void unregister() => _resolver = null;+}++NavigatorState contentNavigator(BuildContext context) =>+ DesktopWorkspaceNavigator._resolver?.call() ??+ Navigator.of(context, rootNavigator: true);++/// Whether the app is showing the desktop web workspace (sidebar shell).+/// Measures the window via the View, not MediaQuery: pages run inside a+/// MediaQuery whose size is overridden to the content pane, which would+/// disagree with the shell's own breakpoint between 960 and ~1208px.+bool isDesktopWorkspace(BuildContext context) {+ if (!AppPlatform.isWeb) return false;+ // Subscribe to size changes so callers rebuild on window resize.+ MediaQuery.sizeOf(context);+ final view = View.of(context);+ return view.physicalSize.width / view.devicePixelRatio >=+ kDesktopWorkspaceBreakpoint;+}diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dartindex ee5f2989..8e2eb7ba 100644--- a/lib/widgets/absorbing_card.dart+++ b/lib/widgets/absorbing_card.dart@@ -21,6 +21,7 @@ import 'card_buttons.dart';import '../services/chromecast_service.dart';import 'expanded_card.dart';import '../main.dart' show colorSourceNotifier, useColorEverywhereNotifier, manualSeedNotifier, manualColorScheme;+import '../utils/desktop_workspace.dart';import 'stable_cached_network_image.dart';class AbsorbingCard extends StatefulWidget {@@ -1201,6 +1202,9 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli}void expandCard(BuildContext context) {+ // The desktop workspace has no full-screen player; the Absorbing tab is+ // the now-playing surface itself.+ if (isDesktopWorkspace(context)) return;AppShell.setExpandedOpen(true);Navigator.of(context, rootNavigator: true).push(ExpandedCardRoute(diff --git a/lib/widgets/adaptive_modal.dart b/lib/widgets/adaptive_modal.dartnew file mode 100644index 00000000..b483ad59--- /dev/null+++ b/lib/widgets/adaptive_modal.dart@@ -0,0 +1,283 @@+import 'package:flutter/material.dart';+import '../utils/desktop_workspace.dart';++enum DialogWidthClass {+ action(480),+ content(720);++ const DialogWidthClass(this.width);+ final double width;+}++/// Marks which surface a modal's content is rendered in so shared content can+/// adapt (hide drag handles, square off sheet corners) without new params.+class ModalSurface extends InheritedWidget {+ const ModalSurface({super.key, required this.desktop, required super.child});++ final bool desktop;++ static bool isDesktopOf(BuildContext context) =>+ context.dependOnInheritedWidgetOfExactType<ModalSurface>()?.desktop ??+ false;++ @override+ bool updateShouldNotify(ModalSurface oldWidget) =>+ oldWidget.desktop != desktop;+}++/// Scrollable browse/detail surface: draggable bottom sheet on mobile,+/// centered dialog on the desktop workspace. The builder's ScrollController+/// comes from the DraggableScrollableSheet on mobile and a dialog-owned+/// controller on desktop, so existing sheet bodies work unchanged.+Future<T?> showAdaptiveSheetDialog<T>({+ required BuildContext context,+ required Widget Function(BuildContext, ScrollController) builder,+ DialogWidthClass widthClass = DialogWidthClass.content,+ double desktopMaxHeightFraction = 0.85,+ bool desktopCloseButton = true,+ double initialChildSize = 0.7,+ double minChildSize = 0.5,+ double maxChildSize = 1.0,+ bool snap = false,+ bool expand = false,+ bool useSafeArea = true,+ Color? backgroundColor,+ bool isDismissible = true,+ bool showDragHandle = false,+}) {+ if (isDesktopWorkspace(context)) {+ return showDesktopSheetDialog<T>(+ context: context,+ builder: builder,+ maxWidth: widthClass.width,+ maxHeightFraction: desktopMaxHeightFraction,+ closeButton: desktopCloseButton,+ backgroundColor: backgroundColor,+ isDismissible: isDismissible,+ );+ }+ return showModalBottomSheet<T>(+ context: context,+ isScrollControlled: true,+ useSafeArea: useSafeArea,+ backgroundColor: backgroundColor,+ isDismissible: isDismissible,+ showDragHandle: showDragHandle,+ builder: (ctx) => DraggableScrollableSheet(+ expand: expand,+ initialChildSize: initialChildSize,+ minChildSize: minChildSize,+ maxChildSize: maxChildSize,+ snap: snap,+ builder: (c, sc) => ModalSurface(desktop: false, child: builder(c, sc)),+ ),+ );+}++/// Intrinsic-height action menu / picker: plain bottom sheet on mobile, small+/// centered dialog on the desktop workspace. Set [desktopScrollWrap] false+/// when the content manages its own scrolling.+Future<T?> showAdaptiveActionMenu<T>({+ required BuildContext context,+ required WidgetBuilder builder,+ double desktopWidth = 480,+ double desktopMaxHeightFraction = 0.85,+ bool desktopScrollWrap = true,+ bool isScrollControlled = false,+ bool useSafeArea = false,+ Color? backgroundColor,+ ShapeBorder? shape,+ bool isDismissible = true,+ bool showDragHandle = false,+ BoxConstraints? constraints,+}) {+ if (isDesktopWorkspace(context)) {+ return showDesktopModalDialog<T>(+ context: context,+ maxWidth: desktopWidth,+ maxHeightFraction: desktopMaxHeightFraction,+ closeButton: false,+ backgroundColor: backgroundColor,+ isDismissible: isDismissible,+ builder: desktopScrollWrap+ ? (ctx) => SingleChildScrollView(child: Builder(builder: builder))+ : builder,+ );+ }+ return showModalBottomSheet<T>(+ context: context,+ isScrollControlled: isScrollControlled,+ useSafeArea: useSafeArea,+ backgroundColor: backgroundColor,+ shape: shape,+ isDismissible: isDismissible,+ showDragHandle: showDragHandle,+ constraints: constraints,+ builder: (ctx) => ModalSurface(desktop: false, child: builder(ctx)),+ );+}++/// Desktop dialog surface for sheet-style builders that expect a+/// ScrollController. Used by the adaptive helpers and showStackableSheet.+Future<T?> showDesktopSheetDialog<T>({+ required BuildContext context,+ required Widget Function(BuildContext, ScrollController) builder,+ double maxWidth = 720,+ double maxHeightFraction = 0.85,+ bool closeButton = true,+ Color? backgroundColor,+ bool isDismissible = true,+ void Function(Route<dynamic>)? onRouteCaptured,+ void Function(Route<dynamic>)? onRouteDisposed,+}) =>+ showDesktopModalDialog<T>(+ context: context,+ maxWidth: maxWidth,+ maxHeightFraction: maxHeightFraction,+ closeButton: closeButton,+ backgroundColor: backgroundColor,+ isDismissible: isDismissible,+ onRouteCaptured: onRouteCaptured,+ onRouteDisposed: onRouteDisposed,+ builder: (ctx) => _SheetDialogScrollHost(builder: builder),+ );++/// Centered dialog with the shared desktop modal chrome (matches the+/// settings surfaces). Always presents on the root navigator so it covers+/// the whole window.+Future<T?> showDesktopModalDialog<T>({+ required BuildContext context,+ required WidgetBuilder builder,+ double maxWidth = 720,+ double maxHeightFraction = 0.85,+ bool closeButton = true,+ Color? backgroundColor,+ bool isDismissible = true,+ void Function(Route<dynamic>)? onRouteCaptured,+ void Function(Route<dynamic>)? onRouteDisposed,+}) {+ final cs = Theme.of(context).colorScheme;+ // Transparent means "the sheet body paints its own rounded container";+ // inside a clipped dialog that container needs a real backdrop instead.+ final bg = backgroundColor == null || backgroundColor == Colors.transparent+ ? cs.surfaceContainerHigh+ : backgroundColor;+ return showDialog<T>(+ context: context,+ useRootNavigator: true,+ barrierDismissible: isDismissible,+ builder: (dialogContext) => Dialog(+ backgroundColor: bg,+ 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(+ maxHeight:+ MediaQuery.sizeOf(dialogContext).height * maxHeightFraction,+ ),+ child: SizedBox(+ width: maxWidth,+ child: _DesktopDialogBody(+ builder: builder,+ closeButton: closeButton,+ onRouteCaptured: onRouteCaptured,+ onRouteDisposed: onRouteDisposed,+ ),+ ),+ ),+ ),+ );+}++class _SheetDialogScrollHost extends StatefulWidget {+ const _SheetDialogScrollHost({required this.builder});++ final Widget Function(BuildContext, ScrollController) builder;++ @override+ State<_SheetDialogScrollHost> createState() => _SheetDialogScrollHostState();+}++class _SheetDialogScrollHostState extends State<_SheetDialogScrollHost> {+ final _controller = ScrollController();++ @override+ void dispose() {+ _controller.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => widget.builder(context, _controller);+}++class _DesktopDialogBody extends StatefulWidget {+ const _DesktopDialogBody({+ required this.builder,+ required this.closeButton,+ this.onRouteCaptured,+ this.onRouteDisposed,+ });++ final WidgetBuilder builder;+ final bool closeButton;+ final void Function(Route<dynamic>)? onRouteCaptured;+ final void Function(Route<dynamic>)? onRouteDisposed;++ @override+ State<_DesktopDialogBody> createState() => _DesktopDialogBodyState();+}++class _DesktopDialogBodyState extends State<_DesktopDialogBody> {+ Route<dynamic>? _route;++ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (!mounted) return;+ _route = ModalRoute.of(context);+ if (_route != null) widget.onRouteCaptured?.call(_route!);+ });+ }++ @override+ void dispose() {+ if (_route != null) widget.onRouteDisposed?.call(_route!);+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final cs = Theme.of(context).colorScheme;+ final content = ModalSurface(+ desktop: true,+ child: Builder(builder: widget.builder),+ );+ if (!widget.closeButton) return content;+ return Stack(+ children: [+ content,+ Positioned(+ top: 8,+ right: 8,+ child: Material(+ color: cs.surfaceContainerHighest.withValues(alpha: 0.85),+ shape: const CircleBorder(),+ clipBehavior: Clip.antiAlias,+ child: IconButton(+ visualDensity: VisualDensity.compact,+ icon: Icon(Icons.close_rounded,+ size: 20, color: cs.onSurfaceVariant),+ onPressed: () => Navigator.of(context).pop(),+ ),+ ),+ ),+ ],+ );+ }+}diff --git a/lib/widgets/admin_task_indicator.dart b/lib/widgets/admin_task_indicator.dartindex ffdae4fd..2897cb1c 100644--- a/lib/widgets/admin_task_indicator.dart+++ b/lib/widgets/admin_task_indicator.dart@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../services/server_task_tracker.dart';+import 'adaptive_modal.dart';class AdminTaskIndicator extends StatelessWidget {static const indicatorKey = Key('admin-task-indicator');@@ -82,11 +83,13 @@ Future<void> showAdminTasksSheet(BuildContext context,ServerTaskTracker tracker,) {- return showModalBottomSheet<void>(+ return showAdaptiveActionMenu<void>(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopWidth: 560,+ desktopScrollWrap: false,builder: (sheetContext) => ListenableBuilder(listenable: tracker,builder: (_, __) => AdminTasksSheet(tasks: tracker.visibleTasks),diff --git a/lib/widgets/audible_series_sheet.dart b/lib/widgets/audible_series_sheet.dartindex fe04d0bb..91f834d2 100644--- a/lib/widgets/audible_series_sheet.dart+++ b/lib/widgets/audible_series_sheet.dart@@ -8,6 +8,7 @@ import '../services/rmab_service.dart';import '../services/scoped_prefs.dart';import '../services/upcoming_releases_service.dart';import '../utils/app_platform.dart';+import 'adaptive_modal.dart';import 'overlay_toast.dart';import 'rmab_book_detail_sheet.dart';import 'rmab_config_sheet.dart' show kRmabBaseUrlKey, kRmabApiTokenKey;@@ -550,13 +551,14 @@ Future<String?> showAudibleRegionPicker(BuildContext context, {required String cfinal cs = Theme.of(context).colorScheme;final tt = Theme.of(context).textTheme;final l = AppLocalizations.of(context)!;- return showModalBottomSheet<String>(+ return showAdaptiveActionMenu<String>(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),isScrollControlled: true,+ desktopScrollWrap: false,constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.6),builder: (ctx) => SafeArea(child: Column(mainAxisSize: MainAxisSize.min, children: [@@ -609,7 +611,7 @@ void showAudibleBookMenu(BuildContext context, {final asin = book['asin'] as String? ?? '';final releaseDate = book['releaseDate'] as String? ?? '';- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/book_card.dart b/lib/widgets/book_card.dartindex e14aabeb..db38422f 100644--- a/lib/widgets/book_card.dart+++ b/lib/widgets/book_card.dart@@ -4,12 +4,14 @@ import 'package:provider/provider.dart';import 'package:cached_network_image/cached_network_image.dart';import '../l10n/app_localizations.dart';import 'cover_badges.dart';+import '../providers/auth_provider.dart';import '../providers/library_provider.dart';import '../services/audio_player_service.dart';import '../services/download_service.dart';import 'absorbing_shared.dart';import 'book_detail_sheet.dart';import 'episode_list_sheet.dart';+import 'hover_cover_actions.dart';class BookCard extends StatelessWidget {final Map<String, dynamic> item;@@ -61,10 +63,19 @@ class BookCard extends StatelessWidget {final headers = lib.mediaHeaders;- if (isWide) {- return _buildWideCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isExplicit: isExplicit);- }- return _buildCompactCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded, isExplicit: isExplicit, unfinishedCount: unfinishedCount);+ final card = isWide+ ? _buildWideCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isExplicit: isExplicit)+ : _buildCompactCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded, isExplicit: isExplicit, unfinishedCount: unfinishedCount);++ final canEdit = itemId != null &&+ !lib.isPodcastLibrary &&+ !lib.isOffline &&+ context.watch<AuthProvider>().canUpdateMetadata;+ return HoverCoverActions(+ onMenu: itemId == null ? null : () => _onLongPress(context),+ editItemId: canEdit ? itemId : null,+ child: card,+ );}void _navigateToDetail(BuildContext context) {diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dartindex d407aff5..b4669657 100644--- a/lib/widgets/book_detail_sheet.dart+++ b/lib/widgets/book_detail_sheet.dart@@ -12,6 +12,7 @@ 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 '../utils/desktop_workspace.dart';import 'package:path_provider/path_provider.dart';import 'package:file_picker/file_picker.dart';import 'package:http/http.dart' as http;@@ -45,6 +46,7 @@ import 'metadata_lookup_sheet.dart';import 'playlist_picker_sheet.dart';import 'collection_picker_sheet.dart';import 'absorb_wave_icon.dart';+import 'adaptive_modal.dart';import 'stackable_sheet.dart';import 'ebook_router.dart';import '../utils/duration_format.dart';@@ -89,6 +91,7 @@ void showQuickActionsSheet(useSafeArea: true,initialChildSize: 0.6,maxChildSize: 0.92,+ desktopWidth: 520,builder: (ctx, sc) => _BookDetailSheetContent(itemId: itemId,scrollController: sc,@@ -1321,9 +1324,11 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {if (id.isNotEmpty) bookSeriesIds.add(id);}final continueSeriesId = lib.continueSeriesShelfMatch(bookSeriesIds);- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,+ desktopWidth: 520,+ desktopScrollWrap: false,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),@@ -1401,18 +1406,27 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {final audioFiles = (media['audioFiles'] as List<dynamic>?) ?? const [];final libraryFiles = (_item!['libraryFiles'] as List<dynamic>?) ?? const [];final rel = _item!['relPath'] as String? ?? '';- Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(+ final itemId = widget.itemId;+ final libraryId = _item!['libraryId'] as String?;+ final isAdmin = auth.isAdmin;+ final nav = contentNavigator(context);+ // On desktop the detail surface is a root-navigator dialog while the+ // editor lands in the content pane below it; close the dialogs first.+ if (isDesktopWorkspace(context)) {+ Navigator.of(context, rootNavigator: true).popUntil((r) => r.isFirst);+ }+ nav.push(MaterialPageRoute(builder: (_) => BookEditScreen(- itemId: widget.itemId,+ itemId: itemId,bookTitle: title,metadata: meta,tags: mediaTags,audioFiles: audioFiles,- libraryFiles: libraryFiles,- relPath: rel,+ libraryFiles: libraryFiles,+ relPath: rel,isEbookOnly: isEbookOnly,- isAdmin: auth.isAdmin,- libraryId: _item!['libraryId'] as String?,+ isAdmin: isAdmin,+ libraryId: libraryId,),));}@@ -1592,15 +1606,15 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {..setBackgroundColor(cs.surface)..loadRequest(Uri.parse(url));- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,+ desktopWidth: 720,+ desktopScrollWrap: false,backgroundColor: Colors.transparent,- enableDrag: true,- builder: (ctx) => FractionallySizedBox(- heightFactor: 0.92,- child: Container(+ builder: (ctx) {+ final body = Container(clipBehavior: Clip.hardEdge,decoration: BoxDecoration(color: cs.surface,@@ -1641,8 +1655,10 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {),),]),- ),- ),+ );+ if (ModalSurface.isDesktopOf(ctx)) return body;+ return FractionallySizedBox(heightFactor: 0.92, child: body);+ },);}@@ -2003,8 +2019,9 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {BuildContext context, List<Map<String, dynamic>> devices) {final cs = Theme.of(context).colorScheme;final l = AppLocalizations.of(context)!;- return showModalBottomSheet<String>(+ return showAdaptiveActionMenu<String>(context: context,+ desktopScrollWrap: false,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),@@ -2299,31 +2316,29 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {void _openMetadataLookup(BuildContext context, AuthProvider auth, String title, String author) {final api = auth.apiService;if (api == null) return;- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,+ useSafeArea: false,backgroundColor: Colors.transparent,- builder: (_) => DraggableScrollableSheet(- expand: false,- initialChildSize: 0.85,- minChildSize: 0.05, snap: true,- maxChildSize: 0.95,- builder: (ctx, sc) => MetadataLookupSheet(- scrollController: sc,- itemId: widget.itemId,- api: api,- initialTitle: title,- initialAuthor: author,- currentMetadata: (_item?['media'] as Map<String, dynamic>?)?['metadata'] as Map<String, dynamic>?,- onApplied: () {- // Reload the item to show the new override, and repaint the- // library so the grid/absorbing card pick up the override cover.- _loadItem();- if (mounted) {- context.read<LibraryProvider>().notifyCoverOverridesChanged();- }- },- ),+ expand: false,+ initialChildSize: 0.85,+ minChildSize: 0.05, snap: true,+ maxChildSize: 0.95,+ builder: (ctx, sc) => MetadataLookupSheet(+ scrollController: sc,+ itemId: widget.itemId,+ api: api,+ initialTitle: title,+ initialAuthor: author,+ currentMetadata: (_item?['media'] as Map<String, dynamic>?)?['metadata'] as Map<String, dynamic>?,+ onApplied: () {+ // Reload the item to show the new override, and repaint the+ // library so the grid/absorbing card pick up the override cover.+ _loadItem();+ if (mounted) {+ context.read<LibraryProvider>().notifyCoverOverridesChanged();+ }+ },),);}diff --git a/lib/widgets/bookmark_detail_dialog.dart b/lib/widgets/bookmark_detail_dialog.dartindex 26c2391f..52487d72 100644--- a/lib/widgets/bookmark_detail_dialog.dart+++ b/lib/widgets/bookmark_detail_dialog.dart@@ -8,6 +8,7 @@ import '../services/bookmark_service.dart';import '../services/bookmark_preview_player.dart';import '../services/download_service.dart';import '../utils/app_platform.dart';+import 'adaptive_modal.dart';import 'clip_editor_sheet.dart';import 'overlay_toast.dart';@@ -108,8 +109,9 @@ class _BookmarkDetailSheetState extends State<BookmarkDetailSheet> {await _promptDownload();return;}- await showModalBottomSheet<void>(+ await showAdaptiveActionMenu<void>(context: context,+ desktopWidth: 560,isScrollControlled: true,showDragHandle: true,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dartindex 13efbf0b..b5c51711 100644--- a/lib/widgets/card_buttons.dart+++ b/lib/widgets/card_buttons.dart@@ -19,6 +19,7 @@ import '../services/scoped_prefs.dart';import '../services/sleep_timer_service.dart';import 'absorb_slider.dart';import 'absorbing_shared.dart';+import 'adaptive_modal.dart';import 'book_detail_sheet.dart';import 'bookmark_detail_dialog.dart';import 'card_button_config.dart';@@ -496,12 +497,10 @@ class _CardBookmarkButtonInlineState extends State<CardBookmarkButtonInline> {}void _showBookmarks(BuildContext context) {- showModalBottomSheet(- context: context, backgroundColor: Colors.transparent, isScrollControlled: true, useSafeArea: true,- builder: (ctx) => DraggableScrollableSheet(- initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,- builder: (ctx, sc) => SimpleBookmarkSheet(itemId: widget.itemId, player: widget.player, accent: widget.accent, scrollController: sc, onChanged: _loadCount),- ),+ showAdaptiveSheetDialog(+ context: context, widthClass: DialogWidthClass.action, backgroundColor: Colors.transparent, useSafeArea: true,+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,+ builder: (ctx, sc) => SimpleBookmarkSheet(itemId: widget.itemId, player: widget.player, accent: widget.accent, scrollController: sc, onChanged: _loadCount),);}}@@ -578,7 +577,7 @@ class _CardSpeedButtonInlineState extends State<CardSpeedButtonInline> {}return Pressable(onTap: () {- showModalBottomSheet(context: context, backgroundColor: Colors.transparent,+ showAdaptiveActionMenu(context: context, backgroundColor: Colors.transparent,useSafeArea: true,builder: (ctx) => CardSpeedSheet(player: widget.player, accent: widget.accent, itemId: widget.itemId));},@@ -848,7 +847,7 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {final hasNote = bm.note != null && bm.note!.isNotEmpty;return InkWell(onTap: () async {- final result = await showModalBottomSheet<BookmarkDetailResult>(+ final result = await showAdaptiveActionMenu<BookmarkDetailResult>(context: ctx,isScrollControlled: true,showDragHandle: true,@@ -1681,7 +1680,7 @@ class CardActionDelegate {enabled: true,onTap: () {Navigator.pop(ctx);- showModalBottomSheet(context: context, backgroundColor: Colors.transparent, useSafeArea: true,+ showAdaptiveActionMenu(context: context, backgroundColor: Colors.transparent, useSafeArea: true,builder: (_) => CardSpeedSheet(player: player, accent: accent, itemId: itemId));},);@@ -1700,11 +1699,9 @@ class CardActionDelegate {enabled: isPlaybackActive,onTap: () {Navigator.pop(ctx);- showModalBottomSheet(context: context, backgroundColor: Colors.transparent, isScrollControlled: true, useSafeArea: true,- builder: (_) => DraggableScrollableSheet(- initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,- builder: (_, sc) => SimpleBookmarkSheet(itemId: itemId, player: player, accent: accent, scrollController: sc, onChanged: () {}),- ),+ showAdaptiveSheetDialog(context: context, widthClass: DialogWidthClass.action, backgroundColor: Colors.transparent, useSafeArea: true,+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,+ builder: (_, sc) => SimpleBookmarkSheet(itemId: itemId, player: player, accent: accent, scrollController: sc, onChanged: () {}),);},);@@ -1839,8 +1836,10 @@ class CardActionDelegate {void showMoreMenu(Color accent, TextTheme tt) {final count = visibleButtonCount;final overflowIds = buttonOrder.skip(count).where((id) => id != '_more').toList();- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,+ desktopWidth: 520,+ desktopScrollWrap: false,backgroundColor: Colors.transparent,isScrollControlled: true,builder: (ctx) => MoreMenuSheet(@@ -1887,7 +1886,7 @@ class CardActionDelegate {final auth = ctx.read<AuthProvider>();final api = auth.apiService;if (cast.isCasting && cast.castingItemId == itemId) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: ctx,backgroundColor: Theme.of(ctx).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(@@ -2021,29 +2020,27 @@ void showPlaybackHistorySheet((episodeId == null ||resolvedPlayer.currentEpisodeId == episodeId));final theme = Theme.of(context);- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,+ widthClass: DialogWidthClass.action,useSafeArea: true,backgroundColor: Colors.transparent,- builder: (_) => DraggableScrollableSheet(- expand: false,- initialChildSize: 0.6,- minChildSize: 0.05,- snap: true,- maxChildSize: 0.9,- builder: (_, scrollController) => _PlaybackHistoryBody(- itemId: itemId,- episodeId: episodeId,- api: context.read<AuthProvider>().apiService,- accent: accent ?? theme.colorScheme.primary,- tt: textTheme ?? theme.textTheme,- isActive: resolvedIsActive,- player: resolvedPlayer,- parentCtx: context,- scrollController: scrollController,- initialTab: initialTab,- ),+ expand: false,+ initialChildSize: 0.6,+ minChildSize: 0.05,+ snap: true,+ maxChildSize: 0.9,+ builder: (_, scrollController) => _PlaybackHistoryBody(+ itemId: itemId,+ episodeId: episodeId,+ api: context.read<AuthProvider>().apiService,+ accent: accent ?? theme.colorScheme.primary,+ tt: textTheme ?? theme.textTheme,+ isActive: resolvedIsActive,+ player: resolvedPlayer,+ parentCtx: context,+ scrollController: scrollController,+ initialTab: initialTab,),);}@@ -2404,8 +2401,9 @@ class _PlaybackHistorySheetBodyState extends State<_PlaybackHistoryBody>Future<void> _showServerSessionDetails(Map<String, dynamic> session,) async {- final changed = await showModalBottomSheet<bool>(+ final changed = await showAdaptiveActionMenu<bool>(context: context,+ desktopWidth: 520,isScrollControlled: true,backgroundColor: Colors.transparent,builder: (_) => SessionDetailsSheet(diff --git a/lib/widgets/card_chapters_sheet.dart b/lib/widgets/card_chapters_sheet.dartindex 908471dc..c6a85c39 100644--- a/lib/widgets/card_chapters_sheet.dart+++ b/lib/widgets/card_chapters_sheet.dart@@ -7,6 +7,7 @@ import '../screens/app_shell.dart';import '../services/audio_player_service.dart';import '../services/chromecast_service.dart';import 'absorbing_shared.dart';+import 'adaptive_modal.dart';void showChaptersSheet({required BuildContext context,@@ -33,12 +34,12 @@ void showChaptersSheet({final cast = ChromecastService();- showModalBottomSheet(- context: context, isScrollControlled: true, useSafeArea: true,+ showAdaptiveSheetDialog(+ context: context, useSafeArea: true,backgroundColor: Colors.transparent,- builder: (ctx) => DraggableScrollableSheet(- expand: false, initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,- builder: (_, sc) {+ widthClass: DialogWidthClass.action,+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,+ builder: (ctx, sc) {if (currentIdx > 0) {WidgetsBinding.instance.addPostFrameCallback((_) {final target = currentIdx * 48.0 - 48;@@ -136,7 +137,6 @@ void showChaptersSheet({)),]),);- },- ),+ },);}diff --git a/lib/widgets/chromecast_button.dart b/lib/widgets/chromecast_button.dartindex 6b091817..83f45a03 100644--- a/lib/widgets/chromecast_button.dart+++ b/lib/widgets/chromecast_button.dart@@ -3,6 +3,7 @@ import 'package:flutter_chrome_cast/flutter_chrome_cast.dart';import '../l10n/app_localizations.dart';import '../services/chromecast_service.dart';import '../services/api_service.dart';+import 'adaptive_modal.dart';/// Shows a device picker. If castAfter params are provided, automatically/// casts the book after connecting to the selected device.@@ -18,7 +19,7 @@ void showCastDevicePicker(String? episodeId,}) {final cast = ChromecastService();- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/collection_picker_sheet.dart b/lib/widgets/collection_picker_sheet.dartindex 15285931..9900e163 100644--- a/lib/widgets/collection_picker_sheet.dart+++ b/lib/widgets/collection_picker_sheet.dart@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/library_provider.dart';+import 'adaptive_modal.dart';import 'overlay_toast.dart';class CollectionPickerSheet extends StatefulWidget {@@ -13,7 +14,7 @@ class CollectionPickerSheet extends StatefulWidget {});static void show(BuildContext context, String libraryItemId) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/desktop_now_playing_bar.dart b/lib/widgets/desktop_now_playing_bar.dartindex 27314219..afbf9429 100644--- a/lib/widgets/desktop_now_playing_bar.dart+++ b/lib/widgets/desktop_now_playing_bar.dart@@ -3,19 +3,24 @@ import 'dart:async';import 'package:cached_network_image/cached_network_image.dart';import 'package:flutter/material.dart';+import '../l10n/app_localizations.dart';import '../providers/library_provider.dart';import '../services/audio_player_service.dart';+import '../services/sleep_timer_service.dart';+import 'adaptive_modal.dart';+import 'card_buttons.dart' show SimpleBookmarkSheet;+import 'sleep_timer_sheet.dart';class DesktopNowPlayingBar extends StatefulWidget {final AudioPlayerService player;final LibraryProvider library;- final VoidCallback onOpenFullPlayer;+ final VoidCallback onOpenNowPlaying;const DesktopNowPlayingBar({super.key,required this.player,required this.library,- required this.onOpenFullPlayer,+ required this.onOpenNowPlaying,});@override@@ -100,6 +105,7 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {if (!player.hasBook) return const SizedBox.shrink();final cs = Theme.of(context).colorScheme;+ final l = AppLocalizations.of(context)!;final title = player.currentTitle?.trim();final author = player.currentAuthor?.trim();final displayTitle = title == null || title.isEmpty@@ -109,6 +115,8 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {? 'Unknown author': author;final totalSeconds = _safeTotalSeconds(player.totalDuration);+ final hasChapters = player.chapters.isNotEmpty;+ final chapterTitle = player.currentChapter?['title'] as String?;return Material(color: cs.surfaceContainerLow,@@ -171,7 +179,8 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {mediaHeaders: widget.library.mediaHeaders,title: displayTitle,author: displayAuthor,- onTap: widget.onOpenFullPlayer,+ chapter: chapterTitle,+ onTap: widget.onOpenNowPlaying,),),const SizedBox(width: 16),@@ -181,6 +190,16 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {mainAxisSize: MainAxisSize.min,mainAxisAlignment: MainAxisAlignment.center,children: [+ if (hasChapters)+ Tooltip(+ message: l.previousChapterTooltip,+ child: IconButton(+ onPressed: player.hasActiveSession+ ? player.skipToPreviousChapter+ : null,+ icon: const Icon(Icons.skip_previous_rounded),+ ),+ ),_SkipButton(seconds: _backSkip,forward: false,@@ -228,6 +247,16 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {? () => player.skipForward(_forwardSkip): null,),+ if (hasChapters)+ Tooltip(+ message: l.nextChapterTooltip,+ child: IconButton(+ onPressed: player.hasActiveSession+ ? player.skipToNextChapter+ : null,+ icon: const Icon(Icons.skip_next_rounded),+ ),+ ),],),),@@ -237,6 +266,24 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {child: Row(mainAxisAlignment: MainAxisAlignment.end,children: [+ Tooltip(+ message: l.bookmarks,+ child: IconButton(+ onPressed: player.currentItemId == null+ ? null+ : _openBookmarks,+ icon: Icon(+ Icons.bookmark_border_rounded,+ size: 20,+ color: cs.onSurfaceVariant,+ ),+ ),+ ),+ _SleepTimerButton(+ onPressed: () =>+ showSleepTimerSheet(context, cs.primary),+ ),+ const SizedBox(width: 8),_SpeedControl(speed: player.speed,presets: _speedPresets,@@ -293,6 +340,28 @@ class _DesktopNowPlayingBarState extends State<DesktopNowPlayingBar> {);}+ void _openBookmarks() {+ final itemId = widget.player.currentItemId;+ if (itemId == null) return;+ final accent = Theme.of(context).colorScheme.primary;+ showAdaptiveSheetDialog(+ context: context,+ widthClass: DialogWidthClass.action,+ initialChildSize: 0.6,+ minChildSize: 0.05,+ maxChildSize: 0.9,+ snap: true,+ backgroundColor: Colors.transparent,+ builder: (ctx, sc) => SimpleBookmarkSheet(+ itemId: itemId,+ player: widget.player,+ accent: accent,+ scrollController: sc,+ onChanged: () {},+ ),+ );+ }+String? _coverUrl() {final itemId = widget.player.currentItemId;final providerUrl = widget.library.getCoverUrl(itemId, width: 160);@@ -410,6 +479,7 @@ class _NowPlayingIdentity extends StatelessWidget {final Map<String, String> mediaHeaders;final String title;final String author;+ final String? chapter;final VoidCallback onTap;const _NowPlayingIdentity({@@ -417,6 +487,7 @@ class _NowPlayingIdentity extends StatelessWidget {required this.mediaHeaders,required this.title,required this.author,+ this.chapter,required this.onTap,});@@ -424,6 +495,10 @@ class _NowPlayingIdentity extends StatelessWidget {Widget build(BuildContext context) {final cs = Theme.of(context).colorScheme;final tt = Theme.of(context).textTheme;+ final l = AppLocalizations.of(context)!;+ final subtitle = chapter == null || chapter!.isEmpty+ ? author+ : '$author · $chapter';final placeholder = ColoredBox(color: cs.surfaceContainerHighest,child: Icon(@@ -434,9 +509,9 @@ class _NowPlayingIdentity extends StatelessWidget {return Semantics(button: true,- label: 'Open full-screen player for $title',+ label: '${l.openNowPlayingTooltip}: $title',child: Tooltip(- message: 'Open full-screen player',+ message: l.openNowPlayingTooltip,child: InkWell(onTap: onTap,borderRadius: BorderRadius.circular(10),@@ -475,7 +550,7 @@ class _NowPlayingIdentity extends StatelessWidget {),const SizedBox(height: 2),Text(- author,+ subtitle,maxLines: 1,overflow: TextOverflow.ellipsis,style: tt.bodySmall?.copyWith(@@ -606,6 +681,49 @@ class _SpeedControl extends StatelessWidget {}}+class _SleepTimerButton extends StatelessWidget {+ final VoidCallback onPressed;++ const _SleepTimerButton({required this.onPressed});++ @override+ Widget build(BuildContext context) {+ final cs = Theme.of(context).colorScheme;+ final l = AppLocalizations.of(context)!;+ final service = SleepTimerService();+ return ListenableBuilder(+ listenable: service,+ builder: (context, _) {+ final active = service.isActive;+ return Tooltip(+ message: l.sleepTimer,+ child: active+ ? TextButton.icon(+ onPressed: onPressed,+ icon: Icon(Icons.bedtime_rounded, size: 18, color: cs.primary),+ label: Text(+ service.displayLabel,+ style: TextStyle(+ color: cs.primary,+ fontSize: 12,+ fontWeight: FontWeight.w700,+ ),+ ),+ )+ : IconButton(+ onPressed: onPressed,+ icon: Icon(+ Icons.bedtime_outlined,+ size: 20,+ color: cs.onSurfaceVariant,+ ),+ ),+ );+ },+ );+ }+}+String _formatTime(double seconds) {final duration = Duration(seconds: seconds.isFinite ? seconds.round() : 0);final hours = duration.inHours;diff --git a/lib/widgets/desktop_page_body.dart b/lib/widgets/desktop_page_body.dartnew file mode 100644index 00000000..9597393b--- /dev/null+++ b/lib/widgets/desktop_page_body.dart@@ -0,0 +1,22 @@+import 'package:flutter/material.dart';+import '../utils/desktop_workspace.dart';++/// Centers a pushed page's content in a readable column on the desktop+/// workspace; returns the child untouched everywhere else.+class DesktopPageBody extends StatelessWidget {+ final Widget child;+ final double maxWidth;++ const DesktopPageBody({super.key, required this.child, this.maxWidth = 840});++ @override+ Widget build(BuildContext context) {+ if (!isDesktopWorkspace(context)) return child;+ return Center(+ child: ConstrainedBox(+ constraints: BoxConstraints(maxWidth: maxWidth),+ child: child,+ ),+ );+ }+}diff --git a/lib/widgets/ebook_reader_view.dart b/lib/widgets/ebook_reader_view.dartindex 5fe17553..7bc870a1 100644--- a/lib/widgets/ebook_reader_view.dart+++ b/lib/widgets/ebook_reader_view.dart@@ -16,6 +16,7 @@ import '../services/progress_sync_service.dart';import '../services/reader_font_service.dart';import '../services/scoped_prefs.dart';import '../services/volume_key_service.dart';+import 'adaptive_modal.dart';import 'overlay_toast.dart';import 'card_buttons.dart' show CardSpeedSheet;@@ -889,12 +890,13 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObsvoid _showChapterList() {final cs = Theme.of(context).colorScheme;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: cs.surface,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20)),),+ desktopScrollWrap: false,builder: (ctx) => SafeArea(child: Column(mainAxisSize: MainAxisSize.min,@@ -933,13 +935,14 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObs// Live preview for the side-margin slider so the WebView only re-paginates// when the drag ends, not on every step.int hPreview = _marginH;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: cs.surface,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20)),),isScrollControlled: true,+ desktopScrollWrap: false,builder: (ctx) => StatefulBuilder(builder: (ctx, setSheetState) {final l = AppLocalizations.of(ctx)!;@@ -1192,13 +1195,14 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObsfinal tt = Theme.of(context).textTheme;final svc = ReaderFontService();await svc.load();- await showModalBottomSheet(+ await showAdaptiveActionMenu(context: context,backgroundColor: cs.surface,isScrollControlled: true,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20)),),+ desktopScrollWrap: false,builder: (ctx) => SafeArea(child: ListenableBuilder(listenable: svc,@@ -1551,13 +1555,14 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObsfinal highlights = _annotations.where((a) => a.type == AnnotationType.highlight).toList();final bookmarks = _annotations.where((a) => a.type == AnnotationType.bookmark).toList();- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: cs.surface,isScrollControlled: true,shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20)),),+ desktopScrollWrap: false,builder: (ctx) => DraggableScrollableSheet(expand: false,initialChildSize: 0.6,@@ -1812,7 +1817,7 @@ class EbookReaderViewState extends State<EbookReaderView> with WidgetsBindingObsminimumSize: const Size(0, 36),tapTargetSize: MaterialTapTargetSize.shrinkWrap,),- onPressed: () => showModalBottomSheet(+ onPressed: () => showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).colorScheme.surface,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/edit_author_sheet.dart b/lib/widgets/edit_author_sheet.dartindex 4db640b3..19bbe124 100644--- a/lib/widgets/edit_author_sheet.dart+++ b/lib/widgets/edit_author_sheet.dart@@ -4,6 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../providers/library_provider.dart';+import 'adaptive_modal.dart';import 'overlay_toast.dart';/// Opens a full-screen editor for an author (root admin only).@@ -26,27 +27,24 @@ void showEditAuthorSheet(required VoidCallback onUpdated,required void Function(String mergedIntoId, String mergedIntoName) onMerged,}) {- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,- builder: (ctx) => DraggableScrollableSheet(- expand: false,- initialChildSize: 0.85,- minChildSize: 0.3,- maxChildSize: 0.95,- snap: true,- builder: (ctx, sc) => _EditAuthorContent(- authorId: authorId,- currentName: currentName,- currentDescription: currentDescription,- currentAsin: currentAsin,- currentImageUrl: currentImageUrl,- scrollController: sc,- onUpdated: onUpdated,- onMerged: onMerged,- ),+ expand: false,+ initialChildSize: 0.85,+ minChildSize: 0.3,+ maxChildSize: 0.95,+ snap: true,+ builder: (ctx, sc) => _EditAuthorContent(+ authorId: authorId,+ currentName: currentName,+ currentDescription: currentDescription,+ currentAsin: currentAsin,+ currentImageUrl: currentImageUrl,+ scrollController: sc,+ onUpdated: onUpdated,+ onMerged: onMerged,),);}diff --git a/lib/widgets/episode_detail_sheet.dart b/lib/widgets/episode_detail_sheet.dartindex a084087b..babb3d63 100644--- a/lib/widgets/episode_detail_sheet.dart+++ b/lib/widgets/episode_detail_sheet.dart@@ -16,6 +16,7 @@ import 'html_description.dart';import 'overlay_toast.dart';import 'playlist_picker_sheet.dart';import 'action_pill.dart';+import 'adaptive_modal.dart';import '../main.dart' show rootNavigatorKey;import 'stackable_sheet.dart';import 'episode_list_sheet.dart';@@ -761,7 +762,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {void _showMoreSheet(BuildContext context, LibraryProvider lib, String dlKey, double progress, bool isFinished) {final cs = Theme.of(context).colorScheme;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dartindex 9233bf8d..6182676a 100644--- a/lib/widgets/episode_list_sheet.dart+++ b/lib/widgets/episode_list_sheet.dart@@ -21,6 +21,7 @@ import 'html_description.dart';import 'stackable_sheet.dart';import 'episode_row.dart';import 'action_pill.dart';+import 'adaptive_modal.dart';export 'episode_detail_sheet.dart';/// Bottom sheet that shows a podcast's episode list.@@ -502,7 +503,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {void _showPodcastMoreSheet(ColorScheme cs, bool allDownloaded, int downloaded) {final l = AppLocalizations.of(context)!;final isAdmin = context.read<AuthProvider>().isAdmin;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(@@ -606,7 +607,7 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {'second': l.episodeListPositionSecond,'end': l.episodeListPositionEnd,};- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/equalizer_sheet.dart b/lib/widgets/equalizer_sheet.dartindex b02a2edc..6c79f777 100644--- a/lib/widgets/equalizer_sheet.dart+++ b/lib/widgets/equalizer_sheet.dart@@ -2,6 +2,7 @@ import 'dart:io' show Platform;import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../services/equalizer_service.dart';+import 'adaptive_modal.dart';/// Show the equalizer & audio enhancements bottom sheet.///@@ -9,22 +10,20 @@ import '../services/equalizer_service.dart';/// in per-book EQ mode, the sheet uses them to show whether the displayed/// EQ belongs to that card's book or to whatever is currently playing.void showEqualizerSheet(BuildContext context, Color accent, {String? itemId, String? itemTitle}) {- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,+ widthClass: DialogWidthClass.action,useSafeArea: true,backgroundColor: Colors.transparent,- builder: (ctx) => DraggableScrollableSheet(- expand: false,- initialChildSize: 0.75,- minChildSize: 0.05, snap: true,- maxChildSize: 0.92,- builder: (ctx, sc) => _EqualizerSheetContent(- accent: accent,- scrollController: sc,- openedForItemId: itemId,- openedForItemTitle: itemTitle,- ),+ expand: false,+ initialChildSize: 0.75,+ minChildSize: 0.05, snap: true,+ maxChildSize: 0.92,+ builder: (ctx, sc) => _EqualizerSheetContent(+ accent: accent,+ scrollController: sc,+ openedForItemId: itemId,+ openedForItemTitle: itemTitle,),);}diff --git a/lib/widgets/home_customize_sheet.dart b/lib/widgets/home_customize_sheet.dartindex 2cce0578..2b9fd6dd 100644--- a/lib/widgets/home_customize_sheet.dart+++ b/lib/widgets/home_customize_sheet.dart@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/auth_provider.dart';import '../providers/library_provider.dart';+import 'adaptive_modal.dart';import 'section_labels.dart';class HomeCustomizeSheet extends StatefulWidget {@@ -12,32 +13,24 @@ class HomeCustomizeSheet extends StatefulWidget {const HomeCustomizeSheet({super.key, this.scrollController});static void show(BuildContext context) {- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,- builder: (context) {+ expand: true,+ initialChildSize: 0.6,+ minChildSize: 0.3,+ maxChildSize: 0.85,+ builder: (context, scrollController) {return GestureDetector(- onTap: () => Navigator.pop(context),- behavior: HitTestBehavior.opaque,- child: DraggableScrollableSheet(- initialChildSize: 0.6,- minChildSize: 0.3,- maxChildSize: 0.85,- builder: (context, scrollController) {- return GestureDetector(- onTap: () {}, // absorb taps on the sheet itself- child: Container(- decoration: BoxDecoration(- color: Theme.of(context).bottomSheetTheme.backgroundColor ??- Theme.of(context).colorScheme.surface,- borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),- ),- child: HomeCustomizeSheet(scrollController: scrollController),- ),- );- },+ onTap: () {}, // absorb taps on the sheet itself+ child: Container(+ decoration: BoxDecoration(+ color: Theme.of(context).bottomSheetTheme.backgroundColor ??+ Theme.of(context).colorScheme.surface,+ borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),+ ),+ child: HomeCustomizeSheet(scrollController: scrollController),),);},@@ -111,67 +104,62 @@ class _HomeCustomizeSheetState extends State<HomeCustomizeSheet> {if (!context.mounted) return;final l = AppLocalizations.of(context)!;- await showModalBottomSheet(+ await showAdaptiveSheetDialog(context: context,- isScrollControlled: true,+ widthClass: DialogWidthClass.action,useSafeArea: true,backgroundColor: cs.surface,- shape: const RoundedRectangleBorder(- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),- ),- builder: (ctx) => DraggableScrollableSheet(- initialChildSize: 0.5,- minChildSize: 0.3,- maxChildSize: 0.85,- expand: false,- builder: (ctx, sc) => Column(children: [- const SizedBox(height: 8),- Center(child: Container(- width: 40, height: 4,- decoration: BoxDecoration(- color: cs.onSurface.withValues(alpha: 0.24),- borderRadius: BorderRadius.circular(2),- ),- )),- const SizedBox(height: 16),- Text(l.homeCustomizeAddGenreTitle, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),- const SizedBox(height: 4),- Text(l.homeCustomizeAddGenreSubtitle,- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),- const SizedBox(height: 12),- Divider(height: 1, color: cs.outlineVariant.withValues(alpha: 0.3), indent: 20, endIndent: 20),- Expanded(- child: genres.isEmpty- ? ListView(controller: sc, children: [- const SizedBox(height: 60),- Center(child: Text(l.noGenresFound, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant))),- ])- : ListView.builder(- controller: sc,- padding: EdgeInsets.only(top: 8, bottom: MediaQuery.of(ctx).padding.bottom + 8),- itemCount: genres.length,- itemBuilder: (ctx, i) {- final genre = genres[i];- final added = alreadyAdded.contains(genre);- return ListTile(- dense: true,- leading: Icon(Icons.label_outline_rounded, size: 18, color: cs.onSurfaceVariant),- title: Text(genre, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),- trailing: added- ? Icon(Icons.check_rounded, size: 18, color: cs.primary)- : null,- onTap: added ? null : () async {- await lib.addGenreSection(genre);- _initialized = false; // force re-init to pick up the new section- if (ctx.mounted) Navigator.pop(ctx);- if (mounted) setState(() {});- },- );- },- ),+ initialChildSize: 0.5,+ minChildSize: 0.3,+ maxChildSize: 0.85,+ expand: false,+ builder: (ctx, sc) => Column(children: [+ const SizedBox(height: 8),+ Center(child: Container(+ width: 40, height: 4,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.24),+ borderRadius: BorderRadius.circular(2),),- ]),- ),+ )),+ const SizedBox(height: 16),+ Text(l.homeCustomizeAddGenreTitle, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),+ const SizedBox(height: 4),+ Text(l.homeCustomizeAddGenreSubtitle,+ style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),+ const SizedBox(height: 12),+ Divider(height: 1, color: cs.outlineVariant.withValues(alpha: 0.3), indent: 20, endIndent: 20),+ Expanded(+ child: genres.isEmpty+ ? ListView(controller: sc, children: [+ const SizedBox(height: 60),+ Center(child: Text(l.noGenresFound, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant))),+ ])+ : ListView.builder(+ controller: sc,+ padding: EdgeInsets.only(top: 8, bottom: MediaQuery.of(ctx).padding.bottom + 8),+ itemCount: genres.length,+ itemBuilder: (ctx, i) {+ final genre = genres[i];+ final added = alreadyAdded.contains(genre);+ return ListTile(+ dense: true,+ leading: Icon(Icons.label_outline_rounded, size: 18, color: cs.onSurfaceVariant),+ title: Text(genre, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),+ trailing: added+ ? Icon(Icons.check_rounded, size: 18, color: cs.primary)+ : null,+ onTap: added ? null : () async {+ await lib.addGenreSection(genre);+ _initialized = false; // force re-init to pick up the new section+ if (ctx.mounted) Navigator.pop(ctx);+ if (mounted) setState(() {});+ },+ );+ },+ ),+ ),+ ]),);}diff --git a/lib/widgets/home_section.dart b/lib/widgets/home_section.dartindex c7e85ee4..4469b544 100644--- a/lib/widgets/home_section.dart+++ b/lib/widgets/home_section.dart@@ -7,8 +7,10 @@ import '../services/download_service.dart';import 'absorbing_shared.dart';import 'book_card.dart';import 'author_card.dart';+import 'hover_cover_actions.dart';import 'series_card.dart';import 'episode_list_sheet.dart';+import '../utils/desktop_workspace.dart';class HomeSection extends StatelessWidget {final String title;@@ -58,10 +60,12 @@ class HomeSection extends StatelessWidget {final effectiveEpisode = isEpisodeSection || hasEpisodeEntities;final bool isRectCover = coverAspectRatio < 1.0;+ final desktop = isDesktopWorkspace(context);+ final scale = desktop ? 1.2 : 1.0;final double cardWidth =- isContinueListening ? 300 : (isAuthorSection ? 120 : 140);+ (isContinueListening ? 300 : (isAuthorSection ? 120 : 140)) * scale;final double cardHeight =- isContinueListening ? 120 : effectiveEpisode ? 200 : (isAuthorSection ? 170 : (isRectCover ? 260 : 200));+ (isContinueListening ? 120 : effectiveEpisode ? 200 : (isAuthorSection ? 170 : (isRectCover ? 260 : 200))) * scale;return Padding(padding: const EdgeInsets.only(top: 24),@@ -107,8 +111,9 @@ class HomeSection extends StatelessWidget {// Snap-scrolling horizontal listSizedBox(height: cardHeight,- child: _SnapScrollList(+ child: SnapScrollList(cardWidth: cardWidth,+ desktop: desktop,itemCount: entities.length,itemBuilder: (context, index) {var entity = entities[index];@@ -142,7 +147,7 @@ class HomeSection extends StatelessWidget {);}- // Podcast episode sections — show cover with episode title overlay+ // Podcast episode sections - show cover with episode title overlayif (isEpisodeSection && entity is Map<String, dynamic>) {return SizedBox(width: cardWidth,@@ -200,29 +205,39 @@ class HomeSection extends StatelessWidget {}}-/// A horizontal scrolling list with smooth snap-to-card behavior.-class _SnapScrollList extends StatefulWidget {+/// A horizontal scrolling list with smooth snap-to-card behavior. On the+/// desktop workspace it adds hover paging arrows and clamping physics.+class SnapScrollList extends StatefulWidget {final double cardWidth;+ final bool desktop;final int itemCount;final Widget Function(BuildContext, int) itemBuilder;- const _SnapScrollList({+ const SnapScrollList({+ super.key,required this.cardWidth,+ this.desktop = false,required this.itemCount,required this.itemBuilder,});@override- State<_SnapScrollList> createState() => _SnapScrollListState();+ State<SnapScrollList> createState() => SnapScrollListState();}-class _SnapScrollListState extends State<_SnapScrollList> {+class SnapScrollListState extends State<SnapScrollList> {late final ScrollController _controller;+ bool _hovering = false;+ bool _canPageBack = false;+ bool _canPageForward = false;++ double get _itemExtent => widget.cardWidth + 12;@overridevoid initState() {super.initState();_controller = ScrollController();+ _controller.addListener(_updateArrows);}@override@@ -231,11 +246,83 @@ class _SnapScrollListState extends State<_SnapScrollList> {super.dispose();}+ void _updateArrows() {+ if (!widget.desktop || !_controller.hasClients) return;+ final canBack = _controller.offset > 1;+ final canForward =+ _controller.offset < _controller.position.maxScrollExtent - 1;+ if (canBack != _canPageBack || canForward != _canPageForward) {+ setState(() {+ _canPageBack = canBack;+ _canPageForward = canForward;+ });+ }+ }++ void _page(int direction) {+ if (!_controller.hasClients) return;+ final viewport = _controller.position.viewportDimension;+ final cardsPerPage = (viewport ~/ _itemExtent).clamp(1, 50);+ final step = cardsPerPage * _itemExtent;+ final raw = _controller.offset + direction * step;+ final maxExtent = _controller.position.maxScrollExtent;+ var target = ((raw / _itemExtent).round() * _itemExtent)+ .clamp(0.0, maxExtent);+ if (target > maxExtent - _itemExtent) {+ target = direction > 0 ? maxExtent : target;+ }+ _controller.animateTo(+ target,+ duration: const Duration(milliseconds: 300),+ curve: Curves.easeOutCubic,+ );+ }++ Widget _arrow({required bool forward}) {+ final cs = Theme.of(context).colorScheme;+ final visible =+ _hovering && (forward ? _canPageForward : _canPageBack);+ return Positioned(+ left: forward ? null : 4,+ right: forward ? 4 : null,+ top: 0,+ bottom: 0,+ child: Center(+ child: AnimatedOpacity(+ opacity: visible ? 1 : 0,+ duration: const Duration(milliseconds: 120),+ child: IgnorePointer(+ ignoring: !visible,+ child: Material(+ color: cs.surfaceContainerHighest.withValues(alpha: 0.9),+ shape: const CircleBorder(),+ elevation: 2,+ clipBehavior: Clip.antiAlias,+ child: InkWell(+ onTap: () => _page(forward ? 1 : -1),+ child: Padding(+ padding: const EdgeInsets.all(8),+ child: Icon(+ forward+ ? Icons.chevron_right_rounded+ : Icons.chevron_left_rounded,+ size: 24,+ color: cs.onSurface,+ ),+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }+@overrideWidget build(BuildContext context) {- final itemExtent = widget.cardWidth + 12;+ final itemExtent = _itemExtent;- return NotificationListener<ScrollEndNotification>(+ final list = NotificationListener<ScrollEndNotification>(onNotification: (notification) {final maxExtent = _controller.position.maxScrollExtent;final offset = _controller.offset;@@ -271,12 +358,35 @@ class _SnapScrollListState extends State<_SnapScrollList> {controller: _controller,scrollDirection: Axis.horizontal,padding: const EdgeInsets.symmetric(horizontal: 20),- physics: const BouncingScrollPhysics(),+ physics: widget.desktop+ ? const ClampingScrollPhysics()+ : const BouncingScrollPhysics(),itemCount: widget.itemCount,separatorBuilder: (_, __) => const SizedBox(width: 12),itemBuilder: widget.itemBuilder,),);++ if (!widget.desktop) return list;+ // Arrow visibility depends on maxScrollExtent, which only exists after+ // the first layout; refresh once attached.+ if (!_controller.hasClients) {+ WidgetsBinding.instance.addPostFrameCallback((_) => _updateArrows());+ }+ return MouseRegion(+ onEnter: (_) {+ setState(() => _hovering = true);+ _updateArrows();+ },+ onExit: (_) => setState(() => _hovering = false),+ child: Stack(+ children: [+ list,+ _arrow(forward: false),+ _arrow(forward: true),+ ],+ ),+ );}}@@ -312,7 +422,16 @@ class _EpisodeCard extends StatelessWidget {final isFinished = episodeId != null && lib.getEpisodeProgressData(itemId, episodeId)?['isFinished'] == true;final isDownloaded = episodeId != null && DownloadService().isDownloaded('$itemId-$episodeId');- return GestureDetector(+ return HoverCoverActions(+ onMenu: episode == null+ ? null+ : () => EpisodeDetailSheet.showQuick(+ context,+ item,+ episode,+ sourcePlaylistId: sourcePlaylistId,+ ),+ child: GestureDetector(onTap: () {if (episode != null) {EpisodeDetailSheet.show(@@ -453,6 +572,7 @@ class _EpisodeCard extends StatelessWidget {),],),+ ),);}}diff --git a/lib/widgets/hover_cover_actions.dart b/lib/widgets/hover_cover_actions.dartnew file mode 100644index 00000000..aabeb931--- /dev/null+++ b/lib/widgets/hover_cover_actions.dart@@ -0,0 +1,146 @@+import 'package:flutter/material.dart';+import 'package:provider/provider.dart';+import '../l10n/app_localizations.dart';+import '../providers/auth_provider.dart';+import '../screens/book_edit_screen.dart';+import '../utils/desktop_workspace.dart';++/// Desktop hover overlay for book/episode covers: a 3-dot menu opening the+/// item's quick actions and, when permitted, an edit shortcut into the book+/// editor. Returns the child untouched off the desktop workspace, so mobile+/// tiles are unaffected.+class HoverCoverActions extends StatefulWidget {+ final Widget child;+ final VoidCallback? onMenu;++ /// Item id to open in the book editor; null hides the edit shortcut.+ /// Callers gate this on `auth.canUpdateMetadata && !lib.isOffline`.+ final String? editItemId;++ const HoverCoverActions({+ super.key,+ required this.child,+ this.onMenu,+ this.editItemId,+ });++ @override+ State<HoverCoverActions> createState() => _HoverCoverActionsState();+}++class _HoverCoverActionsState extends State<HoverCoverActions> {+ bool _hovering = false;+ bool _loadingEditor = false;++ Future<void> _openEditor() async {+ final itemId = widget.editItemId;+ if (itemId == null || _loadingEditor) return;+ final auth = context.read<AuthProvider>();+ final api = auth.apiService;+ if (api == null) return;+ setState(() => _loadingEditor = true);+ final item = await api.getLibraryItem(itemId);+ if (!mounted) return;+ setState(() => _loadingEditor = false);+ if (item == null) return;+ final media = item['media'] as Map<String, dynamic>? ?? {};+ final meta = media['metadata'] as Map<String, dynamic>? ?? {};+ final tags = ((media['tags'] as List<dynamic>?) ?? const []).cast<String>();+ final audioFiles = (media['audioFiles'] as List<dynamic>?) ?? const [];+ final libraryFiles = (item['libraryFiles'] as List<dynamic>?) ?? const [];+ contentNavigator(context).push(MaterialPageRoute(+ builder: (_) => BookEditScreen(+ itemId: itemId,+ bookTitle: meta['title'] as String? ?? '',+ metadata: meta,+ tags: tags,+ audioFiles: audioFiles,+ libraryFiles: libraryFiles,+ relPath: item['relPath'] as String? ?? '',+ isEbookOnly: audioFiles.isEmpty && media['ebookFile'] != null,+ isAdmin: auth.isAdmin,+ libraryId: item['libraryId'] as String?,+ ),+ ));+ }++ Widget _actionButton({+ required IconData icon,+ required String tooltip,+ required VoidCallback onTap,+ bool busy = false,+ }) {+ return Tooltip(+ message: tooltip,+ child: Material(+ color: Colors.black.withValues(alpha: 0.6),+ shape: const CircleBorder(),+ clipBehavior: Clip.antiAlias,+ child: InkWell(+ onTap: onTap,+ child: Padding(+ padding: const EdgeInsets.all(6),+ child: busy+ ? const SizedBox(+ width: 16,+ height: 16,+ child: CircularProgressIndicator(+ strokeWidth: 2, color: Colors.white),+ )+ : Icon(icon, size: 16, color: Colors.white),+ ),+ ),+ ),+ );+ }++ @override+ Widget build(BuildContext context) {+ if (!isDesktopWorkspace(context)) return widget.child;+ if (widget.onMenu == null && widget.editItemId == null) {+ return widget.child;+ }+ final l = AppLocalizations.of(context)!;+ return MouseRegion(+ onEnter: (_) => setState(() => _hovering = true),+ onExit: (_) => setState(() => _hovering = false),+ child: Stack(+ fit: StackFit.passthrough,+ children: [+ widget.child,+ Positioned(+ top: 4,+ right: 4,+ child: AnimatedOpacity(+ opacity: _hovering ? 1 : 0,+ duration: const Duration(milliseconds: 120),+ child: IgnorePointer(+ ignoring: !_hovering,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (widget.editItemId != null) ...[+ _actionButton(+ icon: Icons.edit_rounded,+ tooltip: l.edit,+ onTap: _openEditor,+ busy: _loadingEditor,+ ),+ const SizedBox(width: 4),+ ],+ if (widget.onMenu != null)+ _actionButton(+ icon: Icons.more_horiz_rounded,+ tooltip: l.moreActions,+ onTap: widget.onMenu!,+ ),+ ],+ ),+ ),+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/lib/widgets/library_authors_tab.dart b/lib/widgets/library_authors_tab.dartindex 8d6a2de9..39304531 100644--- a/lib/widgets/library_authors_tab.dart+++ b/lib/widgets/library_authors_tab.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';+import '../utils/desktop_workspace.dart';import 'library_grid_tiles.dart';class LibraryAuthorsTab extends StatelessWidget {@@ -72,7 +73,7 @@ class LibraryAuthorsTab extends StatelessWidget {slivers: [...headers,SliverPadding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding),+ padding: EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding(context)),sliver: SliverGrid(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: responsiveGridCount(context),@@ -90,6 +91,8 @@ class LibraryAuthorsTab extends StatelessWidget {);}- return RefreshIndicator(onRefresh: onRefresh, child: body);+ return isDesktopWorkspace(context)+ ? body+ : RefreshIndicator(onRefresh: onRefresh, child: body);}}diff --git a/lib/widgets/library_books_tab.dart b/lib/widgets/library_books_tab.dartindex 6f1661ac..810965c8 100644--- a/lib/widgets/library_books_tab.dart+++ b/lib/widgets/library_books_tab.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';+import '../utils/desktop_workspace.dart';import 'library_grid_tiles.dart';class LibraryBooksTab extends StatelessWidget {@@ -140,7 +141,7 @@ class LibraryBooksTab extends StatelessWidget {slivers: [...headers,SliverPadding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding),+ padding: EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding(context)),sliver: SliverGrid(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: responsiveGridCount(context),@@ -194,7 +195,9 @@ class LibraryBooksTab extends StatelessWidget {}return false;},- child: RefreshIndicator(onRefresh: onRefresh, child: body),+ child: isDesktopWorkspace(context)+ ? body+ : RefreshIndicator(onRefresh: onRefresh, child: body),);}}diff --git a/lib/widgets/library_grid_tiles.dart b/lib/widgets/library_grid_tiles.dartindex 047ff39b..444bd9df 100644--- a/lib/widgets/library_grid_tiles.dart+++ b/lib/widgets/library_grid_tiles.dart@@ -11,6 +11,7 @@ import '../services/download_service.dart';import 'absorbing_shared.dart';import 'book_detail_sheet.dart';import 'episode_list_sheet.dart';+import 'hover_cover_actions.dart';import 'series_books_sheet.dart';import 'author_books_sheet.dart';@@ -68,7 +69,16 @@ class _GridBookTileState extends State<GridBookTile> {final unfinishedCount =lib.isPodcastLibrary ? lib.getUnfinishedEpisodeCount(widget.item) : 0;- return GestureDetector(+ final canEdit = itemId.isNotEmpty &&+ !lib.isPodcastLibrary &&+ !lib.isOffline &&+ context.watch<AuthProvider>().canUpdateMetadata;+ return HoverCoverActions(+ onMenu: (itemId.isNotEmpty && !lib.isPodcastLibrary)+ ? () => showQuickActionsSheet(context, itemId, initialItem: widget.item)+ : null,+ editItemId: canEdit ? itemId : null,+ child: GestureDetector(// opaque so taps on the blank space below the title (the tile's tall// aspect ratio leaves a gap when the Column children stop short)// still trigger the onTap. Without this, taps in that blank strip@@ -224,6 +234,7 @@ class _GridBookTileState extends State<GridBookTile> {),],),+ ),);}diff --git a/lib/widgets/library_lists_tab.dart b/lib/widgets/library_lists_tab.dartindex 484e62d1..8095a24f 100644--- a/lib/widgets/library_lists_tab.dart+++ b/lib/widgets/library_lists_tab.dart@@ -1,5 +1,6 @@import 'package:flutter/material.dart';import '../screens/library_screen.dart';+import '../utils/desktop_workspace.dart';import 'library_grid_tiles.dart';/// Library "Lists" tab: a stacked-cover grid of all collections and playlists@@ -89,7 +90,7 @@ class LibraryListsTab extends StatelessWidget {slivers: [...headers,SliverPadding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding),+ padding: EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding(context)),sliver: SliverGrid(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: responsiveGridCount(context),@@ -126,6 +127,8 @@ class LibraryListsTab extends StatelessWidget {);}- return RefreshIndicator(onRefresh: onRefresh, child: body);+ return isDesktopWorkspace(context)+ ? body+ : RefreshIndicator(onRefresh: onRefresh, child: body);}}diff --git a/lib/widgets/library_narrators_tab.dart b/lib/widgets/library_narrators_tab.dartindex 80dc7a57..1643ebcf 100644--- a/lib/widgets/library_narrators_tab.dart+++ b/lib/widgets/library_narrators_tab.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';+import '../utils/desktop_workspace.dart';import 'narrator_books_sheet.dart';class LibraryNarratorsTab extends StatelessWidget {@@ -72,7 +73,7 @@ class LibraryNarratorsTab extends StatelessWidget {slivers: [...headers,SliverPadding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding),+ padding: EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding(context)),sliver: SliverList.separated(itemCount: narrators.length,separatorBuilder: (_, __) => Divider(@@ -116,6 +117,8 @@ class LibraryNarratorsTab extends StatelessWidget {);}- return RefreshIndicator(onRefresh: onRefresh, child: body);+ return isDesktopWorkspace(context)+ ? body+ : RefreshIndicator(onRefresh: onRefresh, child: body);}}diff --git a/lib/widgets/library_picker_sheet.dart b/lib/widgets/library_picker_sheet.dartindex a63bf8c7..cbdf73df 100644--- a/lib/widgets/library_picker_sheet.dart+++ b/lib/widgets/library_picker_sheet.dart@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../providers/library_provider.dart';import '../services/player_settings.dart';+import 'adaptive_modal.dart';/// Bottom-sheet library switcher shared by the Home/Library headers and the/// bottom-nav long-press. When the dedicated Podcasts tab is enabled, its@@ -25,35 +26,44 @@ Future<void> showLibraryPickerSheet(.where((library) => library['id'] != excludeLibraryId).toList();- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,+ desktopScrollWrap: false,builder: (ctx) {+ final desktop = ModalSurface.isDesktopOf(ctx);final bottomPad = MediaQuery.of(ctx).viewPadding.bottom;return Container(- constraints: BoxConstraints(- maxHeight: MediaQuery.of(ctx).size.height * 0.6,- ),- decoration: BoxDecoration(- color: cs.surface,- borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),- ),+ constraints: desktop+ ? null+ : BoxConstraints(+ maxHeight: MediaQuery.of(ctx).size.height * 0.6,+ ),+ decoration: desktop+ ? null+ : BoxDecoration(+ color: cs.surface,+ borderRadius:+ const BorderRadius.vertical(top: Radius.circular(24)),+ ),child: Column(mainAxisSize: MainAxisSize.min,children: [- const SizedBox(height: 12),- Center(- child: Container(- width: 40,- height: 4,- decoration: BoxDecoration(- color: cs.onSurfaceVariant.withValues(alpha: 0.3),- borderRadius: BorderRadius.circular(2),+ if (!desktop) ...[+ const SizedBox(height: 12),+ Center(+ child: Container(+ width: 40,+ height: 4,+ decoration: BoxDecoration(+ color: cs.onSurfaceVariant.withValues(alpha: 0.3),+ borderRadius: BorderRadius.circular(2),+ ),),),- ),+ ],const SizedBox(height: 16),Padding(padding: const EdgeInsets.symmetric(horizontal: 24),diff --git a/lib/widgets/library_series_tab.dart b/lib/widgets/library_series_tab.dartindex f8d2db40..e7eb3343 100644--- a/lib/widgets/library_series_tab.dart+++ b/lib/widgets/library_series_tab.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';+import '../utils/desktop_workspace.dart';import 'library_grid_tiles.dart';class LibrarySeriesTab extends StatelessWidget {@@ -78,7 +79,7 @@ class LibrarySeriesTab extends StatelessWidget {slivers: [...headers,SliverPadding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding),+ padding: EdgeInsets.fromLTRB(16, 8, 16, libraryGridBottomPadding(context)),sliver: SliverGrid(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: responsiveGridCount(context),@@ -127,7 +128,9 @@ class LibrarySeriesTab extends StatelessWidget {}return false;},- child: RefreshIndicator(onRefresh: onRefresh, child: body),+ child: isDesktopWorkspace(context)+ ? body+ : RefreshIndicator(onRefresh: onRefresh, child: body),);}}diff --git a/lib/widgets/library_sort_filter_sheet.dart b/lib/widgets/library_sort_filter_sheet.dartindex a41a9167..83832900 100644--- a/lib/widgets/library_sort_filter_sheet.dart+++ b/lib/widgets/library_sort_filter_sheet.dart@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';import '../utils/app_platform.dart';+import 'adaptive_modal.dart';/// Which library tab the sort/filter sheet is being shown for.enum LibraryTab { library, series, authors, narrators, lists }@@ -171,12 +172,19 @@ class _SortFilterSheetState extends State<SortFilterSheet> with SingleTickerProvchild: Text(l.sort, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: cs.primary)),),- SizedBox(- height: _calcHeight(),- child: _tabCtrl.length > 1- ? TabBarView(controller: _tabCtrl, children: _buildViews(cs, l))- : _buildSortTab(cs, l),- ),+ if (ModalSurface.isDesktopOf(context))+ Flexible(+ child: _tabCtrl.length > 1+ ? TabBarView(controller: _tabCtrl, children: _buildViews(cs, l))+ : _buildSortTab(cs, l),+ )+ else+ SizedBox(+ height: _calcHeight(),+ child: _tabCtrl.length > 1+ ? TabBarView(controller: _tabCtrl, children: _buildViews(cs, l))+ : _buildSortTab(cs, l),+ ),SizedBox(height: MediaQuery.of(context).viewPadding.bottom + 8),],),diff --git a/lib/widgets/notes_sheet.dart b/lib/widgets/notes_sheet.dartindex 83d3cfa5..7e81e628 100644--- a/lib/widgets/notes_sheet.dart+++ b/lib/widgets/notes_sheet.dart@@ -6,6 +6,7 @@ import 'package:share_plus/share_plus.dart';import 'package:url_launcher/url_launcher.dart';import '../l10n/app_localizations.dart';import '../services/notes_service.dart';+import 'adaptive_modal.dart';/// Bottom sheet displaying notes for a library item.class NotesSheet extends StatefulWidget {@@ -27,23 +28,20 @@ class NotesSheet extends StatefulWidget {required String itemTitle,required Color accent,}) {- showModalBottomSheet(+ showAdaptiveSheetDialog(context: context,- isScrollControlled: true,useSafeArea: true,backgroundColor: Colors.transparent,- builder: (_) => DraggableScrollableSheet(- initialChildSize: 0.75,- minChildSize: 0.05,- snap: true,- maxChildSize: 0.95,- expand: false,- builder: (_, scrollController) => NotesSheet(- itemId: itemId,- itemTitle: itemTitle,- accent: accent,- scrollController: scrollController,- ),+ initialChildSize: 0.75,+ minChildSize: 0.05,+ snap: true,+ maxChildSize: 0.95,+ expand: false,+ builder: (_, scrollController) => NotesSheet(+ itemId: itemId,+ itemTitle: itemTitle,+ accent: accent,+ scrollController: scrollController,),);}@@ -104,7 +102,7 @@ class _NotesSheetState extends State<NotesSheet> {Future<void> _exportNotes(BuildContext context) async {final cs = Theme.of(context).colorScheme;final l = AppLocalizations.of(context)!;- final format = await showModalBottomSheet<String>(+ final format = await showAdaptiveActionMenu<String>(context: context,backgroundColor: Colors.transparent,builder: (ctx) => Container(@@ -169,7 +167,7 @@ class _NotesSheetState extends State<NotesSheet> {}Future<_NoteEditResult?> _showEditor(BuildContext context, {String title = '', String body = ''}) {- return showModalBottomSheet<_NoteEditResult>(+ return showAdaptiveActionMenu<_NoteEditResult>(context: context,isScrollControlled: true,useSafeArea: true,diff --git a/lib/widgets/overlay_toast.dart b/lib/widgets/overlay_toast.dartindex 5ce7256a..9b26c72f 100644--- a/lib/widgets/overlay_toast.dart+++ b/lib/widgets/overlay_toast.dart@@ -95,36 +95,41 @@ class _AnimatedToastState extends State<_AnimatedToast>end: Offset.zero,).animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut)),child: Center(- child: ClipRRect(- borderRadius: BorderRadius.circular(24),- child: BackdropFilter(- filter: ui.ImageFilter.blur(sigmaX: 20, sigmaY: 20),- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),- decoration: BoxDecoration(- color: cs.surface.withValues(alpha: 0.7),- borderRadius: BorderRadius.circular(24),- border: Border.all(color: cs.primary.withValues(alpha: 0.25)),- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- if (widget.icon != null) ...[- Icon(widget.icon, size: 18, color: cs.primary),- const SizedBox(width: 8),- ],- Flexible(- child: Text(- widget.message,- style: TextStyle(- color: cs.onSurface,- fontSize: 13,- fontWeight: FontWeight.w500,- decoration: TextDecoration.none,+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 420),+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: BackdropFilter(+ filter: ui.ImageFilter.blur(sigmaX: 20, sigmaY: 20),+ child: Container(+ padding:+ const EdgeInsets.symmetric(horizontal: 16, vertical: 10),+ decoration: BoxDecoration(+ color: cs.surface.withValues(alpha: 0.7),+ borderRadius: BorderRadius.circular(24),+ border:+ Border.all(color: cs.primary.withValues(alpha: 0.25)),+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (widget.icon != null) ...[+ Icon(widget.icon, size: 18, color: cs.primary),+ const SizedBox(width: 8),+ ],+ Flexible(+ child: Text(+ widget.message,+ style: TextStyle(+ color: cs.onSurface,+ fontSize: 13,+ fontWeight: FontWeight.w500,+ decoration: TextDecoration.none,+ ),),),- ),- ],+ ],+ ),),),),diff --git a/lib/widgets/playlist_picker_sheet.dart b/lib/widgets/playlist_picker_sheet.dartindex c59c2042..882a2502 100644--- a/lib/widgets/playlist_picker_sheet.dart+++ b/lib/widgets/playlist_picker_sheet.dart@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';import 'package:provider/provider.dart';import '../l10n/app_localizations.dart';import '../providers/library_provider.dart';+import 'adaptive_modal.dart';import 'overlay_toast.dart';class PlaylistPickerSheet extends StatefulWidget {@@ -15,7 +16,7 @@ class PlaylistPickerSheet extends StatefulWidget {});static void show(BuildContext context, String libraryItemId, {String? episodeId}) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/rmab_config_sheet.dart b/lib/widgets/rmab_config_sheet.dartindex ef38d44c..ae01bc07 100644--- a/lib/widgets/rmab_config_sheet.dart+++ b/lib/widgets/rmab_config_sheet.dart@@ -9,6 +9,8 @@ import '../l10n/app_localizations.dart';import '../screens/admin_rmab_screen.dart';import '../services/rmab_service.dart';import '../services/scoped_prefs.dart';+import '../utils/desktop_workspace.dart';+import 'adaptive_modal.dart';import 'rmab_request_status_chip.dart';import 'stackable_sheet.dart';@@ -346,7 +348,11 @@ class _RmabConfigSheetState extends State<_RmabConfigSheet> {setState(() => _errorText = l.rmabConfigErrorInvalidUrl);return;}- Navigator.of(context).push(MaterialPageRoute(+ final nav = contentNavigator(context);+ if (isDesktopWorkspace(context)) {+ Navigator.of(context, rootNavigator: true).popUntil((r) => r.isFirst);+ }+ nav.push(MaterialPageRoute(builder: (_) => AdminRmabScreen(url: target),));}@@ -1001,7 +1007,7 @@ class _MyRequestsTabState extends State<_MyRequestsTab>}void _openRequestDetail(RmabRequest req) {- showModalBottomSheet<void>(+ showAdaptiveActionMenu<void>(context: context,isScrollControlled: true,showDragHandle: true,@@ -1009,6 +1015,7 @@ class _MyRequestsTabState extends State<_MyRequestsTab>shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(24)),),+ desktopWidth: 560,builder: (_) => _RequestDetailSheet(request: req),);}diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dartindex c00765a0..2e53218c 100644--- a/lib/widgets/series_books_sheet.dart+++ b/lib/widgets/series_books_sheet.dart@@ -17,6 +17,7 @@ import 'episode_list_sheet.dart';import 'stackable_sheet.dart';import 'audible_series_sheet.dart';import 'action_pill.dart';+import 'adaptive_modal.dart';import 'books_sheet_shared.dart';import '../services/api_service.dart';import '../utils/duration_format.dart';@@ -778,7 +779,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {void _showSeriesMoreSheet(ColorScheme cs, bool allDownloaded, int downloaded, bool allDone, bool hasSeriesId) {final l = AppLocalizations.of(context)!;- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,shape: const RoundedRectangleBorder(diff --git a/lib/widgets/sleep_timer_sheet.dart b/lib/widgets/sleep_timer_sheet.dartindex c94a4c8d..d0da4887 100644--- a/lib/widgets/sleep_timer_sheet.dart+++ b/lib/widgets/sleep_timer_sheet.dart@@ -2,10 +2,11 @@ import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../services/audio_player_service.dart';import '../services/sleep_timer_service.dart';+import 'adaptive_modal.dart';// ─── SHARED SLEEP TIMER SHEET ─────────────────────────────────void showSleepTimerSheet(BuildContext context, Color accent) {- showModalBottomSheet(+ showAdaptiveActionMenu(context: context,backgroundColor: Colors.transparent,isScrollControlled: true,diff --git a/lib/widgets/stackable_sheet.dart b/lib/widgets/stackable_sheet.dartindex 50cd80ad..e63a791c 100644--- a/lib/widgets/stackable_sheet.dart+++ b/lib/widgets/stackable_sheet.dart@@ -1,4 +1,6 @@import 'package:flutter/material.dart';+import '../utils/desktop_workspace.dart';+import 'adaptive_modal.dart';const int maxSheetDepth = 3;final List<Route<dynamic>> _activeSheetRoutes = [];@@ -8,6 +10,8 @@ final List<Route<dynamic>> _activeSheetRoutes = [];/// Drag to minimum size closes the current sheet only (revealing any sheet below)./// Back button / barrier tap also closes only the current sheet./// Stack is capped at [maxSheetDepth] - opening beyond that evicts the oldest sheet.+/// On the desktop workspace the sheet presents as a centered dialog instead;+/// the stack cap applies across both presentations.Future<T?> showStackableSheet<T>({required BuildContext context,required Widget Function(BuildContext, ScrollController) builder,@@ -17,6 +21,7 @@ Future<T?> showStackableSheet<T>({Color? backgroundColor,bool useSafeArea = false,bool showHandle = false,+ double desktopWidth = 720,}) {FocusManager.instance.primaryFocus?.unfocus();@@ -24,13 +29,24 @@ Future<T?> showStackableSheet<T>({if (_activeSheetRoutes.length >= maxSheetDepth) {final oldest = _activeSheetRoutes.first;try {- Navigator.of(context).removeRoute(oldest);+ Navigator.of(context, rootNavigator: true).removeRoute(oldest);} catch (_) {// Route may already be disposed (e.g. rapid navigation)_activeSheetRoutes.remove(oldest);}}+ if (isDesktopWorkspace(context)) {+ return showDesktopSheetDialog<T>(+ context: context,+ builder: builder,+ maxWidth: desktopWidth,+ backgroundColor: backgroundColor,+ onRouteCaptured: _activeSheetRoutes.add,+ onRouteDisposed: _activeSheetRoutes.remove,+ );+ }+return showModalBottomSheet<T>(context: context,isScrollControlled: true,diff --git a/lib/widgets/tips_sheet.dart b/lib/widgets/tips_sheet.dartindex ecef7000..a091a5a5 100644--- a/lib/widgets/tips_sheet.dart+++ b/lib/widgets/tips_sheet.dart@@ -2,18 +2,18 @@ import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../services/wording.dart';import '../utils/app_platform.dart';+import 'adaptive_modal.dart';void showTipsSheet(BuildContext context) {final cs = Theme.of(context).colorScheme;final tt = Theme.of(context).textTheme;final l = AppLocalizations.of(context)!;final w = Wording.of(context);- showModalBottomSheet(- context: context, isScrollControlled: true, useSafeArea: true,+ showAdaptiveSheetDialog(+ context: context, useSafeArea: true,backgroundColor: Colors.transparent,- builder: (ctx) => DraggableScrollableSheet(- expand: false, initialChildSize: 0.75, minChildSize: 0.05, maxChildSize: 0.95,- builder: (_, sc) => Container(+ expand: false, initialChildSize: 0.75, minChildSize: 0.05, maxChildSize: 0.95,+ builder: (_, sc) => Container(decoration: BoxDecoration(color: cs.surface,borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),@@ -139,7 +139,6 @@ void showTipsSheet(BuildContext context) {],),),- ),);}