A cross platform Audiobookshelf client for Android and iOS
Dart
Move the series and podcast episode menus to the grid, add episode long-press
Barnabas8426270ecabb
diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dartindex 61785d48..d4359b90 100644--- a/lib/screens/home_screen.dart+++ b/lib/screens/home_screen.dart@@ -858,10 +858,13 @@ class _ContinueListeningCardState extends State<_ContinueListeningCard> {}}- // Long-press opens the quick-actions sheet for books; podcasts keep the- // existing open-details behaviour (quick actions are book-only for now).+ // Long-press opens the quick-actions sheet: book quick sheet for books,+ // episode quick sheet for a podcast episode. A bare podcast show falls back+ // to opening details.void openQuickActions() {- if (lib.isPodcastLibrary) {+ if (recentEpisode != null) {+ EpisodeDetailSheet.showQuick(context, item, recentEpisode);+ } else if (lib.isPodcastLibrary) {openDetails();} else {showQuickActionsSheet(context, itemId, initialItem: item);diff --git a/lib/widgets/action_pill.dart b/lib/widgets/action_pill.dartnew file mode 100644index 00000000..b211d414--- /dev/null+++ b/lib/widgets/action_pill.dart@@ -0,0 +1,80 @@+import 'package:flutter/material.dart';++/// One action in an [ActionPillGrid]: a centered icon over a short label.+class ActionPillData {+ final IconData icon;+ final String label;+ final VoidCallback onTap;+ final bool enabled;+ final Color? tint;+ const ActionPillData({+ required this.icon,+ required this.label,+ required this.onTap,+ this.enabled = true,+ this.tint,+ });+}++/// Responsive grid of action pills (the book-menu / admin-Users-page style):+/// 3 across normally, dropping to 2 on a narrow screen or a large system font+/// scale, with cell height that tracks the text scale so a 2-line label stays+/// inside its cell instead of overflowing.+class ActionPillGrid extends StatelessWidget {+ final List<ActionPillData> items;+ const ActionPillGrid({super.key, required this.items});++ @override+ Widget build(BuildContext context) {+ final cs = Theme.of(context).colorScheme;+ return LayoutBuilder(builder: (ctx, constraints) {+ const gap = 10.0;+ final textScale = MediaQuery.textScalerOf(context).scale(1.0);+ final cols = (constraints.maxWidth < 340 || textScale >= 1.3) ? 2 : 3;+ final cellW = (constraints.maxWidth - gap * (cols - 1)) / cols;+ final cellH = (cols == 2 ? 72.0 : 80.0) * textScale.clamp(1.0, 1.7) + 8;+ return Wrap(spacing: gap, runSpacing: gap, children: [+ for (final it in items)+ SizedBox(width: cellW, height: cellH, child: _ActionPill(data: it, cs: cs)),+ ]);+ });+ }+}++class _ActionPill extends StatelessWidget {+ final ActionPillData data;+ final ColorScheme cs;+ const _ActionPill({required this.data, required this.cs});++ @override+ Widget build(BuildContext context) {+ final iconColor = data.enabled+ ? (data.tint ?? cs.onSurfaceVariant)+ : cs.onSurface.withValues(alpha: 0.24);+ final textColor = data.enabled ? cs.onSurface : cs.onSurface.withValues(alpha: 0.24);+ return GestureDetector(+ onTap: data.onTap,+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 10),+ decoration: BoxDecoration(+ color: cs.surfaceContainerHigh,+ borderRadius: BorderRadius.circular(16),+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: Column(+ mainAxisSize: MainAxisSize.max,+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ Icon(data.icon, size: 22, color: iconColor),+ const SizedBox(height: 7),+ // Loose Flexible so a long label ellipsises inside the cell at big+ // font scales rather than overflowing it.+ Flexible(child: Text(data.label, textAlign: TextAlign.center, maxLines: 2,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(color: textColor, fontSize: 11, fontWeight: FontWeight.w500, height: 1.15))),+ ],+ ),+ ),+ );+ }+}diff --git a/lib/widgets/book_card.dart b/lib/widgets/book_card.dartindex 1391aa71..eb1fb002 100644--- a/lib/widgets/book_card.dart+++ b/lib/widgets/book_card.dart@@ -80,7 +80,13 @@ class BookCard extends StatelessWidget {final itemId = item['id'] as String?;if (itemId == null) return;if (context.read<LibraryProvider>().isPodcastLibrary) {- _navigateToDetail(context);+ // Episode card -> episode quick sheet; show cover -> keep current behaviour.+ final episode = item['recentEpisode'] as Map<String, dynamic>?;+ if (episode != null) {+ EpisodeDetailSheet.showQuick(context, item, episode);+ } else {+ _navigateToDetail(context);+ }return;}showQuickActionsSheet(context, itemId, initialItem: item);diff --git a/lib/widgets/episode_detail_sheet.dart b/lib/widgets/episode_detail_sheet.dartindex 082aa3ba..39773f24 100644--- a/lib/widgets/episode_detail_sheet.dart+++ b/lib/widgets/episode_detail_sheet.dart@@ -14,6 +14,8 @@ import 'card_buttons.dart';import 'html_description.dart';import 'overlay_toast.dart';import 'playlist_picker_sheet.dart';+import 'action_pill.dart';+import '../main.dart' show rootNavigatorKey;import 'stackable_sheet.dart';import 'episode_list_sheet.dart';@@ -21,14 +23,18 @@ class EpisodeDetailSheet extends StatefulWidget {final Map<String, dynamic> podcastItem;final Map<String, dynamic> episode;final ScrollController? scrollController;+ /// Compact long-press layout: header + Play + Download + the action grid,+ /// skipping the description / chapters / all-episodes sections.+ final bool quick;const EpisodeDetailSheet({super.key, required this.podcastItem, required this.episode})- : scrollController = null;+ : scrollController = null, quick = false;const EpisodeDetailSheet._({required this.podcastItem,required this.episode,required this.scrollController,+ this.quick = false,}) : super(key: null);static void show(BuildContext context, Map<String, dynamic> podcastItem, Map<String, dynamic> episode) {@@ -45,6 +51,22 @@ class EpisodeDetailSheet extends StatefulWidget {);}+ /// Long-press shortcut: a compact quick-actions sheet for one episode.+ static void showQuick(BuildContext context, Map<String, dynamic> podcastItem, Map<String, dynamic> episode) {+ showStackableSheet(+ context: context,+ useSafeArea: true,+ initialChildSize: 0.55,+ maxChildSize: 0.92,+ builder: (_, scrollController) => EpisodeDetailSheet._(+ podcastItem: podcastItem,+ episode: episode,+ scrollController: scrollController,+ quick: true,+ ),+ );+ }+@overrideState<EpisodeDetailSheet> createState() => _EpisodeDetailSheetState();}@@ -278,42 +300,13 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {durationLabel = h > 0 ? l.episodeDetailDurationHm(h, m) : l.episodeDetailDurationM(m);}- return Container(- clipBehavior: Clip.antiAlias,- decoration: BoxDecoration(- color: Theme.of(context).scaffoldBackgroundColor,- borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),- ),- child: Stack(children: [- // Blurred cover background- if (coverUrl != null)- Positioned.fill(- child: RepaintBoundary(- child: CachedNetworkImage(- imageUrl: coverUrl, fit: BoxFit.cover,- httpHeaders: lib.mediaHeaders,- imageBuilder: (_, p) => ImageFiltered(- imageFilter: ImageFilter.blur(sigmaX: 50, sigmaY: 50, tileMode: TileMode.decal),- child: Image(image: p, fit: BoxFit.cover)),- placeholder: (_, __) => const SizedBox(),- errorWidget: (_, __, ___) => const SizedBox(),- ),- ),- ),- // Gradient overlay- Positioned.fill(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(- begin: Alignment.topCenter, end: Alignment.bottomCenter,- colors: [- Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.6),- Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.85),- Theme.of(context).scaffoldBackgroundColor,- ],- )))),- // Content- ListView(- controller: widget.scrollController,- padding: EdgeInsets.fromLTRB(20, 8, 20, 32 + MediaQuery.of(context).viewPadding.bottom),- children: [+ // Long-press quick layout: header + Play + Download + the action grid.+ if (widget.quick) {+ return _scaffold(context, coverUrl, lib,+ _quickChildren(cs, tt, l, lib, dlKey, progress, isFinished));+ }++ return _scaffold(context, coverUrl, lib, [// Drag handleCenter(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),@@ -346,111 +339,14 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {],// Play button (full width, matching book detail)- SizedBox(height: 52, child: FilledButton.icon(- onPressed: _play,- icon: Icon(- progress > 0 && !isFinished ? Icons.play_arrow_rounded : Icons.podcasts_rounded,- size: 24,- ),- label: Text(- progress > 0 && !isFinished ? l.episodeDetailResume : l.episodeDetailPlayEpisode,- style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onPrimary),- ),- style: FilledButton.styleFrom(- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),- ),- )),+ _playButton(cs, tt, l, progress, isFinished),const SizedBox(height: 12),// Download + Finished rowRow(children: [- Expanded(child: ListenableBuilder(- listenable: DownloadService(),- builder: (context, _) {- final dl = DownloadService();- final downloaded = dl.isDownloaded(dlKey);- final downloading = dl.isDownloading(dlKey);- final dlProgress = dl.downloadProgress(dlKey);-- final IconData icon;- final String label;- final Color color;- if (downloaded) {- icon = Icons.download_done_rounded;- label = l.saved;- color = (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7);- } else if (downloading) {- icon = Icons.downloading_rounded;- label = '${(dlProgress * 100).toStringAsFixed(0)}%';- color = cs.primary;- } else {- icon = Icons.download_outlined;- label = l.download;- color = cs.onSurfaceVariant;- }-- return GestureDetector(- onTap: downloaded- ? () => _confirmDeleteDownload(context, dlKey)- : downloading- ? () => DownloadService().cancelDownload(dlKey)- : _download,- child: Container(- height: 36,- clipBehavior: Clip.antiAlias,- decoration: BoxDecoration(- color: downloaded ? (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),- borderRadius: BorderRadius.circular(14),- border: Border.all(color: downloaded ? (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),- ),- child: Stack(children: [- if (downloading)- FractionallySizedBox(- widthFactor: dlProgress.clamp(0.0, 1.0),- child: Container(- decoration: BoxDecoration(- color: cs.primary.withValues(alpha: 0.15),- borderRadius: BorderRadius.circular(13),- ),- ),- ),- Center(child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [- Icon(icon, size: 16, color: color),- const SizedBox(width: 6),- Text(label, style: TextStyle(color: color, fontSize: 12, fontWeight: FontWeight.w500)),- ])),- ]),- ),- );- },- )),+ Expanded(child: _downloadCell(cs, l, dlKey)),const SizedBox(width: 8),- Expanded(child: GestureDetector(- onTap: _toggleFinished,- child: Container(- height: 36,- decoration: BoxDecoration(- color: isFinished ? Colors.green.withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),- borderRadius: BorderRadius.circular(14),- border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),- ),- child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [- Icon(- isFinished ? Icons.check_circle_rounded : Icons.check_circle_outline_rounded,- size: 16,- color: isFinished ? Colors.green : cs.onSurfaceVariant,- ),- const SizedBox(width: 6),- Text(- isFinished ? Wording.of(context).fullyAbsorbed : Wording.of(context).fullyAbsorbAction,- style: TextStyle(- color: isFinished ? Colors.green : cs.onSurfaceVariant,- fontSize: 12, fontWeight: FontWeight.w500,- ),- ),- ]),- ),- )),+ Expanded(child: _finishedCell(cs, isFinished)),const SizedBox(width: 8),GestureDetector(onTap: () => _showMoreSheet(context, lib, dlKey, progress, isFinished),@@ -528,14 +424,257 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {),],],+ );+ }++ // ─── Shared scaffold + extracted buttons (full + quick layouts) ─────+ Widget _scaffold(BuildContext context, String? coverUrl, LibraryProvider lib, List<Widget> children) {+ return Container(+ clipBehavior: Clip.antiAlias,+ decoration: BoxDecoration(+ color: Theme.of(context).scaffoldBackgroundColor,+ borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),+ ),+ child: Stack(children: [+ ..._bgLayers(context, coverUrl, lib),+ ListView(+ controller: widget.scrollController,+ padding: EdgeInsets.fromLTRB(20, 8, 20, 32 + MediaQuery.of(context).viewPadding.bottom),+ children: children,),]),);}+ List<Widget> _bgLayers(BuildContext context, String? coverUrl, LibraryProvider lib) {+ return [+ // Blurred cover background+ if (coverUrl != null)+ Positioned.fill(+ child: RepaintBoundary(+ child: CachedNetworkImage(+ imageUrl: coverUrl, fit: BoxFit.cover,+ httpHeaders: lib.mediaHeaders,+ imageBuilder: (_, p) => ImageFiltered(+ imageFilter: ImageFilter.blur(sigmaX: 50, sigmaY: 50, tileMode: TileMode.decal),+ child: Image(image: p, fit: BoxFit.cover)),+ placeholder: (_, __) => const SizedBox(),+ errorWidget: (_, __, ___) => const SizedBox(),+ ),+ ),+ ),+ // Gradient overlay+ Positioned.fill(child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(+ begin: Alignment.topCenter, end: Alignment.bottomCenter,+ colors: [+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.6),+ Theme.of(context).scaffoldBackgroundColor.withValues(alpha: 0.85),+ Theme.of(context).scaffoldBackgroundColor,+ ],+ )))),+ ];+ }++ Widget _playButton(ColorScheme cs, TextTheme tt, AppLocalizations l, double progress, bool isFinished) {+ return SizedBox(height: 52, child: FilledButton.icon(+ onPressed: _play,+ icon: Icon(+ progress > 0 && !isFinished ? Icons.play_arrow_rounded : Icons.podcasts_rounded,+ size: 24,+ ),+ label: Text(+ progress > 0 && !isFinished ? l.episodeDetailResume : l.episodeDetailPlayEpisode,+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onPrimary),+ ),+ style: FilledButton.styleFrom(+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),+ ),+ ));+ }++ Widget _downloadCell(ColorScheme cs, AppLocalizations l, String dlKey) {+ return ListenableBuilder(+ listenable: DownloadService(),+ builder: (context, _) {+ final dl = DownloadService();+ final downloaded = dl.isDownloaded(dlKey);+ final downloading = dl.isDownloading(dlKey);+ final dlProgress = dl.downloadProgress(dlKey);+ final dlGreen = (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700);++ final IconData icon;+ final String label;+ final Color color;+ if (downloaded) {+ icon = Icons.download_done_rounded;+ label = l.saved;+ color = dlGreen.withValues(alpha: 0.7);+ } else if (downloading) {+ icon = Icons.downloading_rounded;+ label = '${(dlProgress * 100).toStringAsFixed(0)}%';+ color = cs.primary;+ } else {+ icon = Icons.download_outlined;+ label = l.download;+ color = cs.onSurfaceVariant;+ }++ return GestureDetector(+ onTap: downloaded+ ? () => _confirmDeleteDownload(context, dlKey)+ : downloading+ ? () => DownloadService().cancelDownload(dlKey)+ : _download,+ child: Container(+ height: 36,+ clipBehavior: Clip.antiAlias,+ decoration: BoxDecoration(+ color: downloaded ? dlGreen.withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),+ borderRadius: BorderRadius.circular(14),+ border: Border.all(color: downloaded ? dlGreen.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: Stack(children: [+ if (downloading)+ FractionallySizedBox(+ widthFactor: dlProgress.clamp(0.0, 1.0),+ child: Container(+ decoration: BoxDecoration(+ color: cs.primary.withValues(alpha: 0.15),+ borderRadius: BorderRadius.circular(13),+ ),+ ),+ ),+ Center(child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [+ Icon(icon, size: 16, color: color),+ const SizedBox(width: 6),+ Text(label, style: TextStyle(color: color, fontSize: 12, fontWeight: FontWeight.w500)),+ ])),+ ]),+ ),+ );+ },+ );+ }++ Widget _finishedCell(ColorScheme cs, bool isFinished) {+ return GestureDetector(+ onTap: _toggleFinished,+ child: Container(+ height: 36,+ decoration: BoxDecoration(+ color: isFinished ? Colors.green.withValues(alpha: 0.06) : cs.onSurface.withValues(alpha: 0.06),+ borderRadius: BorderRadius.circular(14),+ border: Border.all(color: isFinished ? Colors.green.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [+ Icon(+ isFinished ? Icons.check_circle_rounded : Icons.check_circle_outline_rounded,+ size: 16,+ color: isFinished ? Colors.green : cs.onSurfaceVariant,+ ),+ const SizedBox(width: 6),+ Flexible(child: Text(+ isFinished ? Wording.of(context).fullyAbsorbed : Wording.of(context).fullyAbsorbAction,+ maxLines: 1, overflow: TextOverflow.ellipsis,+ style: TextStyle(+ color: isFinished ? Colors.green : cs.onSurfaceVariant,+ fontSize: 12, fontWeight: FontWeight.w500,+ ),+ )),+ ]),+ ),+ );+ }++ // Compact long-press layout children.+ List<Widget> _quickChildren(ColorScheme cs, TextTheme tt, AppLocalizations l,+ LibraryProvider lib, String dlKey, double progress, bool isFinished) {+ return [+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),+ Text(_episodeTitle, textAlign: TextAlign.center, maxLines: 3, overflow: TextOverflow.ellipsis,+ style: tt.titleLarge?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface)),+ if (_showTitle.isNotEmpty) ...[+ const SizedBox(height: 4),+ Text(_showTitle, textAlign: TextAlign.center, maxLines: 1, overflow: TextOverflow.ellipsis,+ style: tt.bodyMedium?.copyWith(color: cs.onSurface.withValues(alpha: 0.6))),+ ],+ const SizedBox(height: 18),+ _playButton(cs, tt, l, progress, isFinished),+ const SizedBox(height: 10),+ Row(children: [+ Expanded(child: _downloadCell(cs, l, dlKey)),+ const SizedBox(width: 8),+ Expanded(child: _finishedCell(cs, isFinished)),+ ]),+ const SizedBox(height: 18),+ ActionPillGrid(items: _episodeActionItems(lib, dlKey, progress, isFinished,+ dismiss: () {}, includeOpenDetails: true)),+ ];+ }++ // The episode's secondary actions, shared by the overflow menu (dismiss pops+ // the menu) and the quick sheet (dismiss is a no-op, sheet stays open).+ List<ActionPillData> _episodeActionItems(LibraryProvider lib,+ String dlKey, double progress, bool isFinished,+ {required VoidCallback dismiss, bool includeOpenDetails = false}) {+ final l = AppLocalizations.of(context)!;+ return [+ ActionPillData(+ icon: lib.isOnAbsorbingList(dlKey)+ ? Icons.remove_circle_outline_rounded : Icons.add_circle_outline_rounded,+ label: lib.isOnAbsorbingList(dlKey) ? Wording.of(context).removeFromAbsorbing : Wording.of(context).addToAbsorbing,+ onTap: () async {+ dismiss();+ if (lib.isOnAbsorbingList(dlKey)) {+ await lib.removeFromAbsorbing(dlKey);+ if (context.mounted) {+ ScaffoldMessenger.of(context).showSnackBar(SnackBar(+ duration: const Duration(seconds: 3),+ content: Text(Wording.of(context).removedFromAbsorbing),+ behavior: SnackBarBehavior.floating,+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))));+ }+ } else {+ await lib.addToAbsorbingQueue(dlKey);+ final cached = Map<String, dynamic>.from(widget.podcastItem);+ cached['recentEpisode'] = Map<String, dynamic>.from(widget.episode);+ cached['_absorbingKey'] = dlKey;+ lib.absorbingItemCache[dlKey] = cached;+ if (context.mounted) {+ ScaffoldMessenger.of(context).showSnackBar(SnackBar(+ duration: const Duration(seconds: 3),+ content: Text(Wording.of(context).addedToAbsorbing),+ behavior: SnackBarBehavior.floating,+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))));+ }+ }+ }),+ if (!lib.isOffline)+ ActionPillData(icon: Icons.playlist_add_rounded, label: l.addToPlaylist,+ onTap: () {+ dismiss();+ PlaylistPickerSheet.show(+ context,+ widget.podcastItem['id'] as String,+ episodeId: widget.episode['id'] as String?,+ );+ }),+ if (progress > 0 || isFinished)+ ActionPillData(icon: Icons.restart_alt_rounded, label: l.resetProgress,+ onTap: () { dismiss(); _resetProgress(context); }),+ if (includeOpenDetails)+ ActionPillData(icon: Icons.open_in_full_rounded, label: l.episodeDetailsLabel,+ onTap: () {+ final rc = rootNavigatorKey.currentContext;+ Navigator.of(context).pop();+ if (rc != null) EpisodeDetailSheet.show(rc, widget.podcastItem, widget.episode);+ }),+ ];+ }+void _showMoreSheet(BuildContext context, LibraryProvider lib, String dlKey, double progress, bool isFinished) {final cs = Theme.of(context).colorScheme;- final l = AppLocalizations.of(context)!;showModalBottomSheet(context: context,backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,@@ -549,48 +688,8 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {child: Column(mainAxisSize: MainAxisSize.min, children: [Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),- _moreItem(cs, lib.isOnAbsorbingList(dlKey)- ? Icons.remove_circle_outline_rounded : Icons.add_circle_outline_rounded,- lib.isOnAbsorbingList(dlKey) ? Wording.of(context).removeFromAbsorbing : Wording.of(context).addToAbsorbing,- onTap: () async {- Navigator.pop(ctx);- if (lib.isOnAbsorbingList(dlKey)) {- await lib.removeFromAbsorbing(dlKey);- if (context.mounted) {- ScaffoldMessenger.of(context).showSnackBar(SnackBar(- duration: const Duration(seconds: 3),- content: Text(Wording.of(context).removedFromAbsorbing),- behavior: SnackBarBehavior.floating,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))));- }- } else {- await lib.addToAbsorbingQueue(dlKey);- final cached = Map<String, dynamic>.from(widget.podcastItem);- cached['recentEpisode'] = Map<String, dynamic>.from(widget.episode);- cached['_absorbingKey'] = dlKey;- lib.absorbingItemCache[dlKey] = cached;- if (context.mounted) {- ScaffoldMessenger.of(context).showSnackBar(SnackBar(- duration: const Duration(seconds: 3),- content: Text(Wording.of(context).addedToAbsorbing),- behavior: SnackBarBehavior.floating,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))));- }- }- }),- if (!lib.isOffline)- _moreItem(cs, Icons.playlist_add_rounded, l.addToPlaylist,- onTap: () {- Navigator.pop(ctx);- PlaylistPickerSheet.show(- context,- widget.podcastItem['id'] as String,- episodeId: widget.episode['id'] as String?,- );- }),- if (progress > 0 || isFinished)- _moreItem(cs, Icons.restart_alt_rounded, l.resetProgress,- onTap: () { Navigator.pop(ctx); _resetProgress(context); }),+ ActionPillGrid(items: _episodeActionItems(lib, dlKey, progress, isFinished,+ dismiss: () => Navigator.pop(ctx))),]),),);@@ -598,18 +697,6 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {);}- Widget _moreItem(ColorScheme cs, IconData icon, String label, {required VoidCallback onTap}) {- return Padding(- padding: const EdgeInsets.only(bottom: 6),- child: GestureDetector(onTap: onTap, child: Container(height: 44,- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(14),- border: Border.all(color: cs.onSurface.withValues(alpha: 0.1))),- child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [- Icon(icon, size: 16, color: cs.onSurfaceVariant), const SizedBox(width: 8),- Text(label, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13, fontWeight: FontWeight.w500))]))),- );- }-String _fmtDur(double s) {final h = (s / 3600).floor(); final m = ((s % 3600) / 60).floor();if (h > 0) return '${h}h ${m}m';diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dartindex 0be784e8..24549979 100644--- a/lib/widgets/episode_list_sheet.dart+++ b/lib/widgets/episode_list_sheet.dart@@ -16,6 +16,7 @@ import 'card_buttons.dart';import 'html_description.dart';import 'stackable_sheet.dart';import 'episode_row.dart';+import 'action_pill.dart';export 'episode_detail_sheet.dart';/// Bottom sheet that shows a podcast's episode list.@@ -409,54 +410,57 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {child: Column(mainAxisSize: MainAxisSize.min, children: [Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),- if (!allDownloaded)- _podMoreItem(cs, Icons.download_rounded,- downloaded > 0 ? l.downloadRemainingCount(_episodes.length - downloaded) : l.downloadAll,- onTap: () { Navigator.pop(ctx); _downloadAll(); }),- if (_itemId.isNotEmpty)- _podMoreItem(cs,- _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,- _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,- onTap: () async {- Navigator.pop(ctx);- final lib = context.read<LibraryProvider>();- await lib.toggleRollingDownload(_itemId);- setState(() => _autoDownloadEnabled = lib.isRollingDownloadEnabled(_itemId));- }),- if (_itemId.isNotEmpty)- _podMoreItem(cs,- _subscribed ? Icons.notifications_active_rounded : Icons.notifications_none_rounded,- _subscribed ? l.episodeListUnsubscribeFromNewEpisodes : l.episodeListSubscribeToNewEpisodes,- onTap: () async {- Navigator.pop(ctx);- if (_subscribed) {+ ActionPillGrid(items: [+ if (!allDownloaded)+ ActionPillData(+ icon: Icons.download_rounded,+ label: downloaded > 0 ? l.downloadRemainingCount(_episodes.length - downloaded) : l.downloadAll,+ onTap: () { Navigator.pop(ctx); _downloadAll(); }),+ if (_itemId.isNotEmpty)+ ActionPillData(+ icon: _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,+ label: _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,+ onTap: () async {+ Navigator.pop(ctx);final lib = context.read<LibraryProvider>();- await lib.unsubscribePodcast(_itemId);- if (mounted) setState(() => _subscribed = false);- } else {- final confirm = await showDialog<bool>(- context: context,- builder: (dCtx) => AlertDialog(- icon: const Icon(Icons.notifications_active_rounded),- title: Text(l.episodeListSubscribeTitle),- content: Text(l.episodeListSubscribeContent),- actions: [- TextButton(onPressed: () => Navigator.pop(dCtx, false), child: Text(l.cancel)),- FilledButton(onPressed: () => Navigator.pop(dCtx, true), child: Text(l.episodeListSubscribe)),- ],- ),- );- if (confirm == true && mounted) {+ await lib.toggleRollingDownload(_itemId);+ setState(() => _autoDownloadEnabled = lib.isRollingDownloadEnabled(_itemId));+ }),+ if (_itemId.isNotEmpty)+ ActionPillData(+ icon: _subscribed ? Icons.notifications_active_rounded : Icons.notifications_none_rounded,+ label: _subscribed ? l.episodeListUnsubscribeFromNewEpisodes : l.episodeListSubscribeToNewEpisodes,+ onTap: () async {+ Navigator.pop(ctx);+ if (_subscribed) {final lib = context.read<LibraryProvider>();- await lib.subscribePodcast(_itemId);- setState(() => _subscribed = true);+ await lib.unsubscribePodcast(_itemId);+ if (mounted) setState(() => _subscribed = false);+ } else {+ final confirm = await showDialog<bool>(+ context: context,+ builder: (dCtx) => AlertDialog(+ icon: const Icon(Icons.notifications_active_rounded),+ title: Text(l.episodeListSubscribeTitle),+ content: Text(l.episodeListSubscribeContent),+ actions: [+ TextButton(onPressed: () => Navigator.pop(dCtx, false), child: Text(l.cancel)),+ FilledButton(onPressed: () => Navigator.pop(dCtx, true), child: Text(l.episodeListSubscribe)),+ ],+ ),+ );+ if (confirm == true && mounted) {+ final lib = context.read<LibraryProvider>();+ await lib.subscribePodcast(_itemId);+ setState(() => _subscribed = true);+ }}- }- }),- _podMoreItem(cs,- _hideFinished ? Icons.visibility_rounded : Icons.visibility_off_rounded,- _hideFinished ? l.episodeListShowFinishedEpisodes : l.episodeListHideFinishedEpisodes,- onTap: () { Navigator.pop(ctx); _toggleHideFinished(); }),+ }),+ ActionPillData(+ icon: _hideFinished ? Icons.visibility_rounded : Icons.visibility_off_rounded,+ label: _hideFinished ? l.episodeListShowFinishedEpisodes : l.episodeListHideFinishedEpisodes,+ onTap: () { Navigator.pop(ctx); _toggleHideFinished(); }),+ ]),]),),);@@ -464,18 +468,6 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {);}- Widget _podMoreItem(ColorScheme cs, IconData icon, String label, {required VoidCallback onTap}) {- return Padding(- padding: const EdgeInsets.only(bottom: 6),- child: GestureDetector(onTap: onTap, child: Container(height: 44,- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(14),- border: Border.all(color: cs.onSurface.withValues(alpha: 0.1))),- child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [- Icon(icon, size: 16, color: cs.onSurfaceVariant), const SizedBox(width: 8),- Text(label, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13, fontWeight: FontWeight.w500))]))),- );- }-String? get _coverUrl {final auth = context.read<AuthProvider>();return auth.apiService?.getCoverUrl(_itemId, width: 800);diff --git a/lib/widgets/episode_row.dart b/lib/widgets/episode_row.dartindex 1d67a805..1293403d 100644--- a/lib/widgets/episode_row.dart+++ b/lib/widgets/episode_row.dart@@ -85,6 +85,7 @@ class _EpisodeRowState extends State<EpisodeRow> {onTap: () {EpisodeDetailSheet.show(context, widget.podcastItem, ep);},+ onLongPress: () => EpisodeDetailSheet.showQuick(context, widget.podcastItem, ep),child: Padding(padding: const EdgeInsets.fromLTRB(20, 10, 12, 10),child: Column(diff --git a/lib/widgets/home_section.dart b/lib/widgets/home_section.dartindex 1274935b..751abaaa 100644--- a/lib/widgets/home_section.dart+++ b/lib/widgets/home_section.dart@@ -270,6 +270,9 @@ class _EpisodeCard extends StatelessWidget {EpisodeListSheet.show(context, item);}},+ // Long-press an episode card for its quick-actions sheet (shows stay as-is).+ onLongPress: episode == null ? null+ : () => EpisodeDetailSheet.showQuick(context, item, episode),child: Column(crossAxisAlignment: CrossAxisAlignment.start,mainAxisSize: MainAxisSize.min,diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dartindex e976da9e..e8a67337 100644--- a/lib/widgets/series_books_sheet.dart+++ b/lib/widgets/series_books_sheet.dart@@ -15,6 +15,7 @@ import 'library_grid_tiles.dart';import 'episode_list_sheet.dart';import 'stackable_sheet.dart';import 'audible_series_sheet.dart';+import 'action_pill.dart';import '../services/api_service.dart';/// Show a bottom sheet with all books in a series, sorted by sequence.@@ -750,55 +751,58 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {child: Column(mainAxisSize: MainAxisSize.min, children: [Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),- if (!allDownloaded)- _moreItem(cs, Icons.download_rounded,- downloaded > 0 ? l.downloadRemainingCount((_totalBooks > 0 ? _totalBooks : _books.length) - downloaded) : l.downloadAll,- onTap: () { Navigator.pop(ctx); _downloadAll(); }),- _moreItem(cs,- allDone ? Icons.remove_done_rounded : Icons.done_all_rounded,- allDone ? l.markAllNotFinished : l.markAllFinished,- onTap: () async {- Navigator.pop(ctx);- if (allDone) {- final confirmed = await showDialog<bool>(- context: context,- builder: (dlg) => AlertDialog(- title: Text(l.markAllNotFinishedQuestion),- content: Text(l.seriesBooksMarkAllNotFinishedContent(_books.length)),- actions: [- TextButton(onPressed: () => Navigator.pop(dlg, false), child: Text(l.cancel)),- FilledButton(onPressed: () => Navigator.pop(dlg, true), child: Text(l.seriesBooksUnmarkAll)),- ],- ),- );- if (confirmed == true) _markAllNotFinished();- } else {- final confirmed = await showDialog<bool>(- context: context,- builder: (dlg) => AlertDialog(- title: Text(Wording.of(context).fullyAbsorbSeries),- content: Text(l.seriesBooksFullyAbsorbContent(_books.length)),- actions: [- TextButton(onPressed: () => Navigator.pop(dlg, false), child: Text(l.cancel)),- FilledButton(onPressed: () => Navigator.pop(dlg, true), child: Text(Wording.of(context).fullyAbsorbAction)),- ],- ),- );- if (confirmed == true) _markAllFinished();- }- }),- if (hasSeriesId)- _moreItem(cs,- _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,- _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,+ ActionPillGrid(items: [+ if (!allDownloaded)+ ActionPillData(+ icon: Icons.download_rounded,+ label: downloaded > 0 ? l.downloadRemainingCount((_totalBooks > 0 ? _totalBooks : _books.length) - downloaded) : l.downloadAll,+ onTap: () { Navigator.pop(ctx); _downloadAll(); }),+ ActionPillData(+ icon: allDone ? Icons.remove_done_rounded : Icons.done_all_rounded,+ label: allDone ? l.markAllNotFinished : l.markAllFinished,onTap: () async {Navigator.pop(ctx);- final lib = context.read<LibraryProvider>();- await lib.toggleRollingDownload(widget.seriesId!);- setState(() => _autoDownloadEnabled = lib.isRollingDownloadEnabled(widget.seriesId!));+ if (allDone) {+ final confirmed = await showDialog<bool>(+ context: context,+ builder: (dlg) => AlertDialog(+ title: Text(l.markAllNotFinishedQuestion),+ content: Text(l.seriesBooksMarkAllNotFinishedContent(_books.length)),+ actions: [+ TextButton(onPressed: () => Navigator.pop(dlg, false), child: Text(l.cancel)),+ FilledButton(onPressed: () => Navigator.pop(dlg, true), child: Text(l.seriesBooksUnmarkAll)),+ ],+ ),+ );+ if (confirmed == true) _markAllNotFinished();+ } else {+ final confirmed = await showDialog<bool>(+ context: context,+ builder: (dlg) => AlertDialog(+ title: Text(Wording.of(context).fullyAbsorbSeries),+ content: Text(l.seriesBooksFullyAbsorbContent(_books.length)),+ actions: [+ TextButton(onPressed: () => Navigator.pop(dlg, false), child: Text(l.cancel)),+ FilledButton(onPressed: () => Navigator.pop(dlg, true), child: Text(Wording.of(context).fullyAbsorbAction)),+ ],+ ),+ );+ if (confirmed == true) _markAllFinished();+ }}),- _moreItem(cs, Icons.search_rounded, l.seriesBooksFindMissingTitle,- onTap: () { Navigator.pop(ctx); _findOnAudible(); }),+ if (hasSeriesId)+ ActionPillData(+ icon: _autoDownloadEnabled ? Icons.downloading_rounded : Icons.download_outlined,+ label: _autoDownloadEnabled ? l.turnAutoDownloadOff : l.turnAutoDownloadOn,+ onTap: () async {+ Navigator.pop(ctx);+ final lib = context.read<LibraryProvider>();+ await lib.toggleRollingDownload(widget.seriesId!);+ setState(() => _autoDownloadEnabled = lib.isRollingDownloadEnabled(widget.seriesId!));+ }),+ ActionPillData(icon: Icons.search_rounded, label: l.seriesBooksFindMissingTitle,+ onTap: () { Navigator.pop(ctx); _findOnAudible(); }),+ ]),]),),);@@ -806,18 +810,6 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {);}- Widget _moreItem(ColorScheme cs, IconData icon, String label, {required VoidCallback onTap}) {- return Padding(- padding: const EdgeInsets.only(bottom: 6),- child: GestureDetector(onTap: onTap, child: Container(height: 44,- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(14),- border: Border.all(color: cs.onSurface.withValues(alpha: 0.1))),- child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [- Icon(icon, size: 16, color: cs.onSurfaceVariant), const SizedBox(width: 8),- Text(label, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13, fontWeight: FontWeight.w500))]))),- );- }-Future<void> _downloadAll() async {final auth = context.read<AuthProvider>();final api = auth.apiService;