-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjawg.dart
70 lines (66 loc) · 1.97 KB
/
jawg.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
64
65
66
67
68
69
70
import 'package:flutter/material.dart';
import 'package:universe/universe.dart';
import 'package:example/src/dropdown.dart';
class JawgMap extends StatefulWidget {
const JawgMap({super.key});
@override
State<JawgMap> createState() => _JawgMapState();
}
class _JawgMapState extends State<JawgMap> {
JawgType type = JawgType.Streets;
@override
Widget build(BuildContext context) {
return U.JawgMap(
// Please get and use your own API key from https://www.jawg.io
accessToken:
'yN0ESgFsBwgdpSy0MoyaFsDI66mXptDz4cWH0wArMflMJCBK7TkuyjQY8OtqEViZ',
center: [51.555158, -0.108343],
type: type,
zoom: 16,
controls: [
Align(
alignment: Alignment.bottomLeft,
child: Container(
margin: const EdgeInsets.only(left: 90, bottom: 29),
child: UDropdownButton(
value: type,
onChanged: (JawgType? chosen) {
setState(() {
if (chosen != null) {
type = chosen;
}
});
},
items: const [
DropdownMenuItem(
value: JawgType.Streets,
child: Text('Streets'),
),
DropdownMenuItem(
value: JawgType.Terrain,
child: Text('Terrain'),
),
DropdownMenuItem(
value: JawgType.Sunny,
child: Text('Sunny'),
),
DropdownMenuItem(
value: JawgType.Dark,
child: Text('Dark'),
),
DropdownMenuItem(
value: JawgType.Light,
child: Text('Light'),
),
DropdownMenuItem(
value: JawgType.Matrix,
child: Text('Matrix'),
),
],
),
),
),
],
);
}
}