Skip to content

feat: add list_section control for grouped lists - #32

Merged
AdamMusa merged 2 commits into
mainfrom
feat/list-section
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
mainfrom
feat/list-section

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Engine counterpart: AdamMusa/ruflet-engine#16

Adds the list_section control (SPEC B1, P0) for iOS settings-style grouped lists. It renders as CupertinoListSection on Apple platforms and as a Material card of rows elsewhere.

Usage

page.bgcolor = "systemGroupedBackground"
page.add(
  list_section(header: "Account", footer: "Signed in as #{user.email}") do
    list_tile(title: "Profile", leading: icon("person"), on_click: ->(_e) { page.go("/profile") })
    list_tile(title: "Notifications", trailing: switch(value: true), toggle_inputs: true)
  end
)

list_section([list_tile(title: "Wi-Fi"), list_tile(title: "Bluetooth")], variant: "base", has_leading: false)

Children can be passed positionally, as children: or controls:, or from a block, the same way as column. listsection is the compact alias.

Schema

  • Ruby: controls/shared/listsection_control.rb, ListSectionControl, TYPE = "listsection", WIRE = "ListSection". It is registered as list_section and listsection in the shared and top-level CLASS_MAPs. DSL helpers are added in material_control_methods.rb, shared_control_forwarders.rb and dsl.rb.
  • KEYWORDS: additional_divider_margin bgcolor border_radius clip_behavior controls divider_margin footer has_leading header rows_bgcolor separator_color top_margin variant, plus the common layout set (align animate_* aspect_ratio badge bottom col data disabled expand expand_loose height key left margin offset opacity right rotate rtl scale size_change_interval tooltip top visible width).
  • Events: on_animation_end and on_size_change only, both from the common layout set.
  • Default: variant: "insetGrouped", the D-8 deviation from Flutter's base constructor. It is sent explicitly so every renderer sees the intended variant.
  • header and footer take a String or any control.

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

Tests

  • test/list_section_compatibility_test.rb (new): 10 runs, 45 assertions. It checks the wire type ListSection, every key's serialization (with colors lowercased), the insetGrouped default, control-valued header and footer, block/positional/children:/controls: children, the listsection alias, the Ruflet::DSL::App helper, the common layout keywords and the has_handler? events. It also checks that unknown keywords and events raise ArgumentError, and that both spellings resolve to the same class in both CLASS_MAPs.

verify_pr.sh:

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         +711: All tests passed!
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     ListSection: 0 findings, full Material/Cupertino parity

Template conformance counts (386/348/205) are left for the integrator to regenerate, per D-5/R12.

Add ListSectionControl (wire ListSection) with header, footer, variant,
row/background/separator colors, divider margins, has_leading, top_margin,
border_radius, clip_behavior and the common layout keywords. The
list_section/listsection helpers take children positionally, as children:
or controls:, or from a block like column. variant defaults to insetGrouped.
@AdamMusa
AdamMusa merged commit 88c1ec0 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