Repository navigation
refactor: move ListTile onto the shared control core - #95
Merged
AdamMusa merged 13 commits intoNov 2, 2026
Merged
Conversation
Add the shared control kernel every control will migrate onto: a pure-data ControlSpec, PropReader as the only reader of wire keys, ControlEvents as the only event dispatcher, ControlCore/FocusableCore for client state and focus, and CoreHost as the single owner of a control's invoke listener and layout keywords (re-bound when Ruby replaces the control in place). ToggleLabel, TileToggleCore, CoreSemantics, RawProp and TextOrWidget are the neutral pieces the first migrations share. The control-core contract test checks every migrated control against rules C1-C8 (skin isolation, core purity, spec equals Ruby KEYWORDS, skin consumption, lifecycle, completeness, event and semantics parity, and a report-only legacy ratchet). The manifest starts empty; the runtime rules run against a test-only probe core and the static rules against adversarial fixtures. The JSON snapshot harness and the Ruby control surface copy (with tool/sync_ruby_surface.rb) support the migration PRs.
Regenerate test/contract/ruflet_control_surface.json from ruflet main 43928509 with tools/control_surface.rb (ruflet #59). It now includes the keywords merged since the first copy, among them ListTile chevron (ruflet #38) and TextField text_input_action (ruflet #30), and the controls added since (CarouselView, DraggableScrollableSheet, FittedBox, FormRow, IndexedStack, ListSection, Table, TableRow).
Registry entries map several wire types to one host (the five Button types all build AdaptiveButtonControl), and the entry-shape rule keeps entries from reading the Control. Give ControlCore protected, read-only accessors for its canonical wire type, its parent's, and the parent property that holds it, so a core can choose its spec and rendering itself (a Button inside an AlertDialog, an IconButton in an AppBar's leading slot) while its constructor stays a plain super.control.
Add contract rule C1e for the registry entry, the one place outside the kernel that holds the Control: CoreHost(create:) must be a constructor tear-off, each PlatformControlRenderer closure builds its skin with only core: (the builder's core) and key:, choosing between skins only on the core, and control appears only as CoreHost(control:), inside the host key and in debugPrint. C2b now also bans public mutable fields and setters on cores, and C1 covers helper skin libraries. QA's evasions N1 (an entry injects wire data into a core field) and N4 (an entry passes a raw wire value to a skin) are negative fixtures; the three approved entries (Switch, Checkbox, Radio) are positive fixtures, verbatim.
Record the legacy renderers of the five Button wire types (Button, FilledButton, FilledTonalButton, OutlinedButton, TextButton) on iOS and Android as JSON snapshots: geometry, semantics, what they send to Ruby during semantics taps, label taps, long presses, mouse hover and keyboard focus, and invoke outcomes, plus icon, outlined-icon, maximal, disabled and AlertDialog action fixtures. The migration onto the shared control core may change them only as listed in its parity table.
ButtonCore now owns everything Ruby sends or receives for the Button, FilledButton, FilledTonalButton, OutlinedButton and TextButton wire types: one spec per wire type (it picks its spec and variant from its wire type), click with url, long press, hover and pressed state, focus and the focus/blur methods. The Material skin maps the core onto the five Material buttons; the Cupertino skins render CupertinoButton (plain, filled, tinted), or CupertinoDialogAction for a Button inside an AlertDialog. The registry entry has the canonical shape (create: ButtonCore.new). The legacy CupertinoButtonControl stays for the IconButton family until it migrates. Both designs now answer the blur method, iOS buttons report their enabled state to accessibility, Android OutlinedButton.icon fires hover, and an iOS alert-dialog action honors the layout keywords. Snapshots change only for those rows.
Record the legacy renderers of the four IconButton wire types (IconButton, FilledIconButton, FilledTonalIconButton, OutlinedIconButton) on iOS and Android as JSON snapshots: geometry, semantics, what they send to Ruby during semantics taps, pointer taps, long presses, mouse hover and keyboard focus, and invoke outcomes, plus selected, disabled, maximal and AppBar leading back fixtures. The migration onto the shared control core may change them only as listed in its parity table.
IconButtonCore now owns everything Ruby sends or receives for the IconButton, FilledIconButton, FilledTonalIconButton and OutlinedIconButton wire types: one spec per wire type (picked from its wire type), click with url, long press, hover and pressed state, the selected state, focus and the focus/blur methods, and whether it is an AppBar's leading button (the iOS back chevron). The Material skin maps the core onto IconButton and its variants; the Cupertino skin (the former legacy CupertinoButtonControl) renders CupertinoButton from core values. The registry entry has the canonical shape (create: IconButtonCore.new). Both designs now answer the blur method; iOS reports the enabled state to accessibility and honors selected_icon, selected_icon_color, disabled_color and enable_feedback; Android honors style and visual_density. Snapshots change only for those rows.
Record the legacy ProgressRing renderers (CircularProgressIndicator on Android, CupertinoActivityIndicator on iOS) as JSON snapshots: geometry, semantics, the native indicator's state (value, progress, radius, animating), what they send to Ruby during a tap and invoke outcomes. Fixtures cover determinate, labelled, value plus progress, maximal and layout-keyword rings, and, without settling, indeterminate, progress-only, paused and radius rings, recording whether the indicator still spins. The migration onto the shared control core may change them only as listed in its parity table.
ProgressRingCore now owns everything Ruby sends for ProgressRing (the progress_ring and cupertino_activity_indicator DSL names): one fraction for both designs (`progress` wins over `value`, clamped to 0..1) and the accessibility value both announce (`semantics_value`, or the determinate percentage). The Material skin maps the core onto CircularProgressIndicator and the Cupertino skin onto CupertinoActivityIndicator, wrapped in the same semantics the Material ring exposes. The registry entry has the canonical shape (create: ProgressRingCore.new). Android now honors `progress`; iOS announces semantics_label and the progress value to accessibility and no longer fails an assertion on an out-of-range value. Unknown methods fail fast. Snapshots change only for those rows.
Record the legacy ListTile renderers (Material ListTile on Android, the forked Cupertino list tile on iOS) as JSON snapshots: geometry, semantics, what they send to Ruby during taps, long presses, semantics taps and Tab focus, invoke outcomes, and the toggles a `toggle_inputs` tile drives. Fixtures cover defaults, every slot as text, icon and child control, the chevron, a tile without a title, disabled, selected, `padding` and `content_padding`, the Material-only and Cupertino-only keys and the layout keywords. The migration onto the shared control core may change them only as listed in its parity table.
ListTileCore now owns everything Ruby sends or receives for ListTile (the list_tile and cupertino_list_tile DSL names): what a tap does (click, url and toggling the inputs of a toggle_inputs tile, through one notifier for the core's lifetime), long press, the padding (content_padding, or Ruby's cupertino_list_tile padding) and the trailing chevron composition. The Material skin maps the core onto ListTile; the Cupertino skin onto the forked iOS list tile, reporting the same button, enabled and selected states to accessibility. The registry entry has the canonical shape (create: ListTileCore.new). Both designs now honor `padding`; iOS renders a tile without a title (it showed an error) and reports its states to accessibility. Unknown methods fail fast. Snapshots change only for those rows.
This was referenced Oct 29, 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.
Depends on #94 (ProgressRing, which stacks on #91 → #90 → #88 → #81) and on #89 (Ruby surface refresh). C3 needs #89's copy of the Ruby surface, which has ListTile's
chevron; #89 is a sibling of the stack, so this branch merges its unchanged commit 8863398 (Merge chore/refresh-ruby-surface into refactor/list-tile-control-core, no content of its own; #89 only touchestest/contract/ruflet_control_surface.json, which nothing else in the stack changes). Until those merge, this PR's diff also shows their commits; review the last two.What
Item 10 of the decoupling plan: ListTile (DSL names
list_tileandcupertino_list_tile) moves onto the shared core. Exactly two own commits after the stacking merge:test: snapshot ListTile renderer behaviour: JSON snapshots of the legacy renderers (test/widgets/list_tile_snapshot_test.dart,test/snapshots/ListTile/*.json), 14 fixtures × iOS/Android: defaults (pointer tap, long press, semantics tap, Tab,invoke focus, unfocus), every slot as text/icon (full, withadditional_info,chevron,bgcolor), every slot as a child control, chevron alone, a tile without a title, disabled,toggle_inputsdriving a trailing Switch and a leading Checkbox,padding(thecupertino_list_tilekeyword) andcontent_padding, selected, the Material-only keys, the Cupertino-only keys and the layout keywords.refactor: move ListTile onto the shared control core: the migration. Snapshots change only per the parity table below.Design
controls/list_tile_core.dart(new)listTileSpec,ListTileProps,ListTileCore. The core owns what a tap does, composed once for both designs: toggle the inputs of atoggle_inputstile (oneListTileClickNotifierfor the core's lifetime instead of a new one per skin build), openurl, fireclick; it is null while disabled or when a tap would do nothing. It also ownslong_press, the padding (content_padding, or Ruby'scupertino_list_tile(padding:)) and the trailing chevron composition (trailingWithChevron(glyph): same 6 px gap on both designs, each skin passes its native glyph).controls/list_tile.dartMaterialListTileSkin→ListTileon a transparentMaterial.controls/cupertino_list_tile.dartCupertinoListTileSkin→ the forkedRufletCupertinoListTile(base or notched), wrapped in the sameSemantics(button, selected, enabled)the MaterialListTilebuilds for itself. A tile without a title renders an empty title.controls/adaptive_list_tile.dartcreate: ListTileCore.new, C1e).Core-consumed:
trailing+chevron(composition),content_padding+padding(one padding),toggle_inputs,url. Both skins:title,subtitle,leading,bgcolor,selected(iOS: accessibility state only). Cupertino-only, with reasons:additional_info,bgcolor_activated,notched,leading_size,leading_to_title. Material-only, with reasons:autofocus,dense,is_three_line,horizontal_spacing,min_leading_width,min_vertical_padding,min_height,visual_density,style,title_alignment,shape,icon_color,text_color,selected_color,selected_tile_color,focus_color,hover_color,splash_color,enable_feedback,mouse_cursorand the three text styles. Eventsclick(onTap) andlong_press(onLongPress) are skin-sourced and wired by both skins (C4). Both skin files leavelegacy_renderers.txt.The legacy Material tile also fired
focus/blurfromonFocusChange. Ruby declares neitheron_focusnoron_blurfor ListTile (they are not in its KEYWORDS, so the backend never sent them), so the core does not declare them; nothing Ruby can observe changes.Manifest entry: title + subtitle + leading icon, native widgets
ListTile/RufletCupertinoListTile, parity scripttap native, long press,unfocus.Three existing tests (
ruby_list_tile_chevron_test.dart,ruby_list_tile_events_test.dart,ruby_list_section_test.dart) found the tile by the legacy class names; they now use the skin class names, nothing else changed.Parity changes (DC-5)
padding(thecupertino_list_tilekeyword) ignored: Dart read onlycontent_paddingpaddingis the tile padding whencontent_paddingis not sentcupertino_list_tile(padding: 30)pads on both designspadding.android,padding.ios(geometry)Semantics(button, selected, enabled)around the tile, as the MaterialListTilebuilds; the node covers the tiletitle: an ErrorControl ("CupertinoListTile.title must be provided and visible")list_tile(leading:, subtitle:)renders and taps on iOSno_title.iosinvokeon a ListTile waited for the timeout (no listener)UnsupportedErrortextdefaults.*invoke focustitle/subtitle/additional_infowas dropped (iOS: the title error)textOrWidget)Unchanged on both designs (identical snapshots): all geometry except rows 1 and 3, click/long-press payloads, disabled behaviour,
toggle_inputsdriving the Switch and Checkbox, the chevron, child-control slots, the Material-only and Cupertino-only keys, Android semantics.Tests
ruby_list_tile_chevron_test.dart,ruby_list_tile_events_test.dart,ruby_list_tile_geometry_test.dart,ruby_list_section_test.dart) pass with only the class-name update.chevronfrom chore: refresh the checked-in Ruby control surface #89), C4, C5, C6, C7 (native tap and long press on both designs, same semantics).team/verify_pr.shon head 2d77068 with ruflet 43928509 (the tree #81–#91 were verified with): PASS: engineflutter test+1186 all passed,flutter analyze lib testno issues, ruflet_core 157/157 files, wire-key audit 0 new; the one ListTile finding (prop_not_read padding) is fixed.Gate
No open PR touches
adaptive_list_tile.dart,list_tile.dart,cupertino_list_tile.dart,ruflet_cupertino_list_tile.dart,list_tile_clicks.dartor the ListTile tests; #84/#86/#87 only touch their owntest/snapshots/{Switch,Checkbox,Radio}/list_tile*.json. Checked before starting and before opening.core_manifest.dart/legacy_renderers.txt: adjacent-line conflicts with #84/#86/#87 and developer 1's SegmentedButton/picker PRs; keep both sides, entries alphabetical.