From dfc95c6d6c01141ef842337adedb28294e4e23c2 Mon Sep 17 00:00:00 2001 From: Max Peters Date: Mon, 29 Apr 2024 22:18:33 +0200 Subject: [PATCH 1/3] Run ./am deps --- example/ios/Podfile.lock | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- example/pubspec.lock | 56 +++++++++++++------ 4 files changed, 43 insertions(+), 19 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 90b8570f9..150040d06 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -36,4 +36,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b -COCOAPODS: 1.12.1 +COCOAPODS: 1.15.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 86f54661d..7ef472d80 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -157,7 +157,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a6b826db2..c87d15a33 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =3.2.0-194.0.dev <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" From ec31fc16528f281f811e987ece2de0f61b01b7b8 Mon Sep 17 00:00:00 2001 From: Max Peters Date: Mon, 29 Apr 2024 22:25:34 +0200 Subject: [PATCH 2/3] Create Feature Layer --- example/lib/main.dart | 59 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index dc5e48b1f..235775f21 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -42,7 +42,10 @@ class _ExampleMapState extends State { final LatLng _firstPinCoordinates = const LatLng(52.9, 13.2); static const String _pinId2 = '456'; final LatLng _secondPinCoordinates = const LatLng(51, 11); + static const String _pinFeatureId = '789'; + final LatLng _pinFeatureCoordinates = const LatLng(50.945, 6.965); static const String _pinLayerId = 'PinLayer'; + static const String _featureLayerId = 'FeatureLayer'; static const String _polygon1 = 'polygon1'; static const String _polygon2 = 'polygon2'; static const String _polyLayerId = 'PolygonLayer'; @@ -61,6 +64,7 @@ class _ExampleMapState extends State { bool _subscribedToBounds = false; bool _isFirstPinInView = false; bool _isSecondPinInView = false; + bool _isFeatureInView = false; bool _subscribedToCenterPosition = false; bool _subscribedToGraphicsInView = false; bool _subscribedToZoom = false; @@ -124,6 +128,10 @@ class _ExampleMapState extends State { elevationMode: ElevationMode.onTheGround, ); + await _createFeatureLayer( + layerId: _featureLayerId, + ); + // Create GraphicsLayer with Lines await _createGraphicLayer( layerId: _lineLayerId, @@ -327,6 +335,24 @@ class _ExampleMapState extends State { _controller?.removeGraphic(layerId: layerId, objectId: objectId); } + Future _createFeatureLayer({ + required String layerId, + }) async { + final layer = await _controller?.addFeatureLayer( + layerId: layerId, + options: FeatureLayerOptions( + fields: [ + Field(name: 'oid', type: 'oid'), + Field(name: 'id', type: 'string'), + Field(name: 'family', type: 'string'), + Field(name: 'name', type: 'string'), + ], + symbol: _markerSymbol, + ), + ); + return layer; + } + void _makePolylineVisible({required List points}) { _controller?.moveCameraToPoints( points: points, @@ -568,9 +594,36 @@ class _ExampleMapState extends State { }); } }, - child: _isSecondPinInView - ? const Text('Remove second Pin') - : const Text('Add second Pin'), + child: _isSecondPinInView ? const Text('Remove second Pin') : const Text('Add second Pin'), + ), + ElevatedButton( + onPressed: () { + if (_isFeatureInView) { + _removeGraphic( + layerId: _featureLayerId, + objectId: _pinFeatureId, + ); + setState(() { + _isFeatureInView = false; + }); + } else { + _addPin( + layerId: _featureLayerId, + objectId: _pinFeatureId, + location: _pinFeatureCoordinates, + ); + _controller?.moveCamera( + point: _pinFeatureCoordinates, + zoomLevel: 15, + ); + setState(() { + _isFeatureInView = true; + }); + } + }, + child: _isFeatureInView + ? const Text('Remove FeatureLayer Pin') + : const Text('Add FeatureLayer Pin'), ), ElevatedButton( onPressed: () { From 64db5331501b0cd9d944f90ec15c66133ac3fe87 Mon Sep 17 00:00:00 2001 From: Max Peters Date: Mon, 29 Apr 2024 22:36:23 +0200 Subject: [PATCH 3/3] run format --- example/lib/main.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 235775f21..974d76279 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -594,7 +594,9 @@ class _ExampleMapState extends State { }); } }, - child: _isSecondPinInView ? const Text('Remove second Pin') : const Text('Add second Pin'), + child: _isSecondPinInView + ? const Text('Remove second Pin') + : const Text('Add second Pin'), ), ElevatedButton( onPressed: () {