From 660bd3cdf1650a61f0ca1b950068405255d32896 Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Thu, 19 Jun 2025 13:15:02 +0530 Subject: [PATCH] feat: Enhance project selection interaction by adding tap gesture to collapse dropdown --- lib/view/layouts/layout.dart | 82 ++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/lib/view/layouts/layout.dart b/lib/view/layouts/layout.dart index eca8b05..5d5f909 100644 --- a/lib/view/layouts/layout.dart +++ b/lib/view/layouts/layout.dart @@ -46,45 +46,53 @@ class _LayoutState extends State { endDrawer: UserProfileBar(), floatingActionButton: widget.floatingActionButton, body: SafeArea( - child: Stack( - children: [ - 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), + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + if (projectController.isProjectSelectionExpanded.value) { + projectController.isProjectSelectionExpanded.value = false; + } + }, + child: Stack( + children: [ + Column( + children: [ + _buildHeader(context, isMobile), + Expanded( + child: SingleChildScrollView( + key: controller.scrollKey, + padding: EdgeInsets.symmetric( + horizontal: 0, vertical: isMobile ? 16 : 32), + child: widget.child, ), - padding: const EdgeInsets.all(10), - child: _buildProjectList(context, isMobile), ), - ), - ); - }), - ], + ], + ), + // Project dropdown overlay + Obx(() { + if (!projectController.isProjectSelectionExpanded.value) { + return const SizedBox.shrink(); + } + return Positioned( + top: 95, + 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), + ), + ), + ); + }), + ], + ), ), ), );