fix: run dart fix
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions

This commit is contained in:
Dr.Blank 2025-04-23 00:29:02 +05:30
parent 2cb00c451e
commit ad0cd6e2ad
No known key found for this signature in database
GPG key ID: BA5F87FF0560C57B
5 changed files with 49 additions and 41 deletions

View file

@ -26,7 +26,7 @@ Future<Library?> library(Ref ref, String id) async {
_logger.warning('No library found in the list of libraries'); _logger.warning('No library found in the list of libraries');
return null; return null;
} }
_logger.fine('Fetched library: ${library}'); _logger.fine('Fetched library: $library');
return library.library; return library.library;
} }

View file

@ -6,7 +6,7 @@ part of 'library_provider.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$libraryHash() => r'b62d976f8ab83b2f5823a0fb7dac52fde8fcbffc'; String _$libraryHash() => r'f8a34100acb58f02fa958c71a629577bf815710e';
/// Copied from Dart SDK /// Copied from Dart SDK
class _SystemHash { class _SystemHash {

View file

@ -33,29 +33,32 @@ class LibraryItemPage extends HookConsumerWidget {
final showFab = useState(false); final showFab = useState(false);
// Effect to listen to scroll changes and update FAB visibility // Effect to listen to scroll changes and update FAB visibility
useEffect(() { useEffect(
void listener() { () {
if (!scrollController.hasClients) { void listener() {
return; // Ensure controller is attached 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); scrollController.addListener(listener);
// Initial check in case the view starts scrolled (less likely but safe) // Initial check in case the view starts scrolled (less likely but safe)
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (scrollController.hasClients && context.mounted) { if (scrollController.hasClients && context.mounted) {
listener(); listener();
} }
}); });
// Cleanup: remove the listener when the widget is disposed // Cleanup: remove the listener when the widget is disposed
return () => scrollController.removeListener(listener); return () => scrollController.removeListener(listener);
}, [scrollController],); // Re-run effect if scrollController changes },
[scrollController],
); // Re-run effect if scrollController changes
// --- FAB Scroll-to-Top Logic --- // --- FAB Scroll-to-Top Logic ---
void scrollToTop() { void scrollToTop() {

View file

@ -21,25 +21,28 @@ class LibraryItemSliverAppBar extends HookConsumerWidget {
final showTitle = useState(false); final showTitle = useState(false);
useEffect(() { useEffect(
void listener() { () {
final shouldShow = scrollController.hasClients && void listener() {
scrollController.offset > _showTitleThreshold; final shouldShow = scrollController.hasClients &&
if (showTitle.value != shouldShow) { scrollController.offset > _showTitleThreshold;
showTitle.value = shouldShow; if (showTitle.value != shouldShow) {
showTitle.value = shouldShow;
}
} }
}
scrollController.addListener(listener); scrollController.addListener(listener);
// Trigger listener once initially in case the view starts scrolled // Trigger listener once initially in case the view starts scrolled
// (though unlikely for this specific use case, it's good practice) // (though unlikely for this specific use case, it's good practice)
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (scrollController.hasClients) { if (scrollController.hasClients) {
listener(); listener();
} }
}); });
return () => scrollController.removeListener(listener); return () => scrollController.removeListener(listener);
}, [scrollController],); },
[scrollController],
);
return SliverAppBar( return SliverAppBar(
elevation: 0, elevation: 0,
@ -62,7 +65,8 @@ class LibraryItemSliverAppBar extends HookConsumerWidget {
key: const ValueKey('title-text'), key: const ValueKey('title-text'),
item?.media.metadata.title ?? '', item?.media.metadata.title ?? '',
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodyMedium,) style: Theme.of(context).textTheme.bodyMedium,
)
: const SizedBox( : const SizedBox(
// Also give it a key for differentiation // Also give it a key for differentiation
key: ValueKey('empty-title'), key: ValueKey('empty-title'),

View file

@ -204,7 +204,8 @@ class _LibrarySelectionContent extends ConsumerWidget {
trailing: isSelected ? const Icon(Icons.check) : null, trailing: isSelected ? const Icon(Icons.check) : null,
onTap: () { onTap: () {
appLogger.info( appLogger.info(
'Selected library: ${library.name} (ID: ${library.id})'); 'Selected library: ${library.name} (ID: ${library.id})',
);
// Get current settings state // Get current settings state
final currentSettings = ref.read(apiSettingsProvider); final currentSettings = ref.read(apiSettingsProvider);
// Update the active library ID // Update the active library ID