-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[web] [google_maps_flutter_web] Polygon click issue #111897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @stenlee. Thank you for filing this issue. Can you please provide the following information?
|
@exaby73 |
@stenlee Can you confirm that it works as expected on Android and iOS? |
@exaby73 - Yes, I can confirm it works as expected on Android and iOS. We are using the GoogleMaps (Flutter iOS+Android) intensively for VFR Navigation for pilots - https://www.flylog.io |
From the
Is this similar to what you're experiencing? |
@exaby73 - No it is not. The part of the documentation you are mentioning is connected to using overlays on TOP of the maps. As I described in the provided example (no overlays are used in the example)
|
Hello @stenlee. Could you share sample code in the form of a repo with reproducible steps. For some reason, I am getting a blank screen on web when trying to run the code. |
to prevent a blank screen remember to put the following line to your index.hml file
If you don't have API key, you can use it without - warning will be visible on the page, but the bug is still reproducible
|
Triage reportThe click event did not register when clicking on the polygon. Looks like the blank screen was an API key problem. Resetting the billing account and re-generating the API key on my account solved it. Versions reproducible on
InfoCode Sampleimport 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MapsBug(),
);
}
}
class MapsBug extends StatelessWidget {
const MapsBug({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: GoogleMap(
initialCameraPosition:
const CameraPosition(target: LatLng(50.10, 14.25), zoom: 10),
polygons: {
const Polygon(
polygonId: PolygonId("polygon"),
points: [
LatLng(50.40, 14.10),
LatLng(50.10, 14.10),
LatLng(50.10, 14.50),
LatLng(50.40, 14.50),
],
)
},
onTap: (latLng) {
debugPrint("NOT fired when clicked on Polygon");
},
),
);
}
} Flutter Doctor
|
Hi @stenlee, So the onTap Polygon callback has to find the LatLng position converting the Screen Coordinates. I'll explain my steps:
|
Same issue with version 0.5.8. |
Thanks for the workaround @MaurizioSodano it's still helpful almost 2 years later |
Happy to help, though I had hoped this issue would have been resolved by now. |
Looks like this is because there is |
Uh oh!
There was an error while loading. Please reload this page.
Hi Flutter team
the GoogleMap onTap(latLng) callback is not fired in the google_maps_flutter_web when the polygon is drawn on the map and the user taps(clicks) on the polygon area.
minimum example to reproduce:
The text was updated successfully, but these errors were encountered: