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(
|
// Show draws with a header and conduct draw button
|
||||||
onRefresh: () => _service.loadGroupMonthlyDraws(widget.group.id),
|
return Column(
|
||||||
child: ListView.builder(
|
children: [
|
||||||
padding: EdgeInsets.all(16.w),
|
// Header with Conduct Draw button or status message
|
||||||
itemCount: draws.length,
|
Container(
|
||||||
itemBuilder: (context, index) {
|
padding: EdgeInsets.all(16.w),
|
||||||
final draw = draws[index];
|
decoration: BoxDecoration(
|
||||||
return _buildDrawCard(draw);
|
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();
|
super.initState();
|
||||||
|
|
||||||
_slotController = AnimationController(
|
_slotController = AnimationController(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 400),
|
||||||
vsync: this,
|
vsync: this,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ class _SlotMachineDrawAnimationState extends State<SlotMachineDrawAnimation>
|
||||||
final totalSpins = 25 + (widget.members.length * 2);
|
final totalSpins = 25 + (widget.members.length * 2);
|
||||||
int currentSpin = 0;
|
int currentSpin = 0;
|
||||||
|
|
||||||
_slotTimer = Timer.periodic(const Duration(milliseconds: 150), (timer) {
|
_slotTimer = Timer.periodic(const Duration(milliseconds: 250), (timer) {
|
||||||
if (currentSpin >= totalSpins) {
|
if (currentSpin >= totalSpins) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
_completeAnimation();
|
_completeAnimation();
|
||||||
|
|
@ -506,7 +506,7 @@ class _SlotMachineDrawAnimationState extends State<SlotMachineDrawAnimation>
|
||||||
// Slow down in the last 30% of spins
|
// Slow down in the last 30% of spins
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
_slotTimer = Timer.periodic(
|
_slotTimer = Timer.periodic(
|
||||||
Duration(milliseconds: 200 + (currentSpin * 10)),
|
Duration(milliseconds: 350 + (currentSpin * 15)),
|
||||||
(newTimer) {
|
(newTimer) {
|
||||||
if (currentSpin >= totalSpins) {
|
if (currentSpin >= totalSpins) {
|
||||||
newTimer.cancel();
|
newTimer.cancel();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue