Home > Blockchain >  Flutter showInfoWindow after googleMap build complete
Flutter showInfoWindow after googleMap build complete

Time:10-16

I'm building an App which contains GoogleMap and some markers on it, and I'm using FutureBuilder Wrap the googleMap widget.

After FutureBuilder get the data for building map, the googleMap widget build the map and put the markers on it.

But now I want one of the markers show its info window ,and I tried controller.showInfoWindow method.

It's work perfectly after the map build completely(for example, if I put the method in some button's onTap method, it works fine),but doesn't work if put it in onMapCreated.

How can I show info window automatically when map build finish, not to press something?

I also tried WidgetsBinding.instance.addPostFrameCallback and didn't work too.

CodePudding user response:

I found the problem really is: When the Map Camera is Moving, the showInfoWindow method doesn't work. So I just added a delay time in onMapCreate, and it seems to works fine now.

If anyone has better idea, please let me know.

  • Related