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,26 +2829,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(currentBidAmount),
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
color: Colors.green.shade700,
if (currentBidAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(currentBidAmount),
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
color: Colors.green.shade700,
),
),
),
Text(
'Current Bid',
style: TextStyle(
fontSize: 12.sp,
color: Colors.green.shade600,
Text(
'Current Bid',
style: TextStyle(
fontSize: 12.sp,
color: Colors.green.shade600,
),
),
),
],
),
],
)
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,
),
),
],
),
],
),
SizedBox(height: 12.h),
@ -2878,26 +2911,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(currentPrizeAmount),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Colors.green.shade700,
if (currentPrizeAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(currentPrizeAmount),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Colors.green.shade700,
),
),
),
Text(
'Prize Amount',
style: TextStyle(
fontSize: 12.sp,
color: Colors.green.shade600,
Text(
'Prize Amount',
style: TextStyle(
fontSize: 12.sp,
color: Colors.green.shade600,
),
),
),
],
),
],
)
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,26 +3012,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(nextBidAmount),
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
if (nextBidAmount != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(nextBidAmount),
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
),
),
),
Text(
'Expected Bid',
style: TextStyle(
fontSize: 12.sp,
color: Colors.blue.shade600,
Text(
'Expected Bid',
style: TextStyle(
fontSize: 12.sp,
color: Colors.blue.shade600,
),
),
),
],
),
],
)
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,
),
),
],
),
],
),
SizedBox(height: 12.h),
@ -3017,26 +3094,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(nextPrizePool),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
if (nextPrizePool != null)
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
_formatIndianCurrency(nextPrizePool),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
),
),
),
Text(
'Prize Pool',
style: TextStyle(
fontSize: 12.sp,
color: Colors.blue.shade600,
Text(
'Prize Pool',
style: TextStyle(
fontSize: 12.sp,
color: Colors.blue.shade600,
),
),
),
],
),
],
)
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,
),
),
],
),
],
),
),