Skip to content

Update examples to Standard style #988

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion example/lib/animated_route_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class AnimatedRouteExampleState extends State<AnimatedRouteExample>
setLocationComponent();
refreshTrackLocation();
refreshCarAnnotations();
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
}

@override
Expand Down Expand Up @@ -102,7 +103,7 @@ class AnimatedRouteExampleState extends State<AnimatedRouteExample>
body: MapWidget(
key: const ValueKey("mapWidget"),
cameraOptions: CameraOptions(zoom: 3.0),
styleUri: MapboxStyles.LIGHT,
styleUri: MapboxStyles.STANDARD,
textureView: true,
onMapCreated: _onMapCreated,
onStyleLoadedListener: _onStyleLoadedCallback,
Expand Down
8 changes: 4 additions & 4 deletions example/lib/full_map_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FullMapExampleState extends State<FullMapExample> {

_onMapCreated(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.style;
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
}

_onStyleLoadedCallback(StyleLoadedEventData data) {
Expand Down Expand Up @@ -99,9 +99,9 @@ class FullMapExampleState extends State<FullMapExample> {
() => isLight = !isLight,
);
if (isLight) {
mapboxMap?.loadStyleURI(MapboxStyles.LIGHT);
mapboxMap?.style.setStyleImportConfigProperty("basemap", "lightPreset", "day");
} else {
mapboxMap?.loadStyleURI(MapboxStyles.DARK);
mapboxMap?.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
}
}),
SizedBox(height: 10),
Expand All @@ -117,7 +117,7 @@ class FullMapExampleState extends State<FullMapExample> {
43.70908256335716,
)),
zoom: 3.0),
styleUri: MapboxStyles.LIGHT,
styleUri: MapboxStyles.STANDARD,
textureView: true,
onMapCreated: _onMapCreated,
onStyleLoadedListener: _onStyleLoadedCallback,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/geojson_line_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class DrawGeoJsonLineExampleState extends State<DrawGeoJsonLineExample> {
return new Scaffold(
body: MapWidget(
key: ValueKey("mapWidget"),
styleUri: MapboxStyles.MAPBOX_STREETS,
styleUri: MapboxStyles.STANDARD,
cameraOptions: CameraOptions(
center: Point(coordinates: Position(-122.486052, 37.830348)),
zoom: 14.0),
Expand Down
8 changes: 6 additions & 2 deletions example/lib/image_source_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ class ImageSourceExample extends StatefulWidget implements Example {

class ImageSourceExampleState extends State<ImageSourceExample> {
MapboxMap? mapboxMap;
var isLight = true;

_onMapCreated(MapboxMap mapboxMap) async {
this.mapboxMap = mapboxMap;
mapboxMap.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
}

_onStyleLoaded(StyleLoadedEventData data) async {
Expand All @@ -37,6 +38,9 @@ class ImageSourceExampleState extends State<ImageSourceExample> {
await mapboxMap?.style.addLayer(RasterLayer(
id: "image_layer-id",
sourceId: "image_source-id",
// `LightPreset`s are applied to all layers of the map.
// As `night` is applied we need to set `rasterEmissiveStrength` to color the image
rasterEmissiveStrength: 1.0,
));
var imageSource =
await mapboxMap?.style.getSource("image_source-id") as ImageSource;
Expand All @@ -50,7 +54,7 @@ class ImageSourceExampleState extends State<ImageSourceExample> {
return new Scaffold(
body: MapWidget(
key: ValueKey("mapWidget"),
styleUri: MapboxStyles.DARK,
styleUri: MapboxStyles.STANDARD,
cameraOptions: CameraOptions(
center: Point(coordinates: Position(-80.1263, 25.7845)), zoom: 12.0),
onMapCreated: _onMapCreated,
Expand Down
8 changes: 4 additions & 4 deletions example/lib/offline_map_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
// Note this will not remove the downloaded style pack, instead, it will
// just mark the resources as not a part of the existing style pack. The
// resources still exists in the disk cache.
await _offlineManager?.removeStylePack(MapboxStyles.SATELLITE_STREETS);
await _offlineManager?.removeStylePack(MapboxStyles.STANDARD_SATELLITE);
}

_downloadStylePack() async {
Expand All @@ -65,7 +65,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
metadata: {"tag": "test"},
acceptExpired: false);
_offlineManager?.loadStylePack(
MapboxStyles.SATELLITE_STREETS, stylePackLoadOptions, (progress) {
MapboxStyles.STANDARD_SATELLITE, stylePackLoadOptions, (progress) {
final percentage =
progress.completedResourceCount / progress.requiredResourceCount;
if (!_stylePackProgress.isClosed) {
Expand All @@ -84,7 +84,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
// If you are using a raster tileset you may need to set a different pixelRatio.
// The default is UIScreen.main.scale on iOS and displayMetrics's density on Android.
TilesetDescriptorOptions(
styleURI: MapboxStyles.SATELLITE_STREETS, minZoom: 0, maxZoom: 16)
styleURI: MapboxStyles.STANDARD_SATELLITE, minZoom: 0, maxZoom: 16)
],
acceptExpired: true,
networkRestriction: NetworkRestriction.NONE);
Expand Down Expand Up @@ -129,7 +129,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
if (snapshot.hasData) {
return MapWidget(
key: ValueKey("mapWidget"),
styleUri: MapboxStyles.SATELLITE_STREETS,
styleUri: MapboxStyles.STANDARD_SATELLITE,
cameraOptions:
CameraOptions(center: City.helsinki, zoom: 12.0),
);
Expand Down
4 changes: 3 additions & 1 deletion example/lib/snapshotter_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class SnapshotterExampleState extends State<SnapshotterExample> {
size: Size(width: 400, height: 400),
pixelRatio: MediaQuery.of(context).devicePixelRatio),
);
await _snapshotter?.style.setStyleURI(MapboxStyles.OUTDOORS);
await _snapshotter?.style.setStyleURI(MapboxStyles.STANDARD);
await _snapshotter?.style.setStyleImportConfigProperty("basemap", "theme", "faded");
await _snapshotter?.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
}

_onMapIdle(MapIdleEventData data) async {
Expand Down
9 changes: 5 additions & 4 deletions example/lib/vector_tile_source_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ class VectorTileSourceExampleState extends State<VectorTileSourceExample> {

_onMapCreated(MapboxMap mapboxMap) async {
this.mapboxMap = mapboxMap;
mapboxMap.style.setStyleImportConfigProperty("basemap", "lightPreset", "day");
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
}

_onStyleLoadedCallback(StyleLoadedEventData data) async {
await mapboxMap?.style.addSource(VectorSource(
id: "terrain-data", url: "mapbox://mapbox.mapbox-terrain-v2"));
await mapboxMap?.style.addLayerAt(
await mapboxMap?.style.addLayer(
LineLayer(
id: "terrain-data",
sourceId: "terrain-data",
sourceLayer: "contour",
lineJoin: LineJoin.ROUND,
lineCap: LineCap.ROUND,
lineColor: Colors.red.value,
lineWidth: 1.9),
LayerPosition(above: "country-label"));
lineWidth: 1.9));
}

@override
Widget build(BuildContext context) {
return new Scaffold(
body: MapWidget(
key: ValueKey("mapWidget"),
styleUri: MapboxStyles.LIGHT,
styleUri: MapboxStyles.STANDARD,
cameraOptions: CameraOptions(
center: Point(coordinates: Position(-122.447303, 37.753574)),
zoom: 13.0),
Expand Down