@@ -2,11 +2,7 @@ part of platform_maps_flutter;
22
33/// Text labels for a [Marker] info window.
44class InfoWindow {
5- const InfoWindow ({
6- this .title,
7- this .snippet,
8- this .onTap,
9- });
5+ const InfoWindow ({this .title, this .snippet, this .onTap, this .anchor});
106
117 /// Text labels specifying that no text is to be displayed.
128 static const InfoWindow noText = InfoWindow ();
@@ -21,18 +17,26 @@ class InfoWindow {
2117 /// A null value means no additional text.
2218 final String snippet;
2319
20+ /// The icon image point that will be the anchor of the info window when
21+ /// displayed.
22+ ///
23+ /// The image point is specified in normalized coordinates: An anchor of
24+ /// (0.0, 0.0) means the top left corner of the image. An anchor
25+ /// of (1.0, 1.0) means the bottom right corner of the image.
26+ final Offset anchor;
27+
2428 /// onTap callback for this [InfoWindow] .
2529 final VoidCallback onTap;
2630
2731 appleMaps.InfoWindow get appleMapsInfoWindow => appleMaps.InfoWindow (
28- anchor: Offset (0 , 0 ),
32+ anchor: this .anchor ?? Offset (0 , 0 ),
2933 onTap: this .onTap,
3034 snippet: this .snippet,
3135 title: this .title,
3236 );
3337
3438 googleMaps.InfoWindow get googleMapsInfoWindow => googleMaps.InfoWindow (
35- anchor: Offset (0 , 0 ),
39+ anchor: this .anchor ?? Offset (0 , 0 ),
3640 onTap: this .onTap,
3741 snippet: this .snippet,
3842 title: this .title,
@@ -43,11 +47,13 @@ class InfoWindow {
4347 InfoWindow copyWith ({
4448 String titleParam,
4549 String snippetParam,
50+ Offset anchorParam,
4651 VoidCallback onTapParam,
4752 }) {
4853 return InfoWindow (
4954 title: titleParam ?? title,
5055 snippet: snippetParam ?? snippet,
56+ anchor: anchorParam ?? anchor,
5157 onTap: onTapParam ?? onTap,
5258 );
5359 }
0 commit comments