From d4f37fb5b88fb07bd8fe9d6cf7463d51ea7865d0 Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Mon, 12 Feb 2024 14:04:20 +0100 Subject: [PATCH] add: box on marker press --- app/lib/pages/consts.dart | 1 + app/lib/pages/default_page.dart | 30 ++++++++++++++--------- app/lib/pages/widgets/map_widget.dart | 35 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/app/lib/pages/consts.dart b/app/lib/pages/consts.dart index 3238b397..dcf0e5a4 100644 --- a/app/lib/pages/consts.dart +++ b/app/lib/pages/consts.dart @@ -24,6 +24,7 @@ final chartTextStyle = GoogleFonts.dmSans(fontSize: 14, color: textColor); // Colors const darkBlue = Color(0xFF00B4D8); +const darkestBlue = Color(0xFF03045E); const lightBlue = Color(0xFFCAF0F8); const superLightBlue = Color(0xFFCAF0F8); const barBlue = Color(0xFF0077B6); \ No newline at end of file diff --git a/app/lib/pages/default_page.dart b/app/lib/pages/default_page.dart index 10741804..51167e84 100644 --- a/app/lib/pages/default_page.dart +++ b/app/lib/pages/default_page.dart @@ -73,18 +73,26 @@ class _DefaultPageState extends State<DefaultPage> { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: darkBlue, - appBar: AppBar( - title: Text( - 'IceMap', - style: appTitleStyle, + return MaterialApp( + home: Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [darkBlue, darkestBlue], + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + title: Text('IceMap'), + ), + body: ListView( + children: [ + MapContainerWidget(markerList: markerList), + ], + ), ), - ), - body: ListView( - children: [ - MapContainerWidget(markerList: markerList), - ], ), ); } diff --git a/app/lib/pages/widgets/map_widget.dart b/app/lib/pages/widgets/map_widget.dart index de8b22d0..430f4207 100644 --- a/app/lib/pages/widgets/map_widget.dart +++ b/app/lib/pages/widgets/map_widget.dart @@ -80,6 +80,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: textStyle, + ), + ), + Positioned( + top: 5, + right: 5, + child: GestureDetector( + onTap: () { + setState(() { + selectedMarker = null; // Clear the selected marker + }); + }, + child: const Icon(Icons.close), + ), + ), + ], + ), + ), + ), + ), ], ), ), -- GitLab