Show ontology tag highlights in admin
Some checks failed
Build and deploy Flutter Web / build (push) Failing after 25m24s

This commit is contained in:
Ruslan Bakiev
2026-05-14 20:02:37 +07:00
parent 0532f6aa88
commit abae8b905c

View File

@@ -983,8 +983,7 @@ class _AdminVoiceExperienceRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final tags = review.analysis?['tags']; final selectedTags = _selectedAdminTags(review.analysis);
final tagText = tags is List ? tags.join(', ') : '';
return Material( return Material(
color: Colors.white, color: Colors.white,
@@ -1025,15 +1024,8 @@ class _AdminVoiceExperienceRow extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
], ],
if (tagText.isNotEmpty) ...[ const SizedBox(height: 10),
const SizedBox(height: 8), _AdminOntologyTags(selectedTags: selectedTags),
Text(
tagText,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Color(0xFFE11D48)),
),
],
], ],
), ),
), ),
@@ -1041,6 +1033,85 @@ class _AdminVoiceExperienceRow extends StatelessWidget {
} }
} }
class _AdminOntologyTags extends StatelessWidget {
const _AdminOntologyTags({required this.selectedTags});
final Set<String> selectedTags;
static const _tags = [
_AdminOntologyTag('energy:calm', 'спокойное'),
_AdminOntologyTag('energy:dynamic', 'живое'),
_AdminOntologyTag('privacy:intimate', 'камерное'),
_AdminOntologyTag('privacy:open', 'открытое'),
_AdminOntologyTag('sociality:solo', 'для себя'),
_AdminOntologyTag('sociality:group', 'для компании'),
_AdminOntologyTag('function:reset', 'выдохнуть'),
_AdminOntologyTag('function:impress', 'впечатлить'),
_AdminOntologyTag('function:transit', 'транзитное'),
_AdminOntologyTag('aesthetic:clean', 'чистое'),
_AdminOntologyTag('aesthetic:expressive', 'выразительное'),
];
@override
Widget build(BuildContext context) {
return Wrap(
spacing: 6,
runSpacing: 6,
children: [
for (final tag in _tags)
_AdminOntologyChip(
label: tag.label,
selected: selectedTags.contains(tag.id),
),
],
);
}
}
class _AdminOntologyChip extends StatelessWidget {
const _AdminOntologyChip({required this.label, required this.selected});
final String label;
final bool selected;
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
color: selected ? const Color(0xFFE11D48) : const Color(0xFFF2EEE8),
borderRadius: BorderRadius.circular(999),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 5),
child: Text(
label,
style: TextStyle(
color: selected ? Colors.white : const Color(0xFF746A60),
fontSize: 12,
fontWeight: FontWeight.w800,
height: 1,
),
),
),
);
}
}
class _AdminOntologyTag {
const _AdminOntologyTag(this.id, this.label);
final String id;
final String label;
}
Set<String> _selectedAdminTags(Map<String, dynamic>? analysis) {
final tags = analysis?['tags'];
if (tags is! List) {
return const {};
}
return tags.whereType<String>().toSet();
}
class _IntroStep extends StatelessWidget { class _IntroStep extends StatelessWidget {
const _IntroStep({required this.onNext}); const _IntroStep({required this.onNext});