Closed jansvanda closed 1 year ago
Thanks @jansvanda for using this package, I'll take a look at it. Stay tuned. ๐
Hey @jansvanda
You can now use it like this, I hope it works and is useful to you. Happy coding ๐
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Example'),
content: PlacesAutocomplete(
apiKey: "YOUR_API_KEY_HERE",
searchHintText: "Search for a place",
mounted: mounted,
showBackButton: false,
onSuggestionSelected: (value) {
setState(() {
autocompletePlace =
value.structuredFormatting?.mainText ?? "";
initialValue = value;
});
},
onGetDetailsByPlaceId: (value) {
setState(() {
address = value?.result.formattedAddress ?? "";
});
},
),
actions: <Widget>[
TextButton(
child: const Text('Done'),
onPressed: () => Navigator.of(context).pop(),
),
],
);
},
);
Wow just woke up and there is already a solution! Amazing gonna try it
The fix helped! Thanks! Is there any way it could scroll down the keyboard below the suggestions?
Or maybe ability to show the suggestions on top of the search bar? @rvndsngwn
Hi @rvndsngwn I don't like to spam you, but can you please just help me with this last issue I have? The keyboard overlaps the suggestions, making it unusable if the Box is on the bottom of the page. TY
Hey @jansvanda, It'll take me a while to figure it out ๐
Hi @rvndsngwn I don't like to spam you, but can you please just help me with this last issue I have? The keyboard overlaps the suggestions, making it unusable if the Box is on the bottom of the page. TY
I'll be sure it's possible ๐
In 1.1.0 more customizable options added, now you can customize the UI of the PlacesAutocomplete
class acording to your need.
Or you can use the service AutoCompleteState
, this a service of google auto-complete api.
@rvndsngwn thanks for the update. If i correctly understand, I have to use the suggestionsBoxVerticalOffset
and set it to negative values to let the suggestions appear above the field?
Or what was the solution you thought would be?
Yes maybe it's works, you can try your self.
I haven't tried suggestionsBoxVerticalOffset
. It's a part of UI and I'm provide all the things like: A basic working screen and services.
You can make your own UI with the help of services ๐
If you want to help in your project you can Discord me at ArvindSangwan#4721 ๐
same issue here
The following assertion was thrown while finalizing the widget tree:
A TextEditingController was used after being disposed.
Once you have called dispose() on a TextEditingController, it can no longer be used.
When the exception was thrown, this was the stack:
#0 ChangeNotifier.debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:183:9)
#1 ChangeNotifier.debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:190:6)
#2 ChangeNotifier.dispose (package:flutter/src/foundation/change_notifier.dart:379:27)
#3 _PlacesAutocompleteState.dispose (package:map_location_picker/src/autocomplete_view.dart:375:17)
Hello, I love this library as it is exactly what i need. Sadly, it does not work as expect because no matter what i do, if there is any Widget tree update (I hope it is called like that), i get an error. For example if i have a tabview and on page one i got the PlacesAutocomplete widget, do nothing with it, and just switch to second page and then back, i get this red error widget saying "A TextEditingController was used after being disposed."
I have just tried the whole afternoon getting around it putting it in different views, but nothing really helps.
Steps to reproduce: This is the basic code i have now created to show the same error. With an Alertdialog. When i exit the dialog, and open again, it will show this error.
OH yeah and I never call dispose, that's why this si so weird!
I hope you you can point me to an solution! THANKS Jan