97 lines
3.1 KiB
Dart
97 lines
3.1 KiB
Dart
// import 'dart:async';
|
|
//
|
|
// import 'package:flutter/material.dart';
|
|
// import 'package:flutter/services.dart';
|
|
// import 'package:flutter_map/flutter_map.dart';
|
|
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
|
// import 'package:geolocator/geolocator.dart';
|
|
// import 'package:latlong/latlong.dart';
|
|
// import 'package:map_controller/map_controller.dart';
|
|
//
|
|
// class Home extends StatefulWidget {
|
|
// const Home({Key? key}) : super(key: key);
|
|
//
|
|
//
|
|
// @override
|
|
// _HomeState createState() => _HomeState();
|
|
// }
|
|
//
|
|
// class _HomeState extends State<Home> {
|
|
//
|
|
// MapController? mapController;
|
|
// StatefulMapController? statefulMapController;
|
|
// StreamSubscription<StatefulMapControllerStateChange>? sub;
|
|
// final PopupController _popupController = PopupController();
|
|
//
|
|
// Future<void> showCurrentPosition() async {
|
|
// LocationPermission permission = await Geolocator.checkPermission();
|
|
// if(permission != LocationPermission.whileInUse || permission != LocationPermission.always ){
|
|
// permission = await Geolocator.requestPermission();
|
|
// }
|
|
// Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
|
// mapController?.move(LatLng(position.latitude, position.longitude), 14);
|
|
// }
|
|
//
|
|
// @override
|
|
// void initState() {
|
|
// mapController = MapController();
|
|
// statefulMapController = StatefulMapController(mapController: mapController);
|
|
// statefulMapController!.onReady.then((_) => loadData());
|
|
// sub = statefulMapController!.changeFeed.listen((change) => setState(() {}));
|
|
// super.initState();
|
|
// }
|
|
//
|
|
// void loadData() async {
|
|
// print("Loading geojson data");
|
|
// final data = await rootBundle.loadString('assets/3.geojson');
|
|
// await statefulMapController?.fromGeoJson(data,
|
|
// markerIcon: Icon(Icons.note), verbose: true);
|
|
// }
|
|
//
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return Scaffold(
|
|
// appBar: AppBar(
|
|
// title: Text("Rogaining"),
|
|
// actions: [
|
|
// IconButton(
|
|
// icon: const Icon(Icons.map),
|
|
// onPressed: () => {
|
|
// showCurrentPosition()
|
|
// },
|
|
// )
|
|
//
|
|
// ],
|
|
//
|
|
// // center: LatLng(7.25221960625, 80.7931815538),
|
|
// // zoom: 7.0,
|
|
//
|
|
// ),
|
|
// body: FlutterMap(
|
|
// mapController: mapController,
|
|
// options: MapOptions(
|
|
// onLongPress: (latlong) {
|
|
//
|
|
// },
|
|
// center: LatLng(37.523437479105006, 139.9073099236486),
|
|
// zoom: 6,
|
|
// maxZoom: 20,
|
|
// onTap: (latlong){} // Hide popup when the map is tapped.
|
|
// ),
|
|
// children: [
|
|
// TileLayerWidget(
|
|
// options: TileLayerOptions(
|
|
// urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
// subdomains: ['a', 'b', 'c'],
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// layers: [
|
|
// MarkerLayerOptions(markers: statefulMapController!.markers),
|
|
// ],
|
|
// ),
|
|
//
|
|
// );
|
|
// }
|
|
// }
|