Skip to content

Commit 818455a

Browse files
committed
feat: enable/disable ColorScheme hints, release: 2.2.0
1 parent 41bb6b6 commit 818455a

File tree

8 files changed

+60
-42
lines changed

8 files changed

+60
-42
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0
2+
3+
* Added ColorScheme hints when using the color picker. Can be optionally disabled by passing `isColorPickerColorSchemeHintEnabled: false`. Thanks https://github.com/JoseAlba!
4+
15
## 2.1.0
26

37
* Made `InspectorState` public to allow the developers to toggle the state of Inspector on/off. Thanks https://github.com/lublak!

example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXAggregateTarget section */
@@ -182,7 +182,7 @@
182182
isa = PBXProject;
183183
attributes = {
184184
LastSwiftUpdateCheck = 0920;
185-
LastUpgradeCheck = 1300;
185+
LastUpgradeCheck = 1510;
186186
ORGANIZATIONNAME = "";
187187
TargetAttributes = {
188188
33CC10EC2044A3C60003C045 = {
@@ -235,6 +235,7 @@
235235
/* Begin PBXShellScriptBuildPhase section */
236236
3399D490228B24CF009A79C7 /* ShellScript */ = {
237237
isa = PBXShellScriptBuildPhase;
238+
alwaysOutOfDate = 1;
238239
buildActionMask = 2147483647;
239240
files = (
240241
);
@@ -344,7 +345,7 @@
344345
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
345346
GCC_WARN_UNUSED_FUNCTION = YES;
346347
GCC_WARN_UNUSED_VARIABLE = YES;
347-
MACOSX_DEPLOYMENT_TARGET = 10.11;
348+
MACOSX_DEPLOYMENT_TARGET = 10.14;
348349
MTL_ENABLE_DEBUG_INFO = NO;
349350
SDKROOT = macosx;
350351
SWIFT_COMPILATION_MODE = wholemodule;
@@ -423,7 +424,7 @@
423424
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
424425
GCC_WARN_UNUSED_FUNCTION = YES;
425426
GCC_WARN_UNUSED_VARIABLE = YES;
426-
MACOSX_DEPLOYMENT_TARGET = 10.11;
427+
MACOSX_DEPLOYMENT_TARGET = 10.14;
427428
MTL_ENABLE_DEBUG_INFO = YES;
428429
ONLY_ACTIVE_ARCH = YES;
429430
SDKROOT = macosx;
@@ -470,7 +471,7 @@
470471
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
471472
GCC_WARN_UNUSED_FUNCTION = YES;
472473
GCC_WARN_UNUSED_VARIABLE = YES;
473-
MACOSX_DEPLOYMENT_TARGET = 10.11;
474+
MACOSX_DEPLOYMENT_TARGET = 10.14;
474475
MTL_ENABLE_DEBUG_INFO = NO;
475476
SDKROOT = macosx;
476477
SWIFT_COMPILATION_MODE = wholemodule;

example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/macos/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Cocoa
22
import FlutterMacOS
33

4-
@NSApplicationMain
4+
@main
55
class AppDelegate: FlutterAppDelegate {
66
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
77
return true

example/pubspec.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
40+
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.19.0"
43+
version: "1.18.0"
4444
cupertino_icons:
4545
dependency: "direct main"
4646
description:
@@ -78,18 +78,18 @@ packages:
7878
dependency: transitive
7979
description:
8080
name: leak_tracker
81-
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
81+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
8282
url: "https://pub.dev"
8383
source: hosted
84-
version: "10.0.7"
84+
version: "10.0.5"
8585
leak_tracker_flutter_testing:
8686
dependency: transitive
8787
description:
8888
name: leak_tracker_flutter_testing
89-
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
89+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
9090
url: "https://pub.dev"
9191
source: hosted
92-
version: "3.0.8"
92+
version: "3.0.5"
9393
leak_tracker_testing:
9494
dependency: transitive
9595
description:
@@ -134,7 +134,7 @@ packages:
134134
dependency: transitive
135135
description: flutter
136136
source: sdk
137-
version: "0.0.0"
137+
version: "0.0.99"
138138
source_span:
139139
dependency: transitive
140140
description:
@@ -147,10 +147,10 @@ packages:
147147
dependency: transitive
148148
description:
149149
name: stack_trace
150-
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
150+
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
151151
url: "https://pub.dev"
152152
source: hosted
153-
version: "1.12.0"
153+
version: "1.11.1"
154154
stream_channel:
155155
dependency: transitive
156156
description:
@@ -163,10 +163,10 @@ packages:
163163
dependency: transitive
164164
description:
165165
name: string_scanner
166-
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
166+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
167167
url: "https://pub.dev"
168168
source: hosted
169-
version: "1.3.0"
169+
version: "1.2.0"
170170
term_glyph:
171171
dependency: transitive
172172
description:
@@ -179,10 +179,10 @@ packages:
179179
dependency: transitive
180180
description:
181181
name: test_api
182-
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
182+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
183183
url: "https://pub.dev"
184184
source: hosted
185-
version: "0.7.3"
185+
version: "0.7.2"
186186
vector_math:
187187
dependency: transitive
188188
description:
@@ -195,10 +195,10 @@ packages:
195195
dependency: transitive
196196
description:
197197
name: vm_service
198-
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
198+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
199199
url: "https://pub.dev"
200200
source: hosted
201-
version: "14.3.0"
201+
version: "14.2.5"
202202
sdks:
203-
dart: ">=3.4.0 <4.0.0"
203+
dart: ">=3.3.0 <4.0.0"
204204
flutter: ">=3.18.0-18.0.pre.54"

lib/src/inspector.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Inspector extends StatefulWidget {
4848
this.isPanelVisible = true,
4949
this.isWidgetInspectorEnabled = true,
5050
this.isColorPickerEnabled = true,
51+
this.isColorPickerColorSchemeHintEnabled = true,
5152
this.isZoomEnabled = true,
5253
this.widgetInspectorShortcuts = const [
5354
LogicalKeyboardKey.alt,
@@ -74,6 +75,7 @@ class Inspector extends StatefulWidget {
7475
final bool isWidgetInspectorEnabled;
7576
final bool isColorPickerEnabled;
7677
final bool isZoomEnabled;
78+
final bool isColorPickerColorSchemeHintEnabled;
7779
final Alignment alignment;
7880
final List<LogicalKeyboardKey> widgetInspectorShortcuts;
7981
final List<LogicalKeyboardKey> colorPickerShortcuts;
@@ -463,6 +465,8 @@ class InspectorState extends State<Inspector> {
463465
top: offset.dy - 64.0,
464466
child: ColorPickerOverlay(
465467
color: color,
468+
isColorSchemeHintEnabled:
469+
widget.isColorPickerColorSchemeHintEnabled,
466470
),
467471
);
468472
},

lib/src/widgets/color_picker/color_picker_overlay.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,24 @@ class ColorPickerOverlay extends StatelessWidget {
77
const ColorPickerOverlay({
88
Key? key,
99
required this.color,
10+
required this.isColorSchemeHintEnabled,
1011
}) : super(key: key);
1112

1213
final Color color;
14+
final bool isColorSchemeHintEnabled;
1315

1416
@override
1517
Widget build(BuildContext context) {
1618
final colorScheme = Theme.of(context).colorScheme;
17-
final match =
18-
ColorSchemeInspector.identifyColorSchemeMatch(color, colorScheme);
19+
final String? match;
20+
21+
if (isColorSchemeHintEnabled) {
22+
match = ColorSchemeInspector.identifyColorSchemeMatch(color, colorScheme);
23+
} else {
24+
match = null;
25+
}
26+
27+
final colorString = colorToHexString(color);
1928
return Container(
2029
width: 102.0,
2130
height: 102.0,
@@ -34,7 +43,7 @@ class ColorPickerOverlay extends StatelessWidget {
3443
child: Material(
3544
type: MaterialType.transparency,
3645
child: Text(
37-
'${colorToHexString(color)} $match',
46+
match != null ? '$colorString $match' : colorString,
3847
style: TextStyle(
3948
color: getTextColorOnBackground(color),
4049
fontSize: 12.0,

pubspec.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
40+
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.19.0"
43+
version: "1.18.0"
4444
fake_async:
4545
dependency: transitive
4646
description:
@@ -71,18 +71,18 @@ packages:
7171
dependency: transitive
7272
description:
7373
name: leak_tracker
74-
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
74+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
7575
url: "https://pub.dev"
7676
source: hosted
77-
version: "10.0.7"
77+
version: "10.0.5"
7878
leak_tracker_flutter_testing:
7979
dependency: transitive
8080
description:
8181
name: leak_tracker_flutter_testing
82-
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
82+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
8383
url: "https://pub.dev"
8484
source: hosted
85-
version: "3.0.8"
85+
version: "3.0.5"
8686
leak_tracker_testing:
8787
dependency: transitive
8888
description:
@@ -135,7 +135,7 @@ packages:
135135
dependency: transitive
136136
description: flutter
137137
source: sdk
138-
version: "0.0.0"
138+
version: "0.0.99"
139139
source_span:
140140
dependency: transitive
141141
description:
@@ -148,10 +148,10 @@ packages:
148148
dependency: transitive
149149
description:
150150
name: stack_trace
151-
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
151+
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
152152
url: "https://pub.dev"
153153
source: hosted
154-
version: "1.12.0"
154+
version: "1.11.1"
155155
stream_channel:
156156
dependency: transitive
157157
description:
@@ -164,10 +164,10 @@ packages:
164164
dependency: transitive
165165
description:
166166
name: string_scanner
167-
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
167+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
168168
url: "https://pub.dev"
169169
source: hosted
170-
version: "1.3.0"
170+
version: "1.2.0"
171171
term_glyph:
172172
dependency: transitive
173173
description:
@@ -180,10 +180,10 @@ packages:
180180
dependency: transitive
181181
description:
182182
name: test_api
183-
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
183+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
184184
url: "https://pub.dev"
185185
source: hosted
186-
version: "0.7.3"
186+
version: "0.7.2"
187187
vector_math:
188188
dependency: transitive
189189
description:
@@ -196,10 +196,10 @@ packages:
196196
dependency: transitive
197197
description:
198198
name: vm_service
199-
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
199+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
200200
url: "https://pub.dev"
201201
source: hosted
202-
version: "14.3.0"
202+
version: "14.2.5"
203203
sdks:
204-
dart: ">=3.4.0 <4.0.0"
204+
dart: ">=3.3.0 <4.0.0"
205205
flutter: ">=3.18.0-18.0.pre.54"

0 commit comments

Comments
 (0)