adjusted slot machine
This commit is contained in:
parent
e6a59cef21
commit
9c4f353abd
|
|
@ -803,16 +803,106 @@ class _GroupDetailsPageState extends State<GroupDetailsPage> with SingleTickerPr
|
|||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => _service.loadGroupMonthlyDraws(widget.group.id),
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16.w),
|
||||
itemCount: draws.length,
|
||||
itemBuilder: (context, index) {
|
||||
final draw = draws[index];
|
||||
return _buildDrawCard(draw);
|
||||
},
|
||||
),
|
||||
// Show draws with a header and conduct draw button
|
||||
return Column(
|
||||
children: [
|
||||
// Header with Conduct Draw button or status message
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.grey.shade200, width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Monthly Draws (${draws.length})',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey.shade800,
|
||||
),
|
||||
),
|
||||
if (!widget.group.isActive) ...[
|
||||
SizedBox(height: 4.h),
|
||||
Text(
|
||||
'Group must be "Active" to conduct draws',
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: Colors.orange.shade700,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (widget.group.isActive)
|
||||
ElevatedButton.icon(
|
||||
onPressed: () => _conductDraw(context),
|
||||
icon: Icon(Icons.casino, size: 18.w),
|
||||
label: Text(
|
||||
'Conduct Draw',
|
||||
style: TextStyle(fontSize: 14.sp),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.purple.shade600,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
Get.snackbar(
|
||||
'Group Not Active',
|
||||
'Please start the chitfund group first to conduct draws.',
|
||||
backgroundColor: Colors.orange,
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 3),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.info_outline, size: 18.w),
|
||||
label: Text(
|
||||
'Start Group',
|
||||
style: TextStyle(fontSize: 14.sp),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.orange.shade700,
|
||||
side: BorderSide(color: Colors.orange.shade700),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Draws list
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => _service.loadGroupMonthlyDraws(widget.group.id),
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16.w),
|
||||
itemCount: draws.length,
|
||||
itemBuilder: (context, index) {
|
||||
final draw = draws[index];
|
||||
return _buildDrawCard(draw);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ class _SlotMachineDrawAnimationState extends State<SlotMachineDrawAnimation>
|
|||
super.initState();
|
||||
|
||||
_slotController = AnimationController(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 400),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ class _SlotMachineDrawAnimationState extends State<SlotMachineDrawAnimation>
|
|||
final totalSpins = 25 + (widget.members.length * 2);
|
||||
int currentSpin = 0;
|
||||
|
||||
_slotTimer = Timer.periodic(const Duration(milliseconds: 150), (timer) {
|
||||
_slotTimer = Timer.periodic(const Duration(milliseconds: 250), (timer) {
|
||||
if (currentSpin >= totalSpins) {
|
||||
timer.cancel();
|
||||
_completeAnimation();
|
||||
|
|
@ -506,7 +506,7 @@ class _SlotMachineDrawAnimationState extends State<SlotMachineDrawAnimation>
|
|||
// Slow down in the last 30% of spins
|
||||
timer.cancel();
|
||||
_slotTimer = Timer.periodic(
|
||||
Duration(milliseconds: 200 + (currentSpin * 10)),
|
||||
Duration(milliseconds: 350 + (currentSpin * 15)),
|
||||
(newTimer) {
|
||||
if (currentSpin >= totalSpins) {
|
||||
newTimer.cancel();
|
||||
|
|
|
|||
Loading…
Reference in New Issue