Skip to content

Commit

Permalink
FIX: #136
Browse files Browse the repository at this point in the history
  • Loading branch information
rydmike committed Apr 19, 2023
1 parent c2c9e1b commit 449bc5c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All changes to the **FlexColorScheme** (FCS) package are documented here.

## 7.0.3

**Apr 19, 2023**

- Fix [#136](https://github.com/rydmike/flex_color_scheme/issues/136) default background color regression on `FlexThemeModeSwitch` and `FlexThemeModeOptionButton`.

## 7.0.2

**Apr 16, 2023**
Expand Down
4 changes: 2 additions & 2 deletions example/lib/shared/const/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class App {
// build numbers.
static const String versionMajor = '7';
static const String versionMinor = '0';
static const String versionPatch = '1';
static const String versionPatch = '3';
static const String versionBuild = '01';
static const String version = '$versionMajor.$versionMinor.$versionPatch '
'Build-$versionBuild';
static const String packageVersion =
'$versionMajor.$versionMinor.$versionPatch';
static const String flutterVersion = '3.7.10 (html renderer)';
static const String flutterVersion = '3.7.11 (html renderer)';
static const String copyright = '© 2020 - 2023';
static const String author = 'Mike Rydstrom';
static const String license = 'BSD 3-Clause License';
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ packages:
path: ".."
relative: true
source: path
version: "7.0.2"
version: "7.0.3"
flex_seed_scheme:
dependency: "direct main"
description:
Expand All @@ -153,10 +153,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: "12006889e2987c549c4c1ec1a5ba4ec4b24d34d2469ee5f9476c926dcecff266"
sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f
url: "https://pub.dev"
source: hosted
version: "2.0.4"
version: "2.0.5"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flex_color_scheme_example
description: Examples that demonstrate how to use the FlexColorScheme package.
version: 7.0.2
version: 7.0.3
publish_to: 'none'
environment:
sdk: '>=2.19.0 <4.0.0'
Expand Down Expand Up @@ -54,7 +54,7 @@ dependencies:
# SVG file drawing, used by Asset Images, by dnfield.dev.
# Used to display undraw SVG image in Playground simulated mock apps.
# https://pub.dev/packages/flutter_svg
flutter_svg: ^2.0.4
flutter_svg: ^2.0.5

# Google fonts, by Google material.io.
# https://pub.dev/packages/google_fonts
Expand Down
1 change: 0 additions & 1 deletion lib/src/flex_theme_mode_switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ class _FlexThemeModeOptionButtonState extends State<FlexThemeModeOptionButton> {
semanticsLabel: '', // Is set on button instead
),
Material(
type: MaterialType.transparency,
elevation: widget.elevation,
color: widget.backgroundColor,
clipBehavior: Clip.antiAlias,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flex_color_scheme
description: A Flutter package to use and make beautiful Material design based themes.
version: 7.0.2
version: 7.0.3
homepage: https://docs.flexcolorscheme.com
repository: https://github.com/rydmike/flex_color_scheme
issue_tracker: https://github.com/rydmike/flex_color_scheme/issues
Expand Down
26 changes: 26 additions & 0 deletions test/flex_theme_mode_switch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,29 @@ void main() {
await tester.pumpAndSettle();
expect(lightSwitch, findsOneWidget);

// EXPECT: Light switch has default white background and type canvas.
final Finder lightSwitchMaterial = find
.descendant(of: lightSwitch, matching: find.byType(Material))
.first;
final Material lightMaterial =
tester.widget<Material>(lightSwitchMaterial);
expect(lightMaterial.type, MaterialType.canvas);
expect(lightMaterial.color, Colors.white);

// EXPECT: That we find a dark theme mode button
final Finder darkSwitch = find.bySemanticsLabel('DARK');
await tester.tap(darkSwitch);
await tester.pumpAndSettle();
expect(darkSwitch, findsOneWidget);

// EXPECT: Dark switch has default grey850 background and type canvas.
final Finder darkSwitchMaterial = find
.descendant(of: darkSwitch, matching: find.byType(Material))
.first;
final Material darkMaterial = tester.widget<Material>(darkSwitchMaterial);
expect(darkMaterial.type, MaterialType.canvas);
expect(darkMaterial.color, Colors.grey[850]);

// EXPECT: That after the DARK theme mode TAP the app is in DARK mode.
// ignore: prefer_function_declarations_over_variables
final WidgetPredicate darkMaterialApp = (Widget widget) =>
Expand All @@ -179,6 +196,15 @@ void main() {
await tester.pumpAndSettle();
expect(systemSwitch, findsOneWidget);

// EXPECT: Dark switch has default grey850 background and type canvas.
final Finder systemSwitchMaterial = find
.descendant(of: systemSwitch, matching: find.byType(Material))
.first;
final Material systemMaterial =
tester.widget<Material>(systemSwitchMaterial);
expect(systemMaterial.type, MaterialType.canvas);
expect(systemMaterial.color, Colors.grey[500]);

// EXPECT: That we find a single option button.
final Finder optionButton = find.byKey(const ValueKey<String>('option'));
await tester.tap(optionButton, warnIfMissed: false);
Expand Down

0 comments on commit 449bc5c

Please sign in to comment.