Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onLabelTypeChanged callback added #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class _MyAppState extends State<MyApp> {
onColorChanged: changeColor,
colorHistory: colorHistory,
onHistoryChanged: (List<Color> colors) => colorHistory = colors,
onLabelTypeChanged: (c){
print('COLOR ${c.name}');
},
),
MaterialColorPickerExample(pickerColor: currentColor, onColorChanged: changeColor),
BlockColorPickerExample(
Expand Down
3 changes: 3 additions & 0 deletions example/lib/pickers/hsv_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ class HSVColorPickerExample extends StatefulWidget {
required this.onColorChanged,
this.colorHistory,
this.onHistoryChanged,
this.onLabelTypeChanged
}) : super(key: key);

final Color pickerColor;
final ValueChanged<Color> onColorChanged;
final List<Color>? colorHistory;
final ValueChanged<List<Color>>? onHistoryChanged;
final ValueChanged<ColorLabelType>? onLabelTypeChanged;

@override
State<HSVColorPickerExample> createState() => _HSVColorPickerExampleState();
Expand Down Expand Up @@ -94,6 +96,7 @@ class _HSVColorPickerExampleState extends State<HSVColorPickerExample> {
hexInputBar: _displayHexInputBar,
colorHistory: widget.colorHistory,
onHistoryChanged: widget.onHistoryChanged,
onLabelTypeChanged: widget.onLabelTypeChanged,
),
),
);
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -47,14 +47,14 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -68,5 +68,5 @@ packages:
source: hosted
version: "2.1.2"
sdks:
dart: ">=2.14.0 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.0.0"
4 changes: 4 additions & 0 deletions lib/src/colorpicker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ColorPicker extends StatefulWidget {
this.hexInputController,
this.colorHistory,
this.onHistoryChanged,
this.onLabelTypeChanged
}) : super(key: key);

final Color pickerColor;
Expand All @@ -47,6 +48,7 @@ class ColorPicker extends StatefulWidget {
final double pickerAreaHeightPercent;
final BorderRadius pickerAreaBorderRadius;
final bool hexInputBar;
final ValueChanged<ColorLabelType>? onLabelTypeChanged;

/// Allows setting the color using text input, via [TextEditingController].
///
Expand Down Expand Up @@ -340,6 +342,7 @@ class _ColorPickerState extends State<ColorPicker> {
enableAlpha: widget.enableAlpha,
textStyle: widget.labelTextStyle,
colorLabelTypes: widget.labelTypes,
onLabelTypeChanged: widget.onLabelTypeChanged,
),
),
if (widget.hexInputBar)
Expand Down Expand Up @@ -420,6 +423,7 @@ class _ColorPickerState extends State<ColorPicker> {
enableAlpha: widget.enableAlpha,
textStyle: widget.labelTextStyle,
colorLabelTypes: widget.labelTypes,
onLabelTypeChanged: widget.onLabelTypeChanged
),
),
if (widget.hexInputBar)
Expand Down
Loading