From 749dc2c06efbc02447f7dac0cd04a1cba3c76cf7 Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Tue, 19 Mar 2024 15:50:28 +0100 Subject: [PATCH] update: serverConnection logic --- app/lib/consts.dart | 1 - app/lib/pages/default_page.dart | 6 +++++- app/lib/widgets/main_layout.dart | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/lib/consts.dart b/app/lib/consts.dart index d52c93a1..ff51be45 100644 --- a/app/lib/consts.dart +++ b/app/lib/consts.dart @@ -11,7 +11,6 @@ const int fetchInterval = 60; // Fetch marker data every n minutes // Map variables LatLng mapCenter = LatLng(60.7666, 10.8471); DateTime ?lastUpdate; // Last time data was fetched from server -bool gServerConnection = false; // Font variables const textColor = Colors.white; diff --git a/app/lib/pages/default_page.dart b/app/lib/pages/default_page.dart index 6259afe5..028c3f35 100644 --- a/app/lib/pages/default_page.dart +++ b/app/lib/pages/default_page.dart @@ -142,7 +142,11 @@ class _DefaultPageState extends State<DefaultPage> { ), child: ListView( children: [ - MapContainerWidget(markerList: markerList, relation: relation), + MapContainerWidget( + markerList: markerList, + relation: relation, + serverConnection: serverConnection, + ), ], ), ); diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index 77c433ac..e51ef19e 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -16,10 +16,12 @@ import 'quick_view_chart.dart'; class MapContainerWidget extends StatefulWidget { final List<Measurement> markerList; final Uint8List relation; + final bool serverConnection; const MapContainerWidget({Key? key, required this.markerList, required this.relation, + required this.serverConnection, }) : super(key: key); @override @@ -279,7 +281,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { }); }, child: Visibility( // Show icon only when no server connection - visible: !gServerConnection, + visible: !widget.serverConnection, child: Container( padding: const EdgeInsets.all(8), decoration: isTapped ? const BoxDecoration( -- GitLab