Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Remove dead code and unused dependencies

Barnabasacb8303ee5da
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 136abd73..2600cb67 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -34,7 +34,6 @@ import '../widgets/tips_sheet.dart';
import '../widgets/feature_hint.dart';
import '../widgets/welcome_sheet.dart';
import '../widgets/rmab_config_sheet.dart';
-import '../widgets/queue_playlist_picker_sheet.dart';
import '../l10n/app_localizations.dart';
class SettingsScreen extends StatefulWidget {
@@ -235,48 +234,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
PlayerSettings.notifySettingsChanged();
}
- Widget _buildActivePlaylistRow(
- ColorScheme cs,
- TextTheme tt,
- LibraryProvider lib,
- AppLocalizations l,
- ) {
- String name = l.queuePlaylistNone;
- if (_queuePlaylistId != null) {
- final match = lib.playlists.cast<Map<String, dynamic>>().where(
- (p) => p['id'] == _queuePlaylistId,
- ).firstOrNull;
- final n = match?['name'] as String?;
- if (n != null && n.isNotEmpty) name = n;
- }
- return Container(
- padding: const EdgeInsets.fromLTRB(10, 4, 4, 4),
- decoration: BoxDecoration(
- color: cs.primaryContainer.withValues(alpha: 0.45),
- borderRadius: BorderRadius.circular(12),
- border: Border.all(color: cs.primary.withValues(alpha: 0.25), width: 0.5),
- ),
- child: Row(children: [
- Icon(Icons.playlist_play_rounded, size: 16, color: cs.primary),
- const SizedBox(width: 8),
- Expanded(child: Text(
- name,
- style: tt.bodySmall?.copyWith(color: cs.onPrimaryContainer, fontWeight: FontWeight.w600),
- maxLines: 1, overflow: TextOverflow.ellipsis,
- )),
- IconButton(
- icon: const Icon(Icons.close_rounded, size: 16),
- color: cs.onPrimaryContainer.withValues(alpha: 0.7),
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
- visualDensity: VisualDensity.compact,
- tooltip: l.exit,
- onPressed: () => PlayerSettings.clearQueueModePlaylist(),
- ),
- ]),
- );
- }
-
Future<void> _setMergedQueueMode(String mode) async {
if (mode == 'playlist') return _enterPlaylistMode();
await PlayerSettings.setBookQueueMode(mode);
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index b70100a4..552254b2 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -936,23 +936,6 @@ class ApiService {
);
}
- /// DELETE /api/me/progress/:id — fully remove progress entry
- Future<bool> deleteProgress(String itemId) async {
- try {
- final progressPath = itemId.length > 36
- ? '${itemId.substring(0, 36)}/${itemId.substring(37)}'
- : itemId;
- final resp = await _authDelete(
- Uri.parse('$_cleanBaseUrl/api/me/progress/$progressPath'),
- timeout: const Duration(seconds: 10));
- debugPrint('[API] deleteProgress response: ${resp.statusCode} ${resp.body}');
- return resp.statusCode >= 200 && resp.statusCode < 300;
- } catch (e) {
- debugPrint('[API] deleteProgress error: $e');
- return false;
- }
- }
-
/// Reset progress to zero.
Future<bool> resetProgress(String itemId, double duration) async {
try {
diff --git a/lib/widgets/queue_playlist_picker_sheet.dart b/lib/widgets/queue_playlist_picker_sheet.dart
deleted file mode 100644
index 2966cd61..00000000
--- a/lib/widgets/queue_playlist_picker_sheet.dart
+++ /dev/null
@@ -1,153 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:provider/provider.dart';
-import '../l10n/app_localizations.dart';
-import '../providers/library_provider.dart';
-import '../services/audio_player_service.dart';
-
-/// Bottom sheet that lets the user pick which playlist drives the playlist
-/// queue mode. Writes the choice via [PlayerSettings.setQueuePlaylistId];
-/// callers are responsible for flipping `bookQueueMode`/`podcastQueueMode`
-/// to `'playlist'` if they want to *enter* playlist mode at the same time.
-class QueuePlaylistPickerSheet extends StatefulWidget {
- const QueuePlaylistPickerSheet({super.key});
-
- static Future<String?> show(BuildContext context) {
- return showModalBottomSheet<String?>(
- context: context,
- backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
- ),
- isScrollControlled: true,
- builder: (_) => const QueuePlaylistPickerSheet(),
- );
- }
-
- @override
- State<QueuePlaylistPickerSheet> createState() => _QueuePlaylistPickerSheetState();
-}
-
-class _QueuePlaylistPickerSheetState extends State<QueuePlaylistPickerSheet> {
- String? _activeId;
- bool _loadedActive = false;
-
- @override
- void initState() {
- super.initState();
- _loadActive();
- // Make sure the playlist list is current.
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (mounted) context.read<LibraryProvider>().loadPlaylists();
- });
- }
-
- Future<void> _loadActive() async {
- final id = await PlayerSettings.getQueuePlaylistId();
- if (mounted) setState(() {
- _activeId = id;
- _loadedActive = true;
- });
- }
-
- Future<void> _choose(String id) async {
- await PlayerSettings.setQueuePlaylistId(id);
- if (mounted) Navigator.pop(context, id);
- }
-
- @override
- Widget build(BuildContext context) {
- final cs = Theme.of(context).colorScheme;
- final tt = Theme.of(context).textTheme;
- final l = AppLocalizations.of(context)!;
- final lib = context.watch<LibraryProvider>();
- final playlists = lib.playlists;
-
- return SafeArea(
- child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
- 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),
- ),
- )),
- Text(l.queuePlaylistPickerTitle, style: tt.titleMedium?.copyWith(
- color: cs.onSurface, fontWeight: FontWeight.w600,
- )),
- const SizedBox(height: 12),
- if (lib.isLoadingPlaylists && playlists.isEmpty)
- const Padding(
- padding: EdgeInsets.symmetric(vertical: 32),
- child: CircularProgressIndicator(strokeWidth: 2),
- )
- else if (playlists.isEmpty)
- Padding(
- padding: const EdgeInsets.symmetric(vertical: 32),
- child: Text(l.queuePlaylistNone, style: tt.bodyMedium?.copyWith(
- color: cs.onSurfaceVariant,
- )),
- )
- else
- ConstrainedBox(
- constraints: BoxConstraints(
- maxHeight: MediaQuery.of(context).size.height * 0.6,
- ),
- child: ListView.builder(
- shrinkWrap: true,
- itemCount: playlists.length,
- itemBuilder: (_, i) {
- final p = playlists[i] as Map<String, dynamic>;
- final id = p['id'] as String? ?? '';
- final name = p['name'] as String? ?? l.playlistPickerPlaylistFallback;
- final items = (p['items'] as List<dynamic>?) ?? const [];
- final active = _loadedActive && id == _activeId;
- return Padding(
- padding: const EdgeInsets.only(bottom: 6),
- child: GestureDetector(
- onTap: id.isEmpty ? null : () => _choose(id),
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
- decoration: BoxDecoration(
- color: cs.onSurface.withValues(alpha: active ? 0.10 : 0.06),
- borderRadius: BorderRadius.circular(14),
- border: Border.all(
- color: active
- ? cs.primary.withValues(alpha: 0.5)
- : cs.onSurface.withValues(alpha: 0.1),
- ),
- ),
- child: Row(children: [
- Icon(
- active ? Icons.check_circle_rounded : Icons.playlist_play_rounded,
- size: 18,
- color: active ? cs.primary : cs.onSurfaceVariant,
- ),
- const SizedBox(width: 10),
- Expanded(child: Text(
- name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: tt.bodyMedium?.copyWith(
- color: cs.onSurface,
- fontWeight: active ? FontWeight.w600 : FontWeight.w500,
- ),
- )),
- Text(
- l.playlistDetailItemCount(items.length),
- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant),
- ),
- ]),
- ),
- ),
- );
- },
- ),
- ),
- ]),
- ),
- );
- }
-}
diff --git a/pubspec.lock b/pubspec.lock
index 4e478010..45200a7e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -224,14 +224,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.3"
- dynamic_color:
- dependency: "direct main"
- description:
- name: dynamic_color
- sha256: "43a5a6679649a7731ab860334a5812f2067c2d9ce6452cf069c5e0c25336c17c"
- url: "https://pub.dev"
- source: hosted
- version: "1.8.1"
fading_edge_scrollview:
dependency: transitive
description:
@@ -570,14 +562,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.13.0"
- material_design_icons_flutter:
- dependency: "direct main"
- description:
- name: material_design_icons_flutter
- sha256: "6f986b7a51f3ad4c00e33c5c84e8de1bdd140489bbcdc8b66fc1283dad4dea5a"
- url: "https://pub.dev"
- source: hosted
- version: "7.0.7296"
meta:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 808e973b..08632646 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -23,15 +23,9 @@ dependencies:
# Storage
shared_preferences: ^2.2.2
- # Dynamic Color (Material You)
- dynamic_color: ^1.6.8
-
# Image caching
cached_network_image: ^3.3.0
-
- # Icons
- material_design_icons_flutter: ^7.0.7296
-
+
# Audio playback
just_audio:
path: packages/just_audio