feat: cleaning code
This commit is contained in:
@@ -1,15 +1,42 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// تم بصری حکمشو (الهامگرفته از اپ مرجع: قرمز تیره و طلایی).
|
/// تم بصری حکمشو (الهامگرفته از اپ مرجع: قرمز تیره و طلایی).
|
||||||
|
/// همهی رنگهای پرتکرار اینجا متمرکزند تا در کد بهصورت ثابتِ بینام تکرار نشوند.
|
||||||
class AppColors {
|
class AppColors {
|
||||||
|
// پایه
|
||||||
static const bg = Color(0xFF3A0A12);
|
static const bg = Color(0xFF3A0A12);
|
||||||
static const bgDark = Color(0xFF240108);
|
static const bgDark = Color(0xFF240108);
|
||||||
static const panel = Color(0xFF5A0E1A);
|
static const panel = Color(0xFF5A0E1A);
|
||||||
static const gold = Color(0xFFE9B949);
|
static const gold = Color(0xFFE9B949);
|
||||||
static const goldDark = Color(0xFFB8860B);
|
static const goldDark = Color(0xFFB8860B);
|
||||||
|
static const goldFaint = Color(0x33E9B949); // جداکننده/خطِ طلاییِ کمرنگ
|
||||||
static const accent = Color(0xFFB81D2A);
|
static const accent = Color(0xFFB81D2A);
|
||||||
static const green = Color(0xFF2E7D32);
|
static const green = Color(0xFF2E7D32);
|
||||||
static const text = Color(0xFFF5E9D0);
|
static const text = Color(0xFFF5E9D0);
|
||||||
|
|
||||||
|
// معنایی (دکمهها/وضعیت/خالها)
|
||||||
|
static const success = Color(0xFF3FA34D); // سبزِ روشنِ دکمه
|
||||||
|
static const successDark = Color(0xFF1B5E20); // سبزِ تیره (گرادیان/درخشش)
|
||||||
|
static const online = Color(0xFF4CD964); // نشانگرِ اتصالِ آنلاین
|
||||||
|
static const suitRed = Color(0xFFD32F2F); // دل/خشت
|
||||||
|
static const suitDark = Color(0xFF1A1A1A); // پیک/گشنیز (مرکّبِ کارت)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// نمادِ یکنواییِ خال و رنگش از روی نامِ کاملِ خال (hearts/diamonds/clubs/spades).
|
||||||
|
/// منبعِ واحدِ این منطق تا در صفحههای مختلف تکرار نشود.
|
||||||
|
(String, Color) suitGlyph(String? suit) {
|
||||||
|
switch (suit) {
|
||||||
|
case 'hearts':
|
||||||
|
return ('♥', AppColors.suitRed);
|
||||||
|
case 'diamonds':
|
||||||
|
return ('♦', AppColors.suitRed);
|
||||||
|
case 'clubs':
|
||||||
|
return ('♣', Colors.white);
|
||||||
|
case 'spades':
|
||||||
|
return ('♠', Colors.white);
|
||||||
|
default:
|
||||||
|
return ('—', Colors.white54);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppTheme {
|
class AppTheme {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class GameBackground extends StatelessWidget {
|
|||||||
gradient: RadialGradient(
|
gradient: RadialGradient(
|
||||||
center: Alignment(0, -0.4),
|
center: Alignment(0, -0.4),
|
||||||
radius: 1.3,
|
radius: 1.3,
|
||||||
colors: [Color(0xFF5A0F1E), Color(0xFF240108)],
|
colors: [Color(0xFF5A0F1E), AppColors.bgDark],
|
||||||
stops: [0.0, 1.0],
|
stops: [0.0, 1.0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -33,7 +33,7 @@ class GameBackground extends StatelessWidget {
|
|||||||
gradient: RadialGradient(
|
gradient: RadialGradient(
|
||||||
center: Alignment(0, -1.1),
|
center: Alignment(0, -1.1),
|
||||||
radius: 1.0,
|
radius: 1.0,
|
||||||
colors: [Color(0x33E9B949), Color(0x00000000)],
|
colors: [AppColors.goldFaint, Color(0x00000000)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -65,7 +65,7 @@ class GamePanel extends StatelessWidget {
|
|||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Color(0xFF6E1322), Color(0xFF3A0A12)],
|
colors: [Color(0xFF6E1322), AppColors.bg],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(radius),
|
borderRadius: BorderRadius.circular(radius),
|
||||||
border: Border.all(color: AppColors.gold, width: 2),
|
border: Border.all(color: AppColors.gold, width: 2),
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../theme/app_theme.dart';
|
||||||
|
|
||||||
/// نشانِ رتبه (برنز/نقره/طلا/الماس/پادشاه) با رنگ و برچسبِ فارسی.
|
/// نشانِ رتبه (برنز/نقره/طلا/الماس/پادشاه) با رنگ و برچسبِ فارسی.
|
||||||
class RankBadge extends StatelessWidget {
|
class RankBadge extends StatelessWidget {
|
||||||
final String tier; // bronze..king
|
final String tier; // bronze..king
|
||||||
@@ -10,7 +12,7 @@ class RankBadge extends StatelessWidget {
|
|||||||
static const _tiers = {
|
static const _tiers = {
|
||||||
'bronze': ('برنز', [Color(0xFFCD7F32), Color(0xFF8C5A2B)]),
|
'bronze': ('برنز', [Color(0xFFCD7F32), Color(0xFF8C5A2B)]),
|
||||||
'silver': ('نقره', [Color(0xFFBFC6CC), Color(0xFF8A949B)]),
|
'silver': ('نقره', [Color(0xFFBFC6CC), Color(0xFF8A949B)]),
|
||||||
'gold': ('طلا', [Color(0xFFFFD54F), Color(0xFFB8860B)]),
|
'gold': ('طلا', [Color(0xFFFFD54F), AppColors.goldDark]),
|
||||||
'diamond': ('الماس', [Color(0xFF5BE0E6), Color(0xFF1E8A99)]),
|
'diamond': ('الماس', [Color(0xFF5BE0E6), Color(0xFF1E8A99)]),
|
||||||
'king': ('پادشاه', [Color(0xFFB388FF), Color(0xFF6A1B9A)]),
|
'king': ('پادشاه', [Color(0xFFB388FF), Color(0xFF6A1B9A)]),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class _OtpScreenState extends State<OtpScreen> {
|
|||||||
GameButton(
|
GameButton(
|
||||||
label: 'ورود',
|
label: 'ورود',
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
colors: const [Color(0xFF3FA34D), Color(0xFF1B5E20)],
|
colors: const [AppColors.success, AppColors.successDark],
|
||||||
onTap: (!_valid || loading)
|
onTap: (!_valid || loading)
|
||||||
? null
|
? null
|
||||||
: () => _submit(context),
|
: () => _submit(context),
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class _ProfileSetupScreenState extends State<ProfileSetupScreen> {
|
|||||||
GameButton(
|
GameButton(
|
||||||
label: saving ? 'در حال ذخیره…' : 'تأیید و ورود',
|
label: saving ? 'در حال ذخیره…' : 'تأیید و ورود',
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
colors: const [Color(0xFF3FA34D), Color(0xFF1B5E20)],
|
colors: const [AppColors.success, AppColors.successDark],
|
||||||
onTap: (!_valid || saving)
|
onTap: (!_valid || saving)
|
||||||
? null
|
? null
|
||||||
: () => context.read<AuthBloc>().add(
|
: () => context.read<AuthBloc>().add(
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class _GameScreenState extends State<GameScreen> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
colors: [Color(0xFFE9B949), Color(0xFFB8860B)],
|
colors: [AppColors.gold, AppColors.goldDark],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 8)],
|
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 8)],
|
||||||
@@ -179,7 +179,7 @@ class _GameScreenState extends State<GameScreen> {
|
|||||||
child: const Text(
|
child: const Text(
|
||||||
'نوبت شماست',
|
'نوبت شماست',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF3A0A12),
|
color: AppColors.bg,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
@@ -328,7 +328,7 @@ class _GameScreenState extends State<GameScreen> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'$_countdown',
|
'$_countdown',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Color(0xFF3A0A12),
|
color: AppColors.bg,
|
||||||
fontSize: 26,
|
fontSize: 26,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
@@ -398,8 +398,8 @@ class _GameScreenState extends State<GameScreen> {
|
|||||||
Widget _trumpPicker(BuildContext context) {
|
Widget _trumpPicker(BuildContext context) {
|
||||||
const suits = [
|
const suits = [
|
||||||
('spades', '♠', 'پیک', Colors.white),
|
('spades', '♠', 'پیک', Colors.white),
|
||||||
('hearts', '♥', 'دل', Color(0xFFD32F2F)),
|
('hearts', '♥', 'دل', AppColors.suitRed),
|
||||||
('diamonds', '♦', 'خشت', Color(0xFFD32F2F)),
|
('diamonds', '♦', 'خشت', AppColors.suitRed),
|
||||||
('clubs', '♣', 'گشنیز', Colors.white),
|
('clubs', '♣', 'گشنیز', Colors.white),
|
||||||
];
|
];
|
||||||
return Container(
|
return Container(
|
||||||
@@ -448,7 +448,7 @@ class _GameScreenState extends State<GameScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
const Divider(color: Color(0x33E9B949), height: 1),
|
const Divider(color: AppColors.goldFaint, height: 1),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
// بُرِ مجدد با مصرفِ یک بلیت (۵ کارتِ تازه، سپس باز هم انتخابِ حکم).
|
// بُرِ مجدد با مصرفِ یک بلیت (۵ کارتِ تازه، سپس باز هم انتخابِ حکم).
|
||||||
BlocBuilder<WalletBloc, WalletBlocState>(
|
BlocBuilder<WalletBloc, WalletBlocState>(
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ class _LobbyViewState extends State<_LobbyView> {
|
|||||||
label: 'شروع بازی',
|
label: 'شروع بازی',
|
||||||
icon: Icons.play_arrow,
|
icon: Icons.play_arrow,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
colors: const [Color(0xFF3FA34D), Color(0xFF1B5E20)],
|
colors: const [AppColors.success, AppColors.successDark],
|
||||||
onTap: () => context.read<GameBloc>().startTable(_hands),
|
onTap: () => context.read<GameBloc>().startTable(_hands),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@@ -316,7 +316,7 @@ class _LobbyViewState extends State<_LobbyView> {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
gradient: selected
|
gradient: selected
|
||||||
? const LinearGradient(
|
? const LinearGradient(
|
||||||
colors: [Color(0xFFE9B949), Color(0xFFB8860B)])
|
colors: [AppColors.gold, AppColors.goldDark])
|
||||||
: null,
|
: null,
|
||||||
color: selected ? null : AppColors.panel,
|
color: selected ? null : AppColors.panel,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@@ -326,7 +326,7 @@ class _LobbyViewState extends State<_LobbyView> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
fa[h]!,
|
fa[h]!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: selected ? const Color(0xFF3A0A12) : Colors.white,
|
color: selected ? AppColors.bg : Colors.white,
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class _TierCard extends StatelessWidget {
|
|||||||
const _TierCard({required this.tier, required this.index});
|
const _TierCard({required this.tier, required this.index});
|
||||||
|
|
||||||
static const _palettes = [
|
static const _palettes = [
|
||||||
[Color(0xFF43A047), Color(0xFF1B5E20)],
|
[Color(0xFF43A047), AppColors.successDark],
|
||||||
[Color(0xFFE53935), Color(0xFF8E0E1B)],
|
[Color(0xFFE53935), Color(0xFF8E0E1B)],
|
||||||
[Color(0xFF1E88E5), Color(0xFF0D3C73)],
|
[Color(0xFF1E88E5), Color(0xFF0D3C73)],
|
||||||
[Color(0xFF8E24AA), Color(0xFF4A0D5E)],
|
[Color(0xFF8E24AA), Color(0xFF4A0D5E)],
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import 'package:flame/components.dart';
|
|||||||
import 'package:flame/effects.dart';
|
import 'package:flame/effects.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
const _gold = Color(0xFFE9B949);
|
import '../../../../../core/theme/app_theme.dart';
|
||||||
const _goldDark = Color(0xFF8A5A00);
|
|
||||||
|
const _gold = AppColors.gold;
|
||||||
|
const _goldDark = Color(0xFF8A5A00); // طلاییِ تیرهترِ مخصوصِ نشانها
|
||||||
|
|
||||||
/// ستارهی طلایی روی بازیکنِ نوبتدار (مطابقِ تصویرِ مرجع).
|
/// ستارهی طلایی روی بازیکنِ نوبتدار (مطابقِ تصویرِ مرجع).
|
||||||
class StarBadge extends PositionComponent {
|
class StarBadge extends PositionComponent {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flame/events.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../core/network/card_images.dart';
|
import '../../../../../core/network/card_images.dart';
|
||||||
|
import '../../../../../core/theme/app_theme.dart';
|
||||||
|
|
||||||
/// یک کارت روی میز؛ اگر تصویر `assets/images/cards/<code>.png` موجود باشد از آن
|
/// یک کارت روی میز؛ اگر تصویر `assets/images/cards/<code>.png` موجود باشد از آن
|
||||||
/// استفاده میکند، وگرنه نسخهی برداری میکشد. برای پشت کارت `back.jpg`.
|
/// استفاده میکند، وگرنه نسخهی برداری میکشد. برای پشت کارت `back.jpg`.
|
||||||
@@ -180,7 +181,7 @@ class CardComponent extends PositionComponent
|
|||||||
Paint()
|
Paint()
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 1.5
|
..strokeWidth = 1.5
|
||||||
..color = const Color(0xFF1A1A1A),
|
..color = AppColors.suitDark,
|
||||||
);
|
);
|
||||||
|
|
||||||
// هایلایت طلایی: هنگام کشیدن همیشه (انتخاب)، و پررنگتر روی ناحیهی انداختن.
|
// هایلایت طلایی: هنگام کشیدن همیشه (انتخاب)، و پررنگتر روی ناحیهی انداختن.
|
||||||
@@ -190,7 +191,7 @@ class CardComponent extends PositionComponent
|
|||||||
Paint()
|
Paint()
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = size.x * (_overZone ? 0.06 : 0.035)
|
..strokeWidth = size.x * (_overZone ? 0.06 : 0.035)
|
||||||
..color = const Color(0xFFE9B949)
|
..color = AppColors.gold
|
||||||
..maskFilter = MaskFilter.blur(BlurStyle.normal, _overZone ? 6 : 3),
|
..maskFilter = MaskFilter.blur(BlurStyle.normal, _overZone ? 6 : 3),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ class CardComponent extends PositionComponent
|
|||||||
Paint()
|
Paint()
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 2
|
..strokeWidth = 2
|
||||||
..color = const Color(0xFFE9B949),
|
..color = AppColors.gold,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,13 +225,13 @@ class CardComponent extends PositionComponent
|
|||||||
(String, Color) _suit(String s) {
|
(String, Color) _suit(String s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case 'H':
|
case 'H':
|
||||||
return ('♥', const Color(0xFFD32F2F));
|
return ('♥', AppColors.suitRed);
|
||||||
case 'D':
|
case 'D':
|
||||||
return ('♦', const Color(0xFFD32F2F));
|
return ('♦', AppColors.suitRed);
|
||||||
case 'C':
|
case 'C':
|
||||||
return ('♣', const Color(0xFF1A1A1A));
|
return ('♣', AppColors.suitDark);
|
||||||
default:
|
default:
|
||||||
return ('♠', const Color(0xFF1A1A1A));
|
return ('♠', AppColors.suitDark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:flame/game.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../core/service/app_sounds.dart';
|
import '../../../../../core/service/app_sounds.dart';
|
||||||
|
import '../../../../../core/theme/app_theme.dart';
|
||||||
import '../../../domain/entities/game_entities.dart';
|
import '../../../domain/entities/game_entities.dart';
|
||||||
import '../../bloc/game_bloc.dart';
|
import '../../bloc/game_bloc.dart';
|
||||||
import 'card_codes.dart';
|
import 'card_codes.dart';
|
||||||
@@ -222,7 +223,7 @@ class HokmGame extends FlameGame {
|
|||||||
|
|
||||||
/// نمایشِ بزرگ و گذرای حکمِ انتخابشده در مرکزِ میز (با پاپ).
|
/// نمایشِ بزرگ و گذرای حکمِ انتخابشده در مرکزِ میز (با پاپ).
|
||||||
void _spawnTrumpReveal(String trump) {
|
void _spawnTrumpReveal(String trump) {
|
||||||
final (sym, col) = _trumpGlyph(trump);
|
final (sym, col) = suitGlyph(trump);
|
||||||
final reveal = TextComponent(
|
final reveal = TextComponent(
|
||||||
text: 'حکم $sym',
|
text: 'حکم $sym',
|
||||||
anchor: Anchor.center,
|
anchor: Anchor.center,
|
||||||
@@ -606,16 +607,4 @@ class HokmGame extends FlameGame {
|
|||||||
add(c);
|
add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
(String, Color) _trumpGlyph(String suit) {
|
|
||||||
switch (suit) {
|
|
||||||
case 'hearts':
|
|
||||||
return ('♥', const Color(0xFFD32F2F));
|
|
||||||
case 'diamonds':
|
|
||||||
return ('♦', const Color(0xFFD32F2F));
|
|
||||||
case 'clubs':
|
|
||||||
return ('♣', Colors.white);
|
|
||||||
default:
|
|
||||||
return ('♠', Colors.white);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import 'dart:math' as math;
|
|||||||
import 'package:flame/components.dart';
|
import 'package:flame/components.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// رنگهای مشترکِ میز.
|
import '../../../../../core/theme/app_theme.dart';
|
||||||
const _gold = Color(0xFFE9B949);
|
|
||||||
const _goldDark = Color(0xFFB8860B);
|
// رنگهای مشترکِ میز (منبعِ واحد در AppColors).
|
||||||
|
const _gold = AppColors.gold;
|
||||||
|
const _goldDark = AppColors.goldDark;
|
||||||
|
|
||||||
/// میز: زمینِ سبزِ نمدی در کلِ صفحه + یک «میزِ» مرکزیِ سرمهای با قابِ طلاییِ
|
/// میز: زمینِ سبزِ نمدی در کلِ صفحه + یک «میزِ» مرکزیِ سرمهای با قابِ طلاییِ
|
||||||
/// دولایه (مطابقِ تصویرِ مرجع). کارتهای زمین داخلِ ناحیهی سرمهای انداخته میشوند
|
/// دولایه (مطابقِ تصویرِ مرجع). کارتهای زمین داخلِ ناحیهی سرمهای انداخته میشوند
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'dart:math' as math;
|
|||||||
import 'package:flame/components.dart';
|
import 'package:flame/components.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../../../core/theme/app_theme.dart';
|
||||||
|
|
||||||
/// حلقهی شمارشِ معکوسِ نوبت: کمانی که در طولِ مهلتِ نوبت خالی میشود.
|
/// حلقهی شمارشِ معکوسِ نوبت: کمانی که در طولِ مهلتِ نوبت خالی میشود.
|
||||||
/// در ثانیههای پایانی قرمز و ضرباندار میشود. (صدای ضربانِ قلب در HokmGame
|
/// در ثانیههای پایانی قرمز و ضرباندار میشود. (صدای ضربانِ قلب در HokmGame
|
||||||
/// مدیریت میشود تا هنگامِ بازیشدنِ کارت بلافاصله قطع شود.)
|
/// مدیریت میشود تا هنگامِ بازیشدنِ کارت بلافاصله قطع شود.)
|
||||||
@@ -50,7 +52,7 @@ class TurnTimer extends PositionComponent {
|
|||||||
: (1 - _elapsed / durationSeconds).clamp(0.0, 1.0);
|
: (1 - _elapsed / durationSeconds).clamp(0.0, 1.0);
|
||||||
if (frac <= 0) return;
|
if (frac <= 0) return;
|
||||||
|
|
||||||
final color = frac > 0.35 ? const Color(0xFFE9B949) : const Color(0xFFE53935);
|
final color = frac > 0.35 ? AppColors.gold : AppColors.suitRed;
|
||||||
final arc = Paint()
|
final arc = Paint()
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
..strokeWidth = 4
|
..strokeWidth = 4
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:random_avatar/random_avatar.dart';
|
import 'package:random_avatar/random_avatar.dart';
|
||||||
|
|
||||||
import '../../../../core/network/ws_client.dart';
|
import '../../../../core/network/ws_client.dart';
|
||||||
|
import '../../../../core/theme/app_theme.dart';
|
||||||
import '../../domain/entities/game_entities.dart';
|
import '../../domain/entities/game_entities.dart';
|
||||||
|
|
||||||
/// اوورلیِ روی صحنهی Flame: آواتارِ بازیکنان با قابِ طلایی، نام، نشانِ رتبه،
|
/// اوورلیِ روی صحنهی Flame: آواتارِ بازیکنان با قابِ طلایی، نام، نشانِ رتبه،
|
||||||
@@ -105,7 +106,7 @@ class TableHud extends StatelessWidget {
|
|||||||
width: 1,
|
width: 1,
|
||||||
height: 30,
|
height: 30,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12),
|
margin: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
color: const Color(0x33E9B949),
|
color: AppColors.goldFaint,
|
||||||
),
|
),
|
||||||
_scoreCol('حریف', opp),
|
_scoreCol('حریف', opp),
|
||||||
],
|
],
|
||||||
@@ -121,7 +122,7 @@ class TableHud extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: const TextStyle(color: Color(0xFFE9B949), fontSize: 12),
|
style: const TextStyle(color: AppColors.gold, fontSize: 12),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'$v',
|
'$v',
|
||||||
@@ -135,7 +136,7 @@ class TableHud extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _hokmChip() {
|
Widget _hokmChip() {
|
||||||
final (glyph, color) = _trumpGlyph(s.trump);
|
final (glyph, color) = suitGlyph(s.trump);
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||||
decoration: _panelDeco(),
|
decoration: _panelDeco(),
|
||||||
@@ -145,7 +146,7 @@ class TableHud extends StatelessWidget {
|
|||||||
const Text(
|
const Text(
|
||||||
'حکم',
|
'حکم',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFFE9B949),
|
color: AppColors.gold,
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
@@ -168,14 +169,14 @@ class TableHud extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
ok ? Icons.wifi : Icons.wifi_off,
|
ok ? Icons.wifi : Icons.wifi_off,
|
||||||
color: ok ? const Color(0xFF4CD964) : Colors.redAccent,
|
color: ok ? AppColors.online : Colors.redAccent,
|
||||||
size: 16,
|
size: 16,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
Text(
|
Text(
|
||||||
ok ? 'آنلاین' : 'قطع',
|
ok ? 'آنلاین' : 'قطع',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: ok ? const Color(0xFF4CD964) : Colors.redAccent,
|
color: ok ? AppColors.online : Colors.redAccent,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
@@ -186,7 +187,7 @@ class TableHud extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
_RoundBtn(
|
_RoundBtn(
|
||||||
icon: Icons.logout,
|
icon: Icons.logout,
|
||||||
color: const Color(0xFFB81D2A),
|
color: AppColors.accent,
|
||||||
onTap: onExit,
|
onTap: onExit,
|
||||||
size: 40,
|
size: 40,
|
||||||
),
|
),
|
||||||
@@ -201,24 +202,9 @@ class TableHud extends StatelessWidget {
|
|||||||
colors: [Color(0xFF2A2018), Color(0xFF14100B)],
|
colors: [Color(0xFF2A2018), Color(0xFF14100B)],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
border: Border.all(color: const Color(0xFFB8860B), width: 1.4),
|
border: Border.all(color: AppColors.goldDark, width: 1.4),
|
||||||
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 6)],
|
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 6)],
|
||||||
);
|
);
|
||||||
|
|
||||||
(String, Color) _trumpGlyph(String? suit) {
|
|
||||||
switch (suit) {
|
|
||||||
case 'hearts':
|
|
||||||
return ('♥', const Color(0xFFE53935));
|
|
||||||
case 'diamonds':
|
|
||||||
return ('♦', const Color(0xFFE53935));
|
|
||||||
case 'clubs':
|
|
||||||
return ('♣', Colors.white);
|
|
||||||
case 'spades':
|
|
||||||
return ('♠', Colors.white);
|
|
||||||
default:
|
|
||||||
return ('—', Colors.white54);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PlayerSeat extends StatelessWidget {
|
class _PlayerSeat extends StatelessWidget {
|
||||||
@@ -256,7 +242,7 @@ class _PlayerSeat extends StatelessWidget {
|
|||||||
color: const Color(0xCC14100B),
|
color: const Color(0xCC14100B),
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: isTurn ? const Color(0xFFE9B949) : const Color(0x55B8860B),
|
color: isTurn ? AppColors.gold : const Color(0x55B8860B),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -265,7 +251,7 @@ class _PlayerSeat extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: isTurn ? const Color(0xFFE9B949) : Colors.white,
|
color: isTurn ? AppColors.gold : Colors.white,
|
||||||
fontSize: diameter * 0.18,
|
fontSize: diameter * 0.18,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
@@ -288,7 +274,7 @@ class _PlayerSeat extends StatelessWidget {
|
|||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Color(0xFFF3D27A), Color(0xFFB8860B)],
|
colors: [Color(0xFFF3D27A), AppColors.goldDark],
|
||||||
),
|
),
|
||||||
boxShadow: const [
|
boxShadow: const [
|
||||||
BoxShadow(color: Colors.black54, blurRadius: 6),
|
BoxShadow(color: Colors.black54, blurRadius: 6),
|
||||||
@@ -359,7 +345,7 @@ class _PlayerSeat extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'${player.coins}',
|
'${player.coins}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: const Color(0xFFE9B949),
|
color: AppColors.gold,
|
||||||
fontSize: diameter * 0.16,
|
fontSize: diameter * 0.16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -450,7 +436,7 @@ class _RingPainter extends CustomPainter {
|
|||||||
const start = -1.5708; // بالا
|
const start = -1.5708; // بالا
|
||||||
final sweep = 6.28318 * left;
|
final sweep = 6.28318 * left;
|
||||||
final color =
|
final color =
|
||||||
left < 0.3 ? const Color(0xFFE53935) : const Color(0xFF4CD964);
|
left < 0.3 ? AppColors.suitRed : AppColors.online;
|
||||||
canvas.drawArc(
|
canvas.drawArc(
|
||||||
Rect.fromCircle(center: center, radius: radius),
|
Rect.fromCircle(center: center, radius: radius),
|
||||||
start,
|
start,
|
||||||
@@ -524,7 +510,7 @@ class _TricksBadgeState extends State<_TricksBadge>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xFF7B0E14),
|
color: const Color(0xFF7B0E14),
|
||||||
borderRadius: BorderRadius.circular(d),
|
borderRadius: BorderRadius.circular(d),
|
||||||
border: Border.all(color: const Color(0xFFE9B949), width: 1.4),
|
border: Border.all(color: AppColors.gold, width: 1.4),
|
||||||
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 4)],
|
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 4)],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -566,7 +552,7 @@ class _RoundBtn extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: color,
|
color: color,
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: const Color(0xFFE9B949), width: 1.6),
|
border: Border.all(color: AppColors.gold, width: 1.6),
|
||||||
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 6)],
|
boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 6)],
|
||||||
),
|
),
|
||||||
child: Icon(icon, color: Colors.white, size: size * 0.5),
|
child: Icon(icon, color: Colors.white, size: size * 0.5),
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ class ProfileScreen extends StatelessWidget {
|
|||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
colors: [Color(0xFFFFD54F), Color(0xFFB8860B)],
|
colors: [Color(0xFFFFD54F), AppColors.goldDark],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.edit,
|
Icons.edit,
|
||||||
color: Color(0xFF3A0A12),
|
color: AppColors.bg,
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -246,7 +246,7 @@ class ProfileScreen extends StatelessWidget {
|
|||||||
GameButton(
|
GameButton(
|
||||||
label: 'تهیه اشتراک VIP',
|
label: 'تهیه اشتراک VIP',
|
||||||
icon: Icons.workspace_premium,
|
icon: Icons.workspace_premium,
|
||||||
colors: const [Color(0xFFFFC107), Color(0xFFB8860B)],
|
colors: const [Color(0xFFFFC107), AppColors.goldDark],
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await context.push('/vip');
|
await context.push('/vip');
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
@@ -335,14 +335,14 @@ class _VipBadge extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
colors: [Color(0xFFFFD54F), Color(0xFFB8860B)],
|
colors: [Color(0xFFFFD54F), AppColors.goldDark],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'VIP',
|
'VIP',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF3A0A12),
|
color: AppColors.bg,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
@@ -464,7 +464,7 @@ class _EditProfileSheetState extends State<_EditProfileSheet> {
|
|||||||
GameButton(
|
GameButton(
|
||||||
label: 'تأیید',
|
label: 'تأیید',
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
colors: const [Color(0xFF3FA34D), Color(0xFF1B5E20)],
|
colors: const [AppColors.success, AppColors.successDark],
|
||||||
onTap:
|
onTap:
|
||||||
_valid
|
_valid
|
||||||
? () => Navigator.pop(context, {
|
? () => Navigator.pop(context, {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class _CoinsTab extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
_ItemCard(
|
_ItemCard(
|
||||||
title: 'سکه رایگان',
|
title: 'سکه رایگان',
|
||||||
glowColor: const Color(0xFF1B5E20),
|
glowColor: AppColors.successDark,
|
||||||
icon: Icons.card_giftcard,
|
icon: Icons.card_giftcard,
|
||||||
subtitle: 'با دیدن تبلیغ',
|
subtitle: 'با دیدن تبلیغ',
|
||||||
action: _PriceButton(
|
action: _PriceButton(
|
||||||
@@ -210,7 +210,7 @@ class _CoinsTab extends StatelessWidget {
|
|||||||
for (final p in packages)
|
for (final p in packages)
|
||||||
_ItemCard(
|
_ItemCard(
|
||||||
title: p.title,
|
title: p.title,
|
||||||
glowColor: const Color(0xFF1B5E20),
|
glowColor: AppColors.successDark,
|
||||||
icon: Icons.savings,
|
icon: Icons.savings,
|
||||||
ribbon: p.bonusPct > 0 ? '+${p.bonusPct}٪' : null,
|
ribbon: p.bonusPct > 0 ? '+${p.bonusPct}٪' : null,
|
||||||
subtitle:
|
subtitle:
|
||||||
@@ -402,7 +402,7 @@ class _ItemCard extends StatelessWidget {
|
|||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Color(0xFF6E1322), Color(0xFF3A0A12)],
|
colors: [Color(0xFF6E1322), AppColors.bg],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
border: Border.all(color: AppColors.gold, width: 1.6),
|
border: Border.all(color: AppColors.gold, width: 1.6),
|
||||||
@@ -447,7 +447,7 @@ class _ItemCard extends StatelessWidget {
|
|||||||
angle: -0.7,
|
angle: -0.7,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 3),
|
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 3),
|
||||||
color: const Color(0xFF2E7D32),
|
color: AppColors.green,
|
||||||
child: Text(
|
child: Text(
|
||||||
ribbon!,
|
ribbon!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -571,7 +571,7 @@ class _PriceButton extends StatelessWidget {
|
|||||||
disabled
|
disabled
|
||||||
? const [Color(0xFF555555), Color(0xFF333333)]
|
? const [Color(0xFF555555), Color(0xFF333333)]
|
||||||
: green
|
: green
|
||||||
? const [Color(0xFF3FA34D), Color(0xFF1B5E20)]
|
? const [AppColors.success, AppColors.successDark]
|
||||||
: const [Color(0xFFD83A4A), Color(0xFF8E0E1B)];
|
: const [Color(0xFFD83A4A), Color(0xFF8E0E1B)];
|
||||||
return Opacity(
|
return Opacity(
|
||||||
opacity: disabled ? 0.85 : 1,
|
opacity: disabled ? 0.85 : 1,
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class _VipPackageTile extends StatelessWidget {
|
|||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Color(0xFF6E1322), Color(0xFF3A0A12)],
|
colors: [Color(0xFF6E1322), AppColors.bg],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
border: Border.all(color: AppColors.gold, width: 1.4),
|
border: Border.all(color: AppColors.gold, width: 1.4),
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
|||||||
label: 'سکه روزانه',
|
label: 'سکه روزانه',
|
||||||
icon: Icons.monetization_on,
|
icon: Icons.monetization_on,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
colors: const [Color(0xFF3FA34D), Color(0xFF1B5E20)],
|
colors: const [AppColors.success, AppColors.successDark],
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
context.read<WalletBloc>().add(ClaimDailyEvent()),
|
context.read<WalletBloc>().add(ClaimDailyEvent()),
|
||||||
),
|
),
|
||||||
@@ -152,7 +152,7 @@ class _TopBar extends StatelessWidget {
|
|||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Color(0xFF3A0A12), Color(0xFF1A0106)],
|
colors: [AppColors.bg, Color(0xFF1A0106)],
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
border: Border.all(color: AppColors.goldDark),
|
border: Border.all(color: AppColors.goldDark),
|
||||||
@@ -246,12 +246,12 @@ class _VipTag extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: const LinearGradient(
|
gradient: const LinearGradient(
|
||||||
colors: [Color(0xFFFFD54F), Color(0xFFB8860B)]),
|
colors: [Color(0xFFFFD54F), AppColors.goldDark]),
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
child: const Text('VIP',
|
child: const Text('VIP',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF3A0A12),
|
color: AppColors.bg,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 10)),
|
fontSize: 10)),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user