diff --git a/app/lib/consts.dart b/app/lib/consts.dart index ff51be4528a85120a5f2ee56be5d90e0dc7772c1..69a50090450df0cf6816a836827374678383c663 100644 --- a/app/lib/consts.dart +++ b/app/lib/consts.dart @@ -14,19 +14,19 @@ DateTime ?lastUpdate; // Last time data was fetched from server // Font variables const textColor = Colors.white; -final appTitleStyle = GoogleFonts.dmSans( +final appTitleStyle = GoogleFonts.chakraPetch( fontSize: 35, color: Colors.black, fontWeight: FontWeight.bold, ); -final titleStyle = GoogleFonts.dmSans( - fontSize: 35, - color: textColor, +final titleStyle = GoogleFonts.chakraPetch( + fontSize: 30, + color: Colors.white70, fontWeight: FontWeight.bold, ); -final regTextStyle = GoogleFonts.dmSans(fontSize: 19, color: textColor); -final chartTextStyle = GoogleFonts.dmSans(fontSize: 14, color: textColor); -final subHeadingStyle = GoogleFonts.dmSans(fontSize: 22, color: textColor, fontWeight: FontWeight.bold); +final regTextStyle = GoogleFonts.chakraPetch(fontSize: 16, color: textColor); +final chartTextStyle = GoogleFonts.chakraPetch(fontSize: 12, color: textColor); +final subHeadingStyle = GoogleFonts.chakraPetch(fontSize: 18, color: textColor, fontWeight: FontWeight.bold); // Colors const darkBlue = Color(0xFF015E8F); diff --git a/app/lib/pages/default_page.dart b/app/lib/pages/default_page.dart index badd63c27e5f5805363cc4227ae5411659be0288..78be9cf7ad9ea37e2ab73a7b87661f6339a876f6 100644 --- a/app/lib/pages/default_page.dart +++ b/app/lib/pages/default_page.dart @@ -88,19 +88,6 @@ class _DefaultPageState extends State<DefaultPage> { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar( - title: const Text('IceMap'), - actions: [ - IconButton( - icon: const Icon(Icons.search), - onPressed: () { - setState(() { - showBar = !showBar; - }); - }, - ), - ], - ), body: FutureBuilder( future: Future.wait([markerListFuture, relationFuture]), builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) { @@ -135,13 +122,7 @@ class _DefaultPageState extends State<DefaultPage> { Uint8List relation = snapshot.data![1] as Uint8List; return Container( // Return container with list view and background color - decoration: const BoxDecoration( // Set background color - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [darkBlue, darkestBlue], - ), - ), + color: const Color(0xff151515), child: ListView( children: [ MapContainerWidget( diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index ec7727f367210f8b0fe19a2eb81d7466b649e79c..b2265bb7bdf1cd7fa71b43b4ac7d903309b64bae 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -34,12 +34,6 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { bool isMinimized = true; // Quick view box state tacker bool satLayer = false; // Satellite layer visibility tracker bool isTapped = false; // Button tap state tracker - final MapController _mapController = MapController(); // Map controller to re-center map view - - // recenterMap moves the map back to its initial view - void recenterMap() { - _mapController.move(mapCenter, 9.0); - } // Initialise lastUpdate variable from persistent storage if server fetch fails Future<void> checkAndSetLastUpdate() async { @@ -96,76 +90,11 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { borderRadius: BorderRadius.circular(20), child: Stack( // Stack of quick view, map layer, satellite layer, and buttons children: [ - /*SizedBox( - width: screenWidth * boxWidth, - height: screenWidth * boxHeight, - child: Stack( - children: [ - SatLayer(markerList: widget.markerList), // Satellite layer - Visibility( - visible: satLayer, // Only show layer if satellite button is toggled on - child: FlutterMap( - options: MapOptions( - center: mapCenter, - zoom: 9.0, - ), - mapController: _mapController, - children: [ - TileLayer( - urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", - subdomains: const ['a', 'b', 'c'], - ), - MarkerLayer( - markers: widget.markerList.map((Measurement measurement) { - - return Marker( - width: 50, - height: 50, - point: measurement.center, // Set markers at center of measurement - builder: (ctx) => GestureDetector( - onTap: () { - setState(() { - selectedMarker = measurement; - }); - }, - child: Icon( - Icons.severe_cold, - color: measurement == selectedMarker ? Colors.green : Colors.blue, - size: measurement == selectedMarker ? 40.0 : 30.0, - ), - ), - ); - }).toList(), - ), - ], - ), - ), - ], - ), - ),*/ SizedBox( // Colored box behind map width: screenWidth * boxWidth, height: screenWidth * boxHeight, child: Container( - color: const Color(0x883366ff), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 5), - Text( // Display time of most recent server fetch - 'Last updated at ${lastUpdate != null ? - (lastUpdate?.day == DateTime.now().day && - lastUpdate?.month == DateTime.now().month && - lastUpdate?.year == DateTime.now().year ? - '${lastUpdate?.hour}:${lastUpdate?.minute}' : - '${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}', - style: GoogleFonts.dmSans( - fontSize: 14, - color: Colors.black, - ), - ), - ], - ), + color: Colors.white12, ), ), SizedBox( // Lake map @@ -179,47 +108,6 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { onSelectionChanged: handleSelection,), ), ), - Positioned( // Quick view box layered over map - bottom: 10, - right: 10, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: Container( - width: (screenWidth * boxWidth) / 2.4, - height: isMinimized ? 20 : (screenWidth * boxWidth) / 2.4, - color: Colors.blue.withOpacity(0.7), - child: Stack( - children: [ - Visibility( // Graph only visible when box is maximized and a marker is selected - visible: !isMinimized && selectedTile != null, - child: Center( - child: Padding( - padding: const EdgeInsets.only(right: 16.0, top: 17.0), - child: SizedBox( - width: (screenWidth * boxWidth) / 2.3, - height: (screenWidth * boxWidth) / 2.3, - child: const QuickViewChart(), // Quick view graph - ), - ), - ), - ), - Positioned( - top: 0, - right: 5, - child: GestureDetector( - onTap: () { - setState(() { - isMinimized = !isMinimized; // Toggle minimized state - }); - }, - child: Icon(isMinimized ? Icons.arrow_drop_up : Icons.arrow_drop_down), - ), - ), - ], - ), - ), - ), - ), Positioned( // Satellite button top: 10, right: 10, @@ -233,39 +121,12 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { padding: const EdgeInsets.all(8), decoration: satLayer ? const BoxDecoration( // Add decoration only when pressed shape: BoxShape.circle, - color: Colors.blue, + color: Colors.grey, ) : null, - child: const Icon(Icons.satellite_alt_outlined), - ), - ), - ), - Positioned( // Back to center button - top: 45, - right: 10, - child: GestureDetector( - onTapDown: (_) { - setState(() { - recenterMap(); // Reset map view - isTapped = true; - }); - }, - onTapUp: (_) { - setState(() { - isTapped = false; - }); - }, - onTapCancel: () { - setState(() { - isTapped = false; - }); - }, - child: Container( - padding: const EdgeInsets.all(8), - decoration: isTapped ? const BoxDecoration( // Add decoration only when pressed - shape: BoxShape.circle, - color: Colors.blue, - ) : null, - child: const Icon(Icons.settings_backup_restore), + child: const Icon( + Icons.satellite_alt_outlined, + color: Colors.white54, + ), ), ), ), @@ -304,6 +165,24 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ], ), ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 5), + Text( // Display time of most recent server fetch + 'Last updated at ${lastUpdate != null ? + (lastUpdate?.day == DateTime.now().day && + lastUpdate?.month == DateTime.now().month && + lastUpdate?.year == DateTime.now().year ? + '${lastUpdate?.hour}:${lastUpdate?.minute}' : + '${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}', + style: GoogleFonts.dmSans( + fontSize: 14, + color: Colors.white60, + ), + ), + ], + ), const SizedBox(height: contPadding), // Padding between containers ClipRRect( borderRadius: BorderRadius.circular(20), @@ -322,12 +201,13 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { style: titleStyle, ), const Divider(), + const Padding(padding: EdgeInsets.all(10)), Text( - 'Time of measurement', + 'Measured at ', style: subHeadingStyle, ), Text( - 'Date ${(selectedTile?.timeMeasured.day ?? '-')}/${(selectedTile?.timeMeasured.month ?? '-')}/${(selectedTile?.timeMeasured.year ?? '-')}', + 'Date: ${(selectedTile?.timeMeasured.day ?? '-')}/${(selectedTile?.timeMeasured.month ?? '-')}/${(selectedTile?.timeMeasured.year ?? '-')}', style: regTextStyle, ), Text( diff --git a/server/map/__pycache__/add_lake.cpython-311.pyc b/server/map/__pycache__/add_lake.cpython-311.pyc index 254a045f6358b78911bb45510bbcff0aec323d29..9974e9cb3e6c0dc3dc772696f6baa7f8886172d7 100644 Binary files a/server/map/__pycache__/add_lake.cpython-311.pyc and b/server/map/__pycache__/add_lake.cpython-311.pyc differ diff --git a/server/map/__pycache__/get_measurements.cpython-311.pyc b/server/map/__pycache__/get_measurements.cpython-311.pyc index 368701cd4bb230294da15f554647bff65ca17497..738499b30b843de2743516c74543ef6dacca696a 100644 Binary files a/server/map/__pycache__/get_measurements.cpython-311.pyc and b/server/map/__pycache__/get_measurements.cpython-311.pyc differ diff --git a/server/map/__pycache__/process_lake.cpython-311.pyc b/server/map/__pycache__/process_lake.cpython-311.pyc index 7e90dfd53b3146fc294e1a9df3203d5e8fb93bce..77488b747682ac7f44bea3f34110bcd114c701c5 100644 Binary files a/server/map/__pycache__/process_lake.cpython-311.pyc and b/server/map/__pycache__/process_lake.cpython-311.pyc differ