diff --git a/README.md b/README.md index 85527ea..1f98124 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,6 @@ cp lib/keys.dart.example lib/keys.dart ## Roadmap ### Needed Bugfixes -- Clear search box after selecting first nav point - Make submission guide scarier - Tile cache trimming? Does fluttermap handle? - Filter NSI suggestions based on what has already been typed in diff --git a/assets/changelog.json b/assets/changelog.json index aff9776..3b5fc90 100644 --- a/assets/changelog.json +++ b/assets/changelog.json @@ -2,7 +2,8 @@ "2.6.4": { "content": [ "• Added imperial units support (miles, feet) in addition to metric units (km, meters)", - "• Moved units setting from Navigation to Language & Region settings page" + "• Moved units setting from Navigation to Language & Region settings page", + "• Search text now automatically clears when route planning starts" ] }, "2.6.3": { diff --git a/lib/widgets/search_bar.dart b/lib/widgets/search_bar.dart index 1771629..0e09dbb 100644 --- a/lib/widgets/search_bar.dart +++ b/lib/widgets/search_bar.dart @@ -26,6 +26,7 @@ class _LocationSearchBarState extends State { final Debouncer _searchDebouncer = Debouncer(const Duration(milliseconds: 500)); bool _showResults = false; + bool _wasSettingSecondPoint = false; // Track previous state to detect changes @override void initState() { @@ -161,6 +162,19 @@ class _LocationSearchBarState extends State { Widget build(BuildContext context) { return Consumer( builder: (context, appState, child) { + // BRUTALIST: Clear search box when route planning starts + final isNowSettingSecondPoint = appState.isSettingSecondPoint; + if (isNowSettingSecondPoint && !_wasSettingSecondPoint) { + // Route planning just started - clear the search box + WidgetsBinding.instance.addPostFrameCallback((_) { + _controller.clear(); + setState(() { + _showResults = false; + }); + }); + } + _wasSettingSecondPoint = isNowSettingSecondPoint; + return Column( children: [ Container(