Repository navigation
[material_ui] Refactor typography.dart and text_theme.dart in preparation for M3E - #13371
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors TextTheme by introducing template and macro documentation tags to reduce comment duplication, and simplifies the apply method using a local helper function. It also refactors Typography.material2021 to delegate to a new _withM3Colors factory constructor, and reorganizes and expands the test suites for both classes. Feedback on the changes indicates that an assertion verifying the platform or text themes was omitted during the typography refactoring and should be restored.
22c5574 to
f7b4c49
Compare
|
|
||
| /// Largest of the display styles. | ||
| /// | ||
| /// {@template material_ui.TextTheme.displayStyle} |
There was a problem hiding this comment.
I don't have a strong opinion about {@macro} but I remember Ian once pointed out that {@macro} makes docs hard to read inline and easy to get wrong when a template is edited later (flutter/flutter#142516 (comment)
). These docs look short and clear, so I'd lean slightly towards keeping the inline docs. But either way is fine to me:)
There was a problem hiding this comment.
That makes sense! I've removed the {@macro} templates
f7b4c49 to
2bcc9e7
Compare
flutter/packages@a8549ae...13d38e0 2026-10-28 [email protected] [material_ui] Unskip long press drag test on web (flutter/packages#13358) 2026-10-28 [email protected] [google_maps_flutter_ios, pigeon, webview_flutter_wkwebview] Migrate remaining example apps to uiscene (flutter/packages#13280) 2026-10-27 [email protected] manually roll flutter and fix flaky video player test that is preventing roll from landing (flutter/packages#13465) 2026-10-27 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: data_table_test, floating_action_button_test, text_field_cursor_test (flutter/packages#13460) 2026-10-27 [email protected] [material_ui] Decouple disabled CheckboxListTile state in a11y_assessments (flutter/packages#13177) 2026-10-27 [email protected] [camera_web] Skip video input devices that cannot be started in availableCameras (flutter/packages#13196) 2026-10-27 [email protected] [camera] Add support for zero-shutter-lag capture (flutter/packages#12374) 2026-10-27 [email protected] [in_app_purchase_storekit} Fix more test flakes (flutter/packages#13279) 2026-10-27 [email protected] [material_ui] Refactor `typography.dart` and `text_theme.dart` in preparation for M3E (flutter/packages#13371) If this roll has caused a breakage, revert this CL and set the roller to dry run mode 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
flutter/packages@a8549ae...13d38e0 2026-10-28 [email protected] [material_ui] Unskip long press drag test on web (flutter/packages#13358) 2026-10-28 [email protected] [google_maps_flutter_ios, pigeon, webview_flutter_wkwebview] Migrate remaining example apps to uiscene (flutter/packages#13280) 2026-10-27 [email protected] manually roll flutter and fix flaky video player test that is preventing roll from landing (flutter/packages#13465) 2026-10-27 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: data_table_test, floating_action_button_test, text_field_cursor_test (flutter/packages#13460) 2026-10-27 [email protected] [material_ui] Decouple disabled CheckboxListTile state in a11y_assessments (flutter/packages#13177) 2026-10-27 [email protected] [camera_web] Skip video input devices that cannot be started in availableCameras (flutter/packages#13196) 2026-10-27 [email protected] [camera] Add support for zero-shutter-lag capture (flutter/packages#12374) 2026-10-27 [email protected] [in_app_purchase_storekit} Fix more test flakes (flutter/packages#13279) 2026-10-27 [email protected] [material_ui] Refactor `typography.dart` and `text_theme.dart` in preparation for M3E (flutter/packages#13371) If this roll has caused a breakage, revert this CL and set the roller to dry run mode 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
This PR is a no-op refactor of
typography.dartandtext_theme.dartto prepare for the Material 3 Expressive text styles. These changes were split out from my larger M3E typography changes to prevent that PR from being too big.Specifically, this PR:
TextThemedocumentation to reduce documentation duplicationapplyto reduce code duplication (helpful since we will be adding 15 new text styles with M3E)mergeto reduce code duplication_withM3Colorsfactory constructor toTypography. Currently this is only used once for M3, but it will also be used for M3E.The tests in this PR are purely to increase coverage since these changes are all no-ops. They are not regression tests.
Fixes flutter/flutter#195011
Pre-Review Checklist
[shared_preferences]///).Version and changelog exemption: Purely a refactor, no user-noticeable changes.
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