forked from maplibre/flutter-maplibre-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
243-fix-crash-when-no-location-permission (maplibre#244)
This fixes maplibre#243. --------- Co-authored-by: Julian Bissekkou <julian.bissekkou@tapped.dev>
- Loading branch information
1 parent
6110d1d
commit 1fbd253
Showing
7 changed files
with
84 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:maplibre_gl/mapbox_gl.dart'; | ||
|
||
import 'page.dart'; | ||
|
||
class NoLocationPermissionPage extends ExamplePage { | ||
const NoLocationPermissionPage({super.key}) | ||
: super( | ||
const Icon(Icons.gps_off), | ||
'Using a map without user location/permission', | ||
needsLocationPermission: false, | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const NoLocationPermissionBody(); | ||
} | ||
} | ||
|
||
class NoLocationPermissionBody extends StatefulWidget { | ||
const NoLocationPermissionBody({super.key}); | ||
|
||
@override | ||
State<NoLocationPermissionBody> createState() => | ||
_NoLocationPermissionBodyState(); | ||
} | ||
|
||
class _NoLocationPermissionBodyState extends State<NoLocationPermissionBody> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaplibreMap( | ||
initialCameraPosition: const CameraPosition( | ||
target: LatLng(-33.852, 151.211), | ||
zoom: 11.0, | ||
), | ||
styleString: '''{ | ||
"version": 8, | ||
"sources": { | ||
"OSM": { | ||
"type": "raster", | ||
"tiles": [ | ||
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png", | ||
"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png", | ||
"https://c.tile.openstreetmap.org/{z}/{x}/{y}.png" | ||
], | ||
"tileSize": 256, | ||
"attribution": "© OpenStreetMap contributors", | ||
"maxzoom": 18 | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "OSM-layer", | ||
"source": "OSM", | ||
"type": "raster" | ||
} | ||
] | ||
}''', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters