-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_maps_flutter]add support for map tapping #985
Conversation
de5cedc
to
9d896d8
Compare
I m not getting the idea of long tapped event on map to place marker on the tapped point listing or the Coordinates |
Hey @nandymandy1 ! This PR is just delivering the tap event. It has nothing to do with long tapped events. |
how can i get your codes as I m in tight development schedule and how can i get access to your repository??? |
you can point to my fork like this in your
But do it under your own risk! :) |
ontap listener ready????? |
can you show how to use it??? |
I updated the PR description including an example of usage @nandymandy1 hope it is useful |
can u please update this and re-publish it ? |
9bcf88d
to
ae58d52
Compare
thanks for your contribution!! I am sorry that you're being asked this frequently, but I will appreciate it if you take some time to update your branch again as some APIs have changed. also, I tried the snippet you posted, it looks like the listener is on the controller (not the google maps object itself) which seems an excellent decision in my point of view. here is a snippet that will add a marker and print tapped location, please consider updating your snippet so those who want to test your branch do not face any troubles mapController.onMapTapped.add((LatLng location) {
print("tapped location ${location.latitude} ${location.longitude}");
mapController.addMarker(new MarkerOptions(
icon: BitmapDescriptor.defaultMarker,
position: location,
));
}); let me know once you update your fork so I update the snippet too, since the new API changes will break this snippet as well |
Hi @ebeem Thank you for your comment, I also hope this gets merged soon :) I am not sure if I understood you completely. I think this branch is already rebased to the newest changes on master. The controller is no longer used for listeners but the google map object itself. (It used to be the other way around) So I think the snippet is right. In fact, you can check the |
@RafaO what branch are you actively updating?
|
tested, working great |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RafaO , thanks for the PR. We have now added support for on-device tests for google maps plugin. Please take a look at this file for an example test case. I will be happy to help you through any issue you run into while adding tests. Please add some relevant tests to your PR :-)
one suggestion for the test case would be to:
- Create a map
- Tap the map and make sure the map gets tapped.
Here is an example of how you would do it if it were a button:
final LiveWidgetController widgetController = LiveWidgetController(WidgetsBinding.instance);
test('tapButton', () async {
bool isPressed = false;
await pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: Material(
child: RaisedButton(
onPressed: () {
isPressed = true;
},
child: const Text(
"Hello, World!",
key: ValueKey<String>("text"),
),
),
),
));
await widgetController.tap(find.byKey(const ValueKey<String>("text")));
expect(isPressed, true);
});
Thanks again!
@RafaO , I can drive this PR to completion if you do not have the cycles/time to do it. Please allow changes to your branch. Follow the instructions at: https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork |
Hi @iskakaushik thanks for your feedback and help. The checkmark for allowing changes from maintainers is already activated (was also this way), I hope you are able to perform changes and of course feel free to do so. So far I have this:
But is not working, neither with the boolean or with the place being not null. I am also not sure what is the best way of running these tests because the device stays stuck at the end of tests. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RafaO , I looked into it. We do not support gestures on Platform Views yet. This is not a trivial problem because iOS does not let us synthesize gestures. As we don't have the infrastructure in place to effectively test this just yet. I filed an issue: flutter/flutter#30471
There are a couple of changes that I think will make this PR good to merge. Thanks again for this excellent contribution.
Hi @iskakaushik thanks for taking a look and creating the issue. I reworked with your suggestions the PR. Let me know what you think. |
I think you misread my suggestion as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will shortly publish |
Finally. |
Deliver the tap event in the map with the LatLng object where it happened.
Enables something like this: