diff --git a/lib/api/library_provider.dart b/lib/api/library_provider.dart index 0903015..62c79d8 100644 --- a/lib/api/library_provider.dart +++ b/lib/api/library_provider.dart @@ -26,7 +26,7 @@ Future library(Ref ref, String id) async { _logger.warning('No library found in the list of libraries'); return null; } - _logger.fine('Fetched library: ${library}'); + _logger.fine('Fetched library: $library'); return library.library; } diff --git a/lib/api/library_provider.g.dart b/lib/api/library_provider.g.dart index 8f22251..a8bc88a 100644 --- a/lib/api/library_provider.g.dart +++ b/lib/api/library_provider.g.dart @@ -6,7 +6,7 @@ part of 'library_provider.dart'; // RiverpodGenerator // ************************************************************************** -String _$libraryHash() => r'b62d976f8ab83b2f5823a0fb7dac52fde8fcbffc'; +String _$libraryHash() => r'f8a34100acb58f02fa958c71a629577bf815710e'; /// Copied from Dart SDK class _SystemHash { diff --git a/lib/features/item_viewer/view/library_item_page.dart b/lib/features/item_viewer/view/library_item_page.dart index 781e2d0..e7b9310 100644 --- a/lib/features/item_viewer/view/library_item_page.dart +++ b/lib/features/item_viewer/view/library_item_page.dart @@ -33,29 +33,32 @@ class LibraryItemPage extends HookConsumerWidget { final showFab = useState(false); // Effect to listen to scroll changes and update FAB visibility - useEffect(() { - void listener() { - if (!scrollController.hasClients) { - return; // Ensure controller is attached + useEffect( + () { + void listener() { + if (!scrollController.hasClients) { + return; // Ensure controller is attached + } + final shouldShow = scrollController.offset > _showFabThreshold; + // Update state only if it changes and widget is still mounted + if (showFab.value != shouldShow && context.mounted) { + showFab.value = shouldShow; + } } - final shouldShow = scrollController.offset > _showFabThreshold; - // Update state only if it changes and widget is still mounted - if (showFab.value != shouldShow && context.mounted) { - showFab.value = shouldShow; - } - } - scrollController.addListener(listener); - // Initial check in case the view starts scrolled (less likely but safe) - WidgetsBinding.instance.addPostFrameCallback((_) { - if (scrollController.hasClients && context.mounted) { - listener(); - } - }); + scrollController.addListener(listener); + // Initial check in case the view starts scrolled (less likely but safe) + WidgetsBinding.instance.addPostFrameCallback((_) { + if (scrollController.hasClients && context.mounted) { + listener(); + } + }); - // Cleanup: remove the listener when the widget is disposed - return () => scrollController.removeListener(listener); - }, [scrollController],); // Re-run effect if scrollController changes + // Cleanup: remove the listener when the widget is disposed + return () => scrollController.removeListener(listener); + }, + [scrollController], + ); // Re-run effect if scrollController changes // --- FAB Scroll-to-Top Logic --- void scrollToTop() { diff --git a/lib/features/item_viewer/view/library_item_sliver_app_bar.dart b/lib/features/item_viewer/view/library_item_sliver_app_bar.dart index 7fb1e83..fd6b621 100644 --- a/lib/features/item_viewer/view/library_item_sliver_app_bar.dart +++ b/lib/features/item_viewer/view/library_item_sliver_app_bar.dart @@ -21,25 +21,28 @@ class LibraryItemSliverAppBar extends HookConsumerWidget { final showTitle = useState(false); - useEffect(() { - void listener() { - final shouldShow = scrollController.hasClients && - scrollController.offset > _showTitleThreshold; - if (showTitle.value != shouldShow) { - showTitle.value = shouldShow; + useEffect( + () { + void listener() { + final shouldShow = scrollController.hasClients && + scrollController.offset > _showTitleThreshold; + if (showTitle.value != shouldShow) { + showTitle.value = shouldShow; + } } - } - scrollController.addListener(listener); - // Trigger listener once initially in case the view starts scrolled - // (though unlikely for this specific use case, it's good practice) - WidgetsBinding.instance.addPostFrameCallback((_) { - if (scrollController.hasClients) { - listener(); - } - }); - return () => scrollController.removeListener(listener); - }, [scrollController],); + scrollController.addListener(listener); + // Trigger listener once initially in case the view starts scrolled + // (though unlikely for this specific use case, it's good practice) + WidgetsBinding.instance.addPostFrameCallback((_) { + if (scrollController.hasClients) { + listener(); + } + }); + return () => scrollController.removeListener(listener); + }, + [scrollController], + ); return SliverAppBar( elevation: 0, @@ -62,7 +65,8 @@ class LibraryItemSliverAppBar extends HookConsumerWidget { key: const ValueKey('title-text'), item?.media.metadata.title ?? '', overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyMedium,) + style: Theme.of(context).textTheme.bodyMedium, + ) : const SizedBox( // Also give it a key for differentiation key: ValueKey('empty-title'), diff --git a/lib/features/you/view/widgets/library_switch_chip.dart b/lib/features/you/view/widgets/library_switch_chip.dart index 1463b8f..a673332 100644 --- a/lib/features/you/view/widgets/library_switch_chip.dart +++ b/lib/features/you/view/widgets/library_switch_chip.dart @@ -204,7 +204,8 @@ class _LibrarySelectionContent extends ConsumerWidget { trailing: isSelected ? const Icon(Icons.check) : null, onTap: () { appLogger.info( - 'Selected library: ${library.name} (ID: ${library.id})'); + 'Selected library: ${library.name} (ID: ${library.id})', + ); // Get current settings state final currentSettings = ref.read(apiSettingsProvider); // Update the active library ID