Repository navigation
fix: render Ruby badge on RadioGroup - #60
Merged
Merged
Conversation
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.
Summary
Ruby's
RadioGroup(materials/radiogroup_control.rb) declares the commonbadgekeyword. Its renderer (radio_group.dart) is a content wrapper that is not built onLayoutControl, andLayoutControlis the only place the engine draws a badge. Soradio_group(content, badge: "3")showed nothing, on both designs.Fix
The
RadioGroupchild (its content, or the existing missing-contentErrorControl) is now wrapped inPlatformControlBadge. Radio registration through theRadioGroupinherited registry is unchanged, because the badge sits below it.The badge uses the same
PlatformControlBadge(or the design's own badge) asLayoutControl, so it is a MaterialBadgeon Android and the Cupertino badge on iOS and macOS. The badge is placed inside anyBaseControl, soexpandstill produces the outermostExpanded. Without abadgevalue the widget tree is unchanged.This is part of E7, which covers
badgeon 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 withbadge: "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 testfound no issues. Flutter 3.41.2.Wave-2 follow-up E7 (RadioGroup)