A cross platform Audiobookshelf client for Android and iOS
Dart
Remove unused widgets and fix lint warnings
Nathan Poulson4596377f689d
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dartindex 36204a08..d7faa186 100644--- a/lib/services/api_service.dart+++ b/lib/services/api_service.dart@@ -27,7 +27,7 @@ class ApiService {final String baseUrl;String _accessToken;String? _refreshToken;- bool _isLegacyToken;+ final bool _isLegacyToken;final Map<String, String> customHeaders;/// Called after a successful token refresh so the auth layer can persist.diff --git a/lib/services/socket_service.dart b/lib/services/socket_service.dartindex ec560cae..8eb42b36 100644--- a/lib/services/socket_service.dart+++ b/lib/services/socket_service.dart@@ -1,12 +1,12 @@import 'package:flutter/foundation.dart';-import 'package:socket_io_client/socket_io_client.dart' as IO;+import 'package:socket_io_client/socket_io_client.dart' as io;class SocketService {static final SocketService _instance = SocketService._();factory SocketService() => _instance;SocketService._();- IO.Socket? _socket;+ io.Socket? _socket;String? _token;String? _serverUrl;DateTime? _connectedAt;@@ -16,7 +16,7 @@ class SocketService {/// Build socket.io options with capped reconnection to avoid/// hammering an unreachable server (and draining battery).- Map<String, dynamic> _buildOptions() => IO.OptionBuilder()+ Map<String, dynamic> _buildOptions() => io.OptionBuilder().setTransports(['websocket']).enableReconnection().setReconnectionDelay(1000)@@ -61,7 +61,7 @@ class SocketService {_serverUrl = serverUrl;try {- _socket = IO.io(serverUrl, _buildOptions());+ _socket = io.io(serverUrl, _buildOptions());// onConnect fires on initial connect AND every reconnect_socket!.onConnect((_) {@@ -209,7 +209,7 @@ class SocketService {debugPrint('[Socket] Soft reconnect');try {- _socket = IO.io(url, _buildOptions());+ _socket = io.io(url, _buildOptions());_socket!.onConnect((_) {_connectedAt = DateTime.now();diff --git a/lib/widgets/absorb_title.dart b/lib/widgets/absorb_title.dartdeleted file mode 100644index 9ce55cb3..00000000--- a/lib/widgets/absorb_title.dart+++ /dev/null@@ -1,19 +0,0 @@-import 'package:flutter/material.dart';--class AbsorbTitle extends StatelessWidget {- final Color? color;-- const AbsorbTitle({super.key, this.color});-- @override- Widget build(BuildContext context) {- return Text(- 'A B S O R B',- style: Theme.of(context).textTheme.labelSmall?.copyWith(- color: color ?? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.3),- letterSpacing: 4,- fontWeight: FontWeight.w300,- ),- );- }-}diff --git a/lib/widgets/library_selector.dart b/lib/widgets/library_selector.dartdeleted file mode 100644index 9b12b7fe..00000000--- a/lib/widgets/library_selector.dart+++ /dev/null@@ -1,110 +0,0 @@-import 'package:flutter/material.dart';-import 'package:provider/provider.dart';-import '../providers/library_provider.dart';--/// Maps Audiobookshelf server library icon names to Material Icons.-/// ABS uses Material Symbols names as its icon identifiers.-IconData _absIconToMaterial(String? icon, String? mediaType) {- switch (icon) {- case 'audiobookshelf':- return Icons.headphones_rounded;- case 'database':- return Icons.storage_rounded;- case 'podcast':- return Icons.podcasts_rounded;- case 'book-open':- return Icons.menu_book_rounded;- case 'music':- return Icons.music_note_rounded;- case 'radio':- return Icons.radio_rounded;- case 'book-2': // alternate book icon in some ABS versions- return Icons.auto_stories_rounded;- case 'hat-wizard':- return Icons.auto_fix_high_rounded;- case 'atom':- return Icons.science_rounded;- case 'rocket':- return Icons.rocket_launch_rounded;- case 'microphone':- case 'microphone-alt':- return Icons.mic_rounded;- default:- // Fallback based on media type- return mediaType == 'podcast'- ? Icons.podcasts_rounded- : Icons.auto_stories_rounded;- }-}--class LibrarySelectorButton extends StatelessWidget {- const LibrarySelectorButton({super.key});-- @override- Widget build(BuildContext context) {- return IconButton(- icon: const Icon(Icons.swap_horiz_rounded),- tooltip: 'Switch library',- onPressed: () => _showLibraryPicker(context),- );- }-- void _showLibraryPicker(BuildContext context) {- final lib = context.read<LibraryProvider>();- final cs = Theme.of(context).colorScheme;-- showModalBottomSheet(- context: context,- showDragHandle: true,- builder: (ctx) {- return SafeArea(- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding:- const EdgeInsets.symmetric(horizontal: 24, vertical: 8),- child: Text(- 'Select Library',- style: Theme.of(context).textTheme.titleLarge?.copyWith(- fontWeight: FontWeight.w600,- ),- ),- ),- const SizedBox(height: 8),- ...lib.libraries- .map((library) {- final id = library['id'] as String;- final name = library['name'] as String? ?? 'Library';- final icon = library['icon'] as String?;- final mediaType = library['mediaType'] as String? ?? 'book';- final isSelected = id == lib.selectedLibraryId;-- return ListTile(- leading: Icon(- _absIconToMaterial(icon, mediaType),- color: isSelected ? cs.primary : cs.onSurfaceVariant,- ),- title: Text(name),- trailing: isSelected- ? Icon(Icons.check_circle_rounded,- color: cs.primary)- : null,- selected: isSelected,- onTap: () {- Navigator.pop(ctx);- if (!isSelected) {- lib.selectLibrary(id);- }- },- );- }),- const SizedBox(height: 16),- ],- ),- );- },- );- }-}diff --git a/lib/widgets/pressable_card.dart b/lib/widgets/pressable_card.dartdeleted file mode 100644index ae2c954d..00000000--- a/lib/widgets/pressable_card.dart+++ /dev/null@@ -1,59 +0,0 @@-import 'package:flutter/material.dart';--/// Pressable wrapper that scales down slightly on tap for tactile feedback.-class PressableCard extends StatefulWidget {- final Widget child;- final VoidCallback onTap;- final double borderRadius;-- const PressableCard({- super.key,- required this.child,- required this.onTap,- this.borderRadius = 12,- });-- @override- State<PressableCard> createState() => _PressableCardState();-}--class _PressableCardState extends State<PressableCard>- with SingleTickerProviderStateMixin {- late final AnimationController _controller;- late final Animation<double> _scale;-- @override- void initState() {- super.initState();- _controller = AnimationController(- vsync: this,- duration: const Duration(milliseconds: 100),- reverseDuration: const Duration(milliseconds: 200),- );- _scale = Tween<double>(begin: 1.0, end: 0.96).animate(- CurvedAnimation(parent: _controller, curve: Curves.easeInOut),- );- }-- @override- void dispose() {- _controller.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- return GestureDetector(- onTapDown: (_) => _controller.forward(),- onTapUp: (_) {- _controller.reverse();- widget.onTap();- },- onTapCancel: () => _controller.reverse(),- child: ScaleTransition(- scale: _scale,- child: widget.child,- ),- );- }-}