A cross platform Audiobookshelf client for Android and iOS
Dart
Fix drag-reorder boundaries and show per-book EQ per card
Barnabas7e4006792a9f
diff --git a/lib/services/equalizer_service.dart b/lib/services/equalizer_service.dartindex ee574080..7fa995c2 100644--- a/lib/services/equalizer_service.dart+++ b/lib/services/equalizer_service.dart@@ -52,6 +52,7 @@ class EqualizerService extends ChangeNotifier {double get loudnessGain => _loudnessGain;bool get mono => _mono;bool get perItem => _perItem;+ String? get currentItemId => _currentItemId;/// Initialize — try to connect to platform EQ, fall back to software presets.Future<void> init() async {@@ -276,6 +277,49 @@ class EqualizerService extends ChangeNotifier {String _itemKey(String key, String itemId) => 'eq_${itemId}_$key';+ /// Read an item's persisted EQ settings without mutating service state.+ /// Used by the EQ sheet to preview/edit a non-playing item's EQ.+ Future<Map<String, dynamic>> loadItemSnapshot(String itemId) async {+ final bandCount = _bandLevels.isEmpty ? 5 : _bandLevels.length;+ final hasItemEq = await ScopedPrefs.containsKey(_itemKey('enabled', itemId));+ if (!hasItemEq) {+ return {+ 'enabled': false,+ 'preset': 'flat',+ 'bassBoost': 0.0,+ 'virtualizer': 0.0,+ 'loudnessGain': 0.0,+ 'mono': false,+ 'bands': List<double>.filled(bandCount, 0.0),+ };+ }+ final bandStr = await ScopedPrefs.getString(_itemKey('bands', itemId));+ final bands = bandStr != null+ ? bandStr.split(',').map((s) => double.tryParse(s) ?? 0.0).toList()+ : List<double>.filled(bandCount, 0.0);+ return {+ 'enabled': await ScopedPrefs.getBool(_itemKey('enabled', itemId)) ?? false,+ 'preset': await ScopedPrefs.getString(_itemKey('preset', itemId)) ?? 'flat',+ 'bassBoost': await ScopedPrefs.getDouble(_itemKey('bassBoost', itemId)) ?? 0.0,+ 'virtualizer': await ScopedPrefs.getDouble(_itemKey('virtualizer', itemId)) ?? 0.0,+ 'loudnessGain': await ScopedPrefs.getDouble(_itemKey('loudnessGain', itemId)) ?? 0.0,+ 'mono': await ScopedPrefs.getBool(_itemKey('mono', itemId)) ?? false,+ 'bands': bands,+ };+ }++ /// Persist a full snapshot to an item's storage without affecting live state.+ Future<void> saveItemSnapshot(String itemId, Map<String, dynamic> s) async {+ await ScopedPrefs.setBool(_itemKey('enabled', itemId), s['enabled'] as bool);+ await ScopedPrefs.setString(_itemKey('preset', itemId), s['preset'] as String);+ await ScopedPrefs.setDouble(_itemKey('bassBoost', itemId), s['bassBoost'] as double);+ await ScopedPrefs.setDouble(_itemKey('virtualizer', itemId), s['virtualizer'] as double);+ await ScopedPrefs.setDouble(_itemKey('loudnessGain', itemId), s['loudnessGain'] as double);+ await ScopedPrefs.setBool(_itemKey('mono', itemId), s['mono'] as bool);+ final bands = (s['bands'] as List).cast<double>();+ await ScopedPrefs.setString(_itemKey('bands', itemId), bands.map((l) => l.toStringAsFixed(1)).join(','));+ }+Future<void> _loadItemSettings(String itemId) async {final hasItemEq = await ScopedPrefs.containsKey(_itemKey('enabled', itemId));if (!hasItemEq) {diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dartindex 7aab2816..3eaa26da 100644--- a/lib/widgets/card_buttons.dart+++ b/lib/widgets/card_buttons.dart@@ -9,6 +9,7 @@ import '../services/audio_player_service.dart';import '../services/bookmark_service.dart';import '../services/chromecast_service.dart';import '../services/download_service.dart';+import '../services/equalizer_service.dart';import '../services/playback_history_service.dart';import '../services/sleep_timer_service.dart';import 'absorb_slider.dart';@@ -86,6 +87,7 @@ class CardWideButton extends StatelessWidget {final bool large;final bool compact;final bool iconsOnly;+ final bool highlighted;final VoidCallback? onTap;final Widget? child;@@ -94,7 +96,7 @@ class CardWideButton extends StatelessWidget {required this.icon, required this.label,required this.accent, required this.isActive,this.alwaysEnabled = false, this.large = false, this.compact = false,- this.iconsOnly = false, this.onTap, this.child,+ this.iconsOnly = false, this.highlighted = false, this.onTap, this.child,});@override Widget build(BuildContext context) {@@ -106,24 +108,27 @@ class CardWideButton extends StatelessWidget {final vPad = compact ? 8.0 : (large ? 14.0 : 10.0);final radius = compact ? 10.0 : (large ? 14.0 : 12.0);final showIconOnly = compact || iconsOnly;+ final fgColor = highlighted+ ? accent+ : (enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24));return Pressable(onTap: enabled ? onTap : () => showInactiveToast(context),child: Container(padding: EdgeInsets.symmetric(vertical: vPad),decoration: BoxDecoration(- color: cs.onSurface.withValues(alpha: 0.06),+ color: highlighted ? accent.withValues(alpha: 0.1) : cs.onSurface.withValues(alpha: 0.06),borderRadius: BorderRadius.circular(radius),- border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),+ border: Border.all(color: highlighted ? accent.withValues(alpha: 0.3) : cs.onSurface.withValues(alpha: 0.08)),),child: showIconOnly- ? Center(child: Icon(icon, size: iconSize, color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24)))+ ? Center(child: Icon(icon, size: iconSize, color: fgColor)): Row(mainAxisAlignment: MainAxisAlignment.center,children: [- Icon(icon, size: iconSize, color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24)),+ Icon(icon, size: iconSize, color: fgColor),const SizedBox(width: 6),Flexible(child: Text(label, overflow: TextOverflow.ellipsis, style: TextStyle(- color: enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.24),+ color: fgColor,fontSize: fontSize, fontWeight: FontWeight.w500))),],),@@ -1108,78 +1113,98 @@ class _MoreMenuSheetState extends State<MoreMenuSheet> {child: child,);},- itemCount: _order.length,+ // +1 slot for the section divider, rendered as its own non-draggable item+ // at index == _visibleCount. Giving the divider its own slot lets users drop+ // at the top of hidden / bottom of visible without the `newIdx--` adjustment+ // swallowing the drop zone, and keeps the section header from dragging along+ // with the first hidden item.+ itemCount: _order.length + 1,onReorder: (oldIdx, newIdx) {+ // Divider is not draggable, so oldIdx should never equal _visibleCount.+ if (oldIdx == _visibleCount) return;+ if (newIdx > oldIdx) newIdx--;setState(() {- if (newIdx > oldIdx) newIdx--;- final id = _order[oldIdx];- // Prevent _more from leaving visible zone- if (id == '_more' && newIdx >= _visibleCount) {- newIdx = _visibleCount - 1;+ // Build a combined list with a sentinel at the divider position,+ // simulate the move, then derive new _order and _visibleCount+ // from where the sentinel lands.+ const div = '__DIV__';+ final combined = <String>[];+ for (int i = 0; i <= _order.length; i++) {+ if (i == _visibleCount) combined.add(div);+ if (i < _order.length) combined.add(_order[i]);}- final movedOut = oldIdx < _visibleCount && newIdx >= _visibleCount;- final movedIn = oldIdx >= _visibleCount && newIdx < _visibleCount;- // Cap: max 9 total visible slots (including _more)- if (movedIn && _visibleCount >= 9) return;- _order.removeAt(oldIdx);- _order.insert(newIdx, id);- if (movedOut) _visibleCount--;- if (movedIn) _visibleCount++;- _visibleCount = _visibleCount.clamp(1, _order.length);+ final moved = combined.removeAt(oldIdx);+ final insertAt = newIdx.clamp(0, combined.length);+ combined.insert(insertAt, moved);++ final newDivIdx = combined.indexOf(div);+ combined.removeAt(newDivIdx);++ // Constraints: at least 1 visible, _more stays visible, cap 9 visible+ int newVisible = newDivIdx;+ if (newVisible < 1) return;+ if (newVisible > 9) return;+ if (newVisible > combined.length) newVisible = combined.length;+ final moreIdx = combined.indexOf('_more');+ if (moreIdx != -1 && moreIdx >= newVisible) return;++ _order+ ..clear()+ ..addAll(combined);+ _visibleCount = newVisible;});},itemBuilder: (context, i) {- final id = _order[i];+ // Divider slot - rendered as its own non-draggable list item.+ if (i == _visibleCount) {+ return Padding(+ key: const ValueKey('__DIV__'),+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),+ child: Row(children: [+ Expanded(child: Divider(color: cs.onSurface.withValues(alpha: 0.12))),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 12),+ child: Text(_moreInline ? 'Hidden' : 'In menu',+ style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.4))),+ ),+ Expanded(child: Divider(color: cs.onSurface.withValues(alpha: 0.12))),+ ]),+ );+ }++ final orderIdx = i < _visibleCount ? i : i - 1;+ final id = _order[orderIdx];final isMore = id == '_more';final def = isMore ? null : buttonDefById(id);if (def == null && !isMore) return SizedBox.shrink(key: ValueKey(id));- final isOnCard = i < _visibleCount;- final showDivider = i == _visibleCount;+ final isOnCard = orderIdx < _visibleCount;- return Column(+ return Padding(key: ValueKey(id),- mainAxisSize: MainAxisSize.min,- children: [- if (showDivider)- Padding(- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),- child: Row(children: [- Expanded(child: Divider(color: cs.onSurface.withValues(alpha: 0.12))),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 12),- child: Text(_moreInline ? 'Hidden' : 'In menu',- style: tt.labelSmall?.copyWith(color: cs.onSurface.withValues(alpha: 0.4))),- ),- Expanded(child: Divider(color: cs.onSurface.withValues(alpha: 0.12))),- ]),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 2),- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),- decoration: BoxDecoration(- color: isOnCard ? widget.accent.withValues(alpha: 0.08) : Colors.transparent,- borderRadius: BorderRadius.circular(12),+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 2),+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),+ decoration: BoxDecoration(+ color: isOnCard ? widget.accent.withValues(alpha: 0.08) : Colors.transparent,+ borderRadius: BorderRadius.circular(12),+ ),+ child: Row(children: [+ Icon(isMore ? Icons.more_horiz_rounded : def!.icon, size: 20,+ color: id == 'remove' ? Colors.red.shade300 : cs.onSurface.withValues(alpha: 0.7)),+ const SizedBox(width: 12),+ Expanded(child: Text(isMore ? 'More' : def!.label, style: tt.bodyMedium)),+ if (isOnCard)+ Padding(+ padding: const EdgeInsets.only(right: 8),+ child: Text('${orderIdx + 1}', style: tt.labelSmall?.copyWith(color: widget.accent, fontWeight: FontWeight.w700)),),- child: Row(children: [- Icon(isMore ? Icons.more_horiz_rounded : def!.icon, size: 20,- color: id == 'remove' ? Colors.red.shade300 : cs.onSurface.withValues(alpha: 0.7)),- const SizedBox(width: 12),- Expanded(child: Text(isMore ? 'More' : def!.label, style: tt.bodyMedium)),- if (isOnCard)- Padding(- padding: const EdgeInsets.only(right: 8),- child: Text('${i + 1}', style: tt.labelSmall?.copyWith(color: widget.accent, fontWeight: FontWeight.w700)),- ),- ReorderableDragStartListener(- index: i,- child: Icon(Icons.drag_handle_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.3)),- ),- ]),+ ReorderableDragStartListener(+ index: i,+ child: Icon(Icons.drag_handle_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.3)),),- ),- ],+ ]),+ ),);},),@@ -1347,6 +1372,16 @@ class CardActionDelegate {);}+ /// True when this card's EQ is actively shaping audio:+ /// - global EQ mode: any card glows when the single EQ is on+ /// - per-book mode: only cards whose book has saved EQ enabled+ Future<bool> _resolveEqHighlight(EqualizerService eq, String id) async {+ if (!eq.perItem) return eq.enabled;+ if (id == eq.currentItemId) return eq.enabled;+ final snap = await eq.loadItemSnapshot(id);+ return snap['enabled'] as bool;+ }+Widget buildCardButton(String id, Color accent, TextTheme tt, {bool compact = false, bool short = false, bool iconsOnly = false}) {final large = MediaQuery.sizeOf(context).height > 700;switch (id) {@@ -1385,10 +1420,24 @@ class CardActionDelegate {onTap: () => _openDetails(),);case 'equalizer':- return CardWideButton(- icon: Icons.equalizer_rounded, label: compact ? 'EQ' : 'Equalizer',- accent: accent, isActive: true, alwaysEnabled: true, large: large, compact: compact, iconsOnly: iconsOnly,- onTap: () => showEqualizerSheet(context, accent),+ return ListenableBuilder(+ listenable: EqualizerService(),+ builder: (_, __) {+ final eq = EqualizerService();+ return FutureBuilder<bool>(+ future: _resolveEqHighlight(eq, itemId),+ builder: (_, snap) {+ final highlighted = snap.data ?? false;+ return CardWideButton(+ icon: Icons.equalizer_rounded, label: compact ? 'EQ' : 'Equalizer',+ accent: accent, isActive: true, alwaysEnabled: true,+ highlighted: highlighted,+ large: large, compact: compact, iconsOnly: iconsOnly,+ onTap: () => showEqualizerSheet(context, accent, itemId: itemId, itemTitle: title),+ );+ },+ );+ },);case 'cast':return ListenableBuilder(@@ -1501,7 +1550,7 @@ class CardActionDelegate {case 'equalizer':return MoreMenuItem(icon: Icons.equalizer_rounded, label: 'Equalizer', accent: accent,- onTap: () { Navigator.pop(ctx); showEqualizerSheet(context, accent); },+ onTap: () { Navigator.pop(ctx); showEqualizerSheet(context, accent, itemId: itemId, itemTitle: title); },);case 'cast':return ListenableBuilder(diff --git a/lib/widgets/equalizer_sheet.dart b/lib/widgets/equalizer_sheet.dartindex b486a53a..bf2e576f 100644--- a/lib/widgets/equalizer_sheet.dart+++ b/lib/widgets/equalizer_sheet.dart@@ -2,7 +2,11 @@ import 'package:flutter/material.dart';import '../services/equalizer_service.dart';/// Show the equalizer & audio enhancements bottom sheet.-void showEqualizerSheet(BuildContext context, Color accent) {+///+/// [itemId] and [itemTitle] identify which card the sheet was opened from;+/// 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(context: context,isScrollControlled: true,@@ -13,7 +17,12 @@ void showEqualizerSheet(BuildContext context, Color accent) {initialChildSize: 0.75,minChildSize: 0.05, snap: true,maxChildSize: 0.92,- builder: (ctx, sc) => _EqualizerSheetContent(accent: accent, scrollController: sc),+ builder: (ctx, sc) => _EqualizerSheetContent(+ accent: accent,+ scrollController: sc,+ openedForItemId: itemId,+ openedForItemTitle: itemTitle,+ ),),);}@@ -21,7 +30,14 @@ void showEqualizerSheet(BuildContext context, Color accent) {class _EqualizerSheetContent extends StatefulWidget {final Color accent;final ScrollController scrollController;- const _EqualizerSheetContent({required this.accent, required this.scrollController});+ final String? openedForItemId;+ final String? openedForItemTitle;+ const _EqualizerSheetContent({+ required this.accent,+ required this.scrollController,+ this.openedForItemId,+ this.openedForItemTitle,+ });@overrideState<_EqualizerSheetContent> createState() => _EqualizerSheetContentState();@@ -30,12 +46,24 @@ class _EqualizerSheetContent extends StatefulWidget {class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {final _eq = EqualizerService();+ // Preview mode: the sheet was opened from a card whose book isn't currently+ // playing. We load that item's saved EQ into local state, render from it,+ // and write edits back to that item's storage without touching the platform+ // (which is still applying the playing book's EQ).+ bool _previewMode = false;+ bool _previewLoaded = false;+ bool _pEnabled = false;+ String _pPreset = 'flat';+ List<double> _pBands = [];+ double _pBass = 0.0, _pVirt = 0.0, _pLoud = 0.0;+ bool _pMono = false;+@overridevoid initState() {super.initState();_eq.addListener(_rebuild);- // Ensure EQ is initializedif (!_eq.available) _eq.init();+ _syncPreviewMode();}@override@@ -45,7 +73,195 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {}void _rebuild() {- if (mounted) setState(() {});+ if (!mounted) return;+ _syncPreviewMode();+ setState(() {});+ }++ void _syncPreviewMode() {+ final shouldPreview = _eq.perItem+ && widget.openedForItemId != null+ && widget.openedForItemId != _eq.currentItemId;+ if (shouldPreview && !_previewMode) {+ _previewMode = true;+ _previewLoaded = false;+ // Seed the buffer so the UI has a valid shape (correct band count)+ // until loadItemSnapshot returns. These defaults get overwritten+ // once the real saved snapshot loads.+ _pBands = List<double>.filled(_eq.bandLevels.length, 0.0);+ _pEnabled = false;+ _pPreset = 'flat';+ _pBass = 0.0;+ _pVirt = 0.0;+ _pLoud = 0.0;+ _pMono = false;+ _loadPreview();+ } else if (!shouldPreview && _previewMode) {+ _previewMode = false;+ _previewLoaded = false;+ }+ }++ Future<void> _loadPreview() async {+ final id = widget.openedForItemId;+ if (id == null) return;+ final snap = await _eq.loadItemSnapshot(id);+ if (!mounted) return;+ setState(() {+ _pEnabled = snap['enabled'] as bool;+ _pPreset = snap['preset'] as String;+ _pBass = snap['bassBoost'] as double;+ _pVirt = snap['virtualizer'] as double;+ _pLoud = snap['loudnessGain'] as double;+ _pMono = snap['mono'] as bool;+ _pBands = List<double>.from((snap['bands'] as List).cast<double>());+ _previewLoaded = true;+ });+ }++ Future<void> _savePreview() async {+ final id = widget.openedForItemId;+ if (id == null) return;+ await _eq.saveItemSnapshot(id, {+ 'enabled': _pEnabled,+ 'preset': _pPreset,+ 'bassBoost': _pBass,+ 'virtualizer': _pVirt,+ 'loudnessGain': _pLoud,+ 'mono': _pMono,+ 'bands': _pBands,+ });+ }++ // Branching getters - read from preview buffer when previewing, else service.+ bool get _vEnabled => _previewMode ? _pEnabled : _eq.enabled;+ String get _vPreset => _previewMode ? _pPreset : _eq.activePreset;+ List<double> get _vBands => _previewMode ? _pBands : _eq.bandLevels;+ double get _vBass => _previewMode ? _pBass : _eq.bassBoost;+ double get _vVirt => _previewMode ? _pVirt : _eq.virtualizer;+ double get _vLoud => _previewMode ? _pLoud : _eq.loudnessGain;+ bool get _vMono => _previewMode ? _pMono : _eq.mono;++ void _setEnabled(bool v) {+ if (_previewMode) {+ setState(() => _pEnabled = v);+ _savePreview();+ } else {+ _eq.setEnabled(v);+ }+ }++ void _applyPreset(String name) {+ if (_previewMode) {+ final curve = EqualizerService.presets[name];+ if (curve == null) return;+ setState(() {+ _pPreset = name;+ for (int i = 0; i < _pBands.length; i++) {+ final idx = (i * curve.length / _pBands.length).floor().clamp(0, curve.length - 1);+ _pBands[i] = curve[idx].clamp(_eq.minLevel, _eq.maxLevel);+ }+ });+ _savePreview();+ } else {+ _eq.applyPreset(name);+ }+ }++ void _setBand(int i, double v) {+ if (_previewMode) {+ if (i < 0 || i >= _pBands.length) return;+ setState(() {+ _pBands[i] = v.clamp(_eq.minLevel, _eq.maxLevel);+ _pPreset = 'custom';+ });+ _savePreview();+ } else {+ _eq.setBandLevel(i, v);+ }+ }++ void _setBass(double v) {+ if (_previewMode) {+ setState(() => _pBass = v.clamp(0.0, 1.0));+ _savePreview();+ } else {+ _eq.setBassBoost(v);+ }+ }++ void _setVirt(double v) {+ if (_previewMode) {+ setState(() => _pVirt = v.clamp(0.0, 1.0));+ _savePreview();+ } else {+ _eq.setVirtualizer(v);+ }+ }++ void _setLoud(double v) {+ if (_previewMode) {+ setState(() => _pLoud = v.clamp(0.0, 1.0));+ _savePreview();+ } else {+ _eq.setLoudnessGain(v);+ }+ }++ void _setMono(bool v) {+ if (_previewMode) {+ setState(() => _pMono = v);+ _savePreview();+ } else {+ _eq.setMono(v);+ }+ }++ void _resetAll() {+ if (_previewMode) {+ setState(() {+ _pPreset = 'flat';+ _pBands = List<double>.filled(_pBands.length, 0.0);+ _pBass = 0.0;+ _pVirt = 0.0;+ _pLoud = 0.0;+ _pMono = false;+ });+ _savePreview();+ } else {+ _eq.resetAll();+ }+ }++ /// Shown only in preview mode (per-book EQ on, viewing a non-playing book's+ /// settings). The sliders already reflect the correct book's EQ, but we+ /// still surface the fact that edits won't hit live playback right now.+ Widget _buildScopeBanner(ColorScheme cs, TextTheme tt, Color accent) {+ if (!_previewMode) return const SizedBox.shrink();++ final message = widget.openedForItemTitle != null+ ? 'Editing saved EQ for "${widget.openedForItemTitle}" - applies when it plays'+ : 'Editing saved EQ for this book - applies when it plays';++ return Padding(+ padding: const EdgeInsets.fromLTRB(20, 8, 20, 0),+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),+ decoration: BoxDecoration(+ color: cs.onSurfaceVariant.withValues(alpha: 0.08),+ borderRadius: BorderRadius.circular(10),+ border: Border.all(color: cs.onSurfaceVariant.withValues(alpha: 0.2)),+ ),+ child: Row(children: [+ Icon(Icons.edit_note_rounded, size: 16, color: cs.onSurfaceVariant),+ const SizedBox(width: 8),+ Expanded(+ child: Text(message, style: tt.labelSmall?.copyWith(+ color: cs.onSurface.withValues(alpha: 0.75), height: 1.3)),+ ),+ ]),+ ),+ );}@override@@ -83,14 +299,50 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {Transform.scale(scale: 0.8,child: Switch(- value: _eq.enabled,+ value: _vEnabled,activeTrackColor: accent,- onChanged: (v) => _eq.setEnabled(v),+ onChanged: (v) => _setEnabled(v),),),],),),+ // Per-book EQ toggle - lives up top so users can tell at a glance+ // whether EQ is per-book or global, and flip it without scrolling.+ Padding(+ padding: const EdgeInsets.fromLTRB(20, 4, 20, 0),+ child: GestureDetector(+ onTap: () => _eq.setPerItem(!_eq.perItem),+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),+ decoration: BoxDecoration(+ color: _eq.perItem ? accent.withValues(alpha: 0.1) : cs.onSurface.withValues(alpha: 0.04),+ borderRadius: BorderRadius.circular(10),+ border: Border.all(color: _eq.perItem ? accent.withValues(alpha: 0.3) : cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: Row(children: [+ Icon(Icons.library_music_rounded, size: 16,+ color: _eq.perItem ? accent : cs.onSurfaceVariant),+ const SizedBox(width: 8),+ Expanded(+ child: Text('Per-book EQ',+ style: tt.labelMedium?.copyWith(+ color: _eq.perItem ? accent : cs.onSurface.withValues(alpha: 0.75),+ fontWeight: FontWeight.w600)),+ ),+ Transform.scale(+ scale: 0.7,+ child: Switch(+ value: _eq.perItem,+ activeTrackColor: accent,+ onChanged: (v) => _eq.setPerItem(v),+ ),+ ),+ ]),+ ),+ ),+ ),+ _buildScopeBanner(cs, tt, accent),const SizedBox(height: 4),// ContentExpanded(@@ -106,9 +358,9 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {Wrap(spacing: 8, runSpacing: 8,children: EqualizerService.presets.keys.map((name) {- final isActive = _eq.activePreset == name;+ final isActive = _vPreset == name;return GestureDetector(- onTap: _eq.enabled ? () => _eq.applyPreset(name) : null,+ onTap: _vEnabled ? () => _applyPreset(name) : null,child: AnimatedContainer(duration: const Duration(milliseconds: 150),padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),@@ -122,7 +374,7 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {child: Text(name[0].toUpperCase() + name.substring(1),style: TextStyle(- color: _eq.enabled+ color: _vEnabled? (isActive ? accent : cs.onSurface.withValues(alpha: 0.7)): cs.onSurface.withValues(alpha: 0.24),fontSize: 12,@@ -133,11 +385,11 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {);}).toList(),),- if (_eq.activePreset == 'custom')+ if (_vPreset == 'custom')Padding(padding: const EdgeInsets.only(top: 8),child: GestureDetector(- onTap: _eq.enabled ? () => _eq.applyPreset('flat') : null,+ onTap: _vEnabled ? () => _applyPreset('flat') : null,child: Container(padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),decoration: BoxDecoration(@@ -160,16 +412,16 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {height: 200,child: Row(crossAxisAlignment: CrossAxisAlignment.stretch,- children: List.generate(_eq.bandLevels.length, (i) {+ children: List.generate(_vBands.length, (i) {return Expanded(child: _EQBandSlider(frequency: i < _eq.bandFrequencies.length ? _eq.bandFrequencies[i] : 0,- level: _eq.bandLevels[i],+ level: _vBands[i],minLevel: _eq.minLevel,maxLevel: _eq.maxLevel,accent: accent,- enabled: _eq.enabled,- onChanged: (v) => _eq.setBandLevel(i, v),+ enabled: _vEnabled,+ onChanged: (v) => _setBand(i, v),),);}),@@ -186,10 +438,10 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {_EffectRow(icon: Icons.speaker_rounded,label: 'Bass Boost',- value: _eq.bassBoost,+ value: _vBass,accent: accent,- enabled: _eq.enabled,- onChanged: (v) => _eq.setBassBoost(v),+ enabled: _vEnabled,+ onChanged: (v) => _setBass(v),),const SizedBox(height: 8),@@ -197,10 +449,10 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {_EffectRow(icon: Icons.surround_sound_rounded,label: 'Surround',- value: _eq.virtualizer,+ value: _vVirt,accent: accent,- enabled: _eq.enabled,- onChanged: (v) => _eq.setVirtualizer(v),+ enabled: _vEnabled,+ onChanged: (v) => _setVirt(v),),const SizedBox(height: 8),@@ -208,10 +460,10 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {_EffectRow(icon: Icons.volume_up_rounded,label: 'Loudness',- value: _eq.loudnessGain,+ value: _vLoud,accent: accent,- enabled: _eq.enabled,- onChanged: (v) => _eq.setLoudnessGain(v),+ enabled: _vEnabled,+ onChanged: (v) => _setLoud(v),),const SizedBox(height: 8),@@ -225,50 +477,19 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {child: Row(children: [Icon(Icons.headphones_rounded, size: 18,- color: _eq.mono ? accent.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.2)),+ color: _vMono ? accent.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.2)),const SizedBox(width: 10),Expanded(child: Text('Mono Audio', style: TextStyle(- color: _eq.mono ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24),- fontSize: 12, fontWeight: FontWeight.w500)),- ),- Transform.scale(- scale: 0.8,- child: Switch(- value: _eq.mono,- activeTrackColor: accent,- onChanged: (v) => _eq.setMono(v),- ),- ),- ],- ),- ),-- const SizedBox(height: 8),-- // Per-item EQ toggle- Container(- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),- decoration: BoxDecoration(- color: cs.onSurface.withValues(alpha: 0.04),- borderRadius: BorderRadius.circular(14),- ),- child: Row(- children: [- Icon(Icons.library_music_rounded, size: 18,- color: _eq.perItem ? accent.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.2)),- const SizedBox(width: 10),- Expanded(- child: Text('Per-book EQ', style: TextStyle(- color: _eq.perItem ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24),+ color: _vMono ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurface.withValues(alpha: 0.24),fontSize: 12, fontWeight: FontWeight.w500)),),Transform.scale(scale: 0.8,child: Switch(- value: _eq.perItem,+ value: _vMono,activeTrackColor: accent,- onChanged: (v) => _eq.setPerItem(v),+ onChanged: (v) => _setMono(v),),),],@@ -280,11 +501,11 @@ class _EqualizerSheetContentState extends State<_EqualizerSheetContent> {// Reset buttonCenter(child: TextButton.icon(- onPressed: _eq.enabled ? () => _eq.resetAll() : null,+ onPressed: _vEnabled ? () => _resetAll() : null,icon: Icon(Icons.refresh_rounded, size: 18,- color: _eq.enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12)),+ color: _vEnabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12)),label: Text('Reset All', style: TextStyle(- color: _eq.enabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12),+ color: _vEnabled ? cs.onSurfaceVariant : cs.onSurface.withValues(alpha: 0.12),fontSize: 13)),),),diff --git a/pubspec.yaml b/pubspec.yamlindex c1768961..0dc0f42a 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -1,7 +1,7 @@name: absorbdescription: An Audiobookshelf Clientpublish_to: 'none'-version: 1.8.71+88+version: 1.8.72+89# v1.8.41: JWT auth (accessToken + refreshToken), MANAGE_EXTERNAL_STORAGE removed from playstore flavor# Build scripts (run from Git Bash):# . ./build_bundle.sh - Play Store AAB (no MANAGE_EXTERNAL_STORAGE)