Update dependency flex_color_scheme to v8 #1365
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^7.3.1
->^8.0.0
Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
rydmike/flex_color_scheme (flex_color_scheme)
v8.0.0
Compare Source
Nov 3, 2024
SUMMARY
Version 8.0.0 makes FlexColorScheme fully aligned with Flutter's MAJOR BREAKING Material-3 theming changes introduced in Flutter version 3.22. Due to Flutter 3.22 breaking many past Material styles, introducing new colors to
ColorScheme
and deprecating three colors, FlexColorScheme had to undergo major revision and also break many of its past styles and some older APIs.Most APIs are still there and work as before, but a few produce results that differ slightly from past ones, just like Flutter 3.22 also does over previous versions. Generally, the upgrade should be smooth, but you may need to review the produced theme result to see that you don't get any changes that don't fit with your design goals. Some past defaults have changed in FCS V8, but previous settings are still available. However, you will need to enable them explicitly to get the same results as before. The purpose of these default value changes is to make FCS have less opinionated defaults, and be more aligned with Flutter's Material-3 design defaults. The Themes Playground app will still have some of its own opinionated defaults, done via default settings values the app uses in its default configuration, but the package Material-3 default starting points are now much more aligned with Flutter's Material-3 defaults.
In the Themes Playground you can now export and import settings to a JSON file, and import them back into the Playground later. This is a great way to save your theme settings for later re-use. The exported JSON contains all the internal controller settings values you have configured in the Playground app, that are needed to restore a given configuration state. This Playground feature was a nice contribution by GitHub user @akiller in !PR 257, thank you! This contributed feature got enhanced with more error handling and a slightly refined UI to make it production ready. As a further enhancement of the JSON export feature, the Themes Playground app also got the ability to convert the exported settings JSON config to a shareable URL. You can now share Playground settings with other Flutter developers.
MIGRATION
The most critical changes to migrate from FlexColorScheme V7 to V8 are listed below. For a full list of all breaking changes, see PACKAGE CHANGES and the BREAKING part further below.
The flag
useMaterial3
now defaults totrue
inFlexColorScheme
andFlexThemeData
constructors. Set it tofalse
to explicitly use Material-2 theming. It defaulted to true before. Material-2 is still fully supported in FCS v8 and Flutter v3.24, but will eventually be deprecated in Flutter, when that happens, it will also happen in FCS.The
FlexSubThemesData
propertiesinteractionEffects
,tintedDisabledControls
,defaultUseM2StyleDividerInM3
andblendOnColors
now all default tofalse
. In previous versions they defaulted totrue
. If you before had not explicitly turned these propertiesfalse
, they were alltrue
by default. To get the same result as before in FCS V8, you now have to set these properties totrue
. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles.The
FlexSubThemesData
propertynavigationRailLabelType
no default toNavigationRailLabelType.none
. To get the same result as before by default, you will need to set it toNavigationRailLabelType.all
. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles. The Playground defaults it toNavigationRailLabelType.all
by adding this by default to new default themes.Since
ColorScheme.background
color was deprecated in Flutter 3.22.0 we can no longer use it as a part of surface blends and its modes. For example, whensurfaceMode
is set toFlexSurfaceMode.highBackgroundLowScaffold
it now uses surface and dialog blends set to 2x instead of 1x, so that it represents the "high background" style as before, but done via surface color. Without this breaking change, this mode would produce the same result asFlexSurfaceMode.levelSurfacesLowScaffold
and be redundant.ColorScheme
colorsbackground
,onBackground
andsurfaceVariant
.This major release has many breaking changes forced via breaking changes in Flutter 3.22.0. Due to this, the release also uses this opportunity to clean up APIs with opinionated defaults, like the ones mentioned above. There are additional smaller and more subtle changes in defaults values, that align FCS to use the same color defaults from the new
ColorScheme
colors, that Flutter started using in version 3.22.0 as well. You can find all the details below in the PACKAGE CHANGES chapter.BACKGROUND
Flutter 3.22 introduced a large number of breaking changes to the
ColorScheme
and default color mappings that Flutter's Material components use. In total, the Flutter 3.22.0 release adjusted 249 of its own internal tests to accommodate for new Material-3 spec changes, that all broke past Flutter Material-3 component styles. For a reference to the broken and updated tests, see this issue side comment.FlexColorScheme V8 now allows you to use the new colors introduced in Flutter 3.22. As before, with FCS you can get fully defined hand-tuned
ColorScheme
s without using Material-3 design's Material Color Utilities (MCU) based seed-generated ColorSchemes. You may prefer to use seed generated ColorSchemes with Material-3, but it is nice to know you do not have to.To the seed generated
ColorScheme
s, FCS adds support for all the FlutterDynamicSchemeVariant
seed generated variants. It also improves them by allowing you to use separate seed colors for each palette. With Flutter'sColorScheme.fromSeed
, you can only seed with one color, the primary color. The resultingColorScheme
always uses computed values for secondary and tertiary palettes, plus a hard coded fixed color for the error palette seeding. Surfaces colors are always tied to primary color as well and include a hint of primary color. With FCS, you do not have these limitations, you can seed with separate colors for each palette with even with Flutter's own dynamic scheme variants. This was always possible with FlexColorScheme and its FlexSeedScheme (FSS) based FlexTones, seed generated scheme variants. FCS now brings this feature to Flutter's own dynamic scheme variants as well.As before, FCS also has its own even configurable
FlexTones
way of making seed generated ColorSchemes. Typically, you use predefinedFlexTones
, but you can also create your ownFlexTones
configurations. With it, you can define the chroma goals for each palette and define which tone is mapped to whatColorScheme
color. An internal example of using them is the implementation ofFlexTones
modifiers.FlexColorScheme V8 adds three new
FlexTones
modifiers. The most useful one is calledmonochromeSurfaces()
. This tone modifier makes the surface shades of any usedFlexTones
configuration use monochrome greyscale shades for the surface and surface variant palettes. It thus gives us greyscale colors for ALL surfaces, instead of primary-tinted ones. It can be applied to anyFlexTones
seed generated scheme variant. The other new modifiers areexpressiveOnContainer()
andhigherContrastFixed()
. Check the API docs for more details.PACKAGE CHANGES
This section contains a detailed list of all changes introduced in FlexColorScheme version 8.0.0.
BREAKING CHANGES
This version contains a lot of breaking changes due to updates in the Material-3 ColorScheme in Flutter 3.22. At the same time, this release uses the forced breaking change to clean up some older APIs. FCS is now more aligned with Flutter's Material-3 theming defaults, by typically using them as starting points in the default Material-3 mode. Material-2 mode is still supported, it has its own opinionated defaults as before.
The
ThemeData
flaguseMaterial3
is now true by default to align with Flutter 3.16.0 and later default for ThemeData. To continue using Material-2 theming, setuseMaterial3
to false. All component themes inFlexSubThemes
that have auseMaterial3
property now also default to true.Keeping to Material-3 defaults, in the theme factories
light
anddark
, ifscheme
is undefined it now defaults toFlexScheme.materialBaseline
the Material-3 baseline scheme, whenuseMaterial3
is true. IfuseMaterial3
is false andscheme
is undefined, it defaults toFlexScheme.material
, the default Material-2 theme, as before.Removed ALL references to in Flutter 3.22 deprecated
ColorScheme
colorsbackground
,onBackground
andsurfaceVariant
. They are not used in FCS anymore. Thebackground
color was critical for FCS surface blending, it is now handled differently. The removal of theseColorScheme
colors had far-reaching, but typically still subtle implications on styles created by FCS. There are many breaking minor style changes in this release due to this. Here are the critical changes caused by all these breaking changes in Flutter 3.22:background
andonBackground
colors inFlexColorScheme
,FlexColorScheme.light
,FlexColorScheme.dark
,FlexThemeData.light
andFlexThemeData.dark
factories. They are not used anymore. Usesurface
andonSurface
colors instead.background
,onBackground
,surfaceVariant
fromFlexSchemeOnColors
andFlexSchemeSurfaceColors
. They are no longer used and have no function. They were deprecated since the same colors were deprecated inColorScheme
in Flutter 3.22.surfaceVariantAlpha
andbackgroundAlpha
colors inFlexAlphaValues
. They are not used anymore and have no function, usesurfaceAlpha
instead. They were deprecated since the colors they related to were deprecated inColorScheme
in Flutter 3.22.FlexSchemeSurfaceColors.blend
factory constructor produces slightly different blend result than in earlier versions. Because Flutter 3.22 deprecatedColorScheme
colorsbackground
,onBackground
andsurfaceVariant
, that were used in the blend calculation earlier. It is no longer possible to produce the same results as before, but the results are equivalent to previous design intent. With one exception, usingsurfaceMode
withFlexSurfaceMode.highBackgroundLowScaffold
sets surface and dialog blends to 2x instead of 1x, so that it represents the "high background" style as before, but done via surface. Without this breaking change, this mode would produce the same resultFlexSurfaceMode.levelSurfacesLowScaffold
and be redundant.SchemeColor
removed all the corresponding colors that Flutter 3.22 deprecated. This is a VERY breaking change and will break your code if you happened to use any of the removed enum values. This may likely happen. The removed enum values are:SchemeColor.background
,SchemeColor.onBackground
andSchemeColor.surfaceVariant
. For background Flutter recommends that you should use the valuesSchemeColor.surface
andSchemeColor.onSurface
instead and forsurfaceVariant
theSchemeColor.surfaceContainerHighest
is recommended. In all cases you can try the other new surface colors as well, to see what best fits your design goals and intent.SchemeColor
got support for all the new colors in Flutter 3.22ColorScheme
. It also removed the colors Flutter 3.22 deprecated. The order of the enum values was modified. This will break usage that depends on the enum's index, for example, storage of the values for implementations that depend on the index value.systemNavBarStyle
inFlexColorScheme.themedSystemNavigationBar
now defaults toFlexSystemNavBarStyle.surface
, instead ofFlexSystemNavBarStyle.background
. UsingFlexSystemNavBarStyle.background
results in the colorTheme.of(context).colorScheme.surfaceContainerLow
being used, where it previously wasTheme.of(context).colorScheme.background
. This is because Flutter 3.22 deprecatedColorSCheme.background
.FlexAppBarStyle
valuebackground
now results in theAppBar
using thesurfaceContainerLow
color instead ofbackground
. This breaking change was introduced because of the breaking change in Material-3 in Flutter 3.22 where the colorbackground
was deprecated. The new color is kind of the best match for the oldbackground
color in a typical FCS configuration.FlexSystemNavBarStyle
valuebackground
now results in the app bar using thesurfaceContainerLow
color instead ofbackground
. This breaking change was introduced because of the breaking change in Material-3 in Flutter 3.22 where the colorbackground
was deprecated. The new color is kind of the best match for the oldbackground
color in typical FCS configuration.Breaking rename: All helper component themes in
FlexSubThemes
ended withTheme
, as designed, exceptFlexSubThemes.bottomNavigationBar
. This mistake is now corrected, it was renamed toFlexSubThemes.bottomNavigationBarTheme
. The old version is deprecated and passes its props through to the renamed version. The old and wrong named one will be removed in version 9.0.0.Deprecated
FlexSubThemesData.blendTextTheme
, it no longer has any function. See topic "Why is blendTextTheme deprecated?" further below for more information,Deprecated the FCS legacy property
useFlutterDefaults
. FlexColorScheme in Material-3 mode now defaults to using Flutter default styles. For other configurations, modify them as desired. In Material-2 mode, FCS continues to use its opinionated own defaults as before, as long as Material-2 exists.Deprecated the static function
FlexColorScheme.createPrimarySwatch
, it is no longer used by FlexColorScheme internally, it is now deprecated in FlexColorScheme and will go away in V9. After this, you will still be able to find this function inColorTools
in the packageflex_Color_picker
, where it will remain available.Replaced the FCS legacy property
useTextTheme
with a more feature correctly named propertyuseMaterial3Typography
. Use it instead. TheuseTextTheme
originally had another function in much older versions of FCS. Its name no longer represented its function, the new name does. If not defined, the default istrue
in Material-3 mode andfalse
in Material-2 mode. If you still use Material-2, try setting this to true to get nicer typography in Material-2 mode.The color
material3DarkOnErrorContainer
was changed fromColor(0xFFFFB4AB)
toColor(0xFFFFDAD6)
to match the new Material-3 default dark error color used in Flutter 3.22.Dialog background color now defaults to
surfaceContainerHigh
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. Breaking change introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
ElevatedButton
background color now defaults tosurfaceContainerLow
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
PopupMenuButton
background color now defaults tosurfaceContainer
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
MenuBar
background color now defaults tosurfaceContainer
instead ofsurface
with elevation tint in Material-3 mode. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The produced
MenuTheme
background color now defaults tosurfaceContainer
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22. This affects default background color of the opened menu onMenuBar
,MenuAnchor
andDropdownMenu
.The
BottomSheet
background color now defaults tosurfaceContainerLow
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The produced
DrawerTheme
background color now defaults tosurfaceContainerLow
with no elevation tint color in Material-3 mode, instead ofsurface
with elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22. This affects the default background color of theDrawer
andNavigationDrawer
. FCS usessurfaceContainerLow
as background color in Material-2 mode by default too.The produced
DrawerTheme
width now defaults to 304 dp in Material-3 mode. The [official Material-3 spec is 360 dp](Material-3 spec https://m3.material.io/components/navigation-drawer/specs), FCS was using it, but Flutter SDK has so far "declined" following the Material-3 spec here and still uses the older default 304 dp used in the Material-2 spec. This older default is actually a better choice, so FCS has now opted to revert to using it as default too. For more information about this and why 304 dp is better, see Flutter issue #123380.The
FlexSubThemesData
propertiesinteractionEffects
,tintedDisabledControls
anddefaultUseM2StyleDividerInM3
now all default tofalse
. In previous versions they defaulted totrue
. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles. If you had NOT configured these values before, they defaulted totrue
. You now have to set them explicitly totrue
to opt in and get the same results as you got before when they were not configured.The
FlexSubThemesData
propertiesblendOnColors
now defaults tofalse
. In previous versions it defaulted totrue
. This change was made to have fewer opinionated defaults in FCS, to align it more with Flutter defaults. If you had NOT configured this values before, it defaulted totrue
. You now have to set it explicitly totrue
to get the same result as before, when it was not configured. Consider setting this propertytrue
in dark mode, and false inlight
theme mode, for a style that matches the Material-3 color design, when you are not using a seed generatedColorScheme
. This setting has no effect when using a seed generatedColorScheme
, as it generates blended/tinted onColors based on the seed algorithm, that overrides the effect of this setting. This setting creates a similar effect for none seeded ColorSchemes.The
FlexSubThemesData
propertyinputSelectionHandleSchemeColor
when not defined, defaults toinputDecoratorSchemeColor
and if it is not defined either, the effective text selection handle color result isColorScheme.primary
, same as Flutter SDK default. In previous versions, no definitions, resulted inThemeData.primaryColorDark
being used. This was changed in preparation of Flutter's planned deprecation ofprimaryColorDark
.The
FlexSubThemesData
propertyinputDecoratorIsFilled
now default tofalse
when undefined, like Flutter SDK does. Set it totrue
to get the same style it had with previous undefined value.The
FlexSubThemesData
propertyinputDecoratorBorderType
now default toFlexInputBorderType.underline
when undefined, producing same default as Flutter SDK does. Set it toFlexInputBorderType.outline
to get the same style it had with previous undefined value.The
FlexSubThemesData
propertyinputDecoratorUnfocusedBorderIsColored
now default tofalse
when undefined, like Flutter SDK does. Set it totrue
to get the same style it had with previous undefined value.In
FlexSubTheme.InputDecorationTheme
the following properties have new breaking default values:filled
default tofalse
,borderType
default toFlexInputBorderType.underline
andunfocusedBorderIsColored
tofalse
.The
FlexSubThemesData
propertiesnavigationRailMutedUnselectedLabel
andnavigationRailMutedUnselectedIcon
now default tofalse
. In previous versions they defaulted totrue
. This change was made to have fewer opinionated defaults in FCS and follow Material-3 design spec by default.The
FlexSubThemesData
propertiesnavigationRailUseIndicator
now defaults tonull
, resulting intrue
being used in Material-3 mode andfalse
in Material-2 mode. In previous versions it defaulted totrue
. This change was made to have fewer opinionated defaults in FCS and follow Material design specs for default values. If you still use Material-2, you now have to set this to true to see the indicator. The Playground now always sets either true or false in both modes, it never leaves out the default choice in generated config code. The field is nullable, and you can now also get the M2/M3 different default styles, by not defining this property at all.In
FlexSubThemes.navigationRailTheme
the propertiesmutedUnselectedLabel
andmutedUnselectedIcon
now default tofalse
if undefined. In previous versions they defaulted totrue
. PropertyselectedLabelSchemeColor
defaults toonSurface
andunselectedLabelSchemeColor
default toonSurfaceVariant
, they wereprimary
before. PropertyunselectedIconColor
now defaults toonSurfaceVariant
it wasonSurface
. PropertyselectedIconColor
now defaults toonSecondaryContainer
it wasprimary
. PropertylabelType
now defaults toNavigationRailLabelType.none
it wasNavigationRailLabelType.all
.The
FlexSubThemesData
propertiesnavigationRailUnselectedLabelSchemeColor
andnavigationRailUnselectedIconSchemeColor
now default toonSurfaceVariant
(wasonSurface
). TheonSurfaceVariant
is used as on color pair default when any surface color is used as background color for the rail, if a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons. ThenavigationRailSelectedIconSchemeColor
will if undefined, default to the contrast color pair fornavigationRailIndicatorSchemeColor
. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.navigationRailTheme
behave the same way.The
FlexSubThemesData
propertiesnavigationBarMutedUnselectedLabel
andnavigationBarMutedUnselectedIcon
now default tofalse
. In previous versions they defaulted totrue
. This change was made to have fewer opinionated defaults in FCS and follow Material-3 design spec by default.In
FlexSubThemes.navigationBarTheme
the propertiesmutedUnselectedLabel
andmutedUnselectedIcon
now default tofalse
if undefined. In previous versions they defaulted totrue
. PropertyselectedLabelSchemeColor
defaults toonSurface
andunselectedLabelSchemeColor
default toonSurfaceVariant
, they wereprimary
before. PropertyunselectedIconColor
now defaults toonSurfaceVariant
it wasonSurface
. PropertyselectedIconColor
now defaults toonSecondaryContainer
it wasprimary
.The
FlexSubThemesData
propertiesnavigationBarUnselectedLabelSchemeColor
andnavigationBarUnselectedIconSchemeColor
now default toonSurfaceVariant
(wasonSurface
). TheonSurfaceVariant
is used as on color pair default when any surface color is used as background color for the rail, if a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons. ThenavigationBarSelectedIconSchemeColor
will if undefined, default to the contrast color pair fornavigationBarIndicatorSchemeColor
. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.navigationBarTheme
behave the same way.The
FlexSubThemesData
propertiesbottomNavigationBarMutedUnselectedLabel
andbottomNavigationBarMutedUnselectedIcon
now default tonull
, resulting intrue
being used as default in Material-2 mode andfalse
in Material-3 mode. In previous versions these properties defaulted totrue
in both modes. This change was made to have fewer opinionated defaults in FCS.The
FlexSubThemesData
propertiesbottomNavigationBarUnselectedLabelSchemeColor
andbottomNavigationBarUnselectedIconSchemeColor
now default toonSurfaceVariant
in Material-3 mode, it wasonSurface
, which remains the default in Material-3 mode. In Material-3 mode, theonSurfaceVariant
is used as on color pair default when any surface color is used as background color for the navigation bar. If a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons, in both Material-2 and Material-3 mode. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.bottomNavigationBar
behave the same way.The
FlexSubThemesData
propertychipDeleteIconSchemeColor
now default toSchemeColor.onSurfaceVariant
. In previous versions it defaulted toSchemeColor.onSurface
. Likewise inFlexSubThemes.chipTheme
the propertydeleteIconSchemeColor
now defaults toSchemeColor.onSurfaceVariant
if undefined. In previous versions it defaulted toSchemeColor.onSurface
. This change was made to adjust to follow updated Material-3 spec defaults.The
FlexSubThemesData
propertydrawerUnselectedItemSchemeColor
now default toSchemeColor.onSurfaceVariant
, as on color pair default when any surface color is used as drawer background color. Previously it defaulted toonSurface
. Likewise inFlexSubThemes.navigationDrawerTheme
the propertyunselectedItemSchemeColor
now defaults toSchemeColor.onSurfaceVariant
if undefined. This was changed to use ase as Material-3 defaults.Minor style breaking, the tinted interactions were slightly modified. They are now a bit less pronounced and also have a bit less gray in them.
NEW
Added three new
FlexScheme
s, calledblackWhite
,greys
andsepia
. They are primarily intended to be used as prototype phase color schemes that do not use colors. This can be useful for focusing on features and layout during the early development phase, keeping the discussion away from colors. The schemes can also be used as neutral baselines for custom color schemes, where only a few colors are overridden with custom colors.The const color definition class
FlexColor
got 24 new color values to support monochrome greyscale colors for all new surfaces and their on colors for light and dark mode. These are used as starting colors for the new surface colors in the Flutter 3.22 updated and new Material-3ColorScheme
, when a seed generatedColorScheme
is NOT used. These colors follow the naming conventionlightFlexSurface___
anddarkFlexSurface___
, plus their on and inverse versions.Added named bool parameter
useOnSurfaceVariant
that defaults tofalse
, toFlexSubTheme.schemeColorPair()
and toFlexSubTheme.onSchemeColor()
, when set to true, the on coloronSurfaceVariant
is returned instead foronSurface
for all surface colors.Added
black
,white
andtransparent
as enum values toSchemeColor
. These are notColorScheme
colors, but these colors can in many theming situations be useful instead of theColorScheme
based ones.onSurface
.Added all the new surface colors in Flutter 3.22 to
FlexSchemeSurfaceColors
.Added all the new on colors in Flutter 3.22 to
FlexSchemeOnColors
.The
FlexKeyColor
class got three new properties,contrastLevel
,useExpressiveOnContainerColors
anduseLegacyMonochromeSeedBehavior
. They are used to control seed generation results.The
contrastLevel
is used to control the contrast level of MCU generated scheme colors. ThecontrastLevel
parameter indicates the contrast level between color pairs, such asprimary
andonPrimary
. The value 0.0 is the default, standard contrast; -1.0 is the lowest; 1.0 is the highest. From the Material-3 Design guideline, the standard, medium and high contrast options correspond to values 0.0, 0.5 and 1.0 respectively.contrastLevel
property is only available when seed generating aColorScheme
usingFlexSeedScheme
'sSeedColorScheme.fromSeeds
when a schemevariant
is used where itsFlexSchemeVariant.value
,isFlutterScheme
is true. This set corresponds to all theDynamicSchemeVariant
s available in the Flutter SDK.contrastLevel
is the same as the FluttercontrastLevel
property available inColorScheme.fromSeed
. As of Sep 3, 2024, thiscontrastLevel
is still only available in the master channel. It will land in the next Flutter stable, released after Flutter 3.24. With FCS v8 you can use it already now.The boolean
useExpressiveOnContainerColors
is used to make the light theme mode colorsonPrimaryContainer
,onSecondaryContainer
,onTertiaryContainer
andonErrorContainer
more color expressive, at the cost of their contrast level and accessibility. Defaults tofalse
if undefined.onPrimaryContainer
,onSecondaryContainer
,onTertiaryContainer
andonErrorContainer
have changed from tone 10 to 30 for LIGHT theme mode. This change will land in Flutter when the Material Color Utilities (MCU) package is updated to at least 0.12.0. This has not been done even in master (Sep 3, 2024).useExpressiveOnContainerColors
totrue
will make the colors use the new expressive tone. The expressive tone spec is not yet used in Flutter SDK, but is in the Material-3 design spec and also in MCU v 0.12.0. When this change lands in stable Flutter, it will be made ON by default in FCS too. You will still be able to opt out of using it. Flutter SDK and MCU will not contain such an opt-out feature.useExpressiveOnContainerColors
tofalse
. With it set to false, you will also keep this preference when the Flutter SDK defaults to using the expressive tones.The boolean
useLegacyMonochromeSeedBehavior
is used for enabling the legacy behavior for monochrome seed colorsuseLegacyMonochromeSeedBehavior
totrue
.false
.respectMonochromeSeed
inSeedColorScheme.fromSeeds
in FlexSeedScheme's internal MCU fork, and sets it!useLegacyMonochromeSeedBehavior
. In FSS this feature is opt-in and recommended to be used. Here, in FCS this setting is opt-out if not desired, and it is strongly recommended to use the new behavior. When usinguseLegacyMonochromeSeedBehavior
withAdded TextStyles for
FlexSubThemesData
so that:FlexSubThemes.appBarTheme
usesFlexSubThemesData.appBarToolbarTextStyle
for itstoolbarTextStyle
.FlexSubThemes.appBarTheme
usesFlexSubThemesData.appBarTitleTextStyle
for itstitleTextStyle
.FlexSubThemes.chipTheme
usesFlexSubThemesData.chipLabelStyle
for itslabelStyle
.FlexSubThemes.chipTheme
usesFlexSubThemesData.chipSecondaryLabelStyle
for itssecondaryLabelStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerHeaderHeadlineStyle
for itsheaderHeadlineStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerHeaderHelpStyle
for itsheaderHelpStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerWeekdayStyle
for itsweekdayStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerDayStyle
for itsdayStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerYearStyle
for itsyearStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerRangePickerHeaderHeadlineStyle
for itsrangePickerHeaderHeadlineStyle
.FlexSubThemes.datePickerTheme
usesFlexSubThemesData.datePickerRangePickerHeaderHelpStyle
for itsrangePickerHeaderHelpStyle
.FlexSubThemes.dialogTheme
usesFlexSubThemesData.dialogTitleTextStyle
for itstitleTextStyle
.FlexSubThemes.dialogTheme
usesFlexSubThemesData.dialogContentTextStyle
for itscontentTextStyle
.FlexSubThemes.floatingActionButtonTheme
usesFlexSubThemesData.fabExtendedTextStyle
for itsextendedTextStyle
.FlexSubThemes.menuButtonTheme
usesFlexSubThemesData.menuButtonTextStyle
for itstextStyle
.FlexSubThemes.timePickerTheme
usesFlexSubThemesData.timePickerDayPeriodTextStyle
for itsdayPeriodTextStyle
.FlexSubThemes.timePickerTheme
usesFlexSubThemesData.timePickerDialTextStyle
for itsdialTextStyle
.,FlexSubThemes.timePickerTheme
usesFlexSubThemesData.timePickerHelpTextStyle
for itshelpTextStyle
.,FlexSubThemes.timePickerTheme
usesFlexSubThemesData.timePickerHourMinuteTextStyle
for itshourMinuteTextStyle
.,FlexSubThemes.toggleButtonsTheme
usesFlexSubThemesData.toggleButtonsTextStyle
for itstextStyle
.FlexSubThemes.segmentedButtonTheme
usesFlexSubThemesData.segmentedButtonTextStyle
for itstextStyle
.FlexSubThemes.snackBarTheme
usesFlexSubThemesData.snackBarContentTextStyle
for itscontentTextStyle
.copyWith
on the produced component themes. With these props you get access to directTextStyle
styling for these component properties in the FCS API too.Added
useCupertinoStyle
property toFlexSubThemes.switchTheme
. AddedswitchAdaptiveCupertinoLike
property toFlexSubThemesData
and madeFlexSubThemes.switchTheme
use it.Added
secondarySelectedSchemeColor
,fontSize
,secondaryFontSize
,iconSize
andpadding
properties toFlexSubThemes.chipTheme
. AddedchipSecondarySelectedSchemeColor
,chipFontSize
,chipSecondaryFontSize
,chipIconSize
andchipPadding
properties toFlexSubThemesData
and madeFlexSubThemes.chipTheme
use them.Added
headerForegroundSchemeColor
property toFlexSubThemes.datePickerTheme
. AddeddatePickerHeaderForegroundSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.datePickerTheme
use it for its header foreground color.Added
dividerSchemeColor
property toFlexSubThemes.datePickerTheme
. AddeddatePickerDividerSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.datePickerTheme
use it for its divider color.Added
isDense
property toFlexSubThemes.inputDecoratorTheme
. AddedinputDecoratorIsDense
property toFlexSubThemesData
.Added
contentPadding
property toFlexSubThemes.inputDecoratorTheme
. AddedinputDecoratorContentPadding
property toFlexSubThemesData
and madeFlexSubThemes.inputDecoratorTheme
use it.Added
inputDecoratorSuffixIconSchemeColor
property toFlexSubThemes.inputDecorationTheme
. AddedtoggleButtonsSelectedForegroundSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.segmentedButtonTheme
use it.Added
adaptiveInputDecoratorRadius
andinputDecoratorRadiusAdaptive
properties toFlexSubThemesData
. They are used to select platform(s) to an alternative border radius response for the input decorator, for the selected platform(s).Added
minWidth
andminExtendedWidth
toFlexSubThemes.navigationRailTheme
. AddednavigationRailMinWidth
andnavigationRailMinExtendedWidth
properties toFlexSubThemesData
and madeFlexSubThemes.navigationRailTheme
use them.Added
tabAlignment
property toFlexSubThemes.tabAlignment
. AddedtabBarTabAlignment
property toFlexSubThemesData
and madeFlexSubThemes.tabBarTheme
use it for its. (TODO: Add a note about thrown assert, open an issue in Flutter SDK about it and suggest an alternative solution.)Added
foregroundSchemeColor
property toFlexSubThemes.floatingActionButtonTheme
. AddedfabForegroundSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.floatingActionButtonTheme
use it for its foreground color.Added
selectedForegroundSchemeColor
property toFlexSubThemes.segmentedButtonTheme
.Added
segmentedButtonSelectedForegroundSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.segmentedButtonTheme
use it.Added
selectedForegroundSchemeColor
property toFlexSubThemes.toggleButtonsTheme
.Added
toggleButtonsSelectedForegroundSchemeColor
property toFlexSubThemesData
and madeFlexSubThemes.toggleButtonsTheme
use it.Added
appBarForegroundSchemeColor
,appBarIconSchemeColor
andappBarActionsIconSchemeColor
properties toFlexSubThemesData
and madeFlexSubThemes.appBarTheme
use it for its colors on title, icon and actions.Added
bottomAppBarHeight
property toFlexSubThemesData
and madeFlexSubThemes.bottomAppBarTheme
use it as itsheight
value.Added
scaffoldBackgroundBaseColor
property toFlexSubThemesData
. It is aFlexScaffoldBaseColor
enum that can be used to select the base color used asThemedata.scaffoldBackgroundColor
in a theme. The selected base color is modified by usedsurfaceMode
andblendLevel
] in theFlexColorScheme
'slight
anddark
factory constructors.Added
scaffoldBackgroundSchemeColor
property toFlexSubThemesData
and madeThemeData.scaffoldBackgroundColor
use it as an override color, if it is defined. SettingscaffoldBackgroundSchemeColor
will override any blended background or true black or plain white setting.Added
cupertinoOverrideTheme
toFlexColorScheme
constructor and toFlexColorScheme.light
,FlexColorScheme.dark
,FlexThemeData.light
andFlexThemeData.dark
factory constructors.Added enum
variant
aFlexSchemeVariant
toFlexColorsScheme
andFlexThemeData
light and dark. This is used to define the variant of the seededColorScheme
. It is an alternative totones
that also includes scheme seed variants that Flutter SDK added in version 3.22.2.Added enhanced enum functions
data
andcolors
to theFlexScheme
enum, that returns the predefinedFlexSchemeData
andFlexSchemeColor
respectively, that are associated with a given enum value. This could be done already using theFlexColor.schemes
map. This is a convenience API to be able to use e.g.FlexColor.mango.data
to get the predefinedFlexSchemeData
for themango
enum scheme and e.g.FlexColor.barossa.colors(Brightness.dark)
to get the pre-defined dark colors used for thebarossa
scheme colors. See feature request: https://github.com/rydmike/flex_color_scheme/issues/210Added ability to use custom seed key colors to
FlexKeyColors
.Added support for error colors to
FlexKeyColors
.Added direct color properties for
errorContainer
andonErrorContainer
toFlexColorScheme
,FlexColorScheme.light
,FlexColorScheme.dark
,FlexThemeData.light
,FlexThemeData.dark
. It was required to support custom error container colors in theFlexKeyColors
API.Added
Color
propertiesprimaryLightRef
,secondaryLightRef
andtertiaryLightRef
toFlexSchemeColor
.FlexSchemeColor
made for light mode in the dark modeFlexSchemeColor
. This is used to create computed "fixed" and "fixedDim" colors for dark mode and the light modeColorScheme
that are identical in light and dark mode.FlexSchemeColor()
,FlexSchemeColor.from()
,FlexSchemeColor.effective()
andFlexSchemeColor.toDark()
work correctly with the newprimaryLightRef
,secondaryLightRef
andtertiaryLightRef
properties.light
color properties inFlexSchemeData
staticFlexSchemeColor
color definitions, as lightRef colors in theirdark
mode equivalent FlexSchemeColor. That was 156 color values to add to the 52 darkFlexSchemeColor
definitions.Added
fixedColorStyle
toFlexColorScheme
,FlexColorScheme.light
,FlexColorScheme.dark
,FlexThemeData.light
,FlexThemeData.dark
. It was required to support custom error container colors in theFlexKeyColors
API. The property is an enumFlexFixedColorStyle
, that allows us to choose the style of the generated "fixed" and "fixedDim" colors when not using seed generated color schemes.Added
Color
propertiesprimaryLightRef
,secondaryLightRef
andtertiaryLightRef
toFlexColorScheme.dark
andFlexThemeData.dark
. If you use the override colorsprimary
,secondary
ortertiary
and are not using seeded ColorScheme, you need them to provide the correct light mode reference colors for computing fixed colors that will match the light mode fixed colors, for that it is required to know what the light mode colors are. If you are seeding and use the overrides, and will switch between seeded and not seeded, you can provide the override for the not seeded values inprimary
,secondary
ortertiary
, and the ref to their seed colors from light mode, in the light ref colors. If you always seed when using the overrides, you can also provide the seed colors in theprimary
,secondary
ortertiary
overrides, the light refs fall through to these colors in that cases if not provided during seeding.Added style
navigationBar
to enumFlexSystemNavBarStyle
that use the color for default or themedNavigationBar
background color on the system navigation bar helper.navigationBar
option does not require using the edge-to-edge config required when using transparent system navigation bar to see things behind it. Thetransparent
option sets edge-to-edge mode behind the scenes when used. This can cause some layout changes that must be considered in the app design when used. This is an optional way to style the system navigation bar to match the app's themedNavigationBar
background color, without using edge-to-edge Android screen mode.Added
ListTile
theming support toFlexSubThemesData
and made correspondingFlexSubThemes.listTileTheme
properties use them inFlexColorScheme
asListTileTheme
theming properties.FlexSubThemesData
properties were added:listTileSelectedSchemeColor
,listTileIconSchemeColor
,listTileTextSchemeColor
,listTileTitleTextStyle
,listTileSubtitleTextStyle
,listTileLeadingAndTrailingTextStyle
,listTileTileSchemeColor
,listTileSelectedTileSchemeColor
,listTileContentPadding
,listTileHorizontalTitleGap
,listTileMinVerticalPadding
,listTileStyle
,listTileTitleAlignment
andlistTileControlAffinity
.Added
SearchBar
andSearchView
theming support toFlexSubThemesData
and made correspondingFlexSubThemes.searchBarTheme
andFlexSubThemes.searchViewTheme
properties use them inFlexColorScheme
asSearchBarThemeData
andSearchViewThemeData
theming properties.FlexSubThemesData
properties were added:searchBarBackgroundSchemeColor
,searchViewBackgroundSchemeColor
,searchBarElevation
,searchViewElevation
,searchBarRadius
,searchViewRadius
,searchViewHeaderHeight
,searchBarTextStyle
,searchViewHeaderTextStyle
,searchBarHintStyle
,searchViewHeaderHintStyle
,searchViewDividerColor
,searchBarShadowColor
,searchBarTextCapitalization
,searchBarPadding
,searchBarConstraints
,searchViewConstraints
andsearchUseGlobalShape
.CHANGE
Changed all internal usage of
MaterialStateProperty
andMaterialState
to use newWidgetStateProperty
andWidgetState
introduced in Flutter 3.22 and later.Static functions
FlexSubThemes.schemeColor
andFlexSubThemes.onSchemeColor
now support the updatedSchemeColor
andColorScheme
.Improved the theming logic for
Card
theme.Card.outlined
variant for the default case at least. This Flutter theming limitation and impact is thus now the same in FCS, as it is with vanilla FlutterThemeData
and itsCardTheme
. It is still broken as mentioned in the above issue, but that is a Flutter theming issue and limitation that FCS cannot fix.Changed the
FlexSubThemes.inputDecoratorTheme
to use onlyborder
and its WidgetState for its theme. It offers more and nicer control over hover state than using the older legacy more limited border styles.FIX
Fixed #198 AppBar color issue when using seed generated scheme with key color locked.
Fixed that the Rectangular Slider value indicator did not default to
primary
color when undefined, as intended in FCS M2 and M3 mode. Only the Drop style indicator defaulted to primary. This came from the framework defaulting the old M2 rectangular indicator to a complex, opacity and alpha blendedonSurface
grey looking result.Why is blendedTextTheme deprecated?
The
blendTextTheme
feature was originally made before Material-3's TextTheme was available, before it was fully known how it was going to be implemented. It was an approximation of the TextStyles that could be seen in early versions of Material-3 images. Since the actual Material-3 TextTheme is available, the tinted TextTheme feature is no longer required. While the FCS tinted TextTheme did provide an alternative version of the actual tint used in Material-3, the differences were quite subtle. Additionally, recent changes in Flutter make using it very verbose and complicated. Why it does so is explained in detail below.In Material-3 Typography 2021, the TextTheme and all styles in it are fully opaque and use onSurface as color on all TextStyles. In a seed generated ColorScheme, the text styles become primary color tinted, because the onSurface color by default has subtle primary tint. With FCS, you can modify the onSurface to black or white to avoid this, if so preferred.
In Material-2 Typography 2018 and 2014, some TextStyles in their TextThemes use partially transparent white or black colors, making them appear tinted when placed on lightly colored backgrounds. Such TextStyles also have lower contrast. If the Material-3 default text theme is used on background colors that are tinted with a color that deviates a lot in hue from the hue used as tint color by the TextTheme, it may not fit it so well. The Material-2 opacity-based text styles do not have this limitation. It is unknown why Material-3 switched to a fixed tint color instead of using the opacity-based approach used in Material-2, that is more universally usable on backgrounds with different tint colors.
In Material-3, some component themes override the default color of the default TextTheme TextStyles they use with
onSurfaceVariant
. This color has slightly more tint and lower contrast than the defaultonSurface
. This is used for elements in components that should have less emphasis. Many default Material-3 components also override the color in default TextTheme TextStyles they use withColorScheme.onSurface
color, that it actually already has in a default TextTheme. These two overrides results in that whatever color the default TextTheme TextStyles have, they will be overridden by theseColorScheme
colors. Resulting in that any custom-coloredTextTheme
and itsTextStyle
s are not getting used by such Material-3 components and that the custom colors from the meticulously colored customTextTheme
, are rarely visible anywhere in a Material-3 application. Material-2 component themes do not do this, nor did older Flutter versions of Material-3 component themes do this.An issue has been raised explaining the challenges this newer approach in Flutter causes when using custom colored text themes. If this issue is addressed, the tinted TextTheme feature in FCS may be brought back if it is a requested feature.
In current Flutter versions, using a custom-tinted TextTheme is rather pointless. You can, but it is not enough to define the TextTheme. You also have to pass each tinted TextStyle it has to the appropriate TextStyles in ALL component themes that override its colors, for it to have any effect. It is typically not worth the effort.
THEMES PLAYGROUND
NEW
The Theme Code view panel now has a toggle that allows you to generate the configured code for the theme as input suitable for a separate app theme file. It has static getters that you can use in your
MaterialApp
'stheme
anddarkTheme
.The Theme Code view got a long asked for feature, Themes Playground settings export and import! You can now export your configured theme settings to a JSON file and import them back into the Playground later. This is a great way to save your theme settings for later use or to share them with others. The exported JSON file contains all the internal controller settings values you have configured in the Playground that are needed to restore a given configuration state. This Playground feature was contributed by GitHub user @akiller in !PR 257. Thank you!
The contributed feature got enhanced with more error handling and a slightly refined UI to make it production ready.
As a further enhancement of the JSON export feature, the Themes Playground app also got the ability to convert the exported settings JSON config to a shareable URL. You can now share Playground settings with other Flutter developers.
On each theme settings panel, many controls now appear in two columns to reduce the need to scroll so much on wider media and see more controls on the same screen. The layout is panel width responsive and controls will be in one column as before on smaller media.
Split the "FAB and Chip" settings panels to separate panels FAB and Chip.
Split the "BottomAppBar and SearchBar" panels to separate panels SearchBar and BottomAppBar.
On the surface Color Blends settings panel, you can choose which surface color the scaffold background color will use as its starting point surface color and as base for the blend level and mode. You can also select any ColorScheme color and use it as an override for the scaffold background color. This will override any blended color result as well as the plain white and true black settings.
The ColorScheme settings panel got five new settings:
contrastLevel
property inColorScheme.fromSeed
. It is used to control the contrast level of the generated scheme colors. It will most likely land in the next stable Flutter release after 3.24. With FCS V8 you can use it already now.fixed
,onFixed
,fixedDim
andonFixedVariant
colors, when a seed generatedColorScheme
is NOT being used.fixed
,onFixed
,fixedDim
andonFixedVariant
colors to the Material-3 design specified values 90, 10, 80, 30 or and or opt-in on an alternative set 92, 6, 84, 12 that have higher contrast.onPrimaryContainer
,onSecondaryContainer
,onTertiaryContainer
andonErrorContainer
have changed from tone 10 to 30 for LIGHT theme mode. This change will land in Flutter when the Material Color Utilities (MCU) package is updated to at least 0.12.0. This has not been done even in master (Sep 3, 2024).Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.