Repository navigation
fix: fire long_press from Cupertino list tiles - #6
Merged
AdamMusa merged 2 commits intoOct 28, 2026
Merged
Conversation
CupertinoListTile only fired "click", so list_tile(on_long_press:) never reached Ruby on iOS or macOS. The forked RufletCupertinoListTile now takes an onLongPress callback, and the control fires "long_press" when on_long_press is set and the tile is enabled, matching the Material ListTile renderer. A tile with only on_long_press now gets a gesture detector too, and the pressed highlight is cleared when the long press wins the gesture arena.
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.
Summary
Ruby's
list_tile(on_long_press: ...)sendson_long_press: true. On Android, Windows, Linux and web, the Material renderer fires"long_press"(list_tile.dart:53-58). On iOS and macOS,cupertino_list_tile.dartonly wiredonTap, which fires"click". The forkedRufletCupertinoListTilewidget had no long-press callback, soon_long_pressnever fired on Apple platforms. A tile with onlyon_long_press(noon_click) did not get a gesture detector at all.Fix
widgets/ruflet_cupertino_list_tile.dart: both constructors take anonLongPresscallback. The widget wraps itself in aGestureDetectorwhen eitheronTaporonLongPressis set. The tap highlight callbacks are only registered whenonTapis set. When a long press wins the gesture arena,onTapCancelclears the pressed highlight, so the tile does not stay grey.controls/cupertino_list_tile.dart: whenon_long_pressis true and the control is enabled, it firescontrol.triggerEvent("long_press"). This mirrors Materiallist_tile.dart:53-58. It is passed to both the base and thenotchedtile.No wire keys change. The event name is
"long_press", the same as Material.Tests
New
test/widgets/ruby_list_tile_events_test.dartruns on iOS and macOS (Cupertino) and on Android (Material, the reference):on_click+on_long_press, base and notched tiles: a long press fires exactly['long_press'], and a tap still fires exactly['click']. On Cupertino it also checks that the tile background is back to transparent after the long press.on_long_pressonly: a long press fireslong_press, and a tap fires nothing.on_clickonly: a long press does not firelong_press.disabled: true: neither gesture fires.Before the fix, 6 of the 15 cases failed: all 3 long-press cases on both iOS and macOS. Android passed, as expected.
verify_pr.sh <engine-wt> ""(Flutter 3.41.2):flutter test: +710, all passed (695 baseline + 15 new).flutter analyze lib test: no issues found.QA finding #8 (
qa-baseline.md: "ListTile (Cupertino)on_long_press… fires only"click"").