You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SmartFit_Mobile/lib/view/map/my_map_osm.dart

48 lines
1.3 KiB

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart' as osm;
import 'package:smartfit_app_mobile/common/colo_extension.dart';
import 'package:smartfit_app_mobile/modele/user.dart';
class MyMapOSM extends StatefulWidget {
const MyMapOSM({Key? key}) : super(key: key);
@override
State<MyMapOSM> createState() => _MyMapOSM();
}
class _MyMapOSM extends State<MyMapOSM> {
final controller = MapController();
@override
Widget build(BuildContext context) {
List<osm.LatLng> listPolynines =
context.watch<User>().managerSelectedActivity.getPositionOSM();
return Scaffold(
appBar: AppBar(
title: const Text("Carte Open Street Map "),
backgroundColor: TColor.secondaryColor1,
),
body: FlutterMap(
options: MapOptions(center: listPolynines.first),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
PolylineLayer(
polylines: [
Polyline(
points: listPolynines,
color: TColor.primaryColor1,
strokeWidth: 5.0,
),
],
),
],
),
);
}
}