From adf8af2248d41e016592083d4a31c856c3fb741b Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Fri, 10 May 2024 19:26:27 +0200 Subject: [PATCH] add: info button --- app/lib/widgets/main_layout.dart | 68 +++++++++++++++++- .../__pycache__/add_new_lake.cpython-311.pyc | Bin 9894 -> 9899 bytes 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index 1cdb9b08..5f915d0c 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -39,6 +39,8 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { bool isSatTapped = false; // Satellite button tap state tracker bool isMapTapped = false; // OSM button tap state tracker + bool showColorMeanings = false; // Additional color legend visibility + Measurement? selectedMeasurement = selectedMeasurements[0]; // Initialise lastUpdate variable from persistent storage if server fetch fails @@ -73,6 +75,46 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { }); } + // _buildLegendItem renders a colored circle and text to form a legend + Widget _legendItem(Color color, String text) { + return Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + ), + ), + const SizedBox(width: 8), + Text( + text, + style: const TextStyle( + fontSize: 14, + color: Colors.white, + ), + ), + ], + ); + } + + /// Builds an additional legend to explain the colors + Widget _buildLegend() { + return Column( + children: [ + _legendItem(const Color(0xffff0000), "Very unsafe"), + const SizedBox(height: 10), + _legendItem(const Color(0xffff6a00), "Unsafe"), + const SizedBox(height: 10), + _legendItem(const Color(0xFFb1ff00), "Safe"), + const SizedBox(height: 10), + _legendItem(const Color(0xFF00d6ff), "Very safe"), + const SizedBox(height: 10), + ], + ); + } + @override Widget build(BuildContext context) { // Initialise selectedMarker to first element in markerList @@ -216,6 +258,28 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ), ), ), + Positioned( // Color info button + top: 130, + right: 10, + child: GestureDetector( + onTap: () { + setState(() { + showColorMeanings = !showColorMeanings; // Toggle satellite layer state on press + }); + }, + child: Container( + padding: const EdgeInsets.all(8), + decoration: showColorMeanings ? const BoxDecoration( // Add decoration only when pressed + shape: BoxShape.circle, + color: Colors.grey, + ) : null, + child: const Icon( + Icons.info, + color: Colors.white54, + ), + ), + ), + ), ], ), ), @@ -246,7 +310,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { child: Align( alignment: Alignment.topLeft, child: Padding( - padding: const EdgeInsets.only(top: 20, left: 30), // Updated padding + padding: const EdgeInsets.only(top: 20, left: 30), // Custom padding child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -255,7 +319,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { style: titleStyle, ), const Divider(), - const SizedBox(height: 10), // Reduced padding + const SizedBox(height: 10), Text( 'Tile ID: ${selectedSubDiv?.sub_div_id}', style: regTextStyle, diff --git a/server/map_handler/__pycache__/add_new_lake.cpython-311.pyc b/server/map_handler/__pycache__/add_new_lake.cpython-311.pyc index 4275e07f2c440de66eb2bcb0143d024e5c9475cd..16eb848c6c0ecf96a3d721fd22b4de5d91527f39 100644 GIT binary patch delta 972 zcmZ4HyV{p`IWI340|NttdWc<G#ztOCUdCUW-Ff#hGU`ue<F8}1nB2-gfiYpTm_RFg zy*>j2LlGy4Fl1n0(Bvsf1hG{?gc^td%ZGqip&%j*M1(UiFx=uwFUm}b&&kY7ExyHA zSrh~kW2`9VVPIfTKmtW#ARPuUqLYDvq4+EV149GD2Pp<Vp~+GbubC>CCf}A<+N>!l z!^oAwxrS>QGXukF=E(;oC8a?w19^p^hG`ii1H)=YFo%JGp_X~FqqNv$UMUHl8ipF? zGRC5$8s-IDlNp&sC!dotL^Vg5levZ|g*%034ew+_X-`JJ&DGL{jDkg)ATKlC;z-R) z&QHnAOP~BkMv>8dGM}t;h#ts4Ecpegc||T@W=d&p!7Y}Y{KS+Za7eKf@q#>+29jh< zyTy`{Sdv)G0`)z_*LENUAYvWJ*S{Gjx5%EaKOugBGw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