TF-4370 Handle create new a label with description

This commit is contained in:
dab246
2026-03-11 15:13:40 +07:00
committed by Dat H. Pham
parent 90ddbf5824
commit 7df25c5f5a
3 changed files with 7 additions and 0 deletions
@@ -11,6 +11,8 @@ extension LabelExtension on Label {
String get safeDisplayName => displayName ?? '';
String get safeDescription => description ?? '';
Color? get backgroundColor {
if (id?.value == moreLabelId) {
return AppColor.grayBackgroundColor;
@@ -32,12 +34,14 @@ extension LabelExtension on Label {
KeyWordIdentifier? keyword,
String? displayName,
HexColor? color,
String? description,
}) {
return Label(
id: id ?? this.id,
displayName: displayName ?? this.displayName,
keyword: keyword ?? this.keyword,
color: color ?? this.color,
description: description ?? this.description,
);
}
@@ -63,6 +63,7 @@ class LabelApi
final newLabelCreated = labelCreated!.copyWith(
displayName: labelData.displayName,
color: labelData.color,
description: labelData.description,
);
return newLabelCreated;
} else {
@@ -78,6 +78,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
if (selectedLabel != null) {
_nameInputController.text = selectedLabel.safeDisplayName;
_nameInputFocusNode.requestFocus();
_descriptionInputController.text = selectedLabel.safeDescription;
_createLabelStateNotifier.value = true;
_labelSelectedColorNotifier.value = _selectedColor;
}
@@ -370,6 +371,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
color: _selectedColor != null
? HexColor(_selectedColor!.toHexTriplet())
: null,
description: _descriptionInputController.text,
);
widget.onLabelActionCallback(newLabel);