-
Notifications
You must be signed in to change notification settings - Fork 80
Map not animating to the location when picking from dropdown. #20
Comments
https://stackoverflow.com/a/72052990/8631092 issue solved from this fix Originally posted by @Milinda1313 in fysoul17#125 (comment) |
@martin-braun The Example codes of the package are in "PickArea: CircleArea..." code available. This code has been converted to a comment line. When I opened this code and searched, I saw that the map moved to the selected address. However, when you open the code, I get a "Place not in area" error for the address I came from on the map. |
@yigitcevik Please do not post in an issue that is not relevant to your issue, I replied on #25 |
i have same issue , how to fix ? |
Please make a new issue explaining your issue in detail. Also give device info and |
@sarmiladhandapani The fix was described here: stackoverflow.com/a/72052990/8631092 I'm not sure if you can implement this fix on your consuming application, but your Device: Pixel 5 API Thiramisu |
This issue is a big one. Melinda's fix to convert the widget into a stateful widget by using a wrapper has no effect. The issue boils down to this: When you change the device orientation or enter the search bar (which will show the keyboard) you will get redraws. Those redraws will re-render the map. If you select a target from the dropdown, the keyboard will be hidden and the code tries to animate to the new location while the Google Maps component re-renders. I was able to minimize the issue by wrapping the map within a We are facing an uncertain situation. I remember that I never had such rendering problems with the Place Picker in the past, but suddenly it began to cause problems on my physical device. I also reverted to a much earlier stage only to figure out that there is no point in which this problem was introduced. Any stage is affected, which makes no sense to me. The problem grew to a much bigger problem. It's not just the fact that re-rendering will cause a crash on animating, also that re-rendering causes heavy flickering and even cause the map to be white sometimes. Even if I can minimize the issue by not re-rendering on keyboard toggle, those issues will still occur on device orientation change. |
@negiot, @berkekesikbas, @sarmiladhandapani, after many hours of debugging I finally found the root cause for the problem and fixed it as good as possible. If you update to If you care about what've happened and related issues we still face beyond this one, read on: The original author thought it was a good idea to put a future within a future builder in a way that it will re-execute whenever a new render happens. This future is to load the current location. When the keyboard toggles there will be a new render, but GoogleMap will not rebuild itself usually, but in this case it did, because the future I mentioned before was re-executing, causing the Google Map component to be hidden for a second, thus respawning the entire component and thus re-initializing it entirely. Since your keyboard hides when you select a place, it would try to animate the camera on a component that was disposed and replaced already. It was more likely to happen, when you had the place picker inside a container. With the new version these issues are solved, but flickering on keyboard toggle as well as device orientation change is still a problem. You can solve such problems by enabling Hybrid Composition like so: if(Platform.isAndroid) {
AndroidGoogleMapsFlutter.useAndroidViewSurface = true;
} There is also property called |
https://stackoverflow.com/a/72052990/8631092
Describe the bug When a user tries to search on the search bar, he either enters or choose the location from the suggestions below, the maps refreshes for a bit and then just stays where it was before. The result gets updated but the map does not animate to the location selected.
To Reproduce I'm providing a gist to the dart file where I'm using the package gist.github.com/uV3301/a01b8fb3111c97673f13ff9be861ad04
Expected behavior The expected behavior should be that after the search selection, the map should animate to the query location.
Screenshots
Flutter Doctor -v
Additional context Additionally the error on console is such :
_Originally posted by @uV3301 in fysoul17#125 (comment)
The text was updated successfully, but these errors were encountered: