Skip to content

Conversation

@alexskobozev
Copy link
Contributor

@alexskobozev alexskobozev commented Oct 1, 2025

This PR updates multiple package example apps to stop using deprecated groupValue and onChanged on individual Radio widgets and instead use the new RadioGroup<T> ancestor to manage the selected value and change handling.

Why

Flutter deprecated Radio.groupValue and Radio.onChanged in favor of RadioGroup, which centralizes selection state for related radios. The deprecation is currently reported across several examples in this repo (see linked issue for examples and affected packages). This PR resolves those warnings.

What changed (pattern applied across examples)

  • Wrap related Radio<T> widgets in a RadioGroup<T>(groupValue: ..., onChanged: ...).
  • Remove groupValue/onChanged from each Radio, leaving only value (+ its label UI).
    • Example (from animations demo): old three Radio widgets each had groupValue/onChanged; now they are enclosed in a single RadioGroup<SharedAxisTransitionType> and the Radio children keep just their value.

Packages (examples) updated

  • animations
  • camera
  • camera_android
  • camera_android_camerax
  • camera_avfoundation
  • google_sign_in_web
  • two_dimensional_scrollables (both table_view and tree_view)

Screenshots

N/A (UI unchanged; only wiring of radios changed).

Links

Fixes: flutter/flutter#170915


Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets (multi-package format used).
  • I [linked to at least one issue that this PR fixes] in the description above.
  • Version/CHANGELOG
  • I updated/added any relevant documentation (N/A for example code).
  • I added new tests to check the change I am making (N/A; example code only).
  • All existing and new tests are passing.

@google-cla
Copy link

google-cla bot commented Oct 1, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@alexskobozev alexskobozev changed the title Handle deprecated radio examples [animations][camera][camera_android][camera_android_camerax][camera_avfoundation][google_sign_in_web][two_dimensional_scrollables] Migrate example Radio groups to new RadioGroup API Oct 1, 2025
@alexskobozev alexskobozev marked this pull request as ready for review October 1, 2025 10:08
Refactors the `shared_axis_transition.dart` example to use a new `RadioGroup` widget. This removes the deprecated `groupValue` and `onChanged` properties from each individual `Radio` button
Refactors the camera example to use a new `RadioGroup` widget. This removes deprecated `groupValue` and `onChanged` properties from each individual `RadioListTile` and moves them to the parent `RadioGroup`.
Refactors the camera example to use a new `RadioGroup` widget. This removes deprecated `groupValue` and `onChanged` properties from each individual `RadioListTile` and moves them to the parent `RadioGroup`.
Refactors the `camera_android_camerax` example to use a new `RadioGroup` widget. This removes the deprecated `groupValue` and `onChanged` properties from each individual `RadioListTile` and moves them to the parent `RadioGroup`.
Refactors the `camera_avfoundation` example to use a new `RadioGroup` widget. This removes deprecated `onChanged` logic from each `RadioListTile` and moves it to the parent `RadioGroup`.
Refactors the `google_sign_in_web` example to use a new `RadioGroup` widget. This removes the deprecated `groupValue` and `onChanged` properties from each individual `RadioListTile` and moves them to the parent `RadioGroup`.
Refactors the `two_dimensional_scrollables` example to use a new `RadioGroup` widget. This removes the deprecated `groupValue` and `onChanged` properties from each individual `Radio` button and moves them to the parent `RadioGroup`.
@alexskobozev alexskobozev force-pushed the handle_deprecated_radio_examples branch from 4053511 to 57f7be9 Compare October 1, 2025 10:21
Removes `const` from `Text` widgets inside a `Row` that was not itself `const`, and adds `const` to the `Row` itself.
Adds `const` to constructors and curly braces to control flow statements to fix new lint warnings in the `table_explorer.dart` and `tree_explorer.dart` examples.
Formats the `main.dart` file in the example application to align with current project standards. This change primarily involves code formatting and does not alter any functionality.
@stuartmorgan-g stuartmorgan-g changed the title [animations][camera][camera_android][camera_android_camerax][camera_avfoundation][google_sign_in_web][two_dimensional_scrollables] Migrate example Radio groups to new RadioGroup API [various] Migrate example Radio groups to new RadioGroup API Oct 1, 2025
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(There's a version mismatch from the last merge, but this will still need a second review, so feel free to wait to resolve that until it has the second approval.)

Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to update the changelog/version conflicts and we can get this landed.

@justinmc
Copy link
Contributor

@alexskobozev Sorry, this has gotten a merge conflict due to another PR landing, could you update it?

@alexskobozev
Copy link
Contributor Author

@alexskobozev Sorry, this has gotten a merge conflict due to another PR landing, could you update it?

updated!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 22, 2025
@auto-submit auto-submit bot merged commit f6896e5 into flutter:main Oct 22, 2025
80 checks passed
@alexskobozev alexskobozev deleted the handle_deprecated_radio_examples branch October 23, 2025 06:25
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Oct 23, 2025
flutter/packages@d113bbc...9ec29b6

2025-10-22 [email protected] [go_router] Support for top level
`onEnter` callback. (flutter/packages#8339)
2025-10-22 [email protected] [go_router_builder] Ignore experimental
features (flutter/packages#10275)
2025-10-22 [email protected] Roll Flutter from
2d34167 to 75004a6 (39 revisions) (flutter/packages#10279)
2025-10-22 [email protected] [ci]Adds mechanism
for packages to opt in to batched release (flutter/packages#10237)
2025-10-22 [email protected] [tool] Change
gradle-check logic to enforce alignment of java versions and a minimum
(17) (flutter/packages#10206)
2025-10-22 [email protected] [various] Migrate example Radio groups
to new RadioGroup API (flutter/packages#10155)
2025-10-22 [email protected] [mustache_template] Emoji support
(flutter/packages#10110)
2025-10-22 [email protected] [image_picker] Fix
typos in error messages for android (flutter/packages#10188)
2025-10-22 [email protected] [image_picker] Fix
typos in error messages for platform interface (flutter/packages#10211)
2025-10-21 [email protected] [camera_avfoundation] Wrappers
swift migration - part 1 (flutter/packages#10119)
2025-10-21 [email protected] [go_router_builder] expand supported
versions of analyzer, build and source_gen (flutter/packages#10078)
2025-10-20 [email protected] Roll Flutter from
891d7d5 to 2d34167 (18 revisions) (flutter/packages#10268)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Oct 24, 2025
flutter/packages@d113bbc...9ec29b6

2025-10-22 [email protected] [go_router] Support for top level
`onEnter` callback. (flutter/packages#8339)
2025-10-22 [email protected] [go_router_builder] Ignore experimental
features (flutter/packages#10275)
2025-10-22 [email protected] Roll Flutter from
2d34167 to 75004a6 (39 revisions) (flutter/packages#10279)
2025-10-22 [email protected] [ci]Adds mechanism
for packages to opt in to batched release (flutter/packages#10237)
2025-10-22 [email protected] [tool] Change
gradle-check logic to enforce alignment of java versions and a minimum
(17) (flutter/packages#10206)
2025-10-22 [email protected] [various] Migrate example Radio groups
to new RadioGroup API (flutter/packages#10155)
2025-10-22 [email protected] [mustache_template] Emoji support
(flutter/packages#10110)
2025-10-22 [email protected] [image_picker] Fix
typos in error messages for android (flutter/packages#10188)
2025-10-22 [email protected] [image_picker] Fix
typos in error messages for platform interface (flutter/packages#10211)
2025-10-21 [email protected] [camera_avfoundation] Wrappers
swift migration - part 1 (flutter/packages#10119)
2025-10-21 [email protected] [go_router_builder] expand supported
versions of analyzer, build and source_gen (flutter/packages#10078)
2025-10-20 [email protected] Roll Flutter from
891d7d5 to 2d34167 (18 revisions) (flutter/packages#10268)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

* Updates examples to use the new RadioGroup API instead of deprecated Radio parameters.
* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.
* Updates README to reflect that only Android API 24+ is supported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexskobozev @stuartmorgan-g this note in the changelog and updated readme seems to be out of sync with the sdk: ^3.7.0 constraint in the camera/pubspec.yaml.

This camera 0.11.2+1 plugin release shows up as Upgradable in a Flutter project that has sdk: 3.8.1 constraint (i.e. requires to support Android 21).

If the camera plugin dropped support for Android 21 - it should not be upgradable and maybe plugin's sdk constraint need to be bumped to Dart 3.9?

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are going to comment on PRs instead of filing issues when you believe there's an issue, please use the relevant PR (which is #9851 here, not this one).

Your concern is addressed in the description of that PR:

people on older versions of Flutter, and supporting older versions of Android in their apps, will still get compatible versions, they just aren't the versions we are supporting now

This camera 0.11.2+1 plugin release shows up as Upgradable in a Flutter project that has sdk: 3.8.1 constraint (i.e. requires to support Android 21).

Yes, that is correct. 0.11.2+1 will work correctly in a project that supports Android 21.

If the camera plugin dropped support for Android 21 - it should not be upgradable

"Support" here refers to the camera plugin holistically, not the camera package specifically, and is not the same thing as "runs on". If someone files an issue today about an issue that happens when using camera* only on Android 21-23, we would close that issue saying that we no longer support Android <24, and thus, Android <24 is not supported.

We deliberately do not go into a lot of details about the specific runtime support matrix of each sub-package, because that's way to much information for the README, and the resolver will ensure that the right thing happens regardless. If someone really wants that level of detail, they can read the individual pubspecs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan-g I commented on this PR because it triggered the plugin release.

I realize that older platform plugins are pulled instead. Though for consistency with federated platform plugins the camera plugin might be better use the same sdk constraint because this note in the changelog is misleading about Android 21 support. The camera example project also has sdk 3.9 constraint.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan-g I commented on this PR because it triggered the plugin release.

And I'm asking you to please not do that. The only reason I—the person who this comment was relevant to—saw this question is because I happened to have reviewed this PR. Meanwhile it's spamming a random contributor who has nothing to do with the thing you are asking about.

In general, it is a much better idea to report issues or potential issues via the issue tracker. There is a system for routing them to the right people, instead of just hoping that the right person sees the comment.

Though for consistency with federated platform plugins the camera plugin might be better use the same sdk constraint

Anyone maintaining a federated plugin is welcome to manage their constraints however they choose to. For our plugins, we follow our documented policy of not adding artificial restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[packages] groupValue and onChanged are deprecated

7 participants