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 safeDisplayName => displayName ?? '';
String get safeDescription => description ?? '';
Color? get backgroundColor { Color? get backgroundColor {
if (id?.value == moreLabelId) { if (id?.value == moreLabelId) {
return AppColor.grayBackgroundColor; return AppColor.grayBackgroundColor;
@@ -32,12 +34,14 @@ extension LabelExtension on Label {
KeyWordIdentifier? keyword, KeyWordIdentifier? keyword,
String? displayName, String? displayName,
HexColor? color, HexColor? color,
String? description,
}) { }) {
return Label( return Label(
id: id ?? this.id, id: id ?? this.id,
displayName: displayName ?? this.displayName, displayName: displayName ?? this.displayName,
keyword: keyword ?? this.keyword, keyword: keyword ?? this.keyword,
color: color ?? this.color, color: color ?? this.color,
description: description ?? this.description,
); );
} }
@@ -63,6 +63,7 @@ class LabelApi
final newLabelCreated = labelCreated!.copyWith( final newLabelCreated = labelCreated!.copyWith(
displayName: labelData.displayName, displayName: labelData.displayName,
color: labelData.color, color: labelData.color,
description: labelData.description,
); );
return newLabelCreated; return newLabelCreated;
} else { } else {
@@ -78,6 +78,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
if (selectedLabel != null) { if (selectedLabel != null) {
_nameInputController.text = selectedLabel.safeDisplayName; _nameInputController.text = selectedLabel.safeDisplayName;
_nameInputFocusNode.requestFocus(); _nameInputFocusNode.requestFocus();
_descriptionInputController.text = selectedLabel.safeDescription;
_createLabelStateNotifier.value = true; _createLabelStateNotifier.value = true;
_labelSelectedColorNotifier.value = _selectedColor; _labelSelectedColorNotifier.value = _selectedColor;
} }
@@ -370,6 +371,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
color: _selectedColor != null color: _selectedColor != null
? HexColor(_selectedColor!.toHexTriplet()) ? HexColor(_selectedColor!.toHexTriplet())
: null, : null,
description: _descriptionInputController.text,
); );
widget.onLabelActionCallback(newLabel); widget.onLabelActionCallback(newLabel);