Skip to content

Commit e5c953f

Browse files
pjleonard37Release SDK bot for Maps SDK team
andauthored
Update examples to Standard style (#988)
Co-authored-by: Release SDK bot for Maps SDK team <[email protected]>
1 parent 36d172a commit e5c953f

File tree

7 files changed

+25
-17
lines changed

7 files changed

+25
-17
lines changed

example/lib/animated_route_example.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class AnimatedRouteExampleState extends State<AnimatedRouteExample>
6161
setLocationComponent();
6262
refreshTrackLocation();
6363
refreshCarAnnotations();
64+
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
6465
}
6566

6667
@override
@@ -102,7 +103,7 @@ class AnimatedRouteExampleState extends State<AnimatedRouteExample>
102103
body: MapWidget(
103104
key: const ValueKey("mapWidget"),
104105
cameraOptions: CameraOptions(zoom: 3.0),
105-
styleUri: MapboxStyles.LIGHT,
106+
styleUri: MapboxStyles.STANDARD,
106107
textureView: true,
107108
onMapCreated: _onMapCreated,
108109
onStyleLoadedListener: _onStyleLoadedCallback,

example/lib/full_map_example.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FullMapExampleState extends State<FullMapExample> {
2020

2121
_onMapCreated(MapboxMap mapboxMap) {
2222
this.mapboxMap = mapboxMap;
23-
mapboxMap.style;
23+
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
2424
}
2525

2626
_onStyleLoadedCallback(StyleLoadedEventData data) {
@@ -99,9 +99,9 @@ class FullMapExampleState extends State<FullMapExample> {
9999
() => isLight = !isLight,
100100
);
101101
if (isLight) {
102-
mapboxMap?.loadStyleURI(MapboxStyles.LIGHT);
102+
mapboxMap?.style.setStyleImportConfigProperty("basemap", "lightPreset", "day");
103103
} else {
104-
mapboxMap?.loadStyleURI(MapboxStyles.DARK);
104+
mapboxMap?.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
105105
}
106106
}),
107107
SizedBox(height: 10),
@@ -117,7 +117,7 @@ class FullMapExampleState extends State<FullMapExample> {
117117
43.70908256335716,
118118
)),
119119
zoom: 3.0),
120-
styleUri: MapboxStyles.LIGHT,
120+
styleUri: MapboxStyles.STANDARD,
121121
textureView: true,
122122
onMapCreated: _onMapCreated,
123123
onStyleLoadedListener: _onStyleLoadedCallback,

example/lib/geojson_line_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class DrawGeoJsonLineExampleState extends State<DrawGeoJsonLineExample> {
5858
return new Scaffold(
5959
body: MapWidget(
6060
key: ValueKey("mapWidget"),
61-
styleUri: MapboxStyles.MAPBOX_STREETS,
61+
styleUri: MapboxStyles.STANDARD,
6262
cameraOptions: CameraOptions(
6363
center: Point(coordinates: Position(-122.486052, 37.830348)),
6464
zoom: 14.0),

example/lib/image_source_example.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ class ImageSourceExample extends StatefulWidget implements Example {
2020

2121
class ImageSourceExampleState extends State<ImageSourceExample> {
2222
MapboxMap? mapboxMap;
23-
var isLight = true;
2423

2524
_onMapCreated(MapboxMap mapboxMap) async {
2625
this.mapboxMap = mapboxMap;
26+
mapboxMap.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
27+
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
2728
}
2829

2930
_onStyleLoaded(StyleLoadedEventData data) async {
@@ -37,6 +38,9 @@ class ImageSourceExampleState extends State<ImageSourceExample> {
3738
await mapboxMap?.style.addLayer(RasterLayer(
3839
id: "image_layer-id",
3940
sourceId: "image_source-id",
41+
// `LightPreset`s are applied to all layers of the map.
42+
// As `night` is applied we need to set `rasterEmissiveStrength` to color the image
43+
rasterEmissiveStrength: 1.0,
4044
));
4145
var imageSource =
4246
await mapboxMap?.style.getSource("image_source-id") as ImageSource;
@@ -50,7 +54,7 @@ class ImageSourceExampleState extends State<ImageSourceExample> {
5054
return new Scaffold(
5155
body: MapWidget(
5256
key: ValueKey("mapWidget"),
53-
styleUri: MapboxStyles.DARK,
57+
styleUri: MapboxStyles.STANDARD,
5458
cameraOptions: CameraOptions(
5559
center: Point(coordinates: Position(-80.1263, 25.7845)), zoom: 12.0),
5660
onMapCreated: _onMapCreated,

example/lib/offline_map_example.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
5555
// Note this will not remove the downloaded style pack, instead, it will
5656
// just mark the resources as not a part of the existing style pack. The
5757
// resources still exists in the disk cache.
58-
await _offlineManager?.removeStylePack(MapboxStyles.SATELLITE_STREETS);
58+
await _offlineManager?.removeStylePack(MapboxStyles.STANDARD_SATELLITE);
5959
}
6060

6161
_downloadStylePack() async {
@@ -65,7 +65,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
6565
metadata: {"tag": "test"},
6666
acceptExpired: false);
6767
_offlineManager?.loadStylePack(
68-
MapboxStyles.SATELLITE_STREETS, stylePackLoadOptions, (progress) {
68+
MapboxStyles.STANDARD_SATELLITE, stylePackLoadOptions, (progress) {
6969
final percentage =
7070
progress.completedResourceCount / progress.requiredResourceCount;
7171
if (!_stylePackProgress.isClosed) {
@@ -84,7 +84,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
8484
// If you are using a raster tileset you may need to set a different pixelRatio.
8585
// The default is UIScreen.main.scale on iOS and displayMetrics's density on Android.
8686
TilesetDescriptorOptions(
87-
styleURI: MapboxStyles.SATELLITE_STREETS, minZoom: 0, maxZoom: 16)
87+
styleURI: MapboxStyles.STANDARD_SATELLITE, minZoom: 0, maxZoom: 16)
8888
],
8989
acceptExpired: true,
9090
networkRestriction: NetworkRestriction.NONE);
@@ -129,7 +129,7 @@ class OfflineMapExampleState extends State<OfflineMapExample> {
129129
if (snapshot.hasData) {
130130
return MapWidget(
131131
key: ValueKey("mapWidget"),
132-
styleUri: MapboxStyles.SATELLITE_STREETS,
132+
styleUri: MapboxStyles.STANDARD_SATELLITE,
133133
cameraOptions:
134134
CameraOptions(center: City.helsinki, zoom: 12.0),
135135
);

example/lib/snapshotter_example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class SnapshotterExampleState extends State<SnapshotterExample> {
3939
size: Size(width: 400, height: 400),
4040
pixelRatio: MediaQuery.of(context).devicePixelRatio),
4141
);
42-
await _snapshotter?.style.setStyleURI(MapboxStyles.OUTDOORS);
42+
await _snapshotter?.style.setStyleURI(MapboxStyles.STANDARD);
43+
await _snapshotter?.style.setStyleImportConfigProperty("basemap", "theme", "faded");
44+
await _snapshotter?.style.setStyleImportConfigProperty("basemap", "lightPreset", "night");
4345
}
4446

4547
_onMapIdle(MapIdleEventData data) async {

example/lib/vector_tile_source_example.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,30 @@ class VectorTileSourceExampleState extends State<VectorTileSourceExample> {
2020

2121
_onMapCreated(MapboxMap mapboxMap) async {
2222
this.mapboxMap = mapboxMap;
23+
mapboxMap.style.setStyleImportConfigProperty("basemap", "lightPreset", "day");
24+
mapboxMap.style.setStyleImportConfigProperty("basemap", "theme", "monochrome");
2325
}
2426

2527
_onStyleLoadedCallback(StyleLoadedEventData data) async {
2628
await mapboxMap?.style.addSource(VectorSource(
2729
id: "terrain-data", url: "mapbox://mapbox.mapbox-terrain-v2"));
28-
await mapboxMap?.style.addLayerAt(
30+
await mapboxMap?.style.addLayer(
2931
LineLayer(
3032
id: "terrain-data",
3133
sourceId: "terrain-data",
3234
sourceLayer: "contour",
3335
lineJoin: LineJoin.ROUND,
3436
lineCap: LineCap.ROUND,
3537
lineColor: Colors.red.value,
36-
lineWidth: 1.9),
37-
LayerPosition(above: "country-label"));
38+
lineWidth: 1.9));
3839
}
3940

4041
@override
4142
Widget build(BuildContext context) {
4243
return new Scaffold(
4344
body: MapWidget(
4445
key: ValueKey("mapWidget"),
45-
styleUri: MapboxStyles.LIGHT,
46+
styleUri: MapboxStyles.STANDARD,
4647
cameraOptions: CameraOptions(
4748
center: Point(coordinates: Position(-122.447303, 37.753574)),
4849
zoom: 13.0),

0 commit comments

Comments
 (0)