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), const SizedBox(height: 12),
_buildContactInfo(state), _buildContactInfo(state),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildProfileInfo(agent), _buildProfileInfo(agent, state),
const SizedBox(height: 24), const SizedBox(height: 24),
_buildExperienceSection(state), _buildExperienceSection(state),
const SizedBox(height: 24), const SizedBox(height: 24),
@@ -680,7 +680,12 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
} }
// ── Name, verified badge, title, location, member since, bio ── // ── 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( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24), padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column( child: Column(
@@ -758,7 +763,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
if (agent.location.isNotEmpty) ...[ if (locationDisplay.isNotEmpty) ...[
SvgPicture.asset( SvgPicture.asset(
'assets/icons/location_filled_icon.svg', 'assets/icons/location_filled_icon.svg',
width: 16, width: 16,
@@ -766,7 +771,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
agent.location, locationDisplay,
style: const TextStyle( style: const TextStyle(
fontFamily: 'SourceSerif4', fontFamily: 'SourceSerif4',
fontSize: 14, fontSize: 14,