From ad3204e19467e478213b2420539133e188c4ba8b Mon Sep 17 00:00:00 2001
From: Sara <sarasdj@stud.ntnu.no>
Date: Mon, 12 Feb 2024 18:14:43 +0100
Subject: [PATCH] update: collapsable quick view box

---
 app/lib/pages/consts.dart             |  1 +
 app/lib/pages/widgets/map_widget.dart | 61 ++++++++++++++-------------
 2 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/app/lib/pages/consts.dart b/app/lib/pages/consts.dart
index 4ff9e123..1b5412ba 100644
--- a/app/lib/pages/consts.dart
+++ b/app/lib/pages/consts.dart
@@ -23,6 +23,7 @@ final regTextStyle = GoogleFonts.dmSans(fontSize: 20, color: textColor);
 final chartTextStyle = GoogleFonts.dmSans(fontSize: 14, color: textColor);
 
 // Colors
+const mediumBlue = Color(0xFF015E8F);
 const darkBlue = Color(0xFF00B4D8);
 const darkestBlue = Color(0xFF03045E);
 const lightBlue = Color(0xFFCAF0F8);
diff --git a/app/lib/pages/widgets/map_widget.dart b/app/lib/pages/widgets/map_widget.dart
index 7cec073e..aaf5c079 100644
--- a/app/lib/pages/widgets/map_widget.dart
+++ b/app/lib/pages/widgets/map_widget.dart
@@ -17,6 +17,7 @@ class MapContainerWidget extends StatefulWidget {
 class _MapContainerWidgetState extends State<MapContainerWidget> {
 
   MarkerTemplate? selectedMarker;
+  bool isMinimized = true; // Quick view box state tacker
 
   @override
   Widget build(BuildContext context) {
@@ -77,41 +78,41 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
                         );
                       }).toList(),
                     ),
-                    if (selectedMarker != null) // Quick chart on marker press
-                      Positioned(
-                        bottom: 10,
-                        right: 10,
-                        child: ClipRRect(
-                          borderRadius: BorderRadius.circular(10),
-                          child: Container(
-                            width: (screenWidth * boxWidth)/2.3,
-                            height: (screenWidth * boxWidth)/2.3,
-                            color: darkBlue,
-                            child: Stack(
-                              children: [
-                                Center(
-                                  child: Text(
-                                    'Placeholder',
-                                    style: regTextStyle,
-                                  ),
+                    Positioned(
+                      bottom: 10,
+                      right: 10,
+                      child: ClipRRect(
+                        borderRadius: BorderRadius.circular(10),
+                        child: Container(
+                          width: (screenWidth * boxWidth) / 2.3,
+                          height: isMinimized ? 20 : (screenWidth * boxWidth) / 2.3,
+                          color: darkBlue,
+                          child: Stack(
+                            children: [
+                              Center(
+                                child: Text(
+                                  'Placeholder',
+                                  style: regTextStyle,
                                 ),
-                                Positioned(
-                                  top: 5,
-                                  right: 5,
-                                  child: GestureDetector(
-                                    onTap: () {
-                                      setState(() {
-                                        selectedMarker = null;
-                                      });
-                                    },
-                                    child: const Icon(Icons.close),
-                                  ),
+                              ),
+                              Positioned(
+                                top: isMinimized ? 0 : 5,
+                                left: 5,
+                                child: GestureDetector(
+                                  onTap: () {
+                                    setState(() {
+                                      isMinimized = !isMinimized; // Toggle the minimized state
+                                      print("IsMinimized?: $isMinimized");
+                                    });
+                                  },
+                                  child: Icon(isMinimized ? Icons.arrow_upward : Icons.arrow_downward),
                                 ),
-                              ],
-                            ),
+                              ),
+                            ],
                           ),
                         ),
                       ),
+                    ),
                   ],
                 ),
               ),
-- 
GitLab