Skip to content

fix: fire long_press from Cupertino list tiles - #6

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/cupertino-list-tile-long-press
Oct 28, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/cupertino-list-tile-long-press

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Summary

Ruby's list_tile(on_long_press: ...) sends on_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.dart only wired onTap, which fires "click". The forked RufletCupertinoListTile widget had no long-press callback, so on_long_press never fired on Apple platforms. A tile with only on_long_press (no on_click) did not get a gesture detector at all.

Fix

  • widgets/ruflet_cupertino_list_tile.dart: both constructors take an onLongPress callback. The widget wraps itself in a GestureDetector when either onTap or onLongPress is set. The tap highlight callbacks are only registered when onTap is set. When a long press wins the gesture arena, onTapCancel clears the pressed highlight, so the tile does not stay grey.
  • controls/cupertino_list_tile.dart: when on_long_press is true and the control is enabled, it fires control.triggerEvent("long_press"). This mirrors Material list_tile.dart:53-58. It is passed to both the base and the notched tile.

No wire keys change. The event name is "long_press", the same as Material.

Tests

New test/widgets/ruby_list_tile_events_test.dart runs 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_press only: a long press fires long_press, and a tap fires nothing.
  • on_click only: a long press does not fire long_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"").

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant