Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
32a6914
[animations] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
64064df
[camera] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
157a932
[camera] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
8109fb3
[camera_android_camerax] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
bc09c33
[camera_avfoundation] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
dfc6124
[google_sign_in_web] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
57f7be9
[two_dimensional_scrollables] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
7b2db36
Fix lints in animations example
alexskobozev Oct 1, 2025
fe84be7
[two_dimensional_scrollables] Fix lints in examples
alexskobozev Oct 1, 2025
b813cf9
[camera_avfoundation] Format example `main.dart`
alexskobozev Oct 1, 2025
5bcf490
Adds miscellaneous formatting fixes
alexskobozev Oct 1, 2025
c6cdb22
Merge remote-tracking branch 'upstream/main' into handle_deprecated_r…
alexskobozev Oct 2, 2025
f6b2de3
Update changelogs
alexskobozev Oct 2, 2025
09df509
Revert "Update changelogs"
alexskobozev Oct 3, 2025
7b2347e
Merge remote-tracking branch 'upstream/main' into handle_deprecated_r…
alexskobozev Oct 3, 2025
6c5c615
[google_sign_in_web] Disable RadioListTile when onChanged is null
alexskobozev Oct 3, 2025
3234a2b
[camera_avfoundation] Disable camera selection during recording
alexskobozev Oct 3, 2025
aaba578
Update changelogs
alexskobozev Oct 3, 2025
5e347e4
[google_sign_in_web] Simplify `onChanged` callback in example
alexskobozev Oct 6, 2025
3ded134
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 6, 2025
2a923fe
[google_sign_in_web] Update onChanged callback in example: pass it as…
alexskobozev Oct 7, 2025
71f6c80
Merge remote-tracking branch 'origin/handle_deprecated_radio_examples…
alexskobozev Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/animations/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we not want to release the updated sample code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

pub.dev only shows lib/main.dart, and the changes in this package aren't to that file, so publishing wouldn't do anything (unless people are running examples out of their pub cache, but that's not something we expect/support in the repo policy).


* 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.

## 2.0.11
Expand Down
50 changes: 22 additions & 28 deletions packages/animations/example/lib/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,34 +76,28 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
),
),
const Divider(thickness: 2.0),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.horizontal,
groupValue: _transitionType,
onChanged: (SharedAxisTransitionType? newValue) {
_updateTransitionType(newValue);
},
),
const Text('X'),
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.vertical,
groupValue: _transitionType,
onChanged: (SharedAxisTransitionType? newValue) {
_updateTransitionType(newValue);
},
),
const Text('Y'),
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.scaled,
groupValue: _transitionType,
onChanged: (SharedAxisTransitionType? newValue) {
_updateTransitionType(newValue);
},
),
const Text('Z'),
],
RadioGroup<SharedAxisTransitionType>(
groupValue: _transitionType,
onChanged: (SharedAxisTransitionType? newValue) {
_updateTransitionType(newValue);
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.horizontal,
),
Text('X'),
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.vertical,
),
Text('Y'),
Radio<SharedAxisTransitionType>(
value: SharedAxisTransitionType.scaled,
),
Text('Z'),
],
),
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.11.2+1

* 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.

Expand Down
8 changes: 5 additions & 3 deletions packages/camera/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
groupValue: controller?.description,
value: cameraDescription,
onChanged: onChanged,
),
),
);
Expand All @@ -610,7 +608,11 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
return Expanded(
child: SizedBox(
height: 56.0,
child: ListView(scrollDirection: Axis.horizontal, children: toggles),
child: RadioGroup<CameraDescription>(
groupValue: controller?.description,
onChanged: onChanged,
child: ListView(scrollDirection: Axis.horizontal, children: toggles),
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.11.2
version: 0.11.2+1

environment:
sdk: ^3.7.0
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.10+9

* Updates examples to use the new RadioGroup API instead of deprecated Radio parameters.

## 0.10.10+8

* Restores compileSdk version to flutter.compileSdkVersion.
Expand Down
8 changes: 5 additions & 3 deletions packages/camera/camera_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,18 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
groupValue: controller?.description,
value: cameraDescription,
onChanged: onChanged,
),
),
);
}
}

return Row(children: toggles);
return RadioGroup<CameraDescription>(
groupValue: controller?.description,
onChanged: onChanged,
child: Row(children: toggles),
);
}

String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22

version: 0.10.10+8
version: 0.10.10+9

environment:
sdk: ^3.9.0
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.23+1

* Updates examples to use the new RadioGroup API instead of deprecated Radio parameters.

## 0.6.23

* Converts NV21-compatible streamed images to NV21 when requested. In doing so,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,18 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
groupValue: controller?.description,
value: cameraDescription,
onChanged: onChanged,
),
),
);
}
}

return Row(children: toggles);
return RadioGroup<CameraDescription>(
groupValue: controller?.description,
onChanged: onChanged,
child: Row(children: toggles),
);
}

String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.23
version: 0.6.23+1

environment:
sdk: ^3.8.1
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_avfoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.22+1

* Updates examples to use the new RadioGroup API instead of deprecated Radio parameters.

## 0.9.22

* Adds lensType in the PlatformCameraDescription
Expand Down
47 changes: 23 additions & 24 deletions packages/camera/camera_avfoundation/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -579,38 +579,37 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
Widget _cameraTogglesRowWidget() {
final List<Widget> toggles = <Widget>[];

void onChanged(CameraDescription? description) {
if (description == null) {
return;
}

onNewCameraSelected(description);
}

if (_cameras.isEmpty) {
SchedulerBinding.instance.addPostFrameCallback((_) async {
showInSnackBar('No camera found.');
});
return const Text('None');
} else {
for (final CameraDescription cameraDescription in _cameras) {
toggles.add(
SizedBox(
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
groupValue: controller?.description,
value: cameraDescription,
onChanged: (controller?.value.isRecordingVideo ?? false)
? null
: onChanged,
),
}

final bool isRecording = controller?.value.isRecordingVideo ?? false;

for (final CameraDescription cameraDescription in _cameras) {
toggles.add(
SizedBox(
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
value: cameraDescription,
enabled: !isRecording,
),
);
}
),
);
}

return Row(children: toggles);
return RadioGroup<CameraDescription>(
groupValue: controller?.description,
onChanged: (CameraDescription? description) {
if (description != null) {
onNewCameraSelected(description);
}
},
child: Row(children: toggles),
);
}

String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_avfoundation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_avfoundation
description: iOS implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.9.22
version: 0.9.22+1

environment:
sdk: ^3.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,27 @@ Widget _renderRadioListTileCard<T extends Enum>({
}) {
return _renderConfigCard(
title: title,
children:
values
.map(
(T value) => RadioListTile<T>(
value: value,
groupValue: selected,
onChanged: onChanged,
selected: value == selected,
title: Text(value.name),
dense: true,
),
)
.toList(),
children: <Widget>[
RadioGroup<T>(
groupValue: selected,
onChanged: (T? v) => (onChanged ?? (_) {})(v),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of the wrapping function here? This seems much more complicated than just doing onChanged: onChanged ?? (_) {},

Copy link
Author

@alexskobozev alexskobozev Oct 6, 2025

Choose a reason for hiding this comment

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

Replaced this with onChanged: onChanged ?? (_) {}, but seems if we run flutter run -d chrome --target=lib/button_tester.dart radiogroup is not working. Found that onChanged ?? (_) {} just returns a function, it never calls it. That’s why the callback in RadioGroup is never triggered. The wrapper actually invokes the callback with the selected value. Without it, the radios don’t switch because nothing ever notifies the group.

Copy link
Author

Choose a reason for hiding this comment

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

But you're right, I've simplified it

Copy link
Collaborator

Choose a reason for hiding this comment

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

Found that onChanged ?? (_) {} just returns a function, it never calls it.

I don't follow. That expression is supposed to return a function without calling it, because it's providing a function as a parameter.

In this line for example, onChanged is a function reference, not a function call.

Copy link
Author

Choose a reason for hiding this comment

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

Agree, I was wrong, sorry for taking time, updated the code

child: Column(
mainAxisSize: MainAxisSize.min,
children:
values
.map(
(T value) => RadioListTile<T>(
value: value,
selected: value == selected,
title: Text(value.name),
enabled: onChanged != null,
dense: true,
),
)
.toList(),
),
),
],
);
}

Expand Down
1 change: 1 addition & 0 deletions packages/two_dimensional_scrollables/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same applies here; the changes aren't to lib/main.dart.


* 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.

## 0.3.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,27 @@ class _TableExplorerState extends State<TableExplorer> {
child: Row(
children: <Widget>[
const Spacer(),
Radio<TableType>(
value: TableType.simple,
RadioGroup<TableType>(
groupValue: _currentExample,
onChanged: (TableType? value) {
setState(() {
_currentExample = value!;
});
if (value == null) {
return;
}
setState(() => _currentExample = value);
},
child: Row(
children: <Widget>[
const Radio<TableType>(value: TableType.simple),
const Text('Simple'),
_spacer,
const Radio<TableType>(value: TableType.merged),
const Text('Merged'),
_spacer,
const Radio<TableType>(value: TableType.infinite),
const Text('Infinite'),
],
),
),
const Text('Simple'),
_spacer,
Radio<TableType>(
value: TableType.merged,
groupValue: _currentExample,
onChanged: (TableType? value) {
setState(() {
_currentExample = value!;
});
},
),
const Text('Merged'),
_spacer,
Radio<TableType>(
value: TableType.infinite,
groupValue: _currentExample,
onChanged: (TableType? value) {
setState(() {
_currentExample = value!;
});
},
),
const Text('Infinite'),
const Spacer(),
],
),
Expand Down
Loading