-
Notifications
You must be signed in to change notification settings - Fork 28.5k
☂️ Material Theme System Updates #91772
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
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 |
Reverts: flutter#155476 Initiated by: eyebrowsoffire Reason for reverting: The newly added tests are failing in postsubmit. See https://ci.chromium.org/ui/p/flutter/builders/prod/Windows%20framework_tests_libraries/19062/overview Original PR Author: QuncCccccc Reviewed By: {TahaTesser} This change reverts the following previous change: This PR is to make preparations to make `TabBarTheme` conform to Flutter's conventions for component themes: * Added a `TabBarThemeData` class which defines overrides for the defaults for `TabBar` properties. * Added 2 `TabBarTheme` constructor parameters: `TabBarThemeData? data` and `Widget? child`. This is now the preferred way to configure a `TabBarTheme`: ``` TabBarTheme( data: TabBarThemeData(labelColor: xxx, indicatorColor: xxx, ...), child: TabBar(...) ) ``` These two properties are made nullable to not break existing apps which has customized `ThemeData.tabBarTheme`. * Changed the type of component theme defaults from `TabBarTheme` to `TabBarThemeData`. TODO: * Fix internal failures. * Change the type of `ThemeData.tabBarTheme` from `TabBarTheme` to `TabBarThemeData`. This may cause breaking changes, a migration guide will be created. Addresses the "theme normalization" sub project within flutter#91772
) Following #153982, this PR is to normalize `ThemeData.dialogTheme`; change the `DialogTheme dialogTheme` property to `DialogThemeData dialogTheme` in ThemeData. In `ThemeData()` and `ThemeData.copyWith()`, the dialogTheme parameter type is changed to `Object?` to accept both `DialogTheme` and `DialogThemeData` so that we won't cause immediate breaking change and make sure rolling is smooth. Once all component themes are normalized, these `Object?` types should be changed to `xxxThemeData`. There's no way to create a dart fix because we can't add a "@deprecated" label for `DialogTheme`; `DialogTheme` is a new `InheritedWidget` subclass now. Addresses the "theme normalization" sub project within #91772
Following #151914, this PR is to normalize `ThemeData.cardTheme`; change the `CardTheme cardTheme` property to `CardThemeData cardTheme` in `ThemeData`. In `ThemeData()` and `ThemeData.copyWith()`, the `cardTheme` parameter type is changed to `Object?` to accept both `CardTheme` and `CardThemeData` so that we won't cause immediate breaking change and make sure rolling is smooth. Once all component themes are normalized, these `Object?` types should be changed to `xxxThemeData`. There's no way to create a dart fix because we can't add a "@deprecated" label for `CardTheme` because `CardTheme` is a new InheritedWidget subclass now. Addresses the "theme normalization" sub project within #91772
Following #155476, this PR is to normalize `ThemeData.tabBarTheme`; change the `TabBarTheme tabBarTheme` property to `TabBarThemeData tabBarTheme` in `ThemeData`. In `ThemeData()` and `ThemeData.copyWith()`, the `tabBarTheme` parameter type is changed to `Object?` to accept both `TabBarTheme` and `TabBarThemeData` so that we won't cause immediate breaking change and make sure rolling is smooth. Once all component themes are normalized, these `Object?` types should be changed to `xxxThemeData`. There's no way to create a dart fix because we can't add a "@deprecated" label for TabBarTheme; TabBarTheme is a new InheritedWidget subclass now. Addresses the "theme normalization" sub project within #91772
Deprecation of
|
This issue is assigned to @QuncCccccc but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks! |
This issue is assigned to @QuncCccccc but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks! |
This issue was assigned to @QuncCccccc but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed. |
…icatorColor` (#160024) Related to [☂️ Material Theme System Updates](#91772) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…icatorColor` (flutter#160024) Related to [☂️ Material Theme System Updates](flutter#91772) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
## Description While preparing a PR to normalize `InputDecorationTheme` (part of #91772), I spotted some typos in tab bar theme and dialog theme documentation: ## Tests Documentation only
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.cardColor
[ThemeData
🧹] RemovecardColor
usages #116349ThemeData.dividerColor
[ThemeData
🧹] RemovedividerColor
usages #116347ThemeData.secondaryHeaderColor
[ThemeData
🧹] RemovesecondaryHeaderColor
usages #116342ThemeData.hintColor
[ThemeData
🧹] RemovehintColor
usages #116346ThemeData.splashColor
(5) ⇒inkColor
orinkFeatureColor
ThemeData.unselectedWidgetColor
(11) ⇒ seetoggleableActiveColor
deprecationThemeData.bottomAppBarColor
⇒ Deprecate ThemeData.bottomAppBarColor #111080ThemeData.selectedRowColor
Deprecate ThemeData.selectedRowColor #109070ThemeData.buttonColor
Deprecated ThemeData buttonColor #82196ThemeData.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
DeprecateThemeData.dialogBackgroundColor
in favor ofDialogThemeData.backgroundColor
#155072ThemeData.indicatorColor
DeprecateThemeData.indicatorColor
in favor ofTabBarThemeData.indicatorColor
#160024ThemeData.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
primaryColor
DeprecateThemeData.primaryX
#110848primaryColorDark
[ThemeData
🧹] RemoveprimaryColorLight
&primaryColorDark
usages #116362primaryColorLight
[ThemeData
🧹] RemoveprimaryColorLight
&primaryColorDark
usages #116362ThemeData.fixTextFieldOutlineLabel
Deprecate ThemeData.fixTextFieldOutlineLabel #87281These 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:
AppBarTheme
BottomAppBarTheme
InputDecorationTheme
CardTheme
Normalize Card theme #151914ChipTheme
Reland "ChipThemeData is now conventional" #94179DialogTheme
Normalize Dialog theme #153982ListTileTheme
Reland Refactored ListTileTheme: ListTileThemeData, ThemeData.listThemeData #91840TabBarTheme
Normalize TabBarTheme #155476The text was updated successfully, but these errors were encountered: