From 9eacc2aedf2bc47cccbb05879c1cf5c098cbd97f Mon Sep 17 00:00:00 2001 From: geronimol <56521222+geronimol@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:53:18 -0300 Subject: [PATCH] fix: Color picker hex field (#2415) * fix: color picker dialog hex field value not setting correctly when selecting a text that has color in the editor and pressing the color button in the toolbar. For more details: https://github.com/singerdmx/flutter-quill/pull/2415#issuecomment-2553781409 * docs: add a CHANGELOG entry for the bug fix --------- Co-authored-by: Ellet --- CHANGELOG.md | 4 ++++ lib/src/toolbar/buttons/color/color_dialog.dart | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f1c44468..3aaa48bb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- The color picker dialog's hex field does not use the correct value of the selected text in the editor [#2415](https://github.com/singerdmx/flutter-quill/pull/2415). + ## [11.0.0-dev.16] - 2024-12-13 ### Changed diff --git a/lib/src/toolbar/buttons/color/color_dialog.dart b/lib/src/toolbar/buttons/color/color_dialog.dart index acfabc9f2..c67a0e9f0 100644 --- a/lib/src/toolbar/buttons/color/color_dialog.dart +++ b/lib/src/toolbar/buttons/color/color_dialog.dart @@ -39,13 +39,13 @@ class ColorPickerDialogState extends State { @override void initState() { super.initState(); - hexController = - TextEditingController(text: color_picker.colorToHex(selectedColor)); if (widget.isToggledColor) { selectedColor = widget.isBackground ? hexToColor(widget.selectionStyle.attributes['background']?.value) : hexToColor(widget.selectionStyle.attributes['color']?.value); } + hexController = + TextEditingController(text: color_picker.colorToHex(selectedColor)); } @override