diff --git a/lib/features/agents/presentation/providers/agent_detail_provider.dart b/lib/features/agents/presentation/providers/agent_detail_provider.dart index 1f1f792..a95cc5a 100644 --- a/lib/features/agents/presentation/providers/agent_detail_provider.dart +++ b/lib/features/agents/presentation/providers/agent_detail_provider.dart @@ -184,10 +184,8 @@ class AgentDetailState { if (fvStates != null) parts.addAll(fvStates.map(_normalizeStateCode)); if (fvCities != null) { for (final c in fvCities) { - // City values carry a state prefix (e.g. "ne_adams"); strip it for display. - final cleaned = _stripCityStatePrefix(c); - if (!parts.any((p) => p.toLowerCase() == cleaned.toLowerCase())) { - parts.add(cleaned); + if (!parts.any((p) => p.toLowerCase() == c.toLowerCase())) { + parts.add(c); } } } @@ -198,7 +196,7 @@ class AgentDetailState { parts.add(_normalizeStateCode(agent!.state!)); } if (agent!.city != null && agent!.city!.isNotEmpty) { - parts.add(_stripCityStatePrefix(agent!.city!)); + parts.add(agent!.city!); } } @@ -220,23 +218,6 @@ class AgentDetailState { return trimmed; } - /// Strip the state-code prefix from a city value (e.g. "Ne Adams" / "ne_adams" → "Adams"). - /// After removing the prefix, title-case the remainder. - String _stripCityStatePrefix(String raw) { - final trimmed = raw.trim(); - // Snake-case with a 2-letter state prefix: ne_adams, co_aetna_estates - final snakeMatch = RegExp(r'^[a-z]{2}_', caseSensitive: false).firstMatch(trimmed); - if (snakeMatch != null) { - return titleCase(trimmed.substring(snakeMatch.end)); - } - // Title-cased with a 2-letter prefix token: "Ne Adams", "Co Aetna Estates" - final spaceMatch = RegExp(r'^[A-Za-z]{2}\s+').firstMatch(trimmed); - if (spaceMatch != null) { - return trimmed.substring(spaceMatch.end); - } - return trimmed; - } - /// Combined location text for single-line display. String get locationText { final parts = locationParts; @@ -245,14 +226,28 @@ class AgentDetailState { } /// Extract all values from a field as a list of title-cased strings. + /// For city fields, strip the 2-letter state prefix before title-casing + /// (matches web's `stripCityPrefix`: "ne_adams" → "Adams"). static List? _extractAllValuesAsList(AgentFieldValue fv) { + final isCity = (fv.fieldSlug.toLowerCase() == 'city' || + fv.fieldSlug.toLowerCase() == 'city_name'); + + String format(String raw) { + var s = raw; + if (isCity) { + // Strip 2-letter state prefix: "ne_adams" → "adams", "co_aetna_estates" → "aetna_estates" + s = s.replaceFirst(RegExp(r'^[a-z]{2}_', caseSensitive: false), ''); + } + return titleCase(s); + } + if (fv.jsonValue is List && (fv.jsonValue as List).isNotEmpty) { return (fv.jsonValue as List) - .map((v) => titleCase(v.toString())) + .map((v) => format(v.toString())) .toList(); } if (fv.textValue != null && fv.textValue!.isNotEmpty) { - return [titleCase(fv.textValue!)]; + return [format(fv.textValue!)]; } return null; } diff --git a/lib/features/agents/presentation/screens/agent_detail_screen.dart b/lib/features/agents/presentation/screens/agent_detail_screen.dart index 915c26f..1a0c71a 100644 --- a/lib/features/agents/presentation/screens/agent_detail_screen.dart +++ b/lib/features/agents/presentation/screens/agent_detail_screen.dart @@ -692,15 +692,12 @@ class _AgentDetailScreenState extends ConsumerState { onTap: remaining > 0 ? () => _showLocationModal(parts) : null, child: Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.only(top: 2), - child: SvgPicture.asset( - 'assets/icons/location_pin_icon.svg', - width: 18, - height: 18, - ), + SvgPicture.asset( + 'assets/icons/location_pin_icon.svg', + width: 16, + height: 16, ), const SizedBox(width: 4), Flexible( @@ -712,7 +709,7 @@ class _AgentDetailScreenState extends ConsumerState { style: const TextStyle( fontFamily: 'SourceSerif4', fontSize: 14, - fontWeight: FontWeight.w700, + fontWeight: FontWeight.w600, color: AppColors.primaryDark, ), ), @@ -738,19 +735,20 @@ class _AgentDetailScreenState extends ConsumerState { ], Row( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset( 'assets/icons/calendar_icon.svg', - width: 18, - height: 18, + width: 16, + height: 16, ), const SizedBox(width: 4), Text( agent.memberSinceText, style: const TextStyle( fontFamily: 'SourceSerif4', - fontSize: 13, - fontWeight: FontWeight.w500, + fontSize: 14, + fontWeight: FontWeight.w600, color: AppColors.primaryDark, ), ), diff --git a/lib/features/agents/presentation/screens/agent_home_screen.dart b/lib/features/agents/presentation/screens/agent_home_screen.dart index d031fe4..841dfd4 100644 --- a/lib/features/agents/presentation/screens/agent_home_screen.dart +++ b/lib/features/agents/presentation/screens/agent_home_screen.dart @@ -759,28 +759,38 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { ), ], const SizedBox(height: 8), - // Location + Member Since - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (locationDisplay.isNotEmpty) ...[ + // Location + Member Since (center-aligned, uniform sizing) + if (locationDisplay.isNotEmpty) ...[ + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ SvgPicture.asset( 'assets/icons/location_filled_icon.svg', width: 16, height: 16, ), const SizedBox(width: 4), - Text( - locationDisplay, - style: const TextStyle( - fontFamily: 'SourceSerif4', - fontSize: 14, - fontWeight: FontWeight.w700, - color: AppColors.primaryDark, + Flexible( + child: Text( + locationDisplay, + style: const TextStyle( + fontFamily: 'SourceSerif4', + fontSize: 14, + fontWeight: FontWeight.w600, + color: AppColors.primaryDark, + ), + textAlign: TextAlign.center, ), ), - const SizedBox(width: 20), ], + ), + const SizedBox(height: 6), + ], + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ SvgPicture.asset( 'assets/icons/calendar_icon.svg', width: 16, @@ -795,8 +805,8 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { agent.memberSinceText, style: const TextStyle( fontFamily: 'SourceSerif4', - fontSize: 13, - fontWeight: FontWeight.w500, + fontSize: 14, + fontWeight: FontWeight.w600, color: AppColors.primaryDark, ), ),