Repository navigation
[material_ui] Document Material 3 fallback for Divider.color and VerticalDivider.color - #12967
Conversation
…icalDivider.color The Divider.color and VerticalDivider.color docstrings previously stated that when the color and DividerThemeData.color are both null, ThemeData.dividerColor is used. In Material 3 (the default) the effective fallback is actually ColorScheme.outlineVariant. Align the public field docs with the actual behavior. Port of flutter/flutter#193136 (closed due to code freeze on packages/flutter/lib/src/material). Fixes: flutter/flutter#190534
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for Divider.color and VerticalDivider.color to describe the Material 3 fallback behavior, and adds a corresponding changelog entry. Feedback suggests using a macro template for VerticalDivider.color to reduce docstring duplication.
| /// The color to use when painting the line. | ||
| /// | ||
| /// If this is null, then the [DividerThemeData.color] is used. If that is | ||
| /// also null, then [ThemeData.dividerColor] is used. | ||
| /// also null, then if [ThemeData.useMaterial3] is true it defaults to | ||
| /// [ColorScheme.outlineVariant], otherwise [ThemeData.dividerColor] is used. |
There was a problem hiding this comment.
Instead of duplicating the docstring for VerticalDivider.color, you can use the {@macro material_ui.Divider.color} template defined on Divider.color. This reduces duplication and ensures that any future updates to the fallback documentation automatically propagate to both widgets.
/// {@macro material_ui.Divider.color}There was a problem hiding this comment.
I think this is valid and worth addressing
elliette
left a comment
There was a problem hiding this comment.
Thanks for porting this over! The Gemini suggestion seems valid, otherwise looks good!
|
Thanks for the review! Applied the macro suggestion in ecf95ec — |
QuncCccccc
left a comment
There was a problem hiding this comment.
Thanks a lot for the correction! Overall looks good!
| @@ -0,0 +1,3 @@ | |||
| changelog: | | |||
| - Correct the `Divider.color` and `VerticalDivider.color` docstrings to describe the Material 3 fallback behavior (`ColorScheme.outlineVariant` when `ThemeData.useMaterial3` is true, otherwise `ThemeData.dividerColor`). | |||
There was a problem hiding this comment.
Just to follow converntion:
| - Correct the `Divider.color` and `VerticalDivider.color` docstrings to describe the Material 3 fallback behavior (`ColorScheme.outlineVariant` when `ThemeData.useMaterial3` is true, otherwise `ThemeData.dividerColor`). | |
| - Corrects the `Divider.color` and `VerticalDivider.color` documentation to describe the Material 3 fallback (`ColorScheme.outlineVariant`). |
| /// also null, then if [ThemeData.useMaterial3] is true it defaults to | ||
| /// [ColorScheme.outlineVariant], otherwise [ThemeData.dividerColor] is used. |
There was a problem hiding this comment.
useMaterial3 is true by default, so I think we don't need to explicitly mention "if useMaterial3 is true".
| /// also null, then if [ThemeData.useMaterial3] is true it defaults to | |
| /// [ColorScheme.outlineVariant], otherwise [ThemeData.dividerColor] is used. | |
| /// also null, then this defaults to [ColorScheme.outlineVariant], or to | |
| /// [ThemeData.dividerColor] if [ThemeData.useMaterial3] is false. |
|
Thanks @QuncCccccc — both applied. Flipped the Divider.color docstring so M3 reads as the default and M2 as the exception, and reworded the changelog bullet to match the house phrasing. Ready for another look when you have a moment. |
|
autosubmit label was removed for flutter/packages/12967, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.
|
|
Thanks for the earlier review @elliette — @QuncCccccc approved after some small tweaks, but autosubmit says it needs one more review before merge. Would you mind taking another look when you get a chance? |
|
Hello! @elliette is currently out of office and will get back to this PR once she come back. Thanks a lot for your patience:). |
elliette
left a comment
There was a problem hiding this comment.
Thanks for your patience! Looks good
flutter/packages@93baed9...108dad0 2026-10-22 [email protected] [material_ui] Migrate M3 IconButton template to use new gen_defaults (flutter/packages#12922) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationBar template to use new gen_defaults (flutter/packages#13067) 2026-10-22 [email protected] [material_ui] Remove obsolete `SurfaceTint` defaults template (flutter/packages#13276) 2026-10-22 [email protected] [material_ui] Migrate M3 Radio template to use new gen_defaults (flutter/packages#13210) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationDrawer template to use new gen_defaults (flutter/packages#13068) 2026-10-22 [email protected] [image_picker_ios] PR 3/5 Split SPM packaging and migrate the plugin class to Swift (flutter/packages#13235) 2026-10-22 [email protected] [ci] Increase check-discovery timeout in release workflows (flutter/packages#13392) 2026-10-22 [email protected] [material_ui] Migrate M3 `Switch` template to use new gen_defaults (flutter/packages#13274) 2026-10-22 [email protected] [material_ui] Migrate M3 PopupMenu template to use new gen_defaults (flutter/packages#13209) 2026-10-22 [email protected] [material_ui] Add day and weekday builders to CalendarDatePicker and showDatePicker (flutter/packages#12587) 2026-10-22 [email protected] [material_ui] Migrate M3 `SearchView` template to use new gen_defaults (flutter/packages#13272) 2026-10-22 [email protected] [material_ui] Migrate M3 `TextField` template to use new gen_defaults (flutter/packages#13275) 2026-10-22 [email protected] [material_ui] Migrate M3 RangeSlider template to use new gen_defaults (flutter/packages#13215) 2026-10-22 [email protected] [go_router] Keep web autocomplete focused in shell routes (flutter/packages#13348) 2026-10-22 [email protected] [shared_preferences_android] Fix web compilation of apps that import the package (flutter/packages#13380) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationRail template to use new gen_defaults (flutter/packages#13069) 2026-10-22 [email protected] [material_ui] Migrate M3 SearchBar template to use new gen_defaults (flutter/packages#13216) 2026-10-22 [email protected] [material_ui] Fix for time picker error in locales that do not use Latin digits (flutter/packages#13035) 2026-10-22 [email protected] [material_ui] Fix MenuAnchor scrollbar safe-area padding (flutter/packages#12470) 2026-10-22 [email protected] [material_ui] Document Material 3 fallback for Divider.color and VerticalDivider.color (flutter/packages#12967) 2026-10-22 [email protected] [material_ui] Migrate M3 tabs template to use new gen_defaults (flutter/packages#13139) 2026-10-22 [email protected] [material_ui] Migrate M3 progress indicator defaults to new gen_defaults (flutter/packages#13026) 2026-10-22 [email protected] [google_sign_in] Convert the iOS example app and UI tests to Swift (flutter/packages#13271) 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@93baed9...108dad0 2026-10-22 [email protected] [material_ui] Migrate M3 IconButton template to use new gen_defaults (flutter/packages#12922) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationBar template to use new gen_defaults (flutter/packages#13067) 2026-10-22 [email protected] [material_ui] Remove obsolete `SurfaceTint` defaults template (flutter/packages#13276) 2026-10-22 [email protected] [material_ui] Migrate M3 Radio template to use new gen_defaults (flutter/packages#13210) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationDrawer template to use new gen_defaults (flutter/packages#13068) 2026-10-22 [email protected] [image_picker_ios] PR 3/5 Split SPM packaging and migrate the plugin class to Swift (flutter/packages#13235) 2026-10-22 [email protected] [ci] Increase check-discovery timeout in release workflows (flutter/packages#13392) 2026-10-22 [email protected] [material_ui] Migrate M3 `Switch` template to use new gen_defaults (flutter/packages#13274) 2026-10-22 [email protected] [material_ui] Migrate M3 PopupMenu template to use new gen_defaults (flutter/packages#13209) 2026-10-22 [email protected] [material_ui] Add day and weekday builders to CalendarDatePicker and showDatePicker (flutter/packages#12587) 2026-10-22 [email protected] [material_ui] Migrate M3 `SearchView` template to use new gen_defaults (flutter/packages#13272) 2026-10-22 [email protected] [material_ui] Migrate M3 `TextField` template to use new gen_defaults (flutter/packages#13275) 2026-10-22 [email protected] [material_ui] Migrate M3 RangeSlider template to use new gen_defaults (flutter/packages#13215) 2026-10-22 [email protected] [go_router] Keep web autocomplete focused in shell routes (flutter/packages#13348) 2026-10-22 [email protected] [shared_preferences_android] Fix web compilation of apps that import the package (flutter/packages#13380) 2026-10-22 [email protected] [material_ui] Migrate M3 NavigationRail template to use new gen_defaults (flutter/packages#13069) 2026-10-22 [email protected] [material_ui] Migrate M3 SearchBar template to use new gen_defaults (flutter/packages#13216) 2026-10-22 [email protected] [material_ui] Fix for time picker error in locales that do not use Latin digits (flutter/packages#13035) 2026-10-22 [email protected] [material_ui] Fix MenuAnchor scrollbar safe-area padding (flutter/packages#12470) 2026-10-22 [email protected] [material_ui] Document Material 3 fallback for Divider.color and VerticalDivider.color (flutter/packages#12967) 2026-10-22 [email protected] [material_ui] Migrate M3 tabs template to use new gen_defaults (flutter/packages#13139) 2026-10-22 [email protected] [material_ui] Migrate M3 progress indicator defaults to new gen_defaults (flutter/packages#13026) 2026-10-22 [email protected] [google_sign_in] Convert the iOS example app and UI tests to Swift (flutter/packages#13271) 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
Port of flutter/flutter#193136 — the original PR could not land on flutter/flutter due to the Material/Cupertino code freeze on
packages/flutter/lib/src/material(see flutter/flutter#188444). Re-opening the doc fix here inmaterial_ui.The
Divider.colorandVerticalDivider.colordocstrings currently state that when both the localcolorandDividerThemeData.colorare null,ThemeData.dividerColoris used. In Material 3 (the default since Flutter 3.16) the effective fallback is actuallyColorScheme.outlineVariant, asDivider.createBorderSidealready documents. This PR aligns the public field docstrings with the actual runtime behavior.Fixes: flutter/flutter#190534
Notes for reviewers:
Divider.colordocstring is a{@template material_ui.Divider.color}reused via{@macro}elsewhere, so the fix propagates.VerticalDivider.colorcarries a duplicate (non-macro) docstring, which has been updated to match.Pre-launch Checklist
///).