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..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' @@ -10,15 +9,17 @@ environment: dependencies: flutter: sdk: flutter - google_api_headers: ^1.3.0 - google_maps_webservice: ^0.0.20-nullsafety.5 - http: ^0.13.4 + google_api_headers: ^2.0.0 + google_maps_webservice: + git: + url: https://github.com/shkvoretz/google_maps_webservice.git + http: ^1.1.0 rxdart: ^0.27.5 dev_dependencies: flutter_test: sdk: flutter - lint: ^1.10.0 + lint: ^2.0.1 flutter: assets: