Fix #117755: Fix divider color inconsistencies in M2/M3 #178826
+78
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes
ThemeData.dividerColorto return the correct color that matches what theDividerwidget actually renders in Material 2 and Material 3.Problem
ThemeData.dividerColorreturned different values depending on how the theme was created, causing inconsistency with the actualDividerwidget color:ThemeData()with M3 returnedoutlineinstead ofoutlineVariantThemeData.from()with M3 returned M2 valueonSurface.withOpacity(0.12)instead of M3 valueoutlineVariantDividerwidget always correctly usedoutlineVariantin M3This created confusion for developers who expected
Theme.of(context).dividerColorto match the actual divider color they saw on screen.Solution
Updated both
ThemeData()andThemeData.from()constructors to use the correct divider colors per Material Design specifications:ColorScheme.onSurface.withOpacity(0.12)(unchanged)ColorScheme.outlineVariant(fixed)Now all theme creation methods return the correct
dividerColorthat matches what theDividerwidget actually renders.Testing
Added 4 comprehensive tests that verify:
dividerColorequalsoutlineVariantfor all theme creation methodsdividerColormatches actualDividerwidget colordividerColorequalsonSurface.withOpacity(0.12)and matches actualDividerwidget colorRelated Issues
Fixes #117755
Pre-launch Checklist
///).