Repository navigation
Closed
flutter/packages
#12746Labels
P2Important issues not at the top of the work listhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team
Description
Steps to reproduce
Refernce : b/293423836
- Run the code sample provided below.
- Click on the "Open Drawer" button (or swipe from the left).
- Observe the color of the background scrim that dims the rest of the screen.
- Close it and click on "Open Modal Bottom Sheet" or "Open Dialog".
- Observe the barrier color for those modals as well.
Expected results
When useMaterial3 is enabled, the modals should respect the ColorScheme.scrim token. The background scrim should appear as Red (with the standard framework opacity applied, e.g., 54%), matching the customization made in the theme.
Actual results
The background scrim/dimming effect remains a dark grey/translucent black (Colors.black54). The framework completely ignores the custom Colors.red defined in ColorScheme.scrim.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Scrim Color Demo',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
// 🔴 We set a custom, highly visible scrim color (e.g., Red)
scrim: Colors.red,
),
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Scrim Bug Demo')),
// Drawer will use the default scrim
drawer: const Drawer(
child: Center(child: Text('Drawer Content')),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Builder is used to get the correct context for Scaffold.of
Builder(
builder: (context) {
return ElevatedButton(
onPressed: () => Scaffold.of(context).openDrawer(),
child: const Text('Open Drawer'),
);
},
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) => const SizedBox(
height: 200,
child: Center(child: Text('Bottom Sheet Content')),
),
);
},
child: const Text('Open Modal Bottom Sheet'),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Dialog'),
content: const Text('Dialog Content'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close'),
),
],
),
);
},
child: const Text('Open Dialog'),
),
],
),
),
);
}
}Screenshots or Video
Logs
Logs
[Paste your logs here]Flutter Doctor output
Flutter Doctor
[✓] Flutter (Channel master, 3.47.0-0.4.pre, on Debian GNU/Linux rodete 6.18.14-1rodete4-amd64,
locale en_US.UTF-8) [5.0s]
• Flutter version 3.47.0-0.4.pre on channel master at
/usr/local/google/home/mmohankrishna/developement/flutter
• Upstream repository [email protected]:flutter/flutter.git
• Framework revision 5c6367c2ab (5 weeks ago), 2026-07-07 06:58:20 +0200
• Engine revision 6a5b0bdd7a
• Dart version 3.13.0 (build 3.13.0-275.0.dev)
• DevTools version 2.59.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-riscv64
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [2.2s]
• Android SDK at /usr/local/google/home/mmohankrishna/Android/Sdk
• Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
• Platform android-36.1, build-tools 36.1.0
! Multiple adb binaries found. This can cause conflicts and device detection issues:
- /usr/local/google/home/mmohankrishna/Android/Sdk/platform-tools/adb
- /usr/bin/adb
• Java binary at:
/usr/local/google/home/mmohankrishna/Downloads/android-studio-quail1-patch2-linux/android-s
tudio/jbr/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 21.0.10+-14961533-b1163.108)
• All Android licenses accepted.
[✓] Chrome - develop for the web [14ms]
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop [524ms]
• Debian clang version 21.1.8 (3)
• cmake version 4.2.3
• ninja version 1.13.2
• pkg-config version 2.5.1
• OpenGL core renderer: llvmpipe (LLVM 21.1.8, 256 bits)
• OpenGL core version: 4.5 (Core Profile) Mesa 26.0.2-1
• OpenGL core shading language version: 4.50
• OpenGL ES renderer: llvmpipe (LLVM 21.1.8, 256 bits)
• OpenGL ES version: OpenGL ES 3.2 Mesa 26.0.2-1
• OpenGL ES shading language version: OpenGL ES GLSL ES 3.20
• GL_EXT_framebuffer_blit: yes
• GL_EXT_texture_format_BGRA8888: yes
[✓] Connected device (2 available) [158ms]
• Linux (desktop) • linux • linux-x64 • Debian GNU/Linux rodete 6.18.14-1rodete4-amd64
• Chrome (web) • chrome • web-javascript • Google Chrome 151.0.7922.108
[✓] Network resources [331ms]
• All expected network resources are available.
• No issues found!
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team


Activity
saurabh-mirajkar commentedon Aug 10, 2026
@mmohankrishna-lab Thanks for the report. Could you please provide the output of
flutter doctor -vwhere this reproduces? Also, please include screenshots / video sample of the observed scrim color if possible.mmohankrishna-lab commentedon Aug 11, 2026
@saurabh-mirajkar I've provided the output of flutter doctor -v and aslo attached the screenshots
saurabh-mirajkar commentedon Aug 11, 2026
@mmohankrishna-lab Thanks for providing additional details. I was able to reproduce on latest stable using the provided code sample, so labelling and passing it on to the design team for further investigation.
byshy commentedon Aug 11, 2026
I’d like to work on this.
Proposed fix: when barrier/scrim color isn’t set via the widget or component theme, fall back to Theme.of(context).colorScheme.scrim.withValues(alpha: 0.54) instead of Colors.black54 for dialogs, modal bottom sheets, and drawers (keeps the default look; honors a custom ColorScheme.scrim).
Does that match what the design team wants?
developerashkan commentedon Aug 12, 2026
Hi! I'd like to take a look at this one — no one is assigned yet. I can reproduce it with a ColorScheme.fromSeed(seedColor: ..., scrim: Colors.red) theme: showModalBottomSheet, dialogs and the drawer scrim all still render Colors.black54 instead of the configured ColorScheme.scrim when useMaterial3 is enabled.
Plan: update the Material scrim/barrier color usage (drawer scrim, showModalBottomSheet, dialogs) to read from Theme.of(context).colorScheme.scrim, add a test, and run the framework's material widget tests. If you'd prefer a different approach or this is already in progress, let me know and I'll stand down.
If that sounds good, please assign me and I'll get started.
Piinks commentedon Aug 12, 2026
Hi @developerashkan please do not push a PR to fix an issue when there is one already open. There are many contributors to the Flutter project and many of them are not able to assign themselves to issues.
developerashkan commentedon Aug 13, 2026
@Piinks Got it, thanks for clarifying. It would be helpful to close stale PRs first though, I still have a previous PR open for a different issue.
elliette commentedon Sep 1, 2026
cc @QuncCccccc for triage
[material_ui] Use ColorScheme.scrim for modal barrier/scrim defaults (f…