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', (entry) => entry.monthYear == '$currentMonth/$currentYear',
); );
// Determine bid/prize amounts - use actual data or fallback to group values // For next month
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
final nextMonthFinancial = financialData.firstWhereOrNull( final nextMonthFinancial = financialData.firstWhereOrNull(
(entry) => entry.monthYear == '$nextMonth/$nextYear', (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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -2818,26 +2829,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
], ],
), ),
), ),
Column( if (currentBidAmount != null)
crossAxisAlignment: CrossAxisAlignment.end, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Text( children: [
_formatIndianCurrency(currentBidAmount), Text(
style: TextStyle( _formatIndianCurrency(currentBidAmount),
fontSize: 20.sp, style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20.sp,
color: Colors.green.shade700, fontWeight: FontWeight.bold,
color: Colors.green.shade700,
),
), ),
), Text(
Text( 'Current Bid',
'Current Bid', style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, color: Colors.green.shade600,
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), SizedBox(height: 12.h),
@ -2878,26 +2911,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
], ],
), ),
), ),
Column( if (currentPrizeAmount != null)
crossAxisAlignment: CrossAxisAlignment.end, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Text( children: [
_formatIndianCurrency(currentPrizeAmount), Text(
style: TextStyle( _formatIndianCurrency(currentPrizeAmount),
fontSize: 16.sp, style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 16.sp,
color: Colors.green.shade700, fontWeight: FontWeight.bold,
color: Colors.green.shade700,
),
), ),
), Text(
Text( 'Prize Amount',
'Prize Amount', style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, color: Colors.green.shade600,
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( if (nextBidAmount != null)
crossAxisAlignment: CrossAxisAlignment.end, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Text( children: [
_formatIndianCurrency(nextBidAmount), Text(
style: TextStyle( _formatIndianCurrency(nextBidAmount),
fontSize: 20.sp, style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20.sp,
color: Colors.blue.shade700, fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
),
), ),
), Text(
Text( 'Expected Bid',
'Expected Bid', style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, color: Colors.blue.shade600,
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), SizedBox(height: 12.h),
@ -3017,26 +3094,48 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
], ],
), ),
), ),
Column( if (nextPrizePool != null)
crossAxisAlignment: CrossAxisAlignment.end, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Text( children: [
_formatIndianCurrency(nextPrizePool), Text(
style: TextStyle( _formatIndianCurrency(nextPrizePool),
fontSize: 16.sp, style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 16.sp,
color: Colors.blue.shade700, fontWeight: FontWeight.bold,
color: Colors.blue.shade700,
),
), ),
), Text(
Text( 'Prize Pool',
'Prize Pool', style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, color: Colors.blue.shade600,
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,
),
),
],
),
], ],
), ),
), ),