Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Fill the whole screen with books on tablets instead of waiting for a scroll

Barnabas1ed97464729e
diff --git a/lib/widgets/library_books_tab.dart b/lib/widgets/library_books_tab.dart
index 8fe28dff..0c879c8a 100644
--- a/lib/widgets/library_books_tab.dart
+++ b/lib/widgets/library_books_tab.dart
@@ -149,6 +149,20 @@ class LibraryBooksTab extends StatelessWidget {
);
}
+ // On a tall/wide viewport (tablets) the first page often doesn't fill the
+ // screen, so nothing scrolls and the bottom-trigger below never fires. After
+ // layout, if the grid isn't scrollable yet and there's more to load, pull
+ // the next page. Repeats on each rebuild until the viewport fills or we run
+ // out of items.
+ if (hasMore && !isLoadingPage && items.isNotEmpty) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ final c = scrollController;
+ if (c != null && c.hasClients && c.position.maxScrollExtent <= 0) {
+ onLoadMore();
+ }
+ });
+ }
+
return NotificationListener<ScrollNotification>(
onNotification: (n) {
if (n is ScrollUpdateNotification &&
diff --git a/lib/widgets/library_series_tab.dart b/lib/widgets/library_series_tab.dart
index 4b6d143b..f8d2db40 100644
--- a/lib/widgets/library_series_tab.dart
+++ b/lib/widgets/library_series_tab.dart
@@ -107,6 +107,18 @@ class LibrarySeriesTab extends StatelessWidget {
);
}
+ // Tablets: the first page may not fill the screen, so nothing scrolls and
+ // the bottom-trigger never fires. After layout, if the grid isn't scrollable
+ // yet and there's more to load, pull the next page until the viewport fills.
+ if (hasMoreSeries && !isLoadingSeriesPage && seriesItems.isNotEmpty) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ final c = scrollController;
+ if (c != null && c.hasClients && c.position.maxScrollExtent <= 0) {
+ onLoadMore();
+ }
+ });
+ }
+
return NotificationListener<ScrollNotification>(
onNotification: (n) {
if (n is ScrollUpdateNotification &&
diff --git a/pubspec.yaml b/pubspec.yaml
index 600ea031..3f07c384 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: An Audiobookshelf Client
publish_to: 'none'
-version: 1.9.1+194
+version: 1.9.1+195
environment:
sdk: '>=3.1.0 <4.0.0'