diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b425044d0..874628d5d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -12,7 +12,6 @@
# Controversial but pub.dev penalizes you if dart format is not used.
# - Run all tests with coverage.
# - Upload code coverage output to Codecov for analysis.
-# - branch: version-5-0-0-dev1
name: Test
on:
pull_request:
@@ -32,7 +31,7 @@ jobs:
- name: "Install Flutter and Dart SDK"
uses: subosito/flutter-action@v1.5.3
with:
- channel: "stable"
+ channel: "master"
- name: "Show Dart SDK version"
run: dart --version
- name: "Show Flutter SDK version"
diff --git a/.run/Example theme - Copy Paste.run.xml b/.run/Example theme - Copy Paste.run.xml
index 9dd38fd75..cd80137db 100644
--- a/.run/Example theme - Copy Paste.run.xml
+++ b/.run/Example theme - Copy Paste.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.run/Example1.run.xml b/.run/Example1.run.xml
index 5d5edc14a..b117bfd8d 100644
--- a/.run/Example1.run.xml
+++ b/.run/Example1.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.run/Example2.run.xml b/.run/Example2.run.xml
index 2af2e2418..76425c423 100644
--- a/.run/Example2.run.xml
+++ b/.run/Example2.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.run/Example3.run.xml b/.run/Example3.run.xml
index 1065cd4d9..c2e168a14 100644
--- a/.run/Example3.run.xml
+++ b/.run/Example3.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.run/Example4.run.xml b/.run/Example4.run.xml
index 9718dcf40..99d9ba7ac 100644
--- a/.run/Example4.run.xml
+++ b/.run/Example4.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.run/Example5.run.xml b/.run/Example5.run.xml
index 4cb4d35b0..0ee1f7bca 100644
--- a/.run/Example5.run.xml
+++ b/.run/Example5.run.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 11b9b2ee7..5763e9392 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -20,42 +20,42 @@
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example_copy_paste/main.dart"
+ "program": "lib/example_copy_paste_from_playground/main.dart"
},
{
"name": "Example 1 - Basic Theme Usage",
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example1/main.dart"
+ "program": "lib/example1_basic_theme_usage/main.dart"
},
{
"name": "Example 2 - Custom Theme",
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example2/main.dart"
+ "program": "lib/example2_custom_theme/main.dart"
},
{
"name": "Example 3 - Four Themes",
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example3/main.dart"
+ "program": "lib/example3_four_themes/main.dart"
},
{
"name": "Example 4 - All Themes",
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example4/main.dart"
+ "program": "lib/example4_all_themes/main.dart"
},
{
"name": "Example 5 - Themes Playground",
"cwd": "example",
"request": "launch",
"type": "dart",
- "program": "lib/example5/main.dart"
+ "program": "lib/example5_themes_playground/main.dart"
}
]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e81374694..f0fd52406 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,19 +2,235 @@
All notable changes to the **FlexColorScheme** (FCS) package are documented here.
-## v5.1.0 - July 8, 2022
+## 5.2.0-dev.1
-* Updated to support Flutter 3.0.0, Dart 2.17 and latest Flutter package dependencies in
- example apps. Requires at least Flutter 3.0.0 and Dart 2.17.0.
+**Aug 11, 2022**
+
+This is a dev branch to test features on Flutter channel *master 3.1.0-0.0.pre.2199* and later to
+prepare for next style and feature alignments when `useMaterial3` is true.
+
+This dev release requires at least Flutter *master 3.1.0-0.0.pre.2199*. It includes new Flutter
+SDK ColorScheme colors. This dev release is going to be released when next stable Flutter version
+after 3.0 version comes out. It is expected to be released during Flutter Vikings 2022, Sep 1.
+
+All features current available in master Flutter *master 3.1.0-0.0.pre.2199*, might not be included
+in next stable release. If there are features in this dev release that do not land in stable
+they will be reverted from the FlexColorScheme 5.2.0 stable release.
+
+Due to a number of known and below listed Flutter SDK issues when using `useMaterial3` set to
+`true`, we cannot yet recommend using the option. Use it only if you are willing to accept the
+still incomplete Material 3 implementation in Flutter and the listed issues. If you keep it `false`,
+and use FCS opinionated component themes, you can create a theme that is visually fairly similar to
+M3, but still using M2 `ThemeData` mode to avoid the issues.
+
+**NEW**
+
+* Added support for new Flutter SDK `ColorScheme` colors `outlineVariant` and `scrim`.
+
+* The enum `SchemeColor` has new values and past values are in a new order. The
+ **order was changed** to accommodate new color values `outlineVariant` and `scrim` and to keep
+ them in the same order as their corresponding color properties in Flutter SDK updated
+ `ColorScheme`. The change of order is potentially breaking concerning index values of the enums,
+ but unlikely to break anything in a major way, other than possibly local storage of selected
+ enum values. In the bundled example applications and Themes Playground, you might for example see
+ wrong color selections loaded from local storage, just reset persisted theme or select correct
+ value to fix it.
+
+* Added `appBarCenterTitle` property to `FlexSubThemesData` configuration. It works the
+ same way as `centerTitle` in `AppBar` and its theme. The property is not available in the
+ Themes Playground app, only via the API. We recommend keeping it null to use platform
+ adaptive default behavior, but offer it as convenience property for those that like to use
+ same centering style regardless of used platform.
+
+* Added two new properties to `FlexSubThemes.elevatedButtonTheme`.
+ * Boolean `useMaterial3`, defaults to false.
+ * `onBaseSchemeColor`, defaults to null `SchemeColor?`.
+
+ When `useMaterial3` is `false`, the `elevatedButtonTheme.baseSchemeColor` is used as background
+ color as before, and the new property `elevatedButtonTheme.onBaseSchemeColor` is used as
+ foreground color. However, when `useMaterial3` is `true`, their foreground and background
+ color roles are reversed, and `baseSchemeColor` becomes its foreground color and the
+ `onBaseSchemeColor` its background color.
+
+* Added `elevatedButtonSecondarySchemeColor` property of type `SchemeColor?` to
+ `FlexSubThemesData`. Use it to control secondary color of the `ElevatedButton` in its
+ 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 a completely different default elevated button styles.
+ 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.
+ * `outlineSchemeColor`, defaults to null `SchemeColor?`.
+ When `useMaterial3` is `false`, the `outlineSchemeColor` defaults to `baseSchemeColor`.
+ When `useMaterial3` is `true`, the `outlineSchemeColor` defaults to `SchemeColor.outline`.
+
+**STYLE CHANGE - BREAKING**
+
+* `FlexSubThemesData.fabUseShape` opinionated component theme style default was changed from `true`
+ to `false`. This is a breaking style with previous versions. The opinionated style change was done
+ to use a style that by default matches M3 style when `ThemeData.useMaterial3` is `true`.
+ The new default style is also a way to work around issue
+ [#107946](https://github.com/flutter/flutter/issues/107946), where it is shown that you cannot
+ create a theme that replicates the default roundings in M3 of the FAB.
+ **Style migration**: If you had kept `FlexSubThemesData.fabUseShape` unspecified and relayed on
+ default value in a previous version, you must set it to `true` to get the same result as before.
+ These breaking style changes in the opinionated opt in component sub-themes are unfortunate,
+ but required as FlexColorScheme continues to evolve with Flutter SDK to support Material 3
+ theming, while offering its own opinionated tweaks on some M3 default styles.
+
+* The M3 color utilities package *material_color_utilities* from the Material team, that Flutter SDK
+ 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 `_Scheme.fromSeeds`. The new algorithm changes for example
+ all the default M3 error colors slightly. The changes in the color values are minor, and not
+ visually noticeable to the eye. Values are slightly different, and this release uses the new
+ value for FCS M3 error colors. Tests were also updated to use the new values. The change did break
+ FCS color value tests, and should be per its own policy be considered a major breaking change.
+ However, since the Material 3 design and *material_color_utilities* calls this change minor,
+ then so does FCS.
+
+**STYLE CHANGE - MINOR**
+
+* The `FlexAppBarStyle` property was made nullable. It now defaults to null in all constructors.
+ When it is null and `useMaterial3` is false, the app bar will use style `FlexAppBarStyle.primary`
+ in light mode as default, like before and `FlexAppBarStyle.material` in dark mode. However, if
+ `useMaterial3` is true, then it will use `FlexAppBarStyle.surface` in both light and dark mode,
+ to match the un-themed defaults of Material 3 design `AppBar`.
+
+* Updated `ElevatedButton` to support `useMaterial3` defaults concerning its switched foreground and
+ background color roles. It now also uses stadium border instead of 20dp, M3 size, padding and
+ elevation defaults, when `useMaterial3` is opted in on.
+
+* Updated `OutlinedButton` to support `useMaterial3` defaults concerning its outline color default.
+ It now also uses stadium border instead of 20dp, M3 size and padding, when `useMaterial3` is
+ opted in on.
+
+* Changed opinionated dialog sub-theme defaults to match M3 defaults. Elevation set to 6, was
+ 10 and actionsPadding defaults to `EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0)`, it
+ 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
+ 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)`.
+ This feature will only work with intended design in stable channel after feature and PR
+ ["Migrate Chips to Material 3"](https://github.com/flutter/flutter/pull/107166) lands in stable
+ channel. Currently, it is only available in Flutter *master 3.1.0-x*.
+
+* Updated `InputDecoration` default sub-theme when opting in on `useMaterial3`. When `true` it
+ now results in more upcoming M3 styled `TextField` style, instead of its own totally opinionated
+ custom style also when the opinionated component sub-themes are enabled. It still uses a touch
+ of its own style. To get the same opinionated coloring as before, but on the M3 styled
+ 'TextField' when using M3, set component sub-themes data
+ `subThemesData: const FlexSubThemesData(cinputDecoratorSchemeColor: SchemeColor.primary)`.
+ This feature will only work with intended design in stable channel after feature and PR
+ ["Migrate TextField to Material 3"](https://github.com/flutter/flutter/pull/108366) lands in
+ stable channel. Currently, it is only available in Flutter *master 3.1.0-x*.
+ The M3 alignment of FCS `InputDecoration` still needs more work, like:
+ - Move towards same error container color idea for FCS default, like M3 uses
+ - Option to use FCS component defaults on fill colors and disabled color when opting in on M3.
+
+**CHANGE**
+
+* To support deprecation of `toggleableActiveColor` when PR
+ [Deprecate toggleableActiveColor #97972](https://github.com/flutter/flutter/pull/97972) lands,
+ while retaining the previous FCS defaults for `Switch`, `CheckBox` and `Radio` widgets, when
+ not opting in on component sub-themes. The created `SwitchThemeData`, `CheckboxThemeData` and
+ `CheckboxThemeData` can no longer be null, when not opting in on sub-themes like before.
+ To support the previous nicely theme colored
+ toggles in light and dark themes, that were set by defining the right scheme color for
+ `toggleableActiveColor` in M2 and M3 theme modes, sub-themes for them that replicates the color
+ styles must now be created also when not opting in on sub-themes. This update includes the
+ necessary change to do so. This will be reflected in updates to the core defaults documentation.
+ For a migration guide concerning `toggleableActiveColor` see
+ https://flutter.dev/docs/release/breaking-changes/toggleable-active-color#migration-guide
+
+
+**EXAMPLES**
+
+* *Themes Playground:* Updated the default AppBar style, it uses a dropdown menu that can also select
+ 'null' choice and use default M2 and M3 theming as defaults via it. The AppBar panel now also
+ displays an AppBar Widget of its own, so one does not have to look at the actual AppBar to
+ see the style. It also has widgets below it used to demonstrate the opacity setting.
+
+* *Themes Playground:* Code gen and control enable/disable for onColor blends updated to lock controls
+ with no impact when using seeded color scheme. Code is also not generated for onColor blend
+ settings that has no impact when using seeded color schemes.
+
+* *Themes Playground*: Features and code gen for additional `Elevated.button` individual foreground
+ and background colors.
+
+* *Themes Playground*: Features and code gen for additional `Outlined.button` separate outline
+ color.
+
+* *Themes Playground*: To the component panel added support to customize outline border
+ thickness for `OutlinedButton`, `ToggleButtons` and `TextField`'s `InputDecorator`.
+
+* *Themes Playground*: Features and UI for new Flutter SDK `ColorScheme` colors `outlineVariant`
+ and `scrim`.
+
+**DOCS**
+
+* Removed duplicated section of 5.1.0 changelog entry with date July 5, 2022.
+
+* Harmonized the changelog style and its past history. The new style and how it looks will be tested
+ with a dev release to ensure it works well on pub.
+
+**KNOWN FLUTTER SDK ISSUES**
+
+The issues below in the Flutter SDK itself, are known to impact FlexColorScheme and Flutter
+theming in general.
+
+* The M3 Chip themes available in Flutter `master 3.1.0-*` at the time of writing, do as noted here
+ [PR 107166 comment](https://github.com/flutter/flutter/pull/107166#issuecomment-1189206217),
+ not yet M3 theme plain vanilla `Chip` when using Material 3. This might be fixed in an
+ additional PR later in the SDK.
+
+* [**#107946**](https://github.com/flutter/flutter/issues/107946) Cannot theme Shape and IconSize
+ differently for different sized FloatingActionButtons. One of the drivers behind the breaking
+ FAB defaults for the opinionated FAB theme was this issue.
+
+* [**#108539**](https://github.com/flutter/flutter/issues/108539) Cannot theme shape independently
+ for `SnackBar` with different `behavior`. This is the reason why FCS does not offer a custom shape
+ in its opinionated `SnackBar` theme.
+
+The Flutter SDK M3 `useMaterial3` flag set to `true` continues to have a number of challenges in
+addition to the above ones. We as before still have these issues in Flutter *stable 3.0.5* and
+also at least in Flutter *master 3.1.0-0.0.pre.2033* and earlier:
+
+* [**#107190**](https://github.com/flutter/flutter/issues/107190) Elevation issue with `Material`
+ widget, when opting in on `useMaterial3` causes widespread elevation issues.
+
+* [**#103864**](https://github.com/flutter/flutter/issues/103864) Dynamically changing `Typography`
+ in `ThemeData` generates an error
+
+* [**FIXED #107305**](https://github.com/flutter/flutter/issues/107305) Regression: `AppBarTheme`
+ properties `iconTheme` and `actionsIconTheme` ignored on master channel when `useMaterial3`
+ is true. This is not in stable Flutter channel *stable 3.0.5*, but if you use
+ master channel it is something to be aware of, as it exists in Flutter
+ *master 3.1.0-0.0.pre.2033* and many earlier *master 3.1.0-x* versions. This issue was fixed via
+ [PR #108332](https://github.com/flutter/flutter/pull/108332) and can no longer be observed in
+ *master, 3.1.0-0.0.pre.2108* or later versions.
+
+## 5.1.0
+
+**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*.
**NEW**
-* **Added** full support for in Flutter 3.0.0 new `ColorScheme.surfaceTint` color. It is set to
+* **Added** full support for in *Flutter 3.0.0* new `ColorScheme.surfaceTint` color. It is set to
`ColorScheme.primary` color by default, as Flutter and Material 3 does. If a custom `surfaceTint`
color is provided, it is also used as the blend color, instead of `primary` color, for
FlexColorScheme's surface blend feature.
-* **Added** API for using Flutter 3.0.0 theme extensions directly via FlexColorScheme
+* **Added** API for using *Flutter 3.0.0* theme extensions directly via FlexColorScheme
API. It was added as a convenience feature in order to avoid having to add theme extensions with a
`copyWith` on FlexColorScheme produced ThemeData. With the `FlexColorScheme.extensions` and
`FlexThemeData.extensions` properties you can add custom theme extensions directly.
@@ -42,7 +258,7 @@ All notable changes to the **FlexColorScheme** (FCS) package are documented here
* **Deprecated:** `FlexSubThemes.buttonTheme` that creates an opinionated `ButtonThemeData`.
The ButtonThemeData is marked as obsolete in Flutter SDK, but not yet deprecated in
- Flutter version 3.0.0. FlexColorscheme now marks it as **deprecated**. It will be
+ *Flutter 3.0.0*. FlexColorscheme now marks it as **deprecated**. It will be
removed in a future FlexColorScheme release when Flutter SDK deprecates `ButtonThemeData`.
**M3 STYLE FIXES AND CHANGES**
@@ -52,7 +268,7 @@ All notable changes to the **FlexColorScheme** (FCS) package are documented here
otherwise `theme.colorScheme.secondary` is used.
* **Input Decorator default change**: The `TextField` and its `InputDecorator` border radius
- default value was changed from 20dp to 16 dp when using opinionated component themes.
+ default value was changed from 20dp to 16dp when using opinionated component themes.
If opting in on Material 3, the default value for M3 design is used, which is only 4 dp.
See specification https://m3.material.io/components/text-fields/specs.
Flutter 3.0.x does not yet implement the new M3 TextField style, but via this change when
@@ -82,7 +298,7 @@ All notable changes to the **FlexColorScheme** (FCS) package are documented here
* **Toggleable M3 style change:** Default color of toggles (Switch, CheckBox and Radio) are now
using `primary` color as default themed color when opting in on opinionated component themes or
- setting `ThemeData.useMaterail3` to true. The Switch, CheckBox and Radio themes then use a style
+ setting `ThemeData.useMaterial3` to true. The Switch, CheckBox and Radio themes then use a style
that match the M3 color design intent. In it,
switches and toggles are mostly primary color based. In M3 color design, the secondary color is a
poor choice for switches and toggles, and it is therefore not used as their default color. It
@@ -94,29 +310,29 @@ All notable changes to the **FlexColorScheme** (FCS) package are documented here
might run into this lint being triggered by older Stateful Widgets. The lint warning was
addressed in the package and examples.
-**EXAMPLE UPDATES**
+**EXAMPLES**
-* Added a **Theme Extensions** example to the default example app, i.e. the "Hot Reload Playground".
+* 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
+* *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.
-* Themes Playground: Updated the default style info labels for the NavigationBar. The logic to display
+* *Themes Playground:* Updated the default style info labels for the NavigationBar. The logic to display
default color labels in different config modes (M2/M3/FCS/FCS+M2/FCS+M3) is quite involved, please
report any issues.
-* Themes Playground: Updated the default style info labels for the NavigationRail. The logic to display
+* *Themes Playground:* Updated the default style info labels for the NavigationRail. The logic to display
default color labels in different config modes (M2/M3/FCS/FCS+M2/FCS+M3) is quite involved, please
report any issues.
-* Themes Playground: Due to issue [#107190](https://github.com/flutter/flutter/issues/107190), the
+* *Themes Playground:* Due to issue [#107190](https://github.com/flutter/flutter/issues/107190), the
Playground previous default to use Material 3 was changed to false.
-* Added support in Themes Playground to customize the `surfaceTint` color. It controls both the
+* *Themes Playground:* Added support to customize the `surfaceTint` color. It controls both the
elevation color used for elevated `Material` surfaces in M3. Plus for FlexColorScheme it is also
used as the surface blend color. By default, the `surfaceTint` color equals `ColorScheme.primary`
color. Generally there are not many good design reasons to change the color, but it is now
@@ -129,11 +345,11 @@ All notable changes to the **FlexColorScheme** (FCS) package are documented here
The issues below in the Flutter SDK itself, are known to impact FlexColorScheme and Flutter
theming in general.
-* Switching Typography dynamically in Flutter SDK ThemeData is broken, see
+* Switching `Typography` dynamically in Flutter SDK ThemeData is broken, see
issue [#103864](https://github.com/flutter/flutter/issues/103864) for more information.
- If it is done and the error ignored, an app doing so eventually become unstable.
+ If it is done and the error ignored, an app doing so eventually becomes unstable.
-* The Themes Playground app contains a workaround to
+* The *Themes Playground* app contains a workaround to
avoid issue [#103864](https://github.com/flutter/flutter/issues/103864). The workaround
is done by always using 2021 Typography, but simulating 2018 Typography. This is done by using
a custom TextTheme that looks like 2018 Typography is used when using M2 theme mode. The
@@ -142,8 +358,8 @@ theming in general.
like 2018 Typography is used. All other examples also avoid the issue by only using the
M3 2021 Typography and not even mimicking a switch between M2 and M3 Typography.
- The above workaround is needed because the Playground app has toggles that switches Typography
- frequently, without the workaround it will eventually crash. With this workaround it never
+ The above workaround is needed because the *Themes Playground* app has toggles that switches
+ `Typography` frequently, without the workaround it will eventually crash. With this workaround it never
switches Typography, it just looks like it does, but app stays in 2021 Typography all the time.
The by Themes Playground generated ThemeData config will use the actual real effective
Typography. This is also fine, since an app using the theme will likely never switch used
@@ -151,8 +367,8 @@ theming in general.
is a Flutter SDK issue that FlexColorScheme cannot fix. Most likely 99% of apps will never run
into this issue.
-* In Flutter SDK 3.0.x, when opting in on `useMaterial3:true`, the `Material` widget and other SDK
- widgets built on it, gets no elevation when only the `elevation` property is defined. It is
+* In Flutter *stable 3.0.x*, when opting in on `useMaterial3:true`, the `Material` widget and other
+ SDK widgets built on it, gets no elevation when only the `elevation` property is defined. It is
required to also define `shadowColor` and/or `surfaceTintColor` to get any elevation effect.
When using the `Material` widget itself this is easy to address. However, widgets like
`Drawer`, `PopupMenuButton`, `BottomNavigationBar`, `NavigationRail`, `Dialog`, `AlertDialog`,
@@ -164,134 +380,17 @@ theming in general.
[#54](https://github.com/rydmike/flex_color_scheme/issues/54). There are no good workarounds
for using elevation on these widgets when `useMaterial3` is true. The options are to not use
M3, if such elevations are important to your app design. One working fix is to wrap those widgets
- in a theme where `useMaterial3` is false, then te rest of your app can still use it. This is
- however a rather tedious workaround fix. Due to current SDK `Material` elevation issues when
+ in a theme where `useMaterial3` is false, then the rest of your app can still use it. This is
+ however a rather tedious workaround. Due to current Flutter SDK `Material` elevation issues when
`useMaterial3` is true, it is recommended to not use it yet.
* This regression in master channel impacts AppBar icon colors when using Material 3
[#107305](https://github.com/flutter/flutter/issues/107305). It has not yet landed in stable
- channel Flutter 3.0.4, but if you use master channel it is something to be aware of.
-
-## v5.1.0 - July 5, 2022
-
-* Updated to support Flutter 3.0.0, Dart 2.17 and latest Flutter package dependencies in
- example apps. Requires at least Flutter 3.0.0 and Dart 2.17.0
-
-**NEW**
-
-* **Added** full support for in Flutter 3.0.0 new `ColorScheme.surfaceTint` color. It is set to
- primary color by default, as Flutter and Material 3 does. If a custom `surfaceTint` color is
- provided, it is also used as the blend color, instead of `primary` color for surface blend.
-
-* **Added** pass through API for using Flutter 3.0.0 theme extensions directly via FlexColorScheme
- API. It was added to avoid having to add theme extensions with a CopyWith on FlexColorScheme
- produced ThemeData. With the `FlexColorScheme.extensions` and `FlexThemeData.extensions`
- properties you can add custom theme extensions directly via them as well.
-
-
-**DEPRECATED**
-
-* **Deprecated:** `FlexColorScheme.m3TextTheme`. The custom M3 text theme is no longer needed after
- Flutter 3.0.0 release, that includes the new M3 Typography in addition to its earlier released
- `TextTheme`. You can opt in on using the new M3 style TextTheme as before by setting
- `FlexColorScheme.subThemesData.useTextTheme` to true **or** by setting
- `FlexColorScheme.useMaterial3` to true. Using either does however come with this known issue:
- [#103864](https://github.com/flutter/flutter/issues/103864), where dynamically switching
- Typography, e.g. from 2014 or 2018, to M3 2021 Typography, triggers the mentioned assert in issue
- [#103864](https://github.com/flutter/flutter/issues/103864). This issue has always existed in
- Flutter SDK ThemeData when dynamically changing between different Typography.
- FlexColorScheme avoided triggering it before by only using Typography 2018, also when opting in
- on M3 TextTheme, that before used 2018 based Typography to make a custom M3 TextTheme.
- Avoiding this issue is no longer possible when opting in on M3 that now correctly uses its own
- and different Typography from M2, but exposes this issue if you dynamically change ThemeData from
- one to another Typography.
- To avoid this Flutter SDK issue, use the same Typography for all your themes in your app and don't
- dynamically switch theme between ThemeData objects that uses different Typography in your
- application. The use cases for doing this are also very few.
-
-* **Deprecated:** `FlexSubThemes.buttonTheme` that creates an opinionated `ButtonThemeData`.
- The ButtonThemeData is marked as obsolete in Flutter SDK, but not yet deprecated in
- Flutter version 3.0.0. FlexColorscheme now marks it as **deprecated**. It will be
- removed in a future FlexColorScheme release when Flutter SDK deprecates `ButtonThemeData`.
-
-**M3 FIXES**
-
-* **M3 Style fix**: For Floating Action Button background color, when opting in on
- `ThemeData.useMaterail3` the M3 color `theme.colorScheme.primaryContainer` is used,
- otherwise `theme.colorScheme.secondary` is used.
-
-* **NavigationBar M3 defaults fix**: Default colors of `NavigationBar` when opting in on
- `useMaterial3` and
- not using opinionated component themes, theme will match M3 default colors. The background color
- will follow M3 style also as default opinionated component theme when `useMaterial3` is true, as
- this style is difficult to replicate with a single color otherwise. The difference is subtle for
- FCS surface tinted background color. You can still set it to `background` color to replicate past
- FCS default color when sub-themes were enabled. If opinionated component themes are not used, FCS
- will use default M3 theme styles on `NavigationBar` when `useMaterial3` is true. If opting in
- on opinionated component themes, FCS uses its own custom opinionated default style. It can be
- modified to be the same as default M3 style too, as before. The fix includes a default font
- size change for FCS opinionated styled navigation bar from 11dp to 12dp to harmonize it with
- its M3 style.
-
-* **NavigationRail M3 defaults fix**: Default colors of `NavigationRail` when opting in on
- `useMaterial3` and not using opinionated component themes, theme will match M3 default colors.
- If opinionated component themes are not used, FCS will use default M3 theme styles on
- `NavigationRail` when `useMaterial3` is true. If opting in
- on opinionated component themes, FCS uses its own custom opinionated default style. It can be
- modified to be the same as default M3 style too, just as before. The fix includes a default font
- size change for FCS opinionated styled rail from 14dp to 12dp to harmonize it with its M3 style.
-
-* **Toggleable M3 Style fix:** Default color of toggles (Switch, CheckBox and Radio) are now using
- `primary` color as default themed color when opting in on opinionated component themes or setting
- `ThemeData.useMaterail3` to true.
- The Switch, CheckBox and Radio themes then use a style that match the M3 color design. In it
- switches and toggles are mostly primary color based. In M3 color design, the secondary color is a
- poor choice for switches and toggles, and it is therefore not used as default color, as it
- does not look nice with M3 based ColorSchemes, created e.g. using M3 color seeding. If you use a
- custom M3 color design where secondary color is still prominent, you can of course still use it.
-
-* **Fixed lint:** "Avoid using private types in public APIs". See tweet
- [discussion](https://twitter.com/RydMike/status/1533788260320923649) about why and when you
- might run into this lint being triggered by older Stateful Widgets. The lint warning was
- addressed in the package and examples.
-
-**EXAMPLES**
-
-* Added a Theme Extensions usage demo to the default example, i.e. the "Hot Reload Playground".
-
-* Themes Playground: Updated style defaults labels for Switches, CheckBoc and Radio.
-
-* Themes Playground: To the top row color theme selector and enable FlexColorScheme and sub-themes
- switches, added the "Use Material 3" toggle. Previously this toggle was only available on the
- introduction page/panel.
+ channel Flutter *stable 3.0.5*, but if you use master channel it is something to be aware of.
-* Themes Playground: Updated style default labels for the NavigationBar. The logic to display
- default colors in different config modes (M2/M3/FCS/FCS+M2/FCS+M3) is quite involved, please
- report any issues.
-
-* Themes Playground: Updated style default labels for the NavigationRail. The logic to display
- default colors in different config modes (M2/M3/FCS/FCS+M2/FCS+M3) is quite involved, please
- report any issues.
+## 5.0.1
-* Themes Playground: Added a complex workaround to avoid issue
- [#103864](https://github.com/flutter/flutter/issues/103864) in the Playground app. The workaround
- is done by always using 2021 Typography but simulating 2018 Typography in the app when by using
- an EnglishLike 2018 TextTheme, but with the 2021 Typography, to simulate how an app looks
- that uses other than 2021 Typography. The Playground App actually always stays in 2021
- Typography, but looks like it switches it. Switching Typography dynamically in ThemeData is broken
- due to above issue, and if it is done and error ignore the app becomes unstable eventually.
- This workaround is needed because the Playground app has toggles that may switch Typography
- frequently, and it will eventually crash. With this workaround it never switches Typography, it
- just looks like it does, but app stays in 2021 Typography all the time. The output code that
- creates the configured THemeData uses the actual configured effective Typography mode. This is
- fine, since that app will likely never switch used Typography. If it does, it will of course face
- the same issue the Playground app did, but the issue is a Flutter SDK issue that FlexColorScheme
- cannot fix. Most likely 99% of apps will never run into this issue.
-
-* Added support in Themes Playground to customize `surfaceTint` color, and also use it as custom
- color for surface blends.
-
-## v5.0.1 - April 29, 2022
+**April 29, 2022**
**FIX**
@@ -302,15 +401,17 @@ theming in general.
* Themes Playground: Make prettier default constructor for FlexSubThemesData() if that is
all that was defined in Themes Playground config.
-## v5.0.0 - April 21, 2022
+## 5.0.0
+
+**April 21, 2022**
+
+### Overview
The full journey from version 4.2.0 to stable 5.0.0 includes the steps in
change logs for development versions 5.0.0-dev.3, -dev.2 and -dev.1.
Please refer to them for all details. This changelog contains a summary of
breaking and other critical changes from version 4.2.0.
-### Overview
-
FlexColorScheme version 5 is style wise a big breaking change since all the
built-in produced `ColorScheme`s the themes use have been revised to follow
the new Flutter 2.10.0 Material 3 based `ColorScheme`. The color changes to
@@ -329,13 +430,11 @@ if you have used any of them directly, they still work. The old built-in
variant color values will remain available at least until version 6.0,
maybe even 7.0 if so requested by users.
-**Breaking**
-
-* Requires at least Flutter 2.10.0.
- * Version 5.0.0 requires at least Flutter version 2.10.0 to work. This breaking
- change is required since the new color properties in `ColorScheme` do not exist
- in any stable version of Flutter before version 2.10.
+**BREAKING**
+* Version 5.0.0 requires at least Flutter version 2.10.0 to work. This breaking
+ change is required since the new color properties in `ColorScheme` do not exist
+ in any stable version of Flutter before version 2.10.
* `surfaceStyle` removed.
* In version 5.0.0, the in version 4.2.0 deprecated property `surfaceStyle`, including all
@@ -388,7 +487,7 @@ theme: FlexThemeData.light(
and null when not using it.
-**Breaking** and deprecated due to Flutter SDK change in 2.10.0 stable release.
+**DEPRECATED AND BREAKING** due to Flutter SDK change in 2.10.0 stable release.
* `primaryVariant` and `secondaryVariant`
* The colors `primaryVariant` and `secondaryVariant` in FlexColorScheme are
@@ -427,7 +526,14 @@ theme: FlexThemeData.light(
eventually when the Flutter SDK `ColorScheme` colors `primaryVariant` and `secondaryVariant`
are removed after a year or so.
-**Change** and breaking past style.
+* `SchemeColor` values and order, potentially breaking.
+ The enum `SchemeColor` has new values and past values are in a new order.
+ The order was changed to accommodate all the new color values, and to keep them in
+ the same order as their corresponding color properties in Flutter Material 3
+ `ColorScheme` color values. The change of order is potentially breaking,
+ but highly unlikely to break anything in major ways in normal usage.
+
+**STYLE CHANGE - BREAKING**
* The custom "internal" and temporary `m3TextTheme` was changed.
It is **style breaking** with 4.2.0 and 5.0.0-dev.1 & 2.
@@ -460,18 +566,11 @@ theme: FlexThemeData.light(
of the new Material 3 ColorScheme, the opportunity to improve this color value used in the
built-in theme `espresso` theme was used.
-**Beware**
-
-* `SchemeColor` values and order, potentially breaking.
- The enum `SchemeColor` has new values and past values are in a new order.
- The order was changed to accommodate all the new color values, and to keep them in
- the same order as their corresponding color properties in Flutter Material 3
- `ColorScheme` color values. The change of order is potentially breaking,
- but highly unlikely to break anything in major ways in normal usage.
+## 5.0.0-dev.3
-## v5.0.0-dev.3 - April 20, 2022
+**April 20, 2022**
-**CHANGE** - Breaking past style
+**STYLE CHANGE - BREAKING**
* The custom "internal" and temporary `m3TextTheme` was changed.
It is **style breaking** with 4.2.0 and 5.0.0-dev.1 & 2.
@@ -515,7 +614,9 @@ theme: FlexThemeData.light(
* The examples contain minor improvements and fixes.
-## v5.0.0-dev.2 - April 4, 2022
+## 5.0.0-dev.2
+
+**April 4, 2022**
**BREAKING**
@@ -654,9 +755,9 @@ theme: FlexThemeData.light(
to `FlexSubThemesData`, to expose their already existing properties in
corresponding sub-themes used by `FlexColorScheme`.
-**DEMO APPS**
+**EXAMPLES**
-* **Themes Playground** improvements:
+* *Themes Playground:*
- Added a new single panel "Page" view. The previous large masonry grid view
is still available. Both views can be used and switch to based on what
is appropriate when using different media sizes.
@@ -690,7 +791,11 @@ theme: FlexThemeData.light(
* Finalized test updates. Now 1684 tests, coverage about 99.8%.
-## v5.0.0-dev.1 - March 14, 2022
+## 5.0.0-dev.1
+
+**March 14, 2022**
+
+### Overview
Version 5 is a big refactor with deprecation of previous `variant` based
color names in favor of `container` ones that were added to updated M3
@@ -1050,8 +1155,6 @@ should be relatively easy, despite the long list of changes and new features.
and genoa greens.
Use enum value `FlexScheme.dellGenoa` for easy access to it.
-
-
**CHANGE**
* Added all the new `ColorScheme` M3 color properties to `SchemeColor`
@@ -1128,10 +1231,10 @@ should be relatively easy, despite the long list of changes and new features.
The Colors `primaryVariant` and `secondaryVariant` were removed from it
since the colors are deprecated in Flutter SDK. The change was from:
- | Before | Before |
- |-------------------|-----------------|
- | Primary | Primary variant |
- | Secondary | Secondary variant |
+ | Before | Before |
+ |------------------|-------------------|
+ | Primary | Primary variant |
+ | Secondary | Secondary variant |
to:
@@ -1141,8 +1244,7 @@ should be relatively easy, despite the long list of changes and new features.
| Primary container | Tertiary |
-
-**FIXED**
+**FIX**
* When using `FlexSubThemesData.inputDecoratorSchemeColor` the floating label
did not change to the selected ColorScheme based `SchemeColor`. Now it does,
@@ -1174,17 +1276,19 @@ should be relatively easy, despite the long list of changes and new features.
also a temporary workaround implemented, it attempts to keep system icons from
getting the wrong brightness on Android 11. It may not always work.
-**EXAMPLES and Themes Playground**
-* Update examples 1...4
+**EXAMPLES**
+
+* Updates to examples 1...4
- Add a few of the new features to examples 3 and 4.
- Removed showing the old, already in Flutter v1.26 deprecated
buttons `RaisedButton`, `OutlineButton` and `FlatButton` in ALL the examples.
They are going away in next stable release of Flutter after 2.10.x, as
per this notice [#98537](https://github.com/flutter/flutter/issues/98537).
-* Update default example app, the **Hot Reload Playground**.
-* Major update for "example 5" the **Themes Playground**
- to include support for all the new features. Updates listed below:
+* Update default example app *Hot Reload Playground*.
+
+* Major update to example 5 *Themes Playground*, it now
+ includes support for all the new features:
- Added config for unselected toggleable style.
- Added feature to export the code for the active `ColorScheme`.
@@ -1219,7 +1323,8 @@ should be relatively easy, despite the long list of changes and new features.
the app.
- Added NavigationRail Settings panel, with similar settings and NavigationBar.
-**TESTS TODO**
+**TESTS**
+
* Tests are still incomplete and currently down to about 86% coverage,
but at least all existing (1275) ones are passing and behave as expected.
* Add tests for new `SchemeColor` properties.
@@ -1238,24 +1343,31 @@ should be relatively easy, despite the long list of changes and new features.
Curious about what is planned next for FlexColorScheme? Head over
to the TODO section at the end of this page and read more
-[here](#planned-updates-and-new-features).
+[here](#future-features).
-## v4.2.0 - January 24, 2022
+## 4.2.0
-* **New:** Updated required Dart SDK to minimum 2.15 that Flutter 2.8.0 uses.
- To use this release at least Flutter 2.8.0 is required.
-* **New:** Added support for opinionated sub-theme for the new Material 3 based
- `NavigationBar`. Flutter version 2.8.0 is the first stable version that
- includes the new Material 3 design based `NavigationBar`.
-* **Deprecated:** The property `surfaceStyle` has been deprecated. In
+**January 24, 2022**
+
+**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.
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.
+**NEW**
-* **New:** Custom `FlexColorScheme` based themes can now also be defined by
+* Updated required Dart SDK to minimum 2.15 that Flutter 2.8.0 uses.
+ To use this release at least Flutter 2.8.0 is required.
+
+* Added support for opinionated sub-theme for the new Material 3 based
+ `NavigationBar`. Flutter version 2.8.0 is the first stable version that
+ includes the new Material 3 design based `NavigationBar`.
+
+* Custom `FlexColorScheme` based themes can now also be defined by
alternatively passing in a `ColorScheme` object to the `colorScheme`
property in the constructor, as well as in `FlexColorScheme.light` and
`FlexColorScheme.dark` factories. When used it overrides the `scheme` and
@@ -1273,13 +1385,7 @@ to the TODO section at the end of this page and read more
With this feature it will then be able to feed those colors directly into
FlexColorScheme, and use them as colors to create your `ThemeData`.
-
-* **Changed:** All properties in all `FlexColorScheme` constructors are now
- optional. The change is none breaking, and uses Material 2 based
- design guide example theme light and dark as defaults for undefined values.
-
-
-* **New:** Added a `ColorScheme` color selection option to selected opinionated
+* Added a `ColorScheme` color selection option to selected opinionated
sub-themes configuration class `FlexSubThemesData`. The sub-themes that
support changing their `ColorScheme` based
used theme color selection, have one or more properties called
@@ -1343,10 +1449,15 @@ to the TODO section at the end of this page and read more
methods. It does not prevent you from further modifying and tuning the
produced `ThemeData` with standard Flutter SDK features.
+**CHANGE**
+
+* All properties in all `FlexColorScheme` constructors are now
+ optional. The change is none breaking, and uses Material 2 based
+ design guide example theme light and dark as defaults for undefined values.
-* **Removed:** The `uses-material-design: true` line from library
+* Removed the `uses-material-design: true` line from library
`pubspec.yaml` file was removed. It is not needed since Material icon
- features are not used by this package.
+ features are not used by this package.
* **Example 5 - Themes Playground**
@@ -1391,13 +1502,21 @@ to the TODO section at the end of this page and read more
* **Tests:** Added tests to cover the new features, now total 1123 tests.
-## v4.1.1 - November 20, 2021
+## 4.1.1
+
+**November 20, 2021**
+
+**FIX DOCS**
+
+* Fixed a broken link in the readme that pub.dev analyzer found.
-* **Documentation:** Fixed a broken link in the readme that pub.dev analyzer found.
+## 4.1.0
-## v4.1.0 - November 20, 2021
+**November 20, 2021**
-* **Fix:** The `defaultRadius` in `FlexSubThemesData` now defaults to null
+**FIX**
+
+* The `defaultRadius` in `FlexSubThemesData` now defaults to null
so all sub-themes border radius will default to M3 default border
radius per widget. The const default value it had, was a remnant from early
dev phase when widgets all defaulted to single shared radius and not M3
@@ -1405,8 +1524,33 @@ to the TODO section at the end of this page and read more
previous version get the M3 defaults. Older tests did that, now they expect
same result when no value is assigned, as it should have been.
+**CHANGE**
-* **Examples:** Updated and tuned the examples. Example 5 "Themes Playground"
+Opt in opinionated sub themes minor style changes:
+
+* Added missing themed background color for `SnackBarThemeData` when
+ using opt in opinionated sub themes.
+
+* Tuned the colored text theme on the sub themes that is applied when
+ using the optional colored text themes. The text styles now better match
+ 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
+ opacity on `caption` text style. The opacity on it is lower though, to
+ retain a bit more contrast on blended surfaces, while still adhering to
+ the style intent.
+ >Minor details on the opinionated sub themes may still be tuned and
+ changed slightly as a part of improving them and their appeal. For the
+ text theme coloring future version may expose parameter(s) that can be
+ used to adjust the color tint effect on text theme when colored
+ text theme is enabled.
+
+* Major updates to readme doc, and typo corrections.
+
+**EXAMPLES**
+
+* Updated and tuned the examples. Example 5 *Themes Playground*
now includes capability to define custom color schemes starting from built-in ones.
It can also generate the FlexColorScheme setup code needed for any defined
viewed theme setup. You can copy/paste a theme's Flutter Dart code,
@@ -1414,51 +1558,36 @@ to the TODO section at the end of this page and read more
quick and convenient way to try a theme you made and see in the Themes
Playground in your own app.
+**TESTS**
+
+* Modified tests to catch the fixed `defaultRadius` issue.
+* Added more tests, now total 1069 tests.
-* **Opt in opinionated sub themes minor style changes:**
- * Added missing themed background color for `SnackBarThemeData` when
- using opt in opinionated sub themes.
- * Tuned the colored text theme on the sub themes that is applied when
- using the optional colored text themes. The text styles now better match
- 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
- opacity on `caption` text style. The opacity on it is lower though, to
- retain a bit more contrast on blended surfaces, while still adhering to
- the style intent.
- >Minor details on the opinionated sub themes may still be tuned and
- changed slightly as a part of improving them and their appeal. For the
- text theme coloring future version may expose parameter(s) that can be
- used to adjust the color tint effect on text theme when colored
- text theme is enabled.
-
-
-* Major updates to readme doc, and typo corrections.
-
+## 4.0.0
-* **Tests:**
- * Modified tests to catch the fixed `defaultRadius` issue.
- * Added more tests, now total 1069 tests.
+**November 13, 2021**
-## v4.0.0 - November 13, 2021
+### Overview
-* 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.
+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.
+**BREAKING**
-* **Breaking:** In dark mode, the `darkIsTrueBlack` now makes `surface` color
+* In dark mode, the `darkIsTrueBlack` now makes `surface` color
8% darker instead of 6%. This change was needed to support overlay color
in dark mode when using `darkIsTrueBlack` when using the new `surfaceMode`
property. For more information see Flutter SDK
issue [90353](https://github.com/flutter/flutter/issues/90353).
-* **Fix/Breaking**: From the color scheme English descriptions the sentence
- end "." was removed from all description strings. If and when you want one,
- you can add it as needed.
+
+* From the color scheme English descriptions the sentence end "." was removed from all
+ description strings. If and when you want one, you can add it as needed.
+
+**NEW**
-* **New:** Added a more flexible and powerful alpha blending feature for
+* Added a more flexible and powerful alpha blending feature for
surface and background colors. The new properties in the `FlexColorScheme`
factories `light` and `dark` are `surfaceMode`, of type enum `FlexSurfaceMode`
and integer `blendLevel`. Consider using them instead of previous
@@ -1466,7 +1595,8 @@ to the TODO section at the end of this page and read more
The surface color blend style `surfaceStyle` is still default, and not yet
deprecated, but may be so in version 5. It is not really needed anymore,
but there was no major reason to break things by removing it either.
-* **New:** Major new feature; easy sub-theming of Flutter SDK UI widgets.
+
+* Major new feature, easy sub-theming of Flutter SDK UI widgets.
* You can opt in on nice looking opinionated widget sub-themes by setting
`FlexColorScheme.useSubThemes` to true, it is false by default.
* The default settings for the sub-theme is inspired by
@@ -1493,7 +1623,8 @@ to the TODO section at the end of this page and read more
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.
-* **New:** Added `FlexThemeData` static extension on `ThemeData`.
+
+* Added `FlexThemeData` static extension on `ThemeData`.
* FlexColorScheme Themes can now also be created with the new syntax
`FlexThemeData.light` and `FlexThemeData.dark`, instead of using
`FlexColorScheme.light().toTheme` and `FlexColorScheme.dark().toTheme`.
@@ -1507,16 +1638,20 @@ to the TODO section at the end of this page and read more
definitions, that you then add with copyWith to your FlexColorScheme based
theme, like `FlexColorScheme().toTheme.copyWith(..."your sub themes and
other ThemeData over-rides here")`.
-* **New:** Added `textTheme` and `primaryTextTheme` properties to
+
+* Added `textTheme` and `primaryTextTheme` properties to
`FlexColorScheme` to enable easy setup of custom `TextThemes`, without the
need to add a custom `TextTheme` via a `copyWith`, plus `merge` with the
default text theme.
-* **New:** Added `FlexColorScheme.dialogBackground` as a background surface
+
+* Added `FlexColorScheme.dialogBackground` as a background surface
color that can be controlled and themed separately.
-* **New:** Added `appBarOpacity` to `FlexColorScheme.light()` and `dark()`.
+
+* Added `appBarOpacity` to `FlexColorScheme.light()` and `dark()`.
With it, you can apply themed opacity to the `AppBar` background color to
the selected `FlexAppBarStyle` it is using.
-* **New:** On the `FlexColorScheme` factories `light` and `dark`, exposed
+
+* On the `FlexColorScheme` factories `light` and `dark`, exposed
the `Color` properties `primary`, `primaryVariant`, `secondary`,
`secondaryVariant`, `appBarBackground`, `dialogBackground` and `error`.
They all default to null, but if provided they can be used as override values
@@ -1525,7 +1660,8 @@ to the TODO section at the end of this page and read more
otherwise via the factories define the colors for these properties. If a value
for one of the new direct color properties is used with the factory, it always
has precedence over other properties that assign or compute colors for it.
-* **New:** Exposed boolean property `applyElevationOverlayColor`. It has the same
+
+* Exposed boolean property `applyElevationOverlayColor`. It has the same
function as the same property in `ThemeData`. It applies a semi-transparent
overlay color on Material surfaces to indicate elevation for dark themes.
In `FlexColorScheme` it defaults to true. In Flutter `ThemeData.from` it
@@ -1535,32 +1671,29 @@ to the TODO section at the end of this page and read more
using strong alpha blends on surfaces in dark mode, to use an elevation
overlay color.
-* **New:** All `FlexSchemeData` objects in `FlexColor` are exposed as static
+* All `FlexSchemeData` objects in `FlexColor` are exposed as static
const objects, making them easy to pick and reuse as const objects
individually in custom color scheme lists, or as input to the `colors`
property. Previously only the individual color value definitions were exposed.
-* **New:** Added convenience extension `.blendAlpha()` on `Color`
+
+* Added convenience extension `.blendAlpha()` on `Color`
in `FlexColorExtensions`.
-* **New:** The `FlexThemeModeSwitch` got a bool property `hasTitle`, if set
- to `false` it removes the title entirely.
-* **New:** The `FlexThemeModeSwitch` got a `buttonOrder` property using enum
+* The `FlexThemeModeSwitch` got a bool property `hasTitle`, if set
+ to `false` it removes the title entirely.
+
+* The `FlexThemeModeSwitch` got a `buttonOrder` property using enum
`FlexThemeModeButtonOrder` that you can use to define the order of its
light, system and dark theme mode buttons, in all possible combinations.
-* **New:** Added edgeToEdge support to
+* Added edgeToEdge support to
`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
- Android setup shenanigans. No added APIs, the API for it already existed
- in previous version of FlexColorScheme, using it did however require
- special Android build configuration setup, this is no longer required.
-
-
-* **Change:** The `FlexColor.schemesList` is now a `const` for improved
- efficiency.
-
+ 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
+ Android setup shenanigans. No added APIs, the API for it already existed
+ in 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.
Total number of color schemes is now 36 matched light and dark pairs.
@@ -1573,48 +1706,68 @@ to the TODO section at the end of this page and read more
Use enum value `FlexScheme.rosewood` for easy access to it.
* **Blumine** - Blumine, easter blue and saffron mango theme.
Use enum value `FlexScheme.blumineBlue` for easy access to it.
+
+**CHANGE**
+
+* The `FlexColor.schemesList` is now a `const` for improved efficiency.
+
+
+**DOCS**
+
+* The new main example is a complete quick start guide that doubles as
+ "developers" hot reload based playground template. It has comments
+ explaining what is going on.
+ If you skip reading the readme docs and tutorial, the example may help
+ to kick-start using FlexColorScheme and all its features. It shows most
+ of the features in last tutorial example 5, but without any interactive UI.
+ You are the UI and can edit prop values and use hot-reload to see changes.
+* All examples now use the new `FlexThemeData` extension syntax to create the
+ `ThemeData` and `surfaceMode` to define the alpha blended surfaces.
+* Examples 2 to 5 also use the in Flutter 2.5 new skeleton architecture, with
+ a ChangeNotifier based controller. AnimatedBuilder to listen to it, and
+ an abstract service to get and persist the theme settings, with a concrete
+ in-memory implementation, plus the implementations to persist the theme.
+ * Examples 2 to 4 use the Hive implementation.
+ * Example 5 uses the SharedPreferences implementation
+
+**TESTS**
+
+* Added tests for the new features, total 1066 tests.
+* Coverage 99%, will improve them more later.
+
+## 4.0.0-dev.1
+**November 13, 2021**
-* **Documentation:**
- * The new main example is a complete quick start guide that doubles as
- "developers" hot reload based playground template. It has comments
- explaining what is going on.
- If you skip reading the readme docs and tutorial, the example may help
- to kick-start using FlexColorScheme and all its features. It shows most
- of the features in last tutorial example 5, but without any interactive UI.
- You are the UI and can edit prop values and use hot-reload to see changes.
- * All examples now use the new `FlexThemeData` extension syntax to create the
- `ThemeData` and `surfaceMode` to define the alpha blended surfaces.
- * Examples 2 to 5 also use the in Flutter 2.5 new skeleton architecture, with
- a ChangeNotifier based controller. AnimatedBuilder to listen to it, and
- an abstract service to get and persist the theme settings, with a concrete
- in-memory implementation, plus the implementations to persist the theme.
- * Examples 2 to 4 use the Hive implementation.
- * Example 5 uses the SharedPreferences implementation
-
-* **Tests:**
- * Added tests for the new features, total 1066 tests.
- * Coverage 99%, will improve them more later.
-
-## v4.0.0-dev.1 - November 13, 2021
-
-* See change log for stable 4.0.0, it was the same for the dev release.
+* See change log for stable 4.0.0, it was the same for this dev release.
the text is just not repeated here anymore.
-## v3.0.1 - July 1, 2021
+## 3.0.1
-* **Fix:** The internal order of swapping primary and secondary colors and reducing
+**July 1, 2021**
+
+**FIX**
+
+* The internal order of swapping primary and secondary colors and reducing
used colors in static function `FlexSchemeColor.effective(FlexSchemeColor colors,
int usedColors, {bool swapColors = false})` matters for the intended result when
used together in the same call. The function now swaps primary and secondary colors,
before reducing the used colors.
-* **Tests:** Added tests for above fix that captures the issue and fails
- in version 3.0.0. Total 741 tests, coverage 99.75%.
+
* Documentation and typo fixes.
-## v3.0.0 - June 25, 2021
+**Tests**
+* Added tests for above fix that captures the issue and fails
+ in version 3.0.0. Total 741 tests, coverage 99.75%.
+
+
+## 3.0.0
-* **Breaking:** The color `accentColor` is being deprecated in Flutter SDK `ThemeData` starting
+**June 25, 2021**
+
+**BREAKING**
+
+* The color `accentColor` is being deprecated in Flutter SDK `ThemeData` starting
from version v2.3.0-0.1.pre. For more info see
[Flutter docs here.](https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties)
@@ -1639,7 +1792,9 @@ to the TODO section at the end of this page and read more
you will need to recreate this style via a text field decoration theme.
-* **New:** The `FlexColorScheme.dark` and `FlexColorScheme.light` factories have a new
+**NEW**
+
+* The `FlexColorScheme.dark` and `FlexColorScheme.light` factories have a new
property called `swapColors`. If true, this will swap `primary` and `primaryVariant`
colors with their secondary counter-parts.
@@ -1657,7 +1812,7 @@ to the TODO section at the end of this page and read more
other way around.
-* **New:** The static function `FlexSchemeColor.effective(FlexSchemeColor colors,
+* The static function `FlexSchemeColor.effective(FlexSchemeColor colors,
int usedColors, {bool swapColors = false})` is used to implement the above
`swapColors` feature. It also exposes the logic behind the FlexColorScheme
dark and light theme `usedColors` property. This static method is helpful if
@@ -1678,9 +1833,12 @@ to the TODO section at the end of this page and read more
* **Outer space stage** - Outer space dark blue-grey and stage red theme.
Use enum value `FlexScheme.outerSpace` for easy access to it.
-* **Tests:** Added tests for the new features and removed test related to
+**TESTS**
+
+* Added tests for the new features and removed test related to
`accentColor`. Total 736 tests, coverage 99.75%.
+**OTHER**
* Inspired by **MaterialYou** at GoogleIO 2021, I recently hooked up **FlexColorScheme**
with a Google Dart library that extracts prominent colors from images. Then fed these
@@ -1693,23 +1851,35 @@ to the TODO section at the end of this page and read more
Android 12 like image color branded themes, by wiring extracted image
colors, to colors in a FlexColorScheme based theme.
-## v2.1.1 - March 30, 2021
+## 2.1.1
+
+**March 30, 2021**
-* **Change:** Made the VoidCallback `onSelect` in `FlexThemeModeOptionButton` nullable.
+**CHANGE**
+
+* Made the VoidCallback `onSelect` in `FlexThemeModeOptionButton` nullable.
The optional callback allows for the button to be used for example as a trailing
widget in a ListTile. Keep it null to not have any callback, nor hover or Ink of its own, and use
the select event of the parent instead. When it is used as standalone button you
normally want to use this callback, but not if you want the parent to handle it, that use case was
not allowed with previous version.
-## v2.1.0 - March 22, 2021
+## 2.1.0
+
+**March 22, 2021**
-* **Fix:** Toggling `FlexColorScheme(transparentStatusBar)` from true to false, did not restore the
+**FIX**
+
+* Toggling `FlexColorScheme(transparentStatusBar)` from true to false, did not restore the
Android default status bar scrim, unless the app was completely rebuilt. This has been fixed.
-* **Fix:** When using `FlexColorScheme.themedSystemNavigationBar(useDivider)` in an `AnnotatedRegion`, toggling
+
+* When using `FlexColorScheme.themedSystemNavigationBar(useDivider)` in an `AnnotatedRegion`, toggling
`useDivider` from true to false, did not remove the system navigation bar divider again, unless the
app was completely rebuilt. This has been fixed, see API docs for more info.
-* **Feature:** The `FlexColorScheme.themedSystemNavigationBar` for styling the system navigation bar got a
+
+**NEW**
+
+* The `FlexColorScheme.themedSystemNavigationBar` for styling the system navigation bar got a
new convenience property `systemNavBarStyle` that takes a `FlexSystemNavBarStyle` enum with values:
* `system` for default white system nav bar in light theme and black in dark theme mode.
* `surface` the system navigation bar will be the same color as active theme `colorScheme.surface` color.
@@ -1725,45 +1895,87 @@ to the TODO section at the end of this page and read more
showing the background, while navigation buttons float over the background. This feature only works if it is
also configured in the Android embedder and on SDK 30 or higher.
More information in this example: https://github.com/rydmike/sysnavbar
-* **Examples:** Added status bar scrim, system navigation bar divider,
+
+**EXAMPLES**
+
+* Added status bar scrim, system navigation bar divider,
and navigation bar style toggles to example 5.
These only work on Android builds and do not have any functionality on the live Web builds.
-* **Tests:** Added tests for the new features. Total 690 tests, coverage 99.75%.
-## v2.0.0 - March 15, 2021
+**TESTS**
+
+* Added tests for the new features. Total 690 tests, coverage 99.75%.
-* **First** stable release of FlexColorScheme with sound null safety.
-* Includes the changes from [2.0.0-nullsafety.1] and [2.0.0-nullsafety.2].
-* **Breaking:** The by default enabled divider for `FlexColorScheme.themedSystemNavigationBar` has been
- revised to be disabled by default. To use a divider on the top of the system navigation bar on Android,
- you have to enabled it manually. This is more in line with expected default behavior.
+## 2.0.0
-## v2.0.0-nullsafety.2 - March 15, 2021
+**March 15, 2021**
-* **Breaking** Minor change to the none default `tooltipsMatchBackground: true` border style, it now uses
+## Overview
+
+First stable release of FlexColorScheme with sound null safety.
+Includes the changes from [2.0.0-nullsafety.1] and [2.0.0-nullsafety.2].
+
+**BREAKING**
+
+* The by default enabled divider for `FlexColorScheme.themedSystemNavigationBar` has been
+ revised to be disabled by default. To use a divider on the top of the system navigation bar on
+ Android, you have to enabled it manually. This is more in line with expected default behavior.
+
+## 2.0.0-nullsafety.2
+
+**March 15, 2021**
+
+**BREAKING**
+
+* Minor change to the none default `tooltipsMatchBackground: true` border style, it now uses
the theme divider color as its default outline color.
-* **Breaking:** As stated earlier in the documentation, as a planned change for version 2.0.0, the sub theme for
+* As stated earlier in the documentation, as a planned change for version 2.0.0, the sub theme for
`FloatingActionButtonThemeData` was removed. It is thus now null, just as in a default Flutter ThemeData.
It still produces the same theme as before, the ThemeData definition was just no longer needed to do so.
-* **Features:** The static helper `FlexColorScheme.themedSystemNavigationBar` received three new properties
+
+**NEW**
+
+* The static helper `FlexColorScheme.themedSystemNavigationBar` received three new properties
`noAppBar`, `invertStatusIcons` and `systemNavigationBarDividerColor`. The old property
`nullContextBackground` was deprecated and replaced with `systemNavigationBarColor`. Example 5
has been updated to show how and when these new features can be used.
-* **Migrated** AppBar theming to use the implementation introduced in Flutter 2.0.0 instead of using
+
+**CHANGE**
+* AppBar theming to use the implementation introduced in Flutter 2.0.0 instead of using
its own custom implementation for the "white" app bar theme.
-* **Tests:** Number of tests increased from 639 to 661. Coverage 99.78%.
-* **Documentation:** Added thumbnails to **Appendix A**. This pub.dev version is also to test the
+
+**TESTS**
+
+* Number of tests increased from 639 to 661. Coverage 99.78%.
+
+**DOCS**
+
+* Added thumbnails to **Appendix A**. This pub.dev version is also to test the
thumbnails work and how they look on pub.dev before stable 2.0.0 release.
-## v2.0.0-nullsafety.1 - February 4, 2021
+## 2.0.0-nullsafety.1
+
+**February 4, 2021**
-* **First** version with null-safety.
-* **Breaking:** Removed the in version 1.3.0 deprecated `FlexSchemeSurfaceColors.themeSurface`, use
+### Overview
+
+First dev version with null-safety.
+
+**BREAKING**
+
+* Removed the in version 1.3.0 deprecated `FlexSchemeSurfaceColors.themeSurface`, use
`FlexSchemeSurfaceColors.surfaceStyle` instead.
-* **Tests:** Number of tests were reduced from 723 to 639, when all null related tests were removed.
-## v1.4.1 - January 31, 2021
+**TESTS**
+
+* Number of tests were reduced from 723 to 639, when all null related tests were removed.
+
+## 1.4.1
+
+**January 31, 2021**
+
+**NEW**
* **New color schemes:** Added four new built-in color schemes.
* **Barossa** - Barossa red and cardin green theme.
@@ -1775,65 +1987,103 @@ to the TODO section at the end of this page and read more
* **Damask and lunar** - Damask red and lunar green theme.
Use enum value `FlexScheme.damask` for easy access to it.
-* **Improved:** Semantics for the ThemeMode Widget buttons.
-* **Tests:** FlexThemeModeSwitch widget tests, makes and checks for system mode changes.
-* **Tests:** More tests, totally 723 tests, codecov is now > 99.5%.
+* Semantics for the ThemeMode Widget buttons.
+
+**TESTS**
+
+* FlexThemeModeSwitch widget tests, makes and checks for system mode changes.
+* More tests, totally 723 tests, codecov is now > 99.5%.
* **CI/CD:** Added GitHub actions to automate build and to publish the examples on the Web on a new release.
-* **Examples:** Minor changes to the examples. Modified to not need the `late` keyword when they are converted
+
+**EXAMPLES**
+
+* Minor changes to the examples. Modified to not need the `late` keyword when they are converted
to null safe versions.
-* **Documentation:**
- * Added the new color schemes to the documentation.
- * Minor typo corrections.
-## v1.4.0 - January 18, 2021
+**DOCS**
+
+* Added the new color schemes to the documentation.
+* Minor typo corrections.
+
+## 1.4.0
-* **Feature:** Added convenience property `scheme` to FlexColorScheme factories light and dark. This a shortcut for
+**January 18, 2021**
+
+**NEW**
+
+* Added convenience property `scheme` to FlexColorScheme factories light and dark. This a shortcut for
using the built-in color schemes. The `colors` property can still be used as before. The `.light` and
`.dark` factories no longer have any required properties. If `scheme` is not provided it defaults
to `FlexScheme.material` and if both `scheme` and `colors` are provided, the scheme provided via `colors` prevail.
-* **Examples:** Updated the simple example 1 to use the new `scheme` property, as in
- `theme: FlexColorScheme.light(scheme: FlexScheme.mandyRed).toTheme`.
-* **Feature:** Added experimental support for transparent system navigation bar for Android for SDK >= 30 (Android 11).
+* Added experimental support for transparent system navigation bar for Android for SDK >= 30 (Android 11).
The support is added via new `opacity` property in `FlexColorScheme.themedSystemNavigationBar`.
+
+**EXAMPLES**
- A separate example that builds
+* Updated the simple example 1 to use the new `scheme` property, as in
+ `theme: FlexColorScheme.light(scheme: FlexScheme.mandyRed).toTheme`.
+
+* Added a separate example that builds
on example 5, shows and explains how and when transparent system navigation bar can be used in Android. It also shows
how to make it look nice when using primary color branded background color applied to the system
navigation bar in Android, that is used when transparency is not supported. While if supported, your app otherwise
uses a transparent system navigation. Please see this separate small stand-alone example Android project
[**sysnavbar** on GitHub](https://github.com/rydmike/sysnavbar) for more information.
-* **Tests:** Added more tests, now 689 tests. All color values used are now also tested, any modification to them is considered
+
+**TESTS**
+* Added more tests, now 689 tests. All color values used are now also tested, any modification to them is considered
a breaking change. A bit more tests would still be nice, for the ThemeModeSwitch Widget at least.
Total test coverage > 98%, it will do for now.
-* **Documentation:**
- * Changed example one and the intro, to use the new simpler `scheme` property when using built-in schemes.
- * Added a section that lists which sub-themes, and which of their properties, are NOT null when creating a theme data
- object with FlexColorScheme.toTheme.
- * Removed the "back to content" link after each chapter. It was nice and worked fine on GitHub, but for some reason
- it did not on pub.dev.
- * Tried finding and adding comments for the 3 missing API comments needed to reach 100% API
- documentation comments, not sure if it succeeded. I will see when the update is published.
-## v1.3.0 - January 7, 2021
+**DOCS**
+
+* Changed example one and the intro, to use the new simpler `scheme` property when using built-in schemes.
+* Added a section that lists which sub-themes, and which of their properties, are NOT null when creating a theme data
+ object with FlexColorScheme.toTheme.
+* Removed the "back to content" link after each chapter. It was nice and worked fine on GitHub, but for some reason
+ it did not on pub.dev.
+* Tried finding and adding comments for the 3 missing API comments needed to reach 100% API
+ documentation comments, not sure if it succeeded. I will see when the update is published.
+
+## 1.3.0
+
+**January 7, 2021**
+
+**DEPRECATED**
* Marked `FlexSchemeSurfaceColors.themeSurface` as deprecated in favor of the correctly named
`FlexSchemeSurfaceColors.surfaceStyle` version. The older `themeSurface` will be removed when
null safe Version 2.0.0 is officially released as the main version.
+
+**NEW**
+
* Added `Diagnosticable` mixin to classes `FlexSchemeOnColors`, `FlexSchemeSurfaceColors` and `FlexColorScheme`,
that all also received proper identity overrides and `copyWith` methods.
+
+**CHANGE**
+
* Improved internal null safe behavior, with fall-backs values in some classes and helper functions.
It might make migration to null-safety easier.
+
+**TESTS**
+
* Added 389 tests. Coverage is 89% based on Codecov report. Will add more tests later, enough for now.
* The tests will make the migration to null-safety easier by providing some quality control checks.
* Added GitHub actions to run all the tests and automated test coverage analysis with Codecov.
+
+**DOCS**
+
* Documentation improvements and API doc fixes.
In previous version API-doc analysis says
"441 out of 444 API elements (99.3 %) have documentation comments.". I have not been able to find any missing ones.
The result from this update will only be seen after it has been uploaded, but I doubt it will change much. If
somebody happens to find the missing doc comments let my know, the IDE analyzer does not find them either.
-## v1.2.0 - January 4, 2021
+## 1.2.0
+
+**January 4, 2021**
+**NEW**
* Added four new built-in color schemes.
* **Amber blue** - Amber blaze and blue color theme, based on Material amber and blue accent colors.
Use enum value `FlexScheme.amber` for easy access to it.
@@ -1859,7 +2109,7 @@ to the TODO section at the end of this page and read more
defaults to '0', if not defined and `bottomAppBarElevation` defaults to `appBarElevation`, if not defined.
When using the default constructor (the factories are recommended), they both default to '0'.
-**Example updates**
+**EXAMPLES**
* All examples: The widget showcase now show the resulting themed tab bar on two different backgrounds, one on the
app bar color and one on background color. This can guide you in which tab bar style is right for your use case.
@@ -1872,10 +2122,12 @@ to the TODO section at the end of this page and read more
`FlexColorScheme.toTheme` used Roboto. This was modified so that the resulting themes use the
same font and are thus more comparable.
-## v1.1.1 - December 31, 2020
+## 1.1.1
+
+**December 31, 2020**
+
+**NEW**
-* Updated example 5 to include UI that can be used to vary the computed dark themes white blend percentage level.
- This was added to better demonstrate the `toDark` feature.
* Added a `defaultError` modifier that enables the built-in schemes to use the Material design guide's default dark
error color when using the `toDark` method to compute a dark scheme from a light scheme.
The `toDark` method can be used without the `defaultError` scheme modifier, but then the
@@ -1884,9 +2136,21 @@ to the TODO section at the end of this page and read more
desired behavior and ensures that the dark error color just uses the default value. For custom schemes that do not
specify a custom error color for their light scheme and thus default to the Material Guide's standard error color,
the fix is not needed. Example 5 demonstrates the use case of `defaultError` as well.
+
+**EXAMPLES**
+
+* Updated example 5 to include UI that can be used to vary the computed dark themes white blend percentage level.
+ This was added to better demonstrate the `toDark` feature.
+
+**DOCS**
+
* Major documentation review and updates.
-## v1.1.0 - December 29, 2020
+## 1.1.0
+
+**December 29, 2020**
+
+**NEW**
* Added API to make a matching dark scheme from a light scheme. See
[FlexSchemeColor.toDark](https://pub.dev/documentation/flex_color_scheme/latest/flex_color_scheme/FlexSchemeColor/toDark.html).
@@ -1896,124 +2160,119 @@ to the TODO section at the end of this page and read more
* Added static method [FlexColorScheme.comfortablePlatformDensity](https://pub.dev/documentation/flex_color_scheme/latest/flex_color_scheme/FlexColorScheme/comfortablePlatformDensity.html).
* Added static method [FlexColorScheme.themedSystemNavigationBar](https://pub.dev/documentation/flex_color_scheme/latest/flex_color_scheme/FlexColorScheme/themedSystemNavigationBar.html) that can be used to assist with theming the system navigation bar via an annotated region. See updated example 5, for a demo on how to use it.
* Added API property [FlexColorScheme.transparentStatusBar](https://pub.dev/documentation/flex_color_scheme/latest/flex_color_scheme/FlexColorScheme/transparentStatusBar.html) to allow opting out of the one-toned AppBar in Android.
-* Updated the examples.
- - All examples now use the new platform adaptive `FlexColorScheme.comfortablePlatformDensity` as their `visualDensity`
- setting. The Flutter default `compact` mode for desktop and web goes a bit overboard in its compactness. This
- optional setting presents an alternative where `comfortable` density is used on desktops and Web, while devices keep
- their standard visual density. Just omit the setting if you prefer Flutter's super compact Web and Desktop widgets.
- - Example 3 excludes the system theme mode option, just to show this new feature of the switch.
- - Example 4 includes all built-in schemes, plus 3 custom ones, including one where the dark scheme is made
- with the `toDark` method. Example 4 also includes a sub-page that can be opened to see the same theme on a new page.
- - Example 5 now includes an option make all the dark mode schemes with the `toDark` option, so it can be
- toggled and compared to the hand-tuned versions. The same custom color scheme as in example 4 are also included.
- Example 5 also has the same sub-page as example 4. Example 5 now also show how to solve the issue that the system
- navigation bar does not get color scheme and theme mode appropriate style in Android when we
- change the theme. This improvement is done with an `AnnotatedRegion` and the new static helper
- method `FlexColorScheme.themedSystemNavigationBar`.
+
+**EXAMPLES**
+
+* All examples now use the new platform adaptive `FlexColorScheme.comfortablePlatformDensity` as their `visualDensity`
+ setting. The Flutter default `compact` mode for desktop and web goes a bit overboard in its compactness. This
+ optional setting presents an alternative where `comfortable` density is used on desktops and Web, while devices keep
+ their standard visual density. Just omit the setting if you prefer Flutter's super compact Web and Desktop widgets.
+* *Example 3:* excludes the system theme mode option, just to show this new feature of the switch.
+* *Example 4:* includes all built-in schemes, plus 3 custom ones, including one where the dark scheme is made
+ with the `toDark` method. Example 4 also includes a sub-page that can be opened to see the same theme on a new page.
+* *Example 5:* now includes an option make all the dark mode schemes with the `toDark` option, so it can be
+ toggled and compared to the hand-tuned versions. The same custom color scheme as in example 4 are also included.
+ Example 5 also has the same sub-page as example 4. Example 5 now also show how to solve the issue that the system
+ navigation bar does not get color scheme and theme mode appropriate style in Android when we
+ change the theme. This improvement is done with an `AnnotatedRegion` and the new static helper
+ method `FlexColorScheme.themedSystemNavigationBar`.
+
+**DOCS**
+
* Documentation updates and typo corrections.
-## v1.0.0 - December 21, 2020
+## 1.0.0
+
+**December 21, 2020**
* Version 1.0.0 released
+
+**DOCS**
+
* Documentation layout updates and typo corrections.
-## v1.0.0-dev.2 - December 21, 2020
+## 1.0.0-dev.2
+
+**December 21, 2020**
+**BREAKING**
+
* Made planned API name changes, SchemeOnColors -> FlexSchemeOnColors and
SchemeSurfaceColors -> FlexSchemeSurfaceColors. These are lower level APIs that are
only used when making custom on and surface colors.
Changed ThemeModeOptionButton -> FlexThemeModeOptionButton, this is a lower
level API that can be used when making more advanced custom theme selection
controls that are based on the same button that the `FlexThemeModeSwitch` uses.
-* Exposed planned configuration APIs for the FlexThemeModeSwitch and FlexThemeModeOptionButton.
* Removed the constants that had no function in the public interface from the API.
-* Documentation updates and corrections.
+
+**NEW**
+* Exposed planned configuration APIs for the 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
useful earlier but not anymore, using only TextSelectionThemeData is
enough in the latest stable version.
-## v1.0.0-dev.1 - December 17, 2020
+**DOCS**
+
+* Documentation updates and corrections.
+
-* First development pre-release on pub.dev.
+## 1.0.0-dev.1
----
+**December 17, 2020**
+
+* First development pre-release on pub.dev.
-# Known General Issues
-- The color branding is not applied to Widgets using elevated `Material` of
- type `canvas` in Flutter when using primary colored surface and backgrounds,
- and the theme's `applyElevationOverlayColor: true` is true. This is caused
- by this Flutter [SDK issue and limitation](https://github.com/flutter/flutter/issues/90353).
- Version 4.0.0 addresses this limitation by introducing more color blend
- modes that keep the colors equal in order to not be affected by this
- limitation. If you are using heavy color branding in dark theme mode, the
- overlay color is not really necessary. Material 3 (You) is, based on some code
- comments seen on the NavigationBar, maybe leaning this way too.
---
-# Planned Updates and New Features
-
-These are the topics I currently have on the TODO list for this package.
-Have a new suggestion and idea? Feel free to open a
-[suggestion or issue](https://github.com/rydmike/flex_color_scheme/issues)
-in the repo. There is also a project where active and recent TODOs are
-tracked [here](https://github.com/rydmike/flex_color_scheme/projects/1).
-
-## PLANNED
-
-- All past planned features have been done and delivered with version 5.
- Future planned topics will be listed in the documentation or repo discussions.
-
-## DONE
-
-- Created own documentation site for FlexColorScheme.
-- Version 5.0.0 Added a sub-theme for the `NavigationRail`.
-- Version 5.0.0 Added `SchemeColor` color selection to buttons and toggle buttons.
-- Version 5.0.0 Added support for Material.
-- Version 5.0.0 Added AppBar with optional `SchemeColor` based color selection.
-- Version 5.0.0 Added `SchemeColor` selection to TabBar
-- Version 5.0.0 Added `SchemeColor` color selection to
- the Floating Action Button sub-theme.
-- Version 4.2.0 support making themes from standard ColorScheme. More
- customization of sub-themes. Support for M3 NavigationBar and sub-theming it,
- and a default that matches FlexColorScheme styles.
-- Version 4.0.0 Docs with quick start example first.
-- Version 4.0.0 Added a more complex example that also persists theme.
-- Version 4.0.0 Added API offering more flexibility and customization
- capabilities to the surface color branding.
-- Version 3.0.0 Deprecated `accentColor`. Swap primary and secondary colors
- feature added. Added 4 new color schemes.
-- Version 2.0.0 Release official null-safe version, when nullsafety is
- available in Flutter stable channel.
-- Version 2.0.0-nullsafety.2: Minor new APIs and features added. Example 5 updated.
-- Since [#71184](https://github.com/flutter/flutter/pull/71184) landed in
- Flutter 2.0.0. The past custom "white"
- AppBarTheme implementation was as planned changed to the new one that is
- supported by the SDK.
-- Version 2.0.0-nullsafety.1 released
-- Version 1.4.1 Added automated build and publish pipes for the Web examples!
-- Version 1.4.1 More tests, tests are now considered sufficient for current features.
-- Version 1.4.0: Increased unit and widget test to 689 tests. All color
- definitions are now also tested to ensure they will not be changed by
- any accidental edit. Test coverage is higher than 95%, certainly sufficient
- for this type of package, but there are still some areas that could and
- will be improved.
-- Version 1.3.0: Added 195 unit and widgets tests, mostly unit tests.
-- API to assist with themed annotated region for system navigation bar theming.
-- API to opt-out from one-toned AppBar and return it to Android's default two-toned.
-- Add API that allows us to use an additional extra color definition for
- ThemeData.accentColor to easily make themes
- with custom input border color in dark-mode.
-- Add API the can create the dark scheme based on a light scheme's colors.
-- Release version 1.0.0 on pub.dev.
-- Review and correct documentation mistakes and typos, first pass anyway.
-- Review and update the API.
-- Publish live Web versions of the five examples.
-- Complete the documentation.
-- Release first version 1.0.0-dev.1 publicly on GitHub and pub.dev.
-
-## MAYBE
+## Future Features
+
+The topics on the list below were TODOs for this package prior to version 5.0.0 release.
+
+Have a new suggestion and idea? Check the docs to see if it already exists in
+[future features](https://docs.flexcolorscheme.com/future_features). If not, feel free to open
+a suggestion in repo [discussions](https://github.com/rydmike/flex_color_scheme/discussions).
+There is also a project where active tasks being worked are
+[tracked](https://github.com/rydmike/flex_color_scheme/projects/1).
+
+### TODOs
+
+- [x] Created own documentation site for FlexColorScheme.
+- [x] Version 5.0.0 Added a sub-theme for the `NavigationRail`.
+- [x] Version 5.0.0 Added `SchemeColor` color selection to buttons and toggle buttons.
+- [x] Version 5.0.0 Added support for Material.
+- [x] Version 5.0.0 Added AppBar with optional `SchemeColor` based color selection.
+- [x] Version 5.0.0 Added `SchemeColor` selection to TabBar
+- [x] Version 5.0.0 Added `SchemeColor` color selection to the Floating Action Button sub-theme.
+- [x] Version 4.2.0 support making themes from standard ColorScheme. More customization of sub-themes. Support for M3 NavigationBar and sub-theming it, and a default that matches FlexColorScheme styles.
+- [x] Version 4.0.0 Docs with quick start example first.
+- [x] Version 4.0.0 Added a more complex example that also persists theme.
+- [x] Version 4.0.0 Added API offering more flexibility and customization capabilities to the surface color branding.
+- [x] Version 3.0.0 Deprecated `accentColor`. Swap primary and secondary colors feature added. Added 4 new color schemes.
+- [x] Version 2.0.0 Release official null-safe version, when nullsafety is available in Flutter stable channel.
+- [x] Version 2.0.0-nullsafety.2: Minor new APIs and features added. Example 5 updated.
+- [x] Since [#71184](https://github.com/flutter/flutter/pull/71184) landed in Flutter 2.0.0. The past custom "white" AppBarTheme implementation was as planned changed to the new one that is supported by the SDK.
+- [x] Version 2.0.0-nullsafety.1 released
+- [x] Version 1.4.1 Added automated build and publish pipes for the Web examples!
+- [x] Version 1.4.1 More tests, tests are now considered sufficient for current features.
+- [x] Version 1.4.0: Increased unit and widget test to 689 tests. All color definitions are now also tested to ensure they will not be changed by any accidental edit. Test coverage is higher than 95%, certainly sufficient for this type of package, but there are still some areas that could and will be improved.
+- [x] Version 1.3.0: Added 195 unit and widgets tests, mostly unit tests.
+- [x] API to assist with themed annotated region for system navigation bar theming.
+- [x] API to opt-out from one-toned AppBar and return it to Android's default two-toned.
+- [x] Add API that allows us to use an additional extra color definition for ThemeData.accentColor to easily make themes with custom input border color in dark-mode.
+- [x] Add API the can create the dark scheme based on a light scheme's colors.
+- [x] Release version 1.0.0 on pub.dev.
+- [x] Review and correct documentation mistakes and typos, first pass anyway.
+- [x] Review and update the API.
+- [x] Publish live Web versions of the five examples.
+- [x] Complete the documentation.
+- [x] Release first version 1.0.0-dev.1 publicly on GitHub and pub.dev.
+
+### Was maybe, now obsolete
These maybes were on the PLANNED agenda earlier, however for version 5
and Material 3 the correct alternative was to replace swatches with the
@@ -2024,12 +2283,9 @@ While I don't like adding a none SDK library to the package, if Flutter SDK
uses it as well, then why not. It would still be nice to have the actual
Material 2 swatch algorithm in Dart as well, then we could:
-- Use actual Material 2 color shades when a Material
- color is selected as primary color, for its light/dark shades.
-
-- For this we need to find and use the color algorithm Google uses on its
- Material colors site [here](https://material.io/design/color/the-color-system.html#tools-for-picking-colors) and [here](https://material.io/resources/color/#!/?view.left=0&view.right=0&primary.color=582aed&secondary.color=00B0FF).
-- The algorithms for them are actually even a bit different. The second link also
+- [ ] Use actual Material 2 color shades when a Material color is selected as primary color, for its light/dark shades.
+- [ ] For this we need to find and use the color algorithm Google uses on its Material colors site [here](https://material.io/design/color/the-color-system.html#tools-for-picking-colors) and [here](https://material.io/resources/color/#!/?view.left=0&view.right=0&primary.color=582aed&secondary.color=00B0FF).
+- [ ] The algorithms for them are actually even a bit different. The second link also
seems to imply that color schemes should have had primary and secondary colors,
with light and dark variants. Instead of using just one variant color, like
past `ColorScheme` class in Flutter did. This of course all changed with
@@ -2040,32 +2296,3 @@ Material 2 swatch algorithm in Dart as well, then we could:
- https://github.com/eugeneford/material-palette-generator
- https://github.com/mbitson/mcg/issues/19
- https://github.com/edelstone/material-palette-generator
-
-## OUT OF SCOPE
-
-### Serialization of FlexColorScheme
-
-Including built-in serialization of FlexColorScheme, and its key classes has
-been suggested. I consider `FlexColorScheme` to be functionally on a level
-similar to `ThemeData` and `ColorScheme`. Therefore, it should not cover
-serialization of itself. Serialization have to deal with a lot of potential
-failure points that I think should not have to be a concern in this type of
-component. I am not planning to add it.
-
-My recommendation for saving the state of a `FlexColorScheme` is to include
-values for its settings that you use in your implementation in other models
-in your application, like an "AppSettings" model or similar.
-
-You probably serialize and store such data already, perhaps with shared
-preferences, hive, get_storage or some other solution. Include the values
-you need for your `FlexColorScheme` implementation in your stored settings
-and then use those values to restore your `FlexColorScheme` configuration and
-theme. This way, your implementation also remain in control of what it needs
-to store and restore.
-
-From version 4.0.0 a simple approach using the architecture introduced via the
-Flutter "skeleton" template in Flutter version 2.5 was used together with
-Shared Preferences and Hive to persist and load FlexColorScheme on start.
-This is just one example, other implementations together with Riverpod, Provider,
-Flutter Bloc, GetX etc., and completely different local persistence packages
-work well too.
diff --git a/README.md b/README.md
index 9ca99548c..d58c888c0 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[
](https://docs.flutter.dev/development/packages-and-plugins/favorites)
-Use **FlexColorScheme** to make beautiful color scheme based Flutter themes,
+Use **FlexColorScheme** to make beautiful color scheme based Flutter Material design themes,
with optional primary color surface blends, or key color seeded color schemes.
The themes are based on the same concept as Flutter's ColorScheme based themes,
but offers many additional features, and numerous pre-made themes.
@@ -29,13 +29,13 @@ colors to all color properties in `ThemeData`, as long as they still exist. This
ensures that all the direct colors properties in `ThemeData` match your `ColorScheme`.
There are no surprises in `ThemeData` that do not match your `ColorScheme`.
-You can opt-in on using opinionated component sub-themes.
+You can opt in on using opinionated component sub-themes.
By doing so you can for example adjust the border radius on all UI widgets
with a single property value. Flutter's Material UI widgets still default to
being based on the Material 2 design, and thus use 4 dp corner radius on most
widgets.
-When you opt-in on using the component sub-themes, the border radius on widgets
+When you opt in on using the component sub-themes, the border radius on widgets
default to the new rounded corners as specified by the
[Material 3 guide](https://m3.material.io/), where the
radius varies by widget type. You can keep this, or set the global widget
@@ -61,7 +61,7 @@ avoid the both complicated and confusing `MaterialState` theming properties.
**FlexColorScheme** has many advanced coloring features, like using
surface alpha blends. It also fully supports Material 3 based color schemes,
-including seed key color generated `ColorSchemes`. It offers many configuration
+including seed key color generated `ColorSchemes`. It offers different configuration
options that you can use when you generate your `ColorScheme` from
key colors, customization features that are currently not available in Flutter.
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f97..9625e105d 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 11.0
diff --git a/example/ios/Podfile b/example/ios/Podfile
index 1e8c3c90a..88359b225 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
new file mode 100644
index 000000000..5382cf0b0
--- /dev/null
+++ b/example/ios/Podfile.lock
@@ -0,0 +1,34 @@
+PODS:
+ - Flutter (1.0.0)
+ - path_provider_ios (0.0.1):
+ - Flutter
+ - shared_preferences_ios (0.0.1):
+ - Flutter
+ - url_launcher_ios (0.0.1):
+ - Flutter
+
+DEPENDENCIES:
+ - Flutter (from `Flutter`)
+ - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
+ - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
+ - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
+
+EXTERNAL SOURCES:
+ Flutter:
+ :path: Flutter
+ path_provider_ios:
+ :path: ".symlinks/plugins/path_provider_ios/ios"
+ shared_preferences_ios:
+ :path: ".symlinks/plugins/shared_preferences_ios/ios"
+ url_launcher_ios:
+ :path: ".symlinks/plugins/url_launcher_ios/ios"
+
+SPEC CHECKSUMS:
+ Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
+ path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
+ shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
+ url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
+
+PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
+
+COCOAPODS: 1.11.3
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 6edd238e7..59ceb81c8 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 7243F1DE4BD1AF23302915E6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 64CC123E88BFCA2A368B883B /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
@@ -29,12 +30,15 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 077A5D56B8A3ADF955ED6BDC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 64CC123E88BFCA2A368B883B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 8405207565413799876F01CF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -42,6 +46,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ DBC0D8ACA8D44D32D16752A8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -49,12 +54,24 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7243F1DE4BD1AF23302915E6 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 828FF93B82116CD65DE86F10 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 8405207565413799876F01CF /* Pods-Runner.debug.xcconfig */,
+ 077A5D56B8A3ADF955ED6BDC /* Pods-Runner.release.xcconfig */,
+ DBC0D8ACA8D44D32D16752A8 /* Pods-Runner.profile.xcconfig */,
+ );
+ name = Pods;
+ path = Pods;
+ sourceTree = "";
+ };
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -72,6 +89,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
+ 828FF93B82116CD65DE86F10 /* Pods */,
+ A8D5F143D22514A656E8B113 /* Frameworks */,
);
sourceTree = "";
};
@@ -98,6 +117,14 @@
path = Runner;
sourceTree = "";
};
+ A8D5F143D22514A656E8B113 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 64CC123E88BFCA2A368B883B /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -105,12 +132,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
+ 78F9DEEF949C19CFEE59247E /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ 9FC33A3568ABED10E13BAC97 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -183,6 +212,28 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
+ 78F9DEEF949C19CFEE59247E /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -197,6 +248,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
+ 9FC33A3568ABED10E13BAC97 /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -272,7 +340,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -349,7 +417,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -398,7 +466,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata
index 1d526a16e..21a3cc14c 100644
--- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata
+++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -4,4 +4,7 @@
+
+
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index 27491e8a7..41603ef1b 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -43,5 +43,9 @@
UIViewControllerBasedStatusBarAppearance
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/example/lib/example1_basic_theme_usage/home_page.dart b/example/lib/example1_basic_theme_usage/home_page.dart
index 373bdec6d..839e13c28 100644
--- a/example/lib/example1_basic_theme_usage/home_page.dart
+++ b/example/lib/example1_basic_theme_usage/home_page.dart
@@ -43,6 +43,7 @@ class HomePage extends StatelessWidget {
body: PageBody(
constraints: const BoxConstraints(maxWidth: AppData.maxBodyWidth),
child: ListView(
+ primary: true,
padding: EdgeInsets.all(margins),
children: [
const Text(
diff --git a/example/lib/example2_custom_theme/home_page.dart b/example/lib/example2_custom_theme/home_page.dart
index f767a70c2..3566d5bd7 100644
--- a/example/lib/example2_custom_theme/home_page.dart
+++ b/example/lib/example2_custom_theme/home_page.dart
@@ -47,6 +47,7 @@ class HomePage extends StatelessWidget {
body: PageBody(
constraints: const BoxConstraints(maxWidth: AppData.maxBodyWidth),
child: ListView(
+ primary: true,
padding: EdgeInsets.all(margins),
children: [
const Text(
diff --git a/example/lib/example3_four_themes/home_page.dart b/example/lib/example3_four_themes/home_page.dart
index 631098ac3..557719941 100644
--- a/example/lib/example3_four_themes/home_page.dart
+++ b/example/lib/example3_four_themes/home_page.dart
@@ -46,6 +46,7 @@ class HomePage extends StatelessWidget {
body: PageBody(
constraints: const BoxConstraints(maxWidth: AppData.maxBodyWidth),
child: ListView(
+ primary: true,
padding: EdgeInsets.all(margins),
children: [
const Text(
diff --git a/example/lib/example4_all_themes/home_page.dart b/example/lib/example4_all_themes/home_page.dart
index 3b7edf92c..af8ccaefa 100644
--- a/example/lib/example4_all_themes/home_page.dart
+++ b/example/lib/example4_all_themes/home_page.dart
@@ -59,6 +59,7 @@ class HomePage extends StatelessWidget {
body: PageBody(
constraints: const BoxConstraints(maxWidth: AppData.maxBodyWidth),
child: ListView(
+ primary: true,
padding: EdgeInsets.all(margins),
children: [
const Text(
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 6be291658..09fcb325a 100644
--- a/example/lib/example5_themes_playground/theme/flex_theme_dark.dart
+++ b/example/lib/example5_themes_playground/theme/flex_theme_dark.dart
@@ -32,10 +32,7 @@ ThemeData flexThemeDark(ThemeController controller) =>
///
/// Normally you would probably only have a few properties offered as possible
/// features the user can change. Since this is a feature demo of almost
-/// everything [FlexColorScheme] it is a bit wild.
-///
-/// This function returns the Dark theme mode data that we us in the
-/// ThemesPlayground app.
+/// everything [FlexColorScheme] can do, it is a bit wild.
///
/// The function only contains tutorial comments on topics not covered in the
/// almost identical `flexColorSchemeLight` function. Please see it for
@@ -84,6 +81,8 @@ FlexColorScheme flexColorSchemeDark(ThemeController controller) {
blendTextTheme: controller.blendDarkTextTheme,
useFlutterDefaults: controller.useFlutterDefaults,
useTextTheme: controller.useTextTheme,
+ thinBorderWidth: controller.thinBorderWidth,
+ thickBorderWidth: controller.thickBorderWidth,
//
defaultRadius: controller.defaultRadius,
bottomSheetRadius: controller.bottomSheetBorderRadius,
@@ -94,7 +93,11 @@ FlexColorScheme flexColorSchemeDark(ThemeController controller) {
//
textButtonSchemeColor: controller.textButtonSchemeColor,
elevatedButtonSchemeColor: controller.elevatedButtonSchemeColor,
+ elevatedButtonSecondarySchemeColor:
+ controller.elevatedButtonSecondarySchemeColor,
outlinedButtonSchemeColor: controller.outlinedButtonSchemeColor,
+ outlinedButtonOutlineSchemeColor:
+ controller.outlinedButtonOutlineSchemeColor,
toggleButtonsSchemeColor: controller.toggleButtonsSchemeColor,
switchSchemeColor: controller.switchSchemeColor,
checkboxSchemeColor: controller.checkboxSchemeColor,
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 d97b94b7d..8e2fe5912 100644
--- a/example/lib/example5_themes_playground/theme/flex_theme_light.dart
+++ b/example/lib/example5_themes_playground/theme/flex_theme_light.dart
@@ -31,7 +31,7 @@ ThemeData flexThemeLight(ThemeController controller) =>
///
/// Normally you would probably only have a few properties offered as possible
/// features the user can change. Since this is a feature demo of almost
-/// everything [FlexColorScheme] it is a bit wild.
+/// everything [FlexColorScheme] can do, it is a bit wild.
FlexColorScheme flexColorSchemeLight(ThemeController controller) {
// Using a built-in scheme or one of the custom colors in the demo?
final bool useBuiltIn = controller.schemeIndex > 2 &&
@@ -117,6 +117,9 @@ FlexColorScheme flexColorSchemeLight(ThemeController controller) {
// not yet natively available in Flutter SDK 2.10.3 or earlier,
// this offers it as a way to use it already now.
useTextTheme: controller.useTextTheme,
+ // Outline thickness theming
+ thinBorderWidth: controller.thinBorderWidth,
+ thickBorderWidth: controller.thickBorderWidth,
// Prefer Flutter SDK null default behavior for sub-themes, when
// possible.
useFlutterDefaults: controller.useFlutterDefaults,
@@ -137,7 +140,11 @@ FlexColorScheme flexColorSchemeLight(ThemeController controller) {
// SchemeColor based ColorScheme color used on buttons & toggles.
textButtonSchemeColor: controller.textButtonSchemeColor,
elevatedButtonSchemeColor: controller.elevatedButtonSchemeColor,
+ elevatedButtonSecondarySchemeColor:
+ controller.elevatedButtonSecondarySchemeColor,
outlinedButtonSchemeColor: controller.outlinedButtonSchemeColor,
+ outlinedButtonOutlineSchemeColor:
+ controller.outlinedButtonOutlineSchemeColor,
toggleButtonsSchemeColor: controller.toggleButtonsSchemeColor,
switchSchemeColor: controller.switchSchemeColor,
checkboxSchemeColor: controller.checkboxSchemeColor,
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 561eb9e0a..10fa2649e 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
@@ -95,14 +95,16 @@ String generateThemeDartCode(ThemeController controller) {
final String blendLevelDark = controller.blendLevelDark > 0
? ' blendLevel: ${controller.blendLevelDark},\n'
: '';
- final String appBarStyleLight =
- controller.appBarStyleLight != FlexAppBarStyle.primary
- ? ' appBarStyle: ${controller.appBarStyleLight},\n'
- : '';
- final String appBarStyleDark =
- controller.appBarStyleDark != FlexAppBarStyle.material
- ? ' appBarStyle: ${controller.appBarStyleDark},\n'
- : '';
+ final String appBarStyleLight = controller.appBarStyleLight == null ||
+ (controller.useMaterial3 &&
+ controller.appBarBackgroundSchemeColorLight != null)
+ ? ''
+ : ' appBarStyle: ${controller.appBarStyleLight},\n';
+ final String appBarStyleDark = controller.appBarStyleDark == null ||
+ (controller.useMaterial3 &&
+ controller.appBarBackgroundSchemeColorDark != null)
+ ? ''
+ : ' appBarStyle: ${controller.appBarStyleDark},\n';
final String appBarOpacityLight = controller.appBarOpacityLight != 1
? ' appBarOpacity: ${controller.appBarOpacityLight.toStringAsFixed(2)},\n'
: '';
@@ -155,18 +157,22 @@ String generateThemeDartCode(ThemeController controller) {
final String interactionEffects = controller.interactionEffects
? ''
: ' interactionEffects: ${controller.interactionEffects},\n';
- final String blendOnLevelLight = controller.blendOnLevel > 0
- ? ' blendOnLevel: ${controller.blendOnLevel},\n'
- : '';
- final String blendOnLevelDark = controller.blendOnLevelDark > 0
- ? ' blendOnLevel: ${controller.blendOnLevelDark},\n'
- : '';
- final String blendLightOnColors = controller.blendLightOnColors
- ? ''
- : ' blendOnColors: ${controller.blendLightOnColors},\n';
- final String blendDarkOnColors = controller.blendDarkOnColors
- ? ''
- : ' blendOnColors: ${controller.blendDarkOnColors},\n';
+ final String blendOnLevelLight =
+ controller.blendOnLevel > 0 && !controller.useKeyColors
+ ? ' blendOnLevel: ${controller.blendOnLevel},\n'
+ : '';
+ final String blendOnLevelDark =
+ controller.blendOnLevelDark > 0 && !controller.useKeyColors
+ ? ' blendOnLevel: ${controller.blendOnLevelDark},\n'
+ : '';
+ final String blendLightOnColors =
+ controller.blendLightOnColors || controller.useKeyColors
+ ? ''
+ : ' blendOnColors: ${controller.blendLightOnColors},\n';
+ final String blendDarkOnColors =
+ controller.blendDarkOnColors || controller.useKeyColors
+ ? ''
+ : ' blendOnColors: ${controller.blendDarkOnColors},\n';
final String blendLightTextTheme = controller.blendLightTextTheme
? ''
: ' blendTextTheme: ${controller.blendLightTextTheme},\n';
@@ -182,6 +188,12 @@ String generateThemeDartCode(ThemeController controller) {
final String defRadius = controller.defaultRadius != null
? ' defaultRadius: ${controller.defaultRadius!.toStringAsFixed(1)},\n'
: '';
+ final String thinBorderWidth = controller.thinBorderWidth != null
+ ? ' thinBorderWidth: ${controller.thinBorderWidth!.toStringAsFixed(1)},\n'
+ : '';
+ final String thickBorderWidth = controller.thickBorderWidth != null
+ ? ' thickBorderWidth: ${controller.thickBorderWidth!.toStringAsFixed(1)},\n'
+ : '';
//
// Material bottom sheet.
final String bottomSheetRadius = controller.bottomSheetBorderRadius != null
@@ -223,12 +235,22 @@ String generateThemeDartCode(ThemeController controller) {
controller.elevatedButtonSchemeColor == null
? ''
: ' elevatedButtonSchemeColor: ${controller.elevatedButtonSchemeColor},\n';
+ final String elevatedButtonSecondarySchemeColor = controller
+ .elevatedButtonSecondarySchemeColor ==
+ null
+ ? ''
+ : ' elevatedButtonSecondarySchemeColor: ${controller.elevatedButtonSecondarySchemeColor},\n';
final String outlinedButtonSchemeColor = controller
.outlinedButtonSchemeColor ==
SchemeColor.primary ||
controller.outlinedButtonSchemeColor == null
? ''
: ' outlinedButtonSchemeColor: ${controller.outlinedButtonSchemeColor},\n';
+ final String outlinedButtonOutlineSchemeColor = controller
+ .outlinedButtonOutlineSchemeColor ==
+ null
+ ? ''
+ : ' outlinedButtonOutlineSchemeColor: ${controller.outlinedButtonOutlineSchemeColor},\n';
final String toggleButtonsSchemeColor = controller.toggleButtonsSchemeColor ==
SchemeColor.primary ||
controller.toggleButtonsSchemeColor == null
@@ -295,8 +317,8 @@ String generateThemeDartCode(ThemeController controller) {
// Fab and chip, snack, card, dialog, popup setup CODE
//
final String fabUseShape = controller.fabUseShape
- ? ''
- : ' fabUseShape: ${controller.fabUseShape},\n';
+ ? ' fabUseShape: ${controller.fabUseShape},\n'
+ : '';
final String fabBorderRadius = controller.fabBorderRadius != null &&
controller.fabUseShape
? ' fabRadius: ${controller.fabBorderRadius!.toStringAsFixed(1)},\n'
@@ -570,6 +592,8 @@ String generateThemeDartCode(ThemeController controller) {
'$blendLightTextTheme'
'$useTextTheme'
'$defRadius'
+ '$thinBorderWidth'
+ '$thickBorderWidth'
//
'$bottomSheetRadius'
'$textButtonBorderRadius'
@@ -579,7 +603,9 @@ String generateThemeDartCode(ThemeController controller) {
//
'$textButtonSchemeColor'
'$elevatedButtonSchemeColor'
+ '$elevatedButtonSecondarySchemeColor'
'$outlinedButtonSchemeColor'
+ '$outlinedButtonOutlineSchemeColor'
'$toggleButtonsSchemeColor'
//
'$switchSchemeColor'
@@ -662,6 +688,8 @@ String generateThemeDartCode(ThemeController controller) {
'$blendDarkTextTheme'
'$useTextTheme'
'$defRadius'
+ '$thinBorderWidth'
+ '$thickBorderWidth'
//
'$bottomSheetRadius'
'$textButtonBorderRadius'
@@ -671,7 +699,9 @@ String generateThemeDartCode(ThemeController controller) {
//
'$textButtonSchemeColor'
'$elevatedButtonSchemeColor'
+ '$elevatedButtonSecondarySchemeColor'
'$outlinedButtonSchemeColor'
+ '$outlinedButtonOutlineSchemeColor'
'$toggleButtonsSchemeColor'
//
'$switchSchemeColor'
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 f10684b01..366fc851d 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
@@ -4,21 +4,22 @@ import 'package:flutter/material.dart';
import '../../../../shared/const/app_color.dart';
import '../../../../shared/controllers/theme_controller.dart';
import '../../../../shared/widgets/universal/switch_list_tile_adaptive.dart';
+import '../../../../shared/widgets/universal/theme_showcase.dart';
import '../../shared/color_scheme_popup_menu.dart';
-import 'app_bar_style_buttons.dart';
+import 'app_bar_style_popup_menu.dart';
class AppBarSettings extends StatelessWidget {
const AppBarSettings(this.controller, {super.key});
final ThemeController controller;
- String explainAppBarStyle(final FlexAppBarStyle style, final bool isLight) {
+ String explainAppBarStyle(final FlexAppBarStyle? style, final bool isLight) {
switch (style) {
case FlexAppBarStyle.primary:
- return isLight ? 'Primary color - M2 default' : 'Primary color';
+ return isLight ? 'Primary (M2 default)' : 'Primary';
case FlexAppBarStyle.material:
return isLight
- ? 'White background'
- : 'Dark background (#121212) - M2 default';
+ ? 'White (M2 light surface)'
+ : 'Dark (M2 default surface #121212)';
case FlexAppBarStyle.surface:
return 'Surface, with primary color blend';
case FlexAppBarStyle.background:
@@ -26,6 +27,18 @@ class AppBarSettings extends StatelessWidget {
case FlexAppBarStyle.custom:
return 'Custom, built-in schemes use tertiary color, '
'but you can use any color';
+ case null:
+ {
+ if (controller.useMaterial3) {
+ return 'Surface (M3 default)';
+ } else {
+ if (isLight) {
+ return 'Primary (M2 default)';
+ } else {
+ return 'Dark (M2 default surface #121212)';
+ }
+ }
+ }
}
}
@@ -35,81 +48,64 @@ class AppBarSettings extends StatelessWidget {
final bool isLight = theme.brightness == Brightness.light;
return Column(
children: [
- const SizedBox(height: 8),
+ const AppBarShowcase(),
const ListTile(
subtitle: Text(
- 'Material 2 themes use primary colored AppBar in light '
- 'mode, and almost black in dark mode. With this quick selection, '
- 'you can use '
- 'Primary, Material background or background and surface color, '
- 'with their primary blends or even a custom color as the as the '
- 'themed AppBar color.',
+ 'Material2 uses primary colored AppBar in light '
+ 'mode and almost black in dark mode. Material3 defaults to surface '
+ 'color in both light and dark theme mode. '
+ 'Here you can use select '
+ 'Primary, Material2 surface, background and surface colors '
+ 'with their surfaceTint blends, or use a custom color.',
),
),
- if (isLight) ...[
- ListTile(
- enabled: controller.useFlexColorScheme &&
- controller.appBarBackgroundSchemeColorLight == null,
+ if (isLight)
+ AppBarStylePopupMenu(
title: const Text('Light theme AppBarStyle'),
- subtitle: Text(
- explainAppBarStyle(
- controller.useFlexColorScheme &&
- controller.appBarBackgroundSchemeColorLight == null
- ? controller.appBarStyleLight
- : FlexAppBarStyle.primary,
- isLight),
- ),
- ),
- ListTile(
- enabled: controller.useFlexColorScheme &&
- controller.appBarBackgroundSchemeColorLight == null,
- trailing: AppBarStyleButtons(
- style: controller.useFlexColorScheme &&
- controller.appBarBackgroundSchemeColorLight == null
- ? controller.appBarStyleLight
- : FlexAppBarStyle.primary,
- onChanged: controller.useFlexColorScheme &&
- controller.appBarBackgroundSchemeColorLight == null
- ? controller.setAppBarStyleLight
- : null,
- // To access the custom color we defined for app bar, in this
- // toggle buttons widget, we have to pass along, or the
- // entire controller. Chose the color in this case. It is not
- // carried with the theme, so we cannot get it from there in
- // the widget. FlexColorScheme knows the color when
- // you make a theme with it. This color is used to show the
- // correct color on the toggle button option for custom color.
- // In our examples we only actually have a custom app bar
- // color in the first custom color example, and we want to
- // show this color as well on the toggle button.
- customAppBarColor:
- AppColor.scheme(controller).light.appBarColor),
- ),
- ] else ...[
- ListTile(
- enabled: controller.useFlexColorScheme,
+ labelForDefault: 'default',
+ index: controller.appBarStyleLight?.index ?? -1,
+ onChanged: controller.useFlexColorScheme &&
+ controller.appBarBackgroundSchemeColorLight == null
+ ? (int index) {
+ if (index < 0 || index >= FlexAppBarStyle.values.length) {
+ controller.setAppBarStyleLight(null);
+ } else {
+ controller
+ .setAppBarStyleLight(FlexAppBarStyle.values[index]);
+ }
+ }
+ : null,
+ // To access the custom color we defined for AppBars in this
+ // PopupMenu buttons widget, we have to pass it along, or the
+ // entire controller. We chose the color in this case. It is not
+ // carried with the theme, so we cannot get it from there in
+ // the widget. FlexColorScheme knows the color when
+ // you make a theme with it. This color is used to show the
+ // correct color on the AppBar custom color option for the not
+ // built-in custom color scheme.
+ // In our examples we only actually have a custom app bar
+ // color in the three custom color examples, and we want to
+ // show them as well on the PopupMenu button.
+ customAppBarColor: AppColor.scheme(controller).light.appBarColor,
+ )
+ else
+ AppBarStylePopupMenu(
title: const Text('Dark theme AppBarStyle'),
- subtitle: Text(
- explainAppBarStyle(
- controller.useFlexColorScheme
- ? controller.appBarStyleDark
- : FlexAppBarStyle.material,
- isLight),
- ),
- ),
- ListTile(
- enabled: controller.useFlexColorScheme,
- trailing: AppBarStyleButtons(
- style: controller.useFlexColorScheme
- ? controller.appBarStyleDark
- : FlexAppBarStyle.material,
- onChanged: controller.useFlexColorScheme
- ? controller.setAppBarStyleDark
- : null,
- customAppBarColor:
- AppColor.scheme(controller).dark.appBarColor),
+ labelForDefault: 'default',
+ index: controller.appBarStyleDark?.index ?? -1,
+ onChanged: controller.useFlexColorScheme &&
+ controller.appBarBackgroundSchemeColorDark == null
+ ? (int index) {
+ if (index < 0 || index >= FlexAppBarStyle.values.length) {
+ controller.setAppBarStyleDark(null);
+ } else {
+ controller
+ .setAppBarStyleDark(FlexAppBarStyle.values[index]);
+ }
+ }
+ : null,
+ customAppBarColor: AppColor.scheme(controller).dark.appBarColor,
),
- ],
SwitchListTileAdaptive(
title: const Text('One colored AppBar on Android'),
subtitle: const Text(
@@ -266,20 +262,18 @@ class AppBarSettings extends StatelessWidget {
),
),
],
- const Divider(),
const ListTile(
- title: Text('Custom color'),
+ title: Text('Background color'),
subtitle: Text('With component themes enabled you can select scheme '
- 'color for the themed '
- 'AppBar background color. '
+ 'color for the AppBar background color. '
'Using AppBarStyle is convenient and does not require activating '
'FlexColorScheme component themes, but this offers more choices. '
- 'Selecting a color to override used AppBarStyle, set it back '
+ 'Selecting a color overrides used AppBarStyle, set it back '
'to default to use AppBarStyle again.'),
),
if (isLight)
ColorSchemePopupMenu(
- title: const Text('Light theme AppBar background color'),
+ title: const Text('Light theme custom background color'),
labelForDefault: controller.useFlexColorScheme
? 'default (AppBarStyle)'
: 'default (primary)',
@@ -297,7 +291,7 @@ class AppBarSettings extends StatelessWidget {
)
else
ColorSchemePopupMenu(
- title: const Text('Dark theme AppBar background color'),
+ title: const Text('Dark theme custom background color'),
labelForDefault: controller.useFlexColorScheme
? 'default (AppBarStyle)'
: 'default (surface)',
diff --git a/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_buttons.dart b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_buttons.dart
index a27bd6d69..e6ac5c590 100644
--- a/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_buttons.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_buttons.dart
@@ -1,7 +1,11 @@
import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/material.dart';
+// TODO(rydmike): Remove this widget in example 5 in future release 6.0.0.
// Widget used to change the used app bar style mode in example 5.
+//
+// In version 5.2.0 of FlexColorScheme and its example 5, this widget is
+// no longer used, but keeping it around for a while.
class AppBarStyleButtons extends StatelessWidget {
const AppBarStyleButtons({
super.key,
diff --git a/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_popup_menu.dart b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_popup_menu.dart
new file mode 100644
index 000000000..f0c206dcc
--- /dev/null
+++ b/example/lib/example5_themes_playground/widgets/panels/app_bar_settings/app_bar_style_popup_menu.dart
@@ -0,0 +1,176 @@
+import 'package:flex_color_scheme/flex_color_scheme.dart';
+import 'package:flutter/material.dart';
+
+import '../../shared/color_scheme_box.dart';
+
+/// Widget used to select used AppBarStyle using a popup menu.
+///
+/// Uses index out out of range of [FlexAppBarStyle] to represent and select
+/// no selection of [FlexAppBarStyle] which sets its value to null in parent,
+/// so we can use a selectable item as null input, to represent default value
+/// via no value definition. A bit ugly/pragmatic approach.
+class AppBarStylePopupMenu extends StatelessWidget {
+ const AppBarStylePopupMenu({
+ super.key,
+ required this.index,
+ this.onChanged,
+ this.title,
+ this.subtitle,
+ this.contentPadding,
+ this.labelForDefault = 'default (null)',
+ this.popupLabelDefault,
+ this.customAppBarColor,
+ });
+ final int index;
+ final ValueChanged? onChanged;
+ final Widget? title;
+ final Widget? subtitle;
+ final EdgeInsetsGeometry? contentPadding; // Defaults to 16.
+ final String labelForDefault;
+ final String? popupLabelDefault;
+ final Color? customAppBarColor;
+
+ Color _appBarStyleColor(
+ final FlexAppBarStyle? style,
+ final ColorScheme colorScheme,
+ final bool isLight,
+ final bool useMaterial3,
+ ) {
+ switch (style) {
+ case FlexAppBarStyle.primary:
+ return colorScheme.primary;
+ case FlexAppBarStyle.material:
+ return isLight
+ ? FlexColor.materialLightSurface
+ : FlexColor.materialDarkSurface;
+ case FlexAppBarStyle.surface:
+ return colorScheme.surface;
+ case FlexAppBarStyle.background:
+ return colorScheme.background;
+ case FlexAppBarStyle.custom:
+ return customAppBarColor ?? colorScheme.tertiaryContainer;
+ case null:
+ {
+ if (useMaterial3) {
+ return colorScheme.surface;
+ } else {
+ if (isLight) {
+ return FlexColor.materialLightSurface;
+ } else {
+ return FlexColor.materialDarkSurface;
+ }
+ }
+ }
+ }
+ }
+
+ String _explainAppBarStyle(
+ final FlexAppBarStyle? style,
+ final bool isLight,
+ final bool useMaterial3,
+ ) {
+ switch (style) {
+ case FlexAppBarStyle.primary:
+ return isLight ? 'Primary color (M2 default)' : 'Primary color';
+ case FlexAppBarStyle.material:
+ return isLight
+ ? 'White (M2 light surface)'
+ : 'Dark (M2 default surface #121212)';
+ case FlexAppBarStyle.surface:
+ return 'Surface color, with primary color blend';
+ case FlexAppBarStyle.background:
+ return 'Background color, with primary color blend';
+ case FlexAppBarStyle.custom:
+ return 'Custom. Built-in schemes use tertiaryContainer color, '
+ 'but you can use any color';
+ case null:
+ {
+ if (useMaterial3) {
+ return 'Surface color (M3 default)';
+ } else {
+ if (isLight) {
+ return 'Primary color (M2 default)';
+ } else {
+ return 'Dark (M2 default surface #121212)';
+ }
+ }
+ }
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final ThemeData theme = Theme.of(context);
+ final bool isLight = theme.brightness == Brightness.light;
+ final bool useM3 = theme.useMaterial3;
+ final ColorScheme colorScheme = theme.colorScheme;
+ final TextStyle txtStyle = theme.textTheme.labelLarge!;
+ final bool enabled = onChanged != null;
+ // Negative value, or index over range are used as null and default value.
+ final bool useDefault = index < 0 || index >= FlexAppBarStyle.values.length;
+ final String styleName = !useDefault
+ ? _explainAppBarStyle(FlexAppBarStyle.values[index], isLight, useM3)
+ : _explainAppBarStyle(null, isLight, useM3);
+
+ return PopupMenuButton(
+ tooltip: '',
+ padding: EdgeInsets.zero,
+ onSelected: (int index) {
+ // We return -1 for index that reached max length or any negative
+ // value will cause controller for a FlexAppBarStyle to be set to
+ // "null", we need to be able to do that to input "null" property
+ // value to FlexAppBarStyle configs.
+ onChanged?.call(index >= FlexAppBarStyle.values.length ? -1 : index);
+ },
+ enabled: enabled,
+ itemBuilder: (BuildContext context) => >[
+ for (int i = 0; i <= FlexAppBarStyle.values.length; i++)
+ PopupMenuItem(
+ value: i,
+ child: ListTile(
+ dense: true,
+ leading: ColorSchemeBox(
+ color: i >= FlexAppBarStyle.values.length
+ ? _appBarStyleColor(null, colorScheme, isLight, useM3)
+ : _appBarStyleColor(
+ FlexAppBarStyle.values[i],
+ colorScheme,
+ isLight,
+ useM3,
+ ),
+ defaultColor: i >= FlexAppBarStyle.values.length,
+ ),
+ title: i >= FlexAppBarStyle.values.length
+ // If we reached max length make default label.
+ ? Text(popupLabelDefault ?? labelForDefault, style: txtStyle)
+ : Text(FlexAppBarStyle.values[i].name, style: txtStyle),
+ ),
+ )
+ ],
+ child: ListTile(
+ enabled: enabled,
+ contentPadding:
+ contentPadding ?? const EdgeInsets.symmetric(horizontal: 16),
+ title: title,
+ subtitle: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (subtitle != null) subtitle!,
+ Text(styleName),
+ ],
+ ),
+ trailing: ColorSchemeBox(
+ color: enabled && !useDefault
+ ? _appBarStyleColor(
+ FlexAppBarStyle.values[index],
+ colorScheme,
+ isLight,
+ useM3,
+ )
+ : _appBarStyleColor(null, colorScheme, isLight, useM3),
+ defaultColor: useDefault,
+ ),
+ ),
+ );
+ }
+}
diff --git a/example/lib/example5_themes_playground/widgets/panels/buttons_settings/buttons_settings.dart b/example/lib/example5_themes_playground/widgets/panels/buttons_settings/buttons_settings.dart
index d1fe1dee5..e62c7ce2d 100644
--- a/example/lib/example5_themes_playground/widgets/panels/buttons_settings/buttons_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/buttons_settings/buttons_settings.dart
@@ -18,7 +18,9 @@ class ButtonsSettings extends StatelessWidget {
final String elevatedButtonRadiusDefaultLabel =
controller.elevatedButtonBorderRadius == null &&
controller.defaultRadius == null
- ? 'default 20'
+ ? controller.useMaterial3
+ ? 'default stadium'
+ : 'default 20'
: controller.elevatedButtonBorderRadius == null &&
controller.defaultRadius != null
? 'global ${controller.defaultRadius!.toStringAsFixed(0)}'
@@ -26,7 +28,9 @@ class ButtonsSettings extends StatelessWidget {
final String outlinedButtonRadiusDefaultLabel =
controller.outlinedButtonBorderRadius == null &&
controller.defaultRadius == null
- ? 'default 20'
+ ? controller.useMaterial3
+ ? 'default stadium'
+ : 'default 20'
: controller.outlinedButtonBorderRadius == null &&
controller.defaultRadius != null
? 'global ${controller.defaultRadius!.toStringAsFixed(0)}'
@@ -34,7 +38,9 @@ class ButtonsSettings extends StatelessWidget {
final String textButtonRadiusDefaultLabel =
controller.textButtonBorderRadius == null &&
controller.defaultRadius == null
- ? 'default 20'
+ ? controller.useMaterial3
+ ? 'default stadium'
+ : 'default 20'
: controller.textButtonBorderRadius == null &&
controller.defaultRadius != null
? 'global ${controller.defaultRadius!.toStringAsFixed(0)}'
@@ -43,16 +49,15 @@ class ButtonsSettings extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SizedBox(height: 8),
- const ListTile(
- subtitle: Text('You can change button theme colors, default is '
- 'primary color. All component themes with border radius can '
- 'also have their own radius changed individually. It then either '
- 'overrides the M3 default or the set global radius default, '
- 'depending on what is in use.'),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ child: ElevatedButtonShowcase(),
),
ColorSchemePopupMenu(
- title: const Text('ElevatedButton color'),
+ title: const Text('ElevatedButton main color'),
+ subtitle: controller.useMaterial3
+ ? const Text('Foreground color')
+ : const Text('Background color'),
index: controller.elevatedButtonSchemeColor?.index ?? -1,
onChanged: controller.useSubThemes && controller.useFlexColorScheme
? (int index) {
@@ -65,9 +70,25 @@ class ButtonsSettings extends StatelessWidget {
}
: null,
),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
- child: ElevatedButtonShowcase(),
+ ColorSchemePopupMenu(
+ title: const Text('ElevatedButton secondary color'),
+ subtitle: controller.useMaterial3
+ ? const Text('Background color')
+ : const Text('Foreground color'),
+ labelForDefault: controller.useMaterial3
+ ? 'default (surface)'
+ : 'default (onPrimary)',
+ index: controller.elevatedButtonSecondarySchemeColor?.index ?? -1,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (int index) {
+ if (index < 0 || index >= SchemeColor.values.length) {
+ controller.setElevatedButtonSecondarySchemeColor(null);
+ } else {
+ controller.setElevatedButtonSecondarySchemeColor(
+ SchemeColor.values[index]);
+ }
+ }
+ : null,
),
ListTile(
enabled: controller.useSubThemes && controller.useFlexColorScheme,
@@ -83,7 +104,9 @@ class ButtonsSettings extends StatelessWidget {
: (controller.elevatedButtonBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
value: controller.useSubThemes && controller.useFlexColorScheme
? controller.elevatedButtonBorderRadius ?? -1
: -1,
@@ -111,7 +134,9 @@ class ButtonsSettings extends StatelessWidget {
: (controller.elevatedButtonBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
style: Theme.of(context)
.textTheme
.caption!
@@ -121,8 +146,13 @@ class ButtonsSettings extends StatelessWidget {
),
),
),
+ const Divider(),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ child: OutlinedButtonShowcase(),
+ ),
ColorSchemePopupMenu(
- title: const Text('OutlinedButton color'),
+ title: const Text('OutlinedButton foreground color'),
index: controller.outlinedButtonSchemeColor?.index ?? -1,
onChanged: controller.useSubThemes && controller.useFlexColorScheme
? (int index) {
@@ -135,9 +165,24 @@ class ButtonsSettings extends StatelessWidget {
}
: null,
),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
- child: OutlinedButtonShowcase(),
+ ColorSchemePopupMenu(
+ title: const Text('OutlinedButton outline color'),
+ labelForDefault: controller.useMaterial3
+ ? 'default (outline)'
+ : controller.useSubThemes && controller.useFlexColorScheme
+ ? 'default (primary)'
+ : 'default (onSurface opacity 0.12)',
+ index: controller.outlinedButtonOutlineSchemeColor?.index ?? -1,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (int index) {
+ if (index < 0 || index >= SchemeColor.values.length) {
+ controller.setOutlinedButtonOutlineSchemeColor(null);
+ } else {
+ controller.setOutlinedButtonOutlineSchemeColor(
+ SchemeColor.values[index]);
+ }
+ }
+ : null,
),
ListTile(
enabled: controller.useSubThemes && controller.useFlexColorScheme,
@@ -153,7 +198,9 @@ class ButtonsSettings extends StatelessWidget {
: (controller.outlinedButtonBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
value: controller.useSubThemes && controller.useFlexColorScheme
? controller.outlinedButtonBorderRadius ?? -1
: -1,
@@ -181,7 +228,9 @@ class ButtonsSettings extends StatelessWidget {
: (controller.outlinedButtonBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
style: Theme.of(context)
.textTheme
.caption!
@@ -191,6 +240,120 @@ class ButtonsSettings extends StatelessWidget {
),
),
),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('Normal border width'),
+ subtitle: const Text('Setting shared with unfocused TextField and '
+ 'ToggleButtons'),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: Slider.adaptive(
+ min: -0.5,
+ max: 5,
+ divisions: 11,
+ label: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ?? '')
+ : 'default 1',
+ value: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth ?? -0.5
+ : -0.5,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setThinBorderWidth(value < 0 ? null : value);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ 'WIDTH',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ??
+ '')
+ : 'default 1',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('Pressed border width'),
+ subtitle: const Text('Setting shared with focused TextField'),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: Slider.adaptive(
+ min: -0.5,
+ max: 5,
+ divisions: 11,
+ label: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth == null ||
+ (controller.thickBorderWidth ?? -0.5) < 0
+ ? 'default 2'
+ : (controller.thickBorderWidth?.toStringAsFixed(1) ?? '')
+ : 'default 2',
+ value: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth ?? -0.5
+ : -0.5,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setThickBorderWidth(value < 0 ? null : value);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ 'WIDTH',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth == null ||
+ (controller.thickBorderWidth ?? -0.5) < 0
+ ? 'default 2'
+ : (controller.thickBorderWidth?.toStringAsFixed(1) ??
+ '')
+ : 'default 2',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const Divider(),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ child: TextButtonShowcase(),
+ ),
ColorSchemePopupMenu(
title: const Text('TextButton color'),
index: controller.textButtonSchemeColor?.index ?? -1,
@@ -205,10 +368,6 @@ class ButtonsSettings extends StatelessWidget {
}
: null,
),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
- child: TextButtonShowcase(),
- ),
ListTile(
enabled: controller.useSubThemes && controller.useFlexColorScheme,
title: const Text('TextButton border radius'),
@@ -222,7 +381,9 @@ class ButtonsSettings extends StatelessWidget {
? textButtonRadiusDefaultLabel
: (controller.textButtonBorderRadius?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
value: controller.useSubThemes && controller.useFlexColorScheme
? controller.textButtonBorderRadius ?? -1
: -1,
@@ -250,7 +411,9 @@ class ButtonsSettings extends StatelessWidget {
: (controller.textButtonBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default stadium'
+ : 'default 4',
style: Theme.of(context)
.textTheme
.caption!
diff --git a/example/lib/example5_themes_playground/widgets/panels/component_themes/component_themes.dart b/example/lib/example5_themes_playground/widgets/panels/component_themes/component_themes.dart
index 83fa85928..0e5da5cf7 100644
--- a/example/lib/example5_themes_playground/widgets/panels/component_themes/component_themes.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/component_themes/component_themes.dart
@@ -73,8 +73,8 @@ class ComponentThemes extends StatelessWidget {
enabled: controller.useSubThemes && controller.useFlexColorScheme,
title: Slider.adaptive(
min: -1,
- max: 40,
- divisions: 41,
+ max: 60,
+ divisions: 61,
label: controller.useSubThemes && controller.useFlexColorScheme
? controller.defaultRadius == null ||
(controller.defaultRadius ?? -1) < 0
diff --git a/example/lib/example5_themes_playground/widgets/panels/dialog_settings/dialog_settings.dart b/example/lib/example5_themes_playground/widgets/panels/dialog_settings/dialog_settings.dart
index 9d4d4728d..514c98e47 100644
--- a/example/lib/example5_themes_playground/widgets/panels/dialog_settings/dialog_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/dialog_settings/dialog_settings.dart
@@ -38,7 +38,7 @@ class DialogSettings extends StatelessWidget {
title: const Text('Background color'),
labelForDefault: controller.useFlexColorScheme
? 'default (surface)'
- : 'default (alert-date:background) (time:surface)',
+ : 'default (alert&date=background) (time=surface)',
index: controller.dialogBackgroundSchemeColor?.index ?? -1,
onChanged: controller.useSubThemes && controller.useFlexColorScheme
? (int index) {
@@ -63,7 +63,9 @@ class DialogSettings extends StatelessWidget {
(controller.dialogBorderRadius ?? -1) < 0
? dialogRadiusDefaultLabel
: (controller.dialogBorderRadius?.toStringAsFixed(0) ?? '')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default 28'
+ : 'default 4',
value: controller.useSubThemes && controller.useFlexColorScheme
? controller.dialogBorderRadius ?? -1
: -1,
@@ -90,7 +92,9 @@ class DialogSettings extends StatelessWidget {
: (controller.dialogBorderRadius
?.toStringAsFixed(0) ??
'')
- : 'default 4',
+ : controller.useMaterial3
+ ? 'default 28'
+ : 'default 4',
style: Theme.of(context)
.textTheme
.caption!
diff --git a/example/lib/example5_themes_playground/widgets/panels/fab_toggle_chip_popup_settings/fab_toggle_chip_popup_settings.dart b/example/lib/example5_themes_playground/widgets/panels/fab_toggle_chip_popup_settings/fab_toggle_chip_popup_settings.dart
index 77fbc4893..4b8ca72fa 100644
--- a/example/lib/example5_themes_playground/widgets/panels/fab_toggle_chip_popup_settings/fab_toggle_chip_popup_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/fab_toggle_chip_popup_settings/fab_toggle_chip_popup_settings.dart
@@ -54,6 +54,10 @@ class FabToggleChipPopupSettings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ child: FabShowcase(),
+ ),
ColorSchemePopupMenu(
title: const Text('FloatingActionButton color'),
labelForDefault: controller.useMaterial3
@@ -89,8 +93,8 @@ class FabToggleChipPopupSettings extends StatelessWidget {
title: const Text('Border radius'),
subtitle: Slider.adaptive(
min: -1,
- max: 40,
- divisions: 41,
+ max: 60,
+ divisions: 61,
label: controller.useSubThemes &&
controller.useFlexColorScheme &&
controller.fabUseShape
@@ -144,11 +148,16 @@ class FabToggleChipPopupSettings extends StatelessWidget {
),
),
),
+ const Divider(),
+ const ListTile(
+ title: Text('ToggleButtons'),
+ subtitle: Text('Component themes style and height aligns '
+ 'ToggleButtons with OutlinedButton and FilledButton'),
+ ),
const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
- child: FabShowcase(),
+ padding: EdgeInsets.fromLTRB(16, 8, 16, 8),
+ child: ToggleButtonsShowcase(showOutlinedButton: true),
),
- const Divider(),
ColorSchemePopupMenu(
title: const Text('ToggleButtons color'),
index: controller.toggleButtonsSchemeColor?.index ?? -1,
@@ -215,13 +224,73 @@ class FabToggleChipPopupSettings extends StatelessWidget {
),
),
),
- const Padding(
- padding: EdgeInsets.fromLTRB(16, 8, 16, 8),
- child: ToggleButtonsShowcase(),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('Border width'),
+ subtitle: const Text('Setting shared with OutlinedButton and '
+ 'unfocused TextField'),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: Slider.adaptive(
+ min: -0.5,
+ max: 5,
+ divisions: 11,
+ label: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ?? '')
+ : 'default 1',
+ value: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth ?? -0.5
+ : -0.5,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setThinBorderWidth(value < 0 ? null : value);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ 'WIDTH',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ??
+ '')
+ : 'default 1',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
),
const Divider(),
+ const Padding(
+ padding: EdgeInsets.fromLTRB(16, 8, 16, 16),
+ child: ChipShowcase(),
+ ),
ColorSchemePopupMenu(
title: const Text('Chip color base'),
+ labelForDefault: controller.useMaterial3
+ ? 'default M3 (surface & secondaryContainer)'
+ : 'default (primary with opacity)',
index: controller.chipSchemeColor?.index ?? -1,
onChanged: controller.useSubThemes && controller.useFlexColorScheme
? (int index) {
@@ -245,7 +314,9 @@ class FabToggleChipPopupSettings extends StatelessWidget {
(controller.chipBorderRadius ?? -1) < 0
? chipRadiusDefaultLabel
: (controller.chipBorderRadius?.toStringAsFixed(0) ?? '')
- : 'stadium',
+ : controller.useMaterial3
+ ? 'default 8'
+ : 'stadium',
value: controller.useSubThemes && controller.useFlexColorScheme
? controller.chipBorderRadius ?? -1
: -1,
@@ -271,7 +342,9 @@ class FabToggleChipPopupSettings extends StatelessWidget {
? chipRadiusDefaultLabel
: (controller.chipBorderRadius?.toStringAsFixed(0) ??
'')
- : 'stadium',
+ : controller.useMaterial3
+ ? 'default 8'
+ : 'stadium',
style: Theme.of(context)
.textTheme
.caption!
@@ -281,45 +354,13 @@ class FabToggleChipPopupSettings extends StatelessWidget {
),
),
),
- const Padding(
- padding: EdgeInsets.fromLTRB(16, 8, 16, 16),
- child: ChipShowcase(),
- ),
const Divider(),
- ListTile(
- enabled: controller.useSubThemes && controller.useFlexColorScheme,
- title: const Text('PopupMenu opacity'),
- subtitle: Slider.adaptive(
- max: 100,
- divisions: 100,
- label: (popupOpacity * 100).toStringAsFixed(0),
- value: popupOpacity * 100,
- onChanged: controller.useSubThemes && controller.useFlexColorScheme
- ? (double value) {
- controller.setPopupMenuOpacity(value / 100);
- }
- : null,
- ),
- trailing: Padding(
- padding: const EdgeInsetsDirectional.only(end: 12),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- 'OPACITY',
- style: Theme.of(context).textTheme.bodySmall,
- ),
- Text(
- // ignore: lines_longer_than_80_chars
- '${(popupOpacity * 100).toStringAsFixed(0)} %',
- style: Theme.of(context)
- .textTheme
- .caption!
- .copyWith(fontWeight: FontWeight.bold),
- ),
- ],
- ),
- ),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ // The button used in the PopupMenuShowcase to open the PopupMenu
+ // is not a native widget, only the menu is, and it is the one that
+ // is themed.
+ child: PopupMenuShowcase(),
),
ListTile(
enabled: controller.useSubThemes && controller.useFlexColorScheme,
@@ -372,18 +413,50 @@ class FabToggleChipPopupSettings extends StatelessWidget {
),
),
),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16),
- // The button used in the PopupMenuShowcase to open the PopupMenu
- // is not a native widget, only the menu is, and it is the one that
- // is themed.
- child: PopupMenuShowcase(),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('PopupMenu opacity'),
+ subtitle: Slider.adaptive(
+ max: 100,
+ divisions: 100,
+ label: (popupOpacity * 100).toStringAsFixed(0),
+ value: popupOpacity * 100,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setPopupMenuOpacity(value / 100);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text(
+ 'OPACITY',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ // ignore: lines_longer_than_80_chars
+ '${(popupOpacity * 100).toStringAsFixed(0)} %',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
),
const Divider(),
const ListTile(
title: Text('IconButton, CircleAvatar, DropdownButton and Tooltip'),
subtitle: Text('Included to show their effective themed style'),
),
+ const Padding(
+ padding: EdgeInsets.all(16),
+ child: IconButtonCircleAvatarDropdownTooltipShowcase(),
+ ),
SwitchListTileAdaptive(
title: const Text(
'Tooltip background brightness',
@@ -398,10 +471,6 @@ class FabToggleChipPopupSettings extends StatelessWidget {
? controller.setTooltipsMatchBackground
: null,
),
- const Padding(
- padding: EdgeInsets.all(16),
- child: IconButtonCircleAvatarDropdownTooltipShowcase(),
- ),
],
);
}
diff --git a/example/lib/example5_themes_playground/widgets/panels/input_colors/input_colors_popup_menu.dart b/example/lib/example5_themes_playground/widgets/panels/input_colors/input_colors_popup_menu.dart
index e31501930..12aabdc12 100644
--- a/example/lib/example5_themes_playground/widgets/panels/input_colors/input_colors_popup_menu.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/input_colors/input_colors_popup_menu.dart
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import '../../../../shared/const/app_color.dart';
import '../../../../shared/controllers/theme_controller.dart';
-import '../../shared/color_scheme_popup_menu.dart';
+import '../../shared/color_scheme_box.dart';
/// Popup used to change the used FlexSchemeData index in the theme controller
/// and via that the selected active theme.
diff --git a/example/lib/example5_themes_playground/widgets/panels/input_colors/show_input_colors.dart b/example/lib/example5_themes_playground/widgets/panels/input_colors/show_input_colors.dart
index c1c35eb60..38438c5df 100644
--- a/example/lib/example5_themes_playground/widgets/panels/input_colors/show_input_colors.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/input_colors/show_input_colors.dart
@@ -125,7 +125,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: primary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: primary,
onChanged: (Color color) {
if (isLight) {
@@ -169,7 +169,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: primaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: primaryContainer,
onChanged: (Color color) {
if (isLight) {
@@ -230,7 +230,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: secondary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: secondary,
onChanged: (Color color) {
if (isLight) {
@@ -274,7 +274,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: secondaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: secondaryContainer,
onChanged: (Color color) {
if (isLight) {
@@ -336,7 +336,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: tertiary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: tertiary,
onChanged: (Color color) {
if (isLight) {
@@ -372,7 +372,7 @@ class ShowInputColors extends StatelessWidget {
Expanded(
child: Material(
color: tertiaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: tertiaryContainer,
onChanged: (Color color) {
if (isLight) {
diff --git a/example/lib/example5_themes_playground/widgets/panels/introduction/introduction_panel.dart b/example/lib/example5_themes_playground/widgets/panels/introduction/introduction_panel.dart
index c3af00ca1..a37c28120 100644
--- a/example/lib/example5_themes_playground/widgets/panels/introduction/introduction_panel.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/introduction/introduction_panel.dart
@@ -31,41 +31,39 @@ class IntroductionPanel extends StatelessWidget {
const ListTile(
subtitle: Text('Use the Themes Playground to try features and themes '
'of FlexColorScheme. Find a scheme you like, experiment '
- 'with surface blends at different levels. See how the AppBar '
+ 'with surface blends at different levels. See how AppBar '
'theme options work. Test the true black option for dark '
'themes, along with computed dark themes.\n'
'\n'
- 'From version 5, the new Material 3 based ColorScheme is '
- 'supported '
- 'and used by built-in schemes. ColorSchemes can also be '
- 'generated using main built-in scheme colors as ColorScheme '
- 'seed keys. You can use primary color as seed key, just '
- 'like in ColorScheme.fromSeed, but you also have more options. '
- 'You can use secondary and tertiary colors, in addition to '
- 'primary, as key colors to seed your dynamic ColorScheme. You '
- 'can even customize the tonal palette generation parameters. '
- 'For branding needs, you can lock selected main colors to their '
- 'defined input values, while other colors are still seed '
- 'generated.\n'
+ 'Material 3 based ColorScheme is supported and used by built-in '
+ 'schemes. ColorSchemes can also be generated using main built-in '
+ 'scheme colors as ColorScheme seed keys. You can use primary '
+ 'color as seed key, like with in ColorScheme.fromSeed, but you '
+ 'also have more options. You can use secondary and tertiary '
+ 'colors, in addition to primary as key colors to seed your '
+ 'dynamic ColorScheme. You can even customize the tonal palette '
+ 'generation parameters. For branding purposes you can lock '
+ 'selected main colors to their defined input values, while other '
+ 'colors are still seed generated.\n'
'\n'
'This application does not adjust any individual widget '
- 'properties, the theme is adjusted interactively and all '
+ 'properties. The theme is adjusted interactively and all '
'Flutter widgets change as the app theme is modified '
'interactively via their controls.\n'
'\n'
'The theming settings and their impact on widgets are shown in '
- 'widget topic panels. The same panels are used on two screens, '
- 'with different layouts. The default one is a page '
- 'view where you see one topic at a time. The second screen is a '
- 'large masonry grid view, where you can if your screen is large '
- 'enough, see many topics at once. With it you can open and close '
- 'topics to view more or less of them at the same time.\n'
+ 'widget topic panels. The same panels are used on two screens '
+ 'with different layouts. The default one is a page view, '
+ 'where you see one topic at a time. The second screen is a '
+ 'large masonry grid view, where you can see many topics at once '
+ 'on large screens. You can open and close topics to view more or '
+ 'fewer of them at the same time.\n'
'\n'
'Both layouts are responsive and work well down to phone sizes. '
- 'If you build it, this app fits and runs nicely at on modern '
+ 'If you build this app, it fits and runs nicely on modern '
'phones. The app is however primarily intended to '
'be used on web based desktop browsers, or as a native Windows, '
- 'Mac or Linux desktop app.'
+ 'Mac or Linux desktop app, where it shines.'
'\n'
'The three first themes in the app are example custom color '
'schemes, made in the tutorials with the API, they are not '
@@ -107,8 +105,8 @@ class IntroductionPanel extends StatelessWidget {
'AppBar, see docs to find out more.\n'
'\n'
'The default sub-theming follows Material Design 3 guideline '
- 'whit its own twists. It is partially still limited '
- 'by Flutter Material 2 based theming designs. '
+ 'with its own twists and implementing it to some extent using '
+ 'Flutter Material 2 based theming capabilities on M2 widgets. '
'Most visible change is the corner radius on Widgets, that '
'depends on Widget type, but also font sizes in the TextTheme.'),
),
@@ -144,14 +142,14 @@ class IntroductionPanel extends StatelessWidget {
const ListTile(
title: Text('Material Design 3'),
subtitle: Text(
- 'The in Flutter 2.10.0 introduced Material 3 ColorScheme is '
- 'used and fully supported. However, many '
- 'components in Flutter 3.0.x do still not use the updated '
+ 'Material 3 ColorScheme is used and fully supported. However, many '
+ 'components in Flutter 3.0 do still not use the updated '
"ColorScheme's new colors by default as specified in M3 guide.\n"
'\n'
'When you enable '
"FlexColorScheme's component sub-themes you get "
- 'a theme that is close to the Material 3 style by default. '
+ 'a theme that is close to the Material 3 style without using the '
+ 'M3 toggle in ThemeData. '
'With the component sub-themes settings you can adjust it further, '
'and e.g. change which ColorScheme color each component uses. '
'This is a convenient way to select and use any ColorScheme based '
@@ -159,21 +157,26 @@ class IntroductionPanel extends StatelessWidget {
"FlexColorScheme's supported component theme customization "
'capabilities.\n'
'\n'
- 'Only some widgets in Flutter 3.0.x implement M3 correctly. '
+ 'Only some widgets in Flutter 3.0 implement M3 correctly. '
'If you disable FlexColorScheme and set '
'"useMaterial3:true" with toggle below, you can see which '
'components currently get the new M3 styling.\n'
'\n'
- 'In Flutter SDK 3.0.x there are Material widget elevation issues '
+ 'In Flutter SDK 3.0 there are Material widget elevation issues '
'if you set "useMaterial3:true". For example Dialogs, Drawers, '
'BottomSheet, PopupMenu and most Material using widgets will not '
'get any elevation when it is used. This is due to a change in the '
'Material elevation behavior when M3 is used. For elevation in M3, '
'Material needs to specify shadowColor, and optionally '
- 'surfaceTintColor. For custom Material widgets you ca do this, but '
- 'SDK widgets using Material that do not yet implement their own '
- 'M3 behaviour, do not do so yet, and do not get any elevation, '
- 'even if they should in M3 design as well.',
+ 'surfaceTintColor. For custom Material widgets you can do this, '
+ 'but SDK widgets using Material that do not yet implement their '
+ 'own M3 behaviour, do not do so yet, and do not get any elevation, '
+ 'even if they should in M3 design as well.\n'
+ '\n'
+ 'When you combine "useMaterial3:true" and FlexColorScheme '
+ 'opinionated component theming, FCS will default some widgets '
+ 'with unspecified property values to its M3 defaults, instead of '
+ 'using its own opinionated default.',
),
),
SwitchListTileAdaptive(
@@ -182,7 +185,7 @@ class IntroductionPanel extends StatelessWidget {
),
subtitle: const Text(
'Sets ThemeData.useMaterial3 to true\n'
- 'WARNING: Has elevation issues in Flutter 3.0.x',
+ 'WARNING: Has elevation issues in Flutter 3.0',
),
value: controller.useMaterial3,
onChanged: controller.setUseMaterial3,
diff --git a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/android_navigation_bar_settings.dart b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/android_navigation_bar_settings.dart
index 1b6df6c2e..02b8687d3 100644
--- a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/android_navigation_bar_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/android_navigation_bar_settings.dart
@@ -112,6 +112,7 @@ class AndroidNavigationBarSettings extends StatelessWidget {
// value: controller.useNavDivider,
// onChanged: controller.setUseNavDivider,
// ),
+ const SizedBox(height: 8),
],
);
}
diff --git a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/bottom_navigation_bar_settings.dart b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/bottom_navigation_bar_settings.dart
index d638a5c27..07b809b98 100644
--- a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/bottom_navigation_bar_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/bottom_navigation_bar_settings.dart
@@ -59,6 +59,7 @@ class BottomNavigationBarSettings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
+ const BottomNavigationBarShowcase(),
ColorSchemePopupMenu(
title: const Text('Background color'),
labelForDefault: 'default (background)',
@@ -203,9 +204,6 @@ class BottomNavigationBarSettings extends StatelessWidget {
? controller.setBottomNavShowUnselectedLabels
: null,
),
- const SizedBox(height: 8),
- const BottomNavigationBarShowcase(),
- const Divider(height: 16),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Text(
@@ -243,7 +241,6 @@ class BottomNavigationBarSettings extends StatelessWidget {
? controller.setUseFlutterDefaults
: null,
),
- const SizedBox(height: 8),
],
);
}
diff --git a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/navigation_bar_settings.dart b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/navigation_bar_settings.dart
index 02085b883..d7a511448 100644
--- a/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/navigation_bar_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/navigation_bar_settings/navigation_bar_settings.dart
@@ -123,6 +123,7 @@ class NavigationBarSettings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
+ const NavigationBarShowcase(),
ColorSchemePopupMenu(
title: const Text('Background color'),
labelForDefault: backgroundColorLabel(),
@@ -348,7 +349,6 @@ class NavigationBarSettings extends StatelessWidget {
: null,
),
),
- const NavigationBarShowcase(),
const Divider(height: 1),
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
diff --git a/example/lib/example5_themes_playground/widgets/panels/seeded_color_scheme/scheme_colors.dart b/example/lib/example5_themes_playground/widgets/panels/seeded_color_scheme/scheme_colors.dart
index 36547cc84..2b21d9676 100644
--- a/example/lib/example5_themes_playground/widgets/panels/seeded_color_scheme/scheme_colors.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/seeded_color_scheme/scheme_colors.dart
@@ -125,7 +125,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: primary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: primary,
onChanged: (Color color) {
if (isLight) {
@@ -173,7 +173,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -197,7 +196,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -210,7 +208,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: primaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: primaryContainer,
onChanged: (Color color) {
if (isLight) {
@@ -262,7 +260,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -313,7 +310,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: secondary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: secondary,
onChanged: (Color color) {
if (isLight) {
@@ -361,7 +358,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -385,7 +381,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -398,7 +393,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: secondaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: secondaryContainer,
onChanged: (Color color) {
if (isLight) {
@@ -454,7 +449,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -505,7 +499,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: tertiary,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: tertiary,
onChanged: (Color color) {
if (isLight) {
@@ -545,7 +539,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -569,7 +562,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -582,7 +574,7 @@ class SchemeColors extends StatelessWidget {
},
child: Material(
color: tertiaryContainer,
- child: ColorPickerInkWell(
+ child: ColorPickerInkWellDialog(
color: tertiaryContainer,
onChanged: (Color color) {
if (isLight) {
@@ -624,7 +616,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -685,7 +676,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -708,7 +698,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -731,7 +720,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -759,7 +747,7 @@ class SchemeColors extends StatelessWidget {
),
),
//
- // Background and shadow colors presentation
+ // Background and surface colors presentation
SizedBox(
width: boxWidth,
height: boxHeight,
@@ -791,7 +779,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -814,34 +801,32 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.outline);
- tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
+ tc.setHoverColor(colorScheme.surface);
+ tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
tc.setHoverColor(null);
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.outline,
+ color: colorScheme.surface,
child: ColorNameValue(
- color: colorScheme.outline,
- textColor: _onColor(colorScheme.outline),
- label: 'outline',
- tone: tones.outlineTone,
+ color: colorScheme.surface,
+ textColor: colorScheme.onSurface,
+ label: 'surface',
+ tone: tones.surfaceTone,
showTone: showTones,
),
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.shadow);
+ tc.setHoverColor(colorScheme.onSurface);
tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
@@ -849,12 +834,12 @@ class SchemeColors extends StatelessWidget {
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.shadow,
+ color: colorScheme.onSurface,
child: ColorNameValue(
- color: colorScheme.shadow,
- textColor: _onColor(colorScheme.shadow),
- label: 'shadow',
- tone: tones.shadowTone,
+ color: colorScheme.onSurface,
+ textColor: colorScheme.surface,
+ label: 'onSurface',
+ tone: tones.onSurfaceTone,
showTone: showTones,
),
),
@@ -865,7 +850,7 @@ class SchemeColors extends StatelessWidget {
),
),
//
- // Surface colors presentation
+ // SurfaceVariant and inverseSurface colors presentation
SizedBox(
width: boxWidth,
height: boxHeight,
@@ -878,43 +863,42 @@ class SchemeColors extends StatelessWidget {
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.surface);
- tc.setHoverTonalPalette(TonalPalettes.neutral);
+ tc.setHoverColor(colorScheme.surfaceVariant);
+ tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
},
onExit: (PointerEvent details) {
tc.setHoverColor(null);
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.surface,
+ color: colorScheme.surfaceVariant,
child: ColorNameValue(
- color: colorScheme.surface,
- textColor: colorScheme.onSurface,
- label: 'surface',
- tone: tones.surfaceTone,
+ color: colorScheme.surfaceVariant,
+ textColor: colorScheme.onSurfaceVariant,
+ label: 'surfaceVariant',
+ tone: tones.surfaceVariantTone,
showTone: showTones,
),
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.onSurface);
- tc.setHoverTonalPalette(TonalPalettes.neutral);
+ tc.setHoverColor(colorScheme.onSurfaceVariant);
+ tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
},
onExit: (PointerEvent details) {
tc.setHoverColor(null);
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.onSurface,
+ color: colorScheme.onSurfaceVariant,
child: ColorNameValue(
- color: colorScheme.onSurface,
- textColor: colorScheme.surface,
- label: 'onSurface',
- tone: tones.onSurfaceTone,
+ color: colorScheme.onSurfaceVariant,
+ textColor: colorScheme.surfaceVariant,
+ label: 'onSurfaceVariant',
+ tone: tones.onSurfaceVariantTone,
showTone: showTones,
),
),
@@ -924,43 +908,42 @@ class SchemeColors extends StatelessWidget {
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.surfaceVariant);
- tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
+ tc.setHoverColor(colorScheme.inverseSurface);
+ tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
tc.setHoverColor(null);
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.surfaceVariant,
+ color: colorScheme.inverseSurface,
child: ColorNameValue(
- color: colorScheme.surfaceVariant,
- textColor: colorScheme.onSurfaceVariant,
- label: 'surfaceVariant',
- tone: tones.surfaceVariantTone,
+ color: colorScheme.inverseSurface,
+ textColor: colorScheme.onInverseSurface,
+ label: 'inverseSurface',
+ tone: tones.inverseSurfaceTone,
showTone: showTones,
),
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.onSurfaceVariant);
- tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
+ tc.setHoverColor(colorScheme.onInverseSurface);
+ tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
tc.setHoverColor(null);
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.onSurfaceVariant,
+ color: colorScheme.onInverseSurface,
child: ColorNameValue(
- color: colorScheme.onSurfaceVariant,
- textColor: colorScheme.surfaceVariant,
- label: 'onSurfaceVariant',
- tone: tones.onSurfaceVariantTone,
+ color: colorScheme.onInverseSurface,
+ textColor: colorScheme.inverseSurface,
+ label: 'onInverseSurface',
+ tone: tones.onInverseSurfaceTone,
showTone: showTones,
),
),
@@ -971,7 +954,7 @@ class SchemeColors extends StatelessWidget {
),
),
//
- // Inverse colors presentation
+ // Outline, OutlineVariant, shadow and scrim colors presentation
SizedBox(
width: boxWidth,
height: boxHeight,
@@ -984,7 +967,51 @@ class SchemeColors extends StatelessWidget {
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.inverseSurface);
+ tc.setHoverColor(colorScheme.outline);
+ tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
+ },
+ onExit: (PointerEvent details) {
+ tc.setHoverColor(null);
+ tc.setHoverTonalPalette(null);
+ },
+ child: Material(
+ color: colorScheme.outline,
+ child: ColorNameValue(
+ color: colorScheme.outline,
+ textColor: _onColor(colorScheme.outline),
+ label: 'outline',
+ tone: tones.outlineTone,
+ showTone: showTones,
+ ),
+ ),
+ ),
+ ),
+ Expanded(
+ child: MouseRegion(
+ onEnter: (PointerEvent details) {
+ tc.setHoverColor(colorScheme.outlineVariant);
+ tc.setHoverTonalPalette(TonalPalettes.neutralVariant);
+ },
+ onExit: (PointerEvent details) {
+ tc.setHoverColor(null);
+ tc.setHoverTonalPalette(null);
+ },
+ child: Material(
+ color: colorScheme.outlineVariant,
+ child: ColorNameValue(
+ color: colorScheme.outline,
+ textColor: _onColor(colorScheme.outlineVariant),
+ label: 'outlineVariant',
+ tone: tones.outlineVariantTone,
+ showTone: showTones,
+ ),
+ ),
+ ),
+ ),
+ Expanded(
+ child: MouseRegion(
+ onEnter: (PointerEvent details) {
+ tc.setHoverColor(colorScheme.shadow);
tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
@@ -992,22 +1019,36 @@ class SchemeColors extends StatelessWidget {
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.inverseSurface,
+ color: colorScheme.shadow,
child: ColorNameValue(
- color: colorScheme.inverseSurface,
- textColor: colorScheme.onInverseSurface,
- label: 'inverseSurface',
- tone: tones.inverseSurfaceTone,
+ color: colorScheme.shadow,
+ textColor: _onColor(colorScheme.shadow),
+ label: 'shadow',
+ tone: tones.shadowTone,
showTone: showTones,
),
),
),
),
- const Divider(height: 1, thickness: 1),
+ ],
+ ),
+ ),
+ ),
+ //
+ // Inverse colors presentation NEW
+ SizedBox(
+ width: boxWidth,
+ height: boxHeight,
+ child: Card(
+ margin: EdgeInsets.zero,
+ elevation: 0,
+ clipBehavior: Clip.antiAlias,
+ child: Column(
+ children: [
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
- tc.setHoverColor(colorScheme.onInverseSurface);
+ tc.setHoverColor(colorScheme.scrim);
tc.setHoverTonalPalette(TonalPalettes.neutral);
},
onExit: (PointerEvent details) {
@@ -1015,18 +1056,17 @@ class SchemeColors extends StatelessWidget {
tc.setHoverTonalPalette(null);
},
child: Material(
- color: colorScheme.onInverseSurface,
+ color: colorScheme.scrim,
child: ColorNameValue(
- color: colorScheme.onInverseSurface,
- textColor: colorScheme.inverseSurface,
- label: 'onInverseSurface',
- tone: tones.onInverseSurfaceTone,
+ color: colorScheme.scrim,
+ textColor: _onColor(colorScheme.scrim),
+ label: 'scrim',
+ tone: tones.scrimTone,
showTone: showTones,
),
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
@@ -1049,7 +1089,6 @@ class SchemeColors extends StatelessWidget {
),
),
),
- const Divider(height: 1, thickness: 1),
Expanded(
child: MouseRegion(
onEnter: (PointerEvent details) {
diff --git a/example/lib/example5_themes_playground/widgets/panels/showcase_panels/effective_colors.dart b/example/lib/example5_themes_playground/widgets/panels/showcase_panels/effective_colors.dart
index e3c6d02bc..192633316 100644
--- a/example/lib/example5_themes_playground/widgets/panels/showcase_panels/effective_colors.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/showcase_panels/effective_colors.dart
@@ -33,7 +33,7 @@ class EffectiveColors extends StatelessWidget {
const ListTile(
dense: true,
subtitle: Text('The effective ColorScheme colors '
- 'are presented in the order they appear in the '
+ 'are presented above in the order they appear in the '
'ColorScheme class. Deprecated colors primaryVariant and '
'secondaryVariant are excluded.'),
),
@@ -65,14 +65,18 @@ class EffectiveColors extends StatelessWidget {
),
const ListTile(
dense: true,
- subtitle: Text('ThemeData colors are still important in Flutter 2.10 '
- 'and earlier. Many widgets still depend on them for '
+ subtitle: Text('Above ThemeData colors are still important in '
+ 'Flutter 3.0 and earlier. Many widgets still depend on them for '
'their default colors. FlexColorScheme keeps them in sync '
- 'with ColorScheme, to produce an app with consistent colors '
+ 'with ColorScheme to produce an app with consistent colors '
'on all widgets. It will do so as long as the colors exist '
- 'in ThemeData. If you switch to dark mode and toggle '
- 'FlexColorScheme ON/OFF, you can see that many colors in '
- 'ThemeData loose their relation to active ColorScheme.'),
+ 'in ThemeData. If you turn FlexColorScheme OFF, you can see '
+ 'that the colors in ThemeData loose their relation to active '
+ 'ColorScheme. Widgets in the SDK that still get their default '
+ 'colors from these ThemeData color properties will then no '
+ 'longer get ColorScheme based colors. FlexColorScheme assigns '
+ 'correct ColorScheme based colors to still relevant ThemeData '
+ 'colors.'),
),
const Padding(
padding: EdgeInsets.fromLTRB(16, 0, 16, 16),
diff --git a/example/lib/example5_themes_playground/widgets/panels/surface_blends/surface_blends.dart b/example/lib/example5_themes_playground/widgets/panels/surface_blends/surface_blends.dart
index 80034434f..faab4af1c 100644
--- a/example/lib/example5_themes_playground/widgets/panels/surface_blends/surface_blends.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/surface_blends/surface_blends.dart
@@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import '../../../../shared/controllers/theme_controller.dart';
import '../../../../shared/widgets/universal/switch_list_tile_adaptive.dart';
import '../../shared/color_picker_inkwell.dart';
-import '../../shared/color_scheme_popup_menu.dart';
+import '../../shared/color_scheme_box.dart';
import 'surface_mode_buttons.dart';
// Panel used to define how primary color is blended into surfaces and
@@ -93,7 +93,7 @@ class SurfaceBlends extends StatelessWidget {
title: Text('Blended surfaces and backgrounds'),
isThreeLine: true,
subtitle: Text(
- 'Material Design 2 guide briefly mentions using surfaces with '
+ 'Material Design 2 guide mentions using surfaces with '
'primary color alpha blends. FlexColorScheme surface blends '
'implements it.\n'
'\n'
@@ -139,7 +139,7 @@ class SurfaceBlends extends StatelessWidget {
controller.setSurfaceTintLight(null);
},
),
- ColorPickerInkWell(
+ ColorPickerInkWellDialog(
color: controller.surfaceTintLight ?? colorScheme.primary,
onChanged: controller.setSurfaceTintLight,
recentColors: controller.recentColors,
@@ -164,7 +164,7 @@ class SurfaceBlends extends StatelessWidget {
title: Text('Light theme blend level'),
subtitle: Text('Adjust the surface, background, scaffold and '
'dialog blend level. Also impacts surfaces when '
- 'seed colors are used. Seed based surfaces already include '
+ 'seed colors are used. Seed based surfaces always include '
'a touch of primary, but you can make it stronger with '
'surface blends'),
),
@@ -200,28 +200,37 @@ class SurfaceBlends extends StatelessWidget {
),
),
ListTile(
- enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ enabled: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
title: const Text('Light theme onColors blend level'),
- subtitle: const Text('When seed colors are not used, this affects '
- 'onContainers, onSurface and onBackground, plus main '
- 'onColors when the onColor blending switch is ON'),
+ subtitle: const Text('The onColor blending mixes in its own color, '
+ 'into the onColor, when seed/M3 colors are not used. This '
+ 'affects onContainers, onSurface and onBackground. When the '
+ 'main onColor blending switch is ON, it also affects on colors '
+ 'for primary, secondary, tertiary and error.'),
),
ListTile(
- enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ enabled: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
title: Slider.adaptive(
min: 0,
max: 40,
divisions: 40,
label: controller.blendOnLevel.toString(),
- value: controller.useSubThemes && controller.useFlexColorScheme
+ value: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
? controller.blendOnLevel.toDouble()
: 0,
- onChanged:
- controller.useSubThemes && controller.useFlexColorScheme
- ? (double value) {
- controller.setBlendOnLevel(value.toInt());
- }
- : null,
+ onChanged: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
+ ? (double value) {
+ controller.setBlendOnLevel(value.toInt());
+ }
+ : null,
),
trailing: Padding(
padding: const EdgeInsetsDirectional.only(end: 12),
@@ -234,7 +243,7 @@ class SurfaceBlends extends StatelessWidget {
),
Text(
// ignore: lines_longer_than_80_chars
- '${controller.useSubThemes && controller.useFlexColorScheme ? controller.blendOnLevel : ""}',
+ '${controller.useSubThemes && controller.useFlexColorScheme && !controller.useKeyColors ? controller.blendOnLevel : ""}',
style: Theme.of(context)
.textTheme
.caption!
@@ -254,8 +263,11 @@ class SurfaceBlends extends StatelessWidget {
'colors are not used'),
value: controller.blendLightOnColors &&
controller.useSubThemes &&
- controller.useFlexColorScheme,
- onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
+ onChanged: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
? controller.setBlendLightOnColors
: null,
),
@@ -302,7 +314,7 @@ class SurfaceBlends extends StatelessWidget {
controller.setSurfaceTintDark(null);
},
),
- ColorPickerInkWell(
+ ColorPickerInkWellDialog(
color: controller.surfaceTintDark ?? colorScheme.primary,
onChanged: controller.setSurfaceTintDark,
recentColors: controller.recentColors,
@@ -363,28 +375,37 @@ class SurfaceBlends extends StatelessWidget {
),
),
ListTile(
- enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ enabled: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
title: const Text('Dark theme onColors blend level'),
- subtitle: const Text('When seed colors are not used, this affects '
- 'onContainers, onSurface and onBackground, plus main '
- 'onColors when the onColor blending switch is ON'),
+ subtitle: const Text('The onColor blending mixes in its own color, '
+ 'into the onColor, when seed/M3 colors are not used. This '
+ 'affects onContainers, onSurface and onBackground. When the '
+ 'main onColor blending switch is ON, it also affects on colors '
+ 'for primary, secondary, tertiary and error.'),
),
ListTile(
- enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ enabled: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
title: Slider.adaptive(
min: 0,
max: 40,
divisions: 40,
label: controller.blendOnLevelDark.toString(),
- value: controller.useSubThemes && controller.useFlexColorScheme
+ value: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
? controller.blendOnLevelDark.toDouble()
: 0,
- onChanged:
- controller.useSubThemes && controller.useFlexColorScheme
- ? (double value) {
- controller.setBlendOnLevelDark(value.toInt());
- }
- : null,
+ onChanged: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
+ ? (double value) {
+ controller.setBlendOnLevelDark(value.toInt());
+ }
+ : null,
),
trailing: Padding(
padding: const EdgeInsetsDirectional.only(end: 12),
@@ -397,7 +418,7 @@ class SurfaceBlends extends StatelessWidget {
),
Text(
// ignore: lines_longer_than_80_chars
- '${controller.useSubThemes && controller.useFlexColorScheme ? controller.blendOnLevelDark : ""}',
+ '${controller.useSubThemes && controller.useFlexColorScheme && !controller.useKeyColors ? controller.blendOnLevelDark : ""}',
style: Theme.of(context)
.textTheme
.caption!
@@ -417,8 +438,11 @@ class SurfaceBlends extends StatelessWidget {
'are not used'),
value: controller.blendDarkOnColors &&
controller.useSubThemes &&
- controller.useFlexColorScheme,
- onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors,
+ onChanged: controller.useSubThemes &&
+ controller.useFlexColorScheme &&
+ !controller.useKeyColors
? controller.setBlendDarkOnColors
: null,
),
diff --git a/example/lib/example5_themes_playground/widgets/panels/switch_settings/switch_settings.dart b/example/lib/example5_themes_playground/widgets/panels/switch_settings/switch_settings.dart
index b9cc12bb8..69a945c77 100644
--- a/example/lib/example5_themes_playground/widgets/panels/switch_settings/switch_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/switch_settings/switch_settings.dart
@@ -25,17 +25,10 @@ class SwitchesSettings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
- SwitchListTileAdaptive(
- title: const Text('Unselected toggle color'),
- subtitle: const Text('ON: Use theme color OFF: default grey'),
- value: controller.unselectedToggleIsColored &&
- controller.useSubThemes &&
- controller.useFlexColorScheme,
- onChanged: controller.useSubThemes && controller.useFlexColorScheme
- ? controller.setUnselectedToggleIsColored
- : null,
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ child: SwitchShowcase(),
),
- const Divider(height: 1),
ColorSchemePopupMenu(
title: const Text('Switch color'),
labelForDefault: labelForDefaultColor,
@@ -50,11 +43,12 @@ class SwitchesSettings extends StatelessWidget {
}
: null,
),
+ const Divider(height: 1),
+ const SizedBox(height: 8),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
- child: SwitchShowcase(),
+ child: CheckboxShowcase(),
),
- const Divider(height: 1),
ColorSchemePopupMenu(
title: const Text('Checkbox color'),
labelForDefault: labelForDefaultColor,
@@ -70,11 +64,12 @@ class SwitchesSettings extends StatelessWidget {
}
: null,
),
+ const Divider(height: 1),
+ const SizedBox(height: 8),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
- child: CheckboxShowcase(),
+ child: RadioShowcase(),
),
- const Divider(height: 1),
ColorSchemePopupMenu(
title: const Text('Radio color'),
labelForDefault: labelForDefaultColor,
@@ -89,11 +84,19 @@ class SwitchesSettings extends StatelessWidget {
}
: null,
),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16),
- child: RadioShowcase(),
+
+ // const SizedBox(height: 8),
+ const Divider(height: 1),
+ SwitchListTileAdaptive(
+ title: const Text('Unselected toggle color'),
+ subtitle: const Text('ON: Use theme color OFF: default grey'),
+ value: controller.unselectedToggleIsColored &&
+ controller.useSubThemes &&
+ controller.useFlexColorScheme,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.setUnselectedToggleIsColored
+ : null,
),
- const SizedBox(height: 8),
],
);
}
diff --git a/example/lib/example5_themes_playground/widgets/panels/tab_bar_settings/tab_bar_settings.dart b/example/lib/example5_themes_playground/widgets/panels/tab_bar_settings/tab_bar_settings.dart
index a295c7104..b1661aac6 100644
--- a/example/lib/example5_themes_playground/widgets/panels/tab_bar_settings/tab_bar_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/tab_bar_settings/tab_bar_settings.dart
@@ -36,6 +36,15 @@ class TabBarSettings extends StatelessWidget {
final bool isLight = theme.brightness == Brightness.light;
return Column(
children: [
+ const SizedBox(height: 8),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ child: TabBarForAppBarShowcase(),
+ ),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ child: TabBarForBackgroundShowcase(),
+ ),
const SizedBox(height: 8),
ListTile(
enabled: controller.useFlexColorScheme,
@@ -56,17 +65,6 @@ class TabBarSettings extends StatelessWidget {
: null,
),
),
- const SizedBox(height: 8),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16),
- child: TabBarForAppBarShowcase(),
- ),
- const Padding(
- padding: EdgeInsets.symmetric(horizontal: 16),
- child: TabBarForBackgroundShowcase(),
- ),
- const SizedBox(height: 8),
- const Divider(),
const ListTile(
title: Text('Custom colors'),
subtitle: Text('With component themes enabled you can select '
diff --git a/example/lib/example5_themes_playground/widgets/panels/text_field_settings/text_field_settings.dart b/example/lib/example5_themes_playground/widgets/panels/text_field_settings/text_field_settings.dart
index 657c6fe12..aea9b4def 100644
--- a/example/lib/example5_themes_playground/widgets/panels/text_field_settings/text_field_settings.dart
+++ b/example/lib/example5_themes_playground/widgets/panels/text_field_settings/text_field_settings.dart
@@ -23,10 +23,19 @@ class TextFieldSettings extends StatelessWidget {
controller.defaultRadius != null
? 'global ${controller.defaultRadius!.toStringAsFixed(0)}'
: '';
+
+ final bool? isFilled =
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.inputDecoratorIsFilled
+ : null;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SizedBox(height: 8),
+ // const SizedBox(height: 8),
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: TextInputField(filled: isFilled),
+ ),
if (isLight)
ColorSchemePopupMenu(
title: const Text('Light theme TextField color base'),
@@ -172,9 +181,114 @@ class TextFieldSettings extends StatelessWidget {
? controller.setInputDecoratorUnfocusedBorderIsColored
: null,
),
- const Padding(
- padding: EdgeInsets.all(16),
- child: TextInputField(),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('Unfocused border width'),
+ subtitle: const Text('Setting shared with OutlinedButton and '
+ 'ToggleButtons'),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: Slider.adaptive(
+ min: -0.5,
+ max: 5,
+ divisions: 11,
+ label: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ?? '')
+ : 'default 1',
+ value: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth ?? -0.5
+ : -0.5,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setThinBorderWidth(value < 0 ? null : value);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ 'WIDTH',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thinBorderWidth == null ||
+ (controller.thinBorderWidth ?? -0.5) < 0
+ ? controller.useMaterial3
+ ? 'default 1'
+ : 'default 1.5'
+ : (controller.thinBorderWidth?.toStringAsFixed(1) ??
+ '')
+ : 'default 1',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: const Text('Focused border width'),
+ subtitle: const Text('Setting shared with pressed OutlinedButton'),
+ ),
+ ListTile(
+ enabled: controller.useSubThemes && controller.useFlexColorScheme,
+ title: Slider.adaptive(
+ min: -0.5,
+ max: 5,
+ divisions: 11,
+ label: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth == null ||
+ (controller.thickBorderWidth ?? -0.5) < 0
+ ? 'default 2'
+ : (controller.thickBorderWidth?.toStringAsFixed(1) ?? '')
+ : 'default 2',
+ value: controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth ?? -0.5
+ : -0.5,
+ onChanged: controller.useSubThemes && controller.useFlexColorScheme
+ ? (double value) {
+ controller.setThickBorderWidth(value < 0 ? null : value);
+ }
+ : null,
+ ),
+ trailing: Padding(
+ padding: const EdgeInsetsDirectional.only(end: 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ 'WIDTH',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ Text(
+ controller.useSubThemes && controller.useFlexColorScheme
+ ? controller.thickBorderWidth == null ||
+ (controller.thickBorderWidth ?? -0.5) < 0
+ ? 'default 2'
+ : (controller.thickBorderWidth?.toStringAsFixed(1) ??
+ '')
+ : 'default 2',
+ style: Theme.of(context)
+ .textTheme
+ .caption!
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ ],
+ ),
+ ),
),
],
);
diff --git a/example/lib/example5_themes_playground/widgets/shared/color_name_value.dart b/example/lib/example5_themes_playground/widgets/shared/color_name_value.dart
index 11d8f6977..1e28458d6 100644
--- a/example/lib/example5_themes_playground/widgets/shared/color_name_value.dart
+++ b/example/lib/example5_themes_playground/widgets/shared/color_name_value.dart
@@ -99,7 +99,7 @@ class _ColorNameValueState extends State {
children: [
Expanded(
child: Text(
- 'Tone ${widget.tone.toString()}',
+ 'Tone ${widget.tone}',
overflow: TextOverflow.clip,
textAlign: TextAlign.end,
maxLines: 1,
diff --git a/example/lib/example5_themes_playground/widgets/shared/color_picker_inkwell.dart b/example/lib/example5_themes_playground/widgets/shared/color_picker_inkwell.dart
index ec1b7e2de..74830c486 100644
--- a/example/lib/example5_themes_playground/widgets/shared/color_picker_inkwell.dart
+++ b/example/lib/example5_themes_playground/widgets/shared/color_picker_inkwell.dart
@@ -2,15 +2,17 @@ import 'package:flex_color_picker/flex_color_picker.dart';
import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/material.dart';
-/// A [ColorPicker] that shows a dialog, when a child, normally Material
-/// is wrapped in an InkWell.
+/// An [InkWell] that when tapped shows [ColorPicker.showPickerDialog] when
+/// tapped.
///
/// It uses a stateless color InkWell. Clicking on it allows the user to
-/// change the color using a custom
-/// [ColorPicker] package via a dialog. The indicator has an onChanged
-/// callback that can be used to follow the changes of the color in the
-/// dialog as user tries different colors. If the users closes the dialog
-/// via cancel or barrier dismiss, the wasCancelled returns true.
+/// change the color using the [ColorPicker] package with its built-in dialog.
+///
+/// The widget has an onChanged callback that can be used to follow the changes
+/// of the color in the dialog as user tries different colors.
+///
+/// If the users closes the dialog via cancel or barrier dismiss, the
+/// wasCancelled returns true.
/// This widget is stateless so it will be up to the user of this
/// widget to hold state and return the color to the state it had
/// when dialog was opened, if so desired.
@@ -20,8 +22,12 @@ import 'package:flutter/material.dart';
/// the application and allow it to rebuild the theme of the entire app and the
/// screens of the context that opened the dialog. Since the dialog is stateless
/// it can be kept open even though the app under it is being rebuilt.
-class ColorPickerInkWell extends StatelessWidget {
- const ColorPickerInkWell({
+/// It on purpose uses its stale context and can stay open, however any color
+/// theme changes will only apply to a new dialog, it will not affect the open
+/// dialog itself. The application and widgets visible below the dialog is
+/// however changing as colors are manipulated from the color picker dialog.
+class ColorPickerInkWellDialog extends StatelessWidget {
+ const ColorPickerInkWellDialog({
super.key,
required this.color,
required this.onChanged,
@@ -222,7 +228,78 @@ class ColorPickerInkWell extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final bool isLight = Theme.of(context).brightness == Brightness.light;
+ final ThemeData theme = Theme.of(context);
+ final bool isLight = theme.brightness == Brightness.light;
+
+ // Make the picker using current theme, this will not change after
+ // the picker dialog is opened.
+ final ColorPicker colorPicker = ColorPicker(
+ color: color,
+ onColorChanged: onChanged,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ padding: const EdgeInsets.symmetric(
+ vertical: 8,
+ horizontal: 16,
+ ),
+ enableShadesSelection: true,
+ enableTonalPalette: true,
+ width: 35,
+ height: 35,
+ spacing: 2,
+ runSpacing: 2,
+ elevation: 0,
+ hasBorder: true,
+ borderRadius: 4,
+ wheelDiameter: 195,
+ wheelHasBorder: false,
+ pickersEnabled: const {
+ ColorPickerType.both: false,
+ ColorPickerType.primary: true,
+ ColorPickerType.accent: true,
+ ColorPickerType.bw: false,
+ ColorPickerType.custom: true,
+ ColorPickerType.wheel: true,
+ },
+ pickerTypeLabels: const {
+ ColorPickerType.primary: 'Primary',
+ ColorPickerType.accent: 'Accent',
+ ColorPickerType.bw: 'B&W',
+ ColorPickerType.both: 'Both',
+ ColorPickerType.custom: 'FlexColor',
+ ColorPickerType.wheel: 'Any',
+ },
+ maxRecentColors: 9,
+ recentColors: recentColors,
+ onRecentColorsChanged: onRecentColorsChanged,
+ title: Text('Select Color', style: theme.textTheme.titleLarge),
+ subheading: Text('Select color shade', style: theme.textTheme.bodyLarge),
+ wheelSubheading: Text('Selected color and its shades',
+ style: theme.textTheme.bodyLarge),
+ recentColorsSubheading:
+ Text('Recent colors', style: theme.textTheme.bodyLarge),
+ selectedPickerTypeColor: theme.colorScheme.primary,
+ showMaterialName: true,
+ showColorName: true,
+ showColorCode: true,
+ colorCodeHasColor: true,
+ customColorSwatchesAndNames: isLight
+ ? ColorPickerInkWellDialog._lightSwatches
+ : ColorPickerInkWellDialog._darkSwatches,
+ copyPasteBehavior: const ColorPickerCopyPasteBehavior(
+ longPressMenu: true,
+ editUsesParsedPaste: true,
+ copyButton: true,
+ pasteButton: true,
+ copyFormat: ColorPickerCopyFormat.dartCode,
+ ),
+ actionButtons: const ColorPickerActionButtons(
+ closeButton: true,
+ okButton: true,
+ dialogActionButtons: false,
+ closeTooltipIsClose: false,
+ ),
+ showRecentColors: true,
+ );
return InkWell(
onHover: (bool value) {
@@ -230,74 +307,8 @@ class ColorPickerInkWell extends StatelessWidget {
},
onTap: enabled
? () async {
- if (await ColorPicker(
- color: color,
- onColorChanged: onChanged,
- crossAxisAlignment: CrossAxisAlignment.center,
- padding: const EdgeInsets.symmetric(
- vertical: 8,
- horizontal: 16,
- ),
- enableShadesSelection: true,
- enableTonalPalette: true,
- width: 35,
- height: 35,
- spacing: 2,
- runSpacing: 2,
- elevation: 0,
- hasBorder: true,
- borderRadius: 4,
- wheelDiameter: 195,
- wheelHasBorder: false,
- pickersEnabled: const {
- ColorPickerType.both: false,
- ColorPickerType.primary: true,
- ColorPickerType.accent: true,
- ColorPickerType.bw: false,
- ColorPickerType.custom: true,
- ColorPickerType.wheel: true,
- },
- pickerTypeLabels: const {
- ColorPickerType.primary: 'Primary',
- ColorPickerType.accent: 'Accent',
- ColorPickerType.bw: 'B&W',
- ColorPickerType.both: 'Both',
- ColorPickerType.custom: 'FlexColor',
- ColorPickerType.wheel: 'Any',
- },
- maxRecentColors: 9,
- recentColors: recentColors,
- onRecentColorsChanged: onRecentColorsChanged,
- title: Text('Select Color',
- style: Theme.of(context).textTheme.titleLarge),
- subheading: Text('Select color shade',
- style: Theme.of(context).textTheme.bodyLarge),
- wheelSubheading: Text('Selected color and its shades',
- style: Theme.of(context).textTheme.bodyLarge),
- recentColorsSubheading: Text('Recent colors',
- style: Theme.of(context).textTheme.bodyLarge),
- selectedPickerTypeColor: Theme.of(context).colorScheme.primary,
- showMaterialName: true,
- showColorName: true,
- showColorCode: true,
- colorCodeHasColor: true,
- customColorSwatchesAndNames:
- isLight ? _lightSwatches : _darkSwatches,
- copyPasteBehavior: const ColorPickerCopyPasteBehavior(
- longPressMenu: true,
- editUsesParsedPaste: true,
- copyButton: true,
- pasteButton: true,
- copyFormat: ColorPickerCopyFormat.dartCode,
- ),
- actionButtons: const ColorPickerActionButtons(
- closeButton: true,
- okButton: true,
- dialogActionButtons: false,
- closeTooltipIsClose: false,
- ),
- showRecentColors: true,
- ).showPickerDialog(
+ // ignore: use_build_context_synchronously
+ if (await colorPicker.showPickerDialog(
context,
insetPadding: const EdgeInsets.all(16),
barrierColor: Colors.black.withOpacity(0.05),
diff --git a/example/lib/example5_themes_playground/widgets/shared/color_scheme_box.dart b/example/lib/example5_themes_playground/widgets/shared/color_scheme_box.dart
new file mode 100644
index 000000000..87ec25e22
--- /dev/null
+++ b/example/lib/example5_themes_playground/widgets/shared/color_scheme_box.dart
@@ -0,0 +1,50 @@
+import 'package:flex_color_scheme/flex_color_scheme.dart';
+import 'package:flutter/material.dart';
+
+/// Widget used to display a colored box used in PopupMenus.
+///
+/// It has a palette icon fo none default color, and a texture icon representing
+/// the default unknown color.
+class ColorSchemeBox extends StatelessWidget {
+ const ColorSchemeBox({
+ super.key,
+ this.color = Colors.white,
+ this.size = const Size(45, 35),
+ this.defaultColor = false,
+ });
+
+ final Color color;
+ final Size size;
+ final bool defaultColor;
+
+ // Return true if the color is light, meaning it needs dark text for contrast.
+ static bool _isLight(final Color color) =>
+ FlexSchemeOnColors.estimateErrorBrightness(color) == Brightness.light;
+
+ // On color used when a theme color property does not have a theme onColor.
+ static Color _onColor(final Color color) => _isLight(color)
+ ? Colors.black.withOpacity(0.4)
+ : Colors.white.withOpacity(0.4);
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: size.width,
+ height: size.height,
+ child: Material(
+ color: color,
+ elevation: 0,
+ shape: RoundedRectangleBorder(
+ borderRadius: const BorderRadius.all(Radius.circular(12)),
+ side: BorderSide(
+ color: Theme.of(context).dividerColor,
+ width: 1,
+ ),
+ ),
+ child: defaultColor
+ ? Icon(Icons.texture_outlined, color: _onColor(color))
+ : Icon(Icons.palette_outlined, color: _onColor(color)),
+ ),
+ );
+ }
+}
diff --git a/example/lib/example5_themes_playground/widgets/shared/color_scheme_popup_menu.dart b/example/lib/example5_themes_playground/widgets/shared/color_scheme_popup_menu.dart
index 6329a0d65..56162f30c 100644
--- a/example/lib/example5_themes_playground/widgets/shared/color_scheme_popup_menu.dart
+++ b/example/lib/example5_themes_playground/widgets/shared/color_scheme_popup_menu.dart
@@ -1,6 +1,8 @@
import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/material.dart';
+import 'color_scheme_box.dart';
+
/// Widget used to select a ColorScheme based colors in example 5.
///
/// Uses index out out of range of [SchemeColor] to represent and select
@@ -32,7 +34,7 @@ class ColorSchemePopupMenu extends StatelessWidget {
final ColorScheme colorScheme = theme.colorScheme;
final TextStyle txtStyle = theme.textTheme.labelLarge!;
final bool enabled = onChanged != null;
- // Negative value, or index covering the the last two in th enum,
+ // Negative value, or index covering the last two in the enum,
// the deprecated primaryVariant and secondaryVariant are considered as
// null and default value.
final bool useDefault = index < 0 || index >= SchemeColor.values.length - 2;
@@ -100,47 +102,3 @@ class ColorSchemePopupMenu extends StatelessWidget {
);
}
}
-
-class ColorSchemeBox extends StatelessWidget {
- const ColorSchemeBox({
- super.key,
- this.color = Colors.white,
- this.size = const Size(45, 35),
- this.defaultColor = false,
- });
-
- final Color color;
- final Size size;
- final bool defaultColor;
-
- // Return true if the color is light, meaning it needs dark text for contrast.
- static bool _isLight(final Color color) =>
- FlexSchemeOnColors.estimateErrorBrightness(color) == Brightness.light;
-
- // On color used when a theme color property does not have a theme onColor.
- static Color _onColor(final Color color) => _isLight(color)
- ? Colors.black.withOpacity(0.4)
- : Colors.white.withOpacity(0.4);
-
- @override
- Widget build(BuildContext context) {
- return SizedBox(
- width: size.width,
- height: size.height,
- child: Material(
- color: color,
- elevation: 0,
- shape: RoundedRectangleBorder(
- borderRadius: const BorderRadius.all(Radius.circular(12)),
- side: BorderSide(
- color: Theme.of(context).dividerColor,
- width: 1,
- ),
- ),
- child: defaultColor
- ? Icon(Icons.texture_outlined, color: _onColor(color))
- : Icon(Icons.palette_outlined, color: _onColor(color)),
- ),
- );
- }
-}
diff --git a/example/lib/example_copy_paste_from_playground/main.dart b/example/lib/example_copy_paste_from_playground/main.dart
index e03e2dc0b..4a689ba30 100644
--- a/example/lib/example_copy_paste_from_playground/main.dart
+++ b/example/lib/example_copy_paste_from_playground/main.dart
@@ -38,10 +38,10 @@ class _DemoAppState extends State {
// Material Design 2 color scheme, uncomment and use the theme setup below
// and comment the copy-pasted themes further below,
theme: ThemeData.from(colorScheme: const ColorScheme.light()).copyWith(
- typography: Typography.material2018(platform: defaultTargetPlatform),
+ typography: Typography.material2021(platform: defaultTargetPlatform),
),
darkTheme: ThemeData.from(colorScheme: const ColorScheme.dark()).copyWith(
- typography: Typography.material2018(platform: defaultTargetPlatform),
+ typography: Typography.material2021(platform: defaultTargetPlatform),
),
// This is where you would put a copy-pasted theme definition from
@@ -99,10 +99,10 @@ class _DemoAppState extends State {
// FlexThemeData extensions and opinionated component themes.
// theme: ThemeData.from(colorScheme: flexSchemeLight).copyWith(
- // typography: Typography.material2018(platform: defaultTargetPlatform),
+ // typography: Typography.material2021(platform: defaultTargetPlatform),
// ),
// darkTheme: ThemeData.from(colorScheme: flexSchemeDark).copyWith(
- // typography: Typography.material2018(platform: defaultTargetPlatform),
+ // typography: Typography.material2021(platform: defaultTargetPlatform),
// ),
// ThemeMode toggle via callback
diff --git a/example/lib/shared/const/app_data.dart b/example/lib/shared/const/app_data.dart
index 168c9e822..24858955f 100644
--- a/example/lib/shared/const/app_data.dart
+++ b/example/lib/shared/const/app_data.dart
@@ -34,9 +34,9 @@ class AppData {
// build numbers.
static const String versionMajor = '5';
static const String versionBuild = '01';
- static const String version = '$versionMajor.1.0 Build-$versionBuild';
- static const String packageVersion = '5.1.0';
- static const String flutterVersion = 'stable v3.0.4';
+ static const String version = '$versionMajor.2.0 Build-$versionBuild';
+ static const String packageVersion = '5.2.0-dev.1';
+ static const String flutterVersion = 'master 3.1.0-0.0.pre.2216';
static const String copyright = '© 2020, 2021, 2022';
static const String author = 'Mike Rydstrom';
static const String license = 'BSD 3-Clause License';
diff --git a/example/lib/shared/const/store.dart b/example/lib/shared/const/store.dart
index c1648521d..1c799cbf8 100644
--- a/example/lib/shared/const/store.dart
+++ b/example/lib/shared/const/store.dart
@@ -85,6 +85,16 @@ class Store {
// Default value for the defaultRadius, also used to reset settings.
static const double? defaultDefaultRadius = null;
+ // Key used to read and save the thinBorderWidth value.
+ static const String keyThinBorderWidth = 'thinBorderWidth';
+ // Default value for the thinBorderWidth, also used to reset settings.
+ static const double? defaultThinBorderWidth = null;
+
+ // Key used to read and save the thickBorderWidth value.
+ static const String keyThickBorderWidth = 'thickBorderWidth';
+ // Default value for the thickBorderWidth, also used to reset settings.
+ static const double? defaultThickBorderWidth = null;
+
// Key used to read and save the tooltipsMatchBackground value.
static const String keyTooltipsMatchBackground = 'tooltipsMatchBackground';
// Default value for the tooltipsMatchBackground, also to reset settings.
@@ -350,14 +360,14 @@ class Store {
// Key used to read and save the appBarStyleLight value.
static const String keyAppBarStyleLight = 'lightAppBarStyle';
// Default value for the appBarStyleLight, also used to reset settings.
- static const FlexAppBarStyle defaultAppBarStyleLight =
- FlexAppBarStyle.primary;
+ static const FlexAppBarStyle? defaultAppBarStyleLight = null;
+ // FlexAppBarStyle.primary;
// Key used to read and save the appBarStyleDark value.
static const String keyAppBarStyleDark = 'darkAppBarStyle';
// Default value for the appBarStyleDark, also used to reset settings.
- static const FlexAppBarStyle defaultAppBarStyleDark =
- FlexAppBarStyle.background;
+ static const FlexAppBarStyle? defaultAppBarStyleDark = null;
+ // FlexAppBarStyle.background;
// Key used to read and save the appBarOpacityLight value.
static const String keyAppBarOpacityLight = 'appBarOpacity';
@@ -654,6 +664,14 @@ class Store {
// We use NULL as default, on nullable settings.
static const SchemeColor? defaultElevatedButtonSchemeColor = null;
+ // Key used to read and save the elevatedButtonSecondarySchemeColor value.
+ static const String keyElevatedButtonSecondarySchemeColor =
+ 'elevatedButtonSecondarySchemeColor';
+ // Default value for the elevatedButtonSecondarySchemeColor, also used to
+ // reset settings.
+ // We use NULL as default, on nullable settings.
+ static const SchemeColor? defaultElevatedButtonSecondarySchemeColor = null;
+
// Key used to read and save the elevatedButtonBorderRadius value.
static const String keyElevatedButtonBorderRadius =
'elevatedButtonBorderRadius';
@@ -670,6 +688,14 @@ class Store {
// We use NULL as default, on nullable settings.
static const SchemeColor? defaultOutlinedButtonSchemeColor = null;
+ // Key used to read and save the outlinedButtonOutlineSchemeColor value.
+ static const String keyOutlinedButtonOutlineSchemeColor =
+ 'outlinedButtonOutlineSchemeColor';
+ // Default value for the outlinedButtonOutlineSchemeColor, also used to
+ // reset settings.
+ // We use NULL as default, on nullable settings.
+ static const SchemeColor? defaultOutlinedButtonOutlineSchemeColor = null;
+
// Key used to read and save the outlinedButtonBorderRadius value.
static const String keyOutlinedButtonBorderRadius =
'outlinedButtonBorderRadius';
@@ -726,7 +752,7 @@ class Store {
// Key used to read and save the fabUseShape value.
static const String keyFabUseShape = 'fabUseShape';
// Default value for the fabUseShape, also to reset settings.
- static const bool defaultFabUseShape = true;
+ static const bool defaultFabUseShape = false;
// Key used to read and save the fabBorderRadius value.
static const String keyFabBorderRadius = 'fabBorderRadius';
diff --git a/example/lib/shared/controllers/theme_controller.dart b/example/lib/shared/controllers/theme_controller.dart
index aa47e7137..af71ee19d 100644
--- a/example/lib/shared/controllers/theme_controller.dart
+++ b/example/lib/shared/controllers/theme_controller.dart
@@ -82,6 +82,18 @@ class ThemeController with ChangeNotifier {
Store.keyDefaultRadius,
Store.defaultDefaultRadius,
);
+ _defaultRadius = await _themeService.load(
+ Store.keyDefaultRadius,
+ Store.defaultDefaultRadius,
+ );
+ _thinBorderWidth = await _themeService.load(
+ Store.keyThinBorderWidth,
+ Store.defaultThinBorderWidth,
+ );
+ _thickBorderWidth = await _themeService.load(
+ Store.keyThickBorderWidth,
+ Store.defaultThickBorderWidth,
+ );
_tooltipsMatchBackground = await _themeService.load(
Store.keyTooltipsMatchBackground, Store.defaultTooltipsMatchBackground);
//
@@ -321,12 +333,18 @@ class ThemeController with ChangeNotifier {
_elevatedButtonSchemeColor = await _themeService.load(
Store.keyElevatedButtonSchemeColor,
Store.defaultElevatedButtonSchemeColor);
+ _elevatedButtonSecondarySchemeColor = await _themeService.load(
+ Store.keyElevatedButtonSecondarySchemeColor,
+ Store.defaultElevatedButtonSecondarySchemeColor);
_elevatedButtonBorderRadius = await _themeService.load(
Store.keyElevatedButtonBorderRadius,
Store.defaultElevatedButtonBorderRadius);
_outlinedButtonSchemeColor = await _themeService.load(
Store.keyOutlinedButtonSchemeColor,
Store.defaultOutlinedButtonSchemeColor);
+ _outlinedButtonOutlineSchemeColor = await _themeService.load(
+ Store.keyOutlinedButtonOutlineSchemeColor,
+ Store.defaultOutlinedButtonOutlineSchemeColor);
_outlinedButtonBorderRadius = await _themeService.load(
Store.keyOutlinedButtonBorderRadius,
Store.defaultOutlinedButtonBorderRadius);
@@ -442,6 +460,8 @@ class ThemeController with ChangeNotifier {
await setSchemeIndex(Store.defaultSchemeIndex, false);
await setInteractionEffects(Store.defaultInteractionEffects, false);
await setDefaultRadius(Store.defaultDefaultRadius, false);
+ await setThinBorderWidth(Store.defaultThinBorderWidth, false);
+ await setThickBorderWidth(Store.defaultThickBorderWidth, false);
await setTooltipsMatchBackground(
Store.defaultTooltipsMatchBackground, false);
//
@@ -592,10 +612,14 @@ class ThemeController with ChangeNotifier {
await setTextButtonBorderRadius(Store.defaultTextButtonBorderRadius, false);
await setElevatedButtonSchemeColor(
Store.defaultElevatedButtonSchemeColor, false);
+ await setElevatedButtonSecondarySchemeColor(
+ Store.defaultElevatedButtonSecondarySchemeColor, false);
await setElevatedButtonBorderRadius(
Store.defaultElevatedButtonBorderRadius, false);
await setOutlinedButtonSchemeColor(
Store.defaultOutlinedButtonSchemeColor, false);
+ await setOutlinedButtonOutlineSchemeColor(
+ Store.defaultOutlinedButtonOutlineSchemeColor, false);
await setOutlinedButtonBorderRadius(
Store.defaultOutlinedButtonBorderRadius, false);
await setToggleButtonsSchemeColor(
@@ -799,6 +823,24 @@ class ThemeController with ChangeNotifier {
await _themeService.save(Store.keyDefaultRadius, value);
}
+ late double? _thinBorderWidth;
+ double? get thinBorderWidth => _thinBorderWidth;
+ Future setThinBorderWidth(double? value, [bool notify = true]) async {
+ if (value == _thinBorderWidth) return;
+ _thinBorderWidth = value;
+ if (notify) notifyListeners();
+ await _themeService.save(Store.keyThinBorderWidth, value);
+ }
+
+ late double? _thickBorderWidth;
+ double? get thickBorderWidth => _thickBorderWidth;
+ Future setThickBorderWidth(double? value, [bool notify = true]) async {
+ if (value == _thickBorderWidth) return;
+ _thickBorderWidth = value;
+ if (notify) notifyListeners();
+ await _themeService.save(Store.keyThickBorderWidth, value);
+ }
+
late bool _tooltipsMatchBackground;
bool get tooltipsMatchBackground => _tooltipsMatchBackground;
Future setTooltipsMatchBackground(bool? value,
@@ -1283,22 +1325,22 @@ class ThemeController with ChangeNotifier {
// AppBar SETTINGS.
// ===========================================================================
- late FlexAppBarStyle _appBarStyleLight;
- FlexAppBarStyle get appBarStyleLight => _appBarStyleLight;
+ late FlexAppBarStyle? _appBarStyleLight;
+ FlexAppBarStyle? get appBarStyleLight => _appBarStyleLight;
Future setAppBarStyleLight(FlexAppBarStyle? value,
[bool notify = true]) async {
- if (value == null) return;
+ // if (value == null) return;
if (value == _appBarStyleLight) return;
_appBarStyleLight = value;
if (notify) notifyListeners();
await _themeService.save(Store.keyAppBarStyleLight, value);
}
- late FlexAppBarStyle _appBarStyleDark;
- FlexAppBarStyle get appBarStyleDark => _appBarStyleDark;
+ late FlexAppBarStyle? _appBarStyleDark;
+ FlexAppBarStyle? get appBarStyleDark => _appBarStyleDark;
Future setAppBarStyleDark(FlexAppBarStyle? value,
[bool notify = true]) async {
- if (value == null) return;
+ // if (value == null) return;
if (value == _appBarStyleDark) return;
_appBarStyleDark = value;
if (notify) notifyListeners();
@@ -1808,6 +1850,18 @@ class ThemeController with ChangeNotifier {
await _themeService.save(Store.keyElevatedButtonSchemeColor, value);
}
+ late SchemeColor? _elevatedButtonSecondarySchemeColor;
+ SchemeColor? get elevatedButtonSecondarySchemeColor =>
+ _elevatedButtonSecondarySchemeColor;
+ Future setElevatedButtonSecondarySchemeColor(SchemeColor? value,
+ [bool notify = true]) async {
+ if (value == _elevatedButtonSecondarySchemeColor) return;
+ _elevatedButtonSecondarySchemeColor = value;
+ if (notify) notifyListeners();
+ await _themeService.save(
+ Store.keyElevatedButtonSecondarySchemeColor, value);
+ }
+
late double? _elevatedButtonBorderRadius;
double? get elevatedButtonBorderRadius => _elevatedButtonBorderRadius;
Future setElevatedButtonBorderRadius(double? value,
@@ -1828,6 +1882,17 @@ class ThemeController with ChangeNotifier {
await _themeService.save(Store.keyOutlinedButtonSchemeColor, value);
}
+ late SchemeColor? _outlinedButtonOutlineSchemeColor;
+ SchemeColor? get outlinedButtonOutlineSchemeColor =>
+ _outlinedButtonOutlineSchemeColor;
+ Future setOutlinedButtonOutlineSchemeColor(SchemeColor? value,
+ [bool notify = true]) async {
+ if (value == _outlinedButtonOutlineSchemeColor) return;
+ _outlinedButtonOutlineSchemeColor = value;
+ if (notify) notifyListeners();
+ await _themeService.save(Store.keyOutlinedButtonOutlineSchemeColor, value);
+ }
+
late double? _outlinedButtonBorderRadius;
double? get outlinedButtonBorderRadius => _outlinedButtonBorderRadius;
Future setOutlinedButtonBorderRadius(double? value,
diff --git a/example/lib/shared/utils/app_scroll_behavior.dart b/example/lib/shared/utils/app_scroll_behavior.dart
index 2328145fa..04c767725 100644
--- a/example/lib/shared/utils/app_scroll_behavior.dart
+++ b/example/lib/shared/utils/app_scroll_behavior.dart
@@ -20,6 +20,8 @@ class AppScrollBehavior extends MaterialScrollBehavior {
Set get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
+ PointerDeviceKind.trackpad,
+ PointerDeviceKind.stylus,
};
}
diff --git a/example/lib/shared/widgets/app/show_color_scheme_colors.dart b/example/lib/shared/widgets/app/show_color_scheme_colors.dart
index 1e6747248..c66fdbf4b 100644
--- a/example/lib/shared/widgets/app/show_color_scheme_colors.dart
+++ b/example/lib/shared/widgets/app/show_color_scheme_colors.dart
@@ -237,11 +237,21 @@ class ShowColorSchemeColors extends StatelessWidget {
color: colorScheme.outline,
textColor: colorScheme.background,
),
+ ColorCard(
+ label: 'Outline\nVariant',
+ color: colorScheme.outlineVariant,
+ textColor: colorScheme.background,
+ ),
ColorCard(
label: 'Shadow',
color: colorScheme.shadow,
textColor: _onColor(colorScheme.shadow, background),
),
+ ColorCard(
+ label: 'Scrim',
+ color: colorScheme.scrim,
+ textColor: _onColor(colorScheme.shadow, background),
+ ),
ColorCard(
label: 'Inverse\nSurface',
color: colorScheme.inverseSurface,
diff --git a/example/lib/shared/widgets/app/show_sub_theme_colors.dart b/example/lib/shared/widgets/app/show_sub_theme_colors.dart
index 20b87f2b7..d7fb77d39 100644
--- a/example/lib/shared/widgets/app/show_sub_theme_colors.dart
+++ b/example/lib/shared/widgets/app/show_sub_theme_colors.dart
@@ -114,8 +114,13 @@ class ShowSubThemeColors extends StatelessWidget {
colorScheme.primary;
final Decoration? tooltipDecoration = theme.tooltipTheme.decoration;
final Color tooltipColor = tooltipDecoration is BoxDecoration
- ? tooltipDecoration.color ?? colorScheme.surface
- : colorScheme.surface;
+ ? tooltipDecoration.color ??
+ (isDark
+ ? Colors.white.withOpacity(0.9)
+ : Colors.grey[700]!.withOpacity(0.9))
+ : (isDark
+ ? Colors.white.withOpacity(0.9)
+ : Colors.grey[700]!.withOpacity(0.9));
final Color appBarColor = theme.appBarTheme.backgroundColor ??
(isDark ? colorScheme.surface : colorScheme.primary);
final Color tabBarColor = theme.tabBarTheme.labelColor ??
@@ -205,7 +210,7 @@ class ShowSubThemeColors extends StatelessWidget {
ColorCard(
label: 'Outlined\nButton',
color: outlinedButtonColor,
- textColor: _onColor(elevatedButtonColor, background),
+ textColor: _onColor(outlinedButtonColor, background),
),
ColorCard(
label: 'Text\nButton',
diff --git a/example/lib/shared/widgets/app/show_theme_data_colors.dart b/example/lib/shared/widgets/app/show_theme_data_colors.dart
index 7e2dd9b96..a56841ccf 100644
--- a/example/lib/shared/widgets/app/show_theme_data_colors.dart
+++ b/example/lib/shared/widgets/app/show_theme_data_colors.dart
@@ -155,8 +155,9 @@ class ShowThemeDataColors extends StatelessWidget {
color: theme.secondaryHeaderColor,
textColor: _onColor(theme.secondaryHeaderColor, background),
),
+ // TODO(rydmike): Flutter deprecated after v3.1.0-0.0.pre.',
ColorCard(
- label: 'Toggleable\nActive',
+ label: 'Toggleable\nActive\nDEPRECATED',
color: theme.toggleableActiveColor,
textColor: _onColor(theme.toggleableActiveColor, background),
),
@@ -235,11 +236,12 @@ class ShowThemeDataColors extends StatelessWidget {
color: theme.hintColor,
textColor: _onColor(theme.hintColor, background),
),
- ColorCard(
- label: 'Selected\nRow',
- color: theme.selectedRowColor,
- textColor: _onColor(theme.selectedRowColor, background),
- ),
+ // TODO(rydmike): Flutter deprecated after v3.1.0-0.0.pre.',
+ // ColorCard(
+ // label: 'Selected\nRow\nDEPRECATED',
+ // color: theme.selectedRowColor,
+ // textColor: _onColor(theme.selectedRowColor, background),
+ // ),
ColorCard(
label: 'Unselected\nWidget',
color: theme.unselectedWidgetColor,
diff --git a/example/lib/shared/widgets/universal/switch_list_tile_adaptive.dart b/example/lib/shared/widgets/universal/switch_list_tile_adaptive.dart
index c66159ce0..b99b8e0a3 100644
--- a/example/lib/shared/widgets/universal/switch_list_tile_adaptive.dart
+++ b/example/lib/shared/widgets/universal/switch_list_tile_adaptive.dart
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
// ignore_for_file: comment_references
-/// A theme following wrapper for [SwitchListTileAdaptive].
+/// A theme following wrapper for [SwitchListTile.adaptive].
///
/// The wrapper sets the active thumb color for the switch to
-/// SwitchTheme.active color, and if not define to theme.colorscheme.secondary.
+/// SwitchTheme.active color, and if not defined to theme.colorscheme.secondary.
///
/// NOTE: toggleableActiveColor will be deprecated soon in Flutter SDK,
/// so we are using its replacement fallback already now. See:
diff --git a/example/lib/shared/widgets/universal/theme_showcase.dart b/example/lib/shared/widgets/universal/theme_showcase.dart
index 4a51560db..fed8617f1 100644
--- a/example/lib/shared/widgets/universal/theme_showcase.dart
+++ b/example/lib/shared/widgets/universal/theme_showcase.dart
@@ -62,6 +62,8 @@ class ThemeShowcase extends StatelessWidget {
const Divider(),
const ListTileShowcase(),
const Divider(),
+ const AppBarShowcase(),
+ const Divider(),
const TabBarForAppBarShowcase(),
const SizedBox(height: 8),
const Divider(),
@@ -152,6 +154,68 @@ class ElevatedButtonShowcase extends StatelessWidget {
}
}
+// These are commented until https://github.com/flutter/flutter/pull/107382
+// lands in master 3.1.0 channel.
+// TODO(rydmike): Add these buttons to showcase
+// TODO(rydmike): FCS fix FCS M3 defaults.
+//
+// class FilledButtonShowcase extends StatelessWidget {
+// const FilledButtonShowcase({super.key});
+//
+// @override
+// Widget build(BuildContext context) {
+// return Wrap(
+// crossAxisAlignment: WrapCrossAlignment.center,
+// spacing: 8,
+// runSpacing: 8,
+// children: [
+// FilledButton(
+// onPressed: () {},
+// child: const Text('FilledButton button'),
+// ),
+// FilledButton.icon(
+// onPressed: () {},
+// icon: const Icon(Icons.add),
+// label: const Text('FilledButton icon'),
+// ),
+// const FilledButton(
+// onPressed: null,
+// child: Text('FilledButton button'),
+// ),
+// ],
+// );
+// }
+// }
+//
+//
+// class FilledButtonTonalShowcase extends StatelessWidget {
+// const FilledButtonTonalShowcase({super.key});
+//
+// @override
+// Widget build(BuildContext context) {
+// return Wrap(
+// crossAxisAlignment: WrapCrossAlignment.center,
+// spacing: 8,
+// runSpacing: 8,
+// children: [
+// FilledButton.tonal(
+// onPressed: () {},
+// child: const Text('FilledButton.tonal'),
+// ),
+// FilledButton.tonal.icon(
+// onPressed: () {},
+// icon: const Icon(Icons.add),
+// label: const Text('FilledButton.tonal icon'),
+// ),
+// const FilledButton.tonal(
+// onPressed: null,
+// child: Text('FilledButton.tonal button'),
+// ),
+// ],
+// );
+// }
+// }
+
class OutlinedButtonShowcase extends StatelessWidget {
const OutlinedButtonShowcase({super.key});
@@ -208,8 +272,16 @@ class TextButtonShowcase extends StatelessWidget {
}
}
-class ToggleButtonsShowcase extends StatelessWidget {
- const ToggleButtonsShowcase({super.key});
+class ToggleButtonsShowcase extends StatefulWidget {
+ const ToggleButtonsShowcase({this.showOutlinedButton, super.key});
+ final bool? showOutlinedButton;
+
+ @override
+ State createState() => _ToggleButtonsShowcaseState();
+}
+
+class _ToggleButtonsShowcaseState extends State {
+ List selected = [true, false, false];
@override
Widget build(BuildContext context) {
@@ -219,14 +291,23 @@ class ToggleButtonsShowcase extends StatelessWidget {
runSpacing: 4,
children: [
ToggleButtons(
- isSelected: const [true, false, false],
- onPressed: (int newIndex) {},
+ isSelected: selected,
+ onPressed: (int toggledIndex) {
+ setState(() {
+ selected[toggledIndex] = !selected[toggledIndex];
+ });
+ },
children: const [
Icon(Icons.adb),
Icon(Icons.phone),
Icon(Icons.account_circle),
],
),
+ if (widget.showOutlinedButton ?? false)
+ OutlinedButton(
+ onPressed: () {},
+ child: const Text('Outlined'),
+ ),
ToggleButtons(
isSelected: const [true, false, false],
onPressed: null,
@@ -236,6 +317,11 @@ class ToggleButtonsShowcase extends StatelessWidget {
Icon(Icons.account_circle),
],
),
+ if (widget.showOutlinedButton ?? false)
+ const OutlinedButton(
+ onPressed: null,
+ child: Text('Outlined'),
+ ),
],
);
}
@@ -436,9 +522,9 @@ class _PopupMenuButton extends StatelessWidget {
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
elevation: 0,
- primary: scheme.primary,
- onPrimary: scheme.onPrimary,
- onSurface: scheme.onSurface,
+ backgroundColor: scheme.primary,
+ foregroundColor: scheme.onPrimary,
+ disabledForegroundColor: scheme.onSurface,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(radius ?? 8)),
),
@@ -570,40 +656,77 @@ class ChipShowcase extends StatelessWidget {
onDeleted: () {},
),
const Chip(
- label: Text('Avatar Chip'),
+ label: Text('Chip'),
avatar: FlutterLogo(),
),
- InputChip(
- label: const Text('Input Chip'),
- onSelected: (bool value) {},
+ ActionChip(
+ label: const Text('ActionChip'),
+ avatar: const Icon(Icons.settings),
+ onPressed: () {},
),
- InputChip(
- showCheckmark: true,
+ ActionChip(
+ label: const Text('ActionChip'),
+ avatar: const Icon(Icons.settings),
+ // TODO(rydmike): Uncomment in 3.1.0 to get disabled ActionChip.
+ // The onPressed is required in 3.0.5 stable, but not in 3.1.0 master.
+ onPressed: () {},
+ ),
+ FilterChip(
+ label: const Text('FilterChip'),
selected: true,
- label: const Text('Chip check'),
onSelected: (bool value) {},
),
- const InputChip(
- label: Text('Disabled Chip'),
- isEnabled: false,
+ FilterChip(
+ label: const Text('FilterChip'),
+ selected: false,
+ onSelected: (bool value) {},
+ ),
+ const FilterChip(
+ label: Text('FilterChip'),
+ selected: true,
+ onSelected: null,
),
ChoiceChip(
- label: const Text('Selected Chip'),
+ label: const Text('ChoiceChip'),
selected: true,
onSelected: (bool value) {},
),
ChoiceChip(
- label: const Text('Not selected Chip'),
+ label: const Text('ChoiceChip'),
selected: false,
onSelected: (bool value) {},
),
+ const ChoiceChip(
+ label: Text('ChoiceChip'),
+ selected: true,
+ ),
+ InputChip(
+ label: const Text('InputChip'),
+ onSelected: (bool value) {},
+ onDeleted: () {},
+ ),
+ InputChip(
+ showCheckmark: true,
+ selected: true,
+ label: const Text('InputChip'),
+ onSelected: (bool value) {},
+ onDeleted: () {},
+ ),
+ InputChip(
+ label: const Text('InputChip'),
+ isEnabled: false,
+ onSelected: (bool value) {},
+ onDeleted: () {},
+ // onDeleted: () {},
+ ),
],
);
}
}
class TextInputField extends StatefulWidget {
- const TextInputField({super.key});
+ const TextInputField({this.filled, super.key});
+ final bool? filled;
@override
State createState() => _TextInputFieldState();
@@ -646,8 +769,9 @@ class _TextInputFieldState extends State {
key: const Key('TextField1'),
controller: _textController1,
decoration: InputDecoration(
+ filled: widget.filled ?? true,
hintText: 'Write something...',
- labelText: 'Text entry',
+ labelText: 'TextField - Underline border, if not defined',
errorText: _errorState1
? "Any entry without an 'a' will trigger this error"
: null,
@@ -667,8 +791,12 @@ class _TextInputFieldState extends State {
key: const Key('TextField2'),
controller: _textController2,
decoration: InputDecoration(
+ filled: widget.filled ?? true,
+ border: const OutlineInputBorder(),
hintText: 'Write something...',
- labelText: 'Another text entry',
+ labelText: 'TextField - Outline border, if not defined',
+ prefixIcon: const Icon(Icons.search),
+ suffixIcon: const Icon(Icons.info),
errorText: _errorState2
? "Any entry without an 'a' will trigger this error"
: null,
@@ -678,7 +806,7 @@ class _TextInputFieldState extends State {
const TextField(
enabled: false,
decoration: InputDecoration(
- labelText: 'Disabled text input',
+ labelText: 'TextField - Disabled',
),
),
const SizedBox(height: 8),
@@ -688,6 +816,53 @@ class _TextInputFieldState extends State {
}
}
+class AppBarShowcase extends StatelessWidget {
+ const AppBarShowcase({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return MediaQuery.removePadding(
+ context: context,
+ removeBottom: true,
+ removeTop: true,
+ child: Stack(
+ alignment: AlignmentDirectional.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Wrap(spacing: 8, runSpacing: 8, children: [
+ const Text('Behind AppBar'),
+ FloatingActionButton.small(
+ onPressed: () {},
+ child: const Icon(Icons.add),
+ ),
+ InputChip(
+ showCheckmark: true,
+ selected: true,
+ label: const Text('Chip check'),
+ onSelected: (bool value) {},
+ ),
+ ]),
+ ),
+ AppBar(
+ leading: IconButton(
+ icon: const Icon(Icons.menu),
+ onPressed: () {},
+ ),
+ title: const Text('Material AppBar'),
+ actions: [
+ IconButton(
+ icon: const Icon(Icons.search),
+ onPressed: () {},
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
+
class TabBarForAppBarShowcase extends StatelessWidget {
const TabBarForAppBarShowcase({super.key});
@@ -838,28 +1013,50 @@ class _BottomNavigationBarShowcaseState
MediaQuery.removePadding(
context: context,
removeBottom: true,
- child: BottomNavigationBar(
- currentIndex: buttonIndex,
- onTap: (int value) {
- setState(() {
- buttonIndex = value;
- });
- },
- items: const [
- BottomNavigationBarItem(
- icon: Icon(Icons.chat_bubble),
- label: 'Chat',
- // title: Text('Item 1'),
- ),
- BottomNavigationBarItem(
- icon: Icon(Icons.beenhere),
- label: 'Tasks',
- // title: Text('Item 2'),
+ removeTop: true,
+ child: Stack(
+ alignment: AlignmentDirectional.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Wrap(spacing: 8, runSpacing: 8, children: [
+ const Text('Behind BottomNavBar'),
+ FloatingActionButton.small(
+ onPressed: () {},
+ child: const Icon(Icons.add),
+ ),
+ InputChip(
+ showCheckmark: true,
+ selected: true,
+ label: const Text('Chip check'),
+ onSelected: (bool value) {},
+ ),
+ ]),
),
- BottomNavigationBarItem(
- icon: Icon(Icons.create_new_folder),
- label: 'Folder',
- // title: Text('Item 3'),
+ BottomNavigationBar(
+ currentIndex: buttonIndex,
+ onTap: (int value) {
+ setState(() {
+ buttonIndex = value;
+ });
+ },
+ items: const [
+ BottomNavigationBarItem(
+ icon: Icon(Icons.chat_bubble),
+ label: 'Chat',
+ // title: Text('Item 1'),
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.beenhere),
+ label: 'Tasks',
+ // title: Text('Item 2'),
+ ),
+ BottomNavigationBarItem(
+ icon: Icon(Icons.create_new_folder),
+ label: 'Folder',
+ // title: Text('Item 3'),
+ ),
+ ],
),
],
),
@@ -910,25 +1107,47 @@ class _NavigationBarShowcaseState extends State {
MediaQuery.removePadding(
context: context,
removeBottom: true,
- child: NavigationBar(
- selectedIndex: buttonIndex,
- onDestinationSelected: (int value) {
- setState(() {
- buttonIndex = value;
- });
- },
- destinations: const [
- NavigationDestination(
- icon: Icon(Icons.chat_bubble),
- label: 'Chat',
- ),
- NavigationDestination(
- icon: Icon(Icons.beenhere),
- label: 'Tasks',
+ removeTop: true,
+ child: Stack(
+ alignment: AlignmentDirectional.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Wrap(spacing: 8, runSpacing: 8, children: [
+ const Text('Behind NavBar'),
+ FloatingActionButton.small(
+ onPressed: () {},
+ child: const Icon(Icons.add),
+ ),
+ InputChip(
+ showCheckmark: true,
+ selected: true,
+ label: const Text('Chip check'),
+ onSelected: (bool value) {},
+ ),
+ ]),
),
- NavigationDestination(
- icon: Icon(Icons.create_new_folder),
- label: 'Folder',
+ NavigationBar(
+ selectedIndex: buttonIndex,
+ onDestinationSelected: (int value) {
+ setState(() {
+ buttonIndex = value;
+ });
+ },
+ destinations: const [
+ NavigationDestination(
+ icon: Icon(Icons.chat_bubble),
+ label: 'Chat',
+ ),
+ NavigationDestination(
+ icon: Icon(Icons.beenhere),
+ label: 'Tasks',
+ ),
+ NavigationDestination(
+ icon: Icon(Icons.create_new_folder),
+ label: 'Folder',
+ ),
+ ],
),
],
),
@@ -1031,37 +1250,44 @@ class _NavigationRailShowcaseState extends State {
maxHeight: 1200,
child: Row(
children: [
- NavigationRail(
- extended: isExtended,
- useIndicator: widget.useAssertWorkAround ? true : null,
- minExtendedWidth: 150,
- indicatorColor:
- widget.useAssertWorkAround ? Colors.transparent : null,
- labelType: isExtended ? NavigationRailLabelType.none : null,
- selectedIndex: buttonIndex,
- onDestinationSelected: (int value) {
- setState(() {
- buttonIndex = value;
- });
- },
- destinations: const [
- NavigationRailDestination(
- icon: Icon(Icons.chat_bubble),
- label: Text('Chat'),
- ),
- NavigationRailDestination(
- icon: Icon(Icons.beenhere),
- label: Text('Tasks'),
- ),
- NavigationRailDestination(
- icon: Icon(Icons.create_new_folder),
- label: Text('Folder'),
- ),
- NavigationRailDestination(
- icon: Icon(Icons.logout),
- label: Text('Logout'),
- ),
- ],
+ MediaQuery.removePadding(
+ context: context,
+ removeBottom: true,
+ removeTop: true,
+ child: NavigationRail(
+ extended: isExtended,
+ useIndicator: widget.useAssertWorkAround ? true : null,
+ minExtendedWidth: 150,
+ indicatorColor: widget.useAssertWorkAround
+ ? Colors.transparent
+ : null,
+ labelType:
+ isExtended ? NavigationRailLabelType.none : null,
+ selectedIndex: buttonIndex,
+ onDestinationSelected: (int value) {
+ setState(() {
+ buttonIndex = value;
+ });
+ },
+ destinations: const [
+ NavigationRailDestination(
+ icon: Icon(Icons.chat_bubble),
+ label: Text('Chat'),
+ ),
+ NavigationRailDestination(
+ icon: Icon(Icons.beenhere),
+ label: Text('Tasks'),
+ ),
+ NavigationRailDestination(
+ icon: Icon(Icons.create_new_folder),
+ label: Text('Folder'),
+ ),
+ NavigationRailDestination(
+ icon: Icon(Icons.logout),
+ label: Text('Logout'),
+ ),
+ ],
+ ),
),
const VerticalDivider(width: 1),
Expanded(
diff --git a/example/macos/Podfile b/example/macos/Podfile
index dade8dfad..fe733905d 100644
--- a/example/macos/Podfile
+++ b/example/macos/Podfile
@@ -1,4 +1,4 @@
-platform :osx, '10.11'
+platform :osx, '10.13'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock
index be4112eb8..256a69f02 100644
--- a/example/macos/Podfile.lock
+++ b/example/macos/Podfile.lock
@@ -24,11 +24,11 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
SPEC CHECKSUMS:
- FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
+ FlutterMacOS: 85f90bfb3f1703249cf1539e4dfbff31e8584698
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
-PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
+PODFILE CHECKSUM: a884f6dd3f7494f3892ee6c81feea3a3abbf9153
COCOAPODS: 1.11.3
diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj
index d5aaedd0c..c1318c0d3 100644
--- a/example/macos/Runner.xcodeproj/project.pbxproj
+++ b/example/macos/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 51;
+ objectVersion = 54;
objects = {
/* Begin PBXAggregateTarget section */
@@ -278,6 +278,7 @@
};
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -404,7 +405,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
@@ -483,7 +484,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
@@ -530,7 +531,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
diff --git a/example/pubspec.lock b/example/pubspec.lock
index b984b40e7..c4c58575f 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -63,14 +56,14 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.1"
+ version: "2.0.1"
file:
dependency: transitive
description:
@@ -84,14 +77,14 @@ packages:
name: flex_color_picker
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0"
+ version: "2.6.0-dev.1"
flex_color_scheme:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
- version: "5.1.0"
+ version: "5.2.0-dev.1"
flutter:
dependency: "direct main"
description: flutter
@@ -103,7 +96,7 @@ packages:
name: flutter_staggered_grid_view
url: "https://pub.dartlang.org"
source: hosted
- version: "0.6.1"
+ version: "0.6.2"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -134,14 +127,14 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.4"
+ version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
- version: "4.0.0"
+ version: "4.0.1"
js:
dependency: transitive
description:
@@ -155,35 +148,35 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.2.0"
material_design_icons_flutter:
dependency: "direct main"
description:
name: material_design_icons_flutter
url: "https://pub.dartlang.org"
source: hosted
- version: "5.0.6595"
+ version: "5.0.6996"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
path_provider:
dependency: "direct main"
description:
@@ -197,21 +190,21 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.14"
+ version: "2.0.18"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.9"
+ version: "2.0.11"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.6"
+ version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
@@ -232,7 +225,7 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.6"
+ version: "2.1.2"
platform:
dependency: transitive
description:
@@ -321,7 +314,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.1"
stack_trace:
dependency: transitive
description:
@@ -342,21 +335,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
typed_data:
dependency: transitive
description:
@@ -370,7 +363,7 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
- version: "6.1.4"
+ version: "6.1.5"
url_launcher_android:
dependency: transitive
description:
@@ -384,7 +377,7 @@ packages:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
- version: "6.0.16"
+ version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
@@ -412,7 +405,7 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.11"
+ version: "2.0.13"
url_launcher_windows:
dependency: transitive
description:
@@ -433,7 +426,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.2"
+ version: "2.7.0"
xdg_directories:
dependency: transitive
description:
@@ -443,4 +436,4 @@ packages:
version: "0.2.0+1"
sdks:
dart: ">=2.17.0 <3.0.0"
- flutter: ">=3.0.0"
+ flutter: ">=3.1.0-0.0.pre.2199"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 2c11f52e2..6c4309f60 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -1,10 +1,10 @@
name: flex_color_scheme_example
description: Examples that demonstrate how to use the FlexColorScheme package.
-version: 5.1.0
+version: 5.2.0-dev.1
publish_to: 'none'
environment:
sdk: '>=2.17.0 <3.0.0'
- flutter: '>=3.0.0'
+ flutter: '>=3.1.0-0.0.pre.2199'
dependencies:
# Adds the Cupertino Icons font to your application. Used by the
@@ -14,7 +14,7 @@ dependencies:
# Color picker package, by Mike Rydstrom, rydmike.com (@rydmike).
# https://pub.dev/packages/flex_color_picker
- flex_color_picker: ^2.5.0
+ flex_color_picker: ^2.6.0-dev.1
# Color scheme package, by Mike Rydstrom, rydmike.com (@rydmike).
# https://pub.dev/packages/flex_color_scheme
@@ -27,7 +27,7 @@ dependencies:
# Masonry grid layout package, by Romain Rastel.
# https://pub.dev/packages/flutter_staggered_grid_view
- flutter_staggered_grid_view: ^0.6.1
+ flutter_staggered_grid_view: ^0.6.2
# Google fonts, by Google material.io.
# https://pub.dev/packages/google_fonts
@@ -40,7 +40,7 @@ dependencies:
# Material Design Icons, community designed. Used for
# icons in the Platform selection popup menu.
# https://materialdesignicons.com/
- material_design_icons_flutter: ^5.0.6595
+ material_design_icons_flutter: ^5.0.6996
# Commonly used directories on host platform file systems, by Google (flutter.dev).
# Used to get a working storage path for Hive on Windows.
@@ -58,7 +58,7 @@ dependencies:
# Used for launching a WEB URL, by Google flutter.dev.
# https://pub.dev/packages/url_launcher
- url_launcher: ^6.1.4
+ url_launcher: ^6.1.5
dev_dependencies:
flutter_test:
diff --git a/lib/src/flex_color.dart b/lib/src/flex_color.dart
index 84d87c008..1b0a20469 100644
--- a/lib/src/flex_color.dart
+++ b/lib/src/flex_color.dart
@@ -83,17 +83,31 @@ class FlexColor {
static Color lightErrorContainer(Color lightError) =>
lightError.brighten(25).blend(const Color(0xFFFFFFFF), 80);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3LightError = Color(0xFFBA1B1B);
+ // In version 0.1.5 and due to a small braking algo change, it is:
+ //
/// Material 3 standard light error color.
- static const Color material3LightError = Color(0xFFBA1B1B);
+ static const Color material3LightError = Color(0xFFBA1A1A);
/// Material 3 standard light onError color.
static const Color material3LightOnError = Color(0xFFFFFFFF);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3LightErrorContainer = Color(0xFFFFDAD4);
+ // In version 0.1.5 and due to a small braking algo change, it is:
+ //
/// Material 3 standard light error container color.
- static const Color material3LightErrorContainer = Color(0xFFFFDAD4);
+ static const Color material3LightErrorContainer = Color(0xFFFFDAD6);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3LightOnErrorContainer = Color(0xFF410001);
+ //
/// Material 3 standard light on error container color.
- static const Color material3LightOnErrorContainer = Color(0xFF410001);
+ static const Color material3LightOnErrorContainer = Color(0xFF410002);
/// Material 2 standard dark error color.
static const Color materialDarkError = Color(0xFFCF6679);
@@ -102,17 +116,33 @@ class FlexColor {
static Color darkErrorContainer(Color darkError) =>
darkError.darken(15); //.blend(const Color(0xFF000000), 30);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3DarkError = Color(0xFFFFB4A9);
+ //
/// Material 3 standard dark error color.
- static const Color material3DarkError = Color(0xFFFFB4A9);
+ static const Color material3DarkError = Color(0xFFFFB4AB);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3DarkOnError = Color(0xFF680003);
+ //
/// Material 3 standard dark onError color.
- static const Color material3DarkOnError = Color(0xFF680003);
+ static const Color material3DarkOnError = Color(0xFF690005);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3DarkErrorContainer = Color(0xFF930006);
+ //
/// Material 3 standard dark error container color.
- static const Color material3DarkErrorContainer = Color(0xFF930006);
+ static const Color material3DarkErrorContainer = Color(0xFF93000A);
+ // TODO(rydmike): v0.1.5 of material_color_utilities changed this color.
+ // Before version 0.1.5. the color value was:
+ // static const Color material3DarkOnErrorContainer = Color(0xFFFFB4A9);
+ //
/// Material 3 standard dark on error container color.
- static const Color material3DarkOnErrorContainer = Color(0xFFFFB4A9);
+ static const Color material3DarkOnErrorContainer = Color(0xFFFFB4AB);
// High contrast Material 2 standard error color as per those used in Flutter
// ColorScheme.highContrastLight and ColorScheme.highContrastDark
diff --git a/lib/src/flex_color_scheme.dart b/lib/src/flex_color_scheme.dart
index 07b48bd93..58ea7c2b5 100644
--- a/lib/src/flex_color_scheme.dart
+++ b/lib/src/flex_color_scheme.dart
@@ -310,20 +310,27 @@ enum FlexSurfaceMode {
enum FlexAppBarStyle {
/// Use the scheme primary color as the AppBar's themed background color.
///
- /// This is the default for light themes.
+ /// This is the default for light themes, when [ThemeData.useMaterial3] is
+ /// false.
primary,
- /// Use Material surface color as the AppBar's themed background color.
+ /// Use Material 2 default surface color as the AppBar's themed background
+ /// color.
///
- /// This is the default for dark schemes.
+ /// This is the default for dark schemes, when [ThemeData.useMaterial3] is
+ /// false.
///
- /// For a dark scheme this choice will result in a near black app bar. If this
- /// setting is used in a light scheme, it will result in a white app bar, as
- /// the standard Material surface color for light scheme is white.
+ /// For a dark scheme this choice will result in a near black app bar with
+ /// color value (#FF121212). If this setting is used in a light scheme, it
+ /// will result in a white app bar, as the standard Material 2 surface color
+ /// for light scheme is white.
material,
/// Use scheme surface color as the the AppBar's themed background color,
/// including any blend color it may have.
+ ///
+ /// This is the default for light and dark theme mode, when
+ /// [ThemeData.useMaterial3] is true.
surface,
/// Use scheme background color as the the AppBar's themed background color,
@@ -341,10 +348,10 @@ enum FlexAppBarStyle {
/// custom color for the [AppBar] theme.
///
/// The built-in color schemes have the same color value that is assigned to
- /// [FlexSchemeColor.secondaryContainer] also assigned to
+ /// [FlexSchemeColor.tertiary] also assigned to
/// [FlexSchemeColor.appBarColor], so with them, the custom choice always
- /// results in the [FlexSchemeColor.secondaryContainer] color, which is same
- /// as output [ColorScheme.secondaryContainer], being used as the [AppBar]
+ /// results in the [FlexSchemeColor.tertiaryContainer] color, which is same
+ /// as output [ColorScheme.tertiaryContainer], being used as the [AppBar]
/// color when using the [custom] choice with them.
///
/// FlexColorSchemes using custom [FlexSchemeColor] can assign any color
@@ -1610,10 +1617,12 @@ class FlexColorScheme with Diagnosticable {
/// Style used to define the themed color of the AppBar background color.
///
- /// Defaults to [FlexAppBarStyle.primary] which produces the same results
- /// as a Flutter standard light [ThemeData.from] by tying the app bar color
- /// to the primary color.
- final FlexAppBarStyle appBarStyle = FlexAppBarStyle.primary,
+ /// Defaults to null, which when [useMaterial3] is false results in
+ /// [FlexAppBarStyle.primary] which produces the same results
+ /// as a Flutter standard M2 light [ThemeData.from] by tying the app bar
+ /// color to the primary color. If [useMaterial3] is true it defaults
+ /// [FlexAppBarStyle.surface] which is the same as M3 default.
+ final FlexAppBarStyle? appBarStyle,
/// Themed [AppBar] opacity.
///
@@ -2849,15 +2858,22 @@ class FlexColorScheme with Diagnosticable {
onSurface: onColors.onSurface,
surfaceVariant: effectiveSurfaceVariantColor,
onSurfaceVariant: onColors.onSurfaceVariant,
+ outline: _outlineColor(Brightness.light, onColors.onBackground, 30),
+ outlineVariant:
+ _outlineColor(Brightness.light, onColors.onBackground, 60),
+ shadow: Colors.black,
+ scrim: Colors.black,
inverseSurface: effectiveInverseSurfaceColor,
onInverseSurface: onColors.onInverseSurface,
inversePrimary: _inversePrimary(
Brightness.light, effectiveColors.primary, effectiveSurfaceColor),
- shadow: Colors.black,
- outline: _outlineColor(Brightness.light, onColors.onBackground),
surfaceTint: surfaceTint ?? effectiveColors.primary,
);
+ // Determine effective AppBar style, passed in or default based on M2 or M3.
+ final FlexAppBarStyle effectiveAppBarStyle = appBarStyle ??
+ (useMaterial3 ? FlexAppBarStyle.surface : FlexAppBarStyle.primary);
+
// Determine the effective AppBar color:
// - First priority, passed in color value.
Color? effectiveAppBarColor = appBarBackground;
@@ -2869,7 +2885,7 @@ class FlexColorScheme with Diagnosticable {
: null;
// Third priority [appBarStyle] based.
if (effectiveAppBarColor == null) {
- switch (appBarStyle) {
+ switch (effectiveAppBarStyle) {
case FlexAppBarStyle.primary:
effectiveAppBarColor = effectiveColors.primary;
break;
@@ -3280,10 +3296,12 @@ class FlexColorScheme with Diagnosticable {
/// Style used to define the themed color of the [AppBar] background color.
///
- /// Defaults to [FlexAppBarStyle.material] which produces the same results
- /// as a Flutter standard dark [ThemeData.from] by tying the app bar color
- /// to the surface color.
- final FlexAppBarStyle appBarStyle = FlexAppBarStyle.material,
+ /// Defaults to null, which when [useMaterial3] is false results in
+ /// [FlexAppBarStyle.material] which produces the same results
+ /// as a Flutter standard M2 dark [ThemeData.from] by tying the app bar
+ /// color to the M2 dark Material color. If [useMaterial3] is true it
+ /// defaults [FlexAppBarStyle.surface] which is the same as M3 default.
+ final FlexAppBarStyle? appBarStyle,
/// Themed [AppBar] opacity.
///
@@ -4543,15 +4561,22 @@ class FlexColorScheme with Diagnosticable {
onSurface: onColors.onSurface,
surfaceVariant: effectiveSurfaceVariantColor,
onSurfaceVariant: onColors.onSurfaceVariant,
+ outline: _outlineColor(Brightness.dark, onColors.onBackground, 30),
+ outlineVariant:
+ _outlineColor(Brightness.dark, onColors.onBackground, 60),
+ shadow: Colors.black,
+ scrim: Colors.black,
inverseSurface: effectiveInverseSurfaceColor,
onInverseSurface: onColors.onInverseSurface,
inversePrimary: _inversePrimary(
Brightness.dark, effectiveColors.primary, effectiveSurfaceColor),
- shadow: Colors.black,
- outline: _outlineColor(Brightness.dark, onColors.onBackground),
surfaceTint: surfaceTint ?? effectiveColors.primary,
);
+ // Determine effective AppBar style, passed in or default based on M2 or M3.
+ final FlexAppBarStyle effectiveAppBarStyle = appBarStyle ??
+ (useMaterial3 ? FlexAppBarStyle.surface : FlexAppBarStyle.material);
+
// Determine the effective AppBar color:
// - First priority, passed in color value.
Color? effectiveAppBarColor = appBarBackground;
@@ -4563,7 +4588,7 @@ class FlexColorScheme with Diagnosticable {
: null;
// Third priority [appBarStyle] based.
if (effectiveAppBarColor == null) {
- switch (appBarStyle) {
+ switch (effectiveAppBarStyle) {
case FlexAppBarStyle.primary:
effectiveAppBarColor = effectiveColors.primary;
break;
@@ -4582,7 +4607,7 @@ class FlexColorScheme with Diagnosticable {
break;
}
}
- // Apply specified opacity on on the resulting color.
+ // Apply specified opacity on the resulting color.
effectiveAppBarColor = effectiveAppBarColor.withOpacity(appBarOpacity);
return FlexColorScheme(
@@ -5835,11 +5860,7 @@ class FlexColorScheme with Diagnosticable {
? FlexSubThemes.inputDecorationTheme(
colorScheme: colorScheme,
baseSchemeColor: subTheme.inputDecoratorSchemeColor,
- radius: subTheme.inputDecoratorRadius ??
- subTheme.defaultRadius ??
- (useMaterial3
- ? kInputDecoratorM3Radius
- : kInputDecoratorRadius),
+ radius: subTheme.inputDecoratorRadius ?? subTheme.defaultRadius,
borderType: subTheme.inputDecoratorBorderType,
filled: subTheme.inputDecoratorIsFilled,
fillColor: subTheme.inputDecoratorFillColor,
@@ -5847,7 +5868,8 @@ class FlexColorScheme with Diagnosticable {
unfocusedBorderWidth: subTheme.thinBorderWidth,
unfocusedHasBorder: subTheme.inputDecoratorUnfocusedHasBorder,
unfocusedBorderIsColored:
- subTheme.inputDecoratorUnfocusedBorderIsColored)
+ subTheme.inputDecoratorUnfocusedBorderIsColored,
+ useMaterial3: useMaterial3)
// Default one is also a bit opinionated, this is the FCS standard
// in all previous versions before version 4.0.0. Kept for
// backwards defaults compatibility.
@@ -5873,6 +5895,7 @@ class FlexColorScheme with Diagnosticable {
// apply them via ThemeData copyWith separately for cases when we want
// to use them in a FlexColorSchemes, which might often be the case. Some
// of the values may be null and get defaults via the ThemeData() factory.
+ // TODO(rydmike): Monitor Flutter SDK deprecation of fontFamily.
fontFamily: fontFamily,
visualDensity: visualDensity,
useMaterial3: useMaterial3,
@@ -5889,7 +5912,9 @@ class FlexColorScheme with Diagnosticable {
// factory ThemeData.from() for creating a theme from a color scheme and
// text theme.
brightness: colorScheme.brightness,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of primaryColor.
primaryColor: colorScheme.primary,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of canvasColor.
canvasColor: colorScheme.background,
// TODO(rydmike): Monitor Flutter SDK deprecation of scaffoldBackground.
// See: https://github.com/flutter/flutter/issues/91772
@@ -5902,10 +5927,14 @@ class FlexColorScheme with Diagnosticable {
// separately alone. We want to do so in order to make elegantly nuanced
// primary color branded themes.
scaffoldBackgroundColor: scaffoldBackground ?? colorScheme.background,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of cardColor.
// Card, divider and background colors are same as in ThemeData.from.
cardColor: colorScheme.surface,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of dividerColor.
dividerColor: dividerColor,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of backgroundColor.
backgroundColor: colorScheme.background,
+ // TODO(rydmike): Monitor Flutter SDK deprecation of disabledColor.
// Disabled color uses a different style when using themed interaction
// effects, if not opted in same as before v4.0.0, use ThemeData default.
disabledColor: themedEffects
@@ -5915,7 +5944,7 @@ class FlexColorScheme with Diagnosticable {
: isDark
? Colors.white38
: Colors.black38,
-
+ // TODO(rydmike): Monitor Flutter SDK deprecation of hintColor.
// Same as ThemeData SDK.
// hintColor is only used by DropdownButton and InputDecorator in SDK.
hintColor: isDark ? Colors.white60 : Colors.black.withAlpha(0x99), // 60%
@@ -5961,6 +5990,7 @@ class FlexColorScheme with Diagnosticable {
// Define errorColor via color scheme error color.
errorColor: colorScheme.error,
// TODO(rydmike): Monitor Flutter SDK deprecation of indicatorColor.
+ // https://github.com/flutter/flutter/issues/91772#issuecomment-1198206279
// Use TabBar style dependent function for selected Tab as indicatorColor
// if no color scheme selection for it is made.
indicatorColor: subTheme.tabBarIndicatorSchemeColor == null
@@ -5996,6 +6026,7 @@ class FlexColorScheme with Diagnosticable {
// longer needed corrections or remove totally deprecated
// ThemeData properties when it is appropriate and timely to do so.
// ----------------------------------------------------------------------
+
// TODO(rydmike): Monitor Flutter SDK deprecation of toggleableActive.
// See: https://github.com/flutter/flutter/pull/95870
// This color is still important, if it is not set we get a teal color for
@@ -6007,9 +6038,12 @@ class FlexColorScheme with Diagnosticable {
// When using sub-themes, or Material 3 style, we use primary color
// instead, because it is the best match for M3 ColorDesign for the M2
// components using M3 Colors.
- toggleableActiveColor: useSubThemes || useMaterial3
- ? colorScheme.primary
- : colorScheme.secondary,
+ // TODO(rydmike): Try removal of toggleableActiveColor.
+ // Remove ALL above comments and commented prop when released to stable.
+ // toggleableActiveColor: useSubThemes || useMaterial3
+ // ? colorScheme.primary
+ // : colorScheme.secondary,
+
// TODO(rydmike): Monitor Flutter SDK deprecation of primaryColorDark.
// See: https://github.com/flutter/flutter/issues/91772
// The primary dark color no longer exists in ColorScheme themes, but
@@ -6049,6 +6083,7 @@ class FlexColorScheme with Diagnosticable {
// The FlexColorScheme implementation below has been changed to
// use these new AppBarTheme features in version 2.0.0.
appBarTheme: AppBarTheme(
+ centerTitle: subTheme.appBarCenterTitle,
backgroundColor: effectiveAppBarBackgroundColor,
foregroundColor: appBarForeground,
iconTheme: IconThemeData(color: appBarIconColor),
@@ -6069,11 +6104,14 @@ class FlexColorScheme with Diagnosticable {
statusBarIconBrightness: appBarBrightness == Brightness.dark
? Brightness.light
: Brightness.dark,
- // TODO(rydmike): Raise sys-nav AppBar systemOverlayStyle SDK issue.
+ // TODO(rydmike): Monitor sys-nav AppBar systemOverlayStyle issue.
// Would be useful it could set system navbar properties too and not
// only status bar properties. While it might be odd to do so, it
// seems even more odd that a part of the SystemUiOverlayStyle has
// no effect when used here.
+ // See https://github.com/flutter/flutter/issues/104410
+ // and https://github.com/flutter/flutter/issues/100027#issuecomment-1077697819
+ // PR: https://github.com/flutter/flutter/pull/104827
// The systemNavigationBarColor used by default AppBar in SDK is
// always black, like so:
// systemNavigationBarColor: const Color(0xFF000000),
@@ -6221,21 +6259,25 @@ class FlexColorScheme with Diagnosticable {
? FlexSubThemes.elevatedButtonTheme(
colorScheme: colorScheme,
baseSchemeColor: subTheme.elevatedButtonSchemeColor,
+ onBaseSchemeColor: subTheme.elevatedButtonSecondarySchemeColor,
radius: subTheme.elevatedButtonRadius ?? subTheme.defaultRadius,
elevation: subTheme.elevatedButtonElevation,
padding: subTheme.buttonPadding,
minButtonSize: subTheme.buttonMinSize,
+ useMaterial3: useMaterial3,
)
: null,
outlinedButtonTheme: useSubThemes
? FlexSubThemes.outlinedButtonTheme(
colorScheme: colorScheme,
baseSchemeColor: subTheme.outlinedButtonSchemeColor,
+ outlineSchemeColor: subTheme.outlinedButtonOutlineSchemeColor,
radius: subTheme.outlinedButtonRadius ?? subTheme.defaultRadius,
pressedOutlineWidth: subTheme.thickBorderWidth,
outlineWidth: subTheme.thinBorderWidth,
padding: subTheme.buttonPadding,
minButtonSize: subTheme.buttonMinSize,
+ useMaterial3: useMaterial3,
)
: null,
// Since the old buttons have been deprecated in Flutter 2.0.0
@@ -6283,6 +6325,7 @@ class FlexColorScheme with Diagnosticable {
radius: subTheme.toggleButtonsRadius ?? subTheme.defaultRadius,
minButtonSize: subTheme.buttonMinSize,
visualDensity: visualDensity,
+ useMaterial3: useMaterial3,
)
: null,
// Switch theme.
@@ -6292,7 +6335,12 @@ class FlexColorScheme with Diagnosticable {
baseSchemeColor: subTheme.switchSchemeColor,
unselectedIsColored: subTheme.unselectedToggleIsColored,
)
- : null,
+ : FlexSubThemes.switchTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor:
+ useMaterial3 ? SchemeColor.primary : SchemeColor.secondary,
+ unselectedIsColored: false,
+ ),
// Checkbox theme.
checkboxTheme: useSubThemes
? FlexSubThemes.checkboxTheme(
@@ -6300,7 +6348,12 @@ class FlexColorScheme with Diagnosticable {
baseSchemeColor: subTheme.checkboxSchemeColor,
unselectedIsColored: subTheme.unselectedToggleIsColored,
)
- : null,
+ : FlexSubThemes.checkboxTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor:
+ useMaterial3 ? SchemeColor.primary : SchemeColor.secondary,
+ unselectedIsColored: false,
+ ),
// Radio theme.
radioTheme: useSubThemes
? FlexSubThemes.radioTheme(
@@ -6308,7 +6361,12 @@ class FlexColorScheme with Diagnosticable {
baseSchemeColor: subTheme.radioSchemeColor,
unselectedIsColored: subTheme.unselectedToggleIsColored,
)
- : null,
+ : FlexSubThemes.radioTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor:
+ useMaterial3 ? SchemeColor.primary : SchemeColor.secondary,
+ unselectedIsColored: false,
+ ),
// Input decorator theme.
inputDecorationTheme: effectiveInputDecorationTheme,
// FAB, floating action button theme.
@@ -6331,14 +6389,17 @@ class FlexColorScheme with Diagnosticable {
? FlexSubThemes.chipTheme(
colorScheme: colorScheme,
baseSchemeColor: subTheme.chipSchemeColor,
- labelStyle: effectiveTextTheme.button!,
+ labelStyle: effectiveTextTheme.labelLarge!,
radius: subTheme.chipRadius ?? subTheme.defaultRadius,
+ useMaterial3: useMaterial3,
)
- : ChipThemeData.fromDefaults(
- secondaryColor: colorScheme.primary,
- brightness: colorScheme.brightness,
- labelStyle: effectiveTextTheme.bodyText1!,
- ),
+ : useMaterial3
+ ? null
+ : ChipThemeData.fromDefaults(
+ secondaryColor: colorScheme.primary,
+ brightness: colorScheme.brightness,
+ labelStyle: effectiveTextTheme.bodyText1!,
+ ),
cardTheme: useSubThemes
? FlexSubThemes.cardTheme(
radius: subTheme.cardRadius ?? subTheme.defaultRadius,
@@ -6720,11 +6781,13 @@ class FlexColorScheme with Diagnosticable {
onSurface: onColors.onSurface,
surfaceVariant: effectiveSurfaceVariantColor,
onSurfaceVariant: onColors.onSurfaceVariant,
+ outline: colorScheme?.outline,
+ outlineVariant: colorScheme?.outlineVariant,
+ shadow: colorScheme?.shadow,
+ scrim: colorScheme?.scrim,
inverseSurface: effectiveInverseSurfaceColor,
onInverseSurface: onColors.onInverseSurface,
inversePrimary: colorScheme?.inversePrimary,
- shadow: colorScheme?.shadow,
- outline: colorScheme?.outline,
surfaceTint:
surfaceTint ?? colorScheme?.surfaceTint ?? colors.primary,
) ??
@@ -6754,12 +6817,15 @@ class FlexColorScheme with Diagnosticable {
onSurface: onColors.onSurface,
surfaceVariant: effectiveSurfaceVariantColor,
onSurfaceVariant: onColors.onSurfaceVariant,
+ outline: _outlineColor(usedBrightness, onColors.onBackground, 30),
+ outlineVariant:
+ _outlineColor(usedBrightness, onColors.onBackground, 60),
+ shadow: Colors.black,
+ scrim: Colors.black,
inverseSurface: effectiveInverseSurfaceColor,
onInverseSurface: onColors.onInverseSurface,
inversePrimary: _inversePrimary(
usedBrightness, colors.primary, effectiveSurfaceColor),
- shadow: Colors.black,
- outline: _outlineColor(usedBrightness, onColors.onBackground),
surfaceTint: surfaceTint ?? usedPrimary,
);
}
@@ -6781,11 +6847,12 @@ class FlexColorScheme with Diagnosticable {
}
/// FlexColorScheme default for outline color, when not using seeds.
- static Color _outlineColor(Brightness brightness, Color onBackground) {
+ static Color _outlineColor(
+ Brightness brightness, Color onBackground, int amount) {
if (brightness == Brightness.light) {
- return onBackground.lighten(30);
+ return onBackground.lighten(amount);
} else {
- return onBackground.darken(30);
+ return onBackground.darken(amount);
}
}
@@ -7750,7 +7817,9 @@ class _Scheme {
final int surfaceVariant;
final int onSurfaceVariant;
final int outline;
+ final int outlineVariant;
final int shadow;
+ final int scrim;
final int inverseSurface;
final int inverseOnSurface;
final int inversePrimary;
@@ -7779,7 +7848,9 @@ class _Scheme {
required this.surfaceVariant,
required this.onSurfaceVariant,
required this.outline,
+ required this.outlineVariant,
required this.shadow,
+ required this.scrim,
required this.inverseSurface,
required this.inverseOnSurface,
required this.inversePrimary,
@@ -7828,7 +7899,9 @@ class _Scheme {
surfaceVariant: core.neutralVariant.get(tones.surfaceVariantTone),
onSurfaceVariant: core.neutralVariant.get(tones.onSurfaceVariantTone),
outline: core.neutralVariant.get(tones.outlineTone),
+ outlineVariant: core.neutralVariant.get(tones.outlineVariantTone),
shadow: core.neutral.get(tones.shadowTone),
+ scrim: core.neutral.get(tones.scrimTone),
inverseSurface: core.neutral.get(tones.inverseSurfaceTone),
inverseOnSurface: core.neutral.get(tones.onInverseSurfaceTone),
inversePrimary: core.primary.get(tones.inversePrimaryTone),
@@ -7857,17 +7930,19 @@ class _Scheme {
Color? onError,
Color? errorContainer,
Color? onErrorContainer,
- Color? outline,
Color? background,
Color? onBackground,
Color? surface,
Color? onSurface,
Color? surfaceVariant,
Color? onSurfaceVariant,
+ Color? outline,
+ Color? outlineVariant,
+ Color? shadow,
+ Color? scrim,
Color? inverseSurface,
Color? onInverseSurface,
Color? inversePrimary,
- Color? shadow,
Color? surfaceTint,
}) {
final _Scheme scheme;
@@ -7910,17 +7985,19 @@ class _Scheme {
onError: onError ?? Color(scheme.onError),
errorContainer: errorContainer ?? Color(scheme.errorContainer),
onErrorContainer: onErrorContainer ?? Color(scheme.onErrorContainer),
- outline: outline ?? Color(scheme.outline),
background: background ?? Color(scheme.background),
onBackground: onBackground ?? Color(scheme.onBackground),
surface: surface ?? Color(scheme.surface),
onSurface: onSurface ?? Color(scheme.onSurface),
surfaceVariant: surfaceVariant ?? Color(scheme.surfaceVariant),
onSurfaceVariant: onSurfaceVariant ?? Color(scheme.onSurfaceVariant),
+ outline: outline ?? Color(scheme.outline),
+ outlineVariant: outlineVariant ?? Color(scheme.outlineVariant),
+ shadow: shadow ?? Color(scheme.shadow),
+ scrim: scrim ?? Color(scheme.scrim),
inverseSurface: inverseSurface ?? Color(scheme.inverseSurface),
onInverseSurface: onInverseSurface ?? Color(scheme.inverseOnSurface),
inversePrimary: inversePrimary ?? Color(scheme.inversePrimary),
- shadow: shadow ?? Color(scheme.shadow),
surfaceTint: surfaceTint ?? Color(scheme.primary),
brightness: brightness,
);
diff --git a/lib/src/flex_constants.dart b/lib/src/flex_constants.dart
index 7177c69f1..924d9fb5d 100644
--- a/lib/src/flex_constants.dart
+++ b/lib/src/flex_constants.dart
@@ -47,96 +47,6 @@ const int kDarkenSecondaryContainer = 14;
'This property will be completely removed in version 6.0.0.')
const int kDarkenSecondaryVariant = kDarkenSecondaryContainer;
-/// Primary surface color light blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendSurfaceLight = 0;
-
-/// Primary surface color medium blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendSurfaceMedium = 1;
-
-/// Primary surface color strong blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendSurfaceStrong = 2;
-
-/// Primary surface color heavy blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendSurfaceHeavy = 3;
-
-/// Primary background color light blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendBackgroundLight = 2;
-
-/// Primary background color medium blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendBackgroundMedium = 4;
-
-/// Primary background color strong blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendBackgroundStrong = 6;
-
-/// Primary background color heavy blend percentage value for light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendBackgroundHeavy = 8;
-
-/// Primary scaffoldBackground color heavy blend percentage value, light theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kLightBlendScaffoldHeavy = 1;
-
-/// Primary surface color light blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendSurfaceLight = 2;
-
-/// Primary surface color medium blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendSurfaceMedium = 4;
-
-/// Primary surface color strong blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendSurfaceStrong = 6;
-
-/// Primary surface color heavy blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendSurfaceHeavy = 8;
-
-/// Primary background color light blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendBackgroundLight = 5;
-
-/// Primary background color medium blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendBackgroundMedium = 8;
-
-/// Primary background color strong blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendBackgroundStrong = 11;
-
-/// Primary background color heavy blend percentage value for dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendBackgroundHeavy = 14;
-
-/// Primary scaffoldBackground color heavy blend percentage value, dark theme.
-///
-/// Used by FlexColorScheme.surfaceStyle based surface branding.
-const int kDarkBlendScaffoldHeavy = 2;
-
/// Default border radius on Navigation drawer menu.
///
/// Follows Material M3 guide.
@@ -209,7 +119,10 @@ const double kElevatedButtonElevation = 1;
const double kPopupMenuElevation = 3;
/// Default elevation of [Dialog].
-const double kDialogElevation = 10;
+///
+/// Based on https://m3.material.io/components/dialogs/specs
+/// and Flutter M3 implementation.
+const double kDialogElevation = 6;
/// Default for elevation of none modal [BottomSheet].
const double kBottomSheetElevation = 4;
diff --git a/lib/src/flex_core_palette.dart b/lib/src/flex_core_palette.dart
index d70b446cc..a8312ea71 100644
--- a/lib/src/flex_core_palette.dart
+++ b/lib/src/flex_core_palette.dart
@@ -249,10 +249,10 @@ class FlexCorePalette extends CorePalette {
// create the CorePalette from this list, has unneeded extra overhead.
// It would be a bit more efficient to make an own implementation
// of this simple mid-layer that has the needed constructors directly.
-// Keeping this version around as small private classes around so I can later
+// Keeping this version around as a small private classes so I can later
// benchmark and see if it makes a difference. Perhaps it does not matter,
// in that case extending the parent [CorePalette] is a bit prettier.
-// But its interface feels a bit like using a FFI.
+// But its interface feels a bit like using FFI.
//
// The [CorePalette] in Material Color Utilities is just a convenience
// wrapper for the needed [TonalPalette]s, that are used by an additional
diff --git a/lib/src/flex_sub_themes.dart b/lib/src/flex_sub_themes.dart
index 3881458d8..63eaeaa4b 100644
--- a/lib/src/flex_sub_themes.dart
+++ b/lib/src/flex_sub_themes.dart
@@ -20,8 +20,8 @@ enum FlexInputBorderType {
underline,
}
-/// Enum used to described which color from the active theme's
-/// [ColorScheme], should be used for by color properties available in
+/// Enum used to described which color from the active theme's 30
+/// [ColorScheme] colors, should be used for by color properties available in
/// component sub-themes.
///
/// Used when opting in on component themes. The opinionated component themes
@@ -34,7 +34,7 @@ enum FlexInputBorderType {
/// but is often the same if defined at all.
///
/// The enum selection `primaryVariant` and `secondaryVariant` colors have been
-/// deprecated in Flutter SDK 2.10.0 stable, after master v2.6.0-0.0.pre landed.
+/// deprecated in v4.2.0 as they were deprecated in Flutter SDK stable 2.10.0.
enum SchemeColor {
/// The active theme's color scheme primary color will be used.
primary,
@@ -93,12 +93,6 @@ enum SchemeColor {
/// The active theme's color scheme surface color will be used.
surface,
- /// The active theme's color scheme outline color will be used.
- outline,
-
- /// The active theme's color scheme shadow color will be used.
- shadow,
-
/// The active theme's color scheme onSurface color will be used.
onSurface,
@@ -108,6 +102,18 @@ enum SchemeColor {
/// The active theme's color scheme onSurfaceVariant color will be used.
onSurfaceVariant,
+ /// The active theme's color scheme outline color will be used.
+ outline,
+
+ /// The active theme's color scheme outlineVariant color will be used.
+ outlineVariant,
+
+ /// The active theme's color scheme shadow color will be used.
+ shadow,
+
+ /// The active theme's color scheme scrim color will be used.
+ scrim,
+
/// The active theme's color scheme inverseSurface color will be used.
inverseSurface,
@@ -283,8 +289,12 @@ class FlexSubThemes {
return colorScheme.onSurfaceVariant;
case SchemeColor.outline:
return colorScheme.outline;
+ case SchemeColor.outlineVariant:
+ return colorScheme.outlineVariant;
case SchemeColor.shadow:
return colorScheme.shadow;
+ case SchemeColor.scrim:
+ return colorScheme.scrim;
case SchemeColor.inverseSurface:
return colorScheme.inverseSurface;
case SchemeColor.onInverseSurface:
@@ -361,8 +371,12 @@ class FlexSubThemes {
return colorScheme.surfaceVariant;
case SchemeColor.outline:
return colorScheme.background;
+ case SchemeColor.outlineVariant:
+ return colorScheme.background;
case SchemeColor.shadow:
return colorScheme.background;
+ case SchemeColor.scrim:
+ return colorScheme.background;
case SchemeColor.inverseSurface:
return colorScheme.onInverseSurface;
case SchemeColor.onInverseSurface:
@@ -1016,12 +1030,20 @@ class FlexSubThemes {
/// Typically the same [ColorScheme] that is also use for your [ThemeData].
required final ColorScheme colorScheme,
- /// Select which color from the passed in [ColorScheme] to use as the
- /// chip themes main color.
+ /// Defines which [Theme] based [ColorScheme] based color the Chips
+ /// use as their base color.
///
- /// All colors in the color scheme are not good choices, but some work well.
+ /// The selected color is only used as base for the [Chip] colors, it also
+ /// uses alpha blend and opacity to create the effective Chip colors using
+ /// the selected scheme color as base.
///
- /// If not defined, [colorScheme.primary] will be used.
+ /// If not defined it defaults to effective theme based color from using
+ /// [SchemeColor.primary], when [useMaterial3] is false.
+ ///
+ /// If [useMaterial3] is true, using a null [chipSchemeColor] will
+ /// result in M3 default Chip coloring being used without opacity and alpha
+ /// blends. To get the same coloring for M3 as when [useMaterial3] is false,
+ /// pass in [SchemeColor.primary].
final SchemeColor? baseSchemeColor,
/// The style to be applied to the chip's label.
@@ -1036,7 +1058,17 @@ class FlexSubThemes {
/// based on M3 Specification
/// https://m3.material.io/components/chips/specs
final double? radius,
+
+ /// Set to true to opt in on Material 3 styled chips.
+ ///
+ /// If false widgets will use more opinionated FlexColorScheme defaults.
+ final bool? useMaterial3,
}) {
+ // Flag for not using any defined values, but instead falling back to
+ // effective M3 theme defaults.
+ final bool useM3Defaults =
+ baseSchemeColor == null && (useMaterial3 ?? false);
+
// Get base color, defaults to primary.
final Color usedBaseColor =
schemeColor(baseSchemeColor ?? SchemeColor.primary, colorScheme);
@@ -1052,35 +1084,43 @@ class FlexSubThemes {
labelStyle.copyWith(color: foreground);
return ChipThemeData(
- brightness: ThemeData.estimateBrightnessForColor(colorScheme.primary),
- padding: const EdgeInsets.all(4),
+ brightness: useM3Defaults
+ ? null
+ : ThemeData.estimateBrightnessForColor(colorScheme.primary),
+ padding: (useMaterial3 ?? false) ? null : const EdgeInsets.all(4),
// For all Chip types, except disabled, InputChip & ChoiceChip.
- backgroundColor: usedBaseColor.blendAlpha(
- colorScheme.surface, kChipBackgroundAlphaBlend),
- selectedColor: selectedBackgroundColor, // Selected InputChip
- secondarySelectedColor: selectedBackgroundColor, // Selected ChoiceChip
- checkmarkColor: foreground,
- deleteIconColor: usedBaseColor,
+ backgroundColor: useM3Defaults
+ ? null
+ : usedBaseColor.blendAlpha(
+ colorScheme.surface, kChipBackgroundAlphaBlend),
+ selectedColor:
+ useM3Defaults ? null : selectedBackgroundColor, // Selected InputChip
+ secondarySelectedColor:
+ useM3Defaults ? null : selectedBackgroundColor, // Selected ChoiceChip
+ checkmarkColor: useM3Defaults ? null : foreground,
+ deleteIconColor: useM3Defaults ? null : usedBaseColor,
// Same formula as on Elevated button and ToggleButtons. The Chip has
// a built in scrim for disabled state, making it look a bit different,
// but it is pretty close.
- disabledColor: usedBaseColor
- .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
- .withAlpha(kDisabledBackgroundAlpha),
+ disabledColor: useM3Defaults
+ ? null
+ : usedBaseColor
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledBackgroundAlpha),
// Same label style on selected and not selected chips, their different
// background style make them stand out enough.
- labelStyle: effectiveLabelStyle,
- secondaryLabelStyle: effectiveLabelStyle,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(radius ?? kChipRadius),
- ),
- ),
+ labelStyle: useM3Defaults ? null : effectiveLabelStyle,
+ secondaryLabelStyle: useM3Defaults ? null : effectiveLabelStyle,
+ shape: (useMaterial3 ?? false) && radius == null
+ ? null
+ : RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(radius ?? kChipRadius),
+ ),
+ ),
);
}
- // TODO(rydmike): No padding in Flutter dialog theme, add when available.
- // The M3 guide https://m3.material.io/components/dialogs/specs specs 24 dp.
/// An opinionated [DialogTheme] with custom corner radius and elevation.
///
/// Corner [radius] defaults to [kDialogRadius] = 28 and [elevation] to
@@ -1124,8 +1164,22 @@ class FlexSubThemes {
/// https://m3.material.io/components/dialogs/specs
final double? radius,
- /// Dialog elevation defaults to 10 [kDialogElevation].
+ /// Dialog elevation defaults to 6 [kDialogElevation].
final double? elevation = kDialogElevation,
+
+ /// Padding around the set of [actions] at the bottom of the dialog.
+ ///
+ /// Typically used to provide padding to the button bar between the button
+ /// bar and the edges of the dialog.
+ ///
+ /// If there are no [actions], then no padding will be included. It is also
+ /// important to note that [buttonPadding] may contribute to the padding on
+ /// the edges of [actions] as well.
+ ///
+ /// If null defaults to:
+ /// const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0)
+ /// same as M3 default.
+ final EdgeInsetsGeometry? actionsPadding,
}) {
final Color? background =
(colorScheme == null || backgroundSchemeColor == null)
@@ -1135,6 +1189,9 @@ class FlexSubThemes {
return DialogTheme(
elevation: elevation,
backgroundColor: background,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding: actionsPadding ??
+ const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(radius ?? kDialogRadius),
@@ -1162,11 +1219,29 @@ class FlexSubThemes {
/// Selects which color from the passed in colorScheme to use as the main
/// color for the button.
///
+ /// If [useMaterial3] is false, the [baseSchemeColor] is used as button
+ /// background color in M2 style, and if it is true, it is used as the
+ /// button foreground color for text and icon.
+ ///
/// All colors in the color scheme are not good choices, but some work well.
///
/// If not defined, [colorScheme.primary] will be used.
final SchemeColor? baseSchemeColor,
+ /// Selects which color from the passed in colorScheme to use as the
+ /// secondary color, or on color for for the button.
+ ///
+ /// If [useMaterial3] is false, the [onBaseSchemeColor] is used as button
+ /// foreground color in M2 style, and if it is true, it is used as the
+ /// button background color..
+ ///
+ /// All colors in the color scheme are not good choices, but some work well.
+ ///
+ /// If not defined, the [baseSchemeColor] on color will be used if
+ /// [useMaterial3] is false, if it is true, then [colorScheme.surface] will
+ /// be used.
+ final SchemeColor? onBaseSchemeColor,
+
/// The button corner radius.
///
/// If not defined, defaults to [kButtonRadius] 20dp,
@@ -1174,12 +1249,23 @@ class FlexSubThemes {
/// https://m3.material.io/components/buttons/specs
final double? radius,
- /// The button elevation
+ /// The button elevation.
///
- /// Defaults to [kElevatedButtonElevation] 1, making it a bit more flat in
- /// its elevation state than Flutter SDK, that defaults to 2.
- /// An opinionated choice.
- final double elevation = kElevatedButtonElevation,
+ /// If null and passed in [useMaterial3] is false then it defaults to using
+ /// [kElevatedButtonElevation] 1 with [ElevatedButton.styleFrom], making it
+ /// a bit more flat in its elevation state than Flutter M2, that defaults
+ /// to 2.
+ ///
+ /// If null and passed in [useMaterial3] is true, then it defaults to using
+ /// the M3 elevation defaults by keeping elevation null and using default
+ /// M3 elevated button style. This requires that the ambient theme also uses
+ /// Material 3.
+ ///
+ /// If a value is passed in, the [ElevatedButton.styleFrom] constructor used
+ /// for M2 style elevation is used with the passed in value. The
+ /// constructor has its own built on logic for the different elevation
+ /// values for its MaterialStateProperty.
+ final double? elevation,
/// Padding for the button theme.
///
@@ -1188,68 +1274,142 @@ class FlexSubThemes {
/// M3 has more horizontal padding 24dp, but the tighter default padding
/// in M2 that is 16dp looks fine as well when using stadium borders
/// as in M3.
- /// Making the custom scalable padding and separate one for icon
- /// versions is rather involved, so sticking to defaults, but exposing the
- /// padding property for future or external use.
+ ///
+ /// If null and [useMaterial3] is true in the context, the correct M3
+ /// button theme default computed button padding for M3 will be used.
final EdgeInsetsGeometry? padding,
/// Minimum button size.
///
- /// Defaults to `kButtonMinSize` = Size(40, 40).
- final Size minButtonSize = kButtonMinSize,
+ /// If null, defaults to [kButtonMinSize] (`const Size(64.0, 40.0)`) when
+ /// [useMaterial3] is false and to `const Size(64.0, 40.0)` when
+ /// [useMaterial3] is true.
+ final Size? minButtonSize,
+
+ /// A temporary flag used to opt-in to new Material 3 features.
+ ///
+ /// If set to true, the theme will use Material3 default styles when
+ /// properties are undefined, if false defaults will use FlexColorScheme's
+ /// own opinionated defaults values.
+ ///
+ /// The M2/M3 SDK defaults will only be used for properties that are not
+ /// defined, if defined they keep their defined values.
+ final bool useMaterial3 = false,
}) {
// Get selected color, defaults to primary.
final SchemeColor baseScheme = baseSchemeColor ?? SchemeColor.primary;
final Color baseColor = schemeColor(baseScheme, colorScheme);
- final Color onBaseColor = schemeColorPair(baseScheme, colorScheme);
-
- return ElevatedButtonThemeData(
- style: ElevatedButton.styleFrom(
- minimumSize: minButtonSize,
- padding: padding,
- elevation: elevation,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(radius ?? kButtonRadius),
+ // On color logic with M3 reversal of roles.
+ final Color onBaseColor = onBaseSchemeColor == null
+ ? useMaterial3
+ ? schemeColor(SchemeColor.surface, colorScheme)
+ : schemeColorPair(baseScheme, colorScheme)
+ : schemeColor(onBaseSchemeColor, colorScheme);
+
+ // We are using FCS M2 buttons, styled in M3 fashion.
+ if (!useMaterial3) {
+ return ElevatedButtonThemeData(
+ style: ElevatedButton.styleFrom(
+ minimumSize: minButtonSize ?? kButtonMinSize,
+ padding: padding,
+ elevation: elevation ?? kElevatedButtonElevation,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(radius ?? kButtonRadius),
+ ),
+ ), //buttonShape,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return baseColor
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledForegroundAlpha);
+ }
+ return onBaseColor;
+ },
+ ),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return baseColor
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledBackgroundAlpha);
+ }
+ return baseColor;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return onBaseColor.withAlpha(kHoverBackgroundAlpha);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return onBaseColor.withAlpha(kFocusBackgroundAlpha);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return onBaseColor.withAlpha(kPressedBackgroundAlpha);
+ }
+ return Colors.transparent;
+ },
),
- ), //buttonShape,
- ).copyWith(
- foregroundColor: MaterialStateProperty.resolveWith(
- (Set states) {
- if (states.contains(MaterialState.disabled)) {
- return baseColor
- .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
- .withAlpha(kDisabledForegroundAlpha);
- }
- return onBaseColor;
- },
- ),
- backgroundColor: MaterialStateProperty.resolveWith(
- (Set states) {
- if (states.contains(MaterialState.disabled)) {
- return baseColor
- .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
- .withAlpha(kDisabledBackgroundAlpha);
- }
- return baseColor;
- },
),
- overlayColor: MaterialStateProperty.resolveWith(
- (Set states) {
- if (states.contains(MaterialState.hovered)) {
- return onBaseColor.withAlpha(kHoverBackgroundAlpha);
- }
- if (states.contains(MaterialState.focused)) {
- return onBaseColor.withAlpha(kFocusBackgroundAlpha);
- }
- if (states.contains(MaterialState.pressed)) {
- return onBaseColor.withAlpha(kPressedBackgroundAlpha);
- }
- return Colors.transparent;
- },
+ );
+ //
+ // We are using M3 style buttons, with potentially custom radius,
+ // elevation, foregroundColor, backgroundColor, overlayColor, padding
+ // and minButtonSize.
+ } else {
+ final MaterialStateProperty foregroundColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return baseColor;
+ });
+
+ final MaterialStateProperty backgroundColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.12);
+ }
+ return onBaseColor;
+ });
+
+ final MaterialStateProperty overlayColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return baseColor.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return baseColor.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return baseColor.withOpacity(0.12);
+ }
+ return null;
+ });
+
+ return ElevatedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: foregroundColor,
+ backgroundColor: backgroundColor,
+ overlayColor: overlayColor,
+ minimumSize: ButtonStyleButton.allOrNull(minButtonSize),
+ padding: ButtonStyleButton.allOrNull(padding),
+ elevation: ButtonStyleButton.allOrNull(elevation),
+ shape: radius == null
+ ? null
+ : ButtonStyleButton.allOrNull(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(radius),
+ ),
+ ),
+ ),
),
- ),
- );
+ );
+ }
}
/// An opinionated [FloatingActionButtonThemeData] with custom border radius.
@@ -1390,13 +1550,14 @@ class FlexSubThemes {
/// The border width when the input is selected.
///
- /// Defaults to 2.0.
- final double focusedBorderWidth = kThickBorderWidth,
+ /// If null, defaults to [kThickBorderWidth] = 2.
+ final double? focusedBorderWidth,
/// The border width when the input is unselected or disabled.
///
- /// Defaults to 1.5.
- final double unfocusedBorderWidth = kThinBorderWidth,
+ /// If null, defaults to [kThinBorderWidth] = 1.5, when
+ /// [useMaterial3] is false, and to 1 when [useMaterial3] is true.
+ final double? unfocusedBorderWidth,
/// Horizontal padding on either side of the border's
/// [InputDecoration.labelText] width gap.
@@ -1432,21 +1593,40 @@ class FlexSubThemes {
///
/// Defaults to true.
final bool unfocusedBorderIsColored = true,
+
+ /// A temporary flag used to opt-in to new Material 3 features.
+ ///
+ /// If set to true, the theme will use Material3 default styles when
+ /// properties are undefined, if false defaults will use FlexColorScheme's
+ /// own opinionated defaults values.
+ ///
+ /// The M2/M3 SDK defaults will only be used for properties that are not
+ /// defined, if defined they keep their defined values.
+ final bool useMaterial3 = false,
}) {
// Get selected color, defaults to primary.
final Color baseColor =
schemeColor(baseSchemeColor ?? SchemeColor.primary, colorScheme);
- final Color usedFillColor = fillColor ??
- (colorScheme.brightness == Brightness.dark
- ? baseColor.withAlpha(kFillColorAlphaDark)
- : baseColor.withAlpha(kFillColorAlphaLight));
+ final Color? usedFillColor = fillColor ??
+ (useMaterial3
+ ? null
+ : (colorScheme.brightness == Brightness.dark
+ ? baseColor.withAlpha(kFillColorAlphaDark)
+ : baseColor.withAlpha(kFillColorAlphaLight)));
final Color enabledBorder = unfocusedBorderIsColored
? baseColor.withAlpha(kEnabledBorderAlpha)
: colorScheme.onSurface.withOpacity(0.38);
- final double effectiveRadius = radius ?? kInputDecoratorRadius;
+ // Default border radius.
+ final double effectiveRadius = radius ??
+ (useMaterial3 ? kInputDecoratorM3Radius : kInputDecoratorRadius);
+
+ // Default outline widths.
+ final double unfocusedWidth =
+ unfocusedBorderWidth ?? (useMaterial3 ? 1 : kThinBorderWidth);
+ final double focusedWidth = focusedBorderWidth ?? kThickBorderWidth;
switch (borderType) {
case FlexInputBorderType.outline:
@@ -1480,7 +1660,7 @@ class FlexSubThemes {
borderRadius: BorderRadius.all(Radius.circular(effectiveRadius)),
borderSide: BorderSide(
color: baseColor,
- width: focusedBorderWidth,
+ width: focusedWidth,
),
),
enabledBorder: OutlineInputBorder(
@@ -1489,7 +1669,7 @@ class FlexSubThemes {
borderSide: unfocusedHasBorder
? BorderSide(
color: enabledBorder,
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
)
: BorderSide.none,
),
@@ -1501,7 +1681,7 @@ class FlexSubThemes {
color: baseColor
.blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
.withAlpha(kDisabledBackgroundAlpha),
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
)
: BorderSide.none,
),
@@ -1510,7 +1690,7 @@ class FlexSubThemes {
borderRadius: BorderRadius.all(Radius.circular(effectiveRadius)),
borderSide: BorderSide(
color: colorScheme.error,
- width: focusedBorderWidth,
+ width: focusedWidth,
),
),
errorBorder: OutlineInputBorder(
@@ -1518,7 +1698,7 @@ class FlexSubThemes {
borderRadius: BorderRadius.all(Radius.circular(effectiveRadius)),
borderSide: BorderSide(
color: colorScheme.error.withAlpha(kEnabledBorderAlpha),
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
),
),
);
@@ -1555,7 +1735,7 @@ class FlexSubThemes {
),
borderSide: BorderSide(
color: baseColor,
- width: focusedBorderWidth,
+ width: focusedWidth,
),
),
enabledBorder: UnderlineInputBorder(
@@ -1566,7 +1746,7 @@ class FlexSubThemes {
borderSide: unfocusedHasBorder
? BorderSide(
color: enabledBorder,
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
)
: BorderSide.none,
),
@@ -1580,7 +1760,7 @@ class FlexSubThemes {
color: baseColor
.blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
.withAlpha(kDisabledBackgroundAlpha),
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
)
: BorderSide.none,
),
@@ -1591,7 +1771,7 @@ class FlexSubThemes {
),
borderSide: BorderSide(
color: colorScheme.error,
- width: focusedBorderWidth,
+ width: focusedWidth,
),
),
errorBorder: UnderlineInputBorder(
@@ -1601,7 +1781,7 @@ class FlexSubThemes {
),
borderSide: BorderSide(
color: colorScheme.error.withAlpha(kEnabledBorderAlpha),
- width: unfocusedBorderWidth,
+ width: unfocusedWidth,
),
),
);
@@ -1916,54 +2096,6 @@ class FlexSubThemes {
///
/// The M2/M3 SDK defaults will only be used for properties that are not
/// defined, if defined they keep their defined values.
- ///
- /// Flutter SDK 3.0.5 [useMaterial3] documentation:
- /// -----------------------------------------------
- /// If true, then components that have been migrated to Material 3 will
- /// use new colors, typography and other features of Material 3.
- /// If false, they will use the Material 2 look and feel.
- ///
- /// If a [ThemeData] is constructed with [useMaterial3] set to true, then
- /// some properties will get special defaults. However, just copying a
- /// [ThemeData] with [useMaterial3] set to true will not change any of
- /// these properties in the
- /// resulting [ThemeData]. These properties are:
- ///
- ///
- /// | Property | Material 3 default | Fallback default |
- /// | :-------------- | :--------------------------- | :---------------- |
- /// | [typography] | [Typography.material2021] | [Typography.material2014] |
- /// | [splashFactory] | [InkSparkle]* or [InkRipple] | [InkSplash] |
- ///
- /// \* if and only if the target platform is Android and the app is not
- /// running on the web, otherwise it will fallback to [InkRipple].
- ///
- /// During the migration to Material 3, turning this on may yield
- /// inconsistent look and feel in your app. Some components will be migrated
- /// before others and typography changes will be coming in stages.
- ///
- /// [useMaterial3] defaults to false. After all the migrated components
- /// have landed on stable, we will change this to be true by default. After
- /// that change has landed on stable, we will deprecate this flag and remove
- /// all uses of it. Everything will use the Material 3 look and feel at
- /// that point.
- ///
- /// Components that have been migrated to Material 3 are:
- ///
- /// * [AlertDialog]
- /// * [AppBar]
- /// * [Card]
- /// * [Dialog]
- /// * [ElevatedButton]
- /// * [FloatingActionButton]
- /// * [Material]
- /// * [NavigationBar]
- /// * [NavigationRail]
- /// * [OutlinedButton]
- /// * [StretchingOverscrollIndicator], replacing the
- /// [GlowingOverscrollIndicator]
- /// * [TextButton]
final bool useMaterial3 = false,
/// Set to true to use Flutter SDK defaults for [NavigationBar]
@@ -2400,54 +2532,6 @@ class FlexSubThemes {
///
/// The M2/M3 SDK defaults will only be used for properties that are not
/// defined, if defined they keep their defined values.
- ///
- /// Flutter SDK 3.0.5 [useMaterial3] documentation:
- /// -----------------------------------------------
- /// If true, then components that have been migrated to Material 3 will
- /// use new colors, typography and other features of Material 3.
- /// If false, they will use the Material 2 look and feel.
- ///
- /// If a [ThemeData] is constructed with [useMaterial3] set to true, then
- /// some properties will get special defaults. However, just copying a
- /// [ThemeData] with [useMaterial3] set to true will not change any of
- /// these properties in the
- /// resulting [ThemeData]. These properties are:
- ///
- ///
- /// | Property | Material 3 default | Fallback default |
- /// | :-------------- | :--------------------------- | :---------------- |
- /// | [typography] | [Typography.material2021] | [Typography.material2014] |
- /// | [splashFactory] | [InkSparkle]* or [InkRipple] | [InkSplash] |
- ///
- /// \* if and only if the target platform is Android and the app is not
- /// running on the web, otherwise it will fallback to [InkRipple].
- ///
- /// During the migration to Material 3, turning this on may yield
- /// inconsistent look and feel in your app. Some components will be migrated
- /// before others and typography changes will be coming in stages.
- ///
- /// [useMaterial3] defaults to false. After all the migrated components
- /// have landed on stable, we will change this to be true by default. After
- /// that change has landed on stable, we will deprecate this flag and remove
- /// all uses of it. Everything will use the Material 3 look and feel at
- /// that point.
- ///
- /// Components that have been migrated to Material 3 are:
- ///
- /// * [AlertDialog]
- /// * [AppBar]
- /// * [Card]
- /// * [Dialog]
- /// * [ElevatedButton]
- /// * [FloatingActionButton]
- /// * [Material]
- /// * [NavigationBar]
- /// * [NavigationRail]
- /// * [OutlinedButton]
- /// * [StretchingOverscrollIndicator], replacing the
- /// [GlowingOverscrollIndicator]
- /// * [TextButton]
final bool useMaterial3 = false,
/// Set to true to use Flutter SDK defaults for [NavigationRail]
@@ -2483,7 +2567,7 @@ class FlexSubThemes {
/// [BottomNavigationBar], [NavigationBar] and [NavigationRail],
/// prefer keeping this setting false.
///
- /// If undefined, defaults to false.
+ /// Defaults to false.
final bool useFlutterDefaults = false,
}) {
// Determine if we can even use default icon styles, only when all are null,
@@ -2630,6 +2714,18 @@ class FlexSubThemes {
/// If not defined, [colorScheme.primary] will be used.
final SchemeColor? baseSchemeColor,
+ /// Defines which [Theme] based [ColorScheme] based color, that the
+ /// [OutlinedButton] uses as its outline color.
+ ///
+ /// If [useMaterial3] is false, and the [baseSchemeColor] is not defined,
+ /// the [baseSchemeColor] is used as default button
+ /// outline color, following M2 style.
+ ///
+ /// If [useMaterial3] is true, and the [outlineSchemeColor] is
+ /// not defined, the [colorScheme.outline] is used as default button
+ /// outline color in M3 style.
+ final SchemeColor? outlineSchemeColor,
+
/// The button corner border radius.
///
/// If not defined, defaults to [kButtonRadius] 20dp,
@@ -2637,15 +2733,17 @@ class FlexSubThemes {
/// https://m3.material.io/components/buttons/specs
final double? radius,
- /// The outline thickness when the button is pressed.
+ /// The outline thickness when the button is pressed or in error state.
///
- /// Defaults to 2.0.
- final double pressedOutlineWidth = kThickBorderWidth,
+ /// If null, defaults to [kThickBorderWidth] = 2, when
+ /// [useMaterial3] is false, and to 1 when [useMaterial3] is true.
+ final double? pressedOutlineWidth,
/// The outline thickness when the button is not selected and not pressed.
///
- /// Defaults to 1.5.
- final double outlineWidth = kThinBorderWidth,
+ /// If null, defaults to [kThinBorderWidth] = 1.5, when
+ /// [useMaterial3] is false, and to 1 when [useMaterial3] is true.
+ final double? outlineWidth,
/// Padding for the button theme.
///
@@ -2654,84 +2752,185 @@ class FlexSubThemes {
/// M3 has more horizontal padding 24dp, but the tighter default padding
/// in M2 that is 16dp looks fine as well when using stadium borders
/// as in M3.
- /// Making the custom scalable padding and separate one for icon
- /// versions is rather involved, so sticking to defaults, but exposing the
- /// padding property for future or external use.
+ ///
+ /// If null and [useMaterial3] is true in the context, the correct M3
+ /// button theme default computed button padding for M3 will be used.
final EdgeInsetsGeometry? padding,
/// Minimum button size.
///
- /// Defaults to `kButtonMinSize` = Size(40, 40).
- final Size minButtonSize = kButtonMinSize,
+ /// If null, defaults to [kButtonMinSize] (`const Size(64.0, 40.0)`) when
+ /// [useMaterial3] is false and to `const Size(64.0, 40.0)` when
+ /// [useMaterial3] is true.
+ final Size? minButtonSize,
+
+ /// A temporary flag used to opt-in to new Material 3 features.
+ ///
+ /// If set to true, the theme will use Material3 default styles when
+ /// properties are undefined, if false defaults will use FlexColorScheme's
+ /// own opinionated defaults values.
+ ///
+ /// The M2/M3 SDK defaults will only be used for properties that are not
+ /// defined, if defined they keep their defined values.
+ final bool useMaterial3 = false,
}) {
// Get selected color, defaults to primary.
final Color baseColor =
schemeColor(baseSchemeColor ?? SchemeColor.primary, colorScheme);
- return OutlinedButtonThemeData(
- style: OutlinedButton.styleFrom(
- minimumSize: minButtonSize,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(radius ?? kButtonRadius),
- ),
- ), //buttonShape,
- padding: padding,
- ).copyWith(
- foregroundColor: MaterialStateProperty.resolveWith(
- (Set states) {
- if (states.contains(MaterialState.disabled)) {
- return baseColor
- .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
- .withAlpha(kDisabledForegroundAlpha);
- }
- return baseColor;
- },
- ),
- overlayColor: MaterialStateProperty.resolveWith(
- (Set states) {
- if (states.contains(MaterialState.hovered)) {
- return baseColor.withAlpha(kHoverBackgroundAlpha);
- }
- if (states.contains(MaterialState.focused)) {
- return baseColor.withAlpha(kFocusBackgroundAlpha);
- }
- if (states.contains(MaterialState.pressed)) {
- return baseColor.withAlpha(kPressedBackgroundAlpha);
- }
- return Colors.transparent;
- },
- ),
- side: MaterialStateProperty.resolveWith(
- (final Set states) {
- if (states.contains(MaterialState.disabled)) {
- return BorderSide(
- color: baseColor
+ // Outline color logic with different M2 and M3 defaults.
+ final Color outlineColor = outlineSchemeColor == null
+ ? useMaterial3
+ ? schemeColor(SchemeColor.outline, colorScheme)
+ : baseColor
+ : schemeColor(outlineSchemeColor, colorScheme);
+
+ // Default outline widths.
+ final double normalWidth =
+ outlineWidth ?? (useMaterial3 ? 1 : kThinBorderWidth);
+ final double pressedWidth =
+ pressedOutlineWidth ?? (useMaterial3 ? 1 : kThickBorderWidth);
+
+ // We are using FCS M2 buttons, styled in M3 fashion.
+ if (!useMaterial3) {
+ return OutlinedButtonThemeData(
+ style: OutlinedButton.styleFrom(
+ minimumSize: minButtonSize ?? kButtonMinSize,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(radius ?? kButtonRadius),
+ ),
+ ), //buttonShape,
+ padding: padding,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return baseColor
.blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
- .withAlpha(kDisabledBackgroundAlpha),
- width: outlineWidth,
- );
- }
- if (states.contains(MaterialState.error)) {
- return BorderSide(
- color: colorScheme.error,
- width: pressedOutlineWidth,
- );
- }
- if (states.contains(MaterialState.pressed)) {
+ .withAlpha(kDisabledForegroundAlpha);
+ }
+ return baseColor;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return baseColor.withAlpha(kHoverBackgroundAlpha);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return baseColor.withAlpha(kFocusBackgroundAlpha);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return baseColor.withAlpha(kPressedBackgroundAlpha);
+ }
+ return Colors.transparent;
+ },
+ ),
+ side: MaterialStateProperty.resolveWith(
+ (final Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: outlineColor
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledBackgroundAlpha),
+ width: normalWidth,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: pressedWidth,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: outlineColor,
+ width: pressedWidth,
+ );
+ }
return BorderSide(
- color: baseColor,
- width: pressedOutlineWidth,
+ color: outlineColor.withAlpha(kEnabledBorderAlpha),
+ width: normalWidth,
);
- }
- return BorderSide(
- color: baseColor.withAlpha(kEnabledBorderAlpha),
- width: outlineWidth,
- );
- },
+ },
+ ),
),
- ),
- );
+ );
+ // We are using M3 style buttons, with potentially custom radius,
+ // foregroundColor, outlineColor, overlayColor, padding
+ // and minButtonSize.
+ } else {
+ final MaterialStateProperty foregroundColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return baseColor;
+ });
+
+ final MaterialStateProperty overlayColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return baseColor.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return baseColor.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return baseColor.withOpacity(0.12);
+ }
+ return null;
+ });
+
+ final MaterialStateProperty side =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: colorScheme.onSurface.withOpacity(0.12),
+ width: normalWidth,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: pressedWidth,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: outlineColor,
+ width: pressedWidth,
+ );
+ }
+ return BorderSide(
+ color: outlineColor,
+ width: normalWidth,
+ );
+ });
+
+ return OutlinedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: foregroundColor,
+ backgroundColor:
+ ButtonStyleButton.allOrNull(Colors.transparent),
+ overlayColor: overlayColor,
+ minimumSize: ButtonStyleButton.allOrNull(minButtonSize),
+ padding: ButtonStyleButton.allOrNull(padding),
+ elevation: ButtonStyleButton.allOrNull(0.0),
+ side: side,
+ shape: radius == null
+ ? null
+ : ButtonStyleButton.allOrNull(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(radius),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
}
/// An opinionated [PopupMenuThemeData] with custom corner radius.
@@ -2844,20 +3043,19 @@ class FlexSubThemes {
// }
// TODO(rydmike): SnackBar needs two different corner radius versions.
- // The pinned one should not have a shape, but the floating one should.
- // Not possible to do via its theme, if it could be then the floating one
- // should follow the themed corner radius setting and pinned one
- // remain straight. The SnackBar implements different shapes for its
- // enum based [SnackBarBehavior], but only if [Shape] property is null:
- // If null, [SnackBar] provides different defaults depending on the
- // [SnackBarBehavior]. For [SnackBarBehavior.fixed], no overriding shape
- // is specified, so the [SnackBar] is rectangular. For
- // [SnackBarBehavior.floating], it uses a [RoundedRectangleBorder] with a
- // circular corner radius of 4.0.
- // Maybe open an issue about the limitation that corner radius on none
- // pinned one cannot be changed via theme while keeping straight one
- // straight. However, I think M3 will need it too, so it might come then.
+ // The fixed one should not have a shape, but the floating one should.
+ // Not possible to do via its theme, if it could be then the floating one
+ // should follow the themed corner radius setting and pinned one
+ // remain straight. The SnackBar implements different shapes for its
+ // enum based [SnackBarBehavior], but only if [Shape] property is null:
+ // If null, [SnackBar] provides different defaults depending on the
+ // [SnackBarBehavior]. For [SnackBarBehavior.fixed], no overriding shape
+ // is specified, so the [SnackBar] is rectangular. For
+ // [SnackBarBehavior.floating], it uses a [RoundedRectangleBorder] with a
+ // circular corner radius of 4.0.
//
+ // Opened issue: https://github.com/flutter/flutter/issues/108539
+
/// An opinionated [SnackBarThemeData] with custom elevation.
///
/// The [elevation] defaults to [kSnackBarElevation] (4).
@@ -3232,8 +3430,9 @@ class FlexSubThemes {
/// In this design it uses the same default as outline thickness for
/// selected outline button and input decorator.
///
- /// Defaults to 1.5.
- final double borderWidth = kThinBorderWidth,
+ /// If null, defaults to [kThinBorderWidth] = 1.5, when
+ /// [useMaterial3] is false, and to 1 when [useMaterial3] is true.
+ final double? borderWidth,
/// Minimum button size.
///
@@ -3252,16 +3451,30 @@ class FlexSubThemes {
/// Defaults to null, that results in VisualDensity.adaptivePlatformDensity
/// being used, which is same as null default in ThemeData.
final VisualDensity? visualDensity,
+
+ /// A temporary flag used to opt-in to new Material 3 features.
+ ///
+ /// If set to true, the theme will use Material3 default styles when
+ /// properties are undefined, if false defaults will use FlexColorScheme's
+ /// own opinionated defaults values.
+ ///
+ /// The M2/M3 SDK defaults will only be used for properties that are not
+ /// defined, if defined they keep their defined values.
+ final bool useMaterial3 = false,
}) {
// Get selected color, defaults to primary.
final SchemeColor baseScheme = baseSchemeColor ?? SchemeColor.primary;
final Color baseColor = schemeColor(baseScheme, colorScheme);
final Color onBaseColor = schemeColorPair(baseScheme, colorScheme);
+ // Effective border width, default different with M3.
+ final double effectiveWidth =
+ borderWidth ?? (useMaterial3 ? 1.0 : kThinBorderWidth);
+ // Effective visual density.
final VisualDensity usedVisualDensity =
visualDensity ?? VisualDensity.adaptivePlatformDensity;
return ToggleButtonsThemeData(
- borderWidth: borderWidth,
+ borderWidth: effectiveWidth,
selectedColor: onBaseColor.withAlpha(kSelectedAlpha),
color: baseColor,
fillColor: baseColor.blendAlpha(Colors.white, kAltPrimaryAlphaBlend),
@@ -3299,10 +3512,10 @@ class FlexSubThemes {
// VisualDensity property. Give it the same value that your theme
// uses. This defaults to same value that ThemeData uses by default.
minWidth: minButtonSize.width -
- borderWidth * 2 +
+ effectiveWidth * 2 +
usedVisualDensity.baseSizeAdjustment.dx,
minHeight: minButtonSize.height -
- borderWidth * 2 +
+ effectiveWidth * 2 +
usedVisualDensity.baseSizeAdjustment.dy,
),
);
diff --git a/lib/src/flex_sub_themes_data.dart b/lib/src/flex_sub_themes_data.dart
index ab007c12b..f82e2dc4e 100644
--- a/lib/src/flex_sub_themes_data.dart
+++ b/lib/src/flex_sub_themes_data.dart
@@ -112,18 +112,20 @@ class FlexSubThemesData with Diagnosticable {
//
this.buttonMinSize = kButtonMinSize,
this.buttonPadding = kButtonPadding,
- this.thickBorderWidth = kThickBorderWidth,
- this.thinBorderWidth = kThinBorderWidth,
+ this.thickBorderWidth,
+ this.thinBorderWidth,
//
this.textButtonRadius,
this.elevatedButtonRadius,
- this.elevatedButtonElevation = kElevatedButtonElevation,
+ this.elevatedButtonElevation,
this.outlinedButtonRadius,
this.toggleButtonsRadius,
//
this.textButtonSchemeColor,
this.elevatedButtonSchemeColor,
+ this.elevatedButtonSecondarySchemeColor,
this.outlinedButtonSchemeColor,
+ this.outlinedButtonOutlineSchemeColor,
this.materialButtonSchemeColor,
this.toggleButtonsSchemeColor,
//
@@ -146,7 +148,7 @@ class FlexSubThemesData with Diagnosticable {
this.inputDecoratorUnfocusedBorderIsColored = true,
//
this.fabRadius,
- this.fabUseShape = true,
+ this.fabUseShape = false,
this.fabSchemeColor,
this.chipRadius,
this.chipSchemeColor,
@@ -157,6 +159,7 @@ class FlexSubThemesData with Diagnosticable {
this.popupMenuRadius,
this.popupMenuElevation = kPopupMenuElevation,
this.popupMenuOpacity = 1,
+ //
this.dialogRadius,
this.dialogElevation = kDialogElevation,
this.dialogBackgroundSchemeColor,
@@ -165,6 +168,8 @@ class FlexSubThemesData with Diagnosticable {
this.snackBarBackgroundSchemeColor,
//
this.appBarBackgroundSchemeColor,
+ this.appBarCenterTitle,
+ //
this.tabBarItemSchemeColor,
this.tabBarIndicatorSchemeColor,
//
@@ -575,16 +580,21 @@ class FlexSubThemesData with Diagnosticable {
/// Applies to enabled [OutlinedButton] and always to [ToggleButtons], as well
/// as to selected state of [InputDecorator].
///
- /// Defaults to [kThickBorderWidth].
- final double thickBorderWidth;
+ ///
+ /// If undefined and [ThemeData.useMaterial3] is false,
+ /// defaults to [kThickBorderWidth].
+ /// If undefined and [ThemeData.useMaterial3] is true, defaults to 1.0.
+ final double? thickBorderWidth;
/// Border thickness on unselected input decorator and disabled buttons.
///
/// Applies to disabled [OutlinedButton] and to un-selected state in
/// [InputDecorator].
///
- /// Defaults to [kThinBorderWidth].
- final double thinBorderWidth;
+ /// If undefined and [ThemeData.useMaterial3] is false,
+ /// defaults to [kThinBorderWidth].
+ /// If undefined and [ThemeData.useMaterial3] is true, defaults to 1.0.
+ final double? thinBorderWidth;
/// Border radius override value for [TextButton].
///
@@ -603,11 +613,13 @@ class FlexSubThemesData with Diagnosticable {
/// Elevation of [ElevatedButton].
///
/// This design favors a flat design using colors, the elevated button is
- /// primary colored by default, it thus needs no elevation or ery little in
- /// this design.
+ /// primary colored by default, it thus needs no elevation or very little in
+ /// FlexColorSchemes custom design.
///
- /// Defaults to [kElevatedButtonElevation] = 1.
- final double elevatedButtonElevation;
+ /// If null, defaults to [kElevatedButtonElevation] = 1, when [useMaterial3]
+ /// is false. If [useMaterial3] is true, it is kept null and default M3
+ /// elevation of [ElevatedButton] is kept.
+ final double? elevatedButtonElevation;
/// Border radius value for [OutlinedButton].
///
@@ -633,22 +645,50 @@ class FlexSubThemesData with Diagnosticable {
/// FlexColorScheme sub-theme defaults when opting on its sub themes.
final SchemeColor? textButtonSchemeColor;
- /// Defines which [Theme] based [ColorScheme] based color the
- /// [ElevatedButton] use as its base theme color.
+ /// Defines which [Theme] based [ColorScheme] based color, that the
+ /// [ElevatedButton] used as its main color.
///
- /// If not defined it defaults to theme.colorScheme.primary color via
- /// FlexColorScheme sub-theme defaults when opting on its sub themes.
+ /// If [useMaterial3] is false, the [elevatedButtonSchemeColor] is used as
+ /// button background color in M2 style. If [useMaterial3] is true, it is
+ /// used as the button foreground color for text and icon.
+ ///
+ /// If not defined, it defaults to theme.colorScheme.primary color via
+ /// FlexColorScheme sub-theme defaults when opting on sub themes.
final SchemeColor? elevatedButtonSchemeColor;
- /// Defines which [Theme] based [ColorScheme] based color the
- /// [OutlinedButton] use as its base theme color.
+ /// Defines which [Theme] based [ColorScheme] based color, that the
+ /// [ElevatedButton] uses as its secondary color.
+ ///
+ /// If [useMaterial3] is false, the [elevatedButtonSecondarySchemeColor] is
+ /// used as button foreground color in M2 style. If [useMaterial3] is true,
+ /// it is used as the button background color.
+ ///
+ /// If not defined, the [elevatedButtonSchemeColor]'s on color will be used if
+ /// [useMaterial3] is false, and if it is true, then [ColorScheme.surface]
+ /// will be used as default.
+ final SchemeColor? elevatedButtonSecondarySchemeColor;
+
+ /// Defines which [Theme] based [ColorScheme] based color, that the
+ /// [OutlinedButton] use as its main theme color.
///
/// If not defined it defaults to theme.colorScheme.primary color via
/// FlexColorScheme sub-theme defaults when opting on its sub themes.
final SchemeColor? outlinedButtonSchemeColor;
- /// Defines which [Theme] based [ColorScheme] based color the old
- /// [MaterialButton] use as its base theme color.
+ /// Defines which [Theme] based [ColorScheme] based color, that the
+ /// [OutlinedButton] uses as its outline color.
+ ///
+ /// If [useMaterial3] is false, and the [outlinedButtonOutlineSchemeColor] is
+ /// not defined, the [outlinedButtonSchemeColor] is used as default button
+ /// outline color, following M2 style.
+ ///
+ /// If [useMaterial3] is true, and the [outlinedButtonOutlineSchemeColor] is
+ /// not defined, the [ColorScheme.outline] is used as default button
+ /// outline color in M3 style.
+ final SchemeColor? outlinedButtonOutlineSchemeColor;
+
+ /// Defines which [Theme] based [ColorScheme] based color, that the old
+ /// [MaterialButton] use as its main theme color.
///
/// The [MaterialButton] is the parent class of old deprecated and removed
/// buttons `RaisedButton`, `OutlineButton` and `FlatButton`. The theme
@@ -854,30 +894,39 @@ class FlexSubThemesData with Diagnosticable {
/// Border radius value for [FloatingActionButton].
///
/// If not defined and [defaultRadius] is undefined, defaults to
- /// [kFabRadius] 16dp, based on M3 Specification
+ /// [kFabRadius] 16dp, based on M3 Specification for normal sized FAB.
/// https://m3.material.io/components/floating-action-button/specs
+ ///
+ /// The border radius is only assigned when [fabUseShape] is true, if
+ /// [fabUseShape] is false, the [fabRadius] has no effect on FAB shapes.
+ ///
+ /// If [ThemeData.useMaterial3] and [fabUseShape] are true, you cannot define
+ /// FAB buttons that get the same rounding style as defined by the M3 spec.
+ /// This is because the FAB cannot be themed in same style as its default null
+ /// shape behavior. See issue
+ /// [#107946](https://github.com/flutter/flutter/issues/107946) for
+ /// more information.
final double? fabRadius;
/// Use shape theming on Floating Action Button (FAB).
///
- /// By setting [fabUseShape] to false it is possible to opt out of all
- /// shape theming on FABs and keeping tis un-themed defaults, while still
- /// eg. keeping M3 defaults on other widgets or changing their border radius
- /// with the shared global value.
+ /// When [fabUseShape] is false, default since FCS version 5.2.0, no custom
+ /// shape theme is used on FABs, it keeps its un-themed defaults. The
+ /// [fabRadius] properties has no effect when[ fabUseShape] is false.
///
- /// You may want to continue to keep the FAB round and extended FAB stadium
- /// shaped as before, despite otherwise using a rounder or M3 design.
- /// The circular M2 FAB goes well with those designs too.
+ /// If [ThemeData.useMaterial3] is false the FAB is circular. If it is true,
+ /// the FAB uses M3 shapes as defined by
+ /// https://m3.material.io/components/floating-action-button/specs
///
- /// When the [ThemeData.useMaterial3] will start to have an impact in Flutter
- /// SDK on the [FloatingActionButton] shape and design, setting [fabUseShape]
- /// to false and [ThemeData.useMaterial3] to true, will result in the
- /// M3 spec default FAB shape as implemented by the SDK. As long as the
- /// [ThemeData.useMaterial3] exist in the framework, setting it to false
- /// and setting [fabUseShape] to false, will continue to produce the M2
- /// design.
+ /// Defaults to false.
///
- /// Defaults to true.
+ /// The default opinionated style was changed from true to false, in
+ /// version 5.2.0. This is a style break with previous versions where it was
+ /// true. The opinionated style change was done to use a style that by default
+ /// matches M3 style, when [ThemeData.useMaterial3] is true.
+ ///
+ /// To make make circular FAB when [ThemeData.useMaterial3] is true, set
+ /// [fabUseShape] to true and [fabRadius] to a high values, like 60.
final bool fabUseShape;
/// Defines which [Theme] based [ColorScheme] based color the Floating
@@ -898,7 +947,17 @@ class FlexSubThemesData with Diagnosticable {
/// Defines which [Theme] based [ColorScheme] based color the Chips
/// use as their base color.
///
- /// If not defined it defaults to theme.colorScheme.primary color.
+ /// The selected color is only used as base for the [Chip] colors, it also
+ /// uses alpha blend and opacity to create the effective Chip colors using
+ /// the selected scheme color as base.
+ ///
+ /// If not defined it defaults to effective theme based color from using
+ /// [SchemeColor.primary], when [useMaterial3] is false.
+ ///
+ /// If [useMaterial3] is true, using a null [chipSchemeColor] will
+ /// result in M3 default Chip coloring being used without opacity and alpha
+ /// blends. To get the same coloring for M3 as when [useMaterial3] is false,
+ /// pass in [SchemeColor.primary].
final SchemeColor? chipSchemeColor;
/// Border radius value for [Card].
@@ -1065,6 +1124,13 @@ class FlexSubThemesData with Diagnosticable {
/// ([appBarStyle) factory parameter.
final SchemeColor? appBarBackgroundSchemeColor;
+ /// Whether the AppBar title should be centered.
+ ///
+ /// Overrides the default value of [AppBar.centerTitle] property in all
+ /// descendant [AppBar] widgets. Ff this property is null, then value
+ /// is adapted to the current [TargetPlatform].
+ final bool? appBarCenterTitle;
+
/// Defines which [Theme] based [ColorScheme] based color the [TabBar]
/// items use.
///
@@ -1827,7 +1893,9 @@ class FlexSubThemesData with Diagnosticable {
final double? toggleButtonsRadius,
final SchemeColor? textButtonSchemeColor,
final SchemeColor? elevatedButtonSchemeColor,
+ final SchemeColor? elevatedButtonSecondarySchemeColor,
final SchemeColor? outlinedButtonSchemeColor,
+ final SchemeColor? outlinedButtonOutlineSchemeColor,
final SchemeColor? materialButtonSchemeColor,
final SchemeColor? toggleButtonsSchemeColor,
final SchemeColor? switchSchemeColor,
@@ -1859,7 +1927,10 @@ class FlexSubThemesData with Diagnosticable {
final double? timePickerDialogRadius,
final double? snackBarElevation,
final SchemeColor? snackBarBackgroundSchemeColor,
+ //
final SchemeColor? appBarBackgroundSchemeColor,
+ final bool? appBarCenterTitle,
+ //
final SchemeColor? tabBarItemSchemeColor,
final SchemeColor? tabBarIndicatorSchemeColor,
//
@@ -1947,8 +2018,12 @@ class FlexSubThemesData with Diagnosticable {
textButtonSchemeColor ?? this.textButtonSchemeColor,
elevatedButtonSchemeColor:
elevatedButtonSchemeColor ?? this.elevatedButtonSchemeColor,
+ elevatedButtonSecondarySchemeColor: elevatedButtonSecondarySchemeColor ??
+ this.elevatedButtonSecondarySchemeColor,
outlinedButtonSchemeColor:
outlinedButtonSchemeColor ?? this.outlinedButtonSchemeColor,
+ outlinedButtonOutlineSchemeColor: outlinedButtonOutlineSchemeColor ??
+ this.outlinedButtonOutlineSchemeColor,
materialButtonSchemeColor:
materialButtonSchemeColor ?? this.materialButtonSchemeColor,
toggleButtonsSchemeColor:
@@ -1994,6 +2069,7 @@ class FlexSubThemesData with Diagnosticable {
snackBarBackgroundSchemeColor ?? this.snackBarBackgroundSchemeColor,
appBarBackgroundSchemeColor:
appBarBackgroundSchemeColor ?? this.appBarBackgroundSchemeColor,
+ appBarCenterTitle: appBarCenterTitle ?? this.appBarCenterTitle,
tabBarItemSchemeColor:
tabBarItemSchemeColor ?? this.tabBarItemSchemeColor,
tabBarIndicatorSchemeColor:
@@ -2160,7 +2236,11 @@ class FlexSubThemesData with Diagnosticable {
other.toggleButtonsRadius == toggleButtonsRadius &&
other.textButtonSchemeColor == textButtonSchemeColor &&
other.elevatedButtonSchemeColor == elevatedButtonSchemeColor &&
+ other.elevatedButtonSecondarySchemeColor ==
+ elevatedButtonSecondarySchemeColor &&
other.outlinedButtonSchemeColor == outlinedButtonSchemeColor &&
+ other.outlinedButtonOutlineSchemeColor ==
+ outlinedButtonOutlineSchemeColor &&
other.materialButtonSchemeColor == materialButtonSchemeColor &&
other.toggleButtonsSchemeColor == toggleButtonsSchemeColor &&
other.switchSchemeColor == switchSchemeColor &&
@@ -2192,7 +2272,10 @@ class FlexSubThemesData with Diagnosticable {
other.timePickerDialogRadius == timePickerDialogRadius &&
other.snackBarElevation == snackBarElevation &&
other.snackBarBackgroundSchemeColor == snackBarBackgroundSchemeColor &&
+ //
other.appBarBackgroundSchemeColor == appBarBackgroundSchemeColor &&
+ other.appBarCenterTitle == appBarCenterTitle &&
+ //
other.tabBarItemSchemeColor == tabBarItemSchemeColor &&
other.tabBarIndicatorSchemeColor == tabBarIndicatorSchemeColor &&
other.bottomSheetRadius == bottomSheetRadius &&
@@ -2321,7 +2404,9 @@ class FlexSubThemesData with Diagnosticable {
//
textButtonSchemeColor,
elevatedButtonSchemeColor,
+ elevatedButtonSecondarySchemeColor,
outlinedButtonSchemeColor,
+ outlinedButtonOutlineSchemeColor,
materialButtonSchemeColor,
toggleButtonsSchemeColor,
//
@@ -2359,7 +2444,10 @@ class FlexSubThemesData with Diagnosticable {
//
snackBarElevation,
snackBarBackgroundSchemeColor,
+ //
appBarBackgroundSchemeColor,
+ appBarCenterTitle,
+ //
tabBarItemSchemeColor,
tabBarIndicatorSchemeColor,
//
@@ -2459,8 +2547,13 @@ class FlexSubThemesData with Diagnosticable {
'textButtonSchemeColor', textButtonSchemeColor));
properties.add(EnumProperty(
'elevatedButtonSchemeColor', elevatedButtonSchemeColor));
+ properties.add(EnumProperty(
+ 'elevatedButtonSecondarySchemeColor',
+ elevatedButtonSecondarySchemeColor));
properties.add(EnumProperty(
'outlinedButtonSchemeColor', outlinedButtonSchemeColor));
+ properties.add(EnumProperty(
+ 'outlinedButtonOutlineSchemeColor', outlinedButtonOutlineSchemeColor));
properties.add(EnumProperty(
'materialButtonSchemeColor', materialButtonSchemeColor));
properties.add(EnumProperty(
@@ -2515,6 +2608,8 @@ class FlexSubThemesData with Diagnosticable {
'snackBarBackgroundSchemeColor', snackBarBackgroundSchemeColor));
properties.add(EnumProperty(
'appBarBackgroundSchemeColor', appBarBackgroundSchemeColor));
+ properties
+ .add(DiagnosticsProperty('appBarCenterTitle', appBarCenterTitle));
properties.add(EnumProperty(
'tabBarItemSchemeColor', tabBarItemSchemeColor));
properties.add(EnumProperty(
diff --git a/lib/src/flex_theme_data_extensions.dart b/lib/src/flex_theme_data_extensions.dart
index 42f557621..dc40b18c6 100644
--- a/lib/src/flex_theme_data_extensions.dart
+++ b/lib/src/flex_theme_data_extensions.dart
@@ -234,12 +234,14 @@ extension FlexThemeData on ThemeData {
/// Defaults to 0.
final int blendLevel = 0,
- /// Style used to define the themed color of the [AppBar] background color.
+ /// Style used to define the themed color of the AppBar background color.
///
- /// Defaults to [FlexAppBarStyle.primary] which produces the same results
- /// as a Flutter standard light [ThemeData.from] by tying the app bar color
- /// to the primary color.
- final FlexAppBarStyle appBarStyle = FlexAppBarStyle.primary,
+ /// Defaults to null, which when [useMaterial3] is false results in
+ /// [FlexAppBarStyle.primary] which produces the same results
+ /// as a Flutter standard M2 light [ThemeData.from] by tying the app bar
+ /// color to the primary color. If [useMaterial3] is true it defaults
+ /// [FlexAppBarStyle.surface] which is the same as M3 default.
+ final FlexAppBarStyle? appBarStyle,
/// Themed [AppBar] opacity.
///
@@ -1394,10 +1396,12 @@ extension FlexThemeData on ThemeData {
/// Style used to define the themed color of the [AppBar] background color.
///
- /// Defaults to [FlexAppBarStyle.material] which produces the same results
- /// as a Flutter standard dark [ThemeData.from] by tying the app bar color
- /// to the surface color.
- final FlexAppBarStyle appBarStyle = FlexAppBarStyle.material,
+ /// Defaults to null, which when [useMaterial3] is false results in
+ /// [FlexAppBarStyle.material] which produces the same results
+ /// as a Flutter standard M2 dark [ThemeData.from] by tying the app bar
+ /// color to the M2 dark Material color. If [useMaterial3] is true it
+ /// defaults [FlexAppBarStyle.surface] which is the same as M3 default.
+ final FlexAppBarStyle? appBarStyle,
/// Themed [AppBar] opacity.
///
diff --git a/lib/src/flex_tones.dart b/lib/src/flex_tones.dart
index d1cc2b12a..424ad059f 100644
--- a/lib/src/flex_tones.dart
+++ b/lib/src/flex_tones.dart
@@ -1,5 +1,3 @@
-import 'dart:ui';
-
import 'package:flutter/foundation.dart';
// ignore_for_file: comment_references
@@ -79,7 +77,9 @@ class FlexTones with Diagnosticable {
required this.surfaceVariantTone,
required this.onSurfaceVariantTone,
required this.outlineTone,
+ required this.outlineVariantTone,
required this.shadowTone,
+ required this.scrimTone,
required this.inverseSurfaceTone,
required this.onInverseSurfaceTone,
required this.inversePrimaryTone,
@@ -123,7 +123,9 @@ class FlexTones with Diagnosticable {
this.surfaceVariantTone = 90,
this.onSurfaceVariantTone = 30,
this.outlineTone = 50,
+ this.outlineVariantTone = 80,
this.shadowTone = 0,
+ this.scrimTone = 0,
this.inverseSurfaceTone = 20,
this.onInverseSurfaceTone = 95,
this.inversePrimaryTone = 80,
@@ -167,7 +169,9 @@ class FlexTones with Diagnosticable {
this.surfaceVariantTone = 30,
this.onSurfaceVariantTone = 80,
this.outlineTone = 60,
+ this.outlineVariantTone = 30,
this.shadowTone = 0,
+ this.scrimTone = 0,
this.inverseSurfaceTone = 90,
this.onInverseSurfaceTone = 20,
this.inversePrimaryTone = 40,
@@ -440,9 +444,16 @@ class FlexTones with Diagnosticable {
/// Tone used for [ColorScheme.outline] from neutralVariant [TonalPalette].
final int outlineTone;
+ /// Tone used for [ColorScheme.outlineVariant] from neutralVariant
+ /// [TonalPalette].
+ final int outlineVariantTone;
+
/// Tone used for [ColorScheme.shadow] from neutral [TonalPalette].
final int shadowTone;
+ /// Tone used for [ColorScheme.scrim] from neutral [TonalPalette].
+ final int scrimTone;
+
/// Tone used for [ColorScheme.inverseSurface] from neutral [TonalPalette].
final int inverseSurfaceTone;
@@ -574,7 +585,9 @@ class FlexTones with Diagnosticable {
int? surfaceVariantTone,
int? onSurfaceVariantTone,
int? outlineTone,
+ int? outlineVariantTone,
int? shadowTone,
+ int? scrimTone,
int? inverseSurfaceTone,
int? onInverseSurfaceTone,
int? inversePrimaryTone,
@@ -616,7 +629,9 @@ class FlexTones with Diagnosticable {
surfaceVariantTone: surfaceVariantTone ?? this.surfaceVariantTone,
onSurfaceVariantTone: onSurfaceVariantTone ?? this.onSurfaceVariantTone,
outlineTone: outlineTone ?? this.outlineTone,
+ outlineVariantTone: outlineVariantTone ?? this.outlineVariantTone,
shadowTone: shadowTone ?? this.shadowTone,
+ scrimTone: scrimTone ?? this.scrimTone,
inverseSurfaceTone: inverseSurfaceTone ?? this.inverseSurfaceTone,
onInverseSurfaceTone: onInverseSurfaceTone ?? this.onInverseSurfaceTone,
inversePrimaryTone: inversePrimaryTone ?? this.inversePrimaryTone,
@@ -660,7 +675,9 @@ class FlexTones with Diagnosticable {
other.surfaceVariantTone == surfaceVariantTone &&
other.onSurfaceVariantTone == onSurfaceVariantTone &&
other.outlineTone == outlineTone &&
+ other.outlineVariantTone == outlineVariantTone &&
other.shadowTone == shadowTone &&
+ other.scrimTone == scrimTone &&
other.inverseSurfaceTone == inverseSurfaceTone &&
other.onInverseSurfaceTone == onInverseSurfaceTone &&
other.inversePrimaryTone == inversePrimaryTone &&
@@ -700,7 +717,9 @@ class FlexTones with Diagnosticable {
surfaceVariantTone,
onSurfaceVariantTone,
outlineTone,
+ outlineVariantTone,
shadowTone,
+ scrimTone,
inverseSurfaceTone,
onInverseSurfaceTone,
inversePrimaryTone,
@@ -752,7 +771,10 @@ class FlexTones with Diagnosticable {
properties.add(
DiagnosticsProperty('onSurfaceVariantTone', onSurfaceVariantTone));
properties.add(DiagnosticsProperty('outlineTone', outlineTone));
+ properties.add(
+ DiagnosticsProperty('outlineVariantTone', outlineVariantTone));
properties.add(DiagnosticsProperty('shadowTone', shadowTone));
+ properties.add(DiagnosticsProperty('scrimTone', scrimTone));
properties.add(
DiagnosticsProperty('inverseSurfaceTone', inverseSurfaceTone));
properties.add(
diff --git a/pubspec.lock b/pubspec.lock
index 6eb80a626..447016fd7 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
- version: "41.0.0"
+ version: "43.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
- version: "4.2.0"
+ version: "4.3.1"
args:
dependency: transitive
description:
@@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@@ -42,21 +42,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -91,7 +84,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
file:
dependency: transitive
description:
@@ -164,21 +157,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: "direct main"
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.2.0"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
mime:
dependency: transitive
description:
@@ -206,7 +199,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
pool:
dependency: transitive
description:
@@ -227,7 +220,7 @@ packages:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.1"
+ version: "1.3.2"
shelf_packages_handler:
dependency: transitive
description:
@@ -274,7 +267,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.1"
stack_trace:
dependency: transitive
description:
@@ -295,35 +288,35 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
- version: "1.21.1"
+ version: "1.21.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.13"
+ version: "0.4.16"
typed_data:
dependency: transitive
description:
@@ -375,4 +368,4 @@ packages:
version: "3.1.1"
sdks:
dart: ">=2.17.0 <3.0.0"
- flutter: ">=3.0.0"
+ flutter: ">=3.1.0-0.0.pre.2199"
diff --git a/pubspec.yaml b/pubspec.yaml
index ac9afdcd9..390531758 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,13 +1,13 @@
name: flex_color_scheme
description: A Flutter package to use and make beautiful Material design based themes.
-version: 5.1.0
+version: 5.2.0-dev.1
homepage: https://docs.flexcolorscheme.com
repository: https://github.com/rydmike/flex_color_scheme
issue_tracker: https://github.com/rydmike/flex_color_scheme/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
documentation: https://docs.flexcolorscheme.com
environment:
sdk: '>=2.17.0 <3.0.0'
- flutter: '>=3.0.0'
+ flutter: '>=3.1.0-0.0.pre.2199'
dependencies:
flutter:
@@ -16,8 +16,16 @@ dependencies:
# Color utilities by Google (material.io).
# Used to compute and create Tonal Palette theme colors.
# Flutter SDK from 2.10.0 stable also uses and depends on this package.
- # Using ^0.1.4 because Flutter stable 3.0.0 uses it. Latest release is 0.1.5.
- material_color_utilities: ^0.1.4
+ #
+ # Use ^0.1.3 for Flutter stable 2.10.x, that uses 0.1.3
+ # Use ^0.1.3 for Flutter stable 3.0.x, that uses 0.1.4.
+ # Use ^0.1.3 for Flutter rel candidates 3.1, 3.2, 3.4, that uses 0.1.5, beware that
+ # version 0.1.5 has a new algo compared to 0.1.4 that changes some seed colors slightly.
+ # Use ^0.2.0 for Flutter master 3.1.0-x, that uses 0.2.0 after 5.8.2022 release.
+ # material_color_utilities: ^0.1.3
+ # material_color_utilities: ^0.1.4
+ # material_color_utilities: ^0.1.5
+ material_color_utilities: ^0.2.0
dev_dependencies:
flutter_test:
diff --git a/test/flex_color_scheme_sub_themes_test.dart b/test/flex_color_scheme_sub_themes_test.dart
index 11db9c08a..eedcf3ec6 100644
--- a/test/flex_color_scheme_sub_themes_test.dart
+++ b/test/flex_color_scheme_sub_themes_test.dart
@@ -527,86 +527,5 @@ void main() {
equals(FlexColor.blumineBlueDarkSecondary),
);
});
- // TODO(rydmike): Remove all the fontFamily experiments from tests too.
- // Keeping them around for a while in case I need it again, then the
- // tests are readily available.
- // test(
- // 'FCS8.012-android: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.android,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('Roboto'),
- // );
- // });
- // test(
- // 'FCS8.012-windows: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.windows,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('Segoe UI'),
- // );
- // });
- // test(
- // 'FCS8.012-iOS: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.iOS,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('.SF UI Text'),
- // );
- // });
- // test(
- // 'FCS8.012-macOS: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.macOS,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('.AppleSystemUIFont'),
- // );
- // });
- // test(
- // 'FCS8.012-linux: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.linux,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('Roboto'),
- // );
- // });
- // test(
- // 'FCS8.012-fuchsia: GIVEN a FlexColorScheme raw with sub themes '
- // 'and using sub-theme with custom textTheme '
- // 'EXPECT target platform fontFamily.', () {
- // const FlexColorScheme fcs = FlexColorScheme(
- // subThemesData: FlexSubThemesData(useTextTheme: true),
- // platform: TargetPlatform.fuchsia,
- // );
- // expect(
- // fcs.toTheme.textTheme.bodyMedium!.fontFamily,
- // equals('Roboto'),
- // );
- // });
});
}
diff --git a/test/flex_color_scheme_test.dart b/test/flex_color_scheme_test.dart
index 46010eace..4c72945f2 100644
--- a/test/flex_color_scheme_test.dart
+++ b/test/flex_color_scheme_test.dart
@@ -26,7 +26,15 @@ void main() {
// Expect toTheme to be equal
expect(fcsDefault.toScheme, equals(fcsMaterialLight.toScheme));
// Expect toTheme to be equal
- expect(fcsDefault.toTheme, equals(fcsMaterialLight.toTheme));
+ // TODO(rydmike): toString on ThemeData match, but not ThemeData, why?
+ // This is repeated for many test cases. It seems like ThemeData
+ // equality comparison cannot be guaranteed when using sub-themes that
+ // uses MaterialState or MaterialStateProperty. Verify and report this.
+ // Investigate first what SDK ThemeData test do, if they even attempt it
+ expect(
+ fcsDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(fcsMaterialLight.toTheme
+ .toString(minLevel: DiagnosticLevel.fine)));
});
final FlexSchemeColor sc =
@@ -56,7 +64,10 @@ void main() {
'EXPECT FlexColorScheme.light with scheme Material.', () {
expect(fc1, equals(fc1i));
// Expect toTheme from them to full-fill same condition.
- expect(fc1.toTheme, equals(fc1i.toTheme));
+ expect(
+ fc1.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fc1i.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
final FlexColorScheme fc2 = FlexColorScheme.light(
@@ -89,19 +100,9 @@ void main() {
expect(fc2, equals(fc2i));
// Expect toTheme from them to full-fill same condition.
expect(
- fc2.toTheme.toString(),
- equalsIgnoringHashCodes(fc2i.toTheme.toString()),
- );
- // TODO(rydmike): toString on ThemeData match above, but not ThemeData!
- // Using isNot to prove that here and get a track on the issue, if it
- // ever changes and is fixed. Before there was this issue, but it has
- // been fixed and landed too:
- // https://github.com/flutter/flutter/issues/91587
- //
- // Check ThemeData equality, well checking inequality for now.
- expect(
- fc2.toTheme,
- isNot(fc2i.toTheme),
+ fc2.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fc2i.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -132,19 +133,9 @@ void main() {
expect(fc3, equals(fc3i));
// Expect toTheme from them to full-fill same condition.
expect(
- fc3.toTheme.toString(),
- equalsIgnoringHashCodes(fc3i.toTheme.toString()),
- );
- // TODO(rydmike): toString on ThemeData match above, but not ThemeData!
- // Using isNot to prove that here and get a track on the issue, if it
- // ever changes and is fixed. Before there was this issue, but it has
- // been fixed and landed too:
- // https://github.com/flutter/flutter/issues/91587
- //
- // Check ThemeData equality, well checking inequality for now.
- expect(
- fc3.toTheme,
- isNot(fc3i.toTheme),
+ fc3.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fc3i.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -175,7 +166,10 @@ void main() {
() {
expect(fc4, equals(fc4i));
// Expect toTheme from them to full-fill same condition.
- expect(fc4.toTheme, equals(fc4i.toTheme));
+ expect(
+ fc4.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fc4i.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
// m1 = Default material light scheme colors.
const FlexColorScheme m1 = FlexColorScheme(
@@ -218,7 +212,10 @@ void main() {
'EXPECT them to have equality', () {
expect(m1, equals(m1));
// Expect toTheme from them to full-fill same condition.
- expect(m1.toTheme, equals(m1.toTheme));
+ expect(
+ m1.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
test(
'FCS1.01b: GIVEN the same FlexColorScheme objects '
@@ -230,7 +227,10 @@ void main() {
'EXPECT them to have equality', () {
expect(m1, equals(m2));
// Expect toTheme from them to full-fill same condition.
- expect(m1.toTheme, equals(m2.toTheme));
+ expect(
+ m1.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m2.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
test(
'FCS1.01d: GIVEN two equal FlexColorScheme objects '
@@ -242,7 +242,13 @@ void main() {
'EXPECT them to have equality with operator', () {
expect(m1 == m2, true);
// Expect toTheme from them to full-fill same condition.
- expect(m1.toTheme == m2.toTheme, true);
+ // TODO(rydmike): toString on ThemeData equals, but not ThemeData op, why?
+ // This is repeated for many test cases. It seems like ThemeData
+ // equality comparison cannot be guaranteed when using sub-themes that
+ // uses MaterialState or MaterialStateProperty. Verify and report this.
+ // Investigate first what SDK ThemeData test do, if they even attempt
+ // it. This is commented for now.
+ // expect(m1.toTheme == m2.toTheme, true);
});
test(
'FCS1.02a: GIVEN none identical FlexColorScheme objects '
@@ -271,14 +277,20 @@ void main() {
'equal to an unequal object when made equal with copyWith.', () {
expect(m1e1, equals(m1));
// Expect toTheme from them to full-fill same condition.
- expect(m1e1.toTheme, equals(m1.toTheme));
+ expect(
+ m1e1.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
test(
'FCS1.03b: GIVEN a FlexColorScheme object EXPECT it to be '
'unchanged after an empty .copyWith().', () {
expect(m4.copyWith(), m4);
// Expect toTheme from them to full-fill same condition.
- expect(m4.copyWith().toTheme, equals(m4.toTheme));
+ expect(
+ m4.copyWith().toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m4.toTheme.toString(minLevel: DiagnosticLevel.fine)));
});
final FlexColorScheme m1e2 = FlexColorScheme.light(
@@ -310,8 +322,11 @@ void main() {
expect(FlexColorScheme.light(), equals(m1e2));
// Expect toTheme from them to full-fill same condition.
expect(
- FlexColorScheme.light().toTheme,
- equals(m1e2.toTheme),
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e2.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -324,8 +339,11 @@ void main() {
);
// Expect toTheme from them to full-fill same condition.
expect(
- FlexColorScheme.light(colors: FlexColor.material.light).toTheme,
- equals(m1e2.toTheme),
+ FlexColorScheme.light(colors: FlexColor.material.light)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e2.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -341,8 +359,10 @@ void main() {
expect(
FlexColorScheme.light(
colors: FlexColor.schemes[FlexScheme.material]!.light)
- .toTheme,
- equals(m1e2.toTheme),
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e2.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -361,8 +381,9 @@ void main() {
FlexColorScheme.light(
surfaceMode: FlexSurfaceMode.highBackgroundLowScaffold,
blendLevel: 0,
- ).toTheme,
- equals(m1e2.toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e2.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -398,8 +419,9 @@ void main() {
);
// Expect toTheme from them to full-fill same condition.
expect(
- FlexColorScheme.dark().toTheme,
- equals(m1e3.toTheme),
+ FlexColorScheme.dark().toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e3.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
test(
@@ -415,8 +437,9 @@ void main() {
expect(
FlexColorScheme.dark(
colors: FlexColor.material.dark,
- ).toTheme,
- equals(m1e3.toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e3.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
test(
@@ -432,8 +455,9 @@ void main() {
expect(
FlexColorScheme.dark(
colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme,
- equals(m1e3.toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e3.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -451,8 +475,9 @@ void main() {
FlexColorScheme.dark(
surfaceMode: FlexSurfaceMode.highBackgroundLowScaffold,
blendLevel: 0,
- ).toTheme,
- equals(m1e3.toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ m1e3.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -555,7 +580,7 @@ void main() {
// ignore: lines_longer_than_80_chars
equalsIgnoringHashCodes(
// ignore: lines_longer_than_80_chars
- 'FlexColorScheme#00000(colorScheme: null, brightness: light, primary: Color(0xff6200ee), primaryContainer: Color(0xffbb86fc), primaryVariant: null, secondary: Color(0xff03dac6), secondaryContainer: Color(0xffcefaf8), secondaryVariant: null, tertiary: Color(0xff018786), tertiaryContainer: Color(0xffa4f1ef), error: Color(0xffb00020), surface: Color(0xffffffff), background: Color(0xffffffff), scaffoldBackground: Color(0xffffffff), appBarBackground: Color(0xff6200ee), dialogBackground: Color(0xffffffff), onPrimary: Color(0xffffffff), onPrimaryContainer: Color(0xffffffff), onSecondary: Color(0xff000000), onSecondaryContainer: Color(0xff000000), onTertiary: Color(0xffffffff), onTertiaryContainer: Color(0xff000000), onSurface: Color(0xff000000), onBackground: Color(0xff000000), onError: Color(0xffffffff), surfaceTint: null, tabBarStyle: forAppBar, appBarElevation: 1.0, bottomAppBarElevation: 2.0, tooltipsMatchBackground: true, transparentStatusBar: false, visualDensity: 0, v: 0.0), textTheme: TextTheme#00000(displayLarge: TextStyle(inherit: true, size: 80.0), displayMedium: null, displaySmall: null, headlineLarge: null, headlineMedium: null, headlineSmall: null, titleLarge: null, titleMedium: null, titleSmall: null, bodyLarge: null, bodyMedium: null, bodySmall: null, labelLarge: null, labelMedium: null, labelSmall: null), primaryTextTheme: TextTheme#00000(displayLarge: TextStyle(inherit: true, size: 80.0), displayMedium: null, displaySmall: null, headlineLarge: null, headlineMedium: null, headlineSmall: null, titleLarge: null, titleMedium: null, titleSmall: null, bodyLarge: null, bodyMedium: null, bodySmall: null, labelLarge: null, labelMedium: null, labelSmall: null), fontFamily: Roboto, platform: android, typography: Typography#00000(englishLike: TextTheme#00000(displayLarge: TextStyle(debugLabel: englishLike displayLarge 2018, inherit: true, size: 96.0, weight: 300, letterSpacing: -1.5, baseline: alphabetic), displayMedium: TextStyle(debugLabel: englishLike displayMedium 2018, inherit: true, size: 60.0, weight: 300, letterSpacing: -0.5, baseline: alphabetic), displaySmall: TextStyle(debugLabel: englishLike displaySmall 2018, inherit: true, size: 48.0, weight: 400, letterSpacing: 0.0, baseline: alphabetic), headlineLarge: TextStyle(debugLabel: englishLike headlineLarge 2018, inherit: true, size: 40.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), headlineMedium: TextStyle(debugLabel: englishLike headlineMedium 2018, inherit: true, size: 34.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), headlineSmall: TextStyle(debugLabel: englishLike headlineSmall 2018, inherit: true, size: 24.0, weight: 400, letterSpacing: 0.0, baseline: alphabetic), titleLarge: TextStyle(debugLabel: englishLike titleLarge 2018, inherit: true, size: 20.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic), titleMedium: TextStyle(debugLabel: englishLike titleMedium 2018, inherit: true, size: 16.0, weight: 400, letterSpacing: 0.1, baseline: alphabetic), titleSmall: TextStyle(debugLabel: englishLike titleSmall 2018, inherit: true, size: 14.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic), bodyLarge: TextStyle(debugLabel: englishLike bodyLarge 2018, inherit: true, size: 16.0, weight: 400, letterSpacing: 0.5, baseline: alphabetic), bodyMedium: TextStyle(debugLabel: englishLike bodyMedium 2018, inherit: true, size: 14.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), bodySmall: TextStyle(debugLabel: englishLike bodySmall 2018, inherit: true, size: 12.0, weight: 400, letterSpacing: 0.4, baseline: alphabetic), labelLarge: TextStyle(debugLabel: englishLike labelLarge 2018, inherit: true, size: 14.0, weight: 500, letterSpacing: 1.3, baseline: alphabetic), labelMedium: TextStyle(debugLabel: englishLike labelMedium 2018, inherit: true, size: 11.0, weight: 400, letterSpacing: 1.5, baseline: alphabetic), labelSmall: TextStyle(debugLabel: englishLike labelSmall 2018, inherit: true, size: 10.0, weight: 400, letterSpacing: 1.5, baseline: alphabetic)), dense: TextTheme#00000(displayLarge: TextStyle(debugLabel: dense displayLarge 2018, inherit: true, size: 96.0, weight: 100, baseline: ideographic), displayMedium: TextStyle(debugLabel: dense displayMedium 2018, inherit: true, size: 60.0, weight: 100, baseline: ideographic), displaySmall: TextStyle(debugLabel: dense displaySmall 2018, inherit: true, size: 48.0, weight: 400, baseline: ideographic), headlineLarge: TextStyle(debugLabel: dense headlineLarge 2018, inherit: true, size: 40.0, weight: 400, baseline: ideographic), headlineMedium: TextStyle(debugLabel: dense headlineMedium 2018, inherit: true, size: 34.0, weight: 400, baseline: ideographic), headlineSmall: TextStyle(debugLabel: dense headlineSmall 2018, inherit: true, size: 24.0, weight: 400, baseline: ideographic), titleLarge: TextStyle(debugLabel: dense titleLarge 2018, inherit: true, size: 21.0, weight: 500, baseline: ideographic), titleMedium: TextStyle(debugLabel: dense titleMedium 2018, inherit: true, size: 17.0, weight: 400, baseline: ideographic), titleSmall: TextStyle(debugLabel: dense titleSmall 2018, inherit: true, size: 15.0, weight: 500, baseline: ideographic), bodyLarge: TextStyle(debugLabel: dense bodyLarge 2018, inherit: true, size: 17.0, weight: 400, baseline: ideographic), bodyMedium: TextStyle(debugLabel: dense bodyMedium 2018, inherit: true, size: 15.0, weight: 400, baseline: ideographic), bodySmall: TextStyle(debugLabel: dense bodySmall 2018, inherit: true, size: 13.0, weight: 400, baseline: ideographic), labelLarge: TextStyle(debugLabel: dense labelLarge 2018, inherit: true, size: 15.0, weight: 500, baseline: ideographic), labelMedium: TextStyle(debugLabel: dense labelMedium 2018, inherit: true, size: 12.0, weight: 400, baseline: ideographic), labelSmall: TextStyle(debugLabel: dense labelSmall 2018, inherit: true, size: 11.0, weight: 400, baseline: ideographic)), tall: TextTheme#00000(displayLarge: TextStyle(debugLabel: tall displayLarge 2018, inherit: true, size: 96.0, weight: 400, baseline: alphabetic), displayMedium: TextStyle(debugLabel: tall displayMedium 2018, inherit: true, size: 60.0, weight: 400, baseline: alphabetic), displaySmall: TextStyle(debugLabel: tall displaySmall 2018, inherit: true, size: 48.0, weight: 400, baseline: alphabetic), headlineLarge: TextStyle(debugLabel: tall headlineLarge 2018, inherit: true, size: 40.0, weight: 400, baseline: alphabetic), headlineMedium: TextStyle(debugLabel: tall headlineMedium 2018, inherit: true, size: 34.0, weight: 400, baseline: alphabetic), headlineSmall: TextStyle(debugLabel: tall headlineSmall 2018, inherit: true, size: 24.0, weight: 400, baseline: alphabetic), titleLarge: TextStyle(debugLabel: tall titleLarge 2018, inherit: true, size: 21.0, weight: 700, baseline: alphabetic), titleMedium: TextStyle(debugLabel: tall titleMedium 2018, inherit: true, size: 17.0, weight: 400, baseline: alphabetic), titleSmall: TextStyle(debugLabel: tall titleSmall 2018, inherit: true, size: 15.0, weight: 500, baseline: alphabetic), bodyLarge: TextStyle(debugLabel: tall bodyLarge 2018, inherit: true, size: 17.0, weight: 700, baseline: alphabetic), bodyMedium: TextStyle(debugLabel: tall bodyMedium 2018, inherit: true, size: 15.0, weight: 400, baseline: alphabetic), bodySmall: TextStyle(debugLabel: tall bodySmall 2018, inherit: true, size: 13.0, weight: 400, baseline: alphabetic), labelLarge: TextStyle(debugLabel: tall labelLarge 2018, inherit: true, size: 15.0, weight: 700, baseline: alphabetic), labelMedium: TextStyle(debugLabel: tall labelMedium 2018, inherit: true, size: 12.0, weight: 400, baseline: alphabetic), labelSmall: TextStyle(debugLabel: tall labelSmall 2018, inherit: true, size: 11.0, weight: 400, baseline: alphabetic))), applyElevationOverlayColor: false, subThemesData: FlexSubThemesData#00000(interactionEffects: true, blendOnLevel : 0, blendOnColors: true, useFlutterDefaults: false, blendTextTheme: true, useTextTheme: true, defaultRadius: 20.0, buttonMinSize: Size(40.0, 40.0), buttonPadding: EdgeInsets(16.0, 0.0, 16.0, 0.0), thickBorderWidth: 2.0, thinBorderWidth: 1.5, textButtonRadius: null, elevatedButtonRadius: null, elevatedButtonElevation: 1.0, outlinedButtonRadius: null, toggleButtonsRadius: null, textButtonSchemeColor: null, elevatedButtonSchemeColor: null, outlinedButtonSchemeColor: null, materialButtonSchemeColor: null, toggleButtonsSchemeColor: null, switchSchemeColor: null, checkboxSchemeColor: null, radioSchemeColor: null, unselectedToggleIsColored: false, inputDecoratorRadius: null, inputDecoratorSchemeColor: null, inputDecoratorIsFilled: true, inputDecoratorFillColor: null, inputDecoratorBorderType: outline, inputDecoratorUnfocusedHasBorder: true, inputDecoratorUnfocusedBorderIsColored: true, fabRadius: null, fabUseShape: true, fabSchemeColor: null, chipRadius: null, chipSchemeColor: null, cardRadius: null, cardElevation: 0.0, popupMenuRadius: null, popupMenuElevation: 3.0, popupMenuOpacity: 1.0, dialogRadius: null, dialogElevation: 10.0, dialogBackgroundSchemeColor: null, timePickerDialogRadius: null, snackBarElevation: 4.0, snackBarBackgroundSchemeColor: null, appBarBackgroundSchemeColor: null, tabBarItemSchemeColor: null, tabBarIndicatorSchemeColor: null, bottomSheetRadius: null, bottomSheetElevation: 4.0, bottomSheetModalElevation: 8.0, bottomNavigationBarLabelTextStyle: null, bottomNavigationBarSelectedLabelSize: null, bottomNavigationBarUnselectedLabelSize: null, bottomNavigationBarSelectedLabelSchemeColor: null, bottomNavigationBarUnselectedLabelSchemeColor: null, bottomNavigationBarMutedUnselectedLabel: true, bottomNavigationBarSelectedIconSize: null, bottomNavigationBarUnselectedIconSize: null, bottomNavigationBarSelectedIconSchemeColor: null, bottomNavigationBarUnselectedIconSchemeColor: null, bottomNavigationBarMutedUnselectedIcon: true, bottomNavigationBarBackgroundSchemeColor: null, bottomNavigationBarOpacity: 1.0, bottomNavigationBarElevation: 0.0, bottomNavigationBarShowSelectedLabels: true, bottomNavigationBarShowUnselectedLabels: true, bottomNavigationBarType: fixed, bottomNavigationBarLandscapeLayout: null, navigationBarLabelTextStyle: null, navigationBarSelectedLabelSize: null, navigationBarUnselectedLabelSize: null, navigationBarSelectedLabelSchemeColor: null, navigationBarUnselectedLabelSchemeColor: null, navigationBarMutedUnselectedLabel: true, navigationBarSelectedIconSize: null, navigationBarUnselectedIconSize: null, navigationBarSelectedIconSchemeColor: null, navigationBarUnselectedIconSchemeColor: null, navigationBarMutedUnselectedIcon: true, navigationBarIndicatorSchemeColor: null, navigationBarHighlightOpacity: null, navigationBarBackgroundSchemeColor: null, navigationBarOpacity: 1.0, navigationBarHeight: null, navigationBarLabelBehavior: alwaysShow, navigationRailLabelTextStyle: null, navigationRailSelectedLabelSize: null, navigationRailUnselectedLabelSize: null, navigationRailSelectedLabelSchemeColor: null, navigationRailUnselectedLabelSchemeColor: null, navigationRailMutedUnselectedLabel: true, navigationRailSelectedIconSize: null, navigationRailUnselectedIconSize: null, navigationRailSelectedIconSchemeColor: null, navigationRailUnselectedIconSchemeColor: null, navigationRailMutedUnselectedIcon: true, navigationRailUseIndicator: true, navigationRailIndicatorSchemeColor: null, navigationRailIndicatorOpacity: null, navigationRailBackgroundSchemeColor: null, navigationRailOpacity: 1.0, navigationRailElevation: 0.0, navigationRailLabelType: all, navigationRailGroupAlignment: null), useMaterial3: false, extensions: null)'));
+ 'FlexColorScheme#00000(colorScheme: null, brightness: light, primary: Color(0xff6200ee), primaryContainer: Color(0xffbb86fc), primaryVariant: null, secondary: Color(0xff03dac6), secondaryContainer: Color(0xffcefaf8), secondaryVariant: null, tertiary: Color(0xff018786), tertiaryContainer: Color(0xffa4f1ef), error: Color(0xffb00020), surface: Color(0xffffffff), background: Color(0xffffffff), scaffoldBackground: Color(0xffffffff), appBarBackground: Color(0xff6200ee), dialogBackground: Color(0xffffffff), onPrimary: Color(0xffffffff), onPrimaryContainer: Color(0xffffffff), onSecondary: Color(0xff000000), onSecondaryContainer: Color(0xff000000), onTertiary: Color(0xffffffff), onTertiaryContainer: Color(0xff000000), onSurface: Color(0xff000000), onBackground: Color(0xff000000), onError: Color(0xffffffff), surfaceTint: null, tabBarStyle: forAppBar, appBarElevation: 1.0, bottomAppBarElevation: 2.0, tooltipsMatchBackground: true, transparentStatusBar: false, visualDensity: 0, v: 0.0), textTheme: TextTheme#00000(displayLarge: TextStyle(inherit: true, size: 80.0), displayMedium: null, displaySmall: null, headlineLarge: null, headlineMedium: null, headlineSmall: null, titleLarge: null, titleMedium: null, titleSmall: null, bodyLarge: null, bodyMedium: null, bodySmall: null, labelLarge: null, labelMedium: null, labelSmall: null), primaryTextTheme: TextTheme#00000(displayLarge: TextStyle(inherit: true, size: 80.0), displayMedium: null, displaySmall: null, headlineLarge: null, headlineMedium: null, headlineSmall: null, titleLarge: null, titleMedium: null, titleSmall: null, bodyLarge: null, bodyMedium: null, bodySmall: null, labelLarge: null, labelMedium: null, labelSmall: null), fontFamily: Roboto, platform: android, typography: Typography#00000(englishLike: TextTheme#00000(displayLarge: TextStyle(debugLabel: englishLike displayLarge 2018, inherit: true, size: 96.0, weight: 300, letterSpacing: -1.5, baseline: alphabetic), displayMedium: TextStyle(debugLabel: englishLike displayMedium 2018, inherit: true, size: 60.0, weight: 300, letterSpacing: -0.5, baseline: alphabetic), displaySmall: TextStyle(debugLabel: englishLike displaySmall 2018, inherit: true, size: 48.0, weight: 400, letterSpacing: 0.0, baseline: alphabetic), headlineLarge: TextStyle(debugLabel: englishLike headlineLarge 2018, inherit: true, size: 40.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), headlineMedium: TextStyle(debugLabel: englishLike headlineMedium 2018, inherit: true, size: 34.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), headlineSmall: TextStyle(debugLabel: englishLike headlineSmall 2018, inherit: true, size: 24.0, weight: 400, letterSpacing: 0.0, baseline: alphabetic), titleLarge: TextStyle(debugLabel: englishLike titleLarge 2018, inherit: true, size: 20.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic), titleMedium: TextStyle(debugLabel: englishLike titleMedium 2018, inherit: true, size: 16.0, weight: 400, letterSpacing: 0.1, baseline: alphabetic), titleSmall: TextStyle(debugLabel: englishLike titleSmall 2018, inherit: true, size: 14.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic), bodyLarge: TextStyle(debugLabel: englishLike bodyLarge 2018, inherit: true, size: 16.0, weight: 400, letterSpacing: 0.5, baseline: alphabetic), bodyMedium: TextStyle(debugLabel: englishLike bodyMedium 2018, inherit: true, size: 14.0, weight: 400, letterSpacing: 0.3, baseline: alphabetic), bodySmall: TextStyle(debugLabel: englishLike bodySmall 2018, inherit: true, size: 12.0, weight: 400, letterSpacing: 0.4, baseline: alphabetic), labelLarge: TextStyle(debugLabel: englishLike labelLarge 2018, inherit: true, size: 14.0, weight: 500, letterSpacing: 1.3, baseline: alphabetic), labelMedium: TextStyle(debugLabel: englishLike labelMedium 2018, inherit: true, size: 11.0, weight: 400, letterSpacing: 1.5, baseline: alphabetic), labelSmall: TextStyle(debugLabel: englishLike labelSmall 2018, inherit: true, size: 10.0, weight: 400, letterSpacing: 1.5, baseline: alphabetic)), dense: TextTheme#00000(displayLarge: TextStyle(debugLabel: dense displayLarge 2018, inherit: true, size: 96.0, weight: 100, baseline: ideographic), displayMedium: TextStyle(debugLabel: dense displayMedium 2018, inherit: true, size: 60.0, weight: 100, baseline: ideographic), displaySmall: TextStyle(debugLabel: dense displaySmall 2018, inherit: true, size: 48.0, weight: 400, baseline: ideographic), headlineLarge: TextStyle(debugLabel: dense headlineLarge 2018, inherit: true, size: 40.0, weight: 400, baseline: ideographic), headlineMedium: TextStyle(debugLabel: dense headlineMedium 2018, inherit: true, size: 34.0, weight: 400, baseline: ideographic), headlineSmall: TextStyle(debugLabel: dense headlineSmall 2018, inherit: true, size: 24.0, weight: 400, baseline: ideographic), titleLarge: TextStyle(debugLabel: dense titleLarge 2018, inherit: true, size: 21.0, weight: 500, baseline: ideographic), titleMedium: TextStyle(debugLabel: dense titleMedium 2018, inherit: true, size: 17.0, weight: 400, baseline: ideographic), titleSmall: TextStyle(debugLabel: dense titleSmall 2018, inherit: true, size: 15.0, weight: 500, baseline: ideographic), bodyLarge: TextStyle(debugLabel: dense bodyLarge 2018, inherit: true, size: 17.0, weight: 400, baseline: ideographic), bodyMedium: TextStyle(debugLabel: dense bodyMedium 2018, inherit: true, size: 15.0, weight: 400, baseline: ideographic), bodySmall: TextStyle(debugLabel: dense bodySmall 2018, inherit: true, size: 13.0, weight: 400, baseline: ideographic), labelLarge: TextStyle(debugLabel: dense labelLarge 2018, inherit: true, size: 15.0, weight: 500, baseline: ideographic), labelMedium: TextStyle(debugLabel: dense labelMedium 2018, inherit: true, size: 12.0, weight: 400, baseline: ideographic), labelSmall: TextStyle(debugLabel: dense labelSmall 2018, inherit: true, size: 11.0, weight: 400, baseline: ideographic)), tall: TextTheme#00000(displayLarge: TextStyle(debugLabel: tall displayLarge 2018, inherit: true, size: 96.0, weight: 400, baseline: alphabetic), displayMedium: TextStyle(debugLabel: tall displayMedium 2018, inherit: true, size: 60.0, weight: 400, baseline: alphabetic), displaySmall: TextStyle(debugLabel: tall displaySmall 2018, inherit: true, size: 48.0, weight: 400, baseline: alphabetic), headlineLarge: TextStyle(debugLabel: tall headlineLarge 2018, inherit: true, size: 40.0, weight: 400, baseline: alphabetic), headlineMedium: TextStyle(debugLabel: tall headlineMedium 2018, inherit: true, size: 34.0, weight: 400, baseline: alphabetic), headlineSmall: TextStyle(debugLabel: tall headlineSmall 2018, inherit: true, size: 24.0, weight: 400, baseline: alphabetic), titleLarge: TextStyle(debugLabel: tall titleLarge 2018, inherit: true, size: 21.0, weight: 700, baseline: alphabetic), titleMedium: TextStyle(debugLabel: tall titleMedium 2018, inherit: true, size: 17.0, weight: 400, baseline: alphabetic), titleSmall: TextStyle(debugLabel: tall titleSmall 2018, inherit: true, size: 15.0, weight: 500, baseline: alphabetic), bodyLarge: TextStyle(debugLabel: tall bodyLarge 2018, inherit: true, size: 17.0, weight: 700, baseline: alphabetic), bodyMedium: TextStyle(debugLabel: tall bodyMedium 2018, inherit: true, size: 15.0, weight: 400, baseline: alphabetic), bodySmall: TextStyle(debugLabel: tall bodySmall 2018, inherit: true, size: 13.0, weight: 400, baseline: alphabetic), labelLarge: TextStyle(debugLabel: tall labelLarge 2018, inherit: true, size: 15.0, weight: 700, baseline: alphabetic), labelMedium: TextStyle(debugLabel: tall labelMedium 2018, inherit: true, size: 12.0, weight: 400, baseline: alphabetic), labelSmall: TextStyle(debugLabel: tall labelSmall 2018, inherit: true, size: 11.0, weight: 400, baseline: alphabetic))), applyElevationOverlayColor: false, subThemesData: FlexSubThemesData#00000(interactionEffects: true, blendOnLevel : 0, blendOnColors: true, useFlutterDefaults: false, blendTextTheme: true, useTextTheme: true, defaultRadius: 20.0, buttonMinSize: Size(40.0, 40.0), buttonPadding: EdgeInsets(16.0, 0.0, 16.0, 0.0), thickBorderWidth: null, thinBorderWidth: null, textButtonRadius: null, elevatedButtonRadius: null, elevatedButtonElevation: null, outlinedButtonRadius: null, toggleButtonsRadius: null, textButtonSchemeColor: null, elevatedButtonSchemeColor: null, elevatedButtonSecondarySchemeColor: null, outlinedButtonSchemeColor: null, outlinedButtonOutlineSchemeColor: null, materialButtonSchemeColor: null, toggleButtonsSchemeColor: null, switchSchemeColor: null, checkboxSchemeColor: null, radioSchemeColor: null, unselectedToggleIsColored: false, inputDecoratorRadius: null, inputDecoratorSchemeColor: null, inputDecoratorIsFilled: true, inputDecoratorFillColor: null, inputDecoratorBorderType: outline, inputDecoratorUnfocusedHasBorder: true, inputDecoratorUnfocusedBorderIsColored: true, fabRadius: null, fabUseShape: false, fabSchemeColor: null, chipRadius: null, chipSchemeColor: null, cardRadius: null, cardElevation: 0.0, popupMenuRadius: null, popupMenuElevation: 3.0, popupMenuOpacity: 1.0, dialogRadius: null, dialogElevation: 6.0, dialogBackgroundSchemeColor: null, timePickerDialogRadius: null, snackBarElevation: 4.0, snackBarBackgroundSchemeColor: null, appBarBackgroundSchemeColor: null, appBarCenterTitle: null, tabBarItemSchemeColor: null, tabBarIndicatorSchemeColor: null, bottomSheetRadius: null, bottomSheetElevation: 4.0, bottomSheetModalElevation: 8.0, bottomNavigationBarLabelTextStyle: null, bottomNavigationBarSelectedLabelSize: null, bottomNavigationBarUnselectedLabelSize: null, bottomNavigationBarSelectedLabelSchemeColor: null, bottomNavigationBarUnselectedLabelSchemeColor: null, bottomNavigationBarMutedUnselectedLabel: true, bottomNavigationBarSelectedIconSize: null, bottomNavigationBarUnselectedIconSize: null, bottomNavigationBarSelectedIconSchemeColor: null, bottomNavigationBarUnselectedIconSchemeColor: null, bottomNavigationBarMutedUnselectedIcon: true, bottomNavigationBarBackgroundSchemeColor: null, bottomNavigationBarOpacity: 1.0, bottomNavigationBarElevation: 0.0, bottomNavigationBarShowSelectedLabels: true, bottomNavigationBarShowUnselectedLabels: true, bottomNavigationBarType: fixed, bottomNavigationBarLandscapeLayout: null, navigationBarLabelTextStyle: null, navigationBarSelectedLabelSize: null, navigationBarUnselectedLabelSize: null, navigationBarSelectedLabelSchemeColor: null, navigationBarUnselectedLabelSchemeColor: null, navigationBarMutedUnselectedLabel: true, navigationBarSelectedIconSize: null, navigationBarUnselectedIconSize: null, navigationBarSelectedIconSchemeColor: null, navigationBarUnselectedIconSchemeColor: null, navigationBarMutedUnselectedIcon: true, navigationBarIndicatorSchemeColor: null, navigationBarHighlightOpacity: null, navigationBarBackgroundSchemeColor: null, navigationBarOpacity: 1.0, navigationBarHeight: null, navigationBarLabelBehavior: alwaysShow, navigationRailLabelTextStyle: null, navigationRailSelectedLabelSize: null, navigationRailUnselectedLabelSize: null, navigationRailSelectedLabelSchemeColor: null, navigationRailUnselectedLabelSchemeColor: null, navigationRailMutedUnselectedLabel: true, navigationRailSelectedIconSize: null, navigationRailUnselectedIconSize: null, navigationRailSelectedIconSchemeColor: null, navigationRailUnselectedIconSchemeColor: null, navigationRailMutedUnselectedIcon: true, navigationRailUseIndicator: true, navigationRailIndicatorSchemeColor: null, navigationRailIndicatorOpacity: null, navigationRailBackgroundSchemeColor: null, navigationRailOpacity: 1.0, navigationRailElevation: 0.0, navigationRailLabelType: all, navigationRailGroupAlignment: null), useMaterial3: false, extensions: null)'));
});
test(
'FCS1.07a: Test toStringShort implemented via debugFillProperties '
@@ -610,7 +635,9 @@ void main() {
surfaceVariant: Color(0xffffffff),
onSurfaceVariant: Color(0xff000000),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xff121212),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xffda99ff),
@@ -682,7 +709,9 @@ void main() {
surfaceVariant: Color(0xff121212),
onSurfaceVariant: Color(0xffffffff),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff5a4570),
@@ -752,7 +781,9 @@ void main() {
onInverseSurface: Colors.white,
inversePrimary: Color(0xff9999ff),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Colors.black,
+ scrim: Colors.black,
)),
);
});
@@ -801,7 +832,9 @@ void main() {
onInverseSurface: Colors.black,
inversePrimary: Color(0xff6f5970),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Colors.black,
+ scrim: Colors.black,
)),
);
});
diff --git a/test/flex_color_scheme_to_theme_test.dart b/test/flex_color_scheme_to_theme_test.dart
index cda75c637..1c3d87d49 100644
--- a/test/flex_color_scheme_to_theme_test.dart
+++ b/test/flex_color_scheme_to_theme_test.dart
@@ -28,16 +28,26 @@ void main() {
).toScheme.toString(minLevel: DiagnosticLevel.fine)));
});
+ // TODO(rydmike): toString on ThemeData match, but not ThemeData, why?
+ // This is repeated for many test cases. It seems like ThemeData
+ // equality comparison cannot be guaranteed when using sub-themes that
+ // uses MaterialState or MaterialStateProperty. Verify and report this.
+ // Investigate first what SDK ThemeData test do, if they even attempt it.
test(
'FCS7.01-Default-Light: GIVEN FlexColorScheme.light() made with light '
'brightness '
'EXPECT its ThemeData to be equal to one made with light factory '
'only primary color. v5.0.0 test case', () {
expect(
- FlexColorScheme.light().toTheme,
- equals(FlexColorScheme.light(
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
primary: FlexColor.materialLightPrimary,
- ).toTheme));
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
test(
@@ -45,10 +55,13 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark factory '
'only primary color. v5.0.0 test case', () {
expect(
- FlexColorScheme.dark().toTheme,
- equals(FlexColorScheme.dark(
+ FlexColorScheme.dark().toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
primary: FlexColor.materialDarkPrimary,
- ).toTheme));
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
const ColorScheme schemeLight = ColorScheme(
@@ -76,7 +89,9 @@ void main() {
surfaceVariant: Color(0xffffffff),
onSurfaceVariant: Color(0xff000000),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xff121212),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xffda99ff),
@@ -105,10 +120,15 @@ void main() {
'EXPECT its ThemeData to be equal to one made with light factory. '
' v4.2.0 test case.', () {
expect(
- const FlexColorScheme(
- colorScheme: schemeLight,
- ).toTheme,
- equals(FlexColorScheme.light().toTheme));
+ const FlexColorScheme(
+ colorScheme: schemeLight,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
test(
'FCS7.05-Default-scheme-light-STING: GIVEN FlexColorScheme() made with '
@@ -129,12 +149,15 @@ void main() {
'EXPECT its ThemeData to be equal to one made with light factory '
'and ColorScheme.light v4.2.0 test case.', () {
expect(
- const FlexColorScheme(
- colorScheme: ColorScheme.light(inverseSurface: Color(0xff121212)),
- ).toTheme,
- equals(FlexColorScheme.light(
+ const FlexColorScheme(
+ colorScheme: ColorScheme.light(inverseSurface: Color(0xff121212)),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
colorScheme: const ColorScheme.light(),
- ).toTheme));
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
const ColorScheme schemeDark = ColorScheme(
brightness: Brightness.dark,
@@ -161,7 +184,9 @@ void main() {
surfaceVariant: Color(0xff121212),
onSurfaceVariant: Color(0xffffffff),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff5a4570),
@@ -189,8 +214,14 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark factory '
'correcting on error. v4.2.0 test case', () {
expect(
- const FlexColorScheme(colorScheme: schemeDark).toTheme,
- equals(FlexColorScheme.dark().toTheme),
+ const FlexColorScheme(colorScheme: schemeDark)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -200,12 +231,15 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark factory '
'and ColorScheme.dark v4.2.0 test case.', () {
expect(
- const FlexColorScheme(
- colorScheme: ColorScheme.dark(),
- ).toTheme,
- equals(FlexColorScheme.dark(
+ const FlexColorScheme(
+ colorScheme: ColorScheme.dark(),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
colorScheme: const ColorScheme.dark(),
- ).toTheme));
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
const FlexColorScheme rawHcLight = FlexColorScheme(
@@ -215,7 +249,9 @@ void main() {
surfaceVariant: Color(0xffffffff),
onSurfaceVariant: Color(0xff000000),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xff121212),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xff9999ff),
@@ -281,8 +317,11 @@ void main() {
'EXPECT its ThemeData to be equal to one made '
'FlexColorScheme.light(scheme: FlexScheme.materialHc)', () {
expect(
- rawHcLight.toTheme,
- equals(FlexColorScheme.light(scheme: FlexScheme.materialHc).toTheme),
+ rawHcLight.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(scheme: FlexScheme.materialHc)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -355,27 +394,30 @@ void main() {
).toScheme.toString(minLevel: DiagnosticLevel.fine)));
expect(
- const FlexColorScheme(
- colorScheme: hcDarkScheme,
- brightness: Brightness.light,
- primary: Color(0xff0000ba),
- onPrimary: Colors.white,
- primaryContainer: Color(0xff000088),
- onPrimaryContainer: Colors.white,
- secondary: Color(0xff66fff9),
- onSecondary: Colors.black,
- secondaryContainer: Color(0xff018786),
- onSecondaryContainer: Colors.white,
- error: Color(0xff790000),
- onError: Colors.white,
- surface: Colors.white,
- onSurface: Colors.black,
- background: Colors.white,
- onBackground: Colors.black,
- ).toTheme,
- equals(FlexColorScheme.light(
+ const FlexColorScheme(
+ colorScheme: hcDarkScheme,
+ brightness: Brightness.light,
+ primary: Color(0xff0000ba),
+ onPrimary: Colors.white,
+ primaryContainer: Color(0xff000088),
+ onPrimaryContainer: Colors.white,
+ secondary: Color(0xff66fff9),
+ onSecondary: Colors.black,
+ secondaryContainer: Color(0xff018786),
+ onSecondaryContainer: Colors.white,
+ error: Color(0xff790000),
+ onError: Colors.white,
+ surface: Colors.white,
+ onSurface: Colors.black,
+ background: Colors.white,
+ onBackground: Colors.black,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
colorScheme: overrideScheme,
- ).toTheme));
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
const ColorScheme hcDarkWithLight = ColorScheme(
@@ -401,7 +443,9 @@ void main() {
surfaceVariant: Color(0xffffffff),
onSurfaceVariant: Color(0xff000000),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xff121212),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xff9999ff),
@@ -461,7 +505,12 @@ void main() {
'EXPECT its ThemeData to be equal to one made '
'FlexColorScheme.light(scheme: FlexScheme.materialHc) '
'v4.2.0 test case.', () {
- expect(hcLightWithLight.toTheme, equals(hcLight.toTheme));
+ expect(
+ hcLightWithLight.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ hcLight.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
// Dark default color scheme
@@ -487,7 +536,9 @@ void main() {
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff6f5970),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
),
);
@@ -531,8 +582,10 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark factory '
'and minimal color inputs.', () {
expect(
- darkDefault.toTheme,
- equals(darkFactoryDefault.toTheme),
+ darkDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ darkFactoryDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -561,7 +614,9 @@ void main() {
background: Color(0xff121212),
onBackground: Colors.white,
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff6f5970),
@@ -603,8 +658,10 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark factory '
'and minimal color inputs.', () {
expect(
- hcDarkDefault.toTheme,
- equals(hcDarkFactoryDefault.toTheme),
+ hcDarkDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ hcDarkFactoryDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -633,7 +690,9 @@ void main() {
surfaceVariant: Color(0xff121212),
onSurfaceVariant: Colors.white,
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff6f5970),
@@ -691,7 +750,12 @@ void main() {
'override colors despite conflicting colorscheme given '
'EXPECT its toScheme to be equal to one made with dark factory '
'and minimal colors', () {
- expect(rawHcFCS.toTheme, equals(hcDarkFactoryDefault.toTheme));
+ expect(
+ rawHcFCS.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ hcDarkFactoryDefault.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
test(
@@ -722,7 +786,9 @@ void main() {
onError: Colors.white,
onErrorContainer: Color(0xffffffff),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff6f5970),
),
@@ -778,12 +844,14 @@ void main() {
onError: Colors.white,
onErrorContainer: Color(0xffffffff),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff6f5970),
),
- ).toTheme,
- equals(
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
FlexColorScheme.dark(
primary: const Color(0xffefb7ff),
primaryContainer: const Color(0xffbe9eff),
@@ -801,7 +869,7 @@ void main() {
onSurface: Colors.white,
onBackground: Colors.white,
onError: Colors.white,
- ).toTheme,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
),
);
});
@@ -832,25 +900,34 @@ void main() {
'EXPECT its ThemeData to be equal to one made with light scheme with '
'no parameters.', () {
expect(
- const FlexColorScheme(
- brightness: Brightness.light,
- primary: FlexColor.materialLightPrimary,
- primaryContainer: FlexColor.materialLightPrimaryContainer,
- secondary: FlexColor.materialLightSecondary,
- secondaryContainer: FlexColor.materialLightSecondaryContainer,
- tertiary: FlexColor.materialLightTertiary,
- tertiaryContainer: FlexColor.materialLightTertiaryContainer,
- ).toTheme,
- equals(FlexColorScheme.light().toTheme));
+ const FlexColorScheme(
+ brightness: Brightness.light,
+ primary: FlexColor.materialLightPrimary,
+ primaryContainer: FlexColor.materialLightPrimaryContainer,
+ secondary: FlexColor.materialLightSecondary,
+ secondaryContainer: FlexColor.materialLightSecondaryContainer,
+ tertiary: FlexColor.materialLightTertiary,
+ tertiaryContainer: FlexColor.materialLightTertiaryContainer,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
test(
'FCS7.22DefL: GIVEN FlexColorScheme.light made with no parameters '
'EXPECT its ThemeData to be equal to one made with light scheme.', () {
expect(
- FlexColorScheme.light().toTheme,
- equals(FlexColorScheme.light(
- colors: FlexColor.schemes[FlexScheme.material]!.light,
- ).toTheme),
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
+ colors: FlexColor.schemes[FlexScheme.material]!.light,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -859,10 +936,12 @@ void main() {
expect(
FlexColorScheme.light(
colors: FlexColor.schemes[FlexScheme.material]!.light,
- ).toTheme,
- equals(FlexColorScheme.light(
- colors: FlexColor.schemes[FlexScheme.material]!.light,
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
+ colors: FlexColor.schemes[FlexScheme.material]!.light,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -870,8 +949,14 @@ void main() {
'parameters EXPECT ThemeData to be equal to one made with '
'scheme FlexScheme.material.', () {
expect(
- FlexColorScheme.light().toTheme,
- equals(FlexColorScheme.light(scheme: FlexScheme.material).toTheme),
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(scheme: FlexScheme.material)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -881,8 +966,12 @@ void main() {
expect(
FlexColorScheme.light(
colors: FlexColor.schemes[FlexScheme.material]!.light,
- ).toTheme,
- equals(FlexColorScheme.light(scheme: FlexScheme.material).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(scheme: FlexScheme.material)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -892,8 +981,12 @@ void main() {
expect(
FlexColorScheme.light(
colors: FlexColor.schemes[FlexScheme.material]!.light,
- ).toTheme,
- equals(FlexColorScheme.light().toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -903,17 +996,22 @@ void main() {
'EXPECT its ThemeData to be equal to one made with dark scheme with '
'no parameters.', () {
expect(
- FlexColorScheme.dark(
- colors: const FlexSchemeColor(
- primary: FlexColor.materialDarkPrimary,
- primaryContainer: FlexColor.materialDarkPrimaryContainer,
- secondary: FlexColor.materialDarkSecondary,
- secondaryContainer: FlexColor.materialDarkSecondaryContainer,
- tertiary: FlexColor.materialDarkTertiary,
- tertiaryContainer: FlexColor.materialDarkTertiaryContainer,
- ),
- ).toTheme,
- equals(FlexColorScheme.dark().toTheme));
+ FlexColorScheme.dark(
+ colors: const FlexSchemeColor(
+ primary: FlexColor.materialDarkPrimary,
+ primaryContainer: FlexColor.materialDarkPrimaryContainer,
+ secondary: FlexColor.materialDarkSecondary,
+ secondaryContainer: FlexColor.materialDarkSecondaryContainer,
+ tertiary: FlexColor.materialDarkTertiary,
+ tertiaryContainer: FlexColor.materialDarkTertiaryContainer,
+ ),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
// themeDark = Default material dark scheme colors.
@@ -923,17 +1021,19 @@ void main() {
expect(
FlexColorScheme.light(
swapColors: true,
- ).toTheme,
- equals(FlexColorScheme.light(
- colors: const FlexSchemeColor(
- primary: FlexColor.materialLightSecondary,
- primaryContainer: FlexColor.materialLightSecondaryContainer,
- secondary: FlexColor.materialLightPrimary,
- secondaryContainer: FlexColor.materialLightPrimaryContainer,
- tertiary: FlexColor.materialLightTertiary,
- tertiaryContainer: FlexColor.materialLightTertiaryContainer,
- ),
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.light(
+ colors: const FlexSchemeColor(
+ primary: FlexColor.materialLightSecondary,
+ primaryContainer: FlexColor.materialLightSecondaryContainer,
+ secondary: FlexColor.materialLightPrimary,
+ secondaryContainer: FlexColor.materialLightPrimaryContainer,
+ tertiary: FlexColor.materialLightTertiary,
+ tertiaryContainer: FlexColor.materialLightTertiaryContainer,
+ ),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -944,17 +1044,19 @@ void main() {
expect(
FlexColorScheme.dark(
swapColors: true,
- ).toTheme,
- equals(FlexColorScheme.dark(
- colors: const FlexSchemeColor(
- primary: FlexColor.materialDarkSecondary,
- primaryContainer: FlexColor.materialDarkSecondaryContainer,
- secondary: FlexColor.materialDarkPrimary,
- secondaryContainer: FlexColor.materialDarkPrimaryContainer,
- tertiary: FlexColor.materialDarkTertiary,
- tertiaryContainer: FlexColor.materialDarkTertiaryContainer,
- ),
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
+ colors: const FlexSchemeColor(
+ primary: FlexColor.materialDarkSecondary,
+ primaryContainer: FlexColor.materialDarkSecondaryContainer,
+ secondary: FlexColor.materialDarkPrimary,
+ secondaryContainer: FlexColor.materialDarkPrimaryContainer,
+ tertiary: FlexColor.materialDarkTertiary,
+ tertiaryContainer: FlexColor.materialDarkTertiaryContainer,
+ ),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -962,10 +1064,12 @@ void main() {
'FCS7.30DefL: GIVEN FlexColorScheme.dark made with no parameters '
'EXPECT its ThemeData to be equal to one made with light scheme.', () {
expect(
- FlexColorScheme.dark().toTheme,
- equals(FlexColorScheme.dark(
- colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme),
+ FlexColorScheme.dark().toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
+ colors: FlexColor.schemes[FlexScheme.material]!.dark,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -974,18 +1078,26 @@ void main() {
expect(
FlexColorScheme.dark(
colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme,
- equals(FlexColorScheme.dark(
- colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
+ colors: FlexColor.schemes[FlexScheme.material]!.dark,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
'FCS7.32D: GIVEN a FlexColorScheme.dark made with no '
'parameters EXPECT ThemeData to be equal to one made with '
'scheme FlexScheme.material.', () {
- expect(FlexColorScheme.dark().toTheme,
- FlexColorScheme.dark(scheme: FlexScheme.material).toTheme);
+ expect(
+ FlexColorScheme.dark().toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(scheme: FlexScheme.material)
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
+ );
});
test(
'FCS7.33D: GIVEN a FlexColorScheme.dark made with colors '
@@ -994,10 +1106,12 @@ void main() {
expect(
FlexColorScheme.dark(
colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme,
- equals(FlexColorScheme.dark(
- scheme: FlexScheme.material,
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark(
+ scheme: FlexScheme.material,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
test(
@@ -1007,8 +1121,12 @@ void main() {
expect(
FlexColorScheme.dark(
colors: FlexColor.schemes[FlexScheme.material]!.dark,
- ).toTheme,
- equals(FlexColorScheme.dark().toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ FlexColorScheme.dark()
+ .toTheme
+ .toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -1023,14 +1141,16 @@ void main() {
primaryContainer: FlexColor.materialLightPrimaryContainer,
secondary: FlexColor.materialLightSecondary,
secondaryContainer: FlexColor.materialLightTertiary,
- ).toTheme,
- equals(const FlexColorScheme(
- brightness: Brightness.light,
- primary: FlexColor.materialLightPrimary,
- primaryContainer: FlexColor.materialLightPrimaryContainer,
- secondary: FlexColor.materialLightSecondary,
- secondaryContainer: FlexColor.materialLightTertiary,
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ const FlexColorScheme(
+ brightness: Brightness.light,
+ primary: FlexColor.materialLightPrimary,
+ primaryContainer: FlexColor.materialLightPrimaryContainer,
+ secondary: FlexColor.materialLightSecondary,
+ secondaryContainer: FlexColor.materialLightTertiary,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -1045,14 +1165,16 @@ void main() {
primaryContainer: FlexColor.materialDarkPrimaryContainer,
secondary: FlexColor.materialDarkSecondary,
secondaryContainer: FlexColor.materialDarkTertiary,
- ).toTheme,
- equals(const FlexColorScheme(
- brightness: Brightness.dark,
- primary: FlexColor.materialDarkPrimary,
- primaryContainer: FlexColor.materialDarkPrimaryContainer,
- secondary: FlexColor.materialDarkSecondary,
- secondaryContainer: FlexColor.materialDarkTertiary,
- ).toTheme),
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ const FlexColorScheme(
+ brightness: Brightness.dark,
+ primary: FlexColor.materialDarkPrimary,
+ primaryContainer: FlexColor.materialDarkPrimaryContainer,
+ secondary: FlexColor.materialDarkSecondary,
+ secondaryContainer: FlexColor.materialDarkTertiary,
+ ).toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -1091,6 +1213,7 @@ void main() {
surface: Colors.white,
onSurface: Colors.black,
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
inverseSurface: Color(0xff121212),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xffda99ff),
@@ -1149,7 +1272,7 @@ void main() {
surfaceVariant: Color(0xff121212),
onSurfaceVariant: Color(0xffffffff),
outline: Color(0xffb3b3b3),
- shadow: Color(0xff000000),
+ outlineVariant: Color(0xff666666),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff5a4570),
@@ -1199,24 +1322,28 @@ void main() {
// scheme compliance gaps.
//**************************************************************************
- test(
- 'FCS7.07: GIVEN a FlexColorScheme theme with Material scheme light '
- 'colors EXPECT toggleableActiveColor equality with '
- 'colorScheme.secondary.', () {
- expect(
- themeLight.toggleableActiveColor,
- equals(themeLight.colorScheme.secondary),
- );
- });
- test(
- 'FCS7.08: GIVEN a FlexColorScheme theme with Material scheme dark '
- 'colors EXPECT toggleableActiveColor equality with '
- 'colorScheme.secondary.', () {
- expect(
- themeDark.toggleableActiveColor,
- equals(themeDark.colorScheme.secondary),
- );
- });
+ // TODO(rydmike): May need new tests for deprecated toggleableActiveColor.
+ // This property is deprecated in Flutter SDK and now excluded from test
+ // [Deprecate toggleableActiveColor #97972](https://github.com/flutter/flutter/pull/97972)
+ //
+ // test(
+ // 'FCS7.07: GIVEN a FlexColorScheme theme with Material scheme light '
+ // 'colors EXPECT toggleableActiveColor equality with '
+ // 'colorScheme.secondary.', () {
+ // expect(
+ // themeLight.toggleableActiveColor,
+ // equals(themeLight.colorScheme.secondary),
+ // );
+ // });
+ // test(
+ // 'FCS7.08: GIVEN a FlexColorScheme theme with Material scheme dark '
+ // 'colors EXPECT toggleableActiveColor equality with '
+ // 'colorScheme.secondary.', () {
+ // expect(
+ // themeDark.toggleableActiveColor,
+ // equals(themeDark.colorScheme.secondary),
+ // );
+ // });
test(
'FCS7.09: GIVEN a FlexColorScheme theme with Material scheme light '
'colors EXPECT primaryColorDark equality with '
@@ -1891,7 +2018,9 @@ void main() {
surfaceVariant: Color(0xfff7e9e9),
onSurfaceVariant: Color(0xff000000),
outline: Color(0xff4d4d4d),
+ outlineVariant: Color(0xff999999),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xff1b1414),
onInverseSurface: Color(0xffffffff),
inversePrimary: Color(0xfffff0f0),
@@ -1975,8 +2104,9 @@ void main() {
'FCS7.79e-theme: GIVEN a Equal Raw and FlexColorScheme.light with '
'heavy branding and 2 colors EXPECT toTheme equals.', () {
expect(
- fcsLightH2.toTheme,
- equals(fcsLightH2Raw.toTheme),
+ fcsLightH2.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fcsLightH2Raw.toTheme.toString(minLevel: DiagnosticLevel.fine)),
);
});
@@ -2019,7 +2149,9 @@ void main() {
surfaceVariant: Color(0xff191313),
onSurfaceVariant: Color(0xffffffff),
outline: Color(0xffb3b3b3),
+ outlineVariant: Color(0xff666666),
shadow: Color(0xff000000),
+ scrim: Color(0xff000000),
inverseSurface: Color(0xffffffff),
onInverseSurface: Color(0xff000000),
inversePrimary: Color(0xff644141),
@@ -2096,8 +2228,10 @@ void main() {
'FlexColorScheme objects '
'EXPECT equals toTheme.', () {
expect(
- fcsDarkH2.toTheme,
- equals(fcsDarkH2Raw.toTheme),
+ fcsDarkH2.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ equalsIgnoringHashCodes(
+ fcsDarkH2Raw.toTheme.toString(minLevel: DiagnosticLevel.fine),
+ ),
);
});
@@ -2587,5 +2721,81 @@ void main() {
'typography 2018 and primaryColor set as in FlexColorScheme.dark.', () {
expect(fCPDText, equals(nCPDText));
});
+
+ // AppBar test null style, not using M3.
+ final ThemeData tLAppBarNull = FlexColorScheme.light(
+ scheme: FlexScheme.flutterDash,
+ // appBarStyle: null, // Default value
+ // useMaterial3: false, // Default value
+ ).toTheme;
+ test(
+ 'FCS7.96 Light: GIVEN a FlexColorScheme.light with null appBarStyle '
+ 'and not using M3 EXPECT app bar background primary ', () {
+ expect(tLAppBarNull.appBarTheme.backgroundColor,
+ equals(tLAppBarNull.colorScheme.primary));
+ });
+ final ThemeData tDAppBarNull = FlexColorScheme.dark(
+ scheme: FlexScheme.flutterDash,
+ // appBarStyle: null, // Default value
+ // useMaterial3: false, // Default value
+ ).toTheme;
+ test(
+ 'FCS7.96 Dark: GIVEN a FlexColorScheme.dark with null appBarStyle and '
+ 'not using M3 EXPECT app bar background surface ', () {
+ expect(tDAppBarNull.appBarTheme.backgroundColor,
+ equals(tDAppBarNull.colorScheme.surface));
+ });
+ // AppBar test null style, not using M3.
+ final ThemeData tLAppBarNullM3 = FlexColorScheme.light(
+ scheme: FlexScheme.flutterDash,
+ // appBarStyle: null, // Default value
+ useMaterial3: true,
+ ).toTheme;
+ test(
+ 'FCS7.97 Light: GIVEN a FlexColorScheme.light with null appBarStyle '
+ 'and using M3 EXPECT app bar background surface ', () {
+ expect(tLAppBarNullM3.appBarTheme.backgroundColor,
+ equals(tLAppBarNullM3.colorScheme.surface));
+ });
+ final ThemeData tDAppBarNullM3 = FlexColorScheme.dark(
+ scheme: FlexScheme.flutterDash,
+ // appBarStyle: null, // Default value
+ useMaterial3: true,
+ ).toTheme;
+ test(
+ 'FCS7.97 Dark: GIVEN a FlexColorScheme.dark with null appBarStyle and '
+ ' using M3 EXPECT app bar background surface ', () {
+ expect(tDAppBarNullM3.appBarTheme.backgroundColor,
+ equals(tDAppBarNullM3.colorScheme.surface));
+ });
+ // AppBar test null center title.
+ final ThemeData tLAppBarCenterNull = FlexColorScheme.light(
+ scheme: FlexScheme.flutterDash,
+ ).toTheme;
+ test(
+ 'FCS7.99 null: GIVEN a FlexColorScheme.light with no centerTitle '
+ 'EXPECT app bar center title null ', () {
+ expect(tLAppBarCenterNull.appBarTheme.centerTitle, equals(null));
+ });
+ // AppBar test true center title.
+ final ThemeData tDAppBarCenterTrue = FlexColorScheme.dark(
+ scheme: FlexScheme.flutterDash,
+ subThemesData: const FlexSubThemesData(appBarCenterTitle: true),
+ ).toTheme;
+ test(
+ 'FCS7.99 true: GIVEN a FlexColorScheme.dark with no centerTitle '
+ 'EXPECT app bar center title true ', () {
+ expect(tDAppBarCenterTrue.appBarTheme.centerTitle, equals(true));
+ });
+ // AppBar test true center title.
+ final ThemeData tLAppBarCenterFalse = FlexColorScheme.light(
+ scheme: FlexScheme.flutterDash,
+ subThemesData: const FlexSubThemesData(appBarCenterTitle: false),
+ ).toTheme;
+ test(
+ 'FCS7.99 false: GIVEN a FlexColorScheme.light with no centerTitle '
+ 'EXPECT app bar center title false ', () {
+ expect(tLAppBarCenterFalse.appBarTheme.centerTitle, equals(false));
+ });
});
}
diff --git a/test/flex_color_test.dart b/test/flex_color_test.dart
index c172bc91f..44ec3f02b 100644
--- a/test/flex_color_test.dart
+++ b/test/flex_color_test.dart
@@ -257,6 +257,87 @@ void main() {
});
});
+ //****************************************************************************
+ // FlexColor error colors match seed colors - Color verification, seed results
+ //****************************************************************************
+
+ group('FC-Seed: WITH custom ColorScheme.seed colors brightness', () {
+ test('light equals FlexColor error colors and other seed results', () {
+ final ColorScheme scheme = ColorScheme.fromSeed(seedColor: Colors.blue);
+ expect(scheme.primary, const Color(0xff0061a4));
+ expect(scheme.onPrimary, const Color(0xffffffff));
+ expect(scheme.primaryContainer, const Color(0xffd1e4ff));
+ expect(scheme.onPrimaryContainer, const Color(0xff001d36));
+ expect(scheme.secondary, const Color(0xff535f70));
+ expect(scheme.onSecondary, const Color(0xffffffff));
+ expect(scheme.secondaryContainer, const Color(0xffd7e3f7));
+ expect(scheme.onSecondaryContainer, const Color(0xff101c2b));
+ expect(scheme.tertiary, const Color(0xff6b5778));
+ expect(scheme.onTertiary, const Color(0xffffffff));
+ expect(scheme.tertiaryContainer, const Color(0xfff2daff));
+ expect(scheme.onTertiaryContainer, const Color(0xff251431));
+ expect(scheme.error, const Color(0xffba1a1a));
+ expect(scheme.error, FlexColor.material3LightError);
+ expect(scheme.onError, const Color(0xffffffff));
+ expect(scheme.onError, FlexColor.material3LightOnError);
+ expect(scheme.errorContainer, const Color(0xffffdad6));
+ expect(scheme.errorContainer, FlexColor.material3LightErrorContainer);
+ expect(scheme.onErrorContainer, const Color(0xff410002));
+ expect(scheme.onErrorContainer, FlexColor.material3LightOnErrorContainer);
+ expect(scheme.outline, const Color(0xff73777f));
+ expect(scheme.background, const Color(0xfffdfcff));
+ expect(scheme.onBackground, const Color(0xff1a1c1e));
+ expect(scheme.surface, const Color(0xfffdfcff));
+ expect(scheme.onSurface, const Color(0xff1a1c1e));
+ expect(scheme.surfaceVariant, const Color(0xffdfe2eb));
+ expect(scheme.onSurfaceVariant, const Color(0xff43474e));
+ expect(scheme.inverseSurface, const Color(0xff2f3033));
+ expect(scheme.onInverseSurface, const Color(0xfff1f0f4));
+ expect(scheme.inversePrimary, const Color(0xff9ecaff));
+ expect(scheme.shadow, const Color(0xff000000));
+ expect(scheme.surfaceTint, const Color(0xff0061a4));
+ expect(scheme.brightness, Brightness.light);
+ });
+
+ test('dark equals FlexColor error colors and other seed results', () {
+ final ColorScheme scheme = ColorScheme.fromSeed(
+ seedColor: Colors.blue, brightness: Brightness.dark);
+ expect(scheme.primary, const Color(0xff9ecaff));
+ expect(scheme.onPrimary, const Color(0xff003258));
+ expect(scheme.primaryContainer, const Color(0xff00497d));
+ expect(scheme.onPrimaryContainer, const Color(0xffd1e4ff));
+ expect(scheme.secondary, const Color(0xffbbc7db));
+ expect(scheme.onSecondary, const Color(0xff253140));
+ expect(scheme.secondaryContainer, const Color(0xff3b4858));
+ expect(scheme.onSecondaryContainer, const Color(0xffd7e3f7));
+ expect(scheme.tertiary, const Color(0xffd6bee4));
+ expect(scheme.onTertiary, const Color(0xff3b2948));
+ expect(scheme.tertiaryContainer, const Color(0xff523f5f));
+ expect(scheme.onTertiaryContainer, const Color(0xfff2daff));
+ expect(scheme.error, const Color(0xffffb4ab));
+ expect(scheme.error, FlexColor.material3DarkError);
+ expect(scheme.onError, const Color(0xff690005));
+ expect(scheme.onError, FlexColor.material3DarkOnError);
+ expect(scheme.errorContainer, const Color(0xff93000a));
+ expect(scheme.errorContainer, FlexColor.material3DarkErrorContainer);
+ expect(scheme.onErrorContainer, const Color(0xffffb4ab));
+ expect(scheme.onErrorContainer, FlexColor.material3DarkOnErrorContainer);
+ expect(scheme.outline, const Color(0xff8d9199));
+ expect(scheme.background, const Color(0xff1a1c1e));
+ expect(scheme.onBackground, const Color(0xffe2e2e6));
+ expect(scheme.surface, const Color(0xff1a1c1e));
+ expect(scheme.onSurface, const Color(0xffe2e2e6));
+ expect(scheme.surfaceVariant, const Color(0xff43474e));
+ expect(scheme.onSurfaceVariant, const Color(0xffc3c7cf));
+ expect(scheme.inverseSurface, const Color(0xffe2e2e6));
+ expect(scheme.onInverseSurface, const Color(0xff2f3033));
+ expect(scheme.inversePrimary, const Color(0xff0061a4));
+ expect(scheme.shadow, const Color(0xff000000));
+ expect(scheme.surfaceTint, const Color(0xff9ecaff));
+ expect(scheme.brightness, Brightness.dark);
+ });
+ });
+
//****************************************************************************
// FlexColor unit tests - Test the color value definitions.
//
@@ -324,10 +405,10 @@ void main() {
});
test(
'FC5 colors FlexColor is material3LightError '
- 'EXPECT color is Color(0xFFBA1B1B)', () {
+ 'EXPECT color is Color(0xFFBA1A1A)', () {
expect(
FlexColor.material3LightError,
- equals(const Color(0xFFBA1B1B)),
+ equals(const Color(0xFFBA1A1A)),
);
});
test(
@@ -340,18 +421,18 @@ void main() {
});
test(
'FC5 colors FlexColor is material3LightErrorContainer '
- 'EXPECT color is Color(0xFFFFDAD4)', () {
+ 'EXPECT color is Color(0xFFFFDAD6)', () {
expect(
FlexColor.material3LightErrorContainer,
- equals(const Color(0xFFFFDAD4)),
+ equals(const Color(0xFFFFDAD6)),
);
});
test(
'FC5 colors FlexColor is material3LightOnErrorContainer '
- 'EXPECT color is Color(0xFF410001)', () {
+ 'EXPECT color is Color(0xFF410002)', () {
expect(
FlexColor.material3LightOnErrorContainer,
- equals(const Color(0xFF410001)),
+ equals(const Color(0xFF410002)),
);
});
//
@@ -376,34 +457,34 @@ void main() {
});
test(
'FC5 colors FlexColor is material3DarkError '
- 'EXPECT color is Color(0xFFFFB4A9)', () {
+ 'EXPECT color is Color(0xFFFFB4AB)', () {
expect(
FlexColor.material3DarkError,
- equals(const Color(0xFFFFB4A9)),
+ equals(const Color(0xFFFFB4AB)),
);
});
test(
'FC5 colors FlexColor is material3DarkOnError '
- 'EXPECT color is Color(0xFF680003)', () {
+ 'EXPECT color is Color(0xFF690005)', () {
expect(
FlexColor.material3DarkOnError,
- equals(const Color(0xFF680003)),
+ equals(const Color(0xFF690005)),
);
});
test(
'FC5 colors FlexColor is material3DarkErrorContainer '
- 'EXPECT color is Color(0xFF930006)', () {
+ 'EXPECT color is Color(0xFF93000A)', () {
expect(
FlexColor.material3DarkErrorContainer,
- equals(const Color(0xFF930006)),
+ equals(const Color(0xFF93000A)),
);
});
test(
'FC5 colors FlexColor is material3DarkOnErrorContainer '
- 'EXPECT color is Color(0xFFFFB4A9)', () {
+ 'EXPECT color is Color(0xFFFFB4AB)', () {
expect(
FlexColor.material3DarkOnErrorContainer,
- equals(const Color(0xFFFFB4A9)),
+ equals(const Color(0xFFFFB4AB)),
);
});
//
diff --git a/test/flex_const_test.dart b/test/flex_const_test.dart
index 5bef97c24..a19682bfd 100644
--- a/test/flex_const_test.dart
+++ b/test/flex_const_test.dart
@@ -1,4 +1,5 @@
import 'package:flex_color_scheme/src/flex_constants.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
//****************************************************************************
@@ -32,59 +33,152 @@ void main() {
test('FCT kDarkenSecondaryVariant is 14', () {
expect(kDarkenSecondaryContainer, 14);
});
- test('FCT kLightBlendSurfaceLight is 0', () {
- expect(kLightBlendSurfaceLight, 0);
+ test('FCT kDrawerRadius is 16', () {
+ expect(kDrawerRadius, 16);
});
- test('FCT kLightBlendSurfaceMedium is 1', () {
- expect(kLightBlendSurfaceMedium, 1);
+ test('FCT kFabRadius is 16', () {
+ expect(kFabRadius, 16);
});
- test('FCT kLightBlendSurfaceStrong is 2', () {
- expect(kLightBlendSurfaceStrong, 2);
+ test('FCT kChipRadius is 8', () {
+ expect(kChipRadius, 8);
});
- test('FCT kLightBlendSurfaceHeavy is 3', () {
- expect(kLightBlendSurfaceHeavy, 3);
+ test('FCT kButtonRadius is 20', () {
+ expect(kButtonRadius, 20);
});
- test('FCT kLightBlendBackgroundLight is 2', () {
- expect(kLightBlendBackgroundLight, 2);
+ test('FCT kInputDecoratorRadius is 16', () {
+ expect(kInputDecoratorRadius, 16);
});
- test('FCT kLightBlendBackgroundMedium is 4', () {
- expect(kLightBlendBackgroundMedium, 4);
+ test('FCT kInputDecoratorM3Radius is 4', () {
+ expect(kInputDecoratorM3Radius, 4);
});
- test('FCT kLightBlendBackgroundStrong is 6', () {
- expect(kLightBlendBackgroundStrong, 6);
+ test('FCT kBottomSheetBorderRadius is 16', () {
+ expect(kBottomSheetBorderRadius, 16);
});
- test('FCT kLightBlendBackgroundHeavy is 8', () {
- expect(kLightBlendBackgroundHeavy, 8);
+ test('FCT kDialogRadius is 28', () {
+ expect(kDialogRadius, 28);
});
- test('FCT kLightBlendScaffoldHeavy is 1', () {
- expect(kLightBlendScaffoldHeavy, 1);
+ test('FCT kCardRadius is 12', () {
+ expect(kCardRadius, 12);
});
- test('FCT kDarkBlendSurfaceLight is 2', () {
- expect(kDarkBlendSurfaceLight, 2);
+ test('FCT kMenuRadius is 4', () {
+ expect(kMenuRadius, 4);
});
- test('FCT kDarkBlendSurfaceMedium is 4', () {
- expect(kDarkBlendSurfaceMedium, 4);
+ test('FCT kCardElevation is 0', () {
+ expect(kCardElevation, 0);
});
- test('FCT kDarkBlendSurfaceStrong is 6', () {
- expect(kDarkBlendSurfaceStrong, 6);
+ test('FCT kElevatedButtonElevation is 1', () {
+ expect(kElevatedButtonElevation, 1);
});
- test('FCT kDarkBlendSurfaceHeavy is 8', () {
- expect(kDarkBlendSurfaceHeavy, 8);
+ test('FCT kPopupMenuElevation is 3', () {
+ expect(kPopupMenuElevation, 3);
});
- test('FCT kDarkBlendBackgroundLight is 5', () {
- expect(kDarkBlendBackgroundLight, 5);
+ test('FCT kDialogElevation is 6', () {
+ expect(kDialogElevation, 6);
});
- test('FCT kDarkBlendBackgroundMedium is 8', () {
- expect(kDarkBlendBackgroundMedium, 8);
+ test('FCT kBottomSheetElevation is 4', () {
+ expect(kBottomSheetElevation, 4);
});
- test('FCT kDarkBlendBackgroundStrong is 11', () {
- expect(kDarkBlendBackgroundStrong, 11);
+ test('FCT kBottomSheetModalElevation is 8', () {
+ expect(kBottomSheetModalElevation, 8);
});
- test('FCT kDarkBlendBackgroundHeavy is 14', () {
- expect(kDarkBlendBackgroundHeavy, 14);
+ test('FCT kBottomNavigationBarElevation is 0', () {
+ expect(kBottomNavigationBarElevation, 0);
});
- test('FCT kDarkBlendScaffoldHeavy is 2', () {
- expect(kDarkBlendScaffoldHeavy, 2);
+ test('FCT kNavigationBarHeight is 62', () {
+ expect(kNavigationBarHeight, 62);
+ });
+ test('FCT kNavigationBarIndicatorAlpha is 0x3D', () {
+ expect(kNavigationBarIndicatorAlpha, 0x3D);
+ });
+ test('FCT kNavigationRailElevation is 0', () {
+ expect(kNavigationRailElevation, 0);
+ });
+ test('FCT kSnackBarElevation is 4', () {
+ expect(kSnackBarElevation, 4);
+ });
+ test('FCT kButtonMinSize is Size(40,40)', () {
+ expect(kButtonMinSize, const Size(40, 40));
+ });
+ test('FCT kButtonPadding is horizontal 16', () {
+ expect(kButtonPadding, const EdgeInsets.symmetric(horizontal: 16));
+ });
+ test('FCT kThickBorderWidth is 2', () {
+ expect(kThickBorderWidth, 2);
+ });
+ test('FCT kThinBorderWidth is 1.5', () {
+ expect(kThinBorderWidth, 1.5);
+ });
+ test('FCT kFillColorAlphaLight is 0x0D', () {
+ expect(kFillColorAlphaLight, 0x0D);
+ });
+ test('FCT kFillColorAlphaDark is 0x14', () {
+ expect(kFillColorAlphaDark, 0x14);
+ });
+ test('FCT kHoverBackgroundAlpha is 0x0D', () {
+ expect(kHoverBackgroundAlpha, 0x0D);
+ });
+ test('FCT kFocusBackgroundAlpha is 0x26', () {
+ expect(kFocusBackgroundAlpha, 0x26);
+ });
+ test('FCT kPressedBackgroundAlpha is 0x33', () {
+ expect(kPressedBackgroundAlpha, 0x33);
+ });
+ test('FCT kDisabledBackgroundAlpha is 0x31', () {
+ expect(kDisabledBackgroundAlpha, 0x31);
+ });
+ test('FCT kDisabledForegroundAlpha is 0x5E', () {
+ expect(kDisabledForegroundAlpha, 0x5E);
+ });
+ test('FCT kDisabledAlphaBlend is 0x66', () {
+ expect(kDisabledAlphaBlend, 0x66);
+ });
+ test('FCT kEnabledBorderAlpha is 0xA7', () {
+ expect(kEnabledBorderAlpha, 0xA7);
+ });
+ test('FCT kSelectedAlpha is 0xE5', () {
+ expect(kSelectedAlpha, 0xE5);
+ });
+ test('FCT kAltPrimaryAlphaBlend is 0x19', () {
+ expect(kAltPrimaryAlphaBlend, 0x19);
+ });
+ test('FCT kHoverAlphaBlend is 0x40', () {
+ expect(kHoverAlphaBlend, 0x40);
+ });
+ test('FCT kFocusAlphaBlend is 0x4C', () {
+ expect(kFocusAlphaBlend, 0x4C);
+ });
+ test('FCT kHighlightAlphaBlend is 0x40', () {
+ expect(kHighlightAlphaBlend, 0x40);
+ });
+ test('FCT kSplashAlphaBlend is 0x1F', () {
+ expect(kSplashAlphaBlend, 0x1F);
+ });
+ test('FCT kHoverAlpha is 0x19', () {
+ expect(kHoverAlpha, 0x19);
+ });
+ test('FCT kFocusAlpha is 0x4C', () {
+ expect(kFocusAlpha, 0x4C);
+ });
+ test('FCT kHighlightAlpha is 0x19', () {
+ expect(kHighlightAlpha, 0x19);
+ });
+ test('FCT kSplashAlpha is 0x33', () {
+ expect(kSplashAlpha, 0x33);
+ });
+ test('FCT kChipForegroundAlphaBlend is 0x7F', () {
+ expect(kChipForegroundAlphaBlend, 0x7F);
+ });
+ test('FCT kChipBackgroundAlphaBlend is 0xCC', () {
+ expect(kChipBackgroundAlphaBlend, 0xCC);
+ });
+ test('FCT kChipSelectedBackgroundAlphaBlend is 0x96', () {
+ expect(kChipSelectedBackgroundAlphaBlend, 0x96);
+ });
+ test('FCT kUnselectedBackgroundPrimaryAlphaBlend is 0x66', () {
+ expect(kUnselectedBackgroundPrimaryAlphaBlend, 0x66);
+ });
+ test('FCT kUnselectedAlphaBlend is 0xA5', () {
+ expect(kUnselectedAlphaBlend, 0xA5);
});
});
}
diff --git a/test/flex_core_palette_test.dart b/test/flex_core_palette_test.dart
index 942794a13..0a2dc1a08 100644
--- a/test/flex_core_palette_test.dart
+++ b/test/flex_core_palette_test.dart
@@ -83,77 +83,74 @@ void main() {
);
test(
'FCP1.07: GIVEN FlexCorePalette.fromSeeds with 3 colors and defaults '
- 'EXPECT a give result', () {
- expect(
- m3.asList(),
- [
- 4278190080,
- 4280418397,
- 4281867891,
- 4283381643,
- 4284960932,
- 4286605759,
- 4288316123,
- 4290158072,
- 4291869951,
- 4293582335,
- 4294372863,
- 4294966270,
- 4294967295,
- 4278190080,
- 4280162603,
- 4281544001,
- 4283057240,
- 4284636017,
- 4286280842,
- 4287991204,
- 4289767360,
- 4291609564,
- 4293451512,
- 4294438399,
- 4294966269,
- 4294967295,
- 4278190080,
- 4281405469,
- 4282983730,
- 4284693320,
- 4286403168,
- 4288244345,
- 4290020242,
- 4291993005,
- 4293900488,
- 4294957284,
- 4294962417,
- 4294769916,
- 4294967295,
- 4278190080,
- 4280032030,
- 4281413683,
- 4282926665,
- 4284505442,
- 4286150266,
- 4287860628,
- 4289637038,
- 4291478986,
- 4293321189,
- 4294242292,
- 4294966270,
- 4294967295,
- 4278190080,
- 4280097314,
- 4281478968,
- 4282991951,
- 4284570983,
- 4286150015,
- 4287926169,
- 4289702324,
- 4291478735,
- 4293386476,
- 4294307578,
- 4294966270,
- 4294967295
- ],
- );
+ 'EXPECT a given list result', () {
+ expect(m3.asList(), [
+ 4278190080,
+ 4280418397,
+ 4281867890,
+ 4283381642,
+ 4284960932,
+ 4286605759,
+ 4288316379,
+ 4290158072,
+ 4291804415,
+ 4293516799,
+ 4294373119,
+ 4294966271,
+ 4294967295,
+ 4278190080,
+ 4280162603,
+ 4281544001,
+ 4283057240,
+ 4284636016,
+ 4286280842,
+ 4287991204,
+ 4289767359,
+ 4291609307,
+ 4293451512,
+ 4294372863,
+ 4294966271,
+ 4294967295,
+ 4278190080,
+ 4281405469,
+ 4283049266,
+ 4284693320,
+ 4286468704,
+ 4288244345,
+ 4290085778,
+ 4291993005,
+ 4293900488,
+ 4294957539,
+ 4294962416,
+ 4294966271,
+ 4294967295,
+ 4278190080,
+ 4280032030,
+ 4281413683,
+ 4282926666,
+ 4284505442,
+ 4286150266,
+ 4287860628,
+ 4289637038,
+ 4291478986,
+ 4293321190,
+ 4294242292,
+ 4294966271,
+ 4294967295,
+ 4278190080,
+ 4280097314,
+ 4281478968,
+ 4282991950,
+ 4284570982,
+ 4286215551,
+ 4287926169,
+ 4289702324,
+ 4291478735,
+ 4293386475,
+ 4294307578,
+ 4294966271,
+ 4294967295,
+ ]);
});
// Use 3 input values and use chroma from secondary and tertiary
@@ -173,69 +170,69 @@ void main() {
[
4278190080,
4280418397,
- 4281867891,
- 4283381643,
+ 4281867890,
+ 4283381642,
4284960932,
4286605759,
- 4288316123,
+ 4288316379,
4290158072,
- 4291869951,
- 4293582335,
- 4294372863,
- 4294966270,
+ 4291804415,
+ 4293516799,
+ 4294373119,
+ 4294966271,
4294967295,
4278190080,
4280162603,
4281544001,
- 4283057240,
+ 4283056984,
4284636017,
- 4286280842,
- 4287991204,
+ 4286280586,
+ 4287991205,
4289767360,
- 4291609564,
- 4293451512,
- 4294438399,
- 4294966269,
+ 4291609308,
+ 4293451513,
+ 4294372863,
+ 4294966271,
4294967295,
4278190080,
- 4281340189,
+ 4281405725,
4282983730,
- 4284627784,
+ 4284693320,
4286403168,
- 4288244345,
+ 4288178809,
4290020242,
- 4291927725,
+ 4291927469,
4293834952,
- 4294957284,
- 4294962417,
- 4294769916,
+ 4294957539,
+ 4294962416,
+ 4294966271,
4294967295,
4278190080,
4280032030,
4281413683,
- 4282926665,
+ 4282926666,
4284505442,
4286150266,
4287860628,
4289637038,
4291478986,
- 4293321189,
+ 4293321190,
4294242292,
- 4294966270,
+ 4294966271,
4294967295,
4278190080,
4280097314,
4281478968,
- 4282991951,
- 4284570983,
- 4286150015,
+ 4282991950,
+ 4284570982,
+ 4286215551,
4287926169,
4289702324,
4291478735,
- 4293386476,
+ 4293386475,
4294307578,
- 4294966270,
- 4294967295
+ 4294966271,
+ 4294967295,
],
);
});
diff --git a/test/flex_sub_themes_data_test.dart b/test/flex_sub_themes_data_test.dart
index 5d24af36e..ab337973d 100644
--- a/test/flex_sub_themes_data_test.dart
+++ b/test/flex_sub_themes_data_test.dart
@@ -20,19 +20,16 @@ void main() {
blendTextTheme: true,
useTextTheme: true,
buttonMinSize: Size(40, 40),
- thickBorderWidth: 2,
- thinBorderWidth: 1.5,
- elevatedButtonElevation: 1,
unselectedToggleIsColored: false,
inputDecoratorIsFilled: true,
inputDecoratorBorderType: FlexInputBorderType.outline,
inputDecoratorUnfocusedHasBorder: true,
inputDecoratorUnfocusedBorderIsColored: true,
- fabUseShape: true,
+ fabUseShape: false,
cardElevation: 0,
popupMenuElevation: 3,
popupMenuOpacity: 1,
- dialogElevation: 10,
+ dialogElevation: 6,
snackBarElevation: 4,
bottomSheetElevation: 4,
bottomSheetModalElevation: 8,
@@ -61,19 +58,16 @@ void main() {
blendTextTheme: true,
useTextTheme: true,
buttonMinSize: Size(40, 40),
- thickBorderWidth: 2,
- thinBorderWidth: 1.5,
- elevatedButtonElevation: 1,
unselectedToggleIsColored: false,
inputDecoratorIsFilled: true,
inputDecoratorBorderType: FlexInputBorderType.underline, //<- Diff
inputDecoratorUnfocusedHasBorder: true,
inputDecoratorUnfocusedBorderIsColored: true,
- fabUseShape: true,
+ fabUseShape: false,
cardElevation: 0,
popupMenuElevation: 3,
popupMenuOpacity: 1,
- dialogElevation: 10,
+ dialogElevation: 6,
snackBarElevation: 4,
bottomSheetElevation: 4,
bottomSheetModalElevation: 8,
@@ -103,15 +97,12 @@ void main() {
blendTextTheme: false,
useTextTheme: false,
buttonMinSize: Size(41, 42),
- thickBorderWidth: 4,
- thinBorderWidth: 2.5,
- elevatedButtonElevation: 5,
unselectedToggleIsColored: true,
inputDecoratorIsFilled: false,
inputDecoratorBorderType: FlexInputBorderType.underline,
inputDecoratorUnfocusedHasBorder: false,
inputDecoratorUnfocusedBorderIsColored: false,
- fabUseShape: false,
+ fabUseShape: true,
cardElevation: 2,
popupMenuElevation: 4,
popupMenuOpacity: 5,
@@ -195,19 +186,16 @@ void main() {
blendTextTheme: true,
useTextTheme: true,
buttonMinSize: const Size(40, 40),
- thickBorderWidth: 2,
- thinBorderWidth: 1.5,
- elevatedButtonElevation: 1,
unselectedToggleIsColored: false,
inputDecoratorIsFilled: true,
inputDecoratorBorderType: FlexInputBorderType.outline,
inputDecoratorUnfocusedHasBorder: true,
inputDecoratorUnfocusedBorderIsColored: true,
- fabUseShape: true,
+ fabUseShape: false,
cardElevation: 0,
popupMenuElevation: 3,
popupMenuOpacity: 1,
- dialogElevation: 10,
+ dialogElevation: 6,
snackBarElevation: 4,
bottomSheetElevation: 4,
bottomSheetModalElevation: 8,
@@ -260,6 +248,7 @@ void main() {
textButtonSchemeColor: SchemeColor.background,
elevatedButtonSchemeColor: SchemeColor.primary,
outlinedButtonSchemeColor: SchemeColor.surface,
+ outlinedButtonOutlineSchemeColor: SchemeColor.outline,
materialButtonSchemeColor: SchemeColor.tertiary,
toggleButtonsSchemeColor: SchemeColor.tertiaryContainer,
switchSchemeColor: SchemeColor.inversePrimary,
@@ -290,6 +279,7 @@ void main() {
snackBarElevation: 8,
snackBarBackgroundSchemeColor: SchemeColor.onPrimary,
appBarBackgroundSchemeColor: SchemeColor.primary,
+ appBarCenterTitle: true,
tabBarItemSchemeColor: SchemeColor.onSecondary,
tabBarIndicatorSchemeColor: SchemeColor.onPrimary,
bottomSheetRadius: 20,
@@ -380,6 +370,7 @@ void main() {
textButtonSchemeColor: SchemeColor.background,
elevatedButtonSchemeColor: SchemeColor.primary,
outlinedButtonSchemeColor: SchemeColor.surface,
+ outlinedButtonOutlineSchemeColor: SchemeColor.outline,
materialButtonSchemeColor: SchemeColor.tertiary,
toggleButtonsSchemeColor: SchemeColor.tertiaryContainer,
switchSchemeColor: SchemeColor.inversePrimary,
@@ -410,6 +401,7 @@ void main() {
snackBarElevation: 8,
snackBarBackgroundSchemeColor: SchemeColor.onPrimary,
appBarBackgroundSchemeColor: SchemeColor.primary,
+ appBarCenterTitle: true,
tabBarItemSchemeColor: SchemeColor.onSecondary,
tabBarIndicatorSchemeColor: SchemeColor.onPrimary,
bottomSheetRadius: 20,
@@ -494,7 +486,7 @@ void main() {
//
equalsIgnoringHashCodes(
// ignore: lines_longer_than_80_chars
- 'FlexSubThemesData#00000(interactionEffects: true, blendOnLevel : 0, blendOnColors: true, useFlutterDefaults: false, blendTextTheme: true, useTextTheme: true, defaultRadius: null, buttonMinSize: Size(40.0, 40.0), buttonPadding: EdgeInsets(16.0, 0.0, 16.0, 0.0), thickBorderWidth: 2.0, thinBorderWidth: 1.5, textButtonRadius: null, elevatedButtonRadius: null, elevatedButtonElevation: 1.0, outlinedButtonRadius: null, toggleButtonsRadius: null, textButtonSchemeColor: null, elevatedButtonSchemeColor: null, outlinedButtonSchemeColor: null, materialButtonSchemeColor: null, toggleButtonsSchemeColor: null, switchSchemeColor: null, checkboxSchemeColor: null, radioSchemeColor: null, unselectedToggleIsColored: false, inputDecoratorRadius: null, inputDecoratorSchemeColor: null, inputDecoratorIsFilled: true, inputDecoratorFillColor: null, inputDecoratorBorderType: outline, inputDecoratorUnfocusedHasBorder: true, inputDecoratorUnfocusedBorderIsColored: true, fabRadius: null, fabUseShape: true, fabSchemeColor: null, chipRadius: null, chipSchemeColor: null, cardRadius: null, cardElevation: 0.0, popupMenuRadius: null, popupMenuElevation: 3.0, popupMenuOpacity: 1.0, dialogRadius: null, dialogElevation: 10.0, dialogBackgroundSchemeColor: null, timePickerDialogRadius: null, snackBarElevation: 4.0, snackBarBackgroundSchemeColor: null, appBarBackgroundSchemeColor: null, tabBarItemSchemeColor: null, tabBarIndicatorSchemeColor: null, bottomSheetRadius: null, bottomSheetElevation: 4.0, bottomSheetModalElevation: 8.0, bottomNavigationBarLabelTextStyle: null, bottomNavigationBarSelectedLabelSize: null, bottomNavigationBarUnselectedLabelSize: null, bottomNavigationBarSelectedLabelSchemeColor: null, bottomNavigationBarUnselectedLabelSchemeColor: null, bottomNavigationBarMutedUnselectedLabel: true, bottomNavigationBarSelectedIconSize: null, bottomNavigationBarUnselectedIconSize: null, bottomNavigationBarSelectedIconSchemeColor: null, bottomNavigationBarUnselectedIconSchemeColor: null, bottomNavigationBarMutedUnselectedIcon: true, bottomNavigationBarBackgroundSchemeColor: null, bottomNavigationBarOpacity: 1.0, bottomNavigationBarElevation: 0.0, bottomNavigationBarShowSelectedLabels: true, bottomNavigationBarShowUnselectedLabels: true, bottomNavigationBarType: fixed, bottomNavigationBarLandscapeLayout: null, navigationBarLabelTextStyle: null, navigationBarSelectedLabelSize: null, navigationBarUnselectedLabelSize: null, navigationBarSelectedLabelSchemeColor: null, navigationBarUnselectedLabelSchemeColor: null, navigationBarMutedUnselectedLabel: true, navigationBarSelectedIconSize: null, navigationBarUnselectedIconSize: null, navigationBarSelectedIconSchemeColor: null, navigationBarUnselectedIconSchemeColor: null, navigationBarMutedUnselectedIcon: true, navigationBarIndicatorSchemeColor: null, navigationBarHighlightOpacity: null, navigationBarBackgroundSchemeColor: null, navigationBarOpacity: 1.0, navigationBarHeight: null, navigationBarLabelBehavior: alwaysShow, navigationRailLabelTextStyle: null, navigationRailSelectedLabelSize: null, navigationRailUnselectedLabelSize: null, navigationRailSelectedLabelSchemeColor: null, navigationRailUnselectedLabelSchemeColor: null, navigationRailMutedUnselectedLabel: true, navigationRailSelectedIconSize: null, navigationRailUnselectedIconSize: null, navigationRailSelectedIconSchemeColor: null, navigationRailUnselectedIconSchemeColor: null, navigationRailMutedUnselectedIcon: true, navigationRailUseIndicator: true, navigationRailIndicatorSchemeColor: null, navigationRailIndicatorOpacity: null, navigationRailBackgroundSchemeColor: null, navigationRailOpacity: 1.0, navigationRailElevation: 0.0, navigationRailLabelType: all, navigationRailGroupAlignment: null)'));
+ 'FlexSubThemesData#00000(interactionEffects: true, blendOnLevel : 0, blendOnColors: true, useFlutterDefaults: false, blendTextTheme: true, useTextTheme: true, defaultRadius: null, buttonMinSize: Size(40.0, 40.0), buttonPadding: EdgeInsets(16.0, 0.0, 16.0, 0.0), thickBorderWidth: null, thinBorderWidth: null, textButtonRadius: null, elevatedButtonRadius: null, elevatedButtonElevation: null, outlinedButtonRadius: null, toggleButtonsRadius: null, textButtonSchemeColor: null, elevatedButtonSchemeColor: null, elevatedButtonSecondarySchemeColor: null, outlinedButtonSchemeColor: null, outlinedButtonOutlineSchemeColor: null, materialButtonSchemeColor: null, toggleButtonsSchemeColor: null, switchSchemeColor: null, checkboxSchemeColor: null, radioSchemeColor: null, unselectedToggleIsColored: false, inputDecoratorRadius: null, inputDecoratorSchemeColor: null, inputDecoratorIsFilled: true, inputDecoratorFillColor: null, inputDecoratorBorderType: outline, inputDecoratorUnfocusedHasBorder: true, inputDecoratorUnfocusedBorderIsColored: true, fabRadius: null, fabUseShape: false, fabSchemeColor: null, chipRadius: null, chipSchemeColor: null, cardRadius: null, cardElevation: 0.0, popupMenuRadius: null, popupMenuElevation: 3.0, popupMenuOpacity: 1.0, dialogRadius: null, dialogElevation: 6.0, dialogBackgroundSchemeColor: null, timePickerDialogRadius: null, snackBarElevation: 4.0, snackBarBackgroundSchemeColor: null, appBarBackgroundSchemeColor: null, appBarCenterTitle: null, tabBarItemSchemeColor: null, tabBarIndicatorSchemeColor: null, bottomSheetRadius: null, bottomSheetElevation: 4.0, bottomSheetModalElevation: 8.0, bottomNavigationBarLabelTextStyle: null, bottomNavigationBarSelectedLabelSize: null, bottomNavigationBarUnselectedLabelSize: null, bottomNavigationBarSelectedLabelSchemeColor: null, bottomNavigationBarUnselectedLabelSchemeColor: null, bottomNavigationBarMutedUnselectedLabel: true, bottomNavigationBarSelectedIconSize: null, bottomNavigationBarUnselectedIconSize: null, bottomNavigationBarSelectedIconSchemeColor: null, bottomNavigationBarUnselectedIconSchemeColor: null, bottomNavigationBarMutedUnselectedIcon: true, bottomNavigationBarBackgroundSchemeColor: null, bottomNavigationBarOpacity: 1.0, bottomNavigationBarElevation: 0.0, bottomNavigationBarShowSelectedLabels: true, bottomNavigationBarShowUnselectedLabels: true, bottomNavigationBarType: fixed, bottomNavigationBarLandscapeLayout: null, navigationBarLabelTextStyle: null, navigationBarSelectedLabelSize: null, navigationBarUnselectedLabelSize: null, navigationBarSelectedLabelSchemeColor: null, navigationBarUnselectedLabelSchemeColor: null, navigationBarMutedUnselectedLabel: true, navigationBarSelectedIconSize: null, navigationBarUnselectedIconSize: null, navigationBarSelectedIconSchemeColor: null, navigationBarUnselectedIconSchemeColor: null, navigationBarMutedUnselectedIcon: true, navigationBarIndicatorSchemeColor: null, navigationBarHighlightOpacity: null, navigationBarBackgroundSchemeColor: null, navigationBarOpacity: 1.0, navigationBarHeight: null, navigationBarLabelBehavior: alwaysShow, navigationRailLabelTextStyle: null, navigationRailSelectedLabelSize: null, navigationRailUnselectedLabelSize: null, navigationRailSelectedLabelSchemeColor: null, navigationRailUnselectedLabelSchemeColor: null, navigationRailMutedUnselectedLabel: true, navigationRailSelectedIconSize: null, navigationRailUnselectedIconSize: null, navigationRailSelectedIconSchemeColor: null, navigationRailUnselectedIconSchemeColor: null, navigationRailMutedUnselectedIcon: true, navigationRailUseIndicator: true, navigationRailIndicatorSchemeColor: null, navigationRailIndicatorOpacity: null, navigationRailBackgroundSchemeColor: null, navigationRailOpacity: 1.0, navigationRailElevation: 0.0, navigationRailLabelType: all, navigationRailGroupAlignment: null)'));
});
test(
'FSTC1.07: Test toStringShort implemented via debugFillProperties '
diff --git a/test/flex_sub_themes_scheme_color_test.dart b/test/flex_sub_themes_scheme_color_test.dart
index 503b6dce5..f72bdcd11 100644
--- a/test/flex_sub_themes_scheme_color_test.dart
+++ b/test/flex_sub_themes_scheme_color_test.dart
@@ -29,7 +29,9 @@ void main() {
const Color surfaceVariant = Color(0xFFB9C4F1);
const Color onSurfaceVariant = Color(0xFF22252D);
const Color outline = Color(0xFF020F34);
+ const Color outlineVariant = Color(0xFF0D5937);
const Color shadow = Color(0xFF060B20);
+ const Color scrim = Color(0xFF071331);
const Color inverseSurface = Color(0xFFBCCBED);
const Color onInverseSurface = Color(0xFF2A303C);
const Color inversePrimary = Color(0xFF333333);
@@ -59,7 +61,9 @@ void main() {
surfaceVariant: surfaceVariant,
onSurfaceVariant: onSurfaceVariant,
outline: outline,
+ outlineVariant: outlineVariant,
shadow: shadow,
+ scrim: scrim,
inverseSurface: inverseSurface,
onInverseSurface: onInverseSurface,
inversePrimary: inversePrimary,
@@ -209,43 +213,55 @@ void main() {
equals(outline));
});
test(
- 'FST.sC-24: GIVEN SchemeColor.shadow '
+ 'FST.sC-24: GIVEN SchemeColor.outlineVariant '
+ 'EXPECT outlineVariant color to be returned', () {
+ expect(FlexSubThemes.schemeColor(SchemeColor.outlineVariant, scheme),
+ equals(outlineVariant));
+ });
+ test(
+ 'FST.sC-25: GIVEN SchemeColor.shadow '
'EXPECT shadow color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.shadow, scheme),
equals(shadow));
});
test(
- 'FST.sC-25: GIVEN SchemeColor.inverseSurface '
+ 'FST.sC-26: GIVEN SchemeColor.scrim '
+ 'EXPECT scrim color to be returned', () {
+ expect(
+ FlexSubThemes.schemeColor(SchemeColor.scrim, scheme), equals(scrim));
+ });
+ test(
+ 'FST.sC-27: GIVEN SchemeColor.inverseSurface '
'EXPECT inverseSurface color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.inverseSurface, scheme),
equals(inverseSurface));
});
test(
- 'FST.sC-26: GIVEN SchemeColor.onInverseSurface '
+ 'FST.sC-28: GIVEN SchemeColor.onInverseSurface '
'EXPECT onInverseSurface color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.onInverseSurface, scheme),
equals(onInverseSurface));
});
test(
- 'FST.sC-27: GIVEN SchemeColor.inversePrimary '
+ 'FST.sC-29: GIVEN SchemeColor.inversePrimary '
'EXPECT inversePrimary color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.inversePrimary, scheme),
equals(inversePrimary));
});
test(
- 'FST.sC-28: GIVEN SchemeColor.surfaceTint '
+ 'FST.sC-30: GIVEN SchemeColor.surfaceTint '
'EXPECT surfaceTint color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.surfaceTint, scheme),
equals(surfaceTint));
});
test(
- 'FST.sC-29: GIVEN SchemeColor.primaryVariant '
+ 'FST.sC-31: GIVEN SchemeColor.primaryVariant '
'EXPECT primaryVariant color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.primaryVariant, scheme),
equals(primaryContainer));
});
test(
- 'FST.sC-30: GIVEN SchemeColor.secondaryVariant '
+ 'FST.sC-32: GIVEN SchemeColor.secondaryVariant '
'EXPECT secondaryVariant color to be returned', () {
expect(FlexSubThemes.schemeColor(SchemeColor.secondaryVariant, scheme),
equals(secondaryContainer));
@@ -405,44 +421,56 @@ void main() {
equals(background));
});
test(
- 'FST.sCP-24: GIVEN SchemeColor.shadow '
+ 'FST.sCP-24: GIVEN SchemeColor.outlineVariant '
+ 'EXPECT background color to be returned', () {
+ expect(FlexSubThemes.schemeColorPair(SchemeColor.outlineVariant, scheme),
+ equals(background));
+ });
+ test(
+ 'FST.sCP-25: GIVEN SchemeColor.shadow '
'EXPECT background color to be returned', () {
expect(FlexSubThemes.schemeColorPair(SchemeColor.shadow, scheme),
equals(background));
});
test(
- 'FST.sCP-25: GIVEN SchemeColor.inverseSurface '
+ 'FST.sCP-26: GIVEN SchemeColor.scrim '
+ 'EXPECT background color to be returned', () {
+ expect(FlexSubThemes.schemeColorPair(SchemeColor.scrim, scheme),
+ equals(background));
+ });
+ test(
+ 'FST.sCP-27: GIVEN SchemeColor.inverseSurface '
'EXPECT onInverseSurface color to be returned', () {
expect(FlexSubThemes.schemeColorPair(SchemeColor.inverseSurface, scheme),
equals(onInverseSurface));
});
test(
- 'FST.sCP-26: GIVEN SchemeColor.onInverseSurface '
+ 'FST.sCP-28: GIVEN SchemeColor.onInverseSurface '
'EXPECT inverseSurface color to be returned', () {
expect(
FlexSubThemes.schemeColorPair(SchemeColor.onInverseSurface, scheme),
equals(inverseSurface));
});
test(
- 'FST.sCP-27: GIVEN SchemeColor.inversePrimary '
+ 'FST.sCP-29: GIVEN SchemeColor.inversePrimary '
'EXPECT primary color to be returned', () {
expect(FlexSubThemes.schemeColorPair(SchemeColor.inversePrimary, scheme),
equals(primary));
});
test(
- 'FST.sCP-28: GIVEN SchemeColor.surfaceTint '
+ 'FST.sCP-30: GIVEN SchemeColor.surfaceTint '
'EXPECT primary color to be returned', () {
expect(FlexSubThemes.schemeColorPair(SchemeColor.surfaceTint, scheme),
equals(onPrimary));
});
test(
- 'FST.sCP-29: GIVEN SchemeColor.primaryVariant '
+ 'FST.sCP-31: GIVEN SchemeColor.primaryVariant '
'EXPECT onPrimaryContainer color to be returned', () {
expect(FlexSubThemes.schemeColorPair(SchemeColor.primaryVariant, scheme),
equals(onPrimaryContainer));
});
test(
- 'FST.sCP-30: GIVEN SchemeColor.secondaryVariant '
+ 'FST.sCP-32: GIVEN SchemeColor.secondaryVariant '
'EXPECT onSecondaryContainer color to be returned', () {
expect(
FlexSubThemes.schemeColorPair(SchemeColor.secondaryVariant, scheme),
diff --git a/test/flex_sub_themes_test.dart b/test/flex_sub_themes_test.dart
index 54558499c..c3cc8967a 100644
--- a/test/flex_sub_themes_test.dart
+++ b/test/flex_sub_themes_test.dart
@@ -351,7 +351,10 @@ void main() {
FlexSubThemes.dialogTheme(),
equals(
const DialogTheme(
- elevation: 10,
+ elevation: 6,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding:
+ EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(28),
@@ -373,7 +376,10 @@ void main() {
equals(
const DialogTheme(
backgroundColor: Color(0xFF343476),
- elevation: 10,
+ elevation: 6,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding:
+ EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(28),
@@ -397,7 +403,10 @@ void main() {
equals(
const DialogTheme(
backgroundColor: Color(0xFFDDDDDD),
- elevation: 10,
+ elevation: 6,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding:
+ EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(28),
@@ -421,7 +430,10 @@ void main() {
equals(
DialogTheme(
backgroundColor: colorScheme.tertiary,
- elevation: 10,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding:
+ const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
+ elevation: 6,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(28),
@@ -438,10 +450,15 @@ void main() {
FlexSubThemes.dialogTheme(
elevation: 10,
radius: 6,
+ actionsPadding:
+ const EdgeInsets.only(left: 12.0, right: 6.0, bottom: 20.0),
),
equals(
const DialogTheme(
elevation: 10,
+ // TODO(rydmike): For 3.1.0, not available in stable 3.0.5.
+ actionsPadding:
+ EdgeInsets.only(left: 12.0, right: 6.0, bottom: 20.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(6),
@@ -1138,7 +1155,7 @@ void main() {
// FlexSubThemes ElevatedButton tests
// -------------------------------------------------------------------------
test(
- 'FST1.09: GIVEN a default FlexSubTheme.elevatedButtonTheme() '
+ 'FST1.09-M2: GIVEN a default M2 FlexSubTheme.elevatedButtonTheme() '
'EXPECT equal to ElevatedButtonThemeData() version with '
'same values', () {
const ColorScheme colorScheme = ColorScheme.light();
@@ -1194,9 +1211,178 @@ void main() {
),
);
});
- test('FST1.09-states: Does ElevatedButton have right material states', () {
+ test(
+ 'FST1.09-M3: GIVEN a default M3 FlexSubTheme.elevatedButtonTheme() '
+ 'EXPECT equal to ElevatedButtonThemeData() version with '
+ 'same values', () {
const ColorScheme colorScheme = ColorScheme.light();
- // Disabled foreground
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ ElevatedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return colorScheme.primary;
+ }),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.12);
+ }
+ return colorScheme.onPrimary;
+ }),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.primary.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ return null;
+ }),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test(
+ 'FST1.09-secondary: GIVEN a default FlexSubTheme.elevatedButtonTheme() '
+ 'with secondary color as base color '
+ 'EXPECT equal to ElevatedButtonThemeData() version with '
+ 'same values', () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ ElevatedButtonThemeData(
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size(40, 40),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(20),
+ ),
+ ), //buttonShape,
+ elevation: 1,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.secondary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x5E);
+ }
+ return colorScheme.onSecondary;
+ },
+ ),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.secondary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x31);
+ }
+ return colorScheme.secondary;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.onPrimary.withAlpha(0x0D);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.onPrimary.withAlpha(0x26);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.onPrimary.withAlpha(0x33);
+ }
+ return Colors.transparent;
+ },
+ ),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test(
+ 'FST1.09-secondary-onBase: GIVEN a default '
+ 'FlexSubTheme.elevatedButtonTheme() '
+ 'with secondary color as onBase color '
+ 'EXPECT equal to ElevatedButtonThemeData() version with '
+ 'same values', () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ onBaseSchemeColor: SchemeColor.secondary,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ ElevatedButtonThemeData(
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size(40, 40),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(20),
+ ),
+ ), //buttonShape,
+ elevation: 1,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.secondary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x5E);
+ }
+ return colorScheme.onSecondary;
+ },
+ ),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.primary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x31);
+ }
+ return colorScheme.primary;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.onSecondary.withAlpha(0x0D);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.onSecondary.withAlpha(0x26);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.onSecondary.withAlpha(0x33);
+ }
+ return Colors.transparent;
+ },
+ ),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test('FST1.09-M2-states: Does ElevatedButton have right Material 2 states',
+ () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ // Disabled foreground, default, M2
expect(
FlexSubThemes.elevatedButtonTheme(colorScheme: colorScheme)
.style!
@@ -1206,6 +1392,19 @@ void main() {
.blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
.withAlpha(kDisabledForegroundAlpha)),
);
+ // Disabled foreground, default, M2
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary)
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.secondary
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledForegroundAlpha)),
+ );
+ // Selected foreground, M2
expect(
FlexSubThemes.elevatedButtonTheme(colorScheme: colorScheme)
.style!
@@ -1213,7 +1412,28 @@ void main() {
.resolve({MaterialState.selected}),
equals(colorScheme.onPrimary),
);
- // Disabled background
+ // Selected foreground, custom color, M2
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary)
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.onSecondary),
+ );
+ // Selected foreground, custom colors, M2
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ onBaseSchemeColor: SchemeColor.tertiary)
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.tertiary),
+ );
+ // Disabled background, M2
expect(
FlexSubThemes.elevatedButtonTheme(colorScheme: colorScheme)
.style!
@@ -1260,6 +1480,120 @@ void main() {
equals(Colors.transparent),
);
});
+ test('FST1.09-M3-states: Does ElevatedButton have right Material 3 states',
+ () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ // Disabled foreground, default, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.onSurface.withOpacity(0.38)),
+ );
+ // Disabled foreground, default, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ useMaterial3: true,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.onSurface.withOpacity(0.38)),
+ );
+ // Selected foreground, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.primary),
+ );
+ // Selected foreground, custom color, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ useMaterial3: true,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.secondary),
+ );
+ // Selected foreground, custom colors, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ onBaseSchemeColor: SchemeColor.tertiary,
+ useMaterial3: true,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.secondary),
+ );
+ // Disabled background, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ )
+ .style!
+ .backgroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.onSurface.withOpacity(0.12)),
+ );
+ // Selected background, M3
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ )
+ .style!
+ .backgroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.surface),
+ );
+ // Overlay color states
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).style!.overlayColor!.resolve({MaterialState.hovered}),
+ equals(colorScheme.primary.withOpacity(0.08)),
+ );
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).style!.overlayColor!.resolve({MaterialState.focused}),
+ equals(colorScheme.primary.withOpacity(0.12)),
+ );
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).style!.overlayColor!.resolve({MaterialState.pressed}),
+ equals(colorScheme.primary.withOpacity(0.12)),
+ );
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).style!.overlayColor!.resolve({MaterialState.selected}),
+ equals(null),
+ );
+ });
test(
'FST1.09custom-1: GIVEN a custom FlexSubTheme.elevatedButtonTheme() '
'EXPECT equal to ElevatedButtonThemeData() version with '
@@ -1333,6 +1667,7 @@ void main() {
FlexSubThemes.elevatedButtonTheme(
colorScheme: colorScheme,
baseSchemeColor: SchemeColor.tertiary,
+ onBaseSchemeColor: SchemeColor.secondary,
elevation: 1,
padding: const EdgeInsets.symmetric(horizontal: 8),
minButtonSize: const Size(55, 55),
@@ -1357,7 +1692,7 @@ void main() {
.blendAlpha(colorScheme.onSurface, 0x66)
.withAlpha(0x5E);
}
- return colorScheme.onTertiary;
+ return colorScheme.secondary;
},
),
backgroundColor: MaterialStateProperty.resolveWith(
@@ -1389,22 +1724,146 @@ void main() {
),
);
});
- // -------------------------------------------------------------------------
- // FlexSubThemes OutlinedButton tests
- // -------------------------------------------------------------------------
test(
- 'FST1.10: GIVEN a default FlexSubTheme.outlinedButtonTheme() EXPECT '
- 'equal to OutlinedButtonThemeData() version with same values', () {
+ 'FST1.09custom-1-M3: GIVEN a custom FlexSubTheme.elevatedButtonTheme() '
+ 'EXPECT equal to ElevatedButtonThemeData() version with '
+ 'same values', () {
const ColorScheme colorScheme = ColorScheme.light();
expect(
- FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme).toString(),
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ elevation: 1,
+ padding: const EdgeInsets.symmetric(horizontal: 8),
+ minButtonSize: const Size(50, 50),
+ radius: 10,
+ useMaterial3: true,
+ ).toString(),
equalsIgnoringHashCodes(
- OutlinedButtonThemeData(
- style: OutlinedButton.styleFrom(
- minimumSize: const Size(40, 40),
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(20),
+ ElevatedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return colorScheme.primary;
+ }),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.12);
+ }
+ return colorScheme.onPrimary;
+ }),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.primary.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ return null;
+ }),
+ minimumSize:
+ ButtonStyleButton.allOrNull(const Size(50, 50)),
+ padding: ButtonStyleButton.allOrNull(
+ const EdgeInsets.symmetric(horizontal: 8)),
+ elevation: ButtonStyleButton.allOrNull(1),
+ shape: ButtonStyleButton.allOrNull(
+ const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(10),
+ ),
+ ),
+ ), //buttonShape,
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test(
+ 'FST1.09custom-2-M3: GIVEN a custom FlexSubTheme.elevatedButtonTheme() '
+ 'EXPECT equal to ElevatedButtonThemeData() version with '
+ 'same values', () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ expect(
+ FlexSubThemes.elevatedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ onBaseSchemeColor: SchemeColor.secondary,
+ elevation: 2,
+ padding: const EdgeInsets.symmetric(horizontal: 9),
+ minButtonSize: const Size(55, 55),
+ radius: 12,
+ useMaterial3: true,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ ElevatedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return colorScheme.tertiary;
+ }),
+ backgroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.12);
+ }
+ return colorScheme.secondary;
+ }),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.tertiary.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.tertiary.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.tertiary.withOpacity(0.12);
+ }
+ return null;
+ }),
+ minimumSize:
+ ButtonStyleButton.allOrNull(const Size(55, 55)),
+ padding: ButtonStyleButton.allOrNull(
+ const EdgeInsets.symmetric(horizontal: 9)),
+ elevation: ButtonStyleButton.allOrNull(2),
+ shape: ButtonStyleButton.allOrNull(
+ const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(12),
+ ),
+ ),
+ ), //buttonShape,
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ // -------------------------------------------------------------------------
+ // FlexSubThemes OutlinedButton tests
+ // -------------------------------------------------------------------------
+ test(
+ 'FST1.10-M2: GIVEN a default FlexSubTheme.outlinedButtonTheme() EXPECT '
+ 'equal to OutlinedButtonThemeData() version with same values', () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme).toString(),
+ equalsIgnoringHashCodes(
+ OutlinedButtonThemeData(
+ style: OutlinedButton.styleFrom(
+ minimumSize: const Size(40, 40),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(20),
),
), //buttonShape,
).copyWith(
@@ -1465,20 +1924,561 @@ void main() {
),
);
});
- test('FST1.10-states: Does OutlinedButton have right material states', () {
- const ColorScheme colorScheme = ColorScheme.light();
+ test(
+ 'FST1.10-custom-M2: GIVEN a custom FlexSubTheme.outlinedButtonTheme() '
+ 'EXPECT '
+ 'equal to OutlinedButtonThemeData() version with same values', () {
+ final ColorScheme colorScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF42AEE7),
+ brightness: Brightness.light,
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.primaryContainer,
+ outlineSchemeColor: SchemeColor.secondaryContainer,
+ padding: const EdgeInsets.symmetric(horizontal: 17),
+ minButtonSize: const Size(52, 40),
+ radius: 13,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ OutlinedButtonThemeData(
+ style: OutlinedButton.styleFrom(
+ minimumSize: const Size(52, 40),
+ padding: const EdgeInsets.symmetric(horizontal: 17),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(13),
+ ),
+ ), //buttonShape,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.primaryContainer
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x5E);
+ }
+ return colorScheme.primaryContainer;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.primaryContainer.withAlpha(0x0D);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.primaryContainer.withAlpha(0x26);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.primaryContainer.withAlpha(0x33);
+ }
+ return Colors.transparent;
+ },
+ ),
+ side: MaterialStateProperty.resolveWith(
+ (final Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: colorScheme.secondaryContainer
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x31),
+ width: 1.5,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: 2,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: colorScheme.secondaryContainer,
+ width: 2,
+ );
+ }
+ return BorderSide(
+ color: colorScheme.secondaryContainer.withAlpha(0xA7),
+ width: 1.5,
+ );
+ },
+ ),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test(
+ 'FST1.10-M3: GIVEN a default FlexSubTheme.outlinedButtonTheme() EXPECT '
+ 'equal to OutlinedButtonThemeData() version with same values', () {
+ final ColorScheme colorScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF7142E7),
+ brightness: Brightness.light,
+ );
+ final MaterialStateProperty foregroundColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return colorScheme.primary;
+ });
+
+ final MaterialStateProperty overlayColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.primary.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ return null;
+ });
+
+ final MaterialStateProperty side =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: colorScheme.onSurface.withOpacity(0.12),
+ width: 1,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: 1,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: colorScheme.outline,
+ width: 1,
+ );
+ }
+ return BorderSide(
+ color: colorScheme.outline,
+ width: 1,
+ );
+ });
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ useMaterial3: true,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ OutlinedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: foregroundColor,
+ backgroundColor:
+ ButtonStyleButton.allOrNull(Colors.transparent),
+ overlayColor: overlayColor,
+ elevation: ButtonStyleButton.allOrNull(0.0),
+ side: side,
+ ),
+ ).toString(),
+ ),
+ );
+ });
+ test(
+ 'FST1.10-outline-M2: GIVEN a custom FlexSubTheme.outlinedButtonTheme() '
+ 'EXPECT '
+ 'equal to OutlinedButtonThemeData() version with same values', () {
+ const ColorScheme colorScheme = ColorScheme.light();
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ outlineSchemeColor: SchemeColor.tertiary,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ OutlinedButtonThemeData(
+ style: OutlinedButton.styleFrom(
+ minimumSize: const Size(40, 40),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(20),
+ ),
+ ), //buttonShape,
+ ).copyWith(
+ foregroundColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.secondary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x5E);
+ }
+ return colorScheme.secondary;
+ },
+ ),
+ overlayColor: MaterialStateProperty.resolveWith(
+ (Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.secondary.withAlpha(0x0D);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.secondary.withAlpha(0x26);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.secondary.withAlpha(0x33);
+ }
+ return Colors.transparent;
+ },
+ ),
+ side: MaterialStateProperty.resolveWith(
+ (final Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: colorScheme.tertiary
+ .blendAlpha(colorScheme.onSurface, 0x66)
+ .withAlpha(0x31),
+ width: 1.5,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: 2,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: colorScheme.tertiary,
+ width: 2,
+ );
+ }
+ return BorderSide(
+ color: colorScheme.tertiary.withAlpha(0xA7),
+ width: 1.5,
+ );
+ },
+ ),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+
+ test(
+ 'FST1.10-outline-M3: GIVEN a custom FlexSubTheme.outlinedButtonTheme() '
+ 'EXPECT '
+ 'equal to OutlinedButtonThemeData() version with same values', () {
+ final ColorScheme colorScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF7142E7),
+ brightness: Brightness.light,
+ );
+ final MaterialStateProperty foregroundColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return colorScheme.onSurface.withOpacity(0.38);
+ }
+ return colorScheme.primary;
+ });
+
+ final MaterialStateProperty overlayColor =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.hovered)) {
+ return colorScheme.primary.withOpacity(0.08);
+ }
+ if (states.contains(MaterialState.focused)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return colorScheme.primary.withOpacity(0.12);
+ }
+ return null;
+ });
+
+ final MaterialStateProperty side =
+ MaterialStateProperty.resolveWith((Set states) {
+ if (states.contains(MaterialState.disabled)) {
+ return BorderSide(
+ color: colorScheme.onSurface.withOpacity(0.12),
+ width: 1,
+ );
+ }
+ if (states.contains(MaterialState.error)) {
+ return BorderSide(
+ color: colorScheme.error,
+ width: 1,
+ );
+ }
+ if (states.contains(MaterialState.pressed)) {
+ return BorderSide(
+ color: colorScheme.outline,
+ width: 1,
+ );
+ }
+ return BorderSide(
+ color: colorScheme.outline,
+ width: 1,
+ );
+ });
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.secondary,
+ outlineSchemeColor: SchemeColor.tertiary,
+ padding: const EdgeInsets.symmetric(horizontal: 17),
+ minButtonSize: const Size(52, 40),
+ radius: 13,
+ useMaterial3: true,
+ ).toString(),
+ equalsIgnoringHashCodes(
+ OutlinedButtonThemeData(
+ style: ButtonStyle(
+ foregroundColor: foregroundColor,
+ backgroundColor:
+ ButtonStyleButton.allOrNull(Colors.transparent),
+ overlayColor: overlayColor,
+ minimumSize:
+ ButtonStyleButton.allOrNull(const Size(52, 40)),
+ padding: ButtonStyleButton.allOrNull(
+ const EdgeInsets.symmetric(horizontal: 17)),
+ elevation: ButtonStyleButton.allOrNull(0.0),
+ side: side,
+ shape: ButtonStyleButton.allOrNull(
+ const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(13),
+ ),
+ ),
+ ),
+ ),
+ ).toString(),
+ ),
+ );
+ });
+
+ test('FST1.10-states-M2: Does OutlinedButton have right material states',
+ () {
+ final ColorScheme colorScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF79E742),
+ brightness: Brightness.light,
+ );
+ // Disabled foreground
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.primary
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledForegroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.primary),
+ );
+ // Overlay color states
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .overlayColor!
+ .resolve({MaterialState.hovered}),
+ equals(colorScheme.primary.withAlpha(kHoverBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .overlayColor!
+ .resolve({MaterialState.focused}),
+ equals(colorScheme.primary.withAlpha(kFocusBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .overlayColor!
+ .resolve({MaterialState.pressed}),
+ equals(colorScheme.primary.withAlpha(kPressedBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .overlayColor!
+ .resolve({MaterialState.selected}),
+ equals(Colors.transparent),
+ );
+ // Border side states
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .side!
+ .resolve({MaterialState.disabled}),
+ equals(BorderSide(
+ color: colorScheme.primary
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledBackgroundAlpha),
+ width: 1.5)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .side!
+ .resolve({MaterialState.error}),
+ equals(BorderSide(
+ color: colorScheme.error,
+ width: 2,
+ )),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .side!
+ .resolve({MaterialState.pressed}),
+ equals(BorderSide(
+ color: colorScheme.primary,
+ width: 2,
+ )),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(colorScheme: colorScheme)
+ .style!
+ .side!
+ .resolve({MaterialState.selected}),
+ equals(BorderSide(
+ color: colorScheme.primary.withAlpha(kEnabledBorderAlpha),
+ width: 1.5,
+ )),
+ );
+ });
+ test('FST1.10-states-custom-M2: Does OutlinedButton have right states', () {
+ final ColorScheme colorScheme = ColorScheme.fromSeed(
+ seedColor: const Color(0xFF42AEE7),
+ brightness: Brightness.light,
+ );
+ // Disabled foreground
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.disabled}),
+ equals(colorScheme.tertiary
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledForegroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ )
+ .style!
+ .foregroundColor!
+ .resolve({MaterialState.selected}),
+ equals(colorScheme.tertiary),
+ );
+ // Overlay color states
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.overlayColor!.resolve({MaterialState.hovered}),
+ equals(colorScheme.tertiary.withAlpha(kHoverBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.overlayColor!.resolve({MaterialState.focused}),
+ equals(colorScheme.tertiary.withAlpha(kFocusBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.overlayColor!.resolve({MaterialState.pressed}),
+ equals(colorScheme.tertiary.withAlpha(kPressedBackgroundAlpha)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.overlayColor!.resolve({MaterialState.selected}),
+ equals(Colors.transparent),
+ );
+ // Border side states
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.side!.resolve({MaterialState.disabled}),
+ equals(BorderSide(
+ color: colorScheme.primaryContainer
+ .blendAlpha(colorScheme.onSurface, kDisabledAlphaBlend)
+ .withAlpha(kDisabledBackgroundAlpha),
+ width: 1.5)),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.side!.resolve({MaterialState.error}),
+ equals(BorderSide(
+ color: colorScheme.error,
+ width: 2,
+ )),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.side!.resolve({MaterialState.pressed}),
+ equals(BorderSide(
+ color: colorScheme.primaryContainer,
+ width: 2,
+ )),
+ );
+ expect(
+ FlexSubThemes.outlinedButtonTheme(
+ colorScheme: colorScheme,
+ baseSchemeColor: SchemeColor.tertiary,
+ outlineSchemeColor: SchemeColor.primaryContainer,
+ ).style!.side!.resolve(