ferrish wheel sound
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
@@ -16,23 +17,34 @@ class FerrisWheelPage extends StatefulWidget {
|
||||
|
||||
class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
with TickerProviderStateMixin {
|
||||
// Animation Controllers
|
||||
late AnimationController _rotationController;
|
||||
late AnimationController _glowController;
|
||||
late AnimationController _pulseController;
|
||||
late AnimationController _idleRotationController;
|
||||
|
||||
// Animations
|
||||
Animation<double>? _spinAnimation;
|
||||
Animation<double>? _pulseAnimation;
|
||||
Animation<double>? _idleRotationAnimation;
|
||||
|
||||
// Audio Players
|
||||
final AudioPlayer _bgmPlayer = AudioPlayer();
|
||||
final AudioPlayer _sfxPlayer = AudioPlayer();
|
||||
|
||||
// Audio Settings
|
||||
bool _isSoundEnabled = true;
|
||||
bool _isMusicEnabled = true;
|
||||
|
||||
// Game State
|
||||
int tokens = 3;
|
||||
bool isSpinning = false;
|
||||
String resultText = 'Belum pernah spin';
|
||||
double currentRotation = 0.0;
|
||||
int currentTabIndex = 0;
|
||||
|
||||
// Game Data
|
||||
List<PrizeHistory> prizeHistory = [];
|
||||
|
||||
List<WheelSection> wheelSections = [
|
||||
WheelSection(
|
||||
color: AppColor.primary,
|
||||
@@ -87,42 +99,8 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// Initialize animation controllers
|
||||
_rotationController = AnimationController(
|
||||
duration: const Duration(seconds: 4),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
_glowController = AnimationController(
|
||||
duration: const Duration(milliseconds: 2000),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
_pulseController = AnimationController(
|
||||
duration: const Duration(milliseconds: 800),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
_idleRotationController = AnimationController(
|
||||
duration: const Duration(seconds: 10), // 10 detik per putaran
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
// Initialize animations
|
||||
_pulseAnimation = Tween<double>(begin: 1.0, end: 1.1).animate(
|
||||
CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut),
|
||||
);
|
||||
|
||||
_idleRotationAnimation = Tween<double>(
|
||||
begin: 0.0,
|
||||
end: 2 * math.pi,
|
||||
).animate(_idleRotationController);
|
||||
|
||||
// Start animations
|
||||
_glowController.repeat(reverse: true);
|
||||
_pulseController.repeat(reverse: true);
|
||||
_idleRotationController.repeat();
|
||||
_initializeAudio();
|
||||
_initializeAnimations();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -131,27 +109,113 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
_glowController.dispose();
|
||||
_pulseController.dispose();
|
||||
_idleRotationController.dispose();
|
||||
_bgmPlayer.dispose();
|
||||
_sfxPlayer.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _initializeAudio() async {
|
||||
try {
|
||||
await _bgmPlayer.setSource(
|
||||
AssetSource('audio/carnival/bgm/carnival_main_theme.mp3'),
|
||||
);
|
||||
await _bgmPlayer.setReleaseMode(ReleaseMode.loop);
|
||||
await _bgmPlayer.setVolume(0.5);
|
||||
if (_isMusicEnabled) _bgmPlayer.resume();
|
||||
} catch (e) {
|
||||
print('Error initializing audio: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _playSound(String soundPath, {double volume = 0.7}) async {
|
||||
if (!_isSoundEnabled) return;
|
||||
try {
|
||||
await _sfxPlayer.stop();
|
||||
await _sfxPlayer.setSource(AssetSource(soundPath));
|
||||
await _sfxPlayer.setVolume(volume);
|
||||
await _sfxPlayer.resume();
|
||||
} catch (e) {
|
||||
print('Error playing sound: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _playButtonTap() =>
|
||||
_playSound('audio/carnival/sfx/button_tap.mp3', volume: 0.3);
|
||||
void _playTokenSound() =>
|
||||
_playSound('audio/carnival/sfx/token_sound.mp3', volume: 0.5);
|
||||
void _playWheelSpin() =>
|
||||
_playSound('audio/carnival/sfx/wheel_spin.mp3', volume: 0.8);
|
||||
|
||||
void _playWinSound(int prizeValue) {
|
||||
if (prizeValue >= 1000000) {
|
||||
_playSound('audio/carnival/sfx/win_big.mp3', volume: 0.9);
|
||||
} else if (prizeValue >= 5000) {
|
||||
_playSound('audio/carnival/sfx/win_medium.mp3', volume: 0.8);
|
||||
} else {
|
||||
_playSound('audio/carnival/sfx/win_small.mp3', volume: 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
void _toggleSound() {
|
||||
setState(() => _isSoundEnabled = !_isSoundEnabled);
|
||||
if (_isSoundEnabled) _playButtonTap();
|
||||
}
|
||||
|
||||
void _toggleMusic() {
|
||||
setState(() => _isMusicEnabled = !_isMusicEnabled);
|
||||
_isMusicEnabled ? _bgmPlayer.resume() : _bgmPlayer.pause();
|
||||
if (_isSoundEnabled) _playButtonTap();
|
||||
}
|
||||
|
||||
void _initializeAnimations() {
|
||||
_rotationController = AnimationController(
|
||||
duration: const Duration(seconds: 4),
|
||||
vsync: this,
|
||||
);
|
||||
_glowController = AnimationController(
|
||||
duration: const Duration(milliseconds: 2000),
|
||||
vsync: this,
|
||||
);
|
||||
_pulseController = AnimationController(
|
||||
duration: const Duration(milliseconds: 800),
|
||||
vsync: this,
|
||||
);
|
||||
_idleRotationController = AnimationController(
|
||||
duration: const Duration(seconds: 10),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
_pulseAnimation = Tween<double>(begin: 1.0, end: 1.1).animate(
|
||||
CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut),
|
||||
);
|
||||
_idleRotationAnimation = Tween<double>(
|
||||
begin: 0.0,
|
||||
end: 2 * math.pi,
|
||||
).animate(_idleRotationController);
|
||||
|
||||
_glowController.repeat(reverse: true);
|
||||
_pulseController.repeat(reverse: true);
|
||||
_idleRotationController.repeat();
|
||||
}
|
||||
|
||||
void _spinWheel() {
|
||||
if (isSpinning || tokens <= 0) return;
|
||||
|
||||
_playWheelSpin();
|
||||
_playTokenSound();
|
||||
|
||||
setState(() {
|
||||
isSpinning = true;
|
||||
tokens--;
|
||||
resultText = 'Sedang berputar...';
|
||||
});
|
||||
|
||||
// Stop idle rotation
|
||||
_idleRotationController.stop();
|
||||
|
||||
int targetSection = math.Random().nextInt(8);
|
||||
double sectionAngle = (2 * math.pi) / 8;
|
||||
double targetAngle = (targetSection * sectionAngle) + (sectionAngle / 2);
|
||||
double baseRotations = 4 + math.Random().nextDouble() * 3;
|
||||
|
||||
// Calculate current total rotation
|
||||
double currentIdleRotation = _idleRotationAnimation?.value ?? 0.0;
|
||||
double finalRotation =
|
||||
currentRotation +
|
||||
@@ -172,12 +236,13 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
|
||||
_rotationController.reset();
|
||||
_rotationController.animateTo(1.0).then((_) {
|
||||
_playWinSound(wheelSections[targetSection].value);
|
||||
|
||||
setState(() {
|
||||
currentRotation = finalRotation;
|
||||
isSpinning = false;
|
||||
resultText =
|
||||
'Selamat! Anda mendapat ${wheelSections[targetSection].prize}!';
|
||||
|
||||
prizeHistory.insert(
|
||||
0,
|
||||
PrizeHistory(
|
||||
@@ -191,8 +256,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
});
|
||||
|
||||
_showWinDialog(wheelSections[targetSection]);
|
||||
|
||||
// Restart idle rotation
|
||||
_idleRotationController.reset();
|
||||
_idleRotationController.repeat();
|
||||
});
|
||||
@@ -235,7 +298,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'🎉 Selamat! 🎉',
|
||||
'Selamat!',
|
||||
style: AppStyle.h5.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textWhite,
|
||||
@@ -256,7 +319,10 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: () {
|
||||
_playButtonTap();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColor.white,
|
||||
foregroundColor: AppColor.primary,
|
||||
@@ -283,9 +349,126 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: AppColor.primaryGradient,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_playButtonTap();
|
||||
context.router.back();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: AppColor.textWhite,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'SPIN & WIN',
|
||||
style: AppStyle.h6.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textWhite,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _toggleMusic,
|
||||
icon: Icon(
|
||||
_isMusicEnabled ? Icons.volume_up : Icons.volume_off,
|
||||
color: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _toggleSound,
|
||||
icon: Icon(
|
||||
_isSoundEnabled ? Icons.graphic_eq : Icons.volume_mute,
|
||||
color: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Tab Selector
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
for (int i = 0; i < 3; i++)
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_playButtonTap();
|
||||
setState(() => currentTabIndex = i);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: currentTabIndex == i
|
||||
? AppColor.white
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Text(
|
||||
['Spin Wheel', 'Daftar Hadiah', 'Riwayat'][i],
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: currentTabIndex == i
|
||||
? AppColor.primary
|
||||
: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Content Area
|
||||
Expanded(
|
||||
child: currentTabIndex == 0
|
||||
? _buildMainContent()
|
||||
: currentTabIndex == 1
|
||||
? _buildPrizeListContent()
|
||||
: _buildHistoryContent(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMainContent() {
|
||||
return Column(
|
||||
children: [
|
||||
// User Info Card
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -376,49 +559,45 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
resultText,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textWhite),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Wheel Section
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// Glow Effect
|
||||
AnimatedBuilder(
|
||||
animation: _glowController,
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
width: 340,
|
||||
height: 340,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.white.withOpacity(
|
||||
0.3 + 0.2 * _glowController.value,
|
||||
),
|
||||
blurRadius: 40,
|
||||
spreadRadius: 10,
|
||||
builder: (context, child) => Container(
|
||||
width: 340,
|
||||
height: 340,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.white.withOpacity(
|
||||
0.3 + 0.2 * _glowController.value,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
blurRadius: 40,
|
||||
spreadRadius: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Spinning Wheel
|
||||
AnimatedBuilder(
|
||||
animation: isSpinning
|
||||
? _rotationController
|
||||
: _idleRotationController,
|
||||
builder: (context, child) {
|
||||
double rotationAngle;
|
||||
|
||||
if (isSpinning) {
|
||||
rotationAngle = _spinAnimation?.value ?? currentRotation;
|
||||
} else {
|
||||
rotationAngle =
|
||||
currentRotation +
|
||||
(_idleRotationAnimation?.value ?? 0.0);
|
||||
}
|
||||
double rotationAngle = isSpinning
|
||||
? (_spinAnimation?.value ?? currentRotation)
|
||||
: (currentRotation +
|
||||
(_idleRotationAnimation?.value ?? 0.0));
|
||||
|
||||
return Transform.rotate(
|
||||
angle: rotationAngle,
|
||||
@@ -429,56 +608,56 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// Spin Button
|
||||
AnimatedBuilder(
|
||||
animation:
|
||||
_pulseAnimation ?? const AlwaysStoppedAnimation(1.0),
|
||||
builder: (context, child) {
|
||||
return Transform.scale(
|
||||
scale: _pulseAnimation?.value ?? 1.0,
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [AppColor.warning, AppColor.warning],
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.black.withOpacity(0.3),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColor.warning.withOpacity(0.5),
|
||||
blurRadius: 20,
|
||||
spreadRadius: (_pulseAnimation?.value ?? 1.0) * 5,
|
||||
),
|
||||
],
|
||||
builder: (context, child) => Transform.scale(
|
||||
scale: _pulseAnimation?.value ?? 1.0,
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColor.warning, AppColor.warning],
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
onTap: _spinWheel,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'SPIN',
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.black.withOpacity(0.3),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColor.warning.withOpacity(0.5),
|
||||
blurRadius: 20,
|
||||
spreadRadius: (_pulseAnimation?.value ?? 1.0) * 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
onTap: _spinWheel,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'SPIN',
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Pointer
|
||||
Positioned(
|
||||
top: 30,
|
||||
child: Container(
|
||||
@@ -498,24 +677,22 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
),
|
||||
),
|
||||
|
||||
// Bottom Banner
|
||||
Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColor.warning, AppColor.warning],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColor.warning, AppColor.warning],
|
||||
),
|
||||
child: Text(
|
||||
'❄️ Spin 30x lagi buat mainin spesial spin',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Text(
|
||||
'Spin 30x lagi buat mainin spesial spin',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -527,7 +704,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
@@ -544,7 +720,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
'🎁 Daftar Hadiah',
|
||||
'Daftar Hadiah',
|
||||
style: AppStyle.h6.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
@@ -639,7 +815,6 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
@@ -656,7 +831,7 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
'📜 Riwayat Hadiah',
|
||||
'Riwayat Hadiah',
|
||||
style: AppStyle.h6.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
@@ -773,152 +948,4 @@ class _FerrisWheelPageState extends State<FerrisWheelPage>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: AppColor.primaryGradient,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => context.router.back(),
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: AppColor.textWhite,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'SPIN & WIN',
|
||||
style: AppStyle.h6.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textWhite,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.volume_up, color: AppColor.textWhite),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.info_outline, color: AppColor.textWhite),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() => currentTabIndex = 0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: currentTabIndex == 0
|
||||
? AppColor.white
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Text(
|
||||
'Spin Wheel',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: currentTabIndex == 0
|
||||
? AppColor.primary
|
||||
: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() => currentTabIndex = 1),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: currentTabIndex == 1
|
||||
? AppColor.white
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Text(
|
||||
'Daftar Hadiah',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: currentTabIndex == 1
|
||||
? AppColor.primary
|
||||
: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() => currentTabIndex = 2),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: currentTabIndex == 2
|
||||
? AppColor.white
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Text(
|
||||
'Riwayat',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: currentTabIndex == 2
|
||||
? AppColor.primary
|
||||
: AppColor.textWhite,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Expanded(
|
||||
child: currentTabIndex == 0
|
||||
? _buildMainContent()
|
||||
: currentTabIndex == 1
|
||||
? _buildPrizeListContent()
|
||||
: _buildHistoryContent(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user