Skip to content
Snippets Groups Projects
Commit 0edb98f6 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: add some commenting

parent 68799d9e
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -53,7 +53,7 @@ class _DefaultPageState extends State<DefaultPage> {
// Load marker data from server // Load marker data from server
loadMarkerList(); loadMarkerList();
// Schedule fetchMarkerTemplate to run periodically based on fetchInterval const // Schedule fetchMarkerData to run periodically based on fetchInterval from consts
const Duration interval = Duration(minutes: fetchInterval); const Duration interval = Duration(minutes: fetchInterval);
_timer = Timer.periodic(interval, (timer) { _timer = Timer.periodic(interval, (timer) {
fetchMarkerData(); fetchMarkerData();
...@@ -72,7 +72,7 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -72,7 +72,7 @@ class _DefaultPageState extends State<DefaultPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
home: Container( home: Container(
decoration: const BoxDecoration( decoration: const BoxDecoration( // Set background color
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
...@@ -82,10 +82,10 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -82,10 +82,10 @@ class _DefaultPageState extends State<DefaultPage> {
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
appBar: AppBar( appBar: AppBar(
title: Text('IceMap'), title: const Text('IceMap'),
), ),
body: ListView( body: ListView(
children: [ children: [ // Add main widget
MapContainerWidget(markerList: markerList), MapContainerWidget(markerList: markerList),
], ],
), ),
......
...@@ -26,6 +26,6 @@ Future<List<Measurement>> fetchMarkerData() async { ...@@ -26,6 +26,6 @@ Future<List<Measurement>> fetchMarkerData() async {
} }
} catch (e) { } catch (e) {
print('Error: $e'); print('Error: $e');
throw Exception('Failed to connect to the server. Please check your network connection'); throw Exception('failed to connect to the server. Please check your network connection');
} }
} }
...@@ -36,7 +36,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -36,7 +36,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
const SizedBox(height: contPadding), const SizedBox(height: contPadding),
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
child: Stack( child: Stack( // Stack quick view on top of map
children: [ children: [
SizedBox( SizedBox(
width: screenWidth * boxWidth, width: screenWidth * boxWidth,
...@@ -47,7 +47,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -47,7 +47,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
zoom: 9.0, zoom: 9.0,
), ),
children: [ children: [
TileLayer( TileLayer( // Map from OpenStreetMap
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: const ['a', 'b', 'c'], subdomains: const ['a', 'b', 'c'],
), ),
...@@ -55,7 +55,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -55,7 +55,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
polygons: widget.markerList.map((Measurement measurement) { polygons: widget.markerList.map((Measurement measurement) {
return Polygon( return Polygon(
points: measurement.cornerList.map((Corner corner) { points: measurement.cornerList.map((Corner corner) {
// Match corners to LatLng objects // Map corners to LatLng objects
return LatLng(corner.latitude, corner.longitude); return LatLng(corner.latitude, corner.longitude);
}).toList(), }).toList(),
/*onTap: () { /*onTap: () {
...@@ -71,7 +71,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -71,7 +71,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
], ],
), ),
), ),
Positioned( Positioned( // Quick view box layered over map
bottom: 10, bottom: 10,
right: 10, right: 10,
child: ClipRRect( child: ClipRRect(
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment