Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move MaplibreStyles to maplibre_gl #435

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

### Breaking changes

* All Dart enums have been migrated from mixed cases to lower camelcase according to the `camel_case_types` lint rule.
* All Dart enums have been migrated from mixed cases to lower camelcase
according to the `camel_case_types` lint rule.
* Move `MaplibreStyles` to the main `maplibre_gl` package. You can now use the
demo style without adding `maplibre_gl_platform_interface` as a dependency.

## 0.19.0

Expand Down
5 changes: 1 addition & 4 deletions example/lib/map_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ class MapUiBodyState extends State<MapUiBody> {

// Style string can a reference to a local or remote resources.
// On Android the raw JSON can also be passed via a styleString, on iOS this is not supported.
final List<String> _styleStrings = [
"https://demotiles.maplibre.org/style.json",
"assets/style.json"
];
final List<String> _styleStrings = [MaplibreStyles.demo, "assets/style.json"];
final List<String> _styleStringLabels = [
"Maplibre demo style",
"Local style file"
Expand Down
6 changes: 3 additions & 3 deletions example/lib/offline_regions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ final List<OfflineRegionDefinition> regionDefinitions = [
bounds: hawaiiBounds,
minZoom: 3.0,
maxZoom: 8.0,
mapStyleUrl: "https://demotiles.maplibre.org/style.json",
mapStyleUrl: MaplibreStyles.demo,
),
OfflineRegionDefinition(
bounds: santiagoBounds,
minZoom: 10.0,
maxZoom: 16.0,
mapStyleUrl: "https://demotiles.maplibre.org/style.json",
mapStyleUrl: MaplibreStyles.demo,
),
OfflineRegionDefinition(
bounds: aucklandBounds,
minZoom: 13.0,
maxZoom: 16.0,
mapStyleUrl: "https://demotiles.maplibre.org/style.json",
mapStyleUrl: MaplibreStyles.demo,
),
];

Expand Down
3 changes: 1 addition & 2 deletions example/lib/sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart';

import 'page.dart';
import 'package:maplibre_gl_platform_interface/maplibre_gl_platform_interface.dart';

class StyleInfo {
final String name;
Expand Down Expand Up @@ -104,7 +103,7 @@ class FullMapState extends State<FullMap> {
await controller.addSource(
"terrain",
const VectorSourceProperties(
url: "https://demotiles.maplibre.org/tiles/tiles.json",
url: MaplibreStyles.demo,
));

await controller.addLayer(
Expand Down
1 change: 0 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
sdk: flutter

maplibre_gl: ^0.19.0
maplibre_gl_platform_interface: ^0.19.0
location: ^5.0.3
path_provider: ^2.0.15
http: ^1.1.0
Expand Down
2 changes: 2 additions & 0 deletions lib/maplibre_gl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ part 'src/color_tools.dart';
part 'src/annotation_manager.dart';

part 'src/util.dart';

part 'src/maplibre_styles.dart';
2 changes: 1 addition & 1 deletion lib/src/maplibre_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MaplibreMap extends StatefulWidget {
const MaplibreMap({
super.key,
required this.initialCameraPosition,
this.styleString = "https://demotiles.maplibre.org/style.json",
this.styleString = MaplibreStyles.demo,
this.onMapCreated,
this.onStyleLoadedCallback,
this.gestureRecognizers,
Expand Down
8 changes: 8 additions & 0 deletions lib/src/maplibre_styles.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
part of '../maplibre_gl.dart';

/// MapLibre styles used mostly for demonstration.
abstract class MaplibreStyles {
/// A very simple MapLibre demo style that shows only countries with their
/// boundaries.
static const String demo = "https://demotiles.maplibre.org/style.json";
}
5 changes: 0 additions & 5 deletions maplibre_gl_platform_interface/lib/src/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

part of '../maplibre_gl_platform_interface.dart';

class MaplibreStyles {
/// A very simple MapLibre demo style
static const String demo = "https://demotiles.maplibre.org/style.json";
}

/// The camera mode, which determines how the map camera will track the rendered location.
enum MyLocationTrackingMode {
none,
Expand Down