Files
absensi_sas_flutter/lib/test_flutter_map.dart
2024-01-09 09:30:42 +07:00

66 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
class TestFlutterMap extends StatefulWidget {
const TestFlutterMap({super.key});
@override
State<TestFlutterMap> createState() => _TestFlutterMapState();
}
class _TestFlutterMapState extends State<TestFlutterMap> {
late final MapController _mapController;
double _rotation = 0;
static const _london = LatLng(51.5, -0.09);
static const _paris = LatLng(48.8566, 2.3522);
static const _dublin = LatLng(53.3498, -6.2603);
static const _kantor = LatLng(-7.538761, 110.795699);
static const _markers = [
Marker(
width: 10,
height: 10,
point: _kantor,
child: FlutterLogo(
key: ValueKey('green'),
),
),
];
@override
void initState() {
super.initState();
_mapController = MapController();
}
@override
Widget build(BuildContext context) {
return FlutterMap(
mapController: _mapController,
options: MapOptions(
initialCenter: LatLng(-7.538761, 110.795699),
initialZoom: 5,
maxZoom: 20,
minZoom: 3,
),
children: [
// openStreetMapTileLayer,
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
subdomains: ['a', 'b', 'c']
// Use the recommended flutter_map_cancellable_tile_provider package to
// support the cancellation of loading tiles.
// tileProvider: ,
),
const MarkerLayer(
markers: _markers,
),
],
);
}
}