Skip to content

fix: render Ruby badge on RadioGroup - #60

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/radio-group-badge
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/radio-group-badge

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Summary

Ruby's RadioGroup (materials/radiogroup_control.rb) declares the common badge keyword. Its renderer (radio_group.dart) is a content wrapper that is not built on LayoutControl, and LayoutControl is the only place the engine draws a badge. So radio_group(content, badge: "3") showed nothing, on both designs.

Fix

The RadioGroup child (its content, or the existing missing-content ErrorControl) is now wrapped in PlatformControlBadge. Radio registration through the RadioGroup inherited registry is unchanged, because the badge sits below it.

The badge uses the same PlatformControlBadge (or the design's own badge) as LayoutControl, so it is a Material Badge on Android and the Cupertino badge on iOS and macOS. The badge is placed inside any BaseControl, so expand still produces the outermost Expanded. Without a badge value the widget tree is unchanged.

This is part of E7, which covers badge on BaseControl-only types. Each content-wrapping type gets its own PR. AlertDialog, Banner, BottomSheet and SnackBar are overlays shown outside the control's slot, so they get no badge, and AppBar is a full-width toolbar slot. These are documented as skipped.

Tests

New test/widgets/ruby_radio_group_badge_test.dart, run on iOS and Android. It wraps a 200×60 container with badge: "7" and checks that the badge label renders on the content's top-end corner: right of center and above center. Both cases failed before the fix, because no badge was rendered.

verify_pr.sh: flutter test +697, all passed (695 baseline + 2 new). flutter analyze lib test found no issues. Flutter 3.41.2.

Wave-2 follow-up E7 (RadioGroup)

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