From 76d56ca7b91e6e026321474343ae64467b710336 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 10 Jun 2019 23:09:38 +0300 Subject: [PATCH 01/29] Adds support for holes in polygon overlays to the Google Maps plugin --- packages/google_maps_flutter/CHANGELOG.md | 4 ++ .../flutter/plugins/googlemaps/Convert.java | 14 +++++ .../plugins/googlemaps/PolygonBuilder.java | 7 +++ .../plugins/googlemaps/PolygonController.java | 4 ++ .../googlemaps/PolygonOptionsSink.java | 2 + .../example/lib/place_polygon.dart | 53 +++++++++++++++++++ .../ios/Classes/GoogleMapPolygonController.h | 1 + .../ios/Classes/GoogleMapPolygonController.m | 22 ++++++++ .../ios/Classes/JsonConversions.h | 1 + .../ios/Classes/JsonConversions.m | 10 ++++ .../google_maps_flutter/lib/src/polygon.dart | 24 +++++++++ packages/google_maps_flutter/pubspec.yaml | 2 +- 12 files changed, 143 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index f38d7f161cd9..17c581472efc 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.17 + +* Add support for holes in Polygons + ## 0.5.16 * Add support for custom map styling. diff --git a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index b8775b97cf55..51cfcca073ab 100644 --- a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -407,6 +407,10 @@ static String interpretPolygonOptions(Object o, PolygonOptionsSink sink) { if (points != null) { sink.setPoints(toPoints(points)); } + final Object holes = data.get("holes"); + if (holes != null) { + sink.setHoles(toHoles(holes)); + } final String polygonId = (String) data.get("polygonId"); if (polygonId == null) { throw new IllegalArgumentException("polygonId was null"); @@ -522,6 +526,16 @@ private static List toPoints(Object o) { return points; } + private static List> toHoles(Object o) { + final List data = toList(o); + final List> holes = new ArrayList<>(data.size()); + + for (Object ob : data) { + holes.add(toPoints(ob)); + } + return holes; + } + private static List toPattern(Object o) { final List data = toList(o); diff --git a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java index 68c35864b08c..3284ec878c0b 100644 --- a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java +++ b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java @@ -35,6 +35,13 @@ public void setPoints(List points) { polygonOptions.addAll(points); } + @Override + public void setHoles(List> holes) { + for (List hole : holes) { + polygonOptions.addHole(hole); + } + } + @Override public void setConsumeTapEvents(boolean consumeTapEvents) { this.consumeTapEvents = consumeTapEvents; diff --git a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonController.java b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonController.java index d77c86922fd5..7d434a0a4abf 100644 --- a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonController.java +++ b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonController.java @@ -46,6 +46,10 @@ public void setPoints(List points) { polygon.setPoints(points); } + public void setHoles(List> holes) { + polygon.setHoles(holes); + } + @Override public void setVisible(boolean visible) { polygon.setVisible(visible); diff --git a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonOptionsSink.java b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonOptionsSink.java index 7abbcfaa634e..0b357e87b112 100644 --- a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonOptionsSink.java +++ b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/PolygonOptionsSink.java @@ -16,6 +16,8 @@ interface PolygonOptionsSink { void setPoints(List points); + void setHoles(List> holes); + void setVisible(boolean visible); void setStrokeWidth(float width); diff --git a/packages/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/example/lib/place_polygon.dart index 1e48dfe789f1..b0dbbfe9d77f 100644 --- a/packages/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/example/lib/place_polygon.dart @@ -138,6 +138,22 @@ class PlacePolygonBodyState extends State { }); } + void _addHoles() { + final Polygon polygon = polygons[selectedPolygon]; + setState(() { + polygons[selectedPolygon] = polygon.copyWith(holesParam: _createHoles()); + }); + } + + void _removeHoles() { + final Polygon polygon = polygons[selectedPolygon]; + setState(() { + polygons[selectedPolygon] = polygon.copyWith( + holesParam: >[], + ); + }); + } + @override Widget build(BuildContext context) { return Column( @@ -190,6 +206,22 @@ class PlacePolygonBodyState extends State { ), Column( children: [ + FlatButton( + child: const Text('add holes'), + onPressed: (selectedPolygon == null) + ? null + : ((polygons[selectedPolygon].holes.isNotEmpty) + ? null + : _addHoles), + ), + FlatButton( + child: const Text('remove holes'), + onPressed: (selectedPolygon == null) + ? null + : ((polygons[selectedPolygon].holes.isEmpty) + ? null + : _removeHoles), + ), FlatButton( child: const Text('change stroke width'), onPressed: @@ -229,6 +261,27 @@ class PlacePolygonBodyState extends State { return points; } + List> _createHoles() { + final List> holes = >[]; + final double offset = _polygonIdCounter.ceilToDouble(); + + final List hole1 = []; + hole1.add(_createLatLng(51.8395 + offset, -3.8814)); + hole1.add(_createLatLng(52.0234 + offset, -3.9914)); + hole1.add(_createLatLng(52.1351 + offset, -4.4435)); + hole1.add(_createLatLng(52.0231 + offset, -4.5829)); + holes.add(hole1); + + final List hole2 = []; + hole2.add(_createLatLng(52.2395 + offset, -3.6814)); + hole2.add(_createLatLng(52.4234 + offset, -3.7914)); + hole2.add(_createLatLng(52.5351 + offset, -4.2435)); + hole2.add(_createLatLng(52.4231 + offset, -4.3829)); + holes.add(hole2); + + return holes; + } + LatLng _createLatLng(double lat, double lng) { return LatLng(lat, lng); } diff --git a/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.h b/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.h index c7613fde5f93..eb1735d134b8 100644 --- a/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.h +++ b/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.h @@ -13,6 +13,7 @@ - (void)setStrokeColor:(UIColor*)color; - (void)setStrokeWidth:(CGFloat)width; - (void)setPoints:(NSArray*)points; +- (void)setHoles:(NSArray*>*)holes; - (void)setZIndex:(int)zIndex; @end diff --git a/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.m b/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.m index 4bc4f1780338..833393aef9e9 100644 --- a/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.m +++ b/packages/google_maps_flutter/ios/Classes/GoogleMapPolygonController.m @@ -45,6 +45,19 @@ - (void)setPoints:(NSArray*)points { } _polygon.path = path; } +- (void)setHoles:(NSArray*>*)rawHoles { + NSMutableArray* holes = [[NSMutableArray alloc] init]; + + for (NSArray* points in rawHoles) { + GMSMutablePath* path = [GMSMutablePath path]; + for (CLLocation* location in points) { + [path addCoordinate:location.coordinate]; + } + [holes addObject:path]; + } + + _polygon.holes = holes; +} - (void)setFillColor:(UIColor*)color { _polygon.fillColor = color; @@ -65,6 +78,10 @@ - (void)setStrokeWidth:(CGFloat)width { return [FLTGoogleMapJsonConversions toPoints:data]; } +static NSArray*>* ToHoles(NSArray* data) { + return [FLTGoogleMapJsonConversions toHoles:data]; +} + static UIColor* ToColor(NSNumber* data) { return [FLTGoogleMapJsonConversions toColor:data]; } static void InterpretPolygonOptions(NSDictionary* data, id sink, @@ -89,6 +106,11 @@ static void InterpretPolygonOptions(NSDictionary* data, id*)toPoints:(NSArray*)data; ++ (NSArray*>*)toHoles:(NSArray*)data; @end diff --git a/packages/google_maps_flutter/ios/Classes/JsonConversions.m b/packages/google_maps_flutter/ios/Classes/JsonConversions.m index 6381beaee8d2..829f87791a07 100644 --- a/packages/google_maps_flutter/ios/Classes/JsonConversions.m +++ b/packages/google_maps_flutter/ios/Classes/JsonConversions.m @@ -58,4 +58,14 @@ + (UIColor*)toColor:(NSNumber*)numberColor { return points; } ++ (NSArray*>*)toHoles:(NSArray*)data { + NSMutableArray*>* holes = [[[NSMutableArray alloc] init] init]; + for (unsigned i = 0; i < [data count]; i++) { + NSArray* points = [FLTGoogleMapJsonConversions toPoints:data[i]]; + [holes addObject:points]; + } + + return holes; +} + @end diff --git a/packages/google_maps_flutter/lib/src/polygon.dart b/packages/google_maps_flutter/lib/src/polygon.dart index 439a5f5403b0..c4ef49fd202e 100644 --- a/packages/google_maps_flutter/lib/src/polygon.dart +++ b/packages/google_maps_flutter/lib/src/polygon.dart @@ -36,6 +36,7 @@ class Polygon { this.fillColor = Colors.black, this.geodesic = false, this.points = const [], + this.holes = const >[], this.strokeColor = Colors.black, this.strokeWidth = 10, this.visible = true, @@ -67,6 +68,11 @@ class Polygon { /// default; to form a closed polygon, the start and end points must be the same. final List points; + /// The vertices of the holes to be cut out of polygon. + /// + /// Line segments of each points of hole are drawn inside polygon between consecutive hole points. + final List> holes; + /// True if the marker is visible. final bool visible; @@ -96,6 +102,7 @@ class Polygon { Color fillColorParam, bool geodesicParam, List pointsParam, + List> holesParam, Color strokeColorParam, int strokeWidthParam, bool visibleParam, @@ -108,6 +115,7 @@ class Polygon { fillColor: fillColorParam ?? fillColor, geodesic: geodesicParam ?? geodesic, points: pointsParam ?? points, + holes: holesParam ?? holes, strokeColor: strokeColorParam ?? strokeColor, strokeWidth: strokeWidthParam ?? strokeWidth, visible: visibleParam ?? visible, @@ -138,6 +146,10 @@ class Polygon { json['points'] = _pointsToJson(); } + if (holes != null) { + json['holes'] = _holesToJson(); + } + return json; } @@ -159,6 +171,18 @@ class Polygon { } return result; } + + dynamic _holesToJson() { + final List result = []; + for (final List hole in holes) { + final List jsonHole = []; + for (final LatLng point in hole) { + jsonHole.add(point._toJson()); + } + result.add(jsonHole); + } + return result; + } } Map _keyByPolygonId(Iterable polygons) { diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 7859843f08f6..aa97ad91cc87 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.16 +version: 0.5.17 dependencies: flutter: From 88267213bfaf32157762928c1b7fef7ab8356660 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 10 Jun 2019 23:22:32 +0300 Subject: [PATCH 02/29] Add name and contact info to the AUTHORS file --- AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index d1fc7e4fe08b..72debb9f7d36 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,4 +35,5 @@ Thomas Stockx Sarbagya Dhaubanjar Ozkan Eksi ko2ic -Jonathan Younger \ No newline at end of file +Jonathan Younger +Aleksandr Yurkovskiy From 9252dc407a1cdb48f151bde0fc809c33ae3815f2 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 17 Jun 2019 22:59:52 +0300 Subject: [PATCH 03/29] fix holes generating in example --- packages/google_maps_flutter/example/lib/place_polygon.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/example/lib/place_polygon.dart index b0dbbfe9d77f..8bf92de5cd48 100644 --- a/packages/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/example/lib/place_polygon.dart @@ -24,6 +24,7 @@ class PlacePolygonBodyState extends State { GoogleMapController controller; Map polygons = {}; + Map polygonOffsets = {}; int _polygonIdCounter = 1; PolygonId selectedPolygon; @@ -90,6 +91,7 @@ class PlacePolygonBodyState extends State { setState(() { polygons[polygonId] = polygon; + polygonOffsets[polygonId] = _polygonIdCounter.ceilToDouble(); }); } @@ -263,7 +265,7 @@ class PlacePolygonBodyState extends State { List> _createHoles() { final List> holes = >[]; - final double offset = _polygonIdCounter.ceilToDouble(); + final double offset = polygonOffsets[selectedPolygon]; final List hole1 = []; hole1.add(_createLatLng(51.8395 + offset, -3.8814)); From 1b269089da66b3988737b297d82ccb9c17ffd8df Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 17 Jun 2019 23:13:32 +0300 Subject: [PATCH 04/29] merge with upstream/master --- packages/google_maps_flutter/CHANGELOG.md | 8 ++++---- packages/google_maps_flutter/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index f6383085fd7e..c6f6df0875fd 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.18 + +* Add support for holes in Polygons + ## 0.5.17 * Add support for Padding. @@ -6,10 +10,6 @@ * Update Dart code to conform to current Dart formatter. -## 0.5.17 - -* Add support for holes in Polygons - ## 0.5.16 * Add support for custom map styling. diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index aa97ad91cc87..2f35db1b8efe 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.17 +version: 0.5.18 dependencies: flutter: From 18137c2f2cf0a75cf66565dc1100cff92174c369 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Thu, 20 Jun 2019 21:23:24 +0300 Subject: [PATCH 05/29] change version to 0.5.19 --- packages/google_maps_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 2f35db1b8efe..91f55db128e6 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.18 +version: 0.5.19 dependencies: flutter: From e86673698b83b2d99527f45625f6d0e10b4e4966 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Fri, 21 Jun 2019 23:57:11 +0300 Subject: [PATCH 06/29] change version to 0.5.20 --- packages/google_maps_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 91f55db128e6..4ca1734202af 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.19 +version: 0.5.20 dependencies: flutter: From 32ee443572bd30d5ec96f00c76d0631b0ccc6916 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Thu, 27 Jun 2019 11:38:39 +0300 Subject: [PATCH 07/29] fix format --- packages/google_maps_flutter/example/lib/main.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_maps_flutter/example/lib/main.dart b/packages/google_maps_flutter/example/lib/main.dart index c082f188ff91..79f9a090d466 100644 --- a/packages/google_maps_flutter/example/lib/main.dart +++ b/packages/google_maps_flutter/example/lib/main.dart @@ -48,10 +48,10 @@ class MapsDemo extends StatelessWidget { body: ListView.builder( itemCount: _allPages.length, itemBuilder: (_, int index) => ListTile( - leading: _allPages[index].leading, - title: Text(_allPages[index].title), - onTap: () => _pushPage(context, _allPages[index]), - ), + leading: _allPages[index].leading, + title: Text(_allPages[index].title), + onTap: () => _pushPage(context, _allPages[index]), + ), ), ); } From 5233c0dc3045b22b09b2e66be4f8bf9298c83eef Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Thu, 27 Jun 2019 12:20:51 +0300 Subject: [PATCH 08/29] fix format --- packages/google_maps_flutter/example/lib/main.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_maps_flutter/example/lib/main.dart b/packages/google_maps_flutter/example/lib/main.dart index 79f9a090d466..c082f188ff91 100644 --- a/packages/google_maps_flutter/example/lib/main.dart +++ b/packages/google_maps_flutter/example/lib/main.dart @@ -48,10 +48,10 @@ class MapsDemo extends StatelessWidget { body: ListView.builder( itemCount: _allPages.length, itemBuilder: (_, int index) => ListTile( - leading: _allPages[index].leading, - title: Text(_allPages[index].title), - onTap: () => _pushPage(context, _allPages[index]), - ), + leading: _allPages[index].leading, + title: Text(_allPages[index].title), + onTap: () => _pushPage(context, _allPages[index]), + ), ), ); } From af1c9b054a111883fec627b4a2f42acf0f43bc27 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Wed, 4 Sep 2019 18:48:41 +0300 Subject: [PATCH 09/29] add additional documentation about what is a hole --- packages/google_maps_flutter/lib/src/polygon.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/google_maps_flutter/lib/src/polygon.dart b/packages/google_maps_flutter/lib/src/polygon.dart index 05de0fdfa2e6..247ffb5d80d9 100644 --- a/packages/google_maps_flutter/lib/src/polygon.dart +++ b/packages/google_maps_flutter/lib/src/polygon.dart @@ -72,6 +72,10 @@ class Polygon { /// default; to form a closed polygon, the start and end points must be the same. final List points; + + /// To create an empty area within a polygon, you need to use holes. + /// To create the hole, the coordinates defining the hole path must be inside the polygon. + /// /// The vertices of the holes to be cut out of polygon. /// /// Line segments of each points of hole are drawn inside polygon between consecutive hole points. From c56308696985eccdd4a7ebcfa9e2f1be71d4679a Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 23 Dec 2019 19:30:42 +0300 Subject: [PATCH 10/29] fix polygon compare --- packages/google_maps_flutter/example/lib/place_polygon.dart | 4 ++-- packages/google_maps_flutter/lib/google_maps_flutter.dart | 1 + packages/google_maps_flutter/lib/src/polygon.dart | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/example/lib/place_polygon.dart index 304574af941f..e073738d72c7 100644 --- a/packages/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/example/lib/place_polygon.dart @@ -31,7 +31,7 @@ class PlacePolygonBodyState extends State { GoogleMapController controller; Map polygons = {}; Map polygonOffsets = {}; - int _polygonIdCounter = 1; + int _polygonIdCounter = 0; PolygonId selectedPolygon; // Values when toggling polygon color @@ -80,7 +80,6 @@ class PlacePolygonBodyState extends State { } final String polygonIdVal = 'polygon_id_$_polygonIdCounter'; - _polygonIdCounter++; final PolygonId polygonId = PolygonId(polygonIdVal); final Polygon polygon = Polygon( @@ -98,6 +97,7 @@ class PlacePolygonBodyState extends State { setState(() { polygons[polygonId] = polygon; polygonOffsets[polygonId] = _polygonIdCounter.ceilToDouble(); + _polygonIdCounter++; }); } diff --git a/packages/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/lib/google_maps_flutter.dart index 5f3889f7b2f1..500c6edb5aa2 100644 --- a/packages/google_maps_flutter/lib/google_maps_flutter.dart +++ b/packages/google_maps_flutter/lib/google_maps_flutter.dart @@ -12,6 +12,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:collection/collection.dart'; part 'src/bitmap.dart'; part 'src/callbacks.dart'; diff --git a/packages/google_maps_flutter/lib/src/polygon.dart b/packages/google_maps_flutter/lib/src/polygon.dart index 4f4d70d44de2..8feedf302c64 100644 --- a/packages/google_maps_flutter/lib/src/polygon.dart +++ b/packages/google_maps_flutter/lib/src/polygon.dart @@ -178,6 +178,7 @@ class Polygon { fillColor == typedOther.fillColor && geodesic == typedOther.geodesic && listEquals(points, typedOther.points) && + DeepCollectionEquality().equals(holes, typedOther.holes) && visible == typedOther.visible && strokeColor == typedOther.strokeColor && strokeWidth == typedOther.strokeWidth && From 2516df58234bfdab755bfe3d0370eda5381a2db2 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 23 Dec 2019 19:36:01 +0300 Subject: [PATCH 11/29] apply format --- packages/google_maps_flutter/lib/src/polygon.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google_maps_flutter/lib/src/polygon.dart b/packages/google_maps_flutter/lib/src/polygon.dart index 8feedf302c64..4734f74cfc80 100644 --- a/packages/google_maps_flutter/lib/src/polygon.dart +++ b/packages/google_maps_flutter/lib/src/polygon.dart @@ -74,7 +74,6 @@ class Polygon { /// default; to form a closed polygon, the start and end points must be the same. final List points; - /// To create an empty area within a polygon, you need to use holes. /// To create the hole, the coordinates defining the hole path must be inside the polygon. /// From 38ca9e9318d1a6e39959fdb410aa996ec1bbc6ce Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 23 Dec 2019 19:57:14 +0300 Subject: [PATCH 12/29] add collection package to dependencies --- packages/google_maps_flutter/pubspec.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index f29c41cf221f..8d7f950f786f 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -6,6 +6,7 @@ version: 0.5.21+15 dependencies: flutter: sdk: flutter + collection: any dev_dependencies: flutter_test: From df6610135dde940791d4dd9e81f798d87c6e2408 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 23 Dec 2019 20:01:48 +0300 Subject: [PATCH 13/29] fix version --- packages/google_maps_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 8d7f950f786f..854097c7ac89 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.21+15 +version: 0.5.22 dependencies: flutter: From c51520145f50963f59b7c6aba17b9bcd6f83bae3 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 23 Dec 2019 20:05:56 +0300 Subject: [PATCH 14/29] fix collection dependency version --- packages/google_maps_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 854097c7ac89..017366b00091 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -6,7 +6,7 @@ version: 0.5.22 dependencies: flutter: sdk: flutter - collection: any + collection: ^1.14.11 dev_dependencies: flutter_test: From d2c06dc03eab77a93b09be88835511cb29c35e17 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Fri, 21 Feb 2020 20:06:01 +0300 Subject: [PATCH 15/29] Update packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md Co-Authored-By: Chris Yang --- packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 044af6f911bc..565cbbdc23a1 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.5.24 -* Add support for holes in Polygons +* Add support for holes in Polygons. ## 0.5.23+1 From d377276fb510c605ba03290704718ac420c8219c Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Fri, 21 Feb 2020 20:20:19 +0300 Subject: [PATCH 16/29] renaming --- .../main/java/io/flutter/plugins/googlemaps/Convert.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index 0f7a7e4daec0..3e25b4df9bed 100644 --- a/packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -556,8 +556,8 @@ private static List toPoints(Object o) { final List data = toList(o); final List points = new ArrayList<>(data.size()); - for (Object ob : data) { - final List point = toList(ob); + for (Object rawPoint : data) { + final List point = toList(rawPoint); points.add(new LatLng(toFloat(point.get(0)), toFloat(point.get(1)))); } return points; @@ -567,8 +567,8 @@ private static List> toHoles(Object o) { final List data = toList(o); final List> holes = new ArrayList<>(data.size()); - for (Object ob : data) { - holes.add(toPoints(ob)); + for (Object rawHole : data) { + holes.add(toPoints(rawHole)); } return holes; } From 17b0e6f2eefcc1c85cfb59eb694d621da27d3f76 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Fri, 21 Feb 2020 20:23:13 +0300 Subject: [PATCH 17/29] add comment --- .../google_maps_flutter/example/lib/place_polygon.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart index e073738d72c7..5756318a08bd 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart @@ -97,6 +97,7 @@ class PlacePolygonBodyState extends State { setState(() { polygons[polygonId] = polygon; polygonOffsets[polygonId] = _polygonIdCounter.ceilToDouble(); + // increment _polygonIdCounter to have unique polygon id each time _polygonIdCounter++; }); } From 8d3d94f20f10197ff7bed35128bf1d7c99bb6b49 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Fri, 21 Feb 2020 20:31:36 +0300 Subject: [PATCH 18/29] use explicit return type List instead of dynamic --- .../google_maps_flutter/lib/src/polygon.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/polygon.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/polygon.dart index 4734f74cfc80..95fec3ff03b1 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/polygon.dart @@ -196,7 +196,7 @@ class Polygon { return result; } - dynamic _holesToJson() { + List _holesToJson() { final List result = []; for (final List hole in holes) { final List jsonHole = []; From a603d0097adba77293684de0062d7dd66ed99242 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sat, 2 May 2020 19:32:35 +0300 Subject: [PATCH 19/29] fix issues after merge upstream --- .../lib/src/types/polygon.dart | 3 ++- .../google_maps_flutter_platform_interface/pubspec.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart index 35c3d3889b31..1ea401665eb3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart' show listEquals, VoidCallback; import 'package:flutter/material.dart' show Color, Colors; import 'package:meta/meta.dart' show immutable, required; @@ -205,7 +206,7 @@ class Polygon { for (final List hole in holes) { final List jsonHole = []; for (final LatLng point in hole) { - jsonHole.add(point._toJson()); + jsonHole.add(point.toJson()); } result.add(jsonHole); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 346d96050166..6798481a2937 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: meta: ^1.0.5 plugin_platform_interface: ^1.0.1 stream_transform: ^1.2.0 + collection: ^1.14.12 dev_dependencies: flutter_test: From 14962720a2af7bcc0949af8cc6fd64f10d7e8a0c Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sat, 2 May 2020 23:48:49 +0300 Subject: [PATCH 20/29] fix serializing, add tests --- .../test/fake_maps_controllers.dart | 10 + .../test/polygon_updates_test.dart | 221 ++++++++++++++++-- .../lib/src/types/polygon.dart | 4 +- 3 files changed, 216 insertions(+), 19 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart index 71741c57057b..d70877e80a80 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart @@ -200,12 +200,14 @@ class FakePlatformGoogleMap { final bool visible = polygonData['visible']; final bool geodesic = polygonData['geodesic']; final List points = _deserializePoints(polygonData['points']); + final List> holes = _deserializeHoles(polygonData['holes']); result.add(Polygon( polygonId: PolygonId(polygonId), visible: visible, geodesic: geodesic, points: points, + holes: holes, )); } @@ -218,6 +220,14 @@ class FakePlatformGoogleMap { }).toList(); } + List> _deserializeHoles(List holes) { + return holes.map>((dynamic hole) { + return hole.map((dynamic list) { + return LatLng(list[0], list[1]); + }).toList(); + }).toList(); + } + void updatePolylines(Map polylineUpdates) { if (polylineUpdates == null) { return; diff --git a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart index 185c996113af..667c7d83644e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/polygon_updates_test.dart @@ -33,6 +33,29 @@ Widget _mapWithPolygons(Set polygons) { ); } +List _rectPoints({ + @required double size, + LatLng center = const LatLng(0, 0), +}) { + final halfSize = size / 2; + + return [ + LatLng(center.latitude + halfSize, center.longitude + halfSize), + LatLng(center.latitude - halfSize, center.longitude + halfSize), + LatLng(center.latitude - halfSize, center.longitude - halfSize), + LatLng(center.latitude + halfSize, center.longitude - halfSize), + ]; +} + +Polygon _polygonWithPointsAndHole(PolygonId polygonId) { + _rectPoints(size: 1); + return Polygon( + polygonId: polygonId, + points: _rectPoints(size: 1), + holes: [_rectPoints(size: 0.5)], + ); +} + void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -113,23 +136,6 @@ void main() { expect(platformGoogleMap.polygonsToAdd.isEmpty, true); }); - testWidgets("Updating a polygon", (WidgetTester tester) async { - final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1")); - final Polygon p2 = - Polygon(polygonId: PolygonId("polygon_1"), geodesic: true); - - await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); - await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p2))); - - final FakePlatformGoogleMap platformGoogleMap = - fakePlatformViewsController.lastCreatedView; - expect(platformGoogleMap.polygonsToChange.length, 1); - - final Polygon update = platformGoogleMap.polygonsToChange.first; - expect(update, equals(p2)); - expect(update.geodesic, true); - }); - testWidgets("Mutate a polygon", (WidgetTester tester) async { final Polygon p1 = Polygon( polygonId: PolygonId("polygon_1"), @@ -228,4 +234,185 @@ void main() { expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); expect(platformGoogleMap.polygonsToAdd.isEmpty, true); }); + + testWidgets('Initializing a polygon with points and hole', + (WidgetTester tester) async { + final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1")); + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + expect(platformGoogleMap.polygonsToAdd.length, 1); + + final Polygon initializedPolygon = platformGoogleMap.polygonsToAdd.first; + expect(initializedPolygon, equals(p1)); + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + expect(platformGoogleMap.polygonsToChange.isEmpty, true); + }); + + testWidgets("Adding a polygon with points and hole", + (WidgetTester tester) async { + final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1")); + final Polygon p2 = _polygonWithPointsAndHole(PolygonId("polygon_2")); + + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1, p2: p2))); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + expect(platformGoogleMap.polygonsToAdd.length, 1); + + final Polygon addedPolygon = platformGoogleMap.polygonsToAdd.first; + expect(addedPolygon, equals(p2)); + + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + + expect(platformGoogleMap.polygonsToChange.isEmpty, true); + }); + + testWidgets("Removing a polygon with points and hole", + (WidgetTester tester) async { + final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1")); + + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + await tester.pumpWidget(_mapWithPolygons(null)); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + expect(platformGoogleMap.polygonIdsToRemove.length, 1); + expect(platformGoogleMap.polygonIdsToRemove.first, equals(p1.polygonId)); + + expect(platformGoogleMap.polygonsToChange.isEmpty, true); + expect(platformGoogleMap.polygonsToAdd.isEmpty, true); + }); + + testWidgets("Updating a polygon by adding points and hole", + (WidgetTester tester) async { + final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1")); + final Polygon p2 = _polygonWithPointsAndHole(PolygonId("polygon_1")); + + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p2))); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + expect(platformGoogleMap.polygonsToChange.length, 1); + expect(platformGoogleMap.polygonsToChange.first, equals(p2)); + + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + expect(platformGoogleMap.polygonsToAdd.isEmpty, true); + }); + + testWidgets("Mutate a polygon with points and holes", + (WidgetTester tester) async { + final Polygon p1 = Polygon( + polygonId: PolygonId("polygon_1"), + points: _rectPoints(size: 1), + holes: [_rectPoints(size: 0.5)], + ); + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + + p1.points + ..clear() + ..addAll(_rectPoints(size: 2)); + p1.holes + ..clear() + ..addAll([_rectPoints(size: 1)]); + await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1))); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + expect(platformGoogleMap.polygonsToChange.length, 1); + expect(platformGoogleMap.polygonsToChange.first, equals(p1)); + + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + expect(platformGoogleMap.polygonsToAdd.isEmpty, true); + }); + + testWidgets("Multi Update polygons with points and hole", + (WidgetTester tester) async { + Polygon p1 = Polygon(polygonId: PolygonId("polygon_1")); + Polygon p2 = Polygon( + polygonId: PolygonId("polygon_2"), + points: _rectPoints(size: 2), + holes: [_rectPoints(size: 1)], + ); + final Set prev = _toSet(p1: p1, p2: p2); + p1 = Polygon(polygonId: PolygonId("polygon_1"), visible: false); + p2 = p2.copyWith( + pointsParam: _rectPoints(size: 5), + holesParam: [_rectPoints(size: 2)], + ); + final Set cur = _toSet(p1: p1, p2: p2); + + await tester.pumpWidget(_mapWithPolygons(prev)); + await tester.pumpWidget(_mapWithPolygons(cur)); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + + expect(platformGoogleMap.polygonsToChange, cur); + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + expect(platformGoogleMap.polygonsToAdd.isEmpty, true); + }); + + testWidgets("Multi Update polygons with points and hole", + (WidgetTester tester) async { + Polygon p2 = Polygon( + polygonId: PolygonId("polygon_2"), + points: _rectPoints(size: 2), + holes: [_rectPoints(size: 1)], + ); + final Polygon p3 = Polygon(polygonId: PolygonId("polygon_3")); + final Set prev = _toSet(p2: p2, p3: p3); + + // p1 is added, p2 is updated, p3 is removed. + final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1")); + p2 = p2.copyWith( + pointsParam: _rectPoints(size: 5), + holesParam: [_rectPoints(size: 3)], + ); + final Set cur = _toSet(p1: p1, p2: p2); + + await tester.pumpWidget(_mapWithPolygons(prev)); + await tester.pumpWidget(_mapWithPolygons(cur)); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + + expect(platformGoogleMap.polygonsToChange.length, 1); + expect(platformGoogleMap.polygonsToAdd.length, 1); + expect(platformGoogleMap.polygonIdsToRemove.length, 1); + + expect(platformGoogleMap.polygonsToChange.first, equals(p2)); + expect(platformGoogleMap.polygonsToAdd.first, equals(p1)); + expect(platformGoogleMap.polygonIdsToRemove.first, equals(p3.polygonId)); + }); + + testWidgets("Partial Update polygons with points and hole", + (WidgetTester tester) async { + final Polygon p1 = _polygonWithPointsAndHole(PolygonId("polygon_1")); + final Polygon p2 = Polygon(polygonId: PolygonId("polygon_2")); + Polygon p3 = Polygon( + polygonId: PolygonId("polygon_3"), + points: _rectPoints(size: 2), + holes: [_rectPoints(size: 1)], + ); + final Set prev = _toSet(p1: p1, p2: p2, p3: p3); + p3 = p3.copyWith( + pointsParam: _rectPoints(size: 5), + holesParam: [_rectPoints(size: 3)], + ); + final Set cur = _toSet(p1: p1, p2: p2, p3: p3); + + await tester.pumpWidget(_mapWithPolygons(prev)); + await tester.pumpWidget(_mapWithPolygons(cur)); + + final FakePlatformGoogleMap platformGoogleMap = + fakePlatformViewsController.lastCreatedView; + + expect(platformGoogleMap.polygonsToChange, _toSet(p3: p3)); + expect(platformGoogleMap.polygonIdsToRemove.isEmpty, true); + expect(platformGoogleMap.polygonsToAdd.isEmpty, true); + }); } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart index 1ea401665eb3..96b39157418d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart @@ -201,8 +201,8 @@ class Polygon { return result; } - List _holesToJson() { - final List result = []; + List> _holesToJson() { + final List> result = >[]; for (final List hole in holes) { final List jsonHole = []; for (final LatLng point in hole) { From 63cbca936b6b3f2113413f315932f89fbd1e6c1b Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sat, 2 May 2020 23:52:23 +0300 Subject: [PATCH 21/29] workaround for success build checks in PR --- .../google_maps_flutter/pubspec.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 82e0f3010644..58063c713333 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -7,8 +7,14 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^1.0.0 - google_maps_flutter_platform_interface: ^1.0.1 - collection: ^1.14.11 + google_maps_flutter_platform_interface: #^1.0.1 + # workaround for success build checks in PR + git: + url: git://github.com/sanekyy/plugins.git + ref: polygon_holes + path: packages/google_maps_flutter/google_maps_flutter_platform_interface + + dev_dependencies: flutter_test: From 2a8837d16d5e0c198e0a13831bf7e9180f90997c Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sun, 3 May 2020 10:36:06 +0300 Subject: [PATCH 22/29] cleanup --- .../google_maps_flutter/lib/google_maps_flutter.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart index 4a0ad9434850..c05151262ef6 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart @@ -12,8 +12,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:collection/collection.dart'; - import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; import 'package:google_maps_flutter_platform_interface/src/method_channel/method_channel_google_maps_flutter.dart'; @@ -46,4 +44,5 @@ export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf ScreenCoordinate; part 'src/controller.dart'; + part 'src/google_map.dart'; From fedafd7a4e1364ed8d99decac1a444c2df60e643 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sun, 3 May 2020 10:37:23 +0300 Subject: [PATCH 23/29] bump google_maps_flutter_platform_interface version --- packages/google_maps_flutter/google_maps_flutter/pubspec.yaml | 2 +- .../google_maps_flutter_platform_interface/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 58063c713333..b31c703ab890 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -7,7 +7,7 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^1.0.0 - google_maps_flutter_platform_interface: #^1.0.1 + google_maps_flutter_platform_interface: #^1.0.2 # workaround for success build checks in PR git: url: git://github.com/sanekyy/plugins.git diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 6798481a2937..e40ea47b4853 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the google_maps_flutter plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter_platform_interface # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 1.0.1 +version: 1.0.2 dependencies: flutter: From 33e926e28437fb7b7a28fdec07401024783cc508 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Sun, 3 May 2020 12:57:39 +0300 Subject: [PATCH 24/29] fix collection package version --- .../google_maps_flutter_platform_interface/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index e40ea47b4853..476ac975be66 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: meta: ^1.0.5 plugin_platform_interface: ^1.0.1 stream_transform: ^1.2.0 - collection: ^1.14.12 + collection: ^1.14.11 dev_dependencies: flutter_test: From b082a4101985787bef98814cd66c42628a9e1d17 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Thu, 13 Aug 2020 22:50:41 +0300 Subject: [PATCH 25/29] fix merge issues --- .../google_maps_flutter/google_maps_flutter/pubspec.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index b1a1c8ca9e7b..2e6b36bdd9f9 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -26,12 +26,7 @@ dev_dependencies: sdk: flutter test: ^1.6.0 pedantic: ^1.8.0 - plugin_platform_interface: #^1.0.5 - # workaround for success build checks in PR - git: - url: git://github.com/sanekyy/plugins.git - ref: polygon_holes - path: packages/google_maps_flutter/google_maps_flutter_platform_interface + plugin_platform_interface: ^1.0.2 mockito: ^4.1.1 flutter: From 9802260ce7c823de69dc2b08eaa4193232a01208 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 5 Oct 2020 20:33:24 +0300 Subject: [PATCH 26/29] remove empty line --- .../google_maps_flutter/lib/google_maps_flutter.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart index d924af7a4b22..682c901f4d4a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart @@ -45,5 +45,4 @@ export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf ScreenCoordinate; part 'src/controller.dart'; - part 'src/google_map.dart'; From 7a9b266063f890cb273ba0aa1260c77ce8798c63 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Mon, 5 Oct 2020 21:23:38 +0300 Subject: [PATCH 27/29] 1.0.3 -> 1.1.0 --- packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md | 2 +- packages/google_maps_flutter/google_maps_flutter/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 614fa1760c80..52e63deee44b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.0.3 +## 1.1.0 * Add support for holes in Polygons. diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index bc65d2ea78cc..69a5d212c743 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter -version: 1.0.3 +version: 1.1.0 dependencies: flutter: From a5e6a5c966a6be03b138261d2a76e0fa6ad2c8d4 Mon Sep 17 00:00:00 2001 From: Aleksandr Yurkovskiy Date: Wed, 13 Jan 2021 17:30:37 +0300 Subject: [PATCH 28/29] bump google_maps_flutter_platform_interface version --- packages/google_maps_flutter/google_maps_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index d31baef0f0f1..c07d1899eba8 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -7,7 +7,7 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^1.0.0 - google_maps_flutter_platform_interface: ^1.0.5 + google_maps_flutter_platform_interface: ^1.1.0 dev_dependencies: flutter_test: From d1480e1988aadd1894e3a7032b940b1abfcf0b59 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 13 Jan 2021 11:28:23 -0800 Subject: [PATCH 29/29] Fix deprecated `FlatButton` --- .../google_maps_flutter/example/lib/place_polygon.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart index 95fdf15634ce..5f2a0985b1b9 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart @@ -223,7 +223,7 @@ class PlacePolygonBodyState extends State { ? null : _addHoles), ), - FlatButton( + TextButton( child: const Text('remove holes'), onPressed: (selectedPolygon == null) ? null @@ -231,7 +231,7 @@ class PlacePolygonBodyState extends State { ? null : _removeHoles), ), - FlatButton( + TextButton( child: const Text('change stroke width'), onPressed: (selectedPolygon == null) ? null : _changeWidth,