Repository navigation
fix: read Ruby keys in the Material 2 dropdown and form field decorations - #10
Merged
Merged
Conversation
The Material 2 renderer read `hint` and `disabled_hint`, but Ruby sends `hint_content` and `disabled_hint_content`, so neither hint was ever drawn. Options also showed their `key` instead of their `text`, unlike the canonical and Cupertino dropdowns. Document the Ruby keywords DropdownButtonFormField cannot honour, and that Cupertino placeholders are text only.
Ruby TextField, CupertinoTextField and DropdownM2 send `prefix_icon_size_constraints` and `suffix_icon_size_constraints`; the shared input decoration read `prefix_icon_constraints` and `suffix_icon_constraints`, which no Ruby control sends, so both constraints were dropped.
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.
Fixes QA findings #6 (engine part) and #7. Companion Ruby PR: AdamMusa/ruflet#28 (same branch,
fix/dropdown-m2-wire).What was broken
material_dropdown_m2.dartreadhint/disabled_hint, but Ruby sendshint_content/disabled_hint_content, so neither hint was ever drawn (fix: apply Ruby layout keywords to ReorderableDragHandle #7).keyinstead of itstext. The canonical and Cupertino dropdowns showtext ?? key.buildInputDecorationreadprefix_icon_constraints/suffix_icon_constraints. No Ruby control sends those keys: TextField, CupertinoTextField and DropdownM2 all sendprefix_icon_size_constraints/suffix_icon_size_constraints. Both constraints were therefore dropped for Material TextField and DropdownM2.Rendering after this PR
DropdownM2(legacy alias, still accepted)DropdownButtonFormFieldwithhint_contentanddisabled_hint_contentwidgets. Selecting fireschangewith the valueCupertinoTextFieldwith a picker sheet and a text-onlyhint_textplaceholder. Fireschange(andselect) with the valueDropdown(what Rubydropdown/dropdown_m2/dropdownm2send)DropdownMenu, firesselect(unchanged)select(unchanged)Documented as not honoured (code comments):
text_vertical_alignandfit_parent_size, becauseDropdownButtonFormFieldhas no API for them.suffix_icon_size_constraints, becauseDropdownButtonreplaces the suffix constraints to align its select icon.hint_content/disabled_hint_content. Cupertino placeholders are text only.Decision: (b), keep
Dropdownon the wireI did not restore a
DropdownM2wire type from Ruby. The owner deliberately made it a protocol alias:def dropdown_m2(options = nil, **props) = dropdown(options, **props).%w[dropdown dropdown_m2 dropdownm2] => Components::DropdownControlinplatform_control_contracts.rb. Its KEYWORDS are the union of the Dropdown and DropdownM2 keywords.test_legacy_design_names_are_protocol_aliases_not_renderer_choices, which assertsRuflet.dropdown_m2([])emits"Dropdown".models/control_type.dartlists"DropdownM2": "Dropdown"under "Legacy and transitional protocol names … Renderers must branch on platform, never on a Material/Cupertino wire name … new SDKs emit only the canonical names."The Ruby PR therefore translates
on_changetoon_select(plusmax_menu_height,prefix_iconandselect_iconto their Dropdown spellings). With that,dropdownm2(on_change:)fires through the canonicalselectpath on both designs. This PR only fixes the legacyDropdownM2renderer, which older apps still reach, and the shared decoration keys. It adds no newtype ==branches.Tests
New
test/widgets/ruby_dropdown_m2_test.dart(7 tests). Its backend keeps the realon_<event>delivery gate:DropdownM2on Material: thehint_contentwidget shows, and optiontext(notkey) is listed. Selecting "Blue" delivers[('change', 'blue')]and updatesvalue. Whendisabled, thedisabled_hint_contentwidget shows.prefix_icon_size_constraintsreaches the decoration.DropdownM2on Cupertino: thehint_textplaceholder shows, and picking "Blue" delivers[('change', 'blue')].Dropdownas Rubydropdown_m2now sends it (on_select: true,menu_height), on Material and Cupertino: selecting delivers[('select', 'blue')], andmenu_heightis read.TextFieldreads both*_icon_size_constraintskeys.DropdownM2 is still served by the
DropdowncreateWidget case plus the raw-type branch, socontrol_renderer_matrix_testneeds no new fixture.Verification
verify_pr.sh <engine> <ruby>(Flutter 3.41.2, Ruby 4.0.5): RESULT: PASSflutter test: +702, all passed (baseline 695)flutter analyze lib test: no issues