Conversation
There was a problem hiding this comment.
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.
| 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, |
There was a problem hiding this comment.
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.
| 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, |
…tTile API doc snippets to {@example}
6d5cf79 to
c4e8b48
Compare
This PR addresses batch 9 of the migration detailed in flutter/flutter#188530 (comment).
Non-trivial changes:
Pre-Review Checklist
[shared_preferences]///).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-assistbot 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
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