A cross platform Audiobookshelf client for Android and iOS
Dart
Keep the library refilling on iPad instead of stalling on a spinner until you scroll
Barnabas7d5c21bda816
diff --git a/lib/widgets/library_books_tab.dart b/lib/widgets/library_books_tab.dartindex a474d431..c359cde3 100644--- a/lib/widgets/library_books_tab.dart+++ b/lib/widgets/library_books_tab.dart@@ -187,15 +187,16 @@ 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.+ // On a tall/wide viewport (tablets) a page of results can land entirely+ // within the current screen, so nothing scrolls and the bottom-trigger+ // below never fires. After layout, keep pulling pages while there's less+ // content below the fold than the scroll-trigger's own 400px margin -+ // stopping merely at "technically scrollable" left iPads sitting on a+ // visible, forever-spinning loader until the user nudged the grid.if (hasMore && !isLoadingPage && items.isNotEmpty) {WidgetsBinding.instance.addPostFrameCallback((_) {final c = scrollController;- if (c != null && c.hasClients && c.position.maxScrollExtent <= 0) {+ if (c != null && c.hasClients && c.position.extentAfter < 400) {onLoadMore();}});diff --git a/lib/widgets/library_series_tab.dart b/lib/widgets/library_series_tab.dartindex f8d2db40..7927e82f 100644--- a/lib/widgets/library_series_tab.dart+++ b/lib/widgets/library_series_tab.dart@@ -107,13 +107,15 @@ 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.+ // Tablets: a page of results can land entirely within the current screen,+ // so nothing scrolls and the bottom-trigger never fires. After layout,+ // keep pulling pages while there's less content below the fold than the+ // scroll-trigger's own 400px margin - stopping merely at "technically+ // scrollable" left a visible, forever-spinning loader on iPads.if (hasMoreSeries && !isLoadingSeriesPage && seriesItems.isNotEmpty) {WidgetsBinding.instance.addPostFrameCallback((_) {final c = scrollController;- if (c != null && c.hasClients && c.position.maxScrollExtent <= 0) {+ if (c != null && c.hasClients && c.position.extentAfter < 400) {onLoadMore();}});