Repository navigation
feat: add ListSection control for grouped lists - #16
Merged
Merged
Conversation
Render Ruby list_section as CupertinoListSection (insetGrouped by default, or base) on Apple platforms and as a Material card of rows with inset dividers elsewhere. Header and footer accept a string or a control; margin is applied by the renderer once. iOS separators default to the start of Ruflet list tile titles, and top_margin also applies to inset sections. CupertinoListSection and CupertinoFormSection are accepted as aliases.
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.
Ruby counterpart: AdamMusa/ruflet#32
Adds the
ListSectioncontrol (SPEC B1, P0): iOS-style grouped and inset-grouped lists, with a Material equivalent.Ruby usage
Wire
{"_c": "ListSection", "controls": [...], ...}. Aliases:CupertinoListSectionandCupertinoFormSectionmap toListSectionincontrol_type.dart.controlschildrenheader,footer(string or control)header/footertitleSmallinprimarywith padding (16,16,16,8) /bodySmallinonSurfaceVariantwith padding (16,8,16,0)variantinsetGrouped(default) orbase;inset_groupedis also acceptedCupertinoListSection.insetGrouped/CupertinoListSectionrows_bgcolordecorationcolor (SDK defaultsecondarySystemGroupedBackground)surfaceContainerLow)bgcolorbackgroundColor(defaultsystemGroupedBackground)ColoredBoxbehind the section (default none)separator_colorseparatorColorDivider.colorhas_leading(default true)divider_margin,additional_divider_margindividerMargin+additionalDividerMargin(separator start)indent=divider_margin+additional_divider_margintop_margintopMargin(default 22). insetGrouped: space above the section, see belowborder_radiusclip_behaviorclipBehavior(default hardEdge inset, none base)Material.clipBehavior(default antiAlias inset, none base)margin(common)margin.LayoutControlskips it so it applies onceEvents: none, apart from the common
on_animation_endandon_size_change. All other common layout keywords go throughLayoutControl.An empty section, with no visible rows and no header, renders
ErrorControl("ListSection needs controls or a header")on both designs. The Cupertino SDK asserts on this case.Deviations from the spec, and why
CupertinoListTile.notched. Ruflet's iOS ListTile uses the base geometry: 20 padding + 28 leading + 16 gap, so titles start at 64. The SDK defaults would leave every separator 8pt short of the title above it. Both variants now default to 20 + 44 (or 20 + 0 without leading), which is the SDK's ownbasedefault. Ruby can still override both values.divider_marginmeans the divider start, as on iOS. The spec mapped it to MaterialendIndent, which would give the same Ruby key different meanings on the two designs. Nowindent=divider_margin(default 16) +additional_divider_margin(default 56 with leading, 0 without). The defaults still produce the specced 72 / 16, and the divider starts under the ListTile title.top_marginworks on insetGrouped.CupertinoListSection.insetGroupedacceptstopMarginbut never applies it. Ruby'stop_marginadds the same grouped-background space above an inset section, so the key behaves the same on both variants and designs.border_radiuson iOS. The SDK always clips rows to its fixed 10pt superellipse. When Ruby sets a radius, the renderer passes aBoxDecorationwith that radius. It also clips the first and last rows to that radius instead of the SDK's, so a tapped row's highlight follows the drawn corners.text/switchrow therefore starts at the leading edge on both designs.Tests
test/widgets/ruby_list_section_test.dart(new, 11 tests), covering iOS and Android:CupertinoListSectionwith the insetGrouped type. Inset row x-offset is 20 on both sides. Row 2 top minus row 1 bottom is between 0 and 1 (the hairline). Header sits above the rows and footer below. Rows are clipped by the SDK'sRoundedSuperellipseBorder(radius 10). Exactly one short separator, whose line starts at row.left + 64 and sits right below row 1. In base, the separator starts exactly under the row titles. Themarginoverride moves the rows while the control's own rect stays at x=0, so margin is applied once. Colors, radius, edge-row clips and divider margins reach the SDK, andtop_marginworks on inset. A header-only section renders and an empty one shows ErrorControl. TheCupertinoListSectionalias works. No Material widget is used anywhere.surfaceContainerLow. Card inset 16. Divider count is rows-1, with indent 72 and height 1, placed right below row 1. Header text color isprimary. Base is full-bleed with radius 0 and the divider line starts under the titles. Margin is applied once. Ruby colors, radius,hard_edgeclip, divider indent andtop_marginall apply. Header-only and empty cases are covered. No Cupertino widgets.control_renderer_matrix_test.dart: adds aListSectionfixture with a header. The type renders on iOS, Android, macOS, Windows and Linux with no exception, no ErrorControl and no opposite-design widgets.verify_pr.shwith Flutter 3.41.2:The audit diff shows one changed line. It is the pre-existing ReorderableDragHandle
marginfinding, whose "literal elsewhere" example list now citescupertino_list_section.dart. It is not a new finding.Notes
page.bgcolor = "systemGroupedBackground", orspacing: 0between sections. Each section paints its own grouped background, including its margins.text_field(border: "none")still draws the default rounded border.cupertino_textfield.dartpassescopyWith(border: null), which keeps the SDK border. This affects text fields placed in sections, and is reported to the lead for Package C (which owns that file).