Skip to content

[material_ui] Migrate Checkbox, CheckboxListTile, Radio, and RadioListTile API doc snippets to {@example} (batch 9) - #13112

Open
dkwingsmt wants to merge 2 commits into
flutter:mainfrom
dkwingsmt:snippet_material_checkbox_radio
Open

dkwingsmt wants to merge 2 commits into
flutter:mainfrom
dkwingsmt:snippet_material_checkbox_radio

Conversation

@dkwingsmt

@dkwingsmt dkwingsmt commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses batch 9 of the migration detailed in flutter/flutter#188530 (comment).

Non-trivial changes:

  • None

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request extracts inline code snippets from the documentation of Checkbox, CheckboxListTile, Radio, and RadioListTile into dedicated snippet files within the example package, and introduces corresponding widget tests. Feedback on the changes suggests simplifying the Checkbox snippet by removing private getters inside the snippet body to improve the readability and usability of the generated API documentation.

Comment on lines +12 to +25
final ValueChanged<bool?>? onChanged;

ValueChanged<bool?>? get _nullableOnChanged => onChanged;
bool get _value => true;

@override
Widget build(BuildContext context) {
return
// #region body
Checkbox(
value: _value,
// If `onChanged` is null, this checkbox is disabled.
// If `onChanged` is not null, this checkbox is enabled.
onChanged: _nullableOnChanged,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of private getters _value and _nullableOnChanged in the snippet body makes the generated API documentation less readable and harder to copy-paste directly, as these getters are defined outside the #region body and are not standard. Since onChanged is already nullable and value is always true in the tests, we can use true and onChanged directly in the Checkbox widget.

Suggested change
final ValueChanged<bool?>? onChanged;
ValueChanged<bool?>? get _nullableOnChanged => onChanged;
bool get _value => true;
@override
Widget build(BuildContext context) {
return
// #region body
Checkbox(
value: _value,
// If `onChanged` is null, this checkbox is disabled.
// If `onChanged` is not null, this checkbox is enabled.
onChanged: _nullableOnChanged,
final ValueChanged<bool?>? onChanged;
@override
Widget build(BuildContext context) {
return
// #region body
Checkbox(
value: true,
// If `onChanged` is null, this checkbox is disabled.
// If `onChanged` is not null, this checkbox is enabled.
onChanged: onChanged,

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 2, 2026

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@QuncCccccc QuncCccccc added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Oct 3, 2026
@QuncCccccc
QuncCccccc force-pushed the snippet_material_checkbox_radio branch from 6d5cf79 to c4e8b48 Compare October 3, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants