added empty data card
This commit is contained in:
parent
f937bd849f
commit
b2205c18f4
@ -28,9 +28,7 @@ class CollectionsHealthWidget extends StatelessWidget {
|
||||
return Container(
|
||||
decoration: _boxDecoration(),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
child: MyText.bodyMedium('No collection overview data available.'),
|
||||
),
|
||||
child: const _EmptyDataWidget(), // <-- Use the new empty widget here
|
||||
);
|
||||
}
|
||||
|
||||
@ -287,6 +285,71 @@ class CollectionsHealthWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// NEW EMPTY DATA WIDGET FOR CollectionsHealthWidget
|
||||
// =====================================================================
|
||||
class _EmptyDataWidget extends StatelessWidget {
|
||||
const _EmptyDataWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This height is set to resemble the expected height of the chart/metrics content
|
||||
const double containerHeight = 220;
|
||||
const double iconSize = 48;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header Section
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
MyText.bodyMedium('Collections Health Overview',
|
||||
fontWeight: 700),
|
||||
const SizedBox(height: 2),
|
||||
MyText.bodySmall('View your collection health data.',
|
||||
color: Colors.grey),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Empty Content Area
|
||||
SizedBox(
|
||||
height: containerHeight,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
color: Colors.grey.shade400,
|
||||
size: iconSize,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MyText.bodyMedium(
|
||||
'No collection overview data available.',
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
MyText.bodySmall(
|
||||
'Please check your data source or filters.',
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// CUSTOM PLACEHOLDER WIDGETS (Gauge + Bar/Area + Aging Bars)
|
||||
// =====================================================================
|
||||
|
||||
@ -12,19 +12,39 @@ class CompactPurchaseInvoiceDashboard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final DashboardController controller = Get.find();
|
||||
|
||||
// Define the common box decoration for the main card structure
|
||||
final BoxDecoration cardDecoration = BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 5),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
// Use Obx to reactively listen to data changes
|
||||
return Obx(() {
|
||||
final data = controller.purchaseInvoiceOverviewData.value;
|
||||
|
||||
// Show loading state while API call is in progress
|
||||
if (controller.isPurchaseInvoiceLoading.value) {
|
||||
return SkeletonLoaders.purchaseInvoiceDashboardSkeleton();
|
||||
return Container(
|
||||
decoration: cardDecoration, // Apply decoration to loading state
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SkeletonLoaders.purchaseInvoiceDashboardSkeleton(),
|
||||
);
|
||||
}
|
||||
|
||||
// Show empty state if no data
|
||||
if (data == null || data.totalInvoices == 0) {
|
||||
return Center(
|
||||
child: MyText.bodySmall('No purchase invoices found.'),
|
||||
return Container(
|
||||
decoration: cardDecoration, // Apply decoration to empty state
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: const _EmptyDataWidget(), // <-- Use the new empty widget
|
||||
);
|
||||
}
|
||||
|
||||
@ -42,27 +62,17 @@ class CompactPurchaseInvoiceDashboard extends StatelessWidget {
|
||||
|
||||
final metrics = PurchaseInvoiceMetricsCalculator().calculate(invoices);
|
||||
|
||||
return _buildDashboard(metrics);
|
||||
return _buildDashboard(metrics, cardDecoration);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildDashboard(PurchaseInvoiceMetrics metrics) {
|
||||
Widget _buildDashboard(PurchaseInvoiceMetrics metrics, BoxDecoration decoration) {
|
||||
const double spacing = 16.0;
|
||||
const double smallSpacing = 8.0;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(spacing),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 5),
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: decoration, // Use the passed decoration
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -319,6 +329,56 @@ Color getColorForStatus(String status) {
|
||||
/// REDESIGNED INTERNAL UI WIDGETS
|
||||
/// =======================
|
||||
|
||||
// NEW WIDGET: Empty Data Card
|
||||
class _EmptyDataWidget extends StatelessWidget {
|
||||
const _EmptyDataWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double containerHeight = 220;
|
||||
const double iconSize = 48;
|
||||
const double spacing = 16.0;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header Section
|
||||
const _DashboardHeader(),
|
||||
const SizedBox(height: spacing),
|
||||
|
||||
// Empty Content Area
|
||||
SizedBox(
|
||||
height: containerHeight,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
color: Colors.grey.shade400,
|
||||
size: iconSize,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MyText.bodyMedium(
|
||||
'No purchase invoice data available.',
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
MyText.bodySmall(
|
||||
'Please check your data source or filters.',
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class _SectionTitle extends StatelessWidget {
|
||||
final String title;
|
||||
|
||||
@ -714,4 +774,4 @@ class _ProjectBreakdown extends StatelessWidget {
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user