Repository navigation
Description
Steps to reproduce
- Create a new Flutter project using
flutter create bug. - Replace
lib/main.dartwith the code sample below. - Launch the Widget Previewer using
flutter widget-preview start. - Observe the
SwitchListTilebackground in the preview. - Run the application normally using
flutter runand compare the appearance. - Set
tileColor: Colors.transparenton theSwitchListTileand observe that the issue disappears.
Expected results
The SwitchListTile should have a transparent background by default.
The Widget Previewer should render the widget identically to normal application execution without introducing unintended styling.
Actual results
The Widget Previewer renders the SwitchListTile with an unexpected dark background, despite no tile background color being configured in the application.
This does not occur during normal application execution.
Further investigation revealed that ListTileTheme.of(context).tileColor returns a dark color (approximately #201E24), while Theme.of(context).listTileTheme.tileColor returns null.
Explicitly setting tileColor: Colors.transparent resolves the issue.
Suspected root cause:
The Widget Previewer defines its own ListTileThemeData in packages/flutter_tools/templates/widget_preview_scaffold/lib/src/theme/theme.dart.tmpl, including:
tileColor: backgroundColor.brighten()
In widget_preview_rendering.dart.tmpl, WidgetPreviewGroupWidget propagates the existing ListTileTheme using ListTileTheme.of(context).copyWith(...).
This appears to allow the previewer's internal styling to leak into the previewed application, even when the application provides its own MaterialApp and ThemeData.
Code sample
Code sample
import 'package:flutter/widget_previews.dart';
import 'package:material_ui/material_ui.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
@Preview()
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _isEnabled = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.green,
body: Builder(
builder: (context) {
final inheritedTileColor =
ListTileTheme.of(context).tileColor;
final themeTileColor =
Theme.of(context).listTileTheme.tileColor;
return Column(
children: [
Text('Inherited tile color: $inheritedTileColor'),
Text('ThemeData tile color: $themeTileColor'),
SizedBox(
width: 400,
child: SwitchListTile(
value: _isEnabled,
onChanged: (v) => setState(() => _isEnabled = v),
),
),
],
);
},
),
),
);
}
}Screenshots or Video
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel beta, 3.50.0-0.1.pre, on macOS 26.5.1 25F80 darwin-arm64, locale en-US) [385ms]
• Flutter version 3.50.0-0.1.pre on channel beta at /Users/name/Programs/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 07502c7de3 (4 days ago), 2026-10-13 19:03:20 -0700
• Engine revision b890cddcf8
• Dart version 3.14.0 (build 3.14.0-315.1.beta)
• DevTools version 2.61.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-hcpp
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [1,054ms]
• Android SDK at /Users/name/Library/Android/sdk
• Emulator version 37.2.12.0 (build_id 16428233) (CL:N/A)
• Platform android-36, build-tools 36.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 25.0.3+-15898627-b508.16)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) [1,050ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17A400
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [6ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (2 available) [5.9s]
• macOS (desktop) • macos • darwin-arm64 • macOS 26.5.1 25F80 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 155.0.8059.80
! Error: Browsing on the local area network for name iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources [527ms]
• All expected network resources are available.
• No issues found!
Activity
sugarcoded1 commentedon Oct 18, 2026
This started happening after upgrading to the latest version of the beta channel.
mbcorona commentedon Oct 19, 2026
Hi @sugarcoded1, thanks for the report, and your root cause is right. Reproduced on beta 3.50 with your exact sample.
Routing to team-tool.
[widget_preview] Do not leak ListTileTheme into previewed widgets (fl…
github-actions commentedon Nov 12, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.