From b38d987eac4cfbcdfdfebf7bcf16dd4185821a71 Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Thu, 12 Jun 2025 11:55:02 +0530 Subject: [PATCH] feat: Update layout structure to use Stack for project list overlay and adjust spacing in dashboard --- lib/view/dashboard/dashboard_screen.dart | 3 +- lib/view/layouts/layout.dart | 81 +++++++++++++++++------- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/lib/view/dashboard/dashboard_screen.dart b/lib/view/dashboard/dashboard_screen.dart index e5a8d18..6d948de 100644 --- a/lib/view/dashboard/dashboard_screen.dart +++ b/lib/view/dashboard/dashboard_screen.dart @@ -50,10 +50,9 @@ class _DashboardScreenState extends State with UIMixin { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - MyText.titleMedium("Dashboard", fontWeight: 600), MySpacing.height(12), _buildDashboardStats(), - MySpacing.height(350), + MySpacing.height(300), if (!hasMpin) ...[ MyCard( borderRadiusAll: 12, diff --git a/lib/view/layouts/layout.dart b/lib/view/layouts/layout.dart index 1652ea5..9da4971 100644 --- a/lib/view/layouts/layout.dart +++ b/lib/view/layouts/layout.dart @@ -46,17 +46,44 @@ class _LayoutState extends State { endDrawer: UserProfileBar(), floatingActionButton: widget.floatingActionButton, body: SafeArea( - child: Column( + child: Stack( children: [ - _buildHeader(context, isMobile), - Expanded( - child: SingleChildScrollView( - key: controller.scrollKey, - padding: EdgeInsets.symmetric( - horizontal: 0, vertical: isMobile ? 16 : 32), - child: widget.child, - ), + Column( + children: [ + _buildHeader(context, isMobile), + Expanded( + child: SingleChildScrollView( + key: controller.scrollKey, + padding: EdgeInsets.symmetric( + horizontal: 0, vertical: isMobile ? 16 : 32), + child: widget.child, + ), + ), + ], ), + // Overlay project list below header + Obx(() { + if (!projectController.isProjectSelectionExpanded.value) { + return const SizedBox.shrink(); + } + return Positioned( + top: 95, // Adjust based on header card height + left: 16, + right: 16, + child: Material( + elevation: 4, + borderRadius: BorderRadius.circular(12), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + padding: const EdgeInsets.all(10), + child: _buildProjectList(context, isMobile), + ), + ), + ); + }), ], ), ), @@ -81,15 +108,15 @@ class _LayoutState extends State { return Card( elevation: 4, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(isExpanded ? 16 : 12), + borderRadius: BorderRadius.circular(12), ), margin: EdgeInsets.zero, - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + clipBehavior: Clip.antiAlias, // important for overlap inside card + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.all(10), + child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(8), @@ -158,16 +185,27 @@ class _LayoutState extends State { ), ), IconButton( - icon: Icon(Icons.menu), + icon: const Icon(Icons.menu), onPressed: () => controller.scaffoldKey.currentState?.openEndDrawer(), ), ], ), - const SizedBox(height: 8), - if (isExpanded) _buildProjectList(context, isMobile), - ], - ), + ), + + /// Expanded Project List inside card + if (isExpanded) + Positioned( + top: 70, // slightly below the row + left: 0, + right: 0, + child: Container( + padding: const EdgeInsets.all(10), + color: Colors.white, + child: _buildProjectList(context, isMobile), + ), + ), + ], ), ); }), @@ -178,7 +216,6 @@ class _LayoutState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Divider(), MyText.titleSmall("Switch Project", fontWeight: 600), const SizedBox(height: 4), ConstrainedBox(