Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rydmike committed Apr 9, 2021
1 parent 31bacea commit 7297342
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 38 deletions.
50 changes: 40 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,37 @@
All notable changes to the **FlexColorPicker** package will be documented in this file.

## [2.0.0] - April 9, 2021
* **Documentation:** Only documentation updates from pre-release **2.0.0-nullsafety.5**
* This release only contains documentation updates from pre-release **2.0.0-nullsafety.5**
* Thi is the first stable release of the null-safe version
* This is a **MAJOR** new feature release, in addition to the null-safety conversion.
Please see changelogs from 2.0.0-nullsafety.0 to nullsafety.5, for a complete list of changes and new features.
* To get familiar with version 2.0.0 and all its new features, it is recommended to go through the updated tutorial,
and the API guide in the readme file.
* For convenience, the list of breaking changes from last stable version 1.1.5 are listed below.

### Breaking Changes
In addition to breaking changes as a result of the null-safety implementation, this release contain a few other
**minor breaking changes** from version 1.x, they mostly concern visual nuances and label defaults.


* The `colorCodeIcon` has been deprecated and no longer has any function. To modify the copy icon on the color
code entry field, define the `ColorPickerCopyPasteBehavior(copyIcon: myIcon)` and provide it to the
`copyPasteBehavior` property, it defaults to same icon as in versions 1.x.
* The bottom dialog action button that selects the color now says **OK** instead of **Select**. The label for the OK
button by default comes from a Material localization. You can as before change it to whatever string you want.
* The dialog bottom action button for **OK** by default now uses a plain `TextButton` and
not an `OutlinedButton`. This change is done to conform to a less opinionated default style. You can still
manually configure it to use an `OutlinedButton` instead as before. Now you can choose, before there was
no choice.
* The dialog bottom **OK** button is no longer auto-focused.
* The extension `FlexPickerNoNullStringExtensions` on none nullable
`String` named `toColor`, no longer returns color value `Color(0x00000000)` for colors that cannot be parsed
to a Color. It now returns `Color(0xFF000000)`. This is because the Flutter SDK dislikes the fully transparent
black `Color(0x00000000)`, if it is full opaque black, it works better as a fallback safety color.
The `FlexPickerNullableStringExtensions` on `String?` named `toColorMaybeNull` works as before by returning
null when the `String?` cannot be parsed to a `Color`.
* The color code edit and entry field now works more like a normal text entry field. It still
only accepts valid hex input and converts all input to uppercase.

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

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

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

### COMPLETED
- Release none pre-release version 2.
- Release stable version 2.0.0
- Add GitHub actions for test, analyze, coverage, build and web demo deployment.
- Add a simpler optional async dialog picker function, that returns selected color.
- Add support for colors with opacity or alpha.
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ and buttons for handling COPY-PASTE of colors from and to the picker, including
- [Screen ColorPicker](#screen-colorpicker)
- [Dialog ColorPicker Method](#dialog-colorpicker-method)
- [Dialog ColorPicker Function](#dialog-colorpicker-function)
- [FlexColorPicker API Guide](#flexcolorpicker-api-guide)
- [API Guide](#api-guide)
- [Elements of the Picker](#elements-of-the-picker)
- [Enabled Color Pickers](#enabled-color-pickers)
- [Enable Shades Selection](#enable-shades-selection)
Expand Down Expand Up @@ -609,7 +609,7 @@ exposed to the degree they can be, should you ever need them.
**Finally**, the default example also includes a light and dark theme mode toggle. It is there so that you
can test the look and operation of the color picker with a dark theme.

# FlexColorPicker API Guide
# API Guide

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



### Enabled Color Pickers

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

### Function showColorPickerDialog

API reference: [showColorPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/ColorPicker/showColorPickerDialog.html)
API reference: [showColorPickerDialog](https://pub.dev/documentation/flex_color_picker/latest/flex_color_picker/showColorPickerDialog.html)

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

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

Since the properties `elevation` and `title`, in the `showPickerDialog` method would collide with the same
Expand Down
2 changes: 1 addition & 1 deletion example/lib/demo/utils/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class App {
// Web demo with inside the app. Shown on the start screen in the demo,
// so people testing it don't have to ask. Also info for the About screen.
static const String appName = 'FlexColorPicker';
static const String version = '2.0.0 PRE2';
static const String version = '2.0.0';
static const String packageVersion = 'FlexColorScheme package $version';
static const String packageUrl = 'https://pub.dev/packages/flex_color_picker';
static const String flutterVersion = 'Channel beta 2.1.0-12.2.pre, CanvasKit';
Expand Down
3 changes: 1 addition & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ environment:

dependencies:
# https://pub.dev/packages/flex_color_picker
flex_color_picker:
path: ../
flex_color_picker: ^2.0.0

flutter:
sdk: flutter
Expand Down
38 changes: 19 additions & 19 deletions lib/src/color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1842,22 +1842,22 @@ class _ColorPickerState extends State<ColorPicker> {
if (_editCodeFocused && !widget.copyPasteBehavior.editUsesParsedPaste) {
return;
}

// Make an OS independent copy/paste modifier key.
// Make an OS independent copy/paste shortcut modifier key.
//
// Found the usage of these in the SDK TextField copy/paste implementation.
final bool isRawKeyMacOS = event.data is RawKeyEventDataMacOs;
debugPrint('KeyEvent isMacOs: $isRawKeyMacOS');
// debugPrint('KeyEvent isRawKeyMacOS: $isRawKeyMacOS');
final bool isRawKeyIos = event.data is RawKeyEventDataIos;
debugPrint('KeyEvent isRawKeyIos: $isRawKeyIos');
// BUT!!
// debugPrint('KeyEvent isRawKeyIos: $isRawKeyIos');
// **BUT**
// The above RawKeyEventData did not seem to work on Web when using an
// iPad+Safari and an Apple iPad keyboard, isRawKeyIos did not become true!
// So CMD was not used, only CTRL worked. Maybe we can use context based
// Theme.platform instead here and skip RawKeyEventData, or just combine
// it with RawKeyEventData, since we have a context it might work.
// iPad+Safari and an Apple 10.5 Pro iPad keyboard, isRawKeyIos did not
// become true!
// So CMD modifier did not get used, only CTRL worked. We can use context
// based Theme.platform instead here and skip RawKeyEventData, or just
// combine it with RawKeyEventData. Since we have a context it works too.
final TargetPlatform platform = Theme.of(context).platform;
debugPrint('KeyEvent platform: $platform');
// debugPrint('KeyEvent platform: $platform');

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

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

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

0 comments on commit 7297342

Please sign in to comment.