TF-4233 Correctly set current label color on edit dialog open

This commit is contained in:
dab246
2026-01-07 15:21:12 +07:00
committed by Dat H. Pham
parent ac33424c30
commit 7b250f911b
3 changed files with 19 additions and 1 deletions
@@ -47,6 +47,9 @@ class _ColorsMapWidgetState extends State<ColorsMapWidget> {
Color(0xFF646580),
];
static final Set<int> _defaultColorValues =
_defaultColors.map((c) => c.toInt()).toSet();
final ValueNotifier<Color?> _selectedColor = ValueNotifier(null);
List<Color> _colorList = <Color>[];
@@ -128,7 +131,14 @@ class _ColorsMapWidgetState extends State<ColorsMapWidget> {
void _setUpColorList() {
final custom = widget.customColor;
_colorList = custom != null ? [custom, ..._defaultColors] : _defaultColors;
final hasCustom = custom != null;
final isCustomInDefaults =
hasCustom && _defaultColorValues.contains(custom.toInt());
_colorList = (hasCustom && !isCustomInDefaults)
? [custom, ..._defaultColors]
: _defaultColors;
_selectedColor.value = custom;
}