status dashboard
This commit is contained in:
parent
8f4e2c8c99
commit
3bf6caabe5
@ -110,12 +110,13 @@ class StatusDashboardState extends State<StatusDashboard> {
|
||||
(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<StatusDashboard> {
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
@ -139,6 +139,9 @@ class StatusDashboardState extends State<StatusDashboard> {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
||||
@ -163,31 +166,36 @@ class StatusDashboardState extends State<StatusDashboard> {
|
||||
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<StatusDashboard> {
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user