Support detection of light and dark system colors#164933
Support detection of light and dark system colors#164933auto-submit[bot] merged 7 commits intoflutter:masterfrom
Conversation
chunhtai
left a comment
There was a problem hiding this comment.
Can you talk a bit more about the changes about this pr? It looks like this pr attempt to detect color palette for both light and dart modes? I thought the browser should be able to know whether the system setting is right? In that case, shouldn't we only need to provide the color palette that matches the current browser setting?
| final class SystemColorPalette { | ||
| SystemColorPalette._(this.brightness); | ||
|
|
||
| /// A palette of system colors for light mode. |
There was a problem hiding this comment.
will the value for light or dark change based on the light/dark setting of the browser?
There was a problem hiding this comment.
No. The user can get both light and dark system colors, regardless of system brightness settings.
Sure! Let me explain the steps that got me here:
|
|
autosubmit label was removed for flutter/flutter/164933, because - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/164933, because - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
This PR introduces a `bool useSystemColors` parameter to the `ThemeData` constructor. The goal from this PR is to enable users to easily create high contrast themes that are based on system colors for their `MaterialApp`: ```dart MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), highContrastTheme: ThemeData(useSystemColors: true, ...), highContrastDarkTheme: ThemeData(useSystemColors: true, ...), ) ``` The `MaterialApp` widget will automatically pick the correct one of the 4 themes based on system settings (light/dark mode, high contrast enabled/disabled). Depends on #164933 Closes #118853
) This PR introduces a `bool useSystemColors` parameter to the `ThemeData` constructor. The goal from this PR is to enable users to easily create high contrast themes that are based on system colors for their `MaterialApp`: ```dart MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), highContrastTheme: ThemeData(useSystemColors: true, ...), highContrastDarkTheme: ThemeData(useSystemColors: true, ...), ) ``` The `MaterialApp` widget will automatically pick the correct one of the 4 themes based on system settings (light/dark mode, high contrast enabled/disabled). Depends on flutter#164933 Closes flutter#118853
Part of flutter#118853 This PR is an enhancement to flutter#163335 to provide detection of system colors for both light and dark mode. This is needed for the construction of a [`highContrastTheme`](https://api.flutter.dev/flutter/material/MaterialApp/highContrastTheme.html) and [`highContrastDarkTheme`](https://api.flutter.dev/flutter/material/MaterialApp/highContrastDarkTheme.html).
) This PR introduces a `bool useSystemColors` parameter to the `ThemeData` constructor. The goal from this PR is to enable users to easily create high contrast themes that are based on system colors for their `MaterialApp`: ```dart MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), highContrastTheme: ThemeData(useSystemColors: true, ...), highContrastDarkTheme: ThemeData(useSystemColors: true, ...), ) ``` The `MaterialApp` widget will automatically pick the correct one of the 4 themes based on system settings (light/dark mode, high contrast enabled/disabled). Depends on flutter#164933 Closes flutter#118853
Part of #118853
This PR is an enhancement to #163335 to provide detection of system colors for both light and dark mode. This is needed for the construction of a
highContrastThemeandhighContrastDarkTheme.