Rumahjo-Android-APP/lib/Ui/screens/widgets/my_maps.dart

56 lines
1.4 KiB
Dart
Raw Normal View History

2024-09-07 00:58:50 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
class MyMaps extends StatelessWidget {
final String latitudeString;
final String longitudeString;
const MyMaps({
Key? key,
required this.latitudeString,
required this.longitudeString,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final LatLng location = LatLng(
double.parse(latitudeString),
double.parse(longitudeString)
);
return SafeArea(
child: Scaffold(
body: FlutterMap(
options: MapOptions(
center: location,
zoom: 17.0
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.rumahjo.vds',
),
MarkerLayer(
markers: [
Marker(
width: 45.0,
height: 45.0,
point: location,
builder: (ctx) =>
Container(
child: const Icon(
Icons.location_on,
size: 30.0,
color: Colors.red,
),
),
)
]
)
]
)
)
);
}
}