-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
☂️ Material Theme System Updates #91772
Comments
Nice summary @guidezpl and great to see this collection issue for moving this topic forward and tracking its progress. It will certainly make things clearer when completed. The current situation seems to be a source of a lot of confusion for many Flutter developers, quite a few related issues open and more arriving ever so often. This will help, eventually. Most of the colors properties already have proper homes in the For those colors everything looks fine, but not all color properties in Things to Consider during the Theme System Update and MigrationIn case it is not obvious, but as far as I know e.g. The only way to set it separately, is to define the Being able define slightly different background colors depending on type of surface/background is important. It makes it possible in current version of Flutter to create applications that uses background colors with slightly different nuances, typically with different alpha blend strengths of primary color in the different surface/background colors used by Widgets, depending on their type and current default themed color behavior. For example, currently with the factory
This might apply to a few other
|
@rydmike From what I see, the scaffoldBackgroundColor is moved in a ScaffoldThemeData. Maybe that's a change after your recommendations. Anyways, thanks for keeping track of the ThemeData changes for all of us. |
@talamaska Thanks, I noticed the addition as well. Perhaps it was a part of the plan all along. Probably so, since if it were not, it would result in new ThemeData that has no migration path for certain use cases. |
Currently, I am developing an app that should look Android'ish on Android and iOS'ish on iOS. So I use the MaterialApp for Android and the CupertinoApp for iOS. And I also try to get a Material- and CupertinoTheme together, both with dark and light colors. It isn't easy :( I saw that CupertinoApp has only one theme parameter, and you use the CupertinoDynamicColor to define the light and dark colors (and some more). Now I wonder why we don't have the same for the MaterialApp? Would it be a good idea to remove all these darkTheme, highContrastTheme, and highContrastDarkTheme from the MaterialApp and use a MaterialDynamicColor? |
Additional colors to add to above list?Should perhaps the following colors also be mentioned above among the
They are currently not listed, but I doubt the intention is for them to remain. (cc @guidezpl) primaryColorLightA lighter color of primary. It is only used by primaryColorDarkA darker color of primary, it is used by ChallengesThe replacements would not be an exact match, so it would be breaking, but it matches the current design intent, if Status of primaryColorLight and pimaryColorDarkI wrote quite a bit about some past I did however not see anything addressing or mentioning The presence of Currently if you create a theme with
Which further complicates the continued existence of EDIT Aug 3, 2022: Obviously |
Realized I never posted an update, but I unfortunately was (and remain) too busy with other work to land those ~10 closed PRs linked in the description. But they were all ready (minus conflicts), if someone wants to land them. |
I can do that. ✋ |
Thanks for offering! The only issue is, IIRC, that this batch more-or-less all had uses in the Google codebase that required removal or migration while landing the PR. In other words, these changes were not considered breaking per policy, but were in terms of the Google codebase. |
Do a bit of sprucing up of `ThemeData` in anticipation of future work Related: #91772
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes: * Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties. * Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`: ```dart CardTheme( data: CardThemeData(color: xxx, elevation: xxx, ...), child: Card(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`. * Changed the type of theme defaults from `CardTheme` to `CardThemeData`. TODO: * Fix internal failures that may have breakages. * Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created. Addresses the "theme normalization" sub project within #91772
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes: * Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties. * Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`: ```dart CardTheme( data: CardThemeData(color: xxx, elevation: xxx, ...), child: Card(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`. * Changed the type of theme defaults from `CardTheme` to `CardThemeData`. TODO: * Fix internal failures that may have breakages. * Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created. Addresses the "theme normalization" sub project within flutter#91772
This issue mirrors the design of https://flutter.dev/go/material-theme-system-updates
Rename the TextTheme TextStyles
Deprecate/remove the accent properties
Compute
brightness
,primaryColorBrightness
,accentColorBrightness
accentColorBrightness
Deprecate ThemeData accentColor, accentColorBright, accentIconTheme, accentTextTheme #81336ThemeData.brightness
to be a simple getter that returnscolorScheme.brightness
ThemeData.brightness == ThemeData.colorScheme.brightness #56956SearchDelegate
Updated SearchDelegate to follow custom InputDecorationTheme #55209GridTileBar
Removed GridTileBar accentColor dependency. #78574primaryColorBrightness
DeprecateprimaryColorBrightness
#93396Deprecate/move/remove the 21 grab-bag properties
(x) indicates number of references, excluding
theme_data.dart
and tests. This can be used a proxy for disruptiveness/ease of deprecation.ThemeData.canvasColor
[ThemeData
🧹] RemovecanvasColor
usages #116350ThemeData.scaffoldBackgroundColor
[ThemeData
🧹] RemovescaffoldBackgroundColor
usages #116341ThemeData.bottomAppBarColor
⇒ Deprecate ThemeData.bottomAppBarColor #111080ThemeData.cardColor
[ThemeData
🧹] RemovecardColor
usages #116349ThemeData.dividerColor
[ThemeData
🧹] RemovedividerColor
usages #116347ThemeData.splashColor
(5) ⇒inkColor
orinkFeatureColor
ThemeData.selectedRowColor
Deprecate ThemeData.selectedRowColor #109070ThemeData.unselectedWidgetColor
(11) ⇒ seetoggleableActiveColor
deprecationThemeData.buttonColor
Deprecated ThemeData buttonColor #82196ThemeData.secondaryHeaderColor
[ThemeData
🧹] RemovesecondaryHeaderColor
usages #116342ThemeData.textSelectionColor
TextSelectionTheme support (step 3 of 3) #66482ThemeData.cursorColor
TextSelectionTheme support (step 3 of 3) #66482ThemeData.textSelectionHandleColor
TextSelectionTheme support (step 3 of 3) #66482ThemeData.backgroundColor
DeprecateThemeData
errorColor
andbackgroundColor
#110162ThemeData.dialogBackgroundColor
[ThemeData
🧹] RemovedialogBackgroundColor
usages #116348ThemeData.indicatorColor
[ThemeData
🧹] RemoveindicatorColor
usages #116344ThemeData.hintColor
[ThemeData
🧹] RemovehintColor
usages #116346ThemeData.errorColor
DeprecateThemeData
errorColor
andbackgroundColor
#110162ThemeData.toggleableActiveColor
DeprecatetoggleableActiveColor
#97972Additional grab-bag properties
These grab-bag properties not in the original linked proposal, but can also be deprecated:
ThemeData.shadowColor
[ThemeData
🧹] RemoveshadowColor
usages #116343ThemeData.splashFactory
(4) ⇒inkFactory
orinkFeatureFactory
ThemeData.fixTextFieldOutlineLabel
Deprecate ThemeData.fixTextFieldOutlineLabel #87281primaryColor
DeprecateThemeData.primaryX
#110848primaryColorDark
[ThemeData
🧹] RemoveprimaryColorLight
&primaryColorDark
usages #116362primaryColorLight
[ThemeData
🧹] RemoveprimaryColorLight
&primaryColorDark
usages #116362These factory constructor parameters can also be deprecated:
primarySwatch
fromThemeData
factory constructor (8) ⇒colorScheme
orcolorSchemeSeedColor
(related DeprecateColorScheme.fromSwatch
#120064)Property colors not subject to removal
ThemeData.disabledColor
(26),ThemeData.focusColor
(19), andThemeData.hoverColor
(19) have high usage and are shared amongst many componentsThemeData.highlightColor
(13)ThemeData.fontFamily
andThemeData.fontFamilyFallback
) for convenienceComponent Theme Normalization
All of the existing themes have been normalized except for the following:
CardTheme
Normalize Card theme #151914ChipTheme
Reland "ChipThemeData is now conventional" #94179DialogTheme
InputDecorationTheme
ListTileTheme
Reland Refactored ListTileTheme: ListTileThemeData, ThemeData.listThemeData #91840TabBarTheme
The text was updated successfully, but these errors were encountered: