From 21b7796dfd5bfee56e17739911cd60a417bcfebb Mon Sep 17 00:00:00 2001 From: Matias Dahlin Holst Date: Thu, 28 Nov 2024 14:21:16 +0000 Subject: [PATCH] Pushing version 4.0.0 --- CHANGELOG.md | 19 +++++++++++++++++++ README.md | 11 ++++++----- example/.gitignore | 2 +- example/pubspec.yaml | 7 ------- lib/core/mapsindoors_widget.dart | 8 ++++++-- lib/core/mp_directions_renderer.dart | 2 +- lib/core/mp_directions_service.dart | 5 ----- lib/core/mp_map_label_font.dart | 2 +- pubspec.yaml | 8 ++++---- 9 files changed, 38 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f338f04..3cf91f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.0.0 + +See the [migration guide](https://docs.mapsindoors.com/sdks-and-frameworks/flutter/migration-guide). + +### Added + +* Added `initialCameraPosition: MPCameraPosition` to the `MapWidget` constructor. If set, the initial position of the camera will be moved to the given `MPCameraPosition`. + +### Changed + +* Changed all uses of color `Strings` to use `dart:ui` `Color` instead. +* Updated Mapsindoors SDKs: + * Android to 4.9.0 + * iOS to 4.7.0 + +### Removed + + * `DirectionsService` `ClearWayType` has been removed, use `ClearAvoidWayType` instead. + ## 3.1.3 ### Fixed diff --git a/README.md b/README.md index 1c17257..6949cfd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A federated Flutter plugin for integrating with the native MapsIndoors SDK. | Platform | Android | iOS | | ------------ | ------- | ----- | -| **Supports** | SDK 21+ | 13.0+ | +| **Supports** | SDK 21+ | 14.0+ | ## Features @@ -21,7 +21,7 @@ This plugin is based on the MapsIndoors V4 SDK for Android and iOS. Add MapsIndoors to your `pubspec.yaml`. ```yaml -mapsindoors_mapbox: ^3.0.0 +mapsindoors_mapbox: ^4.0.0 ``` ### Android @@ -149,6 +149,8 @@ class MapWidgetState extends State { child: _mapController = MapsIndoorsWidget( // build with the default floor selector, this is optional. floorSelector: _floorSelectorWidget, + // set an optional starting location for the camera, this starts the camera above Los Angeles + initialCameraPosition: MPCameraPosition(zoom: 7, MPPoint.withCoordinates(longitude: -118.0165, latitude: 33.9457)) readyListener: _mapControlReadyListener, ), ), @@ -235,7 +237,7 @@ The `hideLocationsByDefault()` method hides all markers that are not explicitly The `showLocationsByDefault()` method ensures all markers are shown by setting the main display rule to visible. -The `changeTypePolygonColor(String type, String color)` method changes the fill color for all polygons belonging to a specific type. It gets the display rule for the specified type using `getDisplayRuleByName`, and sets the fill color using `setPolygonFillColor`. +The `changeTypePolygonColor(String type, Color color)` method changes the fill color for all polygons belonging to a specific type. It gets the display rule for the specified type using `getDisplayRuleByName`, and sets the fill color using `setPolygonFillColor`. These methods can all be used to customize the display of markers and polygons on the map. @@ -255,8 +257,7 @@ void showLocationsByDefault() async { } ​ /// This method changes the fill color for all polygons belonging to a specific [type] -/// the [color] MUST be a valid hex color string. -void changeTypePolygonColor(String type, String color) async { +void changeTypePolygonColor(String type, Color color) async { final MPDisplayRule? rule = await getDisplayRuleByName(type); rule?.setPolygonFillColor(color); } diff --git a/example/.gitignore b/example/.gitignore index 24476c5..4314849 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -41,4 +41,4 @@ app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile -/android/app/release +/android/app/release \ No newline at end of file diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e02d130..43637da 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -30,13 +30,6 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 -dependency_overrides: - mapsindoors_mapbox_android: - path: ../../mapsindoors_mapbox_android - mapsindoors_mapbox_ios: - path: ../../mapsindoors_mapbox_ios - mapsindoors_platform_interface: - path: ../../../misdkfl-platform dev_dependencies: integration_test: diff --git a/lib/core/mapsindoors_widget.dart b/lib/core/mapsindoors_widget.dart index 5b62d94..afb5e15 100644 --- a/lib/core/mapsindoors_widget.dart +++ b/lib/core/mapsindoors_widget.dart @@ -15,6 +15,7 @@ class MapsIndoorsWidget extends UniqueWidget { final Alignment? floorSelectorAlignment; final bool useDefaultMapsIndoorsStyle; final OnMapReadyListener? readyListener; + final MPCameraPosition? initialCameraPosition; /// Build the widget, MapsIndoors currently supports the following platforms: /// * Android @@ -36,6 +37,7 @@ class MapsIndoorsWidget extends UniqueWidget { this.floorSelector, this.floorSelectorAlignment, this.readyListener, + this.initialCameraPosition, this.useDefaultMapsIndoorsStyle = true, }) : super(key: const GlobalObjectKey(MapsIndoorsWidget)) { if (readyListener != null) { @@ -350,7 +352,7 @@ class MapsIndoorsWidget extends UniqueWidget { /// /// If any value is null, the corresponding field will not be updated. Future setLabelOptions( - {num? textSize, String? color, bool showHalo = false}) { + {num? textSize, Color? color, bool showHalo = false}) { return MapcontrolPlatform.instance .setLabelOptions(textSize, color, showHalo); } @@ -401,7 +403,9 @@ class _MapsIndoorsState extends State { "useDefaultMapsIndoorsStyle": widget.useDefaultMapsIndoorsStyle, }), "floorSelectorAutoFloorChange": - widget.floorSelector?.isAutoFloorChangeEnabled == true + widget.floorSelector?.isAutoFloorChangeEnabled == true, + "initialCameraPosition": + jsonEncode(widget.initialCameraPosition?.toJson()), }; final floorSelector = widget.floorSelector ?? MPDefaultFloorSelector(); diff --git a/lib/core/mp_directions_renderer.dart b/lib/core/mp_directions_renderer.dart index 684fe3c..71b9a67 100644 --- a/lib/core/mp_directions_renderer.dart +++ b/lib/core/mp_directions_renderer.dart @@ -33,7 +33,7 @@ class MPDirectionsRenderer { .setAnimatedPolyline(animated, repeating, durationMs); /// Set the colors of the polyline - Future setPolyLineColors(String foreground, String background) => + Future setPolyLineColors(Color foreground, Color background) => DirectionsRendererPlatform.instance .setPolyLineColors(foreground, background); diff --git a/lib/core/mp_directions_service.dart b/lib/core/mp_directions_service.dart index a7b6aa8..4c7bf27 100644 --- a/lib/core/mp_directions_service.dart +++ b/lib/core/mp_directions_service.dart @@ -31,11 +31,6 @@ class MPDirectionsService { Future addExcludeWayType(String avoidWayType) => DirectionsServicePlatform.instance.addExcludeWayType(avoidWayType); - /// Clears all added avoidWayTypes - @Deprecated("Deprecated since 4.3.0. Use clearAvoidWayType() instead") - Future clearWayType() => - DirectionsServicePlatform.instance.clearAvoidWayType(); - /// Clears all added avoidWayTypes Future clearAvoidWayType() => DirectionsServicePlatform.instance.clearAvoidWayType(); diff --git a/lib/core/mp_map_label_font.dart b/lib/core/mp_map_label_font.dart index afdaa2d..be83a30 100644 --- a/lib/core/mp_map_label_font.dart +++ b/lib/core/mp_map_label_font.dart @@ -2,7 +2,7 @@ part of '../mapsindoors.dart'; class MPMapLabelFont { final String typeface; - final String color; + final Color color; final bool showHalo; const MPMapLabelFont({ required this.typeface, diff --git a/pubspec.yaml b/pubspec.yaml index ca279a9..0ea775e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mapsindoors_mapbox description: A MapsIndoors flutter plugin using the Mapbox platform for Android and iOS app usage. -version: 3.1.3 +version: 4.0.0 repository: https://github.com/MapsPeople/mapsindoors_flutter_mapbox homepage: https://www.mapsindoors.com/ @@ -19,9 +19,9 @@ flutter: dependencies: flutter: sdk: flutter - mapsindoors_mapbox_android: ^3.1.3 - mapsindoors_mapbox_ios: ^3.1.3 - mapsindoors_platform_interface: ^3.1.3 + mapsindoors_mapbox_android: ^4.0.0 + mapsindoors_mapbox_ios: ^4.0.0 + mapsindoors_platform_interface: ^4.0.0 dev_dependencies: