fixed defaults for grp data

This commit is contained in:
Deep Koluguri 2025-11-06 15:55:19 -05:00
parent 6e480ef09a
commit 38400a8d1a
1 changed files with 178 additions and 79 deletions

View File

@ -2743,16 +2743,27 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
(entry) => entry.monthYear == '$currentMonth/$currentYear',
);
// Determine bid/prize amounts - use actual data or fallback to group values
final currentBidAmount = currentMonthFinancial?.bidAmount ?? currentDraw?.prizeAmount ?? group.totalValue;
final currentPrizeAmount = currentDraw?.prizeAmount ?? currentBidAmount;
// For next month, estimate based on pattern or use group total value
// For next month
final nextMonthFinancial = financialData.firstWhereOrNull(
(entry) => entry.monthYear == '$nextMonth/$nextYear',
);
final nextBidAmount = nextMonthFinancial?.bidAmount ?? group.totalValue;
final nextPrizePool = nextMonthFinancial?.bidAmount ?? group.totalValue;
// Only show section if we have actual data (not just fallbacks)
final hasCurrentData = currentDraw != null || currentMonthFinancial != null;
final hasNextData = nextMonthFinancial != null;
// If no data at all, don't show confusing fallback values
if (!hasCurrentData && !hasNextData && _service.monthlyDraws.isEmpty) {
return SizedBox.shrink(); // Hide section if no real data
}
// Determine bid/prize amounts - use actual data or null
final currentBidAmount = currentMonthFinancial?.bidAmount ?? currentDraw?.prizeAmount;
final currentPrizeAmount = currentDraw?.prizeAmount;
// For next month
final nextBidAmount = nextMonthFinancial?.bidAmount;
final nextPrizePool = nextMonthFinancial?.bidAmount;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -2818,6 +2829,7 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
if (currentBidAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@ -2837,6 +2849,27 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
),
),
],
)
else
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'No Data',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
),
),
Text(
'Pending',
style: TextStyle(
fontSize: 12.sp,
color: Colors.grey.shade500,
),
),
],
),
],
),
@ -2878,6 +2911,7 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
if (currentPrizeAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@ -2897,6 +2931,27 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
),
),
],
)
else
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Not Conducted',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
),
),
Text(
'No Draw Yet',
style: TextStyle(
fontSize: 11.sp,
color: Colors.grey.shade500,
),
),
],
),
],
),
@ -2957,6 +3012,7 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
if (nextBidAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@ -2976,6 +3032,27 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
),
),
],
)
else
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'TBD',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
),
),
Text(
'Not Available',
style: TextStyle(
fontSize: 11.sp,
color: Colors.grey.shade500,
),
),
],
),
],
),
@ -3017,6 +3094,7 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
if (nextPrizePool != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@ -3036,6 +3114,27 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
),
),
],
)
else
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'TBD',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: Colors.grey.shade500,
),
),
Text(
'Not Available',
style: TextStyle(
fontSize: 11.sp,
color: Colors.grey.shade500,
),
),
],
),
],
),