From b951e4a13bf6d3b8cf47a1cf5ed2b5d9a069d9c6 Mon Sep 17 00:00:00 2001
From: Sara <sarasdj@stud.ntnu.no>
Date: Tue, 19 Mar 2024 15:46:45 +0100
Subject: [PATCH] add: no connection icon

---
 app/lib/consts.dart              |  1 +
 app/lib/widgets/main_layout.dart | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/app/lib/consts.dart b/app/lib/consts.dart
index ff51be45..d52c93a1 100644
--- a/app/lib/consts.dart
+++ b/app/lib/consts.dart
@@ -11,6 +11,7 @@ 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/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart
index 227e09df..77c433ac 100644
--- a/app/lib/widgets/main_layout.dart
+++ b/app/lib/widgets/main_layout.dart
@@ -259,6 +259,38 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
                       ),
                     ),
                   ),
+                  Positioned( // No wifi icon
+                    top: 80,
+                    right: 10,
+                    child: GestureDetector(
+                      onTapDown: (_) {
+                        setState(() {
+                          // Add functionality
+                        });
+                      },
+                      onTapUp: (_) {
+                        setState(() {
+                          // Add functionality
+                        });
+                      },
+                      onTapCancel: () {
+                        setState(() {
+                          // Add functionality
+                        });
+                      },
+                      child: Visibility( // Show icon only when no server connection
+                        visible: !gServerConnection,
+                        child: Container(
+                          padding: const EdgeInsets.all(8),
+                          decoration: isTapped ? const BoxDecoration(
+                            shape: BoxShape.circle,
+                            color: Colors.blue,
+                          ) : null,
+                          child: const Icon(Icons.perm_scan_wifi, color: Color(0xFF5B0000)),
+                        ),
+                      ),
+                    ),
+                  ),
                 ],
               ),
             ),
-- 
GitLab