refactor: update agent location display logic to prioritize state over city across UI and models

This commit is contained in:
pradeepkumar
2026-04-11 22:52:13 +05:30
parent 9c63ee70d9
commit 1ef02383a6
4 changed files with 57 additions and 36 deletions

View File

@@ -96,10 +96,10 @@ class AgentProfile {
}
String get location {
// Direct fields first
if (city != null && state != null) return '$city, $state';
if (city != null) return city!;
// Direct fields first (state first, then city)
if (city != null && state != null) return '$state, $city';
if (state != null) return state!;
if (city != null) return city!;
// Fallback: extract from fieldValues (matches web getLocationString)
String? fvCity;
@@ -112,7 +112,7 @@ class AgentProfile {
fvState = _extractFieldString(fv);
}
}
final parts = [fvCity, fvState].where((s) => s != null && s.isNotEmpty);
final parts = [fvState, fvCity].where((s) => s != null && s.isNotEmpty);
if (parts.isNotEmpty) return parts.join(', ');
if (country != null && country!.isNotEmpty) return country!;