Repository navigation
feat: add on_end_reached infinite scroll to scrollable controls - #30
Merged
Merged
Conversation
ListView, GridView, Column and Row with on_end_reached fire end_reached once when the trailing edge comes within end_reached_threshold (200 px by default), including right after the first layout of a short list. It re-arms when the content grows or the user scrolls more than twice the threshold away, and works with the pull-to-refresh sliver view.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Package A / A2 (
end-reached). Ruby counterpart: AdamMusa/ruflet#45.Depends on #27 (A1 pull-to-refresh): stacked so the listener also wraps the refreshable sliver view and the shared
_scrollable()wrapper. Review only the top commit,feat: add on_end_reached infinite scroll to scrollable controls.What
New neutral
controls/end_reached_listener.dart(EndReachedListener). It wraps the scroll view of ListView, GridView, Column and Row next toScrollNotificationControl, and only whenon_end_reachedis set.ScrollNotificationand toScrollMetricsNotification. The latter is dispatched after the first layout and whenever the content size changes. Only depth 0 is considered, and notifications are never absorbed.end_reachedonce whenextentAfter <= end_reached_threshold(default 200 px). That includes right after the first frame when the content is shorter than the viewport.maxScrollExtentgrows past the value it fired for (Ruby appended items), or when the user scrolls more than twice the threshold away from the end, so a failed load can be retried.reverse: truelist (chat) reaches its end at the visual top, which is the "load older messages" case.Ruby usage
Wire
on_end_reached,end_reached_threshold(float px, default 200).end_reachedwith payload{"pixels", "max_scroll_extent", "viewport_dimension"}.Material vs Cupertino
The behavior is identical. The listener is widgets-layer only and works for box scroll views,
SingleChildScrollView(Column/Row withscroll:) and the pull-to-refreshCustomScrollView. Column and Row only have a scroll view whenscroll:(or, for Column,on_refresh) is set.Tests:
test/widgets/ruby_end_reached_test.dart, 18 tests on iOS and Androidcontrolspatch fires again only when the new end is reached.on_refresh.on_end_reached.Results:
flutter test+746: All tests passed! (A1 728 + 18)flutter analyze lib test: No issues found!