Refactor more logic from radio and cupertino radio (#167764)
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> This is in prepare for https://github.com/flutter/flutter/pull/167363 The goal for this refactoring is to make sure the new RadioGroup widget can be used for both CupertinoRadio and Radio, and thus the widget has to be in widget layer to avoid duplicating code. Currently CupertinoRadio and Radio shares ToggleableStateMixin in widget layer. but the mixin itself doesn't contains enough data to implement radioGroup. Therefore, I moved more share logic from CupertinoRadio and Radio to widget layer and created a RadioBase widget. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Showing
- packages/flutter/lib/src/cupertino/radio.dart 92 additions, 126 deletionspackages/flutter/lib/src/cupertino/radio.dart
- packages/flutter/lib/src/material/menu_anchor.dart 2 additions, 2 deletionspackages/flutter/lib/src/material/menu_anchor.dart
- packages/flutter/lib/src/material/radio.dart 144 additions, 183 deletionspackages/flutter/lib/src/material/radio.dart
- packages/flutter/lib/src/material/radio_list_tile.dart 2 additions, 2 deletionspackages/flutter/lib/src/material/radio_list_tile.dart
- packages/flutter/lib/src/material/radio_theme.dart 1 addition, 1 deletionpackages/flutter/lib/src/material/radio_theme.dart
- packages/flutter/lib/src/widgets/raw_radio.dart 206 additions, 0 deletionspackages/flutter/lib/src/widgets/raw_radio.dart
- packages/flutter/lib/src/widgets/toggleable.dart 45 additions, 1 deletionpackages/flutter/lib/src/widgets/toggleable.dart
- packages/flutter/lib/widgets.dart 1 addition, 0 deletionspackages/flutter/lib/widgets.dart
- packages/flutter/test/widgets/raw_radio_test.dart 57 additions, 0 deletionspackages/flutter/test/widgets/raw_radio_test.dart
- packages/flutter/test/widgets/toggleable_test.dart 43 additions, 1 deletionpackages/flutter/test/widgets/toggleable_test.dart
Please register or sign in to comment