Repository navigation
feat: add pull-to-refresh to scrollable controls - #43
Merged
Merged
Conversation
ListView, GridView and Column accept on_refresh plus refresh_color, refresh_bgcolor, refresh_displacement, refresh_trigger_distance and refresh_timeout. Page#dispatch_event invokes end_refresh on the control once a refresh handler returns, also when it raises, so the native spinner stops right after the handler's patches. ScrollableMethods gains a public end_refresh for refreshes that finish later.
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 / A1 (
pull-to-refresh, P0). Engine counterpart: AdamMusa/ruflet-engine#27. Implements lead decision D-2 as approved.Depends on #31 (A0
scroll-methods): this branch is stacked on it, becauseend_refreshlives inScrollableMethods. Review only the top commit,feat: add pull-to-refresh to scrollable controls.What
ListView,GridViewandColumngainon_refreshplusrefresh_bgcolor,refresh_color,refresh_displacement,refresh_timeoutandrefresh_trigger_distance. KEYWORDS stay sorted with events last.Page#dispatch_event: the smallest diff D-2 allows. Onlycontrol.emitis wrapped:page.updatepatches go out first on the same socket, followed byend_refresh. That also happens when the handler raises; the exception still propagates. No other event is touched.ScrollableMethods#end_refresh(timeout: 10, on_result: nil)is public, for refreshes that finish later.GestureEventFactory::EVENT_CLASS_MAPgets"refresh" => GenericEvent.Usage
Wire and events
on_refresh: true,refresh_*as above.refresh(payloadnil).end_refresh(no args) is sent to the same control id.RefreshIndicator(color, bgcolor, displacement). Cupertino uses aCupertinoSliverRefreshControl(color, trigger distance). See the engine PR for the full table.Tests:
test/pull_to_refresh_compatibility_test.rb, 9 runs, 74 assertionshas_handler?(:refresh)holds, and everything is off by default. Row and misspelled keywords are rejected.patch_controlis sent, and then the last message is invokeend_refreshon that wire id. The handler seesGenericEvent.end_refresh, and the error propagates.refreshthat arrives for a control without a handler is still acknowledged, which stops a stray spinner.scrollandsize_changewith handlers send nothing, and a raisingscrollhandler sends nothing either.end_refreshmethod sends the invoke payload; on an unmounted control it returns nil.verify_pr.sh: