-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Create a new Flutter project
- Inside the
MaterialApp -> ThemeDatachange thebrightnessfromBrightness.lighttoBrightness.dark - Launch the app
Expected results
The app launches correctly without issues.
Actual results
The Debug Console shows this error:
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building MyApp(dirty):
'package:flutter/src/material/theme_data.dart': Failed assertion: line 459 pos 12: 'colorScheme?.brightness == null || brightness == null || colorScheme!.brightness == brightness': is not true.
theme_data.dart:459
The relevant error-causing widget was
MyApp
main.dart:4
When the exception was thrown, this was the stack
#2 new ThemeData
theme_data.dart:459
#3 MyApp.build
main.dart:14
#4 StatelessElement.build
framework.dart:5156
#5 ComponentElement.performRebuild
framework.dart:5086
#6 Element.rebuild
framework.dart:4805
#7 BuildOwner.buildScope
framework.dart:2780
#8 WidgetsBinding.drawFrame
binding.dart:903
#9 RendererBinding._handlePersistentFrameCallback
binding.dart:358
#10 SchedulerBinding._invokeFrameCallback
binding.dart:1284
#11 SchedulerBinding.handleDrawFrame
binding.dart:1214
#12 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
binding.dart:939
#16 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)Code sample
This code works:
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
brightness: Brightness.light,
),
home: Container(),
);
}
}This code does NOT work:
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
brightness: Brightness.dark,
),
home: Container(),
);
}
}This code works:
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorSchemeSeed: Colors.deepPurple,
useMaterial3: true,
brightness: Brightness.light,
),
home: Container(),
);
}
}This code works:
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorSchemeSeed: Colors.deepPurple,
useMaterial3: true,
brightness: Brightness.dark,
),
home: Container(),
);
}
}Issue
- If I use
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)It works only withbrightness: Brightness.lightbut not withbrightness: Brightness.dark - If I use
colorSchemeSeed: Colors.deepPurpleIt works with bothbrightness: Brightness.lightandbrightness: Brightness.dark
Flutter Doctor output
[✓] Flutter (Channel stable, 3.10.1, on Fedora Linux 37 (KDE Plasma) 6.2.15-200.fc37.x86_64, locale it_IT.UTF-8)
• Flutter version 3.10.1 on channel stable at /home/alberto/tools/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3d8effc68 (8 giorni fa), 2023-05-16 17:59:05 -0700
• Engine revision b4fb11214d
• Dart version 3.0.1
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /home/alberto/Android/Sdk
• Platform android-33-ext4, build-tools 33.0.2
• Java binary at: /home/alberto/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /opt/brave.com/brave/brave-browser
[✓] Linux toolchain - develop for Linux desktop
• clang version 15.0.7 (Fedora 15.0.7-2.fc37)
• cmake version 3.26.4
• ninja version 1.10.2
• pkg-config version 1.8.0
[✓] Android Studio (version 2022.2)
• Android Studio at /home/alberto/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
[✓] IntelliJ IDEA Community Edition (version 2023.1)
• IntelliJ at /home/alberto/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/231.8770.65
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.78.2)
• VS Code at /usr/share/code
• Flutter extension version 3.64.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 37 (KDE Plasma) 6.2.15-200.fc37.x86_64
• Chrome (web) • chrome • web-javascript • Brave Browser 113.1.51.118
[✓] Network resources
• All expected network resources are available.
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Type
Projects
Status
Done (PR merged)