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

add: new loading icon

parent 78f9e06b
No related branches found
No related tags found
2 merge requests!9Clhp map,!8Clhp map
Showing
with 26 additions and 20 deletions
app/assets/icons/circle-red.png

160 KiB

app/assets/icons/frozen.png

12.6 KiB

app/assets/icons/marker.png

4.7 KiB

...@@ -102,23 +102,26 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -102,23 +102,26 @@ class _DefaultPageState extends State<DefaultPage> {
body: FutureBuilder( body: FutureBuilder(
future: Future.wait([markerListFuture, relationFuture]), future: Future.wait([markerListFuture, relationFuture]),
builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) { builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
// Display loading screen while app state is being set
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
return Container( return Container(
decoration: const BoxDecoration( // Background color for loading screen decoration: const BoxDecoration( // Loading screen
color: darkestBlue, color: darkestBlue,
), ),
child: const Center( child: Center(
child: Icon( child: Image.asset(
Icons.severe_cold, // Loading screen icon 'assets/icons/frozen.png', // Loading screen icon
// Icon from: https://www.flaticon.com/free-icons/cold-water"
color: lightBlue, color: lightBlue,
size: 100, width: 200,
height: 200,
), ),
), ),
); );
} else if (snapshot.hasError) { } else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}')); return Center(child: Text('Error: ${snapshot.error}'));
} else { } else {
// Alert the user after the build completes if there is no server connection // If no server connection, alert user upon completing build
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (!serverConnection && !dialogShown) { if (!serverConnection && !dialogShown) {
dialogShown = true; dialogShown = true;
......
...@@ -9,15 +9,15 @@ environment: ...@@ -9,15 +9,15 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_map: ^4.0.0 flutter_map: ^4.0.0 # Various maps
http: ^0.13.3 http: ^0.13.3 # HTTPS requests
latlong2: ^0.8.2 latlong2: ^0.8.2
provider: ^5.0.0 provider: ^5.0.0
fl_chart: ^0.20.0-nullsafety1 fl_chart: ^0.20.0-nullsafety1 # Charts and diagrams
google_fonts: any google_fonts: any # Fonts
syncfusion_flutter_maps: ^20.4.41 syncfusion_flutter_maps: ^20.4.41 # Choropleth map
path_provider: ^2.0.8 path_provider: ^2.0.8
shared_preferences: any shared_preferences: any # Persistent data storage
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
...@@ -27,4 +27,4 @@ dev_dependencies: ...@@ -27,4 +27,4 @@ dev_dependencies:
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:
- assets/ - assets/icons/
No preview for this file type
...@@ -2,6 +2,7 @@ import json ...@@ -2,6 +2,7 @@ import json
from datetime import datetime from datetime import datetime
from server.data_processing.process_lidar_data import height_in_area from server.data_processing.process_lidar_data import height_in_area
# input_new_Lidar_data send new data gathered from the lidar and send it to the database (from the drone, most likely) # input_new_Lidar_data send new data gathered from the lidar and send it to the database (from the drone, most likely)
def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
try: try:
...@@ -10,7 +11,7 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): ...@@ -10,7 +11,7 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
cursor.execute(''' cursor.execute('''
INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName, WholeAverageThickness) VALUES INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName, WholeAverageThickness) VALUES
(?,?,?,?); (?,?,?,?);
''', ( sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0)) ''', (sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0))
# auto generate new measurement id # auto generate new measurement id
measurement_id = cursor.lastrowid measurement_id = cursor.lastrowid
...@@ -31,19 +32,21 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): ...@@ -31,19 +32,21 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
position_data = cursor.fetchall() position_data = cursor.fetchall()
# soon to be removed # soon to be removed
if(position_data): if (position_data):
for row in position_data: for row in position_data:
latitude, longitude, subID, groupID = row latitude, longitude, subID, groupID = row
heights = height_in_area((latitude,longitude)) heights = height_in_area((latitude, longitude))
if(len(heights) > 0): if (len(heights) > 0):
print(heights) print(heights)
else: else:
print("No height found") print("No height found")
average = sum(heights)/len(heights) average = sum(heights) / len(heights)
cursor.execute(''' cursor.execute('''
INSERT INTO SubDivision(MeasurementID, SubDivisionID, GroupID, MinimumThickness, AverageThickness, CenterLatitude, CenterLongitude, Accuracy) VALUES INSERT INTO SubDivision(MeasurementID, SubDivisionID, GroupID, MinimumThickness, AverageThickness, CenterLatitude, CenterLongitude, Accuracy) VALUES
(?,?,?,?,?,?,?,?); (?,?,?,?,?,?,?,?);
''',(measurement_id, subID, groupID, float(min(heights)), float(average), float(latitude), float(longitude), float(1))) ''', (
measurement_id, subID, groupID, float(min(heights)), float(average), float(latitude), float(longitude),
float(1)))
else: else:
print('No data') print('No data')
...@@ -56,4 +59,4 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): ...@@ -56,4 +59,4 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
except Exception as e: except Exception as e:
print("An error occurred", e) print("An error occurred", e)
# rollback in case of error # rollback in case of error
cursor.connection.rollback() cursor.connection.rollback()
\ No newline at end of file
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