-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.dart
125 lines (112 loc) · 4.38 KB
/
main.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_maps/maps.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
// MapShapeSource _shapeSource;
// List<MapModel> _mapData;
// @override
// void initState() {
// _mapData = _getMapData();
// _shapeSource = MapShapeSource.asset('assets/australia.json',
// shapeDataField: 'STATE_NAME',
// dataCount: _mapData.length,
// primaryValueMapper: (int index) => _mapData[index].state,
// dataLabelMapper: (int index) => _mapData[index].stateCode,
// shapeColorValueMapper: (int index) => _mapData[index].color);
// super.initState();
// }
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: EdgeInsets.fromLTRB(0, 50, 0, 0),
child: SfMaps(
layers: [
MapTileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
initialFocalLatLng: MapLatLng(-20, 147),
initialZoomLevel: 3,
)
],
)),
);
// return Scaffold(
// body: Padding(
// padding: EdgeInsets.fromLTRB(0, 50, 0, 0),
// child: SfMaps(
// title: const MapTitle('Austraila Map'),
// layers: <MapShapeLayer>[
// MapShapeLayer(
// source: _shapeSource,
// showDataLabels: true,
// legend: MapLegend(MapElement.shape),
// shapeTooltipBuilder: (BuildContext context, int index) {
// return Padding(
// padding: EdgeInsets.all(7),
// child: Text(_mapData[index].stateCode,
// style: TextStyle(color: Colors.white)));
// },
// tooltipSettings: MapTooltipSettings(color: Colors.blue[900]),
// )
// ],
// ),
// ),
// );
}
// static List<MapModel> _getMapData() {
// return <MapModel>[
// MapModel('Australian Capital Territory', 'ACT', Colors.amber),
// MapModel('New South Wales', ' New\nSouth Wales', Colors.cyan),
// MapModel('Queensland', 'Queensland', Colors.amber[400]),
// MapModel('Northern Territory', 'Northern\nTerritory', Colors.red[400]),
// MapModel('Victoria', 'Victoria', Colors.purple[400]),
// MapModel(
// 'South Australia', 'South Australia', Colors.lightGreenAccent[200]),
// MapModel('Western Australia', 'Western Australia', Colors.indigo[400]),
// MapModel('Tasmania', 'Tasmania', Colors.lightBlue[100])
// ];
// }
}
// class MapModel {
// MapModel(this.state, this.stateCode, this.color);
// String state;
// String stateCode;
// Color color;
// }