FlexSubThemesData font size change going from 6.1.2 to 7.0.5 #150
-
I've seen a jump in text size going from flex_color_scheme 6.1.2 to 7.0.5. I am unable to find a reason for this going through the changelog and releases. After testing a few of the FlexThemeData's props I've narrowed it down to FlexSubThemesData. The following does not have the same font size on 6.1.2 and 7.0.5:
Do you perhaps know why this might be? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Petri-Oosthuizen thanks for your question. It is a good question and glad to have it here in Q&A section, it will be a good addition to it. Also sorry for the delay, for some reason I did not see the question here before, despite that I am sure I checked, I try to check in daily, and I should get notifications in the GH app too, but did not see one for this, weird. The answer is quite simple, it is a breaking change from V6 to V7. Breaking Change V6 to V7
|
M2-Mode useTextTheme:null | M2-Mode useTextTheme:false | M2-Mode useTextTheme:true |
---|---|---|
Above in M2 mode, you only see any code impact from the setting, when you are in M2 mode and the setting is ON, then you see the useTextTheme: true
. If you keep the setting "ON", and change to M3 mode, Playground removes it from presented code, since adding the true
value produces the displayd result anyway. This can be seen below:
M3-Mode useTextTheme:null | M3-Mode useTextTheme:false | M3-Mode useTextTheme:true |
---|---|---|
It would probably be clearer if the Playground always wrote code with useTextTheme: false/true
regardless of mode when it is not default/null. Since if you change M2/M3 mode in code in your app, after copy/pasting the code from Playground and you had true/false defined in the toggle, but it was not needed in the used M2/M3 mode, you would not know that you need to set it if you change the mode in code, to get the same style with the API when you toggle mode. The Playground does this automatically, adds the code for the toggle only when needed, and removes it whenever not needed.
The Playground goes more with "what you see when you copy the code, is what you get". If you edit the code in your app after copying, and are not familiar with the API, you may in a few rare cases get different results. For this property, keeping the true/false value in code Playground writes, as soon as it is not not null, is probably a better idea for the Playground behavior. It would facilitate more understandable behavior when toggling M2/M3 in code produced by the Playground.
Properties with Similar Playground behavior
There are a few other similar settings that the Playground removes when you switch to M2 mode, even if the toggles are on in the Playground. They are settings that have no impact in M2. Their names are more obvious though, like swapLegacyOnMaterial3: true
and useM2StyleDividerInM3: true
. Even so, I think I should do the same for them, so that Playground writes them out from your settings if you have them ON, even if you use M2 mode, where they have no effect. Then if you toggle in code to M3, you get the effect you might have seen when you used them code in M3 mode in the Playground. Well I think I will keep those two as they are for now, currently Playground disables their controls and removes their value from code when you toggle to M2, so at least in Playground it is clear they have no use in M2 mode. In the API if you leave them in there in M3 mode, they just don't have any effect.
Hope this answers your question, with more detail than you probably wanted to know 😄
Below a ref to the obscure change log entry about this case.
The actual change log of useTextTheme
- API default value breaking: The
FlexSubThemesData
propertyuseTextTheme
, is now nullable and defaults to null. Previously it was not nullable and defaulted to false. As before, this boolean toggle determines if the Material 3 TextTheme and Typography is used.- When opted in on using FCS sub-themes, this flag controls if text theme uses the new Material
Typography.material2021
. - If not defined, and
ThemeData.useMaterial3
is true, thenuseTextTheme
defaults to true andTypography.material2021
is used. - If
ThemeData.useMaterial3
is false, thenuseTextTheme
defaults to false, andTypography.material2018
is used. - This toggle works as a quick override setting for using
Typography.material2021
in Material 2 mode, and for usingTypography.material2018
in Material 3 mode. - As before, when using FlexColorScheme and
ThemeData.useMaterial3
is false and sub themes are not used, the default typography isTypography.material2018
. Note that if FlexColorScheme is not used at all, and yourThemeData
hasThemeData.useMaterial3
set to false, then Flutter defaults to using obsoleteTypography.material2014
. In such a case, consider defining your typography manually toTypography.material2018
or why not evenTypography.material2021
. - If you specify a custom
typography
forFlexColorScheme
orFlexThemeData
, theuseTextTheme
property has no impact on used typography at all.
- When opted in on using FCS sub-themes, this flag controls if text theme uses the new Material
For a complete list of ALL changes from 6.1.2 to 7.0.0, see the logs below. There are a shitload of them. But most breaking changes are (minor) style breaking, meaning API still works as before and produces very similar result. This one that you stumbled on is API breaking though, and recorded as such and can give big diff in result.
7.0.0
Apr 2, 2023
This is a major update to the FlexColorScheme package and a substantial leap for the companion app Themes Playground. For a detailed list of all changes, please refer to the incremental log from its development releases linked below.
Beta Was this translation helpful? Give feedback.
Hi @Petri-Oosthuizen thanks for your question.
It is a good question and glad to have it here in Q&A section, it will be a good addition to it.
Also sorry for the delay, for some reason I did not see the question here before, despite that I am sure I checked, I try to check in daily, and I should get notifications in the GH app too, but did not see one for this, weird.
The answer is quite simple, it is a breaking change from V6 to V7.
Breaking Change V6 to V7
useTextTheme
The breaking change property in action is
useTextTheme
insubThemesData
.Background
The left one in your pics is the Material
Typography2018
, that should be used in Material2 (M2) design. FlutterThemeData
by the way d…