Skip to content

Commit

Permalink
Merge pull request #4 from BorisGautier/dev
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
BorisGautier committed Sep 28, 2021
2 parents 094f18b + c479581 commit 2e29a0e
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 24 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
@@ -1,3 +1,5 @@
## 0.0.1
## [1.0.0-dev.1.0] - September 28, 2021

* TODO: Describe initial release.
* Update mapbox_gl plugin to mapbox_flutter plugin
* Support null safety
* migrate to flutter 2
8 changes: 7 additions & 1 deletion LICENSE
@@ -1 +1,7 @@
TODO: Add your license here.
Copyright 2021

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.TODO: Add your license here.
6 changes: 5 additions & 1 deletion README.md
@@ -1,4 +1,8 @@
# Flutter Mapbox GL
# Flutter Mapbox Flutter

This project is inspired by [Mapbox_gl](https://github.com/tobrun/flutter-mapbox-gl)

This project also integrates the Null_Safety

We welcome [feedback](https://github.com/BorisGautier/mapbox_flutter/issues) and contributions.

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Expand Up @@ -169,7 +169,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "1.0.0-dev.1.0"
mapbox_gl_dart:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion lib/mapbox_flutter_web.dart
Expand Up @@ -28,4 +28,4 @@ part 'web_src/feature_manager/line_manager.dart';
part 'web_src/feature_manager/circle_manager.dart';
part 'web_src/feature_manager/fill_manager.dart';
part 'web_src/mapbox_flutter_map_controller.dart';
part 'src/mapbox_flutter_platform_interface.dart';
part 'src/mapbox_flutter_platform_interface.dart';
32 changes: 20 additions & 12 deletions lib/src/controller.dart
Expand Up @@ -57,7 +57,9 @@ class MapboxFlutterMapController extends ChangeNotifier {
}
});

MapboxFlutterPlatfom.getInstance(_id).onSymbolTappedPlatform.add((symbolId) {
MapboxFlutterPlatfom.getInstance(_id)
.onSymbolTappedPlatform
.add((symbolId) {
final symbol = _symbols[symbolId];
if (symbol != null) {
onSymbolTapped(symbol);
Expand All @@ -71,7 +73,9 @@ class MapboxFlutterMapController extends ChangeNotifier {
}
});

MapboxFlutterPlatfom.getInstance(_id).onCircleTappedPlatform.add((circleId) {
MapboxFlutterPlatfom.getInstance(_id)
.onCircleTappedPlatform
.add((circleId) {
final circle = _circles[circleId];
if (circle != null) {
onCircleTapped(circle);
Expand Down Expand Up @@ -162,7 +166,8 @@ class MapboxFlutterMapController extends ChangeNotifier {
});
}

static MapboxFlutterMapController init(int id, CameraPosition initialCameraPosition,
static MapboxFlutterMapController init(
int id, CameraPosition initialCameraPosition,
{OnStyleLoadedCallback? onStyleLoadedCallback,
OnMapClickCallback? onMapClick,
OnUserLocationUpdated? onUserLocationUpdated,
Expand Down Expand Up @@ -269,8 +274,8 @@ class MapboxFlutterMapController extends ChangeNotifier {
///
/// The returned [Future] completes after listeners have been notified.
Future<void> _updateMapOptions(Map<String, dynamic> optionsUpdate) async {
_cameraPosition =
await MapboxFlutterPlatfom.getInstance(_id).updateMapOptions(optionsUpdate);
_cameraPosition = await MapboxFlutterPlatfom.getInstance(_id)
.updateMapOptions(optionsUpdate);
notifyListeners();
}

Expand Down Expand Up @@ -476,8 +481,8 @@ class MapboxFlutterMapController extends ChangeNotifier {
Future<Line> addLine(LineOptions options, [Map? data]) async {
final LineOptions effectiveOptions =
LineOptions.defaultOptions.copyWith(options);
final line =
await MapboxFlutterPlatfom.getInstance(_id).addLine(effectiveOptions, data);
final line = await MapboxFlutterPlatfom.getInstance(_id)
.addLine(effectiveOptions, data);
_lines[line.id] = line;
notifyListeners();
return line;
Expand Down Expand Up @@ -682,8 +687,8 @@ class MapboxFlutterMapController extends ChangeNotifier {
Future<Fill> addFill(FillOptions options, [Map? data]) async {
final FillOptions effectiveOptions =
FillOptions.defaultOptions.copyWith(options);
final fill =
await MapboxFlutterPlatfom.getInstance(_id).addFill(effectiveOptions, data);
final fill = await MapboxFlutterPlatfom.getInstance(_id)
.addFill(effectiveOptions, data);
_fills[fill.id] = fill;
notifyListeners();
return fill;
Expand Down Expand Up @@ -833,7 +838,8 @@ class MapboxFlutterMapController extends ChangeNotifier {

/// For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
Future<void> setSymbolIconAllowOverlap(bool enable) async {
await MapboxFlutterPlatfom.getInstance(_id).setSymbolIconAllowOverlap(enable);
await MapboxFlutterPlatfom.getInstance(_id)
.setSymbolIconAllowOverlap(enable);
}

/// For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
Expand All @@ -844,7 +850,8 @@ class MapboxFlutterMapController extends ChangeNotifier {

/// For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
Future<void> setSymbolTextAllowOverlap(bool enable) async {
await MapboxFlutterPlatfom.getInstance(_id).setSymbolTextAllowOverlap(enable);
await MapboxFlutterPlatfom.getInstance(_id)
.setSymbolTextAllowOverlap(enable);
}

/// For more information on what this does, see https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
Expand All @@ -862,7 +869,8 @@ class MapboxFlutterMapController extends ChangeNotifier {

/// Removes previously added image source by id
Future<void> removeImageSource(String imageSourceId) {
return MapboxFlutterPlatfom.getInstance(_id).removeImageSource(imageSourceId);
return MapboxFlutterPlatfom.getInstance(_id)
.removeImageSource(imageSourceId);
}

/// Adds a Mapbox style layer to the map's style at render time.
Expand Down
6 changes: 4 additions & 2 deletions lib/src/mapbox_flutter_map.dart
Expand Up @@ -205,7 +205,8 @@ class _MapboxFlutterMapState extends State<MapboxFlutterMap> {
Completer<MapboxFlutterMapController>();

late _MapboxMapOptions _mapboxMapOptions;
final MapboxFlutterPlatfom _mapboxGlPlatform = MapboxFlutterPlatfom.createInstance();
final MapboxFlutterPlatfom _mapboxGlPlatform =
MapboxFlutterPlatfom.createInstance();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -252,7 +253,8 @@ class _MapboxFlutterMapState extends State<MapboxFlutterMap> {

Future<void> onPlatformViewCreated(int id) async {
MapboxFlutterPlatfom.addInstance(id, _mapboxGlPlatform);
final MapboxFlutterMapController controller = MapboxFlutterMapController.init(
final MapboxFlutterMapController controller =
MapboxFlutterMapController.init(
id,
widget.initialCameraPosition,
onStyleLoadedCallback: () {
Expand Down
10 changes: 8 additions & 2 deletions lib/web_src/convert.dart
Expand Up @@ -203,7 +203,10 @@ class Convert {
properties['iconRotate'] = options.iconRotate;
}
if (options.iconOffset != null) {
properties['iconOffset'] = [options.iconOffset!.dx, options.iconOffset!.dy];
properties['iconOffset'] = [
options.iconOffset!.dx,
options.iconOffset!.dy
];
}
if (options.iconAnchor != null) {
properties['iconAnchor'] = options.iconAnchor;
Expand Down Expand Up @@ -233,7 +236,10 @@ class Convert {
properties['textTransform'] = options.textTransform;
}
if (options.textOffset != null) {
properties['textOffset'] = [options.textOffset!.dx, options.textOffset!.dy];
properties['textOffset'] = [
options.textOffset!.dx,
options.textOffset!.dy
];
}
if (options.iconOpacity != null) {
properties['iconOpacity'] = options.iconOpacity;
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
@@ -1,7 +1,7 @@
name: mapbox_flutter
description: A new flutter plugin for mapbox. You can use it for your map backgrounds inside flutter applications
version: 0.0.1
homepage:
version: 1.0.0-dev.1.0
homepage: https://github.com/BorisGautier/mapbox_flutter

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit 2e29a0e

Please sign in to comment.