Use ontology traits in map UI
All checks were successful
Build and deploy Flutter Web / build (push) Successful in 3m17s

This commit is contained in:
Ruslan Bakiev
2026-05-08 16:22:36 +07:00
parent 238521b11b
commit 277888c407
4 changed files with 47 additions and 123 deletions

View File

@@ -3,118 +3,48 @@ import 'package:latlong2/latlong.dart';
enum PlaceTrait {
calm,
alive,
cozy,
cold,
status,
simple,
free,
formal,
private,
dynamic,
intimate,
open,
social,
solo,
beautiful,
neutral,
unusual,
clear,
focused,
group,
reset,
impress,
transit,
clean,
expressive,
}
extension PlaceTraitText on PlaceTrait {
String get label {
return switch (this) {
PlaceTrait.calm => 'спокойное',
PlaceTrait.alive => 'живое',
PlaceTrait.cozy => 'уютное',
PlaceTrait.cold => 'холодное',
PlaceTrait.status => 'статусное',
PlaceTrait.simple => 'простое',
PlaceTrait.free => 'свободное',
PlaceTrait.formal => 'формальное',
PlaceTrait.private => 'приватное',
PlaceTrait.dynamic => 'живое',
PlaceTrait.intimate => 'камерное',
PlaceTrait.open => 'открытое',
PlaceTrait.social => 'для общения',
PlaceTrait.solo => 'для себя',
PlaceTrait.beautiful => 'красивое',
PlaceTrait.neutral => 'нейтральное',
PlaceTrait.unusual => 'необычное',
PlaceTrait.clear => 'понятное',
PlaceTrait.focused => 'помогает собраться',
PlaceTrait.group => 'для компании',
PlaceTrait.reset => 'выдохнуть',
PlaceTrait.impress => 'впечатлить',
PlaceTrait.transit => 'транзитное',
};
}
}
enum UserIntent { exhale, date, meet, focus, move, surprise, alone, impress }
extension UserIntentText on UserIntent {
String get title {
return switch (this) {
UserIntent.exhale => 'выдохнуть',
UserIntent.date => 'свидание',
UserIntent.meet => 'встретиться',
UserIntent.focus => 'поработать',
UserIntent.move => 'движ',
UserIntent.surprise => 'удивиться',
UserIntent.alone => 'побыть одному',
UserIntent.impress => 'привести кого-то',
};
}
String get subtitle {
return switch (this) {
UserIntent.exhale => 'тихо, мягко, без давления',
UserIntent.date => 'красиво и лично',
UserIntent.meet => 'общение без лишней формальности',
UserIntent.focus => 'собраться и не выпадать',
UserIntent.move => 'живо, шумно, с энергией',
UserIntent.surprise => 'не как обычно',
UserIntent.alone => 'быть в своем ритме',
UserIntent.impress => 'место должно держать момент',
PlaceTrait.clean => 'чистое',
PlaceTrait.expressive => 'выразительное',
};
}
IconData get icon {
return switch (this) {
UserIntent.exhale => Icons.air_outlined,
UserIntent.date => Icons.favorite_border,
UserIntent.meet => Icons.forum_outlined,
UserIntent.focus => Icons.center_focus_strong_outlined,
UserIntent.move => Icons.bolt_outlined,
UserIntent.surprise => Icons.auto_awesome_outlined,
UserIntent.alone => Icons.person_outline,
UserIntent.impress => Icons.diamond_outlined,
};
}
Set<PlaceTrait> get traits {
return switch (this) {
UserIntent.exhale => {PlaceTrait.calm, PlaceTrait.cozy, PlaceTrait.solo},
UserIntent.date => {
PlaceTrait.private,
PlaceTrait.beautiful,
PlaceTrait.social,
},
UserIntent.meet => {PlaceTrait.social, PlaceTrait.free, PlaceTrait.alive},
UserIntent.focus => {
PlaceTrait.focused,
PlaceTrait.calm,
PlaceTrait.neutral,
},
UserIntent.move => {PlaceTrait.alive, PlaceTrait.open, PlaceTrait.social},
UserIntent.surprise => {
PlaceTrait.unusual,
PlaceTrait.alive,
PlaceTrait.open,
},
UserIntent.alone => {PlaceTrait.solo, PlaceTrait.free, PlaceTrait.calm},
UserIntent.impress => {
PlaceTrait.status,
PlaceTrait.beautiful,
PlaceTrait.private,
},
PlaceTrait.calm => Icons.air_outlined,
PlaceTrait.dynamic => Icons.bolt_outlined,
PlaceTrait.intimate => Icons.lock_outline,
PlaceTrait.open => Icons.public_outlined,
PlaceTrait.solo => Icons.person_outline,
PlaceTrait.group => Icons.forum_outlined,
PlaceTrait.reset => Icons.spa_outlined,
PlaceTrait.impress => Icons.diamond_outlined,
PlaceTrait.transit => Icons.near_me_outlined,
PlaceTrait.clean => Icons.wb_sunny_outlined,
PlaceTrait.expressive => Icons.auto_awesome_outlined,
};
}
}
@@ -144,14 +74,12 @@ class VoiceReviewDraft {
required this.placeName,
required this.duration,
required this.extractedTraits,
required this.suggestedIntents,
required this.evidence,
});
final String placeName;
final Duration duration;
final Set<PlaceTrait> extractedTraits;
final Set<UserIntent> suggestedIntents;
final List<String> evidence;
bool get isLongEnough => duration.inSeconds >= 30;
@@ -160,14 +88,12 @@ class VoiceReviewDraft {
String? placeName,
Duration? duration,
Set<PlaceTrait>? extractedTraits,
Set<UserIntent>? suggestedIntents,
List<String>? evidence,
}) {
return VoiceReviewDraft(
placeName: placeName ?? this.placeName,
duration: duration ?? this.duration,
extractedTraits: extractedTraits ?? this.extractedTraits,
suggestedIntents: suggestedIntents ?? this.suggestedIntents,
evidence: evidence ?? this.evidence,
);
}