fix: 4 audit findings in professionals location flow

- Clear button (✕) now resets _cityMismatch and _detectedCity so banner and CTA unblock
- _citiesMatch: replace bidirectional contains with equality + word-prefix check to prevent 'Cali' matching 'Calima'
- ProfessionalsProvider: track _currentUserId to reset state on user change (cross-user leak)
- ProfessionalsProvider: store _lastSearch so setLocationContext preserves active search term

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-21 20:47:14 -05:00
co-authored by Claude Sonnet 4.6
parent f26b3d3c03
commit 54f9cc272e
3 changed files with 21 additions and 5 deletions
+4 -1
View File
@@ -178,7 +178,8 @@ class _DashboardViewState extends State<DashboardView> {
.replaceAll(RegExp(r'[úù]'), 'u');
final na = normalize(a);
final nb = normalize(b);
return na.contains(nb) || nb.contains(na);
// Exact match, or one is a full-word prefix of the other (handles "Bogotá D.C." vs "Bogotá")
return na == nb || na.startsWith('$nb ') || nb.startsWith('$na ');
}
Future<void> _geocodeAndMoveMap(String address) async {
@@ -440,6 +441,8 @@ class _DashboardViewState extends State<DashboardView> {
setState(() {
_suggestions = [];
_currentAddress = '';
_detectedCity = '';
_cityMismatch = false;
});
},
)