Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
tlserver committed Feb 19, 2024
1 parent 4567cbf commit 814b30c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
28 changes: 17 additions & 11 deletions example/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ void main() {
class MinimumExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
center: LatLng(0, 0),
zoom: 1,
maxZoom: 19,
return Scaffold(
appBar: AppBar(
title: const Text('Minimum Example'),
),
children: [
TileLayerWidget(
options: TileLayerOptions(
body: FlutterMap(
options: const MapOptions(
initialCenter: LatLng(0, 0),
initialZoom: 1,
minZoom: 0,
maxZoom: 19,
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName:
'net.tlserver6y.flutter_map_location_marker.example',
maxZoom: 19,
),
),
LocationMarkerLayerWidget(),
],
CurrentLocationLayer(),
],
),
);
}
}
Expand Down
22 changes: 12 additions & 10 deletions example/lib/page/geolocator_settings_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';

class GeolocatorSettingsExample extends StatelessWidget {
final _positionStream =
const LocationMarkerDataStreamFactory().fromGeolocatorPositionStream(
stream: Geolocator.getPositionStream(
locationSettings: const LocationSettings(
accuracy: LocationAccuracy.medium,
distanceFilter: 50,
timeLimit: Duration(minutes: 1),
),
),
);

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -26,16 +37,7 @@ class GeolocatorSettingsExample extends StatelessWidget {
maxZoom: 19,
),
CurrentLocationLayer(
positionStream: const LocationMarkerDataStreamFactory()
.fromGeolocatorPositionStream(
stream: Geolocator.getPositionStream(
locationSettings: const LocationSettings(
accuracy: LocationAccuracy.medium,
distanceFilter: 50,
timeLimit: Duration(minutes: 1),
),
),
),
positionStream: _positionStream,
),
],
),
Expand Down

0 comments on commit 814b30c

Please sign in to comment.