From 3bf6caabe52f8bd34b7b1b2a143772825a227cdb Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 26 May 2025 09:44:56 +0000 Subject: [PATCH] status dashboard --- lib/Screens/dashboard/status_dashboard.dart | 47 ++++++++++++--------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/lib/Screens/dashboard/status_dashboard.dart b/lib/Screens/dashboard/status_dashboard.dart index 6a42b8a..4c9d8c8 100644 --- a/lib/Screens/dashboard/status_dashboard.dart +++ b/lib/Screens/dashboard/status_dashboard.dart @@ -110,12 +110,13 @@ class StatusDashboardState extends State { (apiData?['data']?['statusBasedCount']) ?? []); print("statusBasedCount - => $statusBasedCount"); // 👇 Local function to create the card widget - Widget buildInfoCard(String title, int count) { + Widget buildInfoCard(String title, int count, double width) { return Card( elevation: 3, + color: Colors.white, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), child: Container( - width: 150, + width: width, padding: const EdgeInsets.all(12), child: Column( mainAxisSize: MainAxisSize.min, @@ -124,7 +125,6 @@ class StatusDashboardState extends State { title, textAlign: TextAlign.center, style: const TextStyle(fontWeight: FontWeight.w600), - ), const SizedBox(height: 8), Text( @@ -139,6 +139,9 @@ class StatusDashboardState extends State { ), ), ); + + + } return ResponsiveBuilder(builder: (context, sizingInfo) { @@ -163,31 +166,36 @@ class StatusDashboardState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text( - 'Type Based Count', - style: - TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), Wrap( spacing: 10, runSpacing: 10, - children: typeBasedCount - .map((item) => buildInfoCard(item['value'], item['count'])) - .toList(), + children: typeBasedCount.map((item) { + double cardWidth = isDesktop + ? (MediaQuery.of(context).size.width * 0.75 - 10) / 2 // 80% width padding adjusted + : MediaQuery.of(context).size.width - 24; // full width with padding + + return SizedBox( + width: cardWidth, + child: buildInfoCard(item['value'], item['count'], cardWidth), + ); + }).toList(), ), const SizedBox(height: 20), - const Text( - 'Status Based Count', - style: - TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), Wrap( spacing: 10, runSpacing: 10, - children: statusBasedCount - .map((item) => buildInfoCard(item['value'], item['count'])) - .toList(), + children: statusBasedCount.map((item) { + double cardWidth = isDesktop + ? (MediaQuery.of(context).size.width * 0.90 - 50) / 6 // desktop layout: 6 cards per row + : MediaQuery.of(context).size.width - 24; // mobile: full width + + return SizedBox( + width: cardWidth, + child: buildInfoCard(item['value'], item['count'], cardWidth), + ); + }).toList(), ), + ], ), ), @@ -197,6 +205,7 @@ class StatusDashboardState extends State { ), ); }); + } } \ No newline at end of file