diff --git a/CHANGELOG.md b/CHANGELOG.md index a9493594..f5e8ad79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,31 @@ All changes to the **FlexColorScheme** (FCS) package are documented here. +## 7.1.1 + +**May 15, 2023** + +**PACKAGE** + +**FIX** + +* Fixed regression issue where custom a `textTheme`'s color is no longer applied. + * See issue [#151](https://github.com/rydmike/flex_color_scheme/issues/151). + * The issue was introduced in version 7.0.0, when adding a feature that provided automatic correct default contrast text color for **GoogleFonts**, when a default `GoogleFonts` and its `TextTheme`, like `GoogleFonts.notoSansTextTheme()` is used in `textTheme` or `primaryTextTheme` in `FlexColorScheme`. + * The `GoogleFonts` and its `textTheme` color always defaults to the color from M2 mode default light mode `ThemeData.light().textTheme`. This when used in `ThemeData` forces users to assign correct M2/M3 color and `textTheme`/`primaryTextTheme` contrast color, to all its styles, whenever used in a situation where the default is light theme mode M2 color is the wrong color. The default contrast color is basically only correct for a light theme when using Material 2. For anything else, it is incorrect. + * FCS version 7.0.0 got rid of the need to make such correction assignment, but it also incorrectly disabled using custom colors used in any custom `TextTheme`. + * The applied FIX keeps the desired "no need to give correct contrast color" to a default **GoogleFonts** `TextTheme` in **FlexColorScheme** and also allows making custom colored text custom text themes. + * The FIX is a bit involved, it also led to an idea that maybe `GoogleFonts`, should just keep the font color default as null, and let Flutter's default Theme behavior handle the assignment of correct color for the M2/M3 mode and light/dark theme mode, using each mode's default contrast color, for each style in the `TextTheme`. See issue [GoogleFonts #401](https://github.com/material-foundation/flutter-packages/issues/401) for more info on this. + * Tests added for the regression and for the new `GoogleFonts` default `TextTheme` being used and nulling its colors, so they get correct M2/M3 mode default contrast colors in both light and dark mode and for both `textTheme` and `primaryTextTheme`. + + +**THEMES PLAYGROUND** + +**FIX** + +* Fixed the code gen for `useTextTheme` setting to always generate code for setting's value in Playground code gen when it is not null. When it is undefined or null, it means that the `TextTheme` follows the M2/M3 specification mode default `TextTheme` and `Typography`. In previous versions, the code setting for `useTextTheme` only showed up in the generated code when it was needed to produce the viewed end result. If the M2/m3 mode default produced the same result, the setting was not added to the generated API config. This may be confusing. It is clearer to always show it in code gen when it is set to a none null value. See discussion in repo [Q&A #150](https://github.com/rydmike/flex_color_scheme/discussions/150). + + ## 7.1.0 **May 12, 2023** @@ -28,7 +53,7 @@ FlexColorScheme v7.1.0 supports new theming features in Flutter 3.10, it thus re * **UPDATE** - Reviewed and updated status of all known theming issues in info expands. - - The SKIA **canvaskit** renderer is again being used to build all the web examples, including the Themes Playground. + - The SKIA **canvaskit** renderer is again being used to build all the web examples, including the **Themes Playground**. - Updated all examples to use new `ListenableBuilder` instead of `AnimatedBuilder` where appropriate. @@ -94,7 +119,7 @@ This is a major update to the **FlexColorScheme** package and a substantial leap - Package: Only tests and documentation additions and updates. - Playground: Label and layout corrections. -The [Themes Playground](https://rydmike.com/flexcolorscheme/themesplayground-v7/) app built for this release is unfortunately not a SKIA renderer build, it is using the HTML renderer. This makes it less performant than the app would otherwise be. Additionally, scaled content, like the **Themes Simulator** panel in the **Playground**, is also fuzzier than it would be with the SKIA renderer. Due to an issue in Flutter stable 3.7.0 to at least 3.7.9, builds made with the SKIA renderer performs very poorly and crash quickly. For more information, see Flutter [issue #122189](https://github.com/flutter/flutter/issues/122189). A new build using the same package version will be made later and released when a fix for the SKIA issues are available on the Flutter stable channel. +The [Themes Playground](https://rydmike.com/flexcolorscheme/themesplayground-v7/) app built for this release is unfortunately not a SKIA renderer build, it is using the HTML renderer. This makes it less performant than the app would otherwise be. Additionally, scaled content, like the **Themes Simulator** panel in the **Playground**, is also fuzzier than it would be with the SKIA renderer. Due to an issue in Flutter stable 3.7.0 to at least 3.7.9, builds made with the SKIA renderer performs very poorly and crash quickly. For more information, see Flutter [issue #122189](https://github.com/flutter/flutter/issues/122189). A new build using the same package version will be made later and released when fixes for the SKIA issues are available on the Flutter stable channel. ## 7.0.0-dev.3 @@ -143,9 +168,9 @@ The companion app **Themes Playground**, may get label improvements plus spellin **FlexColorScheme** version 6.1.0 contains many new features, more component sub-themes and configurable properties. It improves seed-generated color scheme capabilities by adding more pre-configured seed generation configurations and color contrast accessibility options. -A criticism of Material 3's color system and seed-generated color schemes, is that using colored contrasting colors may be less accessible. FlexColorScheme offers a way to enable in-app modification of its seed-generated color schemes, any seed generation configuration can optionally return results with plain white and black contrasting on colors. This can be applied separately for main on colors and on surfaces. +A criticism of Material 3's color system and seed-generated color schemes, is that using colored contrasting colors may be less accessible. FlexColorScheme offers a way to enable in-app modification of its seed-generated color schemes. Any seed generation configuration can optionally return results with plain white and black contrasting on colors. This can be applied separately for main on colors and on surfaces. -The **Themes Playground** application, has been updated to include most of the new features. It has been improved to make it easier to discover some of its previously existing features, like using custom colors in the Playground to define your own theme. +The **Themes Playground** application has been updated to include most of the new features. It has been improved to make it easier to discover some of its previously existing features, like using custom colors in the Playground to define your own theme. **NEW** @@ -200,15 +225,15 @@ The **Themes Playground** application, has been updated to include most of the n - Same temporary M3 fix is also used on themed `PopupMenuButton`. - Unfortunately, elevation-based shadow cannot be added to any of them in the M3 mode. It will have to wait for actual implementation of the components and their Material 3 themes with support for it. - The M3 supporting components and themes for `BottomSheet` and `PopupMenuButton`, already exist in the Flutter master channel, they will probably land in next new stable release after Flutter 3.3. - - These temporary M3 fixes, make it possible to use the `BottomSheet` and `PopupMenuButton` when opting in on Material 3. Since shadow elevations are still not working for them in M3, it is not perfect, but much better. + - These temporary M3 fixes, make it possible to use the `BottomSheet` and `PopupMenuButton` when opting in on Material 3. Since shadow elevations are still not working for them in M3 mode, it is not perfect, but much better. - The reasons why these issues exist are because these components have not yet been migrated to M3 in Flutter 3.3, plus the combination of this `Material` elevation [issue #107190](https://github.com/flutter/flutter/issues/107190) in M3 mode. As a result we get no elevation tint or any shadow on such `Material` using widgets in M3 mode. - The [issue #107190](https://github.com/flutter/flutter/issues/107190) has been fixed in master. Even if only it lands, we will get shadows back in M3 default `Material`, also if the components and their themes do not land. In combination with the here made M3 manual elevation tint fix, they would in such a case get the correct M3 default background elevation tint behaviour and shadow. - - The above temporary work-around fixes will be removed when the stable version of the framework implements correct Material 3 elevation behavior for these widgets, and produces the same results itself. Hopefully in the next stable release of Flutter. + - The above temporary work-around fixes will be removed when the stable version of the framework implements the correct Material 3 elevation behavior for these widgets, and produces the same results itself. Hopefully in the next stable release of Flutter. **THEMES PLAYGROUND** * On **Theme colors** panel: - - Improved the discoverability of defining and using totally custom colors for your theme in the **Playground**. It has always existed, but maybe now users will discover it more easily. You can still also copy any existing theme, as a starting point for your custom color definitions. + - Improved the discoverability of defining and using totally custom colors for your theme in the **Playground**. It has always existed, but maybe now users will discover it more easily. You can still also copy any existing theme as a starting point for your custom color definitions. - Simplified the terminology used on the **Theme colors** panel. Also simplified its color presentation. - Added an on/off switch that controls the `swapLegacyOnMaterial3` setting. @@ -221,9 +246,9 @@ The **Themes Playground** application, has been updated to include most of the n - The Tonal palette color **tones** now have tooltips that present each tone. * On **Surface blends**: - - Changed the surface blend mode defaults to settings that are more mobile design-friendly. No API change involved. API defaults are the same as before, changes only affect the Playground app defaults. + - Changed surface blend mode defaults to values that are more mobile design-friendly. No API change involved. API defaults are the same as before, changes only affect the Playground app defaults. - Previously used **Playground** default values were intended for desktop and tablet designs, where controls and text are placed on containers with a lower surface blend, like the **Cards** used in the Themes Playground app itself. While one can make a responsive app, that uses this design nicely from mobile to tablet and desktop sizes, most mobile only apps are not designed so. Using Playground defaults that produce a nice theme for more typical mobile designs, will help new FlexColorScheme and Themes Playground users, configure nice themes even quicker. - - The blend mode control now also has a popup-menu, that always shows all surface blend modes, also in smaller UI. On smaller devices the `ToggleButtons` control, as before, only shows popular options. + - The blend mode control now also has a popupmenu that always shows all surface blend modes, also in smaller UI. On smaller devices the `ToggleButtons` control, as before, only shows popular options. * Other **new controllable properties** and features: - **AppBar** theming can now use themed `scaffoldBackground` color as its themed background color. This is useful for matching the AppBar color exactly to the Scaffold background color, when Scaffold background uses different surface blends than the theme's ColorScheme surface or background colors. @@ -246,7 +271,7 @@ The **Themes Playground** application, has been updated to include most of the n - A themed `Slider` widget is now presented in the **Widget Showcase** panel. Basic theming options are now available. The Slider theme is already excellent out of the box. When you need more radical changes to it, those typically go beyond the scope of FCS and require extending the Slider widget. - Removed animation from horizontal list **Theme selector** when selecting a theme. - Removed animation from the theming topics when selecting one on the **Page view**. - - Removed the slide to page animation, when clicking on a topic, on the **topic panel selector**. + - Removed the slide to page animation, that was used when clicking on a topic on the **topic panel selector**. - Direct panel/page selection via the control now instead uses a small **Fade and Zoom in** to show the selected settings panel. - Without any panel page change effect, it was hard to notice what changed. The default slide to the page animation, with the `PageView` is fine when swiping, where it remains, but it was a tad annoying when clicking on the panel page selector. - Changed all used `Slider.adaptive` to `Slider`. @@ -257,7 +282,7 @@ The **Themes Playground** application, has been updated to include most of the n * **FIX** Themes Playground - - Fixed codegen for Switch, CheckBox and Radio, that did not include color selection for setting primary color since it used to be default. The issue only concerned the Themes Playground code generation, APIs worked as expected. + - Fixed the codegen for Switch, Checkbox and Radio, that did not include color selection for setting primary color since it used to be default. The issue only concerned the Themes Playground code generation, APIs worked as expected. ## 6.0.1 @@ -268,7 +293,7 @@ The **Themes Playground** application, has been updated to include most of the n * A null check was fixed by [sososdk](https://github.com/sososdk) in `FlexColorScheme.light` when using custom scheme [PR #90](https://github.com/rydmike/flex_color_scheme/pull/90). Issue did not exist in `FlexColorScheme.dark`. -* Cam16 from Material Color Utilities exported by accident by FlexColorScheme in version 6.0.0 via its **FlexSeedScheme** package export. This export was removed. Cam16 was not exported before moving features to FlexSeedScheme and should not have been now either. FlexSeedScheme does, however export it as before, it is used by the **FlexColorPicker**. +* Cam16 from Material Color Utilities exported by accident by FlexColorScheme in version 6.0.0 via its **FlexSeedScheme** package export. This export was removed. Cam16 was not exported before moving features to FlexSeedScheme and should not have been now either. FlexSeedScheme does export it as before. It is used by the **FlexColorPicker**. ## 6.0.0 @@ -359,7 +384,7 @@ issues. sub-themes. FCS applies this color to `FlexSubThemes.elevatedButtonTheme.onBaseSchemeColor`. If `useMaterial3` is false, it is the foreground color. If `useMaterial3` is true, it is the background color. Material 3, and 2, have completely different elevated button styles. - The Material 2 elevated button is color wise, like the M3 filled button, but with elevation. + The Material 2 elevated button is color wise, like the M3-filled button, but with elevation. * Added two new properties to `FlexSubThemes.outlinedButtonTheme`. * Boolean `useMaterial3`, defaults to false. @@ -416,7 +441,7 @@ self-deprecated members as follows: depends on and FCS also uses, introduced a minor breaking change going from version 0.1.4 to 0.1.5. Some colors in the tonal palettes no longer give exactly the same color values as before. This changes the results for some colors when you create a `ColorScheme.fromSeed` or FCS does - it internally with its extended version `SeedColorScheme.fromSeeds`. The new algorithm changes, + it internally with its extended version `SeedColorScheme.fromSeeds`. The new algorithm changes all the default M3 error colors slightly. The changes in the color values are minor, and not visually noticeable to the eye. Values are still slightly different, and this release uses the new value for FCS M3 error colors. Tests were also updated to use the new values. @@ -457,8 +482,9 @@ self-deprecated members as follows: did not have a custom default before. These are new defaults for the opinionated dialog sub-theme for both M2 and M3. -* Updated `Chip` sub-theme when opting in on `useMaterial3`. When `true` it now uses upcoming M3 - styled Chips instead of its own opinionated custom style, also when the opinionated component +* Updated `Chip` sub-theme when opting in on `useMaterial3`. When `useMaterial3` is `true`, it + now uses upcoming + M3-styled Chips instead of its own opinionated custom style, also when the opinionated component sub-themes are enabled. To get the same opinionated coloring as before, but on the M3 styled chips when using M3, set component sub-themes data `subThemesData: const FlexSubThemesData(chipSchemeColor: SchemeColor.primary)`. @@ -588,7 +614,7 @@ also at least in Flutter *master 3.1.0-0.0.pre.2216* and earlier: **July 8, 2022** -* Updated to support *Flutter 3.0.0*, with *Dart 2.17* and latest Flutter package dependencies in example apps. Requires at least *Flutter 3.0.0* and *Dart 2.17.0*. +* Updated to support *Flutter 3.0.0*, with *Dart 2.17* and the latest Flutter package dependencies in example apps. Requires at least *Flutter 3.0.0* and *Dart 2.17.0*. **NEW** @@ -627,7 +653,7 @@ also at least in Flutter *master 3.1.0-0.0.pre.2216* and earlier: * Added a **Theme Extensions** example to the default example app *Hot Reload Playground*. -* *Themes Playground:* Updated the default style info labels for Switch, CheckBox and Radio. +* *Themes Playground:* Updated the default style info labels for Switch, Checkbox, and Radio. * *Themes Playground:* To the top row theme selector, where the FlexColorScheme and component themes switches are, added the "Use Material 3" toggle. Previously, this toggle was only available on the introduction panel. The availability in the header makes it easy to toggle it ON and OFF at any time, to see what impact it has on widgets. @@ -687,7 +713,7 @@ the built-in schemes have been kept minimal compared to previous styles. Mostly new color values were added to provide support for all the new colors in the Flutter Material 3 `ColorScheme` update, that landed in Flutter -2.10.0. The new colors are style aligned with past styles as far possible, while +2.10.0. The new colors are style aligned with past styles as far as possible, while also keeping them inline with the Material 3 ColorScheme design intent. As `ColorScheme.primaryVariant` and `secondaryVariant` have been deprecated @@ -868,8 +894,8 @@ in version 4 deprecated members and, of course, requiring minimum Flutter **DEPRECATED** * The property `surfaceStyle` has been deprecated. In - version 4.0.0 it was already recommended to use, the then introduced more - powerful surface branding properties `surfaceMode` and `blendLevel` instead. + version 4.0.0 it was already recommended to instead use the then introduced more + powerful surface branding properties `surfaceMode` and `blendLevel`. The `surfaceStyle` property is still available and works as before, but you now get a deprecation warning if it is used. The property and all its related features will be completely removed in version 5.0. @@ -1006,7 +1032,7 @@ in version 4 deprecated members and, of course, requiring minimum Flutter * **Example theme — Copy Playground Theme** - * Added a new simple template example, that is handy for trying copy-pasted + * Added a new simple template example that is handy for trying copy-pasted theme setup code, generated by Themes Playground example 5. @@ -1049,7 +1075,7 @@ Opt in opinionated sub themes minor style changes: * Tuned the colored text theme on the sub themes that are applied when using the optional colored text themes. The text styles now better match - the regular none colored style, + the regular none-colored style, and they are a bit more subtle. Text style `caption` got a bit of opacity. M2 designed widgets like `ListTile`, depend on it for making more muted subtitles by default for `ListTile` via the heading level @@ -1082,8 +1108,8 @@ Opt in opinionated sub themes minor style changes: The breaking case is a minor difference in produced style for true black mode. Version 4.0.0 is still fully API compatible with version 3. -Version 4.0.0 does, however contain so many new -features, that it in itself warrants a new major release bump. +Version 4.0.0 does, however, contain so many new +features that it in itself warrants a new major release bump. **BREAKING** @@ -1093,7 +1119,7 @@ features, that it in itself warrants a new major release bump. property. For more information, see Flutter SDK issue [90353](https://github.com/flutter/flutter/issues/90353). -* From the color scheme English descriptions the sentence end "." was removed from all +* From all the color scheme English descriptions, the sentence ending period was removed from all description strings. If and when you want one, you can add it as needed. **NEW** @@ -1116,7 +1142,7 @@ features, that it in itself warrants a new major release bump. radius is different per widget type. The new TextTheme Typography is also included. All parts cannot be made to look exactly like M3 in Flutter when using [Material 2 design (M2)](https://material.io), but many parts - can, and where possible the defaults try follow those values. You can, of course, + can, and where possible, the defaults try to follow those values. You can, of course, override the defaults. * You can tweak these sub themes with a number of parameters defined in the `FlexSubThemesData` class, passed to @@ -1130,7 +1156,7 @@ features, that it in itself warrants a new major release bump. to match the standard buttons regarding size and design as far as possible. * In case you still use the old deprecated buttons, they also get `ButtonThemeData` that as far as possible match the same style. - * Via the sub themes, it is by default opted-in to also use a bit Material You + * Via the sub themes, it is by default opted-in to also use a bit of Material You like coloring on the text styles. This can also be opted out of, even if otherwise opting in on sub-themes, it is on by default when opting in on sub themes. @@ -1201,9 +1227,9 @@ features, that it in itself warrants a new major release bump. `FlexColorScheme.themedSystemNavigationBar`. This brings the previously experimental support for transparent system navigation bar in Android into the supported fold in FlexColorScheme. Its functionality - requires min Android SDK level 29, but other than that it works without + requires min Android SDK level 29, but other than that, it works without Android setup shenanigans. No added APIs, the API for it already existed - in the previous version of FlexColorScheme, using it did however require + in the previous version of FlexColorScheme, using it did, however, require special Android build configuration setup. This is no longer required. * **New color schemes:** Added four new built-in color schemes. @@ -1244,7 +1270,7 @@ features, that it in itself warrants a new major release bump. **TESTS** * Added tests for the new features, total 1066 tests. -* Coverage 99%, will improve them more later. +* Coverage is now 99%, will improve it more later. ## 4.0.0-dev.1 diff --git a/README.md b/README.md index beb163fa..9681617b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ When you opt in on using the component sub-themes in Material-2 mode, border rad You can also opt in on using Material-3. The Material-3 mode component sub-theming is far less opinionated, using mostly Material-3 defaults. It offers many quick settings to customize Material-3 to fit your custom design goals. -In Flutter **3.7 and later**, using Material-3 design is ready for production use. Some minor issues still exist, please refer to the FlexColorScheme docs [known issues](https://docs.flexcolorscheme.com/known_issues) chapter for more information on status of known **theming** issues in Flutter. +In Flutter **3.7 and later**, using Material-3 design is ready for production use. Some minor issues still exist, please refer to the FlexColorScheme docs [known issues](https://docs.flexcolorscheme.com/known_issues) chapter for more information on the status of known **theming** issues in Flutter. diff --git a/changelog/changelog_1_0_0-dev.2.md b/changelog/changelog_1_0_0-dev.2.md index d103f840..74ee2941 100644 --- a/changelog/changelog_1_0_0-dev.2.md +++ b/changelog/changelog_1_0_0-dev.2.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.0.0-dev.2 @@ -17,12 +17,12 @@ * Removed the constants that had no function in the public interface from the API. **NEW** -* Exposed planned configuration APIs for the FlexThemeModeSwitch and FlexThemeModeOptionButton. +* Exposed planned configuration APIs for FlexThemeModeSwitch and FlexThemeModeOptionButton. **CHANGE** * Removed legacy usage of deprecated ThemeData properties textSelectionColor, cursorColor - and textSelectionHandleColor. They are no longer needed even for stable channel, they were + and textSelectionHandleColor. They are no longer needed even for the stable channel, they were useful earlier but not anymore, using only TextSelectionThemeData is enough in the latest stable version. diff --git a/changelog/changelog_1_1_0.md b/changelog/changelog_1_1_0.md index 6a0300d9..fc038025 100644 --- a/changelog/changelog_1_1_0.md +++ b/changelog/changelog_1_1_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.1.0 diff --git a/changelog/changelog_1_1_1.md b/changelog/changelog_1_1_1.md index 4f503c81..c305eaca 100644 --- a/changelog/changelog_1_1_1.md +++ b/changelog/changelog_1_1_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.1.1 diff --git a/changelog/changelog_1_2_0.md b/changelog/changelog_1_2_0.md index e2ffd065..ea56fcd2 100644 --- a/changelog/changelog_1_2_0.md +++ b/changelog/changelog_1_2_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.2.0 diff --git a/changelog/changelog_1_3_0.md b/changelog/changelog_1_3_0.md index 78f7552b..78d19d85 100644 --- a/changelog/changelog_1_3_0.md +++ b/changelog/changelog_1_3_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.3.0 diff --git a/changelog/changelog_1_4_0.md b/changelog/changelog_1_4_0.md index 4ff8a8ae..d52228c0 100644 --- a/changelog/changelog_1_4_0.md +++ b/changelog/changelog_1_4_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 1.4.0 diff --git a/changelog/changelog_1_4_1.md b/changelog/changelog_1_4_1.md index 4f6bf61a..46f95361 100644 --- a/changelog/changelog_1_4_1.md +++ b/changelog/changelog_1_4_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ### 1.4.1 diff --git a/changelog/changelog_2_0_0-nullsafety_1.md b/changelog/changelog_2_0_0-nullsafety_1.md index edaad787..3f55b790 100644 --- a/changelog/changelog_2_0_0-nullsafety_1.md +++ b/changelog/changelog_2_0_0-nullsafety_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 2.0.0-nullsafety.1 diff --git a/changelog/changelog_2_0_0-nullsafety_2.md b/changelog/changelog_2_0_0-nullsafety_2.md index 6d7aad30..59ef7a0e 100644 --- a/changelog/changelog_2_0_0-nullsafety_2.md +++ b/changelog/changelog_2_0_0-nullsafety_2.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 2.0.0-nullsafety.2 diff --git a/changelog/changelog_2_0_0.md b/changelog/changelog_2_0_0.md index aed87d11..55898a49 100644 --- a/changelog/changelog_2_0_0.md +++ b/changelog/changelog_2_0_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 2.0.0 diff --git a/changelog/changelog_2_1_0.md b/changelog/changelog_2_1_0.md index 437c88bd..60707330 100644 --- a/changelog/changelog_2_1_0.md +++ b/changelog/changelog_2_1_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 2.1.0 diff --git a/changelog/changelog_2_1_1.md b/changelog/changelog_2_1_1.md index c796bd1f..78dbae6d 100644 --- a/changelog/changelog_2_1_1.md +++ b/changelog/changelog_2_1_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 2.1.1 diff --git a/changelog/changelog_3_0_0.md b/changelog/changelog_3_0_0.md index a76b1b08..62122e1a 100644 --- a/changelog/changelog_3_0_0.md +++ b/changelog/changelog_3_0_0.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 3.0.0 diff --git a/changelog/changelog_3_0_1.md b/changelog/changelog_3_0_1.md index 65e0968b..b5ac285d 100644 --- a/changelog/changelog_3_0_1.md +++ b/changelog/changelog_3_0_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 3.0.1 @@ -17,5 +17,5 @@ * Documentation and typo fixes. **Tests** -* Added tests for above fix that captures the issue and fails +* Added tests for the above fix. The test captures the issue and fails in version 3.0.0. Total 741 tests, coverage 99.75%. diff --git a/changelog/changelog_4_0_0_dev_1.md b/changelog/changelog_4_0_0_dev_1.md index d9a38b69..1140effb 100644 --- a/changelog/changelog_4_0_0_dev_1.md +++ b/changelog/changelog_4_0_0_dev_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 4.0.0-dev.1 diff --git a/changelog/changelog_5_0_0_dev_1.md b/changelog/changelog_5_0_0_dev_1.md index 81339280..651c91ea 100644 --- a/changelog/changelog_5_0_0_dev_1.md +++ b/changelog/changelog_5_0_0_dev_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 5.0.0-dev.1 diff --git a/changelog/changelog_5_0_0_dev_2.md b/changelog/changelog_5_0_0_dev_2.md index 191507f3..f4d114bf 100644 --- a/changelog/changelog_5_0_0_dev_2.md +++ b/changelog/changelog_5_0_0_dev_2.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 5.0.0-dev.2 diff --git a/changelog/changelog_5_0_0_dev_3.md b/changelog/changelog_5_0_0_dev_3.md index 3afd8ddd..b6aa4665 100644 --- a/changelog/changelog_5_0_0_dev_3.md +++ b/changelog/changelog_5_0_0_dev_3.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 5.0.0-dev.3 diff --git a/changelog/changelog_6_0_0_dev_1.md b/changelog/changelog_6_0_0_dev_1.md index bdd0ad8d..bae7eaba 100644 --- a/changelog/changelog_6_0_0_dev_1.md +++ b/changelog/changelog_6_0_0_dev_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## 6.0.0-dev.1 diff --git a/changelog/changelog_7_0_0_dev_1.md b/changelog/changelog_7_0_0_dev_1.md index 46a51d31..6462db00 100644 --- a/changelog/changelog_7_0_0_dev_1.md +++ b/changelog/changelog_7_0_0_dev_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. ## 7.0.0-dev.1 @@ -22,10 +22,10 @@ Requires Flutter beta 3.7.0-1.4.pre or later. - Supported via `FlexSubThemes.filledButtonTheme` that is controlled via `FlexSubThemesData` properties `filledButtonRadius`, `filledButtonSchemeColor` and `filledButtonTextStyle`. - When setting up theming for `FilledButton` it was noticed that variant `FilledButton.tonal` cannot be themed separately, see issue: https://github.com/flutter/flutter/issues/115827. -- Added option to keep using the M2 style Divider in M3. The in M3 used primary color tinted outlineVariant does not fit on any color. The M2 style based on black or white with opacity does. It is also less prominent than the M3 style and may be preferred. Set `FlexSubThemesData` property `useM2StyleDividerInM3` to true to use the M2 style in M3. Defaults to false. +- Added option to keep using the M2 style Divider in M3. The in M3 used primary color tinted outlineVariant does not fit on any color. The M2-style based on black or white with opacity does. It is also less prominent than the M3 style and may be preferred. Set `FlexSubThemesData` property `useM2StyleDividerInM3` to true to use the M2 style in M3. Defaults to false. - FlexColorScheme also sets `ThemeData.dividerColor` to `ThemeData.colorScheme.outlineVariant` when `ThemeData.useMaterial3` is `true`. This keeps the in Flutter SDK to be deprecated `ThemeData.dividerColor` always same as actually used effective `Divider` color. Thus, if an app uses `Theme.of(context).dividerColor` while it still exists, to set a color to it, and expects it be the same color as effective `Divider` color, it will be so in FCS, regardless of if M2 or M3 is being used. This is not the case in Flutter SDK by default, see issue https://github.com/flutter/flutter/issues/117755 for more information. -- Added `elevation` to `FlexSubThemes.timePickerTheme`, and make it use the dialog shared `FlexSubThemesData.dialogElevation` setting. This property works with the Flutter master channel, but does not yet exist in Flutter beta 3.7.0-1.4.pre. It was commented out of this released based on Flutter beta. It is unsure if it will land in the next stable Flutter. It probably will not and will remain be commented in next FCS7 stable release as well. Its addition will have to be left pending inclusion in the following Flutter stable release, probably in 3 to 4 months. +- Added `elevation` to `FlexSubThemes.timePickerTheme`, and make it use the dialog shared `FlexSubThemesData.dialogElevation` setting. This property works with the Flutter master channel, but does not yet exist in Flutter beta 3.7.0-1.4.pre. It was commented out of this released based on Flutter beta. It is unsure if it will land in the next stable Flutter, it probably will not. If it does not land, it will remain commented in next FCS7 stable release as well. Its addition will have to be left pending inclusion in the following Flutter stable release, probably in 3 to 4 months. - Added boolean `tintedDisabledControls` to `FlexSubThemesData`. If set to true, disabled widgets will get a hint of primary color or their active main color, when disabled. In future minor versions, this will also apply to components that use own themed settings for disabled color, not only to the ones where disabled color is controlled by `ThemeData.disabledColor`. Previously tinted disabled color for `ThemeData.disabledColor` was included and defined when `FlexSubThemesData.interactionEffects` was set to true. It is now instead controlled by this separate tinted disabled-controls setting. Defaults to true, for an FCS opinionated default. This matches past default when it was included in `FlexSubThemesData.interactionEffects`. diff --git a/changelog/changelog_7_0_0_dev_2.md b/changelog/changelog_7_0_0_dev_2.md index 0069d414..d8c1911e 100644 --- a/changelog/changelog_7_0_0_dev_2.md +++ b/changelog/changelog_7_0_0_dev_2.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. ## 7.0.0-dev.2 diff --git a/changelog/changelog_7_0_0_dev_3.md b/changelog/changelog_7_0_0_dev_3.md index 7bc09fe0..c04a9086 100644 --- a/changelog/changelog_7_0_0_dev_3.md +++ b/changelog/changelog_7_0_0_dev_3.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. ## 7.0.0-dev.3 diff --git a/changelog/changelog_7_1_0_dev_1.md b/changelog/changelog_7_1_0_dev_1.md index 884f180d..8b6ffa9f 100644 --- a/changelog/changelog_7_1_0_dev_1.md +++ b/changelog/changelog_7_1_0_dev_1.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older changelogs and dev release changelogs have been moved into individual files linked from the main changelog. ## 7.1.0-dev.1 diff --git a/changelog/changelog_template.md b/changelog/changelog_template.md index 1922bafa..8f504f9f 100644 --- a/changelog/changelog_template.md +++ b/changelog/changelog_template.md @@ -1,6 +1,6 @@ ### Archived changelog entry -> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation older change entries have been moved into individual files linked from the main changelog. +> The Dart package site [pub.dev](https://pub.dev/) restricts the size of the main [CHANGELOG.md](https://github.com/rydmike/flex_color_scheme/blob/master/CHANGELOG.md) file size to maximum 128kB. To work around this limitation, older change entries have been moved into individual files linked from the main changelog. ## x.y.z diff --git a/example/lib/example1_basic_theme_usage/main.dart b/example/lib/example1_basic_theme_usage/main.dart index 9ec28387..3b94bfdf 100644 --- a/example/lib/example1_basic_theme_usage/main.dart +++ b/example/lib/example1_basic_theme_usage/main.dart @@ -12,7 +12,7 @@ import 'home_page.dart'; // and then how to switch between the light and dark mode. // // You can try this app as a web app at: -// https://rydmike.com/flexcolorscheme/basictheme-v7 +// https://rydmike.com/flexcolorscheme/basictheme-v7-1 // ----------------------------------------------------------------------------- void main() => runApp(const DemoApp()); diff --git a/example/lib/example2_custom_theme/main.dart b/example/lib/example2_custom_theme/main.dart index 7aabc0c9..637d1a9c 100644 --- a/example/lib/example2_custom_theme/main.dart +++ b/example/lib/example2_custom_theme/main.dart @@ -27,7 +27,7 @@ import 'home_page.dart'; // opting in and out of FlexColorScheme's opinionated sub-themes. // // You can try this app as a web app at: -// https://rydmike.com/flexcolorscheme/customtheme-v7 +// https://rydmike.com/flexcolorscheme/customtheme-v7-1 // ----------------------------------------------------------------------------- Future main() async { diff --git a/example/lib/example3_four_themes/main.dart b/example/lib/example3_four_themes/main.dart index d5f51261..4d2e86a7 100644 --- a/example/lib/example3_four_themes/main.dart +++ b/example/lib/example3_four_themes/main.dart @@ -29,7 +29,7 @@ import 'home_page.dart'; // with the enum related color scheme. // // You can try this app as a web app at: -// https://rydmike.com/flexcolorscheme/fourthemes-v7 +// https://rydmike.com/flexcolorscheme/fourthemes-v7-1 // ----------------------------------------------------------------------------- Future main() async { diff --git a/example/lib/example4_all_themes/main.dart b/example/lib/example4_all_themes/main.dart index 0f537255..77594e07 100644 --- a/example/lib/example4_all_themes/main.dart +++ b/example/lib/example4_all_themes/main.dart @@ -43,7 +43,7 @@ import 'home_page.dart'; // in AppColor.schemes. // // You can try this app as a web app at: -// https://rydmike.com/flexcolorscheme/allthemes-v7 +// https://rydmike.com/flexcolorscheme/allthemes-v7-1 // ----------------------------------------------------------------------------- Future main() async { diff --git a/example/lib/example5_themes_playground/main.dart b/example/lib/example5_themes_playground/main.dart index 90bc953f..3d9330dc 100644 --- a/example/lib/example5_themes_playground/main.dart +++ b/example/lib/example5_themes_playground/main.dart @@ -32,7 +32,7 @@ import 'widgets/pages/home_page.dart'; /// in AppColor.schemesCustom and many other options. /// /// You can try this app as a web app at: -/// https://rydmike.com/flexcolorscheme/themesplayground-v7 +/// https://rydmike.com/flexcolorscheme/themesplayground-v7-1 Future main() async { WidgetsFlutterBinding.ensureInitialized(); // Use a ThemeController, which glues our theme settings to Flutter Widgets. diff --git a/example/lib/example5_themes_playground/theme/flex_theme_dark.dart b/example/lib/example5_themes_playground/theme/flex_theme_dark.dart index 2082c4fe..8d3b8bc7 100644 --- a/example/lib/example5_themes_playground/theme/flex_theme_dark.dart +++ b/example/lib/example5_themes_playground/theme/flex_theme_dark.dart @@ -426,7 +426,7 @@ FlexColorScheme flexColorSchemeDark(ThemeController controller, Color source) { // light and dark themes and for the primaryTextTheme to always have right // contrast for whatever primary color is used. FlexColorScheme also retains // the correct opacities on text style if M2 Typography is used, and removes - // it from style when M3 Typography is used. + // it from style when M3 Typography is used, when using GoogleFonts. fontFamily: controller.useAppFont ? App.font : null, textTheme: controller.useAppFont ? App.textTheme : null, primaryTextTheme: controller.useAppFont ? App.textTheme : null, diff --git a/example/lib/example5_themes_playground/theme/flex_theme_light.dart b/example/lib/example5_themes_playground/theme/flex_theme_light.dart index 89cffb1d..44c81bd5 100644 --- a/example/lib/example5_themes_playground/theme/flex_theme_light.dart +++ b/example/lib/example5_themes_playground/theme/flex_theme_light.dart @@ -491,7 +491,7 @@ FlexColorScheme flexColorSchemeLight(ThemeController controller, Color source) { // light and dark themes and for the primaryTextTheme to always have right // contrast for whatever primary color is used. FlexColorScheme also retains // the correct opacities on text style if M2 Typography is used, and removes - // it from style when M3 Typography is used. + // it from style when M3 Typography is used, when using GoogleFonts. fontFamily: controller.useAppFont ? App.font : null, textTheme: controller.useAppFont ? App.textTheme : null, primaryTextTheme: controller.useAppFont ? App.textTheme : null, diff --git a/example/lib/example5_themes_playground/utils/generate_theme_dart_code.dart b/example/lib/example5_themes_playground/utils/generate_theme_dart_code.dart index 2c1a774d..4f35e795 100644 --- a/example/lib/example5_themes_playground/utils/generate_theme_dart_code.dart +++ b/example/lib/example5_themes_playground/utils/generate_theme_dart_code.dart @@ -232,10 +232,7 @@ String generateThemeDartCode(ThemeController controller) { final String blendDarkTextTheme = controller.blendDarkTextTheme ? ' blendTextTheme: ${controller.blendDarkTextTheme},\n' : ''; - final String useTextTheme = controller.useTextTheme == null || - // ignore: use_if_null_to_convert_nulls_to_bools - (controller.useTextTheme == true && controller.useMaterial3) || - (controller.useTextTheme == false && !controller.useMaterial3) + final String useTextTheme = controller.useTextTheme == null ? '' : ' useTextTheme: ${controller.useTextTheme},\n'; final String useM2StyleDividerInM3 = @@ -1680,10 +1677,10 @@ String generateThemeDartCode(ThemeController controller) { // // Compose the final FlexThemeData code string, from all above fragments. // - final String code = '// Made for FlexColorScheme version ' - '${App.packageVersion}. Make sure you\n' - '// use same or higher package version, but still same major version.\n' - '// If you use a lower version, some properties may not be supported.\n' + final String code = '// Theme config for FlexColorScheme version ' + '${App.packageVersionMinor}. Make sure you use\n' + '// same or higher package version, but still same major version. If you\n' + '// use a lower package version, some properties may not be supported.\n' '// In that case remove them after copying this theme to your app.\n' 'theme: FlexThemeData.light(\n' '$lightScheme' @@ -1707,7 +1704,7 @@ String generateThemeDartCode(ThemeController controller) { ' visualDensity: FlexColorScheme.comfortablePlatformDensity,\n' '$useMaterial3' '$swapLegacyOnMaterial3' - ' // To use the playground font, add GoogleFonts package and uncomment\n' + ' // To use the Playground font, add GoogleFonts package and uncomment\n' ' // fontFamily: GoogleFonts.notoSans().fontFamily,\n' '),\n' 'darkTheme: FlexThemeData.dark(\n' diff --git a/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_settings.dart b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_settings.dart index 9bec9374..e73302b9 100644 --- a/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_settings.dart +++ b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_settings.dart @@ -608,8 +608,8 @@ class AppBarSettings extends StatelessWidget { TextSpan( style: spanTextStyle, text: '. The Themes Playground ' - 'uses a Theme wrapper to remove it above, but it is still ' - 'visible in the view. In the simulator using the ' + 'uses a Theme wrapper to remove it above, but it is ' + 'still visible in the view. In the simulator using the ' 'Flutter official M3 demo, you can see the issue on ' 'both SearchBar and the SearchView.\n '), ], diff --git a/example/lib/example5_themes_playground/widgets/panels/theme_colors_settings/theme_colors_settings.dart b/example/lib/example5_themes_playground/widgets/panels/theme_colors_settings/theme_colors_settings.dart index a3ae09e1..9cf27bd2 100644 --- a/example/lib/example5_themes_playground/widgets/panels/theme_colors_settings/theme_colors_settings.dart +++ b/example/lib/example5_themes_playground/widgets/panels/theme_colors_settings/theme_colors_settings.dart @@ -150,7 +150,7 @@ class ThemeColorsSettings extends StatelessWidget { ), SwitchListTileReveal( title: const Text('Swap secondary ' - 'and tertiary'), + 'and tertiary legacy colors in M3'), subtitleDense: true, subtitle: const Text( 'Only applies when using M3, and only to built-in FCS M2 ' diff --git a/example/lib/example_copy_paste_from_playground/main.dart b/example/lib/example_copy_paste_from_playground/main.dart index 0c8db288..a0a60e6d 100644 --- a/example/lib/example_copy_paste_from_playground/main.dart +++ b/example/lib/example_copy_paste_from_playground/main.dart @@ -13,7 +13,7 @@ import 'home_page.dart'; // // Use this example to via copy-paste test a theme using code generated by // the Themes PlayGround found at: -// https://rydmike.com/flexcolorscheme/themesplayground-v7 +// https://rydmike.com/flexcolorscheme/themesplayground-v7-1 // ----------------------------------------------------------------------------- void main() => runApp(const DemoApp()); @@ -57,7 +57,7 @@ class _DemoAppState extends State { theme: FlexThemeData.light( useMaterial3: true, - scheme: FlexScheme.flutterDash, + scheme: FlexScheme.redWine, blendLevel: 2, appBarOpacity: 0.98, subThemesData: const FlexSubThemesData( @@ -73,7 +73,13 @@ class _DemoAppState extends State { navigationRailOpacity: 0.96, ), visualDensity: FlexColorScheme.comfortablePlatformDensity, + // Custom fonts to demonstrate you pass a default GoogleFonts TextTheme + // to both textTheme and primaryTextTheme in M2/M3 mode as well as in + // light/dark theme and have them get correct default color and + // contrast color in all cases. Vanilla ThemeData does not do this. fontFamily: GoogleFonts.notoSans().fontFamily, + textTheme: GoogleFonts.notoSansTextTheme(), + primaryTextTheme: GoogleFonts.notoSansTextTheme(), ), darkTheme: FlexThemeData.dark( useMaterial3: true, @@ -95,13 +101,19 @@ class _DemoAppState extends State { ), visualDensity: FlexColorScheme.comfortablePlatformDensity, fontFamily: GoogleFonts.notoSans().fontFamily, + // Custom fonts to demonstrate you pass a default GoogleFonts TextTheme + // to both textTheme and primaryTextTheme in M2/M3 mode as well as in + // light/dark theme and have them get correct default color and + // contrast color in all cases. Vanilla ThemeData does not do this. + textTheme: GoogleFonts.notoSansTextTheme(), + primaryTextTheme: GoogleFonts.notoSansTextTheme(), ), // If you want to use ThemeData.from a ColorScheme based on a ColorScheme // from FlexColorScheme, then comment the other two theme setups above and // uncomment the theme setup below, and copy-paste the generated // ColorScheme code from the Themes Playground app at - // https://rydmike.com/flexcolorscheme/themesplayground-v7 + // https://rydmike.com/flexcolorscheme/themesplayground-v7-1 // over the example ColorSchemes further below, with copy-pasted schemes. // This will give you the same colors as with FlexColorScheme, but no // other theme customizations FlexColorScheme does when it creates @@ -109,6 +121,9 @@ class _DemoAppState extends State { // FlexThemeData extensions and opinionated component themes. You will // need to customize ThemeData yourself and adjust all its quirks. // + // This example is to show that it is possible to also only use the light + // and dark ColorSchemes generated by FlexColorScheme. + // // theme: ThemeData( // useMaterial3: true, // colorScheme: flexSchemeLight, @@ -132,76 +147,80 @@ class _DemoAppState extends State { } } -// Copy-paste the code for a light ColorScheme you want from the +// Copy-paste the code for a ColorScheme you want from the // Themes Playground here and try it with plain vanilla -// ThemeData.from(colorScheme: flexSchemeLight) light by uncommenting -// that section further above. +// ThemeData(colorScheme: flexSchemeLight/flexSchemeDark) by +// uncommenting that section above. +// +// Light and dark ColorSchemes made by FlexColorScheme v7.1.1. +// These ColorScheme objects require Flutter 3.7 or later. const ColorScheme flexSchemeLight = ColorScheme( brightness: Brightness.light, - primary: Color(0xff00497c), - onPrimary: Color(0xffe8f1ff), - primaryContainer: Color(0xff9acaff), - onPrimaryContainer: Color(0xff001d36), - secondary: Color(0xff4f599d), - onSecondary: Color(0xffefefff), - secondaryContainer: Color(0xffbac3ff), - onSecondaryContainer: Color(0xff041157), - tertiary: Color(0xff6c5b51), - onTertiary: Color(0xffffede2), - tertiaryContainer: Color(0xffd8c2b6), - onTertiaryContainer: Color(0xff251911), - error: Color(0xffba1b1b), - onError: Color(0xffffede9), - errorContainer: Color(0xffffb4a9), - onErrorContainer: Color(0xff410001), - outline: Color(0xff6b7889), - background: Color(0xffcdd6e3), - onBackground: Color(0xff171c22), - surface: Color(0xffe3eaf5), - onSurface: Color(0xff171c22), - surfaceVariant: Color(0xffb2c3d7), - onSurfaceVariant: Color(0xff243140), - inverseSurface: Color(0xff3f474f), - onInverseSurface: Color(0xffedf1fa), - inversePrimary: Color(0xff9acaff), + primary: Color(0xff00497f), + onPrimary: Color(0xfffdfcff), + primaryContainer: Color(0xffd2e4ff), + onPrimaryContainer: Color(0xff001c37), + secondary: Color(0xff287eab), + onSecondary: Color(0xfffbfcff), + secondaryContainer: Color(0xffe4f3ff), + onSecondaryContainer: Color(0xff001e2e), + tertiary: Color(0xffdd520f), + onTertiary: Color(0xffffffff), + tertiaryContainer: Color(0xffffdbcf), + onTertiaryContainer: Color(0xff380d00), + error: Color(0xffba1a1a), + onError: Color(0xfffffbff), + errorContainer: Color(0xffffdad6), + onErrorContainer: Color(0xff410002), + background: Color(0xfff6f7fb), + onBackground: Color(0xff191c20), + surface: Color(0xfff6f7fb), + onSurface: Color(0xff191c20), + surfaceVariant: Color(0xffd6deea), + onSurfaceVariant: Color(0xff414750), + outline: Color(0xff717782), + outlineVariant: Color(0xffc1c7d2), shadow: Color(0xff000000), + scrim: Color(0xff000000), + inverseSurface: Color(0xff2c3137), + onInverseSurface: Color(0xffeff0f7), + inversePrimary: Color(0xffa0c9ff), + surfaceTint: Color(0xff00497f), ); -// Copy-paste the code for a dark ColorScheme you want from the -// Themes Playground here and try it with plain vanilla -// ThemeData.from(colorScheme: flexSchemeLight) light by uncommenting -// that section further above. -// -// Normally it would be the matching pair to the light one, but it does not -// have to be. Same applies when you use FlexColorScheme to make your -// ThemeData. +// Normally the dark mode ColorScheme would be the matching pair to the +// light one, but it does not have to be. Same applies when you use +// FlexColorScheme to make your ThemeData. const ColorScheme flexSchemeDark = ColorScheme( brightness: Brightness.dark, - primary: Color(0xff9acaff), - onPrimary: Color(0xff001d36), - primaryContainer: Color(0xff0061a2), - onPrimaryContainer: Color(0xffcfe4ff), - secondary: Color(0xffbac3ff), - onSecondary: Color(0xff041157), - secondaryContainer: Color(0xff4f599d), - onSecondaryContainer: Color(0xffdde0ff), - tertiary: Color(0xffd8c2b6), - onTertiary: Color(0xff251911), - tertiaryContainer: Color(0xff6c5b51), - onTertiaryContainer: Color(0xfff5ded1), - error: Color(0xffffb4a9), - onError: Color(0xff680003), - errorContainer: Color(0xff930006), - onErrorContainer: Color(0xffffdad4), - outline: Color(0xff8492a4), - background: Color(0xff323a42), - onBackground: Color(0xffdfe3ec), - surface: Color(0xff1a2028), - onSurface: Color(0xffc3c7cf), - surfaceVariant: Color(0xff536173), - onSurfaceVariant: Color(0xffd6e4f7), - inverseSurface: Color(0xffeaeffa), - onInverseSurface: Color(0xff42474e), - inversePrimary: Color(0xff0061a2), + primary: Color(0xffa0c9ff), + onPrimary: Color(0xff001c37), + primaryContainer: Color(0xff00497f), + onPrimaryContainer: Color(0xffd2e4ff), + secondary: Color(0xffc7e7ff), + onSecondary: Color(0xff001e2e), + secondaryContainer: Color(0xff00344c), + onSecondaryContainer: Color(0xffc7e7ff), + tertiary: Color(0xffffb59a), + onTertiary: Color(0xff380d00), + tertiaryContainer: Color(0xff753318), + onTertiaryContainer: Color(0xffffdbcf), + error: Color(0xffffb4ab), + onError: Color(0xff410002), + errorContainer: Color(0xff93000a), + onErrorContainer: Color(0xffffb4ab), + background: Color(0xff13161a), + onBackground: Color(0xffe1e2e8), + surface: Color(0xff13161a), + onSurface: Color(0xffe1e2e8), + surfaceVariant: Color(0xff3a4049), + onSurfaceVariant: Color(0xffc1c7d2), + outline: Color(0xff8b919c), + outlineVariant: Color(0xff414750), shadow: Color(0xff000000), + scrim: Color(0xff000000), + inverseSurface: Color(0xffedeef2), + onInverseSurface: Color(0xff2e3135), + inversePrimary: Color(0xff0061a6), + surfaceTint: Color(0xffa0c9ff), ); diff --git a/example/lib/main.dart b/example/lib/main.dart index 09809203..287c08ae 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -318,7 +318,6 @@ final String? _fontFamily = GoogleFonts.notoSans().fontFamily; // and that labelSmall is a bit too small and has weird letter spacing, so we // make it bigger and change its letter spacing. const TextTheme _textTheme = TextTheme( - displayLarge: TextStyle(fontSize: 53), displayMedium: TextStyle(fontSize: 41), displaySmall: TextStyle(fontSize: 36), labelSmall: TextStyle(fontSize: 11, letterSpacing: 0.5), @@ -381,7 +380,9 @@ const FlexSubThemesData _subThemesData = FlexSubThemesData( // radius is defined to always be 24: bottomSheetRadius: 24, - // Use the Material 3 like text theme. Defaults to true. + // Use the Material3 text theme and typography. Defaults to null. + // When null, the correct M2/M3 TextTheme and Typography for respective mode + // is used. If true, M3 style is enforced, if false, M2 mode is enforced. useTextTheme: true, // Select input decorator type, only SDK options outline and underline @@ -642,11 +643,6 @@ class _DemoAppState extends State { subThemesData: _useSubThemes ? _subThemesData : null, visualDensity: _visualDensity, platform: _platform, - // Use predefined M3 typography while this issue is in effect: - // https://github.com/flutter/flutter/issues/103864 - typography: Typography.material2021( - platform: _platform, - ), // Add all our custom theme extensions, in this case we only have one. extensions: >{ lightBrandTheme, @@ -722,11 +718,6 @@ class _DemoAppState extends State { subThemesData: _useSubThemes ? _subThemesData : null, visualDensity: _visualDensity, platform: _platform, - // Use predefined Material 3 typography while this issue is in effect: - // https://github.com/flutter/flutter/issues/103864 - typography: Typography.material2021( - platform: _platform, - ), // Add all our custom theme extensions, in this case we only have one. extensions: >{ darkBrandTheme, diff --git a/example/lib/shared/const/app.dart b/example/lib/shared/const/app.dart index 59efa192..49dae006 100644 --- a/example/lib/shared/const/app.dart +++ b/example/lib/shared/const/app.dart @@ -41,12 +41,13 @@ class App { // build numbers. static const String versionMajor = '7'; static const String versionMinor = '1'; - static const String versionPatch = '0'; + static const String versionPatch = '1'; static const String versionBuild = '01'; static const String version = '$versionMajor.$versionMinor.$versionPatch ' 'Build-$versionBuild'; static const String packageVersion = '$versionMajor.$versionMinor.$versionPatch'; + static const String packageVersionMinor = '$versionMajor.$versionMinor.x'; static const String flutterVersion = 'stable 3.10.0 (canvaskit)'; static const String copyright = '© 2020 - 2023'; static const String author = 'Mike Rydstrom'; @@ -165,7 +166,7 @@ class App { // the correct opacities on text style if M2 Typography is used, and removes // it from style when M3 Typography is used. static String? get font => GoogleFonts.notoSans().fontFamily; - static TextTheme get textTheme => GoogleFonts.notoSansTextTheme(); + static TextTheme? get textTheme => GoogleFonts.notoSansTextTheme(); /// Defining the visual density here to so we can change it in one spot when /// we want to try different options. diff --git a/example/lib/shared/pages/page_examples.dart b/example/lib/shared/pages/page_examples.dart index ca2409f3..4589bd0e 100644 --- a/example/lib/shared/pages/page_examples.dart +++ b/example/lib/shared/pages/page_examples.dart @@ -28,7 +28,6 @@ class PageExamples extends StatelessWidget { await SubpageDemo.show(context, controller); }, ), - const Divider(), ListTile( title: const Text('Splash page demo 1a'), subtitle: const Text( @@ -40,7 +39,6 @@ class PageExamples extends StatelessWidget { await SplashPageOne.show(context, false); }, ), - const Divider(), ListTile( title: const Text('Splash page demo 1b'), subtitle: const Text( @@ -53,7 +51,6 @@ class PageExamples extends StatelessWidget { await SplashPageOne.show(context, true); }, ), - const Divider(), ListTile( title: const Text('Splash page demo 2'), subtitle: const Text( diff --git a/example/pubspec.lock b/example/pubspec.lock index 3b017d26..8d8ae5e2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -127,7 +127,7 @@ packages: path: ".." relative: true source: path - version: "7.1.0" + version: "7.1.1" flex_seed_scheme: dependency: "direct main" description: @@ -472,10 +472,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "22f8db4a72be26e9e3a4aa3f194b1f7afbc76d20ec141f84be1d787db2155cbd" + sha256: "7aac14be5f4731b923cc697ae2d42043945076cd0dbb8806baecc92c1dc88891" url: "https://pub.dev" source: hosted - version: "6.0.31" + version: "6.0.33" url_launcher_ios: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4ec0a3d4..67c1ec30 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: flex_color_scheme_example description: Examples that demonstrate how to use the FlexColorScheme package. -version: 7.1.0 +version: 7.1.1 publish_to: 'none' environment: sdk: '>=3.0.0 <4.0.0' diff --git a/lib/src/flex_color_scheme.dart b/lib/src/flex_color_scheme.dart index 13f8d509..3a6b60e4 100644 --- a/lib/src/flex_color_scheme.dart +++ b/lib/src/flex_color_scheme.dart @@ -18,6 +18,7 @@ import 'flex_scheme_surface_colors.dart'; import 'flex_sub_themes.dart'; import 'flex_sub_themes_data.dart'; import 'flex_surface_mode.dart'; +import 'flex_text_theme_color.dart'; // ignore_for_file: comment_references @@ -744,9 +745,19 @@ class FlexColorScheme with Diagnosticable { /// Text with a color that contrasts with background, surface, card and /// canvas colors. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for light/dark mode is used. final TextTheme? textTheme; /// A text theme that contrasts with the primary color. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for primary color is used. final TextTheme? primaryTextTheme; /// Name of the font family to use as default font for the text theme in @@ -2166,10 +2177,21 @@ class FlexColorScheme with Diagnosticable { /// Defaults to [VisualDensity.adaptivePlatformDensity]. final VisualDensity? visualDensity, - /// Text with a color that contrasts with the card and canvas colors. + /// Text with a color that contrasts with background, surface, card and + /// canvas colors. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for light/dark mode is used. final TextTheme? textTheme, /// A text theme that contrasts with the primary color. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for primary color is used. final TextTheme? primaryTextTheme, /// Name of the font family to use as default font for the text theme in @@ -4001,10 +4023,21 @@ class FlexColorScheme with Diagnosticable { /// Defaults to [VisualDensity.adaptivePlatformDensity]. final VisualDensity? visualDensity, - /// Text with a color that contrasts with the card and canvas colors. + /// Text with a color that contrasts with background, surface, card and + /// canvas colors. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for light/dark mode is used. final TextTheme? textTheme, /// A text theme that contrasts with the primary color. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for primary color is used. final TextTheme? primaryTextTheme, /// Name of the font family to use as default font for the text theme in @@ -5589,16 +5622,13 @@ class FlexColorScheme with Diagnosticable { } final Typography effectiveTypography = typography ?? defaultTypography(); - // We need the text themes locally for the theming, so we must form them // fully using the same process that the ThemeData() factory uses. TextTheme defText = isDark ? effectiveTypography.white : effectiveTypography.black; - final TextTheme typoColor = defText; final bool primaryIsDark = isColorDark(colorScheme.primary); TextTheme defPrimaryText = primaryIsDark ? effectiveTypography.white : effectiveTypography.black; - final TextTheme typoPrimColor = defPrimaryText; // ThemeData uses this to apply a font from fontFamily, fontFamilyFallback // and package in this order to default text theme and primary text theme. @@ -5623,6 +5653,26 @@ class FlexColorScheme with Diagnosticable { defText = defText.apply(package: package); defPrimaryText = defPrimaryText.apply(package: package); } + + // TextTheme is a default GoogleFonts TextTheme. + // + // Let's take a look at provided TextTheme, if it is mathc for a + // GoogleFont TextTheme, remove its default colors so we can make one with + // correct M2/M3 defaults. + TextTheme? pTextTheme = textTheme; + if (pTextTheme != null) { + final TextTheme gFontTextTheme = ThemeData.light().textTheme.apply( + fontFamily: '', + fontFamilyFallback: [''], + ); + final TextTheme passedTextTheme = pTextTheme.apply( + fontFamily: '', + fontFamilyFallback: [''], + ); + if (gFontTextTheme == passedTextTheme) { + pTextTheme = TextThemeColor.nullFontColor(pTextTheme); + } + } // Make default TextThemes, by also merging in the two TextThemes // passed in via the constructor. The 2nd copyWith, ensures putting back // correct contrast color on any passed in text theme. FCS does not @@ -5630,78 +5680,30 @@ class FlexColorScheme with Diagnosticable { // nor for the primary color contrast text theme. It always fixes them // to be correct and also uses correct opacities on M2 typography, and // opaque ones on M3 typography, regardless of used M2/M3 mode. - defText = defText.merge(textTheme); - defText = defText.copyWith( - // The textHiOpacity color style group. - displayLarge: - defText.displayLarge!.copyWith(color: typoColor.displayLarge!.color), - displayMedium: defText.displayMedium! - .copyWith(color: typoColor.displayMedium!.color), - displaySmall: - defText.displaySmall!.copyWith(color: typoColor.displaySmall!.color), - headlineLarge: defText.headlineLarge! - .copyWith(color: typoColor.headlineLarge!.color), - headlineMedium: defText.headlineMedium! - .copyWith(color: typoColor.headlineMedium!.color), - bodySmall: defText.bodySmall!.copyWith(color: typoColor.bodySmall!.color), - // The textMediumOpacity color style group. - headlineSmall: defText.headlineSmall! - .copyWith(color: typoColor.headlineSmall!.color), - titleLarge: - defText.titleLarge!.copyWith(color: typoColor.titleLarge!.color), - titleMedium: - defText.titleMedium!.copyWith(color: typoColor.titleMedium!.color), - bodyLarge: defText.bodyLarge!.copyWith(color: typoColor.bodyLarge!.color), - bodyMedium: - defText.bodyMedium!.copyWith(color: typoColor.bodyMedium!.color), - labelLarge: - defText.labelLarge!.copyWith(color: typoColor.labelLarge!.color), - // The textNoOpacity color style group. - titleSmall: - defText.titleSmall!.copyWith(color: typoColor.titleSmall!.color), - labelMedium: - defText.labelMedium!.copyWith(color: typoColor.labelMedium!.color), - labelSmall: - defText.labelSmall!.copyWith(color: typoColor.labelSmall!.color), - ); - // Equivalent text theme and color correct for primary Text Theme that will + defText = defText.merge(pTextTheme); + + // TextTheme is a default GoogleFonts TextTheme. + // + // Let's take a look at provided TextTheme, if it is mathc for a + // GoogleFont TextTheme, remove its default colors so we can make one with + // correct M2/M3 defaults. + TextTheme? pPrimTextTheme = primaryTextTheme; + if (pPrimTextTheme != null) { + final TextTheme gFontTextTheme = ThemeData.light().textTheme.apply( + fontFamily: '', + fontFamilyFallback: [''], + ); + final TextTheme passedTextTheme = pPrimTextTheme.apply( + fontFamily: '', + fontFamilyFallback: [''], + ); + if (gFontTextTheme == passedTextTheme) { + pPrimTextTheme = TextThemeColor.nullFontColor(pPrimTextTheme); + } + } + // Equivalent text theme and color correct for primary TextTheme that will // always get correct contrast color to be used on primary color. - defPrimaryText = defPrimaryText.merge(primaryTextTheme); - defPrimaryText = defPrimaryText.copyWith( - // The primeHiOpacity color style group. - displayLarge: defPrimaryText.displayLarge! - .copyWith(color: typoPrimColor.displayLarge!.color), - displayMedium: defPrimaryText.displayMedium! - .copyWith(color: typoPrimColor.displayMedium!.color), - displaySmall: defPrimaryText.displaySmall! - .copyWith(color: typoPrimColor.displaySmall!.color), - headlineLarge: defPrimaryText.headlineLarge! - .copyWith(color: typoPrimColor.headlineLarge!.color), - headlineMedium: defPrimaryText.headlineMedium! - .copyWith(color: typoPrimColor.headlineMedium!.color), - bodySmall: defPrimaryText.bodySmall! - .copyWith(color: typoPrimColor.bodySmall!.color), - // The primeMediumOpacity color style group. - headlineSmall: defPrimaryText.headlineSmall! - .copyWith(color: typoPrimColor.headlineSmall!.color), - titleLarge: defPrimaryText.titleLarge! - .copyWith(color: typoPrimColor.titleLarge!.color), - titleMedium: defPrimaryText.titleMedium! - .copyWith(color: typoPrimColor.titleMedium!.color), - bodyLarge: defPrimaryText.bodyLarge! - .copyWith(color: typoPrimColor.bodyLarge!.color), - bodyMedium: defPrimaryText.bodyMedium! - .copyWith(color: typoPrimColor.bodyMedium!.color), - labelLarge: defPrimaryText.labelLarge! - .copyWith(color: typoPrimColor.labelLarge!.color), - // The primeNoOpacity color style group. - titleSmall: defPrimaryText.titleSmall! - .copyWith(color: typoPrimColor.titleSmall!.color), - labelMedium: defPrimaryText.labelMedium! - .copyWith(color: typoPrimColor.labelMedium!.color), - labelSmall: defPrimaryText.labelSmall! - .copyWith(color: typoPrimColor.labelSmall!.color), - ); + defPrimaryText = defPrimaryText.merge(pPrimTextTheme); // We are using sub themes and blend colors on text themes. If surfaces and // background are not set to use blends, the effect will be slightly @@ -5709,19 +5711,96 @@ class FlexColorScheme with Diagnosticable { if (useSubThemes && subTheme.blendTextTheme) { // Calculate colors for the different TextStyles, color blend strength are // inline with opacities on the 2014/2018/2021 typographies. - final Color textBase = isDark ? Colors.white : Colors.black; - // For main text theme we are suing surface tint instead of primary, + // For main text theme we are using surface tint instead of primary, // normally it defaults to primary, but if it is customized we should base // tinted text theme on it instead. - final Color textHiOpacity = isDark // SDK dark 70%, light 54% - ? textBase.blend(colorScheme.surfaceTint, 15).withAlpha(0xE2) // 92% - : textBase.blend(colorScheme.surfaceTint, 20).withAlpha(0xD8); // 85% - final Color textMediumOpacity = isDark // SDK dark 0%, light 87% - ? textBase.blend(colorScheme.surfaceTint, 12) - : textBase.blend(colorScheme.surfaceTint, 20).withAlpha(0xF4); // 96% - final Color textNoOpacity = isDark // SDK dark 0%, light 0% - ? textBase.blend(colorScheme.surfaceTint, 15) - : textBase.blend(colorScheme.surfaceTint, 23); + Color blendText(Color? color, int blend, int alpha) { + final Color baseColor = color ?? (isDark ? Colors.white : Colors.black); + return baseColor.blend(colorScheme.surfaceTint, blend).withAlpha(alpha); + } + + // The tinted text theme is based of white/black, but if a custom color + // was provided, it is based of it and tinted with surfaceTint. + final Color cDisplayLarge = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.displayLarge?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.displayLarge?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + final Color cDisplayMedium = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.displayMedium?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.displayMedium?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + final Color cDisplaySmall = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.displaySmall?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.displaySmall?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + // + final Color cHeadlineLarge = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.headlineLarge?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.headlineLarge?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + final Color cHeadlineMedium = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.headlineMedium?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.headlineMedium?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + final Color cHeadlineSmall = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.headlineSmall?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.headlineSmall?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + // + final Color cTitleLarge = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.titleLarge?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.titleLarge?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + final Color cTitleMedium = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.titleMedium?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.titleMedium?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + final Color cTitleSmall = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.titleSmall?.color, kLoDarkTextBlend, + kLoDarkTextAlpha) // 100% + : blendText(pTextTheme?.titleSmall?.color, kLoLightTextBlend, + kLoLightTextAlpha); // 100% + // + final Color cBodyLarge = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.bodyLarge?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.bodyLarge?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + final Color cBodyMedium = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.bodyMedium?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.bodyMedium?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + final Color cBodySmall = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.bodySmall?.color, kHiDarkTextBlend, + kHiDarkTextAlpha) // 92% + : blendText(pTextTheme?.bodySmall?.color, kHiLightTextBlend, + kHiLightTextAlpha); // 85% + // + final Color cLabelLarge = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.labelLarge?.color, kMedDarkTextBlend, + kMedDarkTextAlpha) // 100% + : blendText(pTextTheme?.labelLarge?.color, kMedLightTextBlend, + kMedLightTextAlpha); // 96% + final Color cLabelMedium = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.labelMedium?.color, kLoDarkTextBlend, + kLoDarkTextAlpha) // 100% + : blendText(pTextTheme?.labelMedium?.color, kLoLightTextBlend, + kLoLightTextAlpha); // 100% + final Color cLabelSmall = isDark // SDK dark 70%, light 54% + ? blendText(pTextTheme?.labelSmall?.color, kLoDarkTextBlend, + kLoDarkTextAlpha) // 100% + : blendText(pTextTheme?.labelSmall?.color, kLoLightTextBlend, + kLoLightTextAlpha); // 100% + // Apply the computed colors. With this opt-in style, text gets a hint // of primary and less opacity than defaults. The primary tint may // not work so well if you need to put text on a completely different @@ -5734,75 +5813,146 @@ class FlexColorScheme with Diagnosticable { // a primary tint too. defText = defText.copyWith( // The textHiOpacity color style group. - displayLarge: defText.displayLarge!.copyWith(color: textHiOpacity), - displayMedium: defText.displayMedium!.copyWith(color: textHiOpacity), - displaySmall: defText.displaySmall!.copyWith(color: textHiOpacity), - headlineLarge: defText.headlineLarge!.copyWith(color: textHiOpacity), - headlineMedium: defText.headlineMedium!.copyWith(color: textHiOpacity), - bodySmall: defText.bodySmall!.copyWith(color: textHiOpacity), + displayLarge: defText.displayLarge!.copyWith(color: cDisplayLarge), + displayMedium: defText.displayMedium!.copyWith(color: cDisplayMedium), + displaySmall: defText.displaySmall!.copyWith(color: cDisplaySmall), + headlineLarge: defText.headlineLarge!.copyWith(color: cHeadlineLarge), + headlineMedium: + defText.headlineMedium!.copyWith(color: cHeadlineMedium), + bodySmall: defText.bodySmall!.copyWith(color: cBodySmall), // The textMediumOpacity color style group. - headlineSmall: - defText.headlineSmall!.copyWith(color: textMediumOpacity), - titleLarge: defText.titleLarge!.copyWith(color: textMediumOpacity), - titleMedium: defText.titleMedium!.copyWith(color: textMediumOpacity), - bodyLarge: defText.bodyLarge!.copyWith(color: textMediumOpacity), - bodyMedium: defText.bodyMedium!.copyWith(color: textMediumOpacity), - labelLarge: defText.labelLarge!.copyWith(color: textMediumOpacity), + headlineSmall: defText.headlineSmall!.copyWith(color: cHeadlineSmall), + titleLarge: defText.titleLarge!.copyWith(color: cTitleLarge), + titleMedium: defText.titleMedium!.copyWith(color: cTitleMedium), + bodyLarge: defText.bodyLarge!.copyWith(color: cBodyLarge), + bodyMedium: defText.bodyMedium!.copyWith(color: cBodyMedium), + labelLarge: defText.labelLarge!.copyWith(color: cLabelLarge), // The textNoOpacity color style group. - titleSmall: defText.titleSmall!.copyWith(color: textNoOpacity), - labelMedium: defText.labelMedium!.copyWith(color: textNoOpacity), - labelSmall: defText.labelSmall!.copyWith(color: textNoOpacity), + titleSmall: defText.titleSmall!.copyWith(color: cTitleSmall), + labelMedium: defText.labelMedium!.copyWith(color: cLabelMedium), + labelSmall: defText.labelSmall!.copyWith(color: cLabelSmall), ); + // Calculate colors for the different TextStyles, color blend strength are // inline with opacities on the 2014/2018/2021 typographies. - final Color primeBase = primaryIsDark ? Colors.white : Colors.black; - // For primeBase we could do this instead: - // final Color primeBase = colorScheme.onPrimary; - // and get additional variation into its color from current onPrimary, - // likewise for onSurface for normal text, but it is confusing, and also - // we get even more tinted text color then when those on colors are more - // more tinted, so it is a bit confusing. - final Color primeHiOpacity = primaryIsDark // SDK dark 70%, light 54% - ? primeBase.blend(colorScheme.primary, 10).withAlpha(0xE5) // 90% - : primeBase.blend(colorScheme.primary, 10).withAlpha(0xD8); // 85%; - final Color primeMediumOpacity = primaryIsDark // SDK dark 0%, light 87% - ? primeBase.blend(colorScheme.primary, 9) - : primeBase.blend(colorScheme.primary, 5).withAlpha(0xF2); // 95%; - final Color primeNoOpacity = primaryIsDark // SDK dark 0%, light 0% - ? primeBase.blend(colorScheme.primary, 7) - : primeBase.blend(colorScheme.primary, 4); + // For main text theme we are using surface tint instead of primary, + // normally it defaults to primary, but if it is customized we should base + // tinted text theme on it instead. + Color blendPrimText(Color? color, int blend, int alpha) { + final Color baseColor = + color ?? (primaryIsDark ? Colors.white : Colors.black); + return baseColor.blend(colorScheme.primary, blend).withAlpha(alpha); + } + + // The tinted text theme is based of white/black, but if a custom color + // was provided, it is based of it and tinted with surfaceTint. + final Color cPrimDisplayLarge = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.displayLarge?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 90% + : blendPrimText(pPrimTextTheme?.displayLarge?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + final Color cPrimDisplayMedium = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.displayMedium?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 90% + : blendPrimText(pPrimTextTheme?.displayMedium?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + final Color cPrimDisplaySmall = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.displaySmall?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 90% + : blendPrimText(pPrimTextTheme?.displaySmall?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + // + final Color cPrimHeadlineLarge = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.headlineLarge?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 90% + : blendPrimText(pPrimTextTheme?.headlineLarge?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + final Color cPrimHeadlineMedium = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.headlineMedium?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 90% + : blendPrimText(pPrimTextTheme?.headlineMedium?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + final Color cPrimHeadlineSmall = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.headlineSmall?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.headlineSmall?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + // + final Color cPrimTitleLarge = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.titleLarge?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.titleLarge?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + final Color cPrimTitleMedium = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.titleMedium?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.titleMedium?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + final Color cPrimTitleSmall = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.titleSmall?.color, + kLoDarkPrimTextBlend, kLoDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.titleSmall?.color, + kLoLightPrimTextBlend, kLoLightPrimTextAlpha); // 100% + // + final Color cPrimBodyLarge = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.bodyLarge?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.bodyLarge?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + final Color cPrimBodyMedium = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.bodyMedium?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.bodyMedium?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + final Color cPrimBodySmall = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.bodySmall?.color, + kHiDarkPrimTextBlend, kHiDarkPrimTextAlpha) // 92% + : blendPrimText(pPrimTextTheme?.bodySmall?.color, + kHiLightPrimTextBlend, kHiLightPrimTextAlpha); // 85% + // + final Color cPrimLabelLarge = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.labelLarge?.color, + kMedDarkPrimTextBlend, kMedDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.labelLarge?.color, + kMedLightPrimTextBlend, kMedLightPrimTextAlpha); // 95% + final Color cPrimLabelMedium = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.labelMedium?.color, + kLoDarkPrimTextBlend, kLoDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.labelMedium?.color, + kLoLightPrimTextBlend, kLoLightPrimTextAlpha); // 100% + final Color cPrimLabelSmall = primaryIsDark // SDK dark 70%, light 54% + ? blendPrimText(pPrimTextTheme?.labelSmall?.color, + kLoDarkPrimTextBlend, kLoDarkPrimTextAlpha) // 100% + : blendPrimText(pPrimTextTheme?.labelSmall?.color, + kLoLightPrimTextBlend, kLoLightPrimTextAlpha); // 100% // Equivalent blend text styles for primary text theme. defPrimaryText = defPrimaryText.copyWith( // The primeHiOpacity color style group. displayLarge: - defPrimaryText.displayLarge!.copyWith(color: primeHiOpacity), + defPrimaryText.displayLarge!.copyWith(color: cPrimDisplayLarge), displayMedium: - defPrimaryText.displayMedium!.copyWith(color: primeHiOpacity), + defPrimaryText.displayMedium!.copyWith(color: cPrimDisplayMedium), displaySmall: - defPrimaryText.displaySmall!.copyWith(color: primeHiOpacity), + defPrimaryText.displaySmall!.copyWith(color: cPrimDisplaySmall), headlineLarge: - defPrimaryText.headlineLarge!.copyWith(color: primeHiOpacity), + defPrimaryText.headlineLarge!.copyWith(color: cPrimHeadlineLarge), headlineMedium: - defPrimaryText.headlineMedium!.copyWith(color: primeHiOpacity), - bodySmall: defPrimaryText.bodySmall!.copyWith(color: primeHiOpacity), + defPrimaryText.headlineMedium!.copyWith(color: cPrimHeadlineMedium), + bodySmall: defPrimaryText.bodySmall!.copyWith(color: cPrimBodySmall), // The primeMediumOpacity color style group. headlineSmall: - defPrimaryText.headlineSmall!.copyWith(color: primeMediumOpacity), - titleLarge: - defPrimaryText.titleLarge!.copyWith(color: primeMediumOpacity), + defPrimaryText.headlineSmall!.copyWith(color: cPrimHeadlineSmall), + titleLarge: defPrimaryText.titleLarge!.copyWith(color: cPrimTitleLarge), titleMedium: - defPrimaryText.titleMedium!.copyWith(color: primeMediumOpacity), - bodyLarge: - defPrimaryText.bodyLarge!.copyWith(color: primeMediumOpacity), - bodyMedium: - defPrimaryText.bodyMedium!.copyWith(color: primeMediumOpacity), - labelLarge: - defPrimaryText.labelLarge!.copyWith(color: primeMediumOpacity), + defPrimaryText.titleMedium!.copyWith(color: cPrimTitleMedium), + bodyLarge: defPrimaryText.bodyLarge!.copyWith(color: cPrimBodyLarge), + bodyMedium: defPrimaryText.bodyMedium!.copyWith(color: cPrimBodyMedium), + labelLarge: defPrimaryText.labelLarge!.copyWith(color: cPrimLabelLarge), // The primeNoOpacity color style group. - titleSmall: defPrimaryText.titleSmall!.copyWith(color: primeNoOpacity), + titleSmall: defPrimaryText.titleSmall!.copyWith(color: cPrimTitleSmall), labelMedium: - defPrimaryText.labelMedium!.copyWith(color: primeNoOpacity), - labelSmall: defPrimaryText.labelSmall!.copyWith(color: primeNoOpacity), + defPrimaryText.labelMedium!.copyWith(color: cPrimLabelMedium), + labelSmall: defPrimaryText.labelSmall!.copyWith(color: cPrimLabelSmall), ); } // Assigning results to effective text themes. In older versions a merge diff --git a/lib/src/flex_constants.dart b/lib/src/flex_constants.dart index 55bf82b2..a3b1b411 100644 --- a/lib/src/flex_constants.dart +++ b/lib/src/flex_constants.dart @@ -458,3 +458,130 @@ const int kInputDecoratorLightBgDarken = 3; /// /// Value: 3 const int kInputDecoratorDarkBgLighten = 5; + +// The v7.1 Blended TextTheme magic values moved to constants +// ----------------------------------------------------------------------------- + +// Normal TextTheme + +/// High blended light TextTheme alpha blend % +/// +/// Value: 20 +const int kHiLightTextBlend = 20; + +/// High blended dark TextTheme alpha blend % +/// +/// Value: 15 +const int kHiDarkTextBlend = 15; + +/// Medium blended light TextTheme alpha blend % +/// +/// Value: 20 +const int kMedLightTextBlend = 20; + +/// Medium blended dark TextTheme alpha blend % +/// +/// Value: 15 +const int kMedDarkTextBlend = 12; + +/// Low blended light TextTheme alpha blend % +/// +/// Value: 23 +const int kLoLightTextBlend = 23; + +/// Low blended dark TextTheme alpha blend % +/// +/// Value: 15 +const int kLoDarkTextBlend = 15; + +/// High blended light TextTheme alpha value +/// +/// Value: 0xD8 = 85% +const int kHiLightTextAlpha = 0xD8; + +/// High blended dark TextTheme alpha value +/// +/// Value: 0xE2 = 92% +const int kHiDarkTextAlpha = 0xE2; + +/// Medium blended light TextTheme alpha value +/// +/// Value: 0xF4 = 96% +const int kMedLightTextAlpha = 0xF4; + +/// Medium blended dark TextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kMedDarkTextAlpha = 0xFF; + +/// Low blended light TextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kLoLightTextAlpha = 0xFF; + +/// Low blended dark TextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kLoDarkTextAlpha = 0xFF; + +// Primary TextTheme + +/// High blended light PrimaryTextTheme alpha blend % +/// +/// Value: 10 +const int kHiLightPrimTextBlend = 10; + +/// High blended dark PrimaryTextTheme alpha blend % +/// +/// Value: 10 +const int kHiDarkPrimTextBlend = 10; + +/// Medium blended light PrimaryTextTheme alpha blend % +/// +/// Value: 5 +const int kMedLightPrimTextBlend = 5; + +/// Medium blended dark PrimaryTextTheme alpha blend % +/// +/// Value: 9 +const int kMedDarkPrimTextBlend = 9; + +/// Low blended light PrimaryTextTheme alpha blend % +/// +/// Value: 4 +const int kLoLightPrimTextBlend = 4; + +/// Low blended dark PrimaryTextTheme alpha blend % +/// +/// Value: 7 +const int kLoDarkPrimTextBlend = 7; + +/// High blended light PrimaryTextTheme alpha value +/// +/// Value: 0xD8 = 85% +const int kHiLightPrimTextAlpha = 0xD8; + +/// High blended dark PrimaryTextTheme alpha value +/// +/// Value: 0xE5 = 90% +const int kHiDarkPrimTextAlpha = 0xE5; + +/// Medium blended light PrimaryTextTheme alpha value +/// +/// Value: 0xF2 = 95% +const int kMedLightPrimTextAlpha = 0xF2; + +/// Medium blended dark PrimaryTextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kMedDarkPrimTextAlpha = 0xFF; + +/// Low blended light PrimaryTextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kLoLightPrimTextAlpha = 0xFF; + +/// Low blended dark PrimaryTextTheme alpha value +/// +/// Value: 0xFF = 100% +const int kLoDarkPrimTextAlpha = 0xFF; diff --git a/lib/src/flex_text_theme_color.dart b/lib/src/flex_text_theme_color.dart new file mode 100644 index 00000000..81f1c3a7 --- /dev/null +++ b/lib/src/flex_text_theme_color.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +/// A utility class to set the color of the font color to null in all +/// [TextStyle]s in a [TextTheme]. +class TextThemeColor { + /// Set font color to null in all styles in passed in [TextTheme] and + /// return the new [TextTheme] other properties remain unchanged. + static TextTheme nullFontColor(TextTheme textTheme) { + /// Set font color to null in all styles in passed in [TextTheme] and + return TextTheme( + displayLarge: nullColor(textTheme.displayLarge!), + displayMedium: nullColor(textTheme.displayMedium!), + displaySmall: nullColor(textTheme.displaySmall!), + // + headlineLarge: nullColor(textTheme.headlineLarge!), + headlineMedium: nullColor(textTheme.headlineMedium!), + headlineSmall: nullColor(textTheme.headlineSmall!), + // + titleLarge: nullColor(textTheme.titleLarge!), + titleMedium: nullColor(textTheme.titleMedium!), + titleSmall: nullColor(textTheme.titleSmall!), + // + bodyLarge: nullColor(textTheme.bodyLarge!), + bodyMedium: nullColor(textTheme.bodyMedium!), + bodySmall: nullColor(textTheme.bodySmall!), + // + labelLarge: nullColor(textTheme.labelLarge!), + labelMedium: nullColor(textTheme.labelMedium!), + labelSmall: nullColor(textTheme.labelSmall!), + ); + } + + /// Set font color to null in all styles in passed in [TextStyle] and + /// return the new [TextStyle] other properties remain unchanged. + static TextStyle nullColor(TextStyle style) { + return TextStyle( + color: null, // Set color to NULL, let ThemeData handle default. + backgroundColor: style.backgroundColor, + fontSize: style.fontSize, + fontWeight: style.fontWeight, + fontStyle: style.fontStyle, + letterSpacing: style.letterSpacing, + wordSpacing: style.wordSpacing, + textBaseline: style.textBaseline, + height: style.height, + leadingDistribution: style.leadingDistribution, + locale: style.locale, + foreground: style.foreground, + background: style.background, + shadows: style.shadows, + fontFeatures: style.fontFeatures, + fontVariations: style.fontVariations, + decoration: style.decoration, + decorationColor: style.decorationColor, + decorationStyle: style.decorationStyle, + decorationThickness: style.decorationThickness, + debugLabel: style.debugLabel, + fontFamily: style.fontFamily, + fontFamilyFallback: style.fontFamilyFallback, + overflow: style.overflow, + ); + } +} diff --git a/lib/src/flex_theme_data_extensions.dart b/lib/src/flex_theme_data_extensions.dart index 627e5ca8..d0a27db3 100644 --- a/lib/src/flex_theme_data_extensions.dart +++ b/lib/src/flex_theme_data_extensions.dart @@ -973,10 +973,21 @@ extension FlexThemeData on ThemeData { /// Defaults to [VisualDensity.adaptivePlatformDensity]. final VisualDensity? visualDensity, - /// Text with a color that contrasts with the card and canvas colors. + /// Text with a color that contrasts with background, surface, card and + /// canvas colors. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for light/dark mode is used. final TextTheme? textTheme, /// A text theme that contrasts with the primary color. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for primary color is used. final TextTheme? primaryTextTheme, /// Name of the font family to use as default font for the text theme in @@ -2265,10 +2276,21 @@ extension FlexThemeData on ThemeData { /// Defaults to [VisualDensity.adaptivePlatformDensity]. final VisualDensity? visualDensity, - /// Text with a color that contrasts with the card and canvas colors. + /// Text with a color that contrasts with background, surface, card and + /// canvas colors. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for light/dark mode is used. final TextTheme? textTheme, /// A text theme that contrasts with the primary color. + /// + /// If a default `TextTheme` from package GoogleFonts is passed. + /// FlexColorScheme will detect this and make the color in the passed + /// in `GoogleFonts` null for all its `TextStyle`s so that the correct + /// color for M2/M3 mode and contrast for primary color is used. final TextTheme? primaryTextTheme, /// Name of the font family to use as default font for the text theme in diff --git a/pubspec.lock b/pubspec.lock index 232ee980..d26e6b84 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -97,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" file: dependency: transitive description: @@ -147,6 +155,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + google_fonts: + dependency: "direct dev" + description: + name: google_fonts + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" http_multi_server: dependency: transitive description: @@ -243,6 +267,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" + url: "https://pub.dev" + source: hosted + version: "2.0.15" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86" + url: "https://pub.dev" + source: hosted + version: "2.0.27" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" + url: "https://pub.dev" + source: hosted + version: "2.1.10" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + url: "https://pub.dev" + source: hosted + version: "2.0.6" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + url: "https://pub.dev" + source: hosted + version: "2.1.4" pool: dependency: transitive description: @@ -251,6 +339,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" protobuf: dependency: transitive description: @@ -412,10 +508,10 @@ packages: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web_socket_channel: dependency: transitive description: @@ -432,6 +528,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.dev" + source: hosted + version: "4.1.4" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + url: "https://pub.dev" + source: hosted + version: "1.0.0" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 91b5dd6b..b5f0c79a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flex_color_scheme description: A Flutter package to use and make beautiful Material design based themes. -version: 7.1.0 +version: 7.1.1 homepage: https://docs.flexcolorscheme.com repository: https://github.com/rydmike/flex_color_scheme issue_tracker: https://github.com/rydmike/flex_color_scheme/issues @@ -53,7 +53,11 @@ dependencies: meta: ^1.8.0 dev_dependencies: + # Flutter test tools flutter_test: sdk: flutter - + # Google fonts, by Google material.io. + # https://pub.dev/packages/google_fonts + google_fonts: ^4.0.4 + # Test lib. test: diff --git a/test/flex_color_scheme_to_theme_test.dart b/test/flex_color_scheme_to_theme_test.dart index 525137e3..9d95ec0d 100644 --- a/test/flex_color_scheme_to_theme_test.dart +++ b/test/flex_color_scheme_to_theme_test.dart @@ -2,6 +2,7 @@ import 'package:flex_color_scheme/flex_color_scheme.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:google_fonts/google_fonts.dart'; void main() { //**************************************************************************** @@ -5205,6 +5206,9 @@ void main() { ); }); }); + // + // FCS9 GROUP + // group('FCS9: Pass-through features WITH FlexColorScheme.toTheme ', () { TestWidgetsFlutterBinding.ensureInitialized(); test( @@ -5577,6 +5581,2295 @@ void main() { equals(colorScheme.surfaceVariant)); }); }); + // + // Group FCS11 More TextTheme tests and tests for issue #151: + // https://github.com/rydmike/flex_color_scheme/issues/151 + group('FCS11: TextTheme and ISSUE-151-Light WITH FlexColorScheme.toTheme ', + () { + TestWidgetsFlutterBinding.ensureInitialized(); + // + // Define a full TextTheme, but no font size or colors. + const TextTheme testText = TextTheme( + displayLarge: TextStyle( + fontWeight: FontWeight.w300, + textBaseline: TextBaseline.alphabetic, + letterSpacing: -1.5), + displayMedium: TextStyle( + fontWeight: FontWeight.w300, + textBaseline: TextBaseline.alphabetic, + letterSpacing: -0.5), + displaySmall: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.0), + headlineLarge: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.25), + headlineMedium: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.25), + headlineSmall: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.0), + titleLarge: TextStyle( + fontWeight: FontWeight.w500, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.15), + titleMedium: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.15), + titleSmall: TextStyle( + fontWeight: FontWeight.w500, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.1), + bodyLarge: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.5), + bodyMedium: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.25), + bodySmall: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 0.4), + labelLarge: TextStyle( + fontWeight: FontWeight.w500, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 1.25), + labelMedium: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 1.5), + labelSmall: TextStyle( + fontWeight: FontWeight.w400, + textBaseline: TextBaseline.alphabetic, + letterSpacing: 1.5), + ); + testWidgets( + 'FCS11-01 FCS-M2-LIGHT default textTheme with some other props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: false, + textTheme: testText, + primaryTextTheme: testText, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(Colors.black54)); + expect(textTheme.displayMedium!.color, equals(Colors.black54)); + expect(textTheme.displaySmall!.color, equals(Colors.black54)); + expect(textTheme.headlineLarge!.color, equals(Colors.black54)); + expect(textTheme.headlineMedium!.color, equals(Colors.black54)); + expect(textTheme.headlineSmall!.color, equals(Colors.black87)); + expect(textTheme.titleLarge!.color, equals(Colors.black87)); + expect(textTheme.titleMedium!.color, equals(Colors.black87)); + expect(textTheme.titleSmall!.color, equals(Colors.black)); + expect(textTheme.bodyLarge!.color, equals(Colors.black87)); + expect(textTheme.bodyMedium!.color, equals(Colors.black87)); + expect(textTheme.bodySmall!.color, equals(Colors.black54)); + expect(textTheme.labelLarge!.color, equals(Colors.black87)); + expect(textTheme.labelMedium!.color, equals(Colors.black)); + expect(textTheme.labelSmall!.color, equals(Colors.black)); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(Colors.white70)); + expect(pTextTheme.displayMedium!.color, equals(Colors.white70)); + expect(pTextTheme.displaySmall!.color, equals(Colors.white70)); + expect(pTextTheme.headlineLarge!.color, equals(Colors.white70)); + expect(pTextTheme.headlineMedium!.color, equals(Colors.white70)); + expect(pTextTheme.headlineSmall!.color, equals(Colors.white)); + expect(pTextTheme.titleLarge!.color, equals(Colors.white)); + expect(pTextTheme.titleMedium!.color, equals(Colors.white)); + expect(pTextTheme.titleSmall!.color, equals(Colors.white)); + expect(pTextTheme.bodyLarge!.color, equals(Colors.white)); + expect(pTextTheme.bodyMedium!.color, equals(Colors.white)); + expect(pTextTheme.bodySmall!.color, equals(Colors.white70)); + expect(pTextTheme.labelLarge!.color, equals(Colors.white)); + expect(pTextTheme.labelMedium!.color, equals(Colors.white)); + expect(pTextTheme.labelSmall!.color, equals(Colors.white)); + }); + testWidgets( + 'FCS11-02 FCS-M2-LIGHT default textTheme with some other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2018 typography and FCS tined text.', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: false, + textTheme: testText, + primaryTextTheme: testText, + subThemesData: const FlexSubThemesData( + useTextTheme: false, + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff29001a))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.labelLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff29001a))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff29001a))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xfffaeef5))); + }); + testWidgets( + 'FCS11-03 FCS-M2-DARK default textTheme with some other props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: false, + textTheme: testText, + primaryTextTheme: testText, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(Colors.white70)); + expect(textTheme.displayMedium!.color, equals(Colors.white70)); + expect(textTheme.displaySmall!.color, equals(Colors.white70)); + expect(textTheme.headlineLarge!.color, equals(Colors.white70)); + expect(textTheme.headlineMedium!.color, equals(Colors.white70)); + expect(textTheme.headlineSmall!.color, equals(Colors.white)); + expect(textTheme.titleLarge!.color, equals(Colors.white)); + expect(textTheme.titleMedium!.color, equals(Colors.white)); + expect(textTheme.titleSmall!.color, equals(Colors.white)); + expect(textTheme.bodyLarge!.color, equals(Colors.white)); + expect(textTheme.bodyMedium!.color, equals(Colors.white)); + expect(textTheme.bodySmall!.color, equals(Colors.white70)); + expect(textTheme.labelLarge!.color, equals(Colors.white)); + expect(textTheme.labelMedium!.color, equals(Colors.white)); + expect(textTheme.labelSmall!.color, equals(Colors.white)); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(Colors.black54)); + expect(pTextTheme.displayMedium!.color, equals(Colors.black54)); + expect(pTextTheme.displaySmall!.color, equals(Colors.black54)); + expect(pTextTheme.headlineLarge!.color, equals(Colors.black54)); + expect(pTextTheme.headlineMedium!.color, equals(Colors.black54)); + expect(pTextTheme.headlineSmall!.color, equals(Colors.black87)); + expect(pTextTheme.titleLarge!.color, equals(Colors.black87)); + expect(pTextTheme.titleMedium!.color, equals(Colors.black87)); + expect(pTextTheme.titleSmall!.color, equals(Colors.black)); + expect(pTextTheme.bodyLarge!.color, equals(Colors.black87)); + expect(pTextTheme.bodyMedium!.color, equals(Colors.black87)); + expect(pTextTheme.bodySmall!.color, equals(Colors.black54)); + expect(pTextTheme.labelLarge!.color, equals(Colors.black87)); + expect(pTextTheme.labelMedium!.color, equals(Colors.black)); + expect(pTextTheme.labelSmall!.color, equals(Colors.black)); + }); + testWidgets( + 'FCS11-04 FCS-M2-DARK default textTheme with some other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2018 typography and FCS tined text.', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: false, + textTheme: testText, + primaryTextTheme: testText, + subThemesData: const FlexSubThemesData( + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displayMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displaySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleSmall!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.labelLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.labelMedium!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.labelSmall!.color, equals(const Color(0xfffff3f8))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff0a0608))); + }); + // + // + testWidgets( + 'FCS11-05 FCS-M3-LIGHT default textTheme with some other props defined ' + 'EXPECT color and font size match 2021 typography', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: testText, + primaryTextTheme: testText, + ); + final ThemeData theme = fcs.toTheme; + final ColorScheme c = fcs.toScheme; + final Color tColor = c.onSurface; + final Color pColor = c.surface; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(tColor)); + expect(textTheme.displayMedium!.color, equals(tColor)); + expect(textTheme.displaySmall!.color, equals(tColor)); + expect(textTheme.headlineLarge!.color, equals(tColor)); + expect(textTheme.headlineMedium!.color, equals(tColor)); + expect(textTheme.headlineSmall!.color, equals(tColor)); + expect(textTheme.titleLarge!.color, equals(tColor)); + expect(textTheme.titleMedium!.color, equals(tColor)); + expect(textTheme.titleSmall!.color, equals(tColor)); + expect(textTheme.bodyLarge!.color, equals(tColor)); + expect(textTheme.bodyMedium!.color, equals(tColor)); + expect(textTheme.bodySmall!.color, equals(tColor)); + expect(textTheme.labelLarge!.color, equals(tColor)); + expect(textTheme.labelMedium!.color, equals(tColor)); + expect(textTheme.labelSmall!.color, equals(tColor)); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(pColor)); + expect(pTextTheme.displayMedium!.color, equals(pColor)); + expect(pTextTheme.displaySmall!.color, equals(pColor)); + expect(pTextTheme.headlineLarge!.color, equals(pColor)); + expect(pTextTheme.headlineMedium!.color, equals(pColor)); + expect(pTextTheme.headlineSmall!.color, equals(pColor)); + expect(pTextTheme.titleLarge!.color, equals(pColor)); + expect(pTextTheme.titleMedium!.color, equals(pColor)); + expect(pTextTheme.titleSmall!.color, equals(pColor)); + expect(pTextTheme.bodyLarge!.color, equals(pColor)); + expect(pTextTheme.bodyMedium!.color, equals(pColor)); + expect(pTextTheme.bodySmall!.color, equals(pColor)); + expect(pTextTheme.labelLarge!.color, equals(pColor)); + expect(pTextTheme.labelMedium!.color, equals(pColor)); + expect(pTextTheme.labelSmall!.color, equals(pColor)); + }); + testWidgets( + 'FCS11-06 FCS-M3-LIGHT default textTheme with some other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2021 typography and FCS tined text.', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: testText, + primaryTextTheme: testText, + subThemesData: const FlexSubThemesData( + useTextTheme: true, + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff29001a))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.labelLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff29001a))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff29001a))); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xfffaeef5))); + }); + testWidgets( + 'FCS11-07 FCS-M3-DARK default textTheme with some other props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: testText, + primaryTextTheme: testText, + ); + final ThemeData theme = fcs.toTheme; + final ColorScheme c = fcs.toScheme; + final Color tColor = c.onSurface; + final Color pColor = c.surface; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(tColor)); + expect(textTheme.displayMedium!.color, equals(tColor)); + expect(textTheme.displaySmall!.color, equals(tColor)); + expect(textTheme.headlineLarge!.color, equals(tColor)); + expect(textTheme.headlineMedium!.color, equals(tColor)); + expect(textTheme.headlineSmall!.color, equals(tColor)); + expect(textTheme.titleLarge!.color, equals(tColor)); + expect(textTheme.titleMedium!.color, equals(tColor)); + expect(textTheme.titleSmall!.color, equals(tColor)); + expect(textTheme.bodyLarge!.color, equals(tColor)); + expect(textTheme.bodyMedium!.color, equals(tColor)); + expect(textTheme.bodySmall!.color, equals(tColor)); + expect(textTheme.labelLarge!.color, equals(tColor)); + expect(textTheme.labelMedium!.color, equals(tColor)); + expect(textTheme.labelSmall!.color, equals(tColor)); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(pColor)); + expect(pTextTheme.displayMedium!.color, equals(pColor)); + expect(pTextTheme.displaySmall!.color, equals(pColor)); + expect(pTextTheme.headlineLarge!.color, equals(pColor)); + expect(pTextTheme.headlineMedium!.color, equals(pColor)); + expect(pTextTheme.headlineSmall!.color, equals(pColor)); + expect(pTextTheme.titleLarge!.color, equals(pColor)); + expect(pTextTheme.titleMedium!.color, equals(pColor)); + expect(pTextTheme.titleSmall!.color, equals(pColor)); + expect(pTextTheme.bodyLarge!.color, equals(pColor)); + expect(pTextTheme.bodyMedium!.color, equals(pColor)); + expect(pTextTheme.bodySmall!.color, equals(pColor)); + expect(pTextTheme.labelLarge!.color, equals(pColor)); + expect(pTextTheme.labelMedium!.color, equals(pColor)); + expect(pTextTheme.labelSmall!.color, equals(pColor)); + }); + testWidgets( + 'FCS11-08 FCS-M3-DARK default textTheme with some other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2021 typography and FCS tined text.', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: testText, + primaryTextTheme: testText, + subThemesData: const FlexSubThemesData(blendTextTheme: true), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displayMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displaySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleSmall!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.labelLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.labelMedium!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.labelSmall!.color, equals(const Color(0xfffff3f8))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff0a0608))); + }); + // + // Define a full LIGHT TextTheme, with font sizes and colors. + const TextTheme tLText = TextTheme( + displayLarge: TextStyle( + fontSize: 58.0, + color: Color(0xd8500433), + fontWeight: FontWeight.w400, + letterSpacing: -0.25, + height: 1.12, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + displayMedium: TextStyle( + fontSize: 46.0, + color: Color(0xd8295004), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.16, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + displaySmall: TextStyle( + fontSize: 37.0, + color: Color(0xd8044550), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.22, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineLarge: TextStyle( + fontSize: 33.0, + color: Color(0xd8500433), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.25, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineMedium: TextStyle( + fontSize: 29.0, + color: Color(0xd83b1602), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.29, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineSmall: TextStyle( + fontSize: 25.0, + color: Color(0xd84f0834), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleLarge: TextStyle( + fontSize: 23.0, + color: Color(0xd860053d), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.27, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleMedium: TextStyle( + fontSize: 17.0, + color: Color(0xd8405004), + fontWeight: FontWeight.w500, + letterSpacing: 0.15, + height: 1.50, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleSmall: TextStyle( + fontSize: 15.0, + color: Color(0xd8045016), + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelLarge: TextStyle( + fontSize: 15.0, + color: Color(0xd80e0450), + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelMedium: TextStyle( + fontSize: 13.0, + color: Color(0xd8020c36), + fontWeight: FontWeight.w500, + letterSpacing: 0.5, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelSmall: TextStyle( + fontSize: 12.0, + color: Color(0xd81b3605), + fontWeight: FontWeight.w500, + letterSpacing: 0.5, + height: 1.45, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodyLarge: TextStyle( + fontSize: 17.0, + color: Color(0xd80d2f02), + fontWeight: FontWeight.w400, + letterSpacing: 0.5, + height: 1.50, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodyMedium: TextStyle( + fontSize: 15.0, + color: Color(0xd8260118), + fontWeight: FontWeight.w400, + letterSpacing: 0.25, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodySmall: TextStyle( + fontSize: 13.0, + color: Color(0xd8570738), + fontWeight: FontWeight.w400, + letterSpacing: 0.4, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + ); + // + // Define a full DARK TextTheme, with font sizes and colors. + const TextTheme tDText = TextTheme( + displayLarge: TextStyle( + fontSize: 58.0, + color: Color(0xd84d4148), + fontWeight: FontWeight.w400, + letterSpacing: -0.25, + height: 1.12, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + displayMedium: TextStyle( + fontSize: 46.0, + color: Color(0xd8495042), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.16, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + displaySmall: TextStyle( + fontSize: 37.0, + color: Color(0xd8344548), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.22, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineLarge: TextStyle( + fontSize: 33.0, + color: Color(0xd8603e53), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.25, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineMedium: TextStyle( + fontSize: 29.0, + color: Color(0xd8775e51), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.29, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + headlineSmall: TextStyle( + fontSize: 25.0, + color: Color(0xd8704f63), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleLarge: TextStyle( + fontSize: 23.0, + color: Color(0xd86c465e), + fontWeight: FontWeight.w400, + letterSpacing: 0.0, + height: 1.27, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleMedium: TextStyle( + fontSize: 17.0, + color: Color(0xd8626947), + fontWeight: FontWeight.w500, + letterSpacing: 0.15, + height: 1.50, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + titleSmall: TextStyle( + fontSize: 15.0, + color: Color(0xd8045016), + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelLarge: TextStyle( + fontSize: 15.0, + color: Color(0xd8484467), + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelMedium: TextStyle( + fontSize: 13.0, + color: Color(0xd8525870), + fontWeight: FontWeight.w500, + letterSpacing: 0.5, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + labelSmall: TextStyle( + fontSize: 12.0, + color: Color(0xd8647557), + fontWeight: FontWeight.w500, + letterSpacing: 0.5, + height: 1.45, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodyLarge: TextStyle( + fontSize: 17.0, + color: Color(0xd84b6244), + fontWeight: FontWeight.w400, + letterSpacing: 0.5, + height: 1.50, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodyMedium: TextStyle( + fontSize: 15.0, + color: Color(0xd879566b), + fontWeight: FontWeight.w400, + letterSpacing: 0.25, + height: 1.43, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + bodySmall: TextStyle( + fontSize: 13.0, + color: Color(0xd86b4f60), + fontWeight: FontWeight.w400, + letterSpacing: 0.4, + height: 1.33, + textBaseline: TextBaseline.alphabetic, + leadingDistribution: TextLeadingDistribution.even), + ); + testWidgets( + 'FCS11-09 FCS-M3-LIGHT custom textTheme with color and size defined ' + 'EXPECT color and font size match custom style', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: tLText, + primaryTextTheme: tDText, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 custom font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(58)); + expect(textTheme.displayMedium!.fontSize, equals(46)); + expect(textTheme.displaySmall!.fontSize, equals(37)); + expect(textTheme.headlineLarge!.fontSize, equals(33)); + expect(textTheme.headlineMedium!.fontSize, equals(29)); + expect(textTheme.headlineSmall!.fontSize, equals(25)); + expect(textTheme.titleLarge!.fontSize, equals(23)); + expect(textTheme.titleMedium!.fontSize, equals(17)); + expect(textTheme.titleSmall!.fontSize, equals(15)); + expect(textTheme.bodyLarge!.fontSize, equals(17)); + expect(textTheme.bodyMedium!.fontSize, equals(15)); + expect(textTheme.bodySmall!.fontSize, equals(13)); + expect(textTheme.labelLarge!.fontSize, equals(15)); + expect(textTheme.labelMedium!.fontSize, equals(13)); + expect(textTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(58)); + expect(pTextTheme.displayMedium!.fontSize, equals(46)); + expect(pTextTheme.displaySmall!.fontSize, equals(37)); + expect(pTextTheme.headlineLarge!.fontSize, equals(33)); + expect(pTextTheme.headlineMedium!.fontSize, equals(29)); + expect(pTextTheme.headlineSmall!.fontSize, equals(25)); + expect(pTextTheme.titleLarge!.fontSize, equals(23)); + expect(pTextTheme.titleMedium!.fontSize, equals(17)); + expect(pTextTheme.titleSmall!.fontSize, equals(15)); + expect(pTextTheme.bodyLarge!.fontSize, equals(17)); + expect(pTextTheme.bodyMedium!.fontSize, equals(15)); + expect(pTextTheme.bodySmall!.fontSize, equals(13)); + expect(pTextTheme.labelLarge!.fontSize, equals(15)); + expect(pTextTheme.labelMedium!.fontSize, equals(13)); + expect(pTextTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8500433))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8295004))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8044550))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8500433))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd83b1602))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xd84f0834))); + expect(textTheme.titleLarge!.color, equals(const Color(0xd860053d))); + expect(textTheme.titleMedium!.color, equals(const Color(0xd8405004))); + expect(textTheme.titleSmall!.color, equals(const Color(0xd8045016))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xd80d2f02))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xd8260118))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd8570738))); + expect(textTheme.labelLarge!.color, equals(const Color(0xd80e0450))); + expect(textTheme.labelMedium!.color, equals(const Color(0xd8020c36))); + expect(textTheme.labelSmall!.color, equals(const Color(0xd81b3605))); + // Test M3 custom font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd84d4148))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8495042))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8344548))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8603e53))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8775e51))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xd8704f63))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xd86c465e))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xd8626947))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xd8045016))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xd84b6244))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xd879566b))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd86b4f60))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xd8484467))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xd8525870))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xd8647557))); + }); + testWidgets( + 'FCS11-10 FCS-M3-LIGHT custom textTheme with color and size defined ' + 'TINTED textTheme ' + 'EXPECT color and font size match custom style', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: tLText, + primaryTextTheme: tDText, + subThemesData: const FlexSubThemesData(blendTextTheme: true), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 custom font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(58)); + expect(textTheme.displayMedium!.fontSize, equals(46)); + expect(textTheme.displaySmall!.fontSize, equals(37)); + expect(textTheme.headlineLarge!.fontSize, equals(33)); + expect(textTheme.headlineMedium!.fontSize, equals(29)); + expect(textTheme.headlineSmall!.fontSize, equals(25)); + expect(textTheme.titleLarge!.fontSize, equals(23)); + expect(textTheme.titleMedium!.fontSize, equals(17)); + expect(textTheme.titleSmall!.fontSize, equals(15)); + expect(textTheme.bodyLarge!.fontSize, equals(17)); + expect(textTheme.bodyMedium!.fontSize, equals(15)); + expect(textTheme.bodySmall!.fontSize, equals(13)); + expect(textTheme.labelLarge!.fontSize, equals(15)); + expect(textTheme.labelMedium!.fontSize, equals(13)); + expect(textTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(58)); + expect(pTextTheme.displayMedium!.fontSize, equals(46)); + expect(pTextTheme.displaySmall!.fontSize, equals(37)); + expect(pTextTheme.headlineLarge!.fontSize, equals(33)); + expect(pTextTheme.headlineMedium!.fontSize, equals(29)); + expect(pTextTheme.headlineSmall!.fontSize, equals(25)); + expect(pTextTheme.titleLarge!.fontSize, equals(23)); + expect(pTextTheme.titleMedium!.fontSize, equals(17)); + expect(pTextTheme.titleSmall!.fontSize, equals(15)); + expect(pTextTheme.bodyLarge!.fontSize, equals(17)); + expect(pTextTheme.bodyMedium!.fontSize, equals(15)); + expect(pTextTheme.bodySmall!.fontSize, equals(13)); + expect(pTextTheme.labelLarge!.fontSize, equals(15)); + expect(pTextTheme.labelMedium!.fontSize, equals(13)); + expect(pTextTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom and tinted font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8670342))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8493d1d))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd82c3558))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8670342))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd857101c))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xf4660642))); + expect(textTheme.titleLarge!.color, equals(const Color(0xf4730349))); + expect(textTheme.titleMedium!.color, equals(const Color(0xf45a3d1d))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff323b2e))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xf433241c))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xf446002d))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd86c0545))); + expect(textTheme.labelLarge!.color, equals(const Color(0xf4340358))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff300846))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff432822))); + // Test M3 custom and tinted font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xe558394d))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xe5554647))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xe5423d4d))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xe5693656))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xe57e5355))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xff774764))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xff733e60))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xff6a5e4b))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff11491d))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xff555848))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xff7f4d6c))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xe5734562))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xff533d68))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff595170))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff6a6b59))); + }); + + testWidgets( + 'FCS11-11 FCS-M3-DARK custom textTheme with color and size defined ' + 'EXPECT color and font size match custom style', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS dark, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: tDText, + primaryTextTheme: tLText, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 custom font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(58)); + expect(textTheme.displayMedium!.fontSize, equals(46)); + expect(textTheme.displaySmall!.fontSize, equals(37)); + expect(textTheme.headlineLarge!.fontSize, equals(33)); + expect(textTheme.headlineMedium!.fontSize, equals(29)); + expect(textTheme.headlineSmall!.fontSize, equals(25)); + expect(textTheme.titleLarge!.fontSize, equals(23)); + expect(textTheme.titleMedium!.fontSize, equals(17)); + expect(textTheme.titleSmall!.fontSize, equals(15)); + expect(textTheme.bodyLarge!.fontSize, equals(17)); + expect(textTheme.bodyMedium!.fontSize, equals(15)); + expect(textTheme.bodySmall!.fontSize, equals(13)); + expect(textTheme.labelLarge!.fontSize, equals(15)); + expect(textTheme.labelMedium!.fontSize, equals(13)); + expect(textTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(58)); + expect(pTextTheme.displayMedium!.fontSize, equals(46)); + expect(pTextTheme.displaySmall!.fontSize, equals(37)); + expect(pTextTheme.headlineLarge!.fontSize, equals(33)); + expect(pTextTheme.headlineMedium!.fontSize, equals(29)); + expect(pTextTheme.headlineSmall!.fontSize, equals(25)); + expect(pTextTheme.titleLarge!.fontSize, equals(23)); + expect(pTextTheme.titleMedium!.fontSize, equals(17)); + expect(pTextTheme.titleSmall!.fontSize, equals(15)); + expect(pTextTheme.bodyLarge!.fontSize, equals(17)); + expect(pTextTheme.bodyMedium!.fontSize, equals(15)); + expect(pTextTheme.bodySmall!.fontSize, equals(13)); + expect(pTextTheme.labelLarge!.fontSize, equals(15)); + expect(pTextTheme.labelMedium!.fontSize, equals(13)); + expect(pTextTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd84d4148))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8495042))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8344548))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8603e53))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd8775e51))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xd8704f63))); + expect(textTheme.titleLarge!.color, equals(const Color(0xd86c465e))); + expect(textTheme.titleMedium!.color, equals(const Color(0xd8626947))); + expect(textTheme.titleSmall!.color, equals(const Color(0xd8045016))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xd84b6244))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xd879566b))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd86b4f60))); + expect(textTheme.labelLarge!.color, equals(const Color(0xd8484467))); + expect(textTheme.labelMedium!.color, equals(const Color(0xd8525870))); + expect(textTheme.labelSmall!.color, equals(const Color(0xd8647557))); + // Test M3 custom font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8500433))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8295004))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8044550))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8500433))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd83b1602))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xd84f0834))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xd860053d))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xd8405004))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xd8045016))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xd80d2f02))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xd8260118))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd8570738))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xd80e0450))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xd8020c36))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xd81b3605))); + }); + testWidgets( + 'FCS11-12 FCS-M3-DARK custom textTheme with color and size defined ' + 'TINTED textTheme ' + 'EXPECT color and font size match custom style', + (WidgetTester tester) async { + // Make a full ColorScheme from a SeedColor,. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS dark, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: tDText, + primaryTextTheme: tLText, + subThemesData: const FlexSubThemesData(blendTextTheme: true), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 custom font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(58)); + expect(textTheme.displayMedium!.fontSize, equals(46)); + expect(textTheme.displaySmall!.fontSize, equals(37)); + expect(textTheme.headlineLarge!.fontSize, equals(33)); + expect(textTheme.headlineMedium!.fontSize, equals(29)); + expect(textTheme.headlineSmall!.fontSize, equals(25)); + expect(textTheme.titleLarge!.fontSize, equals(23)); + expect(textTheme.titleMedium!.fontSize, equals(17)); + expect(textTheme.titleSmall!.fontSize, equals(15)); + expect(textTheme.bodyLarge!.fontSize, equals(17)); + expect(textTheme.bodyMedium!.fontSize, equals(15)); + expect(textTheme.bodySmall!.fontSize, equals(13)); + expect(textTheme.labelLarge!.fontSize, equals(15)); + expect(textTheme.labelMedium!.fontSize, equals(13)); + expect(textTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(58)); + expect(pTextTheme.displayMedium!.fontSize, equals(46)); + expect(pTextTheme.displaySmall!.fontSize, equals(37)); + expect(pTextTheme.headlineLarge!.fontSize, equals(33)); + expect(pTextTheme.headlineMedium!.fontSize, equals(29)); + expect(pTextTheme.headlineSmall!.fontSize, equals(25)); + expect(pTextTheme.titleLarge!.fontSize, equals(23)); + expect(pTextTheme.titleMedium!.fontSize, equals(17)); + expect(pTextTheme.titleSmall!.fontSize, equals(15)); + expect(pTextTheme.bodyLarge!.fontSize, equals(17)); + expect(pTextTheme.bodyMedium!.fontSize, equals(15)); + expect(pTextTheme.bodySmall!.fontSize, equals(13)); + expect(pTextTheme.labelLarge!.fontSize, equals(15)); + expect(pTextTheme.labelMedium!.fontSize, equals(13)); + expect(pTextTheme.labelSmall!.fontSize, equals(12)); + // Test M3 custom and tinted font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xe26b535f))); + expect(textTheme.displayMedium!.color, equals(const Color(0xe268605a))); + expect(textTheme.displaySmall!.color, equals(const Color(0xe256575f))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xe27b5168))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xe28e6b67))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xff835c72))); + expect(textTheme.titleLarge!.color, equals(const Color(0xff80546d))); + expect(textTheme.titleMedium!.color, equals(const Color(0xff777259))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff2f6036))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xff636c57))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xff8b6278))); + expect(textTheme.bodySmall!.color, equals(const Color(0xe2845f73))); + expect(textTheme.labelLarge!.color, equals(const Color(0xff605275))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff6f6680))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff7e7e6b))); + // Test M3 custom and tinted font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8631745))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8415a1b))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd820515e))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8631745))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8512719))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xf258113c))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xf2680e45))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xf24a550f))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff0f541e))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xf21a360d))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xf2320a22))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd86a1a49))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xf21b0d57))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff0d133d))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff253b0e))); + }); + + testWidgets( + 'FCS11-13 FCS-M2-LIGHT Google textTheme with no props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: false, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(Colors.black54)); + expect(textTheme.displayMedium!.color, equals(Colors.black54)); + expect(textTheme.displaySmall!.color, equals(Colors.black54)); + expect(textTheme.headlineLarge!.color, equals(Colors.black54)); + expect(textTheme.headlineMedium!.color, equals(Colors.black54)); + expect(textTheme.headlineSmall!.color, equals(Colors.black87)); + expect(textTheme.titleLarge!.color, equals(Colors.black87)); + expect(textTheme.titleMedium!.color, equals(Colors.black87)); + expect(textTheme.titleSmall!.color, equals(Colors.black)); + expect(textTheme.bodyLarge!.color, equals(Colors.black87)); + expect(textTheme.bodyMedium!.color, equals(Colors.black87)); + expect(textTheme.bodySmall!.color, equals(Colors.black54)); + expect(textTheme.labelLarge!.color, equals(Colors.black87)); + expect(textTheme.labelMedium!.color, equals(Colors.black)); + expect(textTheme.labelSmall!.color, equals(Colors.black)); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(Colors.white70)); + expect(pTextTheme.displayMedium!.color, equals(Colors.white70)); + expect(pTextTheme.displaySmall!.color, equals(Colors.white70)); + expect(pTextTheme.headlineLarge!.color, equals(Colors.white70)); + expect(pTextTheme.headlineMedium!.color, equals(Colors.white70)); + expect(pTextTheme.headlineSmall!.color, equals(Colors.white)); + expect(pTextTheme.titleLarge!.color, equals(Colors.white)); + expect(pTextTheme.titleMedium!.color, equals(Colors.white)); + expect(pTextTheme.titleSmall!.color, equals(Colors.white)); + expect(pTextTheme.bodyLarge!.color, equals(Colors.white)); + expect(pTextTheme.bodyMedium!.color, equals(Colors.white)); + expect(pTextTheme.bodySmall!.color, equals(Colors.white70)); + expect(pTextTheme.labelLarge!.color, equals(Colors.white)); + expect(pTextTheme.labelMedium!.color, equals(Colors.white)); + expect(pTextTheme.labelSmall!.color, equals(Colors.white)); + }); + testWidgets( + 'FCS11-14 FCS-M2-LIGHT Google textTheme with no other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2018 typography and FCS tined text.', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: false, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + subThemesData: const FlexSubThemesData( + useTextTheme: false, + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff29001a))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.labelLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff29001a))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff29001a))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xfffaeef5))); + }); + testWidgets( + 'FCS11-15 FCS-M2-DARK Google textTheme with no other props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: false, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(Colors.white70)); + expect(textTheme.displayMedium!.color, equals(Colors.white70)); + expect(textTheme.displaySmall!.color, equals(Colors.white70)); + expect(textTheme.headlineLarge!.color, equals(Colors.white70)); + expect(textTheme.headlineMedium!.color, equals(Colors.white70)); + expect(textTheme.headlineSmall!.color, equals(Colors.white)); + expect(textTheme.titleLarge!.color, equals(Colors.white)); + expect(textTheme.titleMedium!.color, equals(Colors.white)); + expect(textTheme.titleSmall!.color, equals(Colors.white)); + expect(textTheme.bodyLarge!.color, equals(Colors.white)); + expect(textTheme.bodyMedium!.color, equals(Colors.white)); + expect(textTheme.bodySmall!.color, equals(Colors.white70)); + expect(textTheme.labelLarge!.color, equals(Colors.white)); + expect(textTheme.labelMedium!.color, equals(Colors.white)); + expect(textTheme.labelSmall!.color, equals(Colors.white)); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(Colors.black54)); + expect(pTextTheme.displayMedium!.color, equals(Colors.black54)); + expect(pTextTheme.displaySmall!.color, equals(Colors.black54)); + expect(pTextTheme.headlineLarge!.color, equals(Colors.black54)); + expect(pTextTheme.headlineMedium!.color, equals(Colors.black54)); + expect(pTextTheme.headlineSmall!.color, equals(Colors.black87)); + expect(pTextTheme.titleLarge!.color, equals(Colors.black87)); + expect(pTextTheme.titleMedium!.color, equals(Colors.black87)); + expect(pTextTheme.titleSmall!.color, equals(Colors.black)); + expect(pTextTheme.bodyLarge!.color, equals(Colors.black87)); + expect(pTextTheme.bodyMedium!.color, equals(Colors.black87)); + expect(pTextTheme.bodySmall!.color, equals(Colors.black54)); + expect(pTextTheme.labelLarge!.color, equals(Colors.black87)); + expect(pTextTheme.labelMedium!.color, equals(Colors.black)); + expect(pTextTheme.labelSmall!.color, equals(Colors.black)); + }); + testWidgets( + 'FCS11-16 FCS-M2-DARK Google textTheme with no other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2018 typography and FCS tined text.', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: false, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + subThemesData: const FlexSubThemesData( + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M2 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(96)); + expect(textTheme.displayMedium!.fontSize, equals(60)); + expect(textTheme.displaySmall!.fontSize, equals(48)); + expect(textTheme.headlineLarge!.fontSize, equals(40)); + expect(textTheme.headlineMedium!.fontSize, equals(34)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(20)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(11)); + expect(textTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(96)); + expect(pTextTheme.displayMedium!.fontSize, equals(60)); + expect(pTextTheme.displaySmall!.fontSize, equals(48)); + expect(pTextTheme.headlineLarge!.fontSize, equals(40)); + expect(pTextTheme.headlineMedium!.fontSize, equals(34)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(20)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(11)); + expect(pTextTheme.labelSmall!.fontSize, equals(10)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displayMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displaySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleSmall!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.labelLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.labelMedium!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.labelSmall!.color, equals(const Color(0xfffff3f8))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff0a0608))); + }); + // + // + testWidgets( + 'FCS11-17 FCS-M3-LIGHT Google textTheme with no other props defined ' + 'EXPECT color and font size match 2021 typography', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + ); + final ThemeData theme = fcs.toTheme; + final ColorScheme c = fcs.toScheme; + final Color tColor = c.onSurface; + final Color pColor = c.surface; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(tColor)); + expect(textTheme.displayMedium!.color, equals(tColor)); + expect(textTheme.displaySmall!.color, equals(tColor)); + expect(textTheme.headlineLarge!.color, equals(tColor)); + expect(textTheme.headlineMedium!.color, equals(tColor)); + expect(textTheme.headlineSmall!.color, equals(tColor)); + expect(textTheme.titleLarge!.color, equals(tColor)); + expect(textTheme.titleMedium!.color, equals(tColor)); + expect(textTheme.titleSmall!.color, equals(tColor)); + expect(textTheme.bodyLarge!.color, equals(tColor)); + expect(textTheme.bodyMedium!.color, equals(tColor)); + expect(textTheme.bodySmall!.color, equals(tColor)); + expect(textTheme.labelLarge!.color, equals(tColor)); + expect(textTheme.labelMedium!.color, equals(tColor)); + expect(textTheme.labelSmall!.color, equals(tColor)); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(pColor)); + expect(pTextTheme.displayMedium!.color, equals(pColor)); + expect(pTextTheme.displaySmall!.color, equals(pColor)); + expect(pTextTheme.headlineLarge!.color, equals(pColor)); + expect(pTextTheme.headlineMedium!.color, equals(pColor)); + expect(pTextTheme.headlineSmall!.color, equals(pColor)); + expect(pTextTheme.titleLarge!.color, equals(pColor)); + expect(pTextTheme.titleMedium!.color, equals(pColor)); + expect(pTextTheme.titleSmall!.color, equals(pColor)); + expect(pTextTheme.bodyLarge!.color, equals(pColor)); + expect(pTextTheme.bodyMedium!.color, equals(pColor)); + expect(pTextTheme.bodySmall!.color, equals(pColor)); + expect(pTextTheme.labelLarge!.color, equals(pColor)); + expect(pTextTheme.labelMedium!.color, equals(pColor)); + expect(pTextTheme.labelSmall!.color, equals(pColor)); + }); + testWidgets( + 'FCS11-18 FCS-M3-LIGHT Google textTheme with some no props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2021 typography and FCS tined text.', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.light, seedColor: const Color(0xffd9008c)); + // FCS light, M2 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.light( + colorScheme: scheme, + useMaterial3: true, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + subThemesData: const FlexSubThemesData( + useTextTheme: true, + blendTextTheme: true, + ), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + theme: theme, + themeMode: ThemeMode.light, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.displayMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.displaySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xd8240017))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.titleSmall!.color, equals(const Color(0xff29001a))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xf4240017))); + expect(textTheme.bodySmall!.color, equals(const Color(0xd8240017))); + expect(textTheme.labelLarge!.color, equals(const Color(0xf4240017))); + expect(textTheme.labelMedium!.color, equals(const Color(0xff29001a))); + expect(textTheme.labelSmall!.color, equals(const Color(0xff29001a))); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xe5f7e6f1))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xfff8e9f3))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xfffaeef5))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xfffaeef5))); + }); + testWidgets( + 'FCS11-19 FCS-M3-DARK Google textTheme with no other props defined ' + 'EXPECT color and font size match 2018 typography', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + ); + final ThemeData theme = fcs.toTheme; + final ColorScheme c = fcs.toScheme; + final Color tColor = c.onSurface; + final Color pColor = c.surface; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(tColor)); + expect(textTheme.displayMedium!.color, equals(tColor)); + expect(textTheme.displaySmall!.color, equals(tColor)); + expect(textTheme.headlineLarge!.color, equals(tColor)); + expect(textTheme.headlineMedium!.color, equals(tColor)); + expect(textTheme.headlineSmall!.color, equals(tColor)); + expect(textTheme.titleLarge!.color, equals(tColor)); + expect(textTheme.titleMedium!.color, equals(tColor)); + expect(textTheme.titleSmall!.color, equals(tColor)); + expect(textTheme.bodyLarge!.color, equals(tColor)); + expect(textTheme.bodyMedium!.color, equals(tColor)); + expect(textTheme.bodySmall!.color, equals(tColor)); + expect(textTheme.labelLarge!.color, equals(tColor)); + expect(textTheme.labelMedium!.color, equals(tColor)); + expect(textTheme.labelSmall!.color, equals(tColor)); + // Test M3 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(pColor)); + expect(pTextTheme.displayMedium!.color, equals(pColor)); + expect(pTextTheme.displaySmall!.color, equals(pColor)); + expect(pTextTheme.headlineLarge!.color, equals(pColor)); + expect(pTextTheme.headlineMedium!.color, equals(pColor)); + expect(pTextTheme.headlineSmall!.color, equals(pColor)); + expect(pTextTheme.titleLarge!.color, equals(pColor)); + expect(pTextTheme.titleMedium!.color, equals(pColor)); + expect(pTextTheme.titleSmall!.color, equals(pColor)); + expect(pTextTheme.bodyLarge!.color, equals(pColor)); + expect(pTextTheme.bodyMedium!.color, equals(pColor)); + expect(pTextTheme.bodySmall!.color, equals(pColor)); + expect(pTextTheme.labelLarge!.color, equals(pColor)); + expect(pTextTheme.labelMedium!.color, equals(pColor)); + expect(pTextTheme.labelSmall!.color, equals(pColor)); + }); + testWidgets( + 'FCS11-20 FCS-M3-DARK Google textTheme with no other props defined ' + 'FCS use TINTED text ' + 'EXPECT font size match 2021 typography and FCS tined text.', + (WidgetTester tester) async { + // Define a Google Fonts TextTheme, it has colors baked into its styles. + // FCS will handle their removal and return theme correct colors, if the + // colors in default Google default TextTheme has not been modified. + // FCS will then return the correct color style for textTheme and + // primaryTextTheme, that is correct for both M2 and M3 mode, where + // M2 gets the opacity based colors and M3 the onSurface based colors. + final TextTheme gTextTheme = GoogleFonts.notoSansTextTheme(); + // Make a full ColorScheme from a SeedColor. + final ColorScheme scheme = ColorScheme.fromSeed( + brightness: Brightness.dark, seedColor: const Color(0xffd9008c)); + // FCS light, M3 and custom text theme. + final FlexColorScheme fcs = FlexColorScheme.dark( + colorScheme: scheme, + useMaterial3: true, + textTheme: gTextTheme, + primaryTextTheme: gTextTheme, + subThemesData: const FlexSubThemesData(blendTextTheme: true), + ); + final ThemeData theme = fcs.toTheme; + late TextTheme textTheme; + late TextTheme pTextTheme; + await tester.pumpWidget(MaterialApp( + darkTheme: theme, + themeMode: ThemeMode.dark, + home: Builder( + builder: (BuildContext context) { + textTheme = Theme.of(context).textTheme; + pTextTheme = Theme.of(context).primaryTextTheme; + return const Text('A'); + }, + ), + )); + // Test M3 default font sizes for textTheme. + expect(textTheme.displayLarge!.fontSize, equals(57)); + expect(textTheme.displayMedium!.fontSize, equals(45)); + expect(textTheme.displaySmall!.fontSize, equals(36)); + expect(textTheme.headlineLarge!.fontSize, equals(32)); + expect(textTheme.headlineMedium!.fontSize, equals(28)); + expect(textTheme.headlineSmall!.fontSize, equals(24)); + expect(textTheme.titleLarge!.fontSize, equals(22)); + expect(textTheme.titleMedium!.fontSize, equals(16)); + expect(textTheme.titleSmall!.fontSize, equals(14)); + expect(textTheme.bodyLarge!.fontSize, equals(16)); + expect(textTheme.bodyMedium!.fontSize, equals(14)); + expect(textTheme.bodySmall!.fontSize, equals(12)); + expect(textTheme.labelLarge!.fontSize, equals(14)); + expect(textTheme.labelMedium!.fontSize, equals(12)); + expect(textTheme.labelSmall!.fontSize, equals(11)); + // Test M3 default font sizes for primaryTextTheme. + expect(pTextTheme.displayLarge!.fontSize, equals(57)); + expect(pTextTheme.displayMedium!.fontSize, equals(45)); + expect(pTextTheme.displaySmall!.fontSize, equals(36)); + expect(pTextTheme.headlineLarge!.fontSize, equals(32)); + expect(pTextTheme.headlineMedium!.fontSize, equals(28)); + expect(pTextTheme.headlineSmall!.fontSize, equals(24)); + expect(pTextTheme.titleLarge!.fontSize, equals(22)); + expect(pTextTheme.titleMedium!.fontSize, equals(16)); + expect(pTextTheme.titleSmall!.fontSize, equals(14)); + expect(pTextTheme.bodyLarge!.fontSize, equals(16)); + expect(pTextTheme.bodyMedium!.fontSize, equals(14)); + expect(pTextTheme.bodySmall!.fontSize, equals(12)); + expect(pTextTheme.labelLarge!.fontSize, equals(14)); + expect(pTextTheme.labelMedium!.fontSize, equals(12)); + expect(pTextTheme.labelSmall!.fontSize, equals(11)); + // Test M2 default font colors for textTheme. + expect(textTheme.displayLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displayMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.displaySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineLarge!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineMedium!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.headlineSmall!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.titleSmall!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.bodyLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodyMedium!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.bodySmall!.color, equals(const Color(0xe2fff3f8))); + expect(textTheme.labelLarge!.color, equals(const Color(0xfffff5f9))); + expect(textTheme.labelMedium!.color, equals(const Color(0xfffff3f8))); + expect(textTheme.labelSmall!.color, equals(const Color(0xfffff3f8))); + // Test M2 default font colors for primTextTheme. + expect(pTextTheme.displayLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displayMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.displaySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineLarge!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineMedium!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.headlineSmall!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.titleSmall!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.bodyLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodyMedium!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.bodySmall!.color, equals(const Color(0xd8191114))); + expect(pTextTheme.labelLarge!.color, equals(const Color(0xf20c0809))); + expect(pTextTheme.labelMedium!.color, equals(const Color(0xff0a0608))); + expect(pTextTheme.labelSmall!.color, equals(const Color(0xff0a0608))); + }); + }); } // Custom page transition with no transition. diff --git a/test/flex_const_test.dart b/test/flex_const_test.dart index abf15308..e5b9e22e 100644 --- a/test/flex_const_test.dart +++ b/test/flex_const_test.dart @@ -231,5 +231,81 @@ void main() { test('FCT kInputDecoratorDarkBgLighten is 5', () { expect(kInputDecoratorDarkBgLighten, 5); }); + // New in FCS 7.1.1 + test('FCT kHiLightTextBlend is 20', () { + expect(kHiLightTextBlend, 20); + }); + test('FCT kHiDarkTextBlend is 15', () { + expect(kHiDarkTextBlend, 15); + }); + test('FCT kMedLightTextBlend is 20', () { + expect(kMedLightTextBlend, 20); + }); + test('FCT kMedDarkTextBlend is 12', () { + expect(kMedDarkTextBlend, 12); + }); + test('FCT kLoLightTextBlend is 23', () { + expect(kLoLightTextBlend, 23); + }); + test('FCT kLoDarkTextBlend is 15', () { + expect(kLoDarkTextBlend, 15); + }); + test('FCT kHiLightTextAlpha is 0xD8', () { + expect(kHiLightTextAlpha, 0xD8); + }); + test('FCT kHiDarkTextAlpha is 0xE2', () { + expect(kHiDarkTextAlpha, 0xE2); + }); + test('FCT kMedLightTextAlpha is 0xF4', () { + expect(kMedLightTextAlpha, 0xF4); + }); + test('FCT kMedDarkTextAlpha is 0xFF', () { + expect(kMedDarkTextAlpha, 0xFF); + }); + test('FCT kLoLightTextAlpha is 0xFF', () { + expect(kLoLightTextAlpha, 0xFF); + }); + test('FCT kLoDarkTextAlpha is 0xFF', () { + expect(kLoDarkTextAlpha, 0xFF); + }); + test('FCT kHiLightPrimTextBlend is 10', () { + expect(kHiLightPrimTextBlend, 10); + }); + test('FCT kHiDarkPrimTextBlend is 10', () { + expect(kHiDarkPrimTextBlend, 10); + }); + test('FCT kMedLightPrimTextBlend is 5', () { + expect(kMedLightPrimTextBlend, 5); + }); + test('FCT kAlphaUnselect is 0xDD', () { + expect(kAlphaUnselect, 0xDD); + }); + test('FCT kMedDarkPrimTextBlend is 9', () { + expect(kMedDarkPrimTextBlend, 9); + }); + test('FCT kLoLightPrimTextBlend is 4', () { + expect(kLoLightPrimTextBlend, 4); + }); + test('FCT kLoDarkPrimTextBlend is 7', () { + expect(kLoDarkPrimTextBlend, 7); + }); + test('FCT kHiLightPrimTextAlpha is 0xD8', () { + expect(kHiLightPrimTextAlpha, 0xD8); + }); + test('FCT kHiDarkPrimTextAlpha is 0xE5', () { + expect(kHiDarkPrimTextAlpha, 0xE5); + }); + test('FCT kMedLightPrimTextAlpha is 0xF2', () { + expect(kMedLightPrimTextAlpha, 0xF2); + }); + test('FCT kMedDarkPrimTextAlpha is 0xFF', () { + expect(kMedDarkPrimTextAlpha, 0xFF); + }); + test('FCT kLoLightPrimTextAlpha is 0xFF', () { + expect(kLoLightPrimTextAlpha, 0xFF); + }); + test('FCT kLoDarkPrimTextAlpha is 0xFF', () { + expect(kLoDarkPrimTextAlpha, 0xFF); + }); }); } diff --git a/test/flex_text_theme_color_test.dart b/test/flex_text_theme_color_test.dart new file mode 100644 index 00000000..997af466 --- /dev/null +++ b/test/flex_text_theme_color_test.dart @@ -0,0 +1,57 @@ +import 'package:flex_color_scheme/src/flex_text_theme_color.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +//**************************************************************************** +// These simple FlexColor unit test just monitors that the used color values +// for the standard material color schemes included in the SDK, match the ones +// defined in FlexColor. If either changes in the future, the tests will fail. +// They also ensure that we have not changed our own used scheme color values. +//**************************************************************************** + +void main() { + //**************************************************************************** + // TextThemeColor unit tests - TextThemeColor utility makes null colored font. + //**************************************************************************** + group('FTTC01: TextThemeColor.nullFontColor makes font color null.', () { + test('FTTC01.01: GIVEN a font, test all style has color', () { + final TextTheme font = ThemeData.light().textTheme; + expect(font.displayLarge?.color, isNotNull); + expect(font.displayMedium?.color, isNotNull); + expect(font.displaySmall?.color, isNotNull); + // + expect(font.headlineLarge?.color, isNotNull); + expect(font.headlineMedium?.color, isNotNull); + expect(font.headlineSmall?.color, isNotNull); + // + expect(font.bodyLarge?.color, isNotNull); + expect(font.bodyMedium?.color, isNotNull); + expect(font.bodySmall?.color, isNotNull); + // + expect(font.labelLarge?.color, isNotNull); + expect(font.labelMedium?.color, isNotNull); + expect(font.labelSmall?.color, isNotNull); + }); + test( + 'FTTC01.02: GIVEN a font with colors, and apply null FontColor, ' + 'test all style has NULL color', () { + final TextTheme font = + TextThemeColor.nullFontColor(ThemeData.light().textTheme); + expect(font.displayLarge?.color, isNull); + expect(font.displayMedium?.color, isNull); + expect(font.displaySmall?.color, isNull); + // + expect(font.headlineLarge?.color, isNull); + expect(font.headlineMedium?.color, isNull); + expect(font.headlineSmall?.color, isNull); + // + expect(font.bodyLarge?.color, isNull); + expect(font.bodyMedium?.color, isNull); + expect(font.bodySmall?.color, isNull); + // + expect(font.labelLarge?.color, isNull); + expect(font.labelMedium?.color, isNull); + expect(font.labelSmall?.color, isNull); + }); + }); +}