Skip to content

fix: render the iOS sliding segmented control from Ruby's sliding prop - #93

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/sliding-segmented-button
Nov 2, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/sliding-segmented-button

Conversation

@AdamMusa

@AdamMusa AdamMusa commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Pairs with AdamMusa/ruflet#61 (Ruby). Not part of the control-core stack: this fixes the legacy renderer first, and the SegmentedButton migration follows on top.

Bug

Since b9e52ff7, Ruby's cupertino_sliding_segmented_button sends the canonical SegmentedButton wire type. adaptive_segmented_button.dart selected CupertinoSlidingSegmentedControl only when the raw control.type == "CupertinoSlidingSegmentedButton", which no longer matches. Every sliding control therefore rendered on iOS as the plain CupertinoSegmentedControl.

Fix

  • Declared property: the Cupertino renderer selects the sliding control from sliding, which the paired Ruby PR declares; cupertino_sliding_segmented_button defaults it to true. This follows the owner's rule that renderers branch on the platform and declared props, never on a Material or Cupertino wire name. Material has no sliding equivalent and keeps rendering SegmentedButton; sliding is ignored there.
  • Legacy clients (gems older than b9e52ff7) still send the raw CupertinoSlidingSegmentedButton wire type. control_type.dart now has an alias-properties table next to the alias map (CupertinoSlidingSegmentedButton → {sliding: true}). Control.fromMap applies it with putIfAbsent, so an explicit sliding: false still wins. No renderer needs the raw type, and the control-core migration will rely on the same normalization.
  • Where the edits sit:

Tests

test/widgets/ruby_sliding_segmented_button_test.dart (6):

  • iOS, sliding: true: renders CupertinoSlidingSegmentedControl and not the segmented control. Geometry: both segments sit side by side in the sliding track. Tapping "Two" sends change 1.
  • iOS, no sliding: renders CupertinoSegmentedControl.
  • Legacy wire name: implies sliding: true and renders the sliding control.
  • Explicit sliding: false: wins over the alias.
  • Material, sliding: true: renders SegmentedButton.
  • Table unit test: the alias-properties table.

team/verify_pr.sh with the paired ruflet branch (RUBY_PKGS="ruflet_core ruflet ruflet_server ruflet_rails"): PASS:

  • engine flutter test +1127 all passed, flutter analyze lib test no issues;
  • ruflet_core 162/162, ruflet 13/13, ruflet_server 11/11, ruflet_rails 15/15;
  • wire-key audit 0 new findings.

Gate

No open engine PR touches adaptive_segmented_button.dart or the sliding renderer.

Ruby's cupertino_sliding_segmented_button sends the canonical SegmentedButton
wire type, so the Cupertino renderer's check for the raw
CupertinoSlidingSegmentedButton wire name never matched and every sliding
control rendered as the plain segmented control on iOS. Select the sliding
control from the declared sliding property instead. Material has no sliding
equivalent and keeps rendering SegmentedButton.

Clients from before the canonical wire types still send the legacy wire
name: the alias table in control_type.dart now carries the properties an
alias implies (sliding: true for CupertinoSlidingSegmentedButton), applied
when the Control is built, so no renderer branches on a wire name.
Brings in the PRs merged since, so #93 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
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.

2 participants