fix: disabled Radio and CupertinoRadio - #6769
Merged
Merged
Conversation
disabled=True had almost no effect on a radio: it stayed fully selectable and rendered in its enabled colors — only the label grayed out, and for Radio only when a custom label_style was set. Regressed in the migration to Flutter's native RadioGroup widget (#5651): the old code disabled a radio by passing onChanged: null to the Flutter widget, but under the RadioGroup API a radio with a RadioGroup ancestor is interactive unless an explicit enabled: false is passed — Flet never passed it, so taps on the radio went straight to the group registry, bypassing Flet's disabled checks, which only guarded the label's own tap handler. Both controls now forward enabled: !disabled, so a disabled radio ignores taps and renders its disabled state (fill_color's ControlState.DISABLED value now actually resolves too), and disabling an ancestor (e.g. the whole RadioGroup) cascades the same way. The Radio label now also grays out with the default text style, not just with a custom label_style.
Deploying flet-website-v2 with
|
| Latest commit: |
b8a09a7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://544274e2.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-disabled-radio.flet-website-v2.pages.dev |
Radio and CupertinoRadioRadio and CupertinoRadio
FeodorFitsner
approved these changes
Aug 14, 2026
13 tasks
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.
disabled=Truehad almost no effect onRadioandCupertinoRadio: the radio could still be selected and kept its enabled colors — only the label grayed out (and forRadio, only when a customlabel_stylewas set).This regressed in the migration to Flutter's native
RadioGroupwidget (#5651). The old code disabled a radio by passingonChanged: nullto the Flutter widget, but under theRadioGroupAPI a radio with aRadioGroupancestor is interactive unless it gets an explicitenabled: false. Flet never passed it, so taps on the radio went straight to the group registry, bypassing thedisabledchecks that only guarded the label's own tap handler.Both controls now pass
enabled: !disabledto their Flutter widgets:fill_color'sControlState.DISABLEDvalue now actually resolves;RadioGroup) cascades down to its radios;Radio's label also grays out with the default text style now, not only with a customlabel_style.Fixes #6159
Test code
Before: "One" and "Two" render fully enabled and clicking them selects them.
After: both render grayed out (radio and label) and clicks are ignored; "Three" still works.
Summary by Sourcery
Bug Fixes: