Releases: rydmike/flex_color_picker
Version 2.0.0
[2.0.0] - April 9, 2021
-
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 theColorPickerCopyPasteBehavior(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 anOutlinedButton
. This change is done to conform to a less opinionated default style. You can still
manually configure it to use anOutlinedButton
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
namedtoColor
, no longer returns color valueColor(0x00000000)
for colors that cannot be parsed
to a Color. It now returnsColor(0xFF000000)
. This is because the Flutter SDK dislikes the fully transparent
blackColor(0x00000000)
, if it is full opaque black, it works better as a fallback safety color.
TheFlexPickerNullableStringExtensions
onString?
namedtoColorMaybeNull
works as before by returning
null when theString?
cannot be parsed to aColor
. -
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.
Version 2.0.0-nullsafety.5
[2.0.0-nullsafety.5] - April 8, 2021
- Fix: Setting
borderColor
did not change the border color on the wheel whenwheelHasBorder
was true. - New features: The
showPickerDialog
method now exposes most (= not directly controlled) properties
of the underlyingAlertDialog
used to make the dialog, this includes e.g. thebackgroundColor
,elevation
,
clipBehavior
andshape
as new exposed properties that may be useful. - New feature: Added a new alternative color picker dialog function
showColorPickerDialog
that returns a
Future<Color>
which when the dialog is closed, returns the selected color from the dialog or original start
color value, if no selection was made.
This picker might be simpler to use in some scenarios, but it does not allow
for the feature where colors and theme's can update in the background behind the dialog, as colors are selected
in it, before it is even closed. However, if you just need to open a dialog, select a color and move on, this
version offers a simpler API for that. Under the hood it is just a wrapper for the previous more
capable version with the onChange callbacks. It shares all other properties and features with theColorPicker
combined with itsshowPickerDialog
method, except all the onChanged callbacks that are excluded.
Since the propertieselevation
andtitle
in theshowPickerDialog
method, would collide with the same
named properties inColorPicker
. The dialog's elevation and title in theshowColorPickerDialog
are
instead calleddailogElevation
anddialogTitle
in it. - Improvement: Performance was improved via more optimized rebuilds.
- Documentation: First version of updated documentation with API guide documentation is now included. It still
requires proof-reading before stable release, but getting close to be ready for release now. - Default example: The default example got a new picker that shows how to the new
showColorPickerDialog
function. - Web example: The Web example, with the built-in API tooltips guides, got a major rewrite. It was originally
not intended to be as large as it grew to be, but since it grew so much it needed a rewrite.
It now uses Riverpod to make its simple state management needs easy to handle and much cleaner than before.
It also includes persisting the settings directly as settings are changed in the app. The persistence is
implemented with Hive and should work on all Flutter platforms as well, but it has only been tested on Android,
Web and Windows.
As an experiment, only RiverPod StateProviders were used. While the setup is a bit tedious, it enables the desired
fine-grained control over rebuilds of all the used setting control widgets. Each setting is also stored as an
individual key-value pair in the used Hive box.
A ProviderObserver that observes changes in the StateProviders we want to persist, is used to save any state change
to the used Hive box, regardless of where the state is changed in the demo app. This setup was an experiment to
see if it might work and provide some simplification benefits. At least in this case it did, and it is also a pretty
interesting and simple solution.
The default start values are also defined via the Riverpod StateProvider's default values, that also
use their const Hive string key as their provider name. Each StateProvider gets its start setting value from
the Hive box with the same key. If the key does not exist yet in Hive, it falls back to a default value from a
const Map using the same sring const as its key, for the default fallback value. Reset back to default values is also
done by setting all providers' state back to their default values as defined by the same const
fallback value map.
Version 2.0.0-nullsafety.4
[2.0.0-nullsafety.4] - March 22, 2021
- New Feature: A bool
enableOpacity
property was added that enables an opacity
slider that can be used to control the alpha channel in the selected ARGB color value. The slider
height can be controlled withopacityTrackHeight
, the width withopacityTrackWidth
and the
slider thumb size withopacityThumbRadius
. There is also aopacitySubheading
Widget that can
be used to provide a Widget heading for the opacity slider.
NOTE:
This is FlexColorPicker 2.0.0 dev and pre-release with sound null safety. It contains
many new features compared to previous stable 1.1.5 none null safe version.The package documentation has not yet been updated to cover the new features that are
being introduced in final 2.0.0 version together with null-safety. The changelog covers
the major changes. The API-documentation is up to date as well. The bundled and live
web demo app demonstrates all the new features, and you
can change most API settings. The demo also shows each API name and current value in a tooltip for
each control that modifies API values in the demo.No more new features will be added to 2.0.0 before the pending stable release. This release is
a stabilization and fine-tuning phase. The remaining minimum requirements for releasing stable version 2
is an update of this package documentation to cover all new features.
Later releases will provide additional refinements, further testing and CI/CD pipe.
Version 2.0.0-nullsafety.3
[2.0.0-nullsafety.3] - March 12, 2021
- Bugfix: Color code field no longer receives focus when switching to it on wheel page.
Focus is set to color wheel, or the selected color shade, if the
shade colors are present. The focus handling has also been improved for desktop usage. - Bugfix: 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 keepeditUsesParsedPaste
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. - 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
be edited on the wheel picker, set this to true to make it read only there as well. Copy/paste operations still work
if they are enabled even if the color code field entry is in read only mode. - New feature: The
copyPasteBehavior
property received three new features and properties:- The copy/paste context menu can now also optionally use secondary, typically mouse right, click by setting
secondaryMenu
to true. - It also has a mode where long press will be used on iOS/Android, but secondary mouse click will be
used on desktop/web, by settingsecondaryOnDesktopLongOnDevice
to true. - When
parseShortHexCode
is true the hex color code paste action and field entry parser,
interpret short three character web hex color codes like in CSS.
- The copy/paste context menu can now also optionally use secondary, typically mouse right, click by setting
- New extension: The extension
FlexPickerNoNullStringExtensions
onString
got a new
extension functionColor toColorShort(bool enableShortRGB)
. - New extension: The extension
FlexPickerNullableStringExtensions
onString?
got a new
extension functionColor? toColorShortMaybeNull(bool enableShortRGB)
. - Minor breaking: The extension
FlexPickerNoNullStringExtensions
on none nullable
String
namedtoColor
no longer returns color valueColor(0x00000000)
for colors that cannot be parsed
to a Color. It now returnsColor(0xFF000000)
. This is because the Flutter SDK dislikes the fully transparent
blackColor(0x00000000)
, if it is full opaque black, it works better as a fallback safety color.
TheFlexPickerNullableStringExtensions
onString?
namedtoColorMaybeNull
works as before by returning
null when theString?
cannot be parsed to aColor
. - Tests: Added unit tests for
ColorPickerActionButtonType
andColorPickerCopyPasteBehavior
.
See API documentation for more information.
Version 2.0.0-nullsafety.2
[2.0.0-nullsafety.2] - March 3, 2021
Documentation and live Web demo link fixes.
Version 2.0.0-nullsafety.1
[2.0.0-nullsafety.1] - March 3, 2021
There are many new features included in this version 2 pre-release. The new features can be explored with
live Web example. Its source code is also included in the package
example folder, in "example/lib/demo/main.dart".
-
Improvements: The wheel picker now move on pointer down to point location, it no longer requires a slight movement
for its thumbs to move to the selected start tracking point. -
Improvements: Keyboard traversal of the colors and selecting indicator colors with the keyboard via
enter or space. The wheel can however still not be operated with a keyboard, only touch and mouse controlled. -
New property
onColorChangeStart
: Called when user starts color selection with current color before the change. -
New property
onColorChangeEnd
: Called when user ends color selection with the new color value. -
New property
selectedPickerTypeColor
: The color of the thumb on the slider that shows the selected picker.
Ported from none null-safe version 1.1.4, does not exist in version 2.0.0-nullsafety.0. -
New property
colorCodePrefixStyle
: Defines the text style of the prefix for the color code.
If not defined it defaults to same style ascolorCodeTextStyle
.
Ported from none null-safe version 1.1.4, does not exist in version 2.0.0-nullsafety.0. -
New property
title
: A Widget used as an app bar type of title widget above the heading. Can
include copy, paste, select-close and cancel-cancel icon buttons when picker is used as a dialog. -
Major new feature: An
actionButtons
property that takes anColorPickerActionButtons()
. Used to define
what type of Ok and Cancel action buttons the color picker has when used in a dialog.
It is possible to define if
bottom action buttons should beTextButton
,OutlinedButton
orElevatedButton
per button.
If not defined, the labels on the buttons come from Material localizations, not from default hard coded values.
See breaking label for the 'Select' label. There are optional select/OK and cancel icon buttons that can be used
in the title bar for a more compact dialog. See API documentation for more information. -
Major feature: A
copyPasteBehavior
property that takes anColorPickerCopyPasteBehavior()
.
Used to define the copy/paste behavior of the color picker, including:- Keyboard shortcuts: CTRL-C, CMD-C, CTRL-V, CMD-V
- Top toolbar copy-paste buttons.
- Long press copy-paste menu.
All copy/paste behaviors are optional and can be enabled based on what is needed.
For the copy format, the desired resulting RGB color string format can be configured to use #RRGGBB
RRGGBB #AARRGGBB AARRGGBB and 0xAARRGGBB (default) options. The selected copy format is indicated with the
corresponding prefix in the color code display/edit field when it is enabled.Paste supports parsing multiple RGB color string formats. It automatically detects what format is used and auto
parses to correct Flutter/Dart color value. You can e.g. paste string formatted as #RRGGBB RRGGBB #AARRGGBB
AARRGGBB #RGB RGB or 0xAARRGGBB, partial color string values also work. You can also activate
a snack bar that informs the users if they paste color strings in an unsupported RGB string format into the
color picker.See API documentation for more information.
-
Major new feature: The picker can display recently used colors in a list of color indicators at the bottom of
the picker. You can use the following properties to control it.-
showRecentColors
: Set to true/false to enable/disable the usage of the recent colors feature. -
recentColorsSubheading
: Subheading widget for the recently used colors. Typically, a Text widget,
e.g. Text('Recent colors'). If not provided there is no sub heading for the recently used colors. -
maxRecentColors
: Number of recent colors to track, from 2 to 20 allowed. -
recentColors
: a list with current recent color, defaults to empty. You can store the last list
and use it to restore the previous recent colors list. -
onRecentColorsChanged
: Optional value callback that returns a copy the current list of recently
used colors. Use it store a copy of the recent colors in order to be able to restore it later.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
colorCodeIcon
has been deprecated and no longer has any function. To modify the copy icon on the color
code entry field, define theColorPickerCopyPasteBehavior(copyIcon: myIcon)
and provide it to the
copyPasteBehavior
property, it defaults to same icon as in version 1.x. - The bottom 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
not anOutlinedButton
, this change is done to conform to a less opinionated default style. You can still
manually configure it to use anOutlinedButton
instead as before. Now you can choose, before there was
no choice. - The dialog bottom OK button is no longer auto-focused.
Version 1.1.5
[1.1.5] - March 3, 2021
- Bug fix
selectedPickerTypeColor
: When color was undefined, the thumb did not receive the same text color as the
default and only one before in version 1.1.3 and earlier, in dark-mode. This broke compatibility with past style
when using dark-mode. This fix restores the correct past style when theselectedPickerTypeColor
is undefined.
Version 1.1.4
[1.1.4] - March 3, 2021
- New property
selectedPickerTypeColor
: Defines the color of the thumb on the slider that shows the selected picker. - New property
colorCodePrefixStyle
: Defines the text style of the prefix for the color code.
If not defined it defaults to same style ascolorCodeTextStyle
.
Version 2.0.0-nullsafety.0
[2.0.0-nullsafety.0] - February 15, 2021
- First version with null safety.
- A workaround to flutter/flutter#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. - The almost full API configurable Web example and demo, was included in the package in "example/lib/demo/mina.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 responsive, to offer better usability on Web.
Version 1.1.3
[1.1.3] - December 22, 2020
- Fixed the faulty documentation and comment for showPickerDialog parameter insetPadding.
- Fixed the faulty default value for showPickerDialog parameter insetPadding, the new default
value is the same as Flutter and Material default
EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0)
, as it should have been. - Minor documentation style correction.