Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
11cc8c9
[google_maps_flutter] Added Point of Interest Tapping
AsimRoyChowdhury Feb 4, 2026
18d0e19
[google_maps_flutter] Added example for Point of Interest Tapping
AsimRoyChowdhury Feb 4, 2026
fa00c6a
[google_maps_flutter] Added tests for onPoiTap Callback
AsimRoyChowdhury Feb 4, 2026
ca71a07
[google_maps_flutter] Updated Changelogs and Pubspec.yml files
AsimRoyChowdhury Feb 4, 2026
a28a4db
Merge branch 'main' into feature/google-maps-poi-click
AsimRoyChowdhury Feb 4, 2026
2aa24ed
Apply suggestion from @gemini-code-assist[bot]
AsimRoyChowdhury Feb 4, 2026
3c8b5b6
[google_maps_flutter] corrected version for google_maps_flutter_platf…
AsimRoyChowdhury Feb 5, 2026
d54f1b3
[google_maps_flutter] removed redundant import
AsimRoyChowdhury Feb 5, 2026
904a092
[google_maps_flutter] changed tester.pumpAndSettle() to await on onMa…
AsimRoyChowdhury Feb 5, 2026
7b8f809
[google_maps_flutter] removed unnecessary logging to console
AsimRoyChowdhury Feb 5, 2026
e8d0682
[google_maps_flutter] changed the test code to test for the actual me…
AsimRoyChowdhury Feb 5, 2026
752925f
[google_maps_flutter] removed the unnecessary POIClickCallback typedef
AsimRoyChowdhury Feb 5, 2026
69ecb49
[google_maps_flutter] added support for onPoiTap for flutter web
AsimRoyChowdhury Feb 5, 2026
8e522fa
[google_maps_flutter] created tests for onPoiTap Callback for flutter…
AsimRoyChowdhury Feb 5, 2026
ae2a1ea
Merge branch 'feature/google-maps-poi-click' of https://github.com/As…
AsimRoyChowdhury Feb 5, 2026
7552d23
[google_maps_flutter] updated versions for google map flutter web pac…
AsimRoyChowdhury Feb 5, 2026
3145ae7
[google_maps_flutter] added dependency overrides for gogle_maps_flutt…
AsimRoyChowdhury Feb 6, 2026
4e0803e
[google_maps_flutter] updated dependency overrides
AsimRoyChowdhury Feb 6, 2026
2382ad4
[google_maps_flutter] changed the onPoiTap to accept named paramters …
AsimRoyChowdhury Feb 6, 2026
5781bdc
google_maps_flutter] added much more test for the federated package
AsimRoyChowdhury Feb 6, 2026
347d0a9
[google_maps_flutter] updated all flutter analyze checks
AsimRoyChowdhury Feb 6, 2026
ece8e5c
[google_maps_flutter] fixed the fake google maps for automated unit t…
AsimRoyChowdhury Feb 6, 2026
a250736
[google_maps_flutter] formatted java code with formatter
AsimRoyChowdhury Feb 6, 2026
a10dbdb
[google_maps_flutter] updated changelog for google_maps_flutter_web p…
AsimRoyChowdhury Feb 6, 2026
cdabd12
[google_maps_flutter] removed linting issues and updated code for CI …
AsimRoyChowdhury Feb 7, 2026
689a05e
[google_map_flutter] added tests for ios
AsimRoyChowdhury Feb 7, 2026
aa9f696
[google_map_flutter] removed eol and linting issues
AsimRoyChowdhury Feb 7, 2026
5aea2d0
[google_maps_flutter] removed unnecesary type annotation
AsimRoyChowdhury Feb 7, 2026
a58d87c
[google_maps_flutter] corrected java formatting issue
AsimRoyChowdhury Feb 7, 2026
70c2e69
[google_maps_flutter] fixed repo check issues
AsimRoyChowdhury Feb 7, 2026
7c7c0db
[google_maps_flutter] corrected formatting issues
AsimRoyChowdhury Feb 7, 2026
cfd44c5
[google_maps_flutter] updated code formatting
AsimRoyChowdhury Feb 7, 2026
5fab785
[google_maps_flutter] Add onPoiTap to platform interface
AsimRoyChowdhury Feb 7, 2026
72f43f3
[google_maps_flutter] added onPoiTap changes to platform interface pa…
AsimRoyChowdhury Feb 7, 2026
3079afc
[google_maps_flutter] removed unncessary files
AsimRoyChowdhury Feb 7, 2026
9b17699
[google_maps_flutter] implemented onPoiTap callback for all packages
AsimRoyChowdhury Feb 8, 2026
7596469
[google_maps_flutter] updated changelog.md for web package
AsimRoyChowdhury Feb 8, 2026
9cc391e
[google_maps_flutter] Fix federated PR structure: overrides, artifact…
AsimRoyChowdhury Feb 12, 2026
28b709b
[google_maps_flutter] updated formatting errors
AsimRoyChowdhury Feb 12, 2026
2589982
[google_maps_flutter] updated pubspecs to use dart sdk 3.8.0
AsimRoyChowdhury Feb 12, 2026
5acc132
[google_maps_flutter] updated web version to 0.7.0
AsimRoyChowdhury Feb 12, 2026
9d9139c
[google_maps_flutter] removed name from onPoiClick tests
AsimRoyChowdhury Feb 12, 2026
b57aba0
[google_maps_flutter] updated format
AsimRoyChowdhury Feb 13, 2026
679b64f
[google_maps_flutter] added the name field
AsimRoyChowdhury Feb 13, 2026
f7cd0a2
[google_maps_flutter] downgraded sdk version in examples
AsimRoyChowdhury Feb 13, 2026
f1480dd
[google_maps_flutter] updated web version to use 0.5.15
AsimRoyChowdhury Feb 13, 2026
89450b3
[google_maps_flutter] updated pubspecs for dependency overrides
AsimRoyChowdhury Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.15.0

* Adds `onPoiTap` support to the `GoogleMap` widget to handle taps on base map landmarks and businesses.
* Adds a "Place POI" example to the example app.

## 2.14.1

* Replaces internal use of deprecated methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'padding.dart';
import 'page.dart';
import 'place_circle.dart';
import 'place_marker.dart';
import 'place_poi.dart';
import 'place_polygon.dart';
import 'place_polyline.dart';
import 'scrolling_map.dart';
Expand All @@ -41,6 +42,7 @@ final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[
const PlacePolylinePage(),
const PlacePolygonPage(),
const PlaceCirclePage(),
const PlacePoiPage(),
const PaddingPage(),
const SnapshotPage(),
const LiteModePage(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

import 'page.dart';

/// Page for demonstrating Point of Interest (POI) tapping.
class PlacePoiPage extends GoogleMapExampleAppPage {
/// Default constructor.
const PlacePoiPage({super.key})
: super(const Icon(Icons.business), 'Place POI');

@override
Widget build(BuildContext context) {
return const PlacePoiBody();
}
}

/// Body of the POI page.
class PlacePoiBody extends StatefulWidget {
/// Default constructor.
const PlacePoiBody({super.key});

@override
State<StatefulWidget> createState() => PlacePoiBodyState();
}

/// State for [PlacePoiBody].
class PlacePoiBodyState extends State<PlacePoiBody> {
/// The controller for the map.
///
/// This is public to match the example pattern, but marked with a doc comment.
GoogleMapController? controller;
PointOfInterest? _lastPoi;

final CameraPosition _kKolkata = const CameraPosition(
target: LatLng(22.54222641620606, 88.34560669761545),
zoom: 16.0,
);

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}

void _onPoiTap(PointOfInterest poi) {
setState(() {
_lastPoi = poi;
});

controller?.animateCamera(CameraUpdate.newLatLng(poi.position));
}

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Expanded(
child: GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: _kKolkata,
onPoiTap: _onPoiTap,
myLocationButtonEnabled: false,
),
),
Container(
color: Colors.white,
width: double.infinity,
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const Text(
'Last Tapped POI:',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
const SizedBox(height: 8),
if (_lastPoi != null) ...<Widget>[
Text('Place ID: ${_lastPoi!.placeId}'),
Text(
'Lat/Lng: ${_lastPoi!.position.latitude.toStringAsFixed(5)}, ${_lastPoi!.position.longitude.toStringAsFixed(5)}',
),
] else
const Text('Tap on a business or landmark icon...'),
],
),
),
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dependencies:
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
google_maps_flutter_android: ^2.16.1
google_maps_flutter_platform_interface: ^2.14.0
google_maps_flutter_android: ^2.19.0
google_maps_flutter_platform_interface: ^2.14.1

dev_dependencies:
build_runner: ^2.1.10
Expand All @@ -33,3 +33,15 @@ flutter:
uses-material-design: true
assets:
- assets/

dependency_overrides:
google_maps_flutter:
path: ../
google_maps_flutter_android:
path: ../../google_maps_flutter_android
google_maps_flutter_ios:
path: ../../google_maps_flutter_ios
google_maps_flutter_platform_interface:
path: ../../google_maps_flutter_platform_interface
google_maps_flutter_web:
path: ../../google_maps_flutter_web
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf
MarkerId,
MinMaxZoomPreference,
PatternItem,
PointOfInterest,
Polygon,
PolygonId,
Polyline,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class GoogleMapController {
(InfoWindowTapEvent e) => _googleMapState.onInfoWindowTap(e.value),
),
);
_streamSubscriptions.add(
GoogleMapsFlutterPlatform.instance
.onPoiTap(mapId: mapId)
.listen((MapPoiTapEvent e) => _googleMapState.onPoiTap(e.value)),
);
_streamSubscriptions.add(
GoogleMapsFlutterPlatform.instance
.onPolylineTap(mapId: mapId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class GoogleMap extends StatefulWidget {
this.onCameraIdle,
this.onTap,
this.onLongPress,
this.onPoiTap,
this.cloudMapId,
});

Expand Down Expand Up @@ -290,6 +291,9 @@ class GoogleMap extends StatefulWidget {
/// Called every time a [GoogleMap] is long pressed.
final ArgumentCallback<LatLng>? onLongPress;

/// Called when a [PointOfInterest] is tapped.
final ArgumentCallback<PointOfInterest>? onPoiTap;

/// True if a "My Location" layer should be shown on the map.
///
/// This layer includes a location indicator at the current device location,
Expand Down Expand Up @@ -612,6 +616,10 @@ class _GoogleMapState extends State<GoogleMap> {
}
}

void onPoiTap(PointOfInterest poi) {
widget.onPoiTap?.call(poi);
}

void onPolygonTap(PolygonId polygonId) {
final Polygon? polygon = _polygons[polygonId];
if (polygon == null) {
Expand Down
20 changes: 15 additions & 5 deletions packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.14.1
version: 2.15.0

environment:
sdk: ^3.8.0
Expand All @@ -21,10 +21,10 @@ flutter:
dependencies:
flutter:
sdk: flutter
google_maps_flutter_android: ^2.16.1
google_maps_flutter_ios: ^2.15.4
google_maps_flutter_platform_interface: ^2.14.0
google_maps_flutter_web: ^0.5.14
google_maps_flutter_android: ^2.19.0
google_maps_flutter_ios: ^2.18.0
google_maps_flutter_platform_interface: ^2.15.0
google_maps_flutter_web: ^0.5.15

dev_dependencies:
flutter_test:
Expand All @@ -41,3 +41,13 @@ topics:
# The example deliberately includes limited-use secrets.
false_secrets:
- /example/web/index.html

dependency_overrides:
google_maps_flutter_android:
path: ../google_maps_flutter_android
google_maps_flutter_ios:
path: ../google_maps_flutter_ios
google_maps_flutter_platform_interface:
path: ../google_maps_flutter_platform_interface
google_maps_flutter_web:
path: ../google_maps_flutter_web
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ class FakeGoogleMapsFlutterPlatform extends GoogleMapsFlutterPlatform {
return mapEventStreamController.stream.whereType<MapTapEvent>();
}

@override
Stream<MapPoiTapEvent> onPoiTap({required int mapId}) {
return mapEventStreamController.stream.whereType<MapPoiTapEvent>();
}

@override
Stream<MapLongPressEvent> onLongPress({required int mapId}) {
return mapEventStreamController.stream.whereType<MapLongPressEvent>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,4 +659,39 @@ void main() {

expect(map.tileOverlaySets.length, 1);
});

testWidgets('onPoiTap callback is called', (WidgetTester tester) async {
PointOfInterest? tappedPoi;
final mapCreatedCompleter = Completer<void>();

await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
initialCameraPosition: const CameraPosition(target: LatLng(0, 0)),
onPoiTap: (PointOfInterest poi) => tappedPoi = poi,
onMapCreated: (_) => mapCreatedCompleter.complete(),
),
),
);

// Wait for the map to be fully initialized in the fake platform.
await mapCreatedCompleter.future;

// Use the top-level 'platform' variable instead of redeclaring it.
const poi = PointOfInterest(
position: LatLng(10.0, 10.0),
placeId: 'test_id_123',
);

// Inject the event into the fake platform's stream.
// mapId 0 is used as it's the first map created in the test.
platform.mapEventStreamController.add(MapPoiTapEvent(0, poi));

// Allow the stream and callback to process.
await tester.pump();

expect(tappedPoi, poi);
expect(tappedPoi!.placeId, 'test_id_123');
});
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.19.0

* Implements `onPoiTap` support for Android using `OnPoiClickListener`.

## 2.18.12

* Bumps com.google.maps.android:android-maps-utils from 3.20.1 to 4.0.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.MapStyleOptions;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.PointOfInterest;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.TileOverlay;
Expand Down Expand Up @@ -67,6 +68,7 @@ class GoogleMapController
MapsApi,
MapsInspectorApi,
OnMapReadyCallback,
GoogleMap.OnPoiClickListener,
PlatformView {

private static final String TAG = "GoogleMapController";
Expand Down Expand Up @@ -200,6 +202,7 @@ public void onMapReady(@NonNull GoogleMap googleMap) {
this.googleMap.setIndoorEnabled(this.indoorEnabled);
this.googleMap.setTrafficEnabled(this.trafficEnabled);
this.googleMap.setBuildingsEnabled(this.buildingsEnabled);
this.googleMap.setOnPoiClickListener(this);
installInvalidator();
if (mapReadyResult != null) {
mapReadyResult.success();
Expand Down Expand Up @@ -363,6 +366,17 @@ public void onMarkerDragEnd(Marker marker) {
markersController.onMarkerDragEnd(marker.getId(), marker.getPosition());
}

@Override
public void onPoiClick(PointOfInterest poi) {
Messages.PlatformPointOfInterest platformPoi =
new Messages.PlatformPointOfInterest.Builder()
.setPosition(Convert.latLngToPigeon(poi.latLng))
.setPlaceId(poi.placeId)
.build();

flutterApi.onPoiTap(platformPoi, new NoOpVoidResult());
}

@Override
public void onPolygonClick(Polygon polygon) {
polygonsController.onPolygonTap(polygon.getId());
Expand Down
Loading