Skip to content

feat: add form_row control for labeled form rows - #37

Merged
AdamMusa merged 2 commits into
mainfrom
feat/form-row
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
mainfrom
feat/form-row

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Engine counterpart: AdamMusa/ruflet-engine#21

Adds the form_row control (SPEC B2). It renders as CupertinoFormRow on Apple platforms and as a Material label-and-field row elsewhere.

Usage

list_section(header: "Payment") do
  form_row(text_field(border: "none", text_align: "end"), prefix: "Name")
  form_row(text_field(value: email, border: "none", text_align: "end"),
           prefix: "Email", helper: "We never share it", error: email_error)
end

formrow is the compact alias. content can also be passed as content:.

Schema

  • Ruby: controls/shared/formrow_control.rb, FormRowControl, TYPE = "formrow", WIRE = "FormRow". It is registered as form_row and formrow in the shared and top-level CLASS_MAPs. DSL helpers form_row(content = nil, **props) and formrow are added in material_control_methods.rb, shared_control_forwarders.rb and dsl.rb.
  • KEYWORDS: content error helper padding prefix, plus the common layout set.
  • Events: on_animation_end and on_size_change only, both from the common layout set.
  • content is required: a missing one raises ArgumentError, "form_row requires content", as context_menu does. prefix, helper and error take a String or any control.

The engine PR describes how each key renders on Material and Cupertino.

Tests

  • test/form_row_compatibility_test.rb (new): 10 runs, 33 assertions. It checks the wire type FormRow, the serialization of content, prefix, helper, error and padding, control-valued labels, the content: keyword, the required-content error, the formrow alias, the Ruflet::DSL::App helper, serialization as a child row, the common layout keywords and the has_handler? events. It also checks that unknown keywords and events raise, and that both spellings resolve to the same class in both CLASS_MAPs.

verify_pr.sh (Flutter 3.41.2):

PASS ruby:ruflet_core                   146/146 files, 628 runs   (baseline 145/145)
PASS ruby:ruflet_rails                  15/15 files, 278 runs     (html_dsl iterates every CLASS_MAP entry)
PASS engine:ruflet flutter test         +707: All tests passed!   (baseline 695 + 7 focused + 5 matrix)
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     NEW vs baseline: 0. FormRow: 0 props not read, 0 near misses, full Material/Cupertino prop parity

Add FormRowControl (wire FormRow) with content, prefix, helper, error,
padding and the common layout keywords. form_row/formrow take the field
positionally or as content:, and raise when it is missing.
@AdamMusa
AdamMusa merged commit 63d2a4c into main Oct 29, 2026
5 checks passed
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