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

update: add map to top box

parent ef6f6958
No related branches found
No related tags found
1 merge request!1Server
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart'; // Import LatLng class from the latlong package
import 'dart:async';
import 'dart:io';
......@@ -8,6 +10,7 @@ const String mapEndpoint = "update_map";
// NB: if http connection fails, run: adb reverse tcp:8443 tcp:8443
const int fetchInterval = 5;
// main is the entry point for the application, and starts the App() function
void main() {
runApp(const App());
}
......@@ -50,6 +53,7 @@ class DefaultPage extends StatefulWidget {
class _DefaultPageState extends State<DefaultPage> {
late Timer _timer;
// Timer initializer
@override
void initState() {
super.initState();
......@@ -63,6 +67,7 @@ class _DefaultPageState extends State<DefaultPage> {
});
}
// Fetch timer
@override
void dispose() {
// Cancel timer on widget termination
......@@ -90,13 +95,25 @@ class _DefaultPageState extends State<DefaultPage> {
width: screenWidth * boxWidth,
height: screenWidth * boxHeight,
color: Colors.blue,
child: FlutterMap(
options: MapOptions(
center: LatLng(51.5, -0.09), // Initial center of the map (latitude and longitude)
zoom: 13.0, // Initial zoom level of the map
),
children: [ // Add layers directly as children
TileLayer(
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c'],
),
],
),
),
SizedBox(height: 20),
Container( // Detailed info container
width: screenWidth * boxWidth,
height: screenWidth * boxHeight,
color: Colors.blue,
child: Align(
child: const Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(top: 10, left: 10), // Edge padding, text
......
......@@ -62,6 +62,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
flutter_map:
dependency: "direct main"
description:
name: flutter_map
sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -83,6 +91,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
intl:
dependency: transitive
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
latlong2:
dependency: "direct main"
description:
name: latlong2
sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0"
url: "https://pub.dev"
source: hosted
version: "0.8.2"
lints:
dependency: transitive
description:
......@@ -91,6 +115,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
lists:
dependency: transitive
description:
name: lists
sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
......@@ -115,6 +147,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
mgrs_dart:
dependency: transitive
description:
name: mgrs_dart
sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7
url: "https://pub.dev"
source: hosted
version: "2.0.0"
path:
dependency: transitive
description:
......@@ -123,6 +163,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
polylabel:
dependency: transitive
description:
name: polylabel
sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
proj4dart:
dependency: transitive
description:
name: proj4dart
sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e
url: "https://pub.dev"
source: hosted
version: "2.1.0"
sky_engine:
dependency: transitive
description: flutter
......@@ -176,6 +232,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.1"
tuple:
dependency: transitive
description:
name: tuple
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
url: "https://pub.dev"
source: hosted
version: "2.0.2"
typed_data:
dependency: transitive
description:
......@@ -184,6 +248,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
unicode:
dependency: transitive
description:
name: unicode
sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
vector_math:
dependency: transitive
description:
......@@ -200,5 +272,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.0"
wkt_parser:
dependency: transitive
description:
name: wkt_parser
sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
sdks:
dart: ">=3.2.6 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.3.0"
......@@ -4,12 +4,15 @@ publish_to: 'none'
version: 0.1.0
environment:
sdk: '>=3.2.6 <4.0.0'
sdk: '>=2.17.0 <4.0.0'
dependencies:
flutter:
sdk: flutter
flutter_map: ^4.0.0
http: ^0.13.3
latlong2: ^0.8.2
dev_dependencies:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment