Show ontology tag highlights in admin
Some checks failed
Build and deploy Flutter Web / build (push) Failing after 25m24s
Some checks failed
Build and deploy Flutter Web / build (push) Failing after 25m24s
This commit is contained in:
@@ -983,8 +983,7 @@ class _AdminVoiceExperienceRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tags = review.analysis?['tags'];
|
||||
final tagText = tags is List ? tags.join(', ') : '';
|
||||
final selectedTags = _selectedAdminTags(review.analysis);
|
||||
|
||||
return Material(
|
||||
color: Colors.white,
|
||||
@@ -1025,15 +1024,8 @@ class _AdminVoiceExperienceRow extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
if (tagText.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
tagText,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: Color(0xFFE11D48)),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
_AdminOntologyTags(selectedTags: selectedTags),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -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 {
|
||||
const _IntroStep({required this.onNext});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user