Repository navigation
refactor: move the Button family onto the shared control core - #90
Merged
AdamMusa merged 3 commits intoNov 2, 2026
Merged
Conversation
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.
AdamMusa
force-pushed
the
refactor/button-control-core
branch
from
October 29, 2026 01:47
52cb358 to
f7a7e8f
Compare
This was referenced Oct 29, 2026
Brings in the PRs merged since, so #90 merges; conflicts take the resolution tested on the full merge of the open PRs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
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 #88 (entry-shape rule, which adds
ControlCore.wireType/parentWireType), which depends on #81. Until those merge, this PR's diff also shows their commits; review the last two.What
Item 4 of the decoupling plan: the five Button wire types (Button, FilledButton, FilledTonalButton, OutlinedButton, TextButton) move onto the shared core. Exactly two own commits:
test: snapshot Button renderer behaviour: JSON snapshots of the legacy renderers (test/widgets/button_snapshot_test.dart,test/snapshots/Button/*.json). There are 10 fixtures × iOS/Android:invoke focus,invoke blur;stylemap), disabled;refactor: move the Button family onto the shared control core: the migration. Snapshots change only per the parity table below.Design
controls/button_core.dart(new)ControlSpecper wire type (shared keys;elevationonly where Ruby has it;default/destructive/text_styleon Button only).ButtonPropsand a singleButtonCore(FocusableCore). The core picks its spec andButtonVariantfromwireType, andinAlertDialogfromparentWireType(#88). It owns: click (opensurl, thenclick; non-null while enabled, like the legacy buttons); long press; hover and pressed state (oneMouseRegion+Listenerindecorate, firinghoverfor both designs); focus; thefocusandblurmethods.controls/button.dartMaterialButtonSkin-> ElevatedButton / FilledButton (+ tonal) / OutlinedButton / TextButton (+.icon).stylegoes through the existing pureparseButtonStyle(utils/buttons.dartimportedshow parseButtonStyle, not edited; #63/#76 touch it).controls/cupertino_button_skin.dart(new)CupertinoButtonSkin-> CupertinoButton (plain/filled/tinted), thestylemap resolved againstcore.states(hovered, pressed, focused, disabled), same rendering as the legacy class.controls/cupertino_dialog_action.dartCupertinoDialogActionSkin-> CupertinoDialogAction, for a Button inside an AlertDialog (a manifest helper of the Cupertino skin, so C1/C4 cover it).controls/adaptive_button.dartcreate: ButtonCore.new, and skins chosen only oncore.inAlertDialog. The key iscontrol_<wire type>_<id>, because a core serves one wire type.The legacy
CupertinoButtonControl(cupertino_button.dart) stays, unchanged, for the IconButton family (next item); it stays inlegacy_renderers.txt.button.dartandcupertino_dialog_action.dartleave it. Manifest: five entries sharing the core and skins, each with native widgets (ElevatedButton/FilledButton/OutlinedButton/TextButtonandCupertinoButton). Each parity script runstap native, a label tap, a long press, mouse hover in/out, Tab andunfocus, so it fires every core event (hover,focus,blur) on both designs.Core-consumed (
PropConsumer.core):url. Cupertino-only, with reasons:alignment,border_radius,padding,min_size,mouse_cursor,focus_color,disabled_bgcolor,opacity_on_clickandsize(Material takes these throughstyle, or has no equivalent); the dialog-action keysdefault,destructiveandtext_style.Parity changes (DC-5)
page.invoke(button, "blur")raised "Unknown Button method: blur"blurunfocuses the button (blurevent);focusunchangedblurworksinvoke blur(+ the focus flags that follow)hasEnabledState/isEnabledlike Material (disabled: not enabled); the semantics node covers the whole bordered buttonOutlinedButton.iconnever firedhover(noonHover)hovertrue/false from the core for every varianton_hoverworks on outlined icon buttonsBaseControl(opacity, tooltip, rtl, expand only)LayoutControllike every other button: width/height, margin, badge...ruby_button_keys_test.dartException("Unknown Button method: x")UnsupportedError("Button(<id>).x is not supported on <platform>: ...")_internals.stylebeforestylestyleonly_internals.styleUnchanged on both designs (identical snapshots): geometry, click/long-press payloads, hover on the other variants, focus, the disabled behaviour, icon composition, the maximal
stylerendering and the dialog action. Material keeps ignoring top-levelcolor/bgcolor/elevationunlessstyleis set (the legacyparseButtonStylecontract). The audit's 10 baseline Button findings (on_focus/on_blurnot fired on any of the five types) are fixed.Tests
test/widgets/ruby_button_keys_test.dart(4): the iOS dialog action honorsmargin(Material unchanged), andbluris a method on both designs.cupertino_control_independence_test.dart,ruby_button_attributes_test.dart) now mount the entry or findCupertinoButtonSkin; their assertions are unchanged. The pressed-style test's fixture gainson_click: true: its test backend records events without the subscription check the real backend applies, and the core only fires subscribed events.focus/blurmethods), C6, C7 (native tap, long press, hover, focus/unfocus identical on iOS and Android).team/verify_pr.shon head f7a7e8f (on #88 ba72191) with rufletorigin/main43928509: PASS: engineflutter test+1043 all passed,flutter analyze lib testno issues, ruflet_core 157/157 files, wire-key audit 0 new findings, 10 fixed.Gate
No open PR touches
adaptive_button.dart,button.dart,cupertino_dialog_action.dart,ruby_button_attributes_test.dartor the new files; checked before starting and before opening.utils/buttons.dart(#63, #76) is not edited.core_manifest.dart/legacy_renderers.txt/cupertino_control_independence_test.dartare also edited by #84/#86/#87 (adjacent lines; keep both).