feat: update _buildProfileInfo to prioritize state-derived location data over agent model location

This commit is contained in:
pradeepkumar
2026-04-15 18:18:02 +05:30
parent 3ccb582b38
commit 2424743226

View File

@@ -264,7 +264,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
const SizedBox(height: 12),
_buildContactInfo(state),
const SizedBox(height: 16),
_buildProfileInfo(agent),
_buildProfileInfo(agent, state),
const SizedBox(height: 24),
_buildExperienceSection(state),
const SizedBox(height: 24),
@@ -680,7 +680,12 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
}
// ── Name, verified badge, title, location, member since, bio ──
Widget _buildProfileInfo(AgentProfile agent) {
Widget _buildProfileInfo(AgentProfile agent, AgentDetailState state) {
// Prefer fieldValues-derived location (state.locationParts, with uppercased
// 2-letter state codes); fall back to agent model location when empty.
final locationDisplay = state.locationParts.isNotEmpty
? state.locationParts.join(', ')
: agent.location;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
@@ -758,7 +763,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (agent.location.isNotEmpty) ...[
if (locationDisplay.isNotEmpty) ...[
SvgPicture.asset(
'assets/icons/location_filled_icon.svg',
width: 16,
@@ -766,7 +771,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
),
const SizedBox(width: 4),
Text(
agent.location,
locationDisplay,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,