feat: Update layout structure to use Stack for project list overlay and adjust spacing in dashboard

This commit is contained in:
Vaibhav Surve 2025-06-12 11:55:02 +05:30
parent 56efbe8869
commit b38d987eac
2 changed files with 60 additions and 24 deletions

View File

@ -50,10 +50,9 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
MyText.titleMedium("Dashboard", fontWeight: 600),
MySpacing.height(12), MySpacing.height(12),
_buildDashboardStats(), _buildDashboardStats(),
MySpacing.height(350), MySpacing.height(300),
if (!hasMpin) ...[ if (!hasMpin) ...[
MyCard( MyCard(
borderRadiusAll: 12, borderRadiusAll: 12,

View File

@ -46,17 +46,44 @@ class _LayoutState extends State<Layout> {
endDrawer: UserProfileBar(), endDrawer: UserProfileBar(),
floatingActionButton: widget.floatingActionButton, floatingActionButton: widget.floatingActionButton,
body: SafeArea( body: SafeArea(
child: Column( child: Stack(
children: [ children: [
_buildHeader(context, isMobile), Column(
Expanded( children: [
child: SingleChildScrollView( _buildHeader(context, isMobile),
key: controller.scrollKey, Expanded(
padding: EdgeInsets.symmetric( child: SingleChildScrollView(
horizontal: 0, vertical: isMobile ? 16 : 32), key: controller.scrollKey,
child: widget.child, 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<Layout> {
return Card( return Card(
elevation: 4, elevation: 4,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(isExpanded ? 16 : 12), borderRadius: BorderRadius.circular(12),
), ),
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: Padding( clipBehavior: Clip.antiAlias, // important for overlap inside card
padding: const EdgeInsets.all(10), child: Stack(
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Padding(
children: [ padding: const EdgeInsets.all(10),
Row( child: Row(
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -158,16 +185,27 @@ class _LayoutState extends State<Layout> {
), ),
), ),
IconButton( IconButton(
icon: Icon(Icons.menu), icon: const Icon(Icons.menu),
onPressed: () => onPressed: () =>
controller.scaffoldKey.currentState?.openEndDrawer(), 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<Layout> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Divider(),
MyText.titleSmall("Switch Project", fontWeight: 600), MyText.titleSmall("Switch Project", fontWeight: 600),
const SizedBox(height: 4), const SizedBox(height: 4),
ConstrainedBox( ConstrainedBox(