feat: add payment

This commit is contained in:
2026-07-05 16:03:15 +03:30
parent c2356b3242
commit 5017e9a613
30 changed files with 470 additions and 65 deletions
@@ -41,10 +41,12 @@ class _LobbyScreenState extends State<LobbyScreen> {
final d = state.dailyStatus;
if (d is DailySuccess) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('سکه روزانه دریافت شد: +${d.amount}')));
SnackBar(content: Text('سکه روزانه دریافت شد: +${d.amount}')),
);
} else if (d is DailyError) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(d.message)));
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(d.message)));
}
},
builder: (context, state) {
@@ -60,13 +62,16 @@ class _LobbyScreenState extends State<LobbyScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const GlowText('سلطان حکم', size: 44),
const GlowText('حاکم ایرانی', size: 44),
const SizedBox(height: 44),
GameButton(
label: 'بازی',
icon: Icons.style,
width: double.infinity,
colors: const [Color(0xFFC2185B), Color(0xFF6A0D38)],
colors: const [
Color(0xFFC2185B),
Color(0xFF6A0D38),
],
onTap: () async {
await context.push('/game/tiers');
if (context.mounted) _reload();
@@ -77,7 +82,10 @@ class _LobbyScreenState extends State<LobbyScreen> {
label: 'دورهمی',
icon: Icons.group_add,
width: double.infinity,
colors: const [Color(0xFF1565C0), Color(0xFF0A2E57)],
colors: const [
Color(0xFF1565C0),
Color(0xFF0A2E57),
],
onTap: () async {
await context.push('/private');
if (context.mounted) _reload();
@@ -88,7 +96,10 @@ class _LobbyScreenState extends State<LobbyScreen> {
label: 'رتبه‌بندی',
icon: Icons.leaderboard,
width: double.infinity,
colors: const [Color(0xFFE9952F), Color(0xFF9C5A00)],
colors: const [
Color(0xFFE9952F),
Color(0xFF9C5A00),
],
onTap: () => context.push('/leaderboard'),
),
const SizedBox(height: 16),
@@ -96,7 +107,10 @@ class _LobbyScreenState extends State<LobbyScreen> {
label: 'فروشگاه',
icon: Icons.storefront,
width: double.infinity,
colors: const [Color(0xFF7B1FA2), Color(0xFF3E0A57)],
colors: const [
Color(0xFF7B1FA2),
Color(0xFF3E0A57),
],
onTap: () => _openShop(context),
),
const SizedBox(height: 16),
@@ -104,9 +118,14 @@ class _LobbyScreenState extends State<LobbyScreen> {
label: 'سکه روزانه',
icon: Icons.monetization_on,
width: double.infinity,
colors: const [AppColors.success, AppColors.successDark],
onTap: () =>
context.read<WalletBloc>().add(ClaimDailyEvent()),
colors: const [
AppColors.success,
AppColors.successDark,
],
onTap:
() => context.read<WalletBloc>().add(
ClaimDailyEvent(),
),
),
],
),
@@ -119,8 +138,10 @@ class _LobbyScreenState extends State<LobbyScreen> {
context.go('/login');
},
icon: const Icon(Icons.logout, color: Colors.white54),
label: const Text('خروج',
style: TextStyle(color: Colors.white54)),
label: const Text(
'خروج',
style: TextStyle(color: Colors.white54),
),
),
const SizedBox(height: 8),
],
@@ -176,9 +197,10 @@ class _TopBar extends StatelessWidget {
color: AppColors.panel,
border: Border.all(color: AppColors.gold, width: 2),
),
child: (w == null || w.avatar.isEmpty)
? const Icon(Icons.person, color: AppColors.gold)
: ClipOval(child: RandomAvatar(w.avatar)),
child:
(w == null || w.avatar.isEmpty)
? const Icon(Icons.person, color: AppColors.gold)
: ClipOval(child: RandomAvatar(w.avatar)),
),
),
const SizedBox(width: 10),
@@ -186,23 +208,35 @@ class _TopBar extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(children: [
if (w != null && w.name.isNotEmpty) ...[
Text(w.name,
Row(
children: [
if (w != null && w.name.isNotEmpty) ...[
Text(
w.name,
style: const TextStyle(
color: Colors.white, fontWeight: FontWeight.bold)),
const SizedBox(width: 6),
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
const SizedBox(width: 6),
],
if (w?.vip == true) const _VipTag(),
],
if (w?.vip == true) const _VipTag(),
]),
),
const SizedBox(height: 2),
Row(children: [
const Icon(Icons.star, color: AppColors.gold, size: 16),
const SizedBox(width: 4),
Text('سطح ${w?.level ?? '-'}',
Row(
children: [
const Icon(Icons.star, color: AppColors.gold, size: 16),
const SizedBox(width: 4),
Text(
'سطح ${w?.level ?? '-'}',
style: const TextStyle(
color: AppColors.gold, fontWeight: FontWeight.bold)),
]),
color: AppColors.gold,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 4),
ClipRRect(
borderRadius: BorderRadius.circular(4),
@@ -210,9 +244,10 @@ class _TopBar extends StatelessWidget {
width: 96,
height: 7,
child: LinearProgressIndicator(
value: (w == null || w.xpForNext == 0)
? 0
: w.xpIntoLevel / w.xpForNext,
value:
(w == null || w.xpForNext == 0)
? 0
: w.xpIntoLevel / w.xpForNext,
backgroundColor: Colors.white10,
valueColor: const AlwaysStoppedAnimation(AppColors.gold),
),
@@ -224,13 +259,17 @@ class _TopBar extends StatelessWidget {
GestureDetector(
onTap: onCoinTap,
child: StatChip(
icon: Icons.confirmation_number, value: '${w?.tickets ?? 0}'),
icon: Icons.confirmation_number,
value: '${w?.tickets ?? 0}',
),
),
const SizedBox(width: 8),
GestureDetector(
onTap: onCoinTap,
child: StatChip(
icon: Icons.monetization_on, value: '${w?.coins ?? 0}'),
icon: Icons.monetization_on,
value: '${w?.coins ?? 0}',
),
),
],
),
@@ -246,14 +285,18 @@ class _VipTag extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFFFFD54F), AppColors.goldDark]),
colors: [Color(0xFFFFD54F), AppColors.goldDark],
),
borderRadius: BorderRadius.circular(6),
),
child: const Text('VIP',
style: TextStyle(
color: AppColors.bg,
fontWeight: FontWeight.bold,
fontSize: 10)),
child: const Text(
'VIP',
style: TextStyle(
color: AppColors.bg,
fontWeight: FontWeight.bold,
fontSize: 10,
),
),
);
}
}