-
Notifications
You must be signed in to change notification settings - Fork 7
/
multidata.dart
63 lines (59 loc) · 1.63 KB
/
multidata.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import 'package:flutter/material.dart';
import 'package:universe/universe.dart';
class MarkerData {
final String name;
final String description;
MarkerData({
required this.name,
required this.description,
});
}
class MultiMarkerWithDataMap extends StatelessWidget {
const MultiMarkerWithDataMap({super.key});
@override
Widget build(BuildContext context) {
return U.OpenStreetMap(
center: [51.555158, -0.108343],
zoom: 16,
// multiple markers with different styles
markers: U.MarkerLayer(
[
// default
U.Marker([51.555158, -0.108343], data: 'Arsenal'),
// marker icon
U.Marker(
[51.558374, -0.107398],
widget: const MarkerIcon(
icon: Icons.location_on,
color: Colors.red,
),
data: 'Arsenal #1',
),
// marker svg
U.Marker(
[51.556674, -0.106215],
widget: const MarkerSvg('assets/marker.svg', color: Colors.pink),
data: 'Arsenal #2',
),
// marker custom widget
U.Marker(
[51.556669, -0.108123],
widget: const Column(
children: [
Text('ARS'),
Icon(Icons.location_on, color: Colors.red, size: 24)
],
),
data: 'Arsenal #3',
),
],
onTap: (latlng, data) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Data: $data'),
));
},
),
);
}
}