From 49a9716c8735166b7149ce24facfd912878ad032 Mon Sep 17 00:00:00 2001 From: devCitronnoir Date: Thu, 16 Feb 2023 14:42:24 +0100 Subject: [PATCH 1/5] autosearch from a Textfield + dependency upgrade A simple change to allow auto-search from a classic Flutter Textfield. --- lib/src/flutter_google_places.dart | 12 ++++++++++-- pubspec.yaml | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/flutter_google_places.dart b/lib/src/flutter_google_places.dart index a451c36..ac213a7 100644 --- a/lib/src/flutter_google_places.dart +++ b/lib/src/flutter_google_places.dart @@ -30,6 +30,7 @@ class PlacesAutocompleteWidget extends StatefulWidget { final TextStyle? textStyle; final ThemeData? themeData; + /// optional - sets 'proxy' value in google_maps_webservice /// /// In case of using a proxy the baseUrl can be set. @@ -296,11 +297,15 @@ class PlacesAutocompleteResultState extends State { class AppBarPlacesAutoCompleteTextField extends StatefulWidget { final InputDecoration? textDecoration; final TextStyle? textStyle; + final FocusNode? focusNode; + final bool autofocus; const AppBarPlacesAutoCompleteTextField({ Key? key, this.textDecoration, this.textStyle, + this.focusNode, + this.autofocus = true, }) : super(key: key); @override @@ -319,7 +324,8 @@ class AppBarPlacesAutoCompleteTextFieldState margin: const EdgeInsets.only(top: 4.0), child: TextField( controller: state._queryTextController, - autofocus: true, + autofocus: widget.autofocus, + focusNode: widget.focusNode, style: widget.textStyle ?? _defaultStyle(), decoration: widget.textDecoration ?? _defaultDecoration(state.widget.hint), @@ -451,13 +457,15 @@ abstract class PlacesAutocompleteState extends State { void initState() { super.initState(); + doSearch(widget.startText!); + _queryTextController = TextEditingController(text: widget.startText); _queryTextController!.selection = TextSelection( baseOffset: 0, extentOffset: widget.startText?.length ?? 0, ); - _initPlaces(); + _initPlaces().then((value) => doSearch(widget.startText!)); _searching = false; _queryTextController!.addListener(_onQueryChange); diff --git a/pubspec.yaml b/pubspec.yaml index 14c8af2..f41d3e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lint: ^1.10.0 + lint: ^2.0.1 flutter: assets: From dd5dd2d0f8c908333838d51604597812b77db04d Mon Sep 17 00:00:00 2001 From: devCitronnoir Date: Fri, 30 Jun 2023 12:43:48 +0200 Subject: [PATCH 2/5] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index f41d3e5..ee632ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: sdk: flutter google_api_headers: ^1.3.0 google_maps_webservice: ^0.0.20-nullsafety.5 - http: ^0.13.4 + http: ^1.1.0 rxdart: ^0.27.5 dev_dependencies: From 44cb5eca7659fcd7654eb35f775ae384ab9d604e Mon Sep 17 00:00:00 2001 From: devCitronnoir Date: Fri, 30 Jun 2023 12:47:55 +0200 Subject: [PATCH 3/5] Update pubspec.yaml --- pubspec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index ee632ae..4343484 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,9 @@ dependencies: flutter: sdk: flutter google_api_headers: ^1.3.0 - google_maps_webservice: ^0.0.20-nullsafety.5 + google_maps_webservice: + git: + url: https://github.com/shkvoretz/google_maps_webservice.git http: ^1.1.0 rxdart: ^0.27.5 From 00321ea5d227d2a86846cc76c1b8f79e6f12c866 Mon Sep 17 00:00:00 2001 From: devCitronnoir Date: Fri, 30 Jun 2023 12:52:34 +0200 Subject: [PATCH 4/5] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 4343484..760332d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: flutter: sdk: flutter - google_api_headers: ^1.3.0 + google_api_headers: ^2.0.0 google_maps_webservice: git: url: https://github.com/shkvoretz/google_maps_webservice.git From d86baed5655682ccbcb09c8b33b49e133d0ec231 Mon Sep 17 00:00:00 2001 From: devCitronnoir Date: Fri, 30 Jun 2023 13:09:19 +0200 Subject: [PATCH 5/5] Update pubspec.yaml --- pubspec.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 760332d..89e5ecf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,6 @@ name: flutter_google_places description: Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice -version: 0.4.0 -repository: https://github.com/fluttercommunity/flutter_google_places +version: 0.5.0 environment: sdk: '>=2.12.0 <3.0.0'