You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5f2addd
Browse filesBrowse the repository at this point in the historyBrowse files
[widget_preview] Do not leak ListTileTheme into previewed widgets (flutter#194992)
In the widget preview scaffold, `WidgetPreviewGroupWidget` wrapped
`ExpansionTile` in a `ListTileTheme`. Because `ListTileTheme` is an
`InheritedTheme` (`InheritedWidget`), it enclosed all previewed child
widgets. Because `MaterialApp` and `Theme` do not insert a
`ListTileTheme` boundary to reset ancestor inherited themes, previewed
`ListTile` and `SwitchListTile` widgets inherited the scaffold's
brightened `tileColor` (`#201E24`).
This removes the `ListTileTheme` and dead `Theme(dividerColor:
Colors.transparent)` wrappers around `ExpansionTile`, removes unused
`listTileTheme` from the scaffold's `_baseTheme`, and adds integration
regression tests in `theming_test.dart`.
Fixesflutter#194660
### Visual Behavior
- **Before**: `SwitchListTile` and `ListTile` rendered with an
unintended dark tile background (`#201E24`).
- **After**: `SwitchListTile` and `ListTile` render with the default
transparent background.
Previous output:
```
00:01 +4: Previewed MaterialApp ListTileTheme is not overridden
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: MaterialColor:<MaterialColor(primary value: Color(alpha: 1.0000, red: 0.9569, green:
0.2627, blue: 0.2118, colorSpace: ColorSpace.sRGB))>
Actual: Color:<Color(alpha: 1.0000, red: 0.1245, green: 0.1171, blue: 0.1394, colorSpace:
ColorSpace.sRGB)>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:02 +4 -1: Previewed MaterialApp ListTileTheme is not overridden [E]
00:02 +4 -1: ListTileTheme does not leak into previewed widgets without MaterialApp
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: null
Actual: Color:<Color(alpha: 1.0000, red: 0.1245, green: 0.1171, blue: 0.1394, colorSpace:
ColorSpace.sRGB)>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:02 +4 -2: ListTileTheme does not leak into previewed widgets without MaterialApp [E]
00:02 +4 -2: SwitchListTile in preview has transparent background by default
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: has `color` with value Color:<Color(alpha: 0.0000, red: 0.0000, green: 0.0000, blue:
0.0000, colorSpace: ColorSpace.extendedSRGB)>
Actual: ShapeDecoration:<ShapeDecoration(color: Color(alpha: 1.0000, red: 0.1245, green: 0.1171,
blue: 0.1394, colorSpace: ColorSpace.sRGB), shape: RoundedRectangleBorder(BorderSide(none),
BorderRadius.circular(12.0)))>
Which: has `color` with value Color:<Color(alpha: 1.0000, red: 0.1245, green: 0.1171, blue:
0.1394, colorSpace: ColorSpace.sRGB)>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +4 -3: SwitchListTile in preview has transparent background by default [E]
```
Current output:
```
00:00 +0: loading dev/integration_tests/widget_preview_scaffold/test/theming_test.dart
00:00 +0: Theming is correctly propagated down to the previewed widget
00:00 +1: Default theme is used if no preview theme is specified
00:00 +2: BrightnessToggleButton correctly toggles preview brightness
00:01 +3: Updated brightness property doesn't override state set by BrightnessToggleButton
00:01 +4: Previewed MaterialApp ListTileTheme is not overridden
00:01 +5: ListTileTheme does not leak into previewed widgets without MaterialApp
00:01 +6: SwitchListTile in preview has transparent background by default
00:01 +7: All tests passed!
```
0 commit comments