My widget renders a list of photos and installs a ScrollController to detect when the user scrolls to the bottom so new photos can be loaded. On some devices however the initial loaded photos don't cover the whole screen. In this case I want to load more photos until the whole screen is covered. How can I achieve that?
scrollController.addListener(() async {
final pos = scrollController.position;
final triggerFetchMoreSize = 0.9 * pos.maxScrollExtent;
if (pos.pixels > triggerFetchMoreSize) {
// scrolling to bottom detected
}
}
SingleChildScrollView(controller: scrollController,
physics: const AlwaysScrollableScrollPhysics(),
child: PhotoList());