feat: enhance AI suggestion display in edit dialog with product name and category labels
This commit is contained in:
@@ -327,11 +327,12 @@ class _EditDialogState extends State<_EditDialog> {
|
||||
final aiPath = item.categorySuggestionPath;
|
||||
final aiLabel = (aiPath != null && aiPath.isNotEmpty)
|
||||
? aiPath
|
||||
: ((aiCategory != null && aiCategory.isNotEmpty)
|
||||
? aiCategory
|
||||
: (item.suggestedProductName?.isNotEmpty == true
|
||||
? item.suggestedProductName
|
||||
: null));
|
||||
: ((aiCategory != null && aiCategory.isNotEmpty) ? aiCategory : null);
|
||||
final suggestedProductLabel = (item.suggestedProductId != null &&
|
||||
item.suggestedProductName?.isNotEmpty == true &&
|
||||
item.matchedProductId == null)
|
||||
? item.suggestedProductName
|
||||
: null;
|
||||
final currentQuantity =
|
||||
double.tryParse(_quantityCtrl.text.replaceAll(',', '.')) ?? widget.item.quantity;
|
||||
final currentUnit = _unitCtrl.text.trim().isEmpty ? widget.item.unit : _unitCtrl.text.trim();
|
||||
@@ -431,8 +432,24 @@ class _EditDialogState extends State<_EditDialog> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (aiLabel != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
if (suggestedProductLabel != null) ...[ const SizedBox(height: 8),
|
||||
ActionChip(
|
||||
avatar: Icon(
|
||||
Icons.search,
|
||||
size: 14,
|
||||
color: Colors.blue.shade700,
|
||||
),
|
||||
label: Text(
|
||||
'Förslag: $suggestedProductLabel',
|
||||
style: theme.textTheme.labelSmall,
|
||||
),
|
||||
backgroundColor: Colors.blue.shade50,
|
||||
side: BorderSide(color: Colors.blue.shade300),
|
||||
visualDensity: VisualDensity.compact,
|
||||
onPressed: _applyAiSuggestionForExistingSelection,
|
||||
),
|
||||
],
|
||||
if (aiLabel != null) ...[ const SizedBox(height: 8),
|
||||
ActionChip(
|
||||
avatar: Icon(
|
||||
Icons.auto_awesome,
|
||||
@@ -440,7 +457,7 @@ class _EditDialogState extends State<_EditDialog> {
|
||||
color: Colors.green.shade700,
|
||||
),
|
||||
label: Text(
|
||||
'AI-forslag: $aiLabel',
|
||||
'AI-kategori: $aiLabel',
|
||||
style: theme.textTheme.labelSmall,
|
||||
),
|
||||
backgroundColor: Colors.green.shade50,
|
||||
|
||||
Reference in New Issue
Block a user