From 1a08730b83dc0610b99ffe600fba7178d6997a95 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 11 Apr 2026 22:52:19 +0530 Subject: [PATCH] refactor: update location parsing logic to prioritize state before city in profile settings --- .../profile/presentation/widgets/profile_settings_tab.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/features/profile/presentation/widgets/profile_settings_tab.dart b/lib/features/profile/presentation/widgets/profile_settings_tab.dart index 2c7a09e..c1ba43d 100644 --- a/lib/features/profile/presentation/widgets/profile_settings_tab.dart +++ b/lib/features/profile/presentation/widgets/profile_settings_tab.dart @@ -92,7 +92,7 @@ class _ProfileSettingsTabState extends ConsumerState { final city = profile['city'] as String? ?? ''; final stateName = profile['state'] as String? ?? ''; final country = profile['country'] as String? ?? ''; - final parts = [city, stateName, country].where((s) => s.isNotEmpty); + final parts = [stateName, city, country].where((s) => s.isNotEmpty); _locationController.text = parts.join(', '); } @@ -403,8 +403,9 @@ class _ProfileSettingsTabState extends ConsumerState { .map((s) => s.trim()) .where((s) => s.isNotEmpty) .toList(); - if (locationParts.isNotEmpty) data['city'] = locationParts[0]; - if (locationParts.length > 1) data['state'] = locationParts[1]; + // Display order is state first, then city, then country — parse in the same order + if (locationParts.isNotEmpty) data['state'] = locationParts[0]; + if (locationParts.length > 1) data['city'] = locationParts[1]; if (locationParts.length > 2) data['country'] = locationParts[2]; }