Skip to content

Commit 7297342

Browse files
committed
Release 2.0.0
1 parent 31bacea commit 7297342

File tree

5 files changed

+65
-38
lines changed

5 files changed

+65
-38
lines changed

CHANGELOG.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,37 @@
33
All notable changes to the **FlexColorPicker** package will be documented in this file.
44

55
## [2.0.0] - April 9, 2021
6-
* **Documentation:** Only documentation updates from pre-release **2.0.0-nullsafety.5**
6+
* This release only contains documentation updates from pre-release **2.0.0-nullsafety.5**
7+
* Thi is the first stable release of the null-safe version
8+
* This is a **MAJOR** new feature release, in addition to the null-safety conversion.
9+
Please see changelogs from 2.0.0-nullsafety.0 to nullsafety.5, for a complete list of changes and new features.
10+
* To get familiar with version 2.0.0 and all its new features, it is recommended to go through the updated tutorial,
11+
and the API guide in the readme file.
12+
* For convenience, the list of breaking changes from last stable version 1.1.5 are listed below.
13+
14+
### Breaking Changes
15+
In addition to breaking changes as a result of the null-safety implementation, this release contain a few other
16+
**minor breaking changes** from version 1.x, they mostly concern visual nuances and label defaults.
17+
18+
19+
* The `colorCodeIcon` has been deprecated and no longer has any function. To modify the copy icon on the color
20+
code entry field, define the `ColorPickerCopyPasteBehavior(copyIcon: myIcon)` and provide it to the
21+
`copyPasteBehavior` property, it defaults to same icon as in versions 1.x.
22+
* The bottom dialog action button that selects the color now says **OK** instead of **Select**. The label for the OK
23+
button by default comes from a Material localization. You can as before change it to whatever string you want.
24+
* The dialog bottom action button for **OK** by default now uses a plain `TextButton` and
25+
not an `OutlinedButton`. This change is done to conform to a less opinionated default style. You can still
26+
manually configure it to use an `OutlinedButton` instead as before. Now you can choose, before there was
27+
no choice.
28+
* The dialog bottom **OK** button is no longer auto-focused.
29+
* The extension `FlexPickerNoNullStringExtensions` on none nullable
30+
`String` named `toColor`, no longer returns color value `Color(0x00000000)` for colors that cannot be parsed
31+
to a Color. It now returns `Color(0xFF000000)`. This is because the Flutter SDK dislikes the fully transparent
32+
black `Color(0x00000000)`, if it is full opaque black, it works better as a fallback safety color.
33+
The `FlexPickerNullableStringExtensions` on `String?` named `toColorMaybeNull` works as before by returning
34+
null when the `String?` cannot be parsed to a `Color`.
35+
* The color code edit and entry field now works more like a normal text entry field. It still
36+
only accepts valid hex input and converts all input to uppercase.
737

838
## [2.0.0-nullsafety.5] - April 8, 2021
939
* **Fix:** Setting `borderColor` did not change the border color on the wheel when `wheelHasBorder` was true.
@@ -60,8 +90,8 @@ All notable changes to the **FlexColorPicker** package will be documented in thi
6090
* **Fix:** The property `editUsesParsedPaste` now works as intended, if true, desktop keyboard paste commands,
6191
while editing a color value are intercepted, and the hole pasted buffer value gets parsed, it does not get
6292
pasted into the field. For normal field paste functionality keep `editUsesParsedPaste` false (default).
63-
* The color code edit and entry field now works more like a normal text entry field. It still only accepts
64-
valid hex input and converts all input to uppercase.
93+
* **Minor breaking:** The color code edit and entry field now works more like a normal text entry field. It still
94+
only accepts valid hex input and converts all input to uppercase.
6595
* **New property:** If `colorCodeHasColor` is true, then the background of the color code entry field uses the current
6696
selected color.
6797
* **New property** If `colorCodeReadOnly` the color code entry field is always read only. Normally color code can
@@ -79,7 +109,7 @@ All notable changes to the **FlexColorPicker** package will be documented in thi
79109
* **New extension:** The extension `FlexPickerNullableStringExtensions` on `String?` got a new
80110
extension function `Color? toColorShortMaybeNull(bool enableShortRGB)`.
81111
* **Minor breaking:** The extension `FlexPickerNoNullStringExtensions` on none nullable
82-
`String` named `toColor` no longer returns color value `Color(0x00000000)` for colors that cannot be parsed
112+
`String` named `toColor`, no longer returns color value `Color(0x00000000)` for colors that cannot be parsed
83113
to a Color. It now returns `Color(0xFF000000)`. This is because the Flutter SDK dislikes the fully transparent
84114
black `Color(0x00000000)`, if it is full opaque black, it works better as a fallback safety color.
85115
The `FlexPickerNullableStringExtensions` on `String?` named `toColorMaybeNull` works as before by returning
@@ -149,10 +179,10 @@ example folder, in "example/lib/demo/main.dart".
149179
*See API documentation for more information.*
150180

151181
### Breaking changes
152-
The following are **minor breaking changes** from version 1.x, they mostly concern visual nuances and label defaults.
182+
The following are **minor breaking changes** from version 1.1.5, they mostly concern visual nuances and label defaults.
153183
* The `colorCodeIcon` has been deprecated and no longer has any function. To modify the copy icon on the color
154184
code entry field, define the `ColorPickerCopyPasteBehavior(copyIcon: myIcon)` and provide it to the
155-
`copyPasteBehavior` property, it defaults to same icon as in version 1.x.
185+
`copyPasteBehavior` property, it defaults to same icon as in version 1.1.5.
156186
* The bottom dialog action button that selects the color now says **OK** instead of **Select**. The label for the OK
157187
button by default comes from a Material localization. You can as before change it to whatever string you want.
158188
* The dialog bottom action button for **OK** by default now uses just a plain `TextButton` and
@@ -163,9 +193,9 @@ The following are **minor breaking changes** from version 1.x, they mostly conce
163193

164194
## [2.0.0-nullsafety.0] - February 15, 2021
165195
* First version with null safety.
166-
* A workaround to https://github.com/flutter/flutter/issues/71687 was introduced. The issue has not been resolved.
167-
However, the workaround allows for the Wrap implementation that was changed to a Row in version 1.1.2, to be used
168-
again.
196+
* A workaround to issue [#71687](https://github.com/flutter/flutter/issues/71687) was introduced.
197+
The issue has not been solved. However, the workaround allows for the Wrap implementation that was
198+
changed to a Row in version 1.1.2, to be used again.
169199
* The almost full API configurable Web example and demo, was included in the package in
170200
"example/lib/demo/main.dart" together with the previous default example in "example/lib/main.dart".
171201
Previously this Web example was in a separate GitHub repository. The example was updated to make it
@@ -250,7 +280,7 @@ Feel free to open a [suggestion or issue](https://github.com/rydmike/flex_color_
250280
- Add selected colors to the custom colors section.
251281

252282
### COMPLETED
253-
- Release none pre-release version 2.
283+
- Release stable version 2.0.0
254284
- Add GitHub actions for test, analyze, coverage, build and web demo deployment.
255285
- Add a simpler optional async dialog picker function, that returns selected color.
256286
- Add support for colors with opacity or alpha.

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ and buttons for handling COPY-PASTE of colors from and to the picker, including
2424
- [Screen ColorPicker](#screen-colorpicker)
2525
- [Dialog ColorPicker Method](#dialog-colorpicker-method)
2626
- [Dialog ColorPicker Function](#dialog-colorpicker-function)
27-
- [FlexColorPicker API Guide](#flexcolorpicker-api-guide)
27+
- [API Guide](#api-guide)
2828
- [Elements of the Picker](#elements-of-the-picker)
2929
- [Enabled Color Pickers](#enabled-color-pickers)
3030
- [Enable Shades Selection](#enable-shades-selection)
@@ -609,7 +609,7 @@ exposed to the degree they can be, should you ever need them.
609609
**Finally**, the default example also includes a light and dark theme mode toggle. It is there so that you
610610
can test the look and operation of the color picker with a dark theme.
611611

612-
# FlexColorPicker API Guide
612+
# API Guide
613613

614614
In addition to what is covered in the above [tutorial](#tutorial), the **FlexColorPicker** has a large amount of
615615
additional features. Its behavior can easily be modified with its direct
@@ -649,8 +649,6 @@ ColorPicker(
649649
),
650650
```
651651

652-
653-
654652
### Enabled Color Pickers
655653

656654
API reference: [pickersEnabled](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/ColorPicker/pickersEnabled.html)
@@ -1352,7 +1350,7 @@ cumbersome to use, although the above mentioned example show how it is done.
13521350

13531351
### Function showColorPickerDialog
13541352

1355-
API reference: [showColorPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/ColorPicker/showColorPickerDialog.html)
1353+
API reference: [showColorPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/showColorPickerDialog.html)
13561354

13571355
The `showColorPickerDialog` function is often simpler to use. Just pass in a build context for the dialog, and the
13581356
required start color value, then call the function, with needed color picker and dialog setup properties, and
@@ -1372,7 +1370,7 @@ its `showPickerDialog` method.
13721370

13731371
The `showColorPickerDialog` dialog demo in the default example app shown earlier [here](#dialog-colorpicker-function)
13741372
explains how to use the built-in
1375-
[ColorPicker(...).showPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/ColorPicker/showPickerDialog.html)
1373+
[ColorPicker(...).showColorPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/showColorPickerDialog.html)
13761374
function.
13771375

13781376
Since the properties `elevation` and `title`, in the `showPickerDialog` method would collide with the same

example/lib/demo/utils/app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class App {
1111
// Web demo with inside the app. Shown on the start screen in the demo,
1212
// so people testing it don't have to ask. Also info for the About screen.
1313
static const String appName = 'FlexColorPicker';
14-
static const String version = '2.0.0 PRE2';
14+
static const String version = '2.0.0';
1515
static const String packageVersion = 'FlexColorScheme package $version';
1616
static const String packageUrl = 'https://pub.dev/packages/flex_color_picker';
1717
static const String flutterVersion = 'Channel beta 2.1.0-12.2.pre, CanvasKit';

example/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ environment:
77

88
dependencies:
99
# https://pub.dev/packages/flex_color_picker
10-
flex_color_picker:
11-
path: ../
10+
flex_color_picker: ^2.0.0
1211

1312
flutter:
1413
sdk: flutter

lib/src/color_picker.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,22 +1842,22 @@ class _ColorPickerState extends State<ColorPicker> {
18421842
if (_editCodeFocused && !widget.copyPasteBehavior.editUsesParsedPaste) {
18431843
return;
18441844
}
1845-
1846-
// Make an OS independent copy/paste modifier key.
1845+
// Make an OS independent copy/paste shortcut modifier key.
18471846
//
18481847
// Found the usage of these in the SDK TextField copy/paste implementation.
18491848
final bool isRawKeyMacOS = event.data is RawKeyEventDataMacOs;
1850-
debugPrint('KeyEvent isMacOs: $isRawKeyMacOS');
1849+
// debugPrint('KeyEvent isRawKeyMacOS: $isRawKeyMacOS');
18511850
final bool isRawKeyIos = event.data is RawKeyEventDataIos;
1852-
debugPrint('KeyEvent isRawKeyIos: $isRawKeyIos');
1853-
// BUT!!
1851+
// debugPrint('KeyEvent isRawKeyIos: $isRawKeyIos');
1852+
// **BUT**
18541853
// The above RawKeyEventData did not seem to work on Web when using an
1855-
// iPad+Safari and an Apple iPad keyboard, isRawKeyIos did not become true!
1856-
// So CMD was not used, only CTRL worked. Maybe we can use context based
1857-
// Theme.platform instead here and skip RawKeyEventData, or just combine
1858-
// it with RawKeyEventData, since we have a context it might work.
1854+
// iPad+Safari and an Apple 10.5 Pro iPad keyboard, isRawKeyIos did not
1855+
// become true!
1856+
// So CMD modifier did not get used, only CTRL worked. We can use context
1857+
// based Theme.platform instead here and skip RawKeyEventData, or just
1858+
// combine it with RawKeyEventData. Since we have a context it works too.
18591859
final TargetPlatform platform = Theme.of(context).platform;
1860-
debugPrint('KeyEvent platform: $platform');
1860+
// debugPrint('KeyEvent platform: $platform');
18611861

18621862
// Should COMMAND modifier be used instead of CTRL for keyboard COPY-PASTE?
18631863
// Use all sources we have to determine if it is iOS or macOS that should
@@ -1866,28 +1866,28 @@ class _ColorPickerState extends State<ColorPicker> {
18661866
isRawKeyIos ||
18671867
platform == TargetPlatform.iOS ||
18681868
platform == TargetPlatform.macOS;
1869-
debugPrint('KeyEvent useCommandModifier: $useCommandModifier');
1869+
// debugPrint('KeyEvent useCommandModifier: $useCommandModifier');
18701870

18711871
// isModifierPressed will be true when COMMAND key is pressed on macOS/iOS
1872-
// or when CTRL key is pressed on other platforms.
1872+
// OR when CTRL key is pressed on other platforms.
18731873
final bool isModifierPressed =
18741874
useCommandModifier ? event.isMetaPressed : event.isControlPressed;
1875-
debugPrint('KeyEvent isModifierPressed: $isModifierPressed');
1875+
// debugPrint('KeyEvent isModifierPressed: $isModifierPressed');
18761876

1877-
// The raw keyboard listener reacts to both up and down events, we only
1878-
// use down of them, so we only execute the copy and paste command once
1879-
// when the keys are pressed down, we do not want to do it 2nd time when
1877+
// The raw keyboard listener reacts to both up and down events, we only use
1878+
// down, so that we only execute the copy and paste keyboard command once
1879+
// when the keys are pressed down. We do not want to do it 2nd time when
18801880
// the key goes up.
18811881
if (event.runtimeType == RawKeyDownEvent) {
1882-
// If logical key is paste OR CTRL+V and we use ctrlV paste behavior, then
1883-
// we get the clipboard data.
1882+
// If logical key is paste OR modifier+V and we use ctrlV paste behavior,
1883+
// we get the latest clipboard data.
18841884
if ((event.logicalKey == LogicalKeyboardKey.paste ||
18851885
(isModifierPressed &&
18861886
event.logicalKey == LogicalKeyboardKey.keyV)) &&
18871887
widget.copyPasteBehavior.ctrlV) {
18881888
_getClipboard();
18891889
}
1890-
// If logical key is copy or CTRL+C and we used ctrlC copy behavior, then
1890+
// If logical key is copy or modifier+C and we used ctrlC copy behavior,
18911891
// we set the current color to the clipboard data.
18921892
if ((event.logicalKey == LogicalKeyboardKey.copy ||
18931893
(isModifierPressed &&

0 commit comments

Comments
 (0)