diff --git a/lib/collections/routes.dart b/lib/collections/routes.dart index 84edf3bc..080cbd8a 100644 --- a/lib/collections/routes.dart +++ b/lib/collections/routes.dart @@ -36,7 +36,6 @@ import 'package:spotube/pages/desktop_login/desktop_login.dart'; import 'package:spotube/pages/lyrics/lyrics.dart'; import 'package:spotube/pages/root/root_app.dart'; import 'package:spotube/pages/settings/settings.dart'; -import 'package:spotube/pages/settings/library.dart'; import 'package:spotube/pages/mobile_login/mobile_login.dart'; final rootNavigatorKey = Catcher2.navigatorKey; @@ -133,12 +132,6 @@ final routerProvider = Provider((ref) { child: const BlackListPage(), ), ), - GoRoute( - path: "local_library", - pageBuilder: (context, state) => SpotubeSlidePage( - child: const LocalLibrariesPage(), - ), - ), if (!kIsWeb) GoRoute( path: "logs", diff --git a/lib/pages/library/library.dart b/lib/pages/library/library.dart index ccdb6a35..eff30348 100644 --- a/lib/pages/library/library.dart +++ b/lib/pages/library/library.dart @@ -27,7 +27,7 @@ class LibraryPage extends HookConsumerWidget { leading: ThemedButtonsTabBar( tabs: [ Tab(text: " ${context.l10n.playlists} "), - Tab(text: " ${context.l10n.local_tracks} "), + Tab(text: " ${context.l10n.local_tab} "), Tab( child: Badge( isLabelVisible: downloadingCount > 0, diff --git a/lib/pages/settings/library.dart b/lib/pages/settings/library.dart deleted file mode 100644 index c81e3d3d..00000000 --- a/lib/pages/settings/library.dart +++ /dev/null @@ -1,100 +0,0 @@ -import 'package:file_picker/file_picker.dart'; -import 'package:file_selector/file_selector.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_desktop_tools/flutter_desktop_tools.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:collection/collection.dart'; -import 'package:fuzzywuzzy/fuzzywuzzy.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; - -import 'package:spotube/collections/spotube_icons.dart'; -import 'package:spotube/components/shared/inter_scrollbar/inter_scrollbar.dart'; -import 'package:spotube/components/shared/page_window_title_bar.dart'; -import 'package:spotube/extensions/context.dart'; -import 'package:spotube/provider/blacklist_provider.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; - -class LocalLibrariesPage extends HookConsumerWidget { - const LocalLibrariesPage({super.key}); - - @override - Widget build(BuildContext context, ref) { - final controller = useScrollController(); - // final blacklist = ref.watch(blacklistProvider); - // final searchText = useState(""); - final preferencesNotifier = ref.watch(userPreferencesProvider.notifier); - final preferences = ref.watch(userPreferencesProvider); - - final addLocalLibraryLocation = useCallback(() async { - if (DesktopTools.platform.isMobile || DesktopTools.platform.isMacOS) { - final dirStr = await FilePicker.platform.getDirectoryPath( - initialDirectory: preferences.downloadLocation, - ); - if (dirStr == null) return; - preferencesNotifier.setLocalLibraryLocation([...preferences.localLibraryLocation, dirStr]); - } else { - String? dirStr = await getDirectoryPath( - initialDirectory: preferences.downloadLocation, - ); - if (dirStr == null) return; - preferencesNotifier.setLocalLibraryLocation([...preferences.localLibraryLocation, dirStr]); - } - }, [preferences.localLibraryLocation]); - - final removeLocalLibraryLocation = useCallback((int index) { - if (index < 0 || index >= preferences.localLibraryLocation.length) return; - preferencesNotifier.setLocalLibraryLocation([...preferences.localLibraryLocation]..removeAt(index)); - }, [preferences.localLibraryLocation]); - - return Scaffold( - appBar: PageWindowTitleBar( - title: Text(context.l10n.local_library), - centerTitle: true, - leading: const BackButton(), - ), - body: Column( - mainAxisSize: MainAxisSize.min, - children: [ - /* Padding( - padding: const EdgeInsets.all(8.0), - child: TextField( - onChanged: (value) => searchText.value = value, - decoration: InputDecoration( - hintText: context.l10n.search, - prefixIcon: const Icon(SpotubeIcons.search), - ), - ), - ), */ - Padding( - padding: const EdgeInsets.all(8.0), - child: FilledButton( - child: const Icon(SpotubeIcons.add), - onPressed: addLocalLibraryLocation, - ), - ), - InterScrollbar( - controller: controller, - child: ListView.builder( - controller: controller, - shrinkWrap: true, - itemCount: preferences.localLibraryLocation.length, - itemBuilder: (context, index) { - final item = preferences.localLibraryLocation.elementAt(index); - return ListTile( - title: Text(item), - trailing: Tooltip( - message: context.l10n.remove_library_location, - child: IconButton( - icon: Icon(SpotubeIcons.trash, color: Colors.red[400]), - onPressed: () => removeLocalLibraryLocation(index), - ), - ), - ); - }, - ), - ), - ], - ), - ); - } -} diff --git a/lib/pages/settings/sections/downloads.dart b/lib/pages/settings/sections/downloads.dart index 30a730ca..3092ed03 100644 --- a/lib/pages/settings/sections/downloads.dart +++ b/lib/pages/settings/sections/downloads.dart @@ -47,15 +47,6 @@ class SettingsDownloadsSection extends HookConsumerWidget { ), onTap: pickDownloadLocation, ), - ListTile( - leading: const Icon(SpotubeIcons.folder), - title: Text(context.l10n.local_library), - subtitle: Text(context.l10n.local_library_description), - onTap: () { - GoRouter.of(context).push("/settings/local_library"); - }, - trailing: const Icon(SpotubeIcons.angleRight), - ), ], ); }