Skip to content

Document Material 3 fallback for Divider.color and VerticalDivider.color - #193136

Closed
gbolahan507 wants to merge 1 commit into
flutter:masterfrom
gbolahan507:docs/divider-color-m3-fallback
Closed

gbolahan507 wants to merge 1 commit into
flutter:masterfrom
gbolahan507:docs/divider-color-m3-fallback

Conversation

@gbolahan507

Copy link
Copy Markdown
Contributor

The Divider.color and VerticalDivider.color docstrings currently state that when both the local color and DividerThemeData.color are null, ThemeData.dividerColor is used. In Material 3 (the default since Flutter 3.16) the effective fallback is actually ColorScheme.outlineVariant, as Divider.createBorderSide already documents. This PR aligns the public field docstrings with the actual runtime behavior.

Fixes: #190534

Notes for reviewers:

  • The Divider.color docstring is a {@template flutter.material.Divider.color} that is also {@macro}-referenced by PopupMenuDivider, so the fix propagates to that widget's docs as well.
  • VerticalDivider.color has a duplicate (non-macro) docstring, which has been updated to match.

Pre-launch Checklist

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 since 3.16)
the effective fallback is actually [ColorScheme.outlineVariant], as
already documented on [Divider.createBorderSide]. Align the public
field docs with the actual behavior.

Fixes: flutter#190534
@github-actions

Copy link
Copy Markdown

This pull request contains changes to Material or Cupertino, which are currently frozen in this repository.

Changes should be made in material_ui and/or cupertino_ui in the flutter/packages repository.

Please refer to #188444 for instructions.

@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 updates the documentation for both Divider and VerticalDivider to specify that when ThemeData.useMaterial3 is true, the default color falls back to ColorScheme.outlineVariant instead of ThemeData.dividerColor. The feedback suggests rephrasing these documentation comments to avoid a comma splice and nested conditional structure, which improves overall readability.

Comment on lines +122 to +123
/// also null, then if [ThemeData.useMaterial3] is true it defaults to
/// [ColorScheme.outlineVariant], otherwise [ThemeData.dividerColor] is used.

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 phrasing here contains a comma splice and is slightly hard to read due to the nested conditional structure ('then if...'). Rephrasing it to use a semicolon and placing the condition after the default value improves readability and grammatical correctness.

  /// also null, then it defaults to [ColorScheme.outlineVariant] if\n  /// [ThemeData.useMaterial3] is true; otherwise, [ThemeData.dividerColor] is used.
References
  1. Optimize for readability: Code is read more often than it is written. (link)

Comment on lines +296 to +297
/// also null, then if [ThemeData.useMaterial3] is true it defaults to
/// [ColorScheme.outlineVariant], otherwise [ThemeData.dividerColor] is used.

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 phrasing here contains a comma splice and is slightly hard to read due to the nested conditional structure ('then if...'). Rephrasing it to use a semicolon and placing the condition after the default value improves readability and grammatical correctness.

  /// also null, then it defaults to [ColorScheme.outlineVariant] if\n  /// [ThemeData.useMaterial3] is true; otherwise, [ThemeData.dividerColor] is used.
References
  1. Optimize for readability: Code is read more often than it is written. (link)

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Sep 22, 2026
@gbolahan507

Copy link
Copy Markdown
Contributor Author

Closing per the code-freeze CI failure — Material changes now live in flutter/packages material_ui (see #188444). Ported to flutter/packages#12967.

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 22, 2026
…icalDivider.color (#12967)

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 in `material_ui`.

The `Divider.color` and `VerticalDivider.color` docstrings currently state that when both the local `color` and `DividerThemeData.color` are null, `ThemeData.dividerColor` is used. In Material 3 (the default since Flutter 3.16) the effective fallback is actually `ColorScheme.outlineVariant`, as `Divider.createBorderSide` already documents. This PR aligns the public field docstrings with the actual runtime behavior.

Fixes: flutter/flutter#190534

Notes for reviewers:
- The `Divider.color` docstring is a `{@template material_ui.Divider.color}` reused via `{@macro}` elsewhere, so the fix propagates.
- `VerticalDivider.color` carries a duplicate (non-macro) docstring, which has been updated to match.
- A prior attempt on flutter/flutter (#190535) was approved by @elliette before being auto-closed for inactivity on a whitespace nit; this port takes that direction into the correct repo per the decoupling policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget Divider not selecting proper color per docs.

1 participant