Select Git revision
cloropleth_map.dart
-
Sara Savanovic Djordjevic authoredSara Savanovic Djordjevic authored
cloropleth_map.dart 1.31 KiB
import 'dart:typed_data';
import 'package:app/pages/consts.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_maps/maps.dart';
import '../consts.dart';
import 'dart:typed_data';
/// A class containing thickness for each subdivision of the map.
class IceThicknessModel {
IceThicknessModel(this.subDivID, this.thickness);
final int subDivID;
final double thickness;
}
/// A stateful widget which contains a choropleth map.
/// The map data is fetched from the server, and the map is rendered
/// using the Syncfusion Flutter Maps library.
class ChoroplethMap extends StatefulWidget {
const ChoroplethMap({Key? key, required this.relation}) : super(key: key);
final Uint8List relation;
@override
_ChoroplethMapState createState() => _ChoroplethMapState();
}
class _ChoroplethMapState extends State<ChoroplethMap> {
late MapShapeSource mapShapeSource;
List<IceThicknessModel> iceThicknessList = <IceThicknessModel>[];
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return SfMaps(
layers: [
MapShapeLayer(
source: MapShapeSource.memory(
widget.relation,
shapeDataField: 'name',
),
color: Colors.orange,
),
],
);
}
}