feat: add game graphic

This commit is contained in:
2026-07-08 09:06:32 +03:30
parent ffd2646eea
commit 46a649166b
15 changed files with 521 additions and 57 deletions
@@ -90,8 +90,15 @@ class _GameScreenState extends State<GameScreen> {
listenWhen:
(a, b) =>
(a.notice != b.notice && b.notice != null) ||
(a.gameOver == null && b.gameOver != null),
(a.gameOver == null && b.gameOver != null) ||
(a.handResult == null && b.handResult != null),
listener: (context, state) {
// جشنِ کُت: هنگامِ دستِ کُت‌شده‌ی بُرده، ضربه‌ی لمسی.
final hr = state.handResult;
if (hr != null && hr.kot) {
final myTeam = (state.state?.yourSeat ?? 0) % 2;
if (hr.winnerTeam == myTeam) HapticFeedback.mediumImpact();
}
if (state.gameOver != null) {
final won =
state.gameOver!.winnerTeam ==
@@ -540,44 +547,77 @@ class _GameScreenState extends State<GameScreen> {
final mySeat = s.state?.yourSeat ?? 0;
final myTeam = mySeat % 2;
final won = r.winnerTeam == myTeam;
final kotWin = won && r.kot; // جشنِ ویژه فقط برای کُتِ بُرده
return IgnorePointer(
child: Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 18),
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.gold),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
won ? 'این دست را بردید!' : 'این دست را باختید',
style: TextStyle(
color: won ? AppColors.green : Colors.redAccent,
fontSize: 20,
fontWeight: FontWeight.bold,
),
child: Stack(
children: [
if (kotWin) const Positioned.fill(child: Confetti(count: 40)),
Center(
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 28, vertical: 18),
decoration: BoxDecoration(
gradient: kotWin
? const LinearGradient(
colors: [AppColors.lapisMid, AppColors.lapisInk])
: null,
color: kotWin ? null : Colors.black87,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: AppColors.gold, width: kotWin ? 2 : 1),
boxShadow: kotWin
? [
BoxShadow(
color: AppColors.gold.withValues(alpha: 0.4),
blurRadius: 20),
]
: null,
),
if (r.kot)
Padding(
padding: const EdgeInsets.only(top: 6),
child: Text(
r.hakemKot
? 'حاکم‌کُت! (${r.points} امتیاز)'
: 'کُت! (${r.points} امتیاز)',
style: const TextStyle(color: AppColors.gold),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (kotWin)
Text(
r.hakemKot ? 'حاکم‌کُت! 🔥' : 'کُت! 🔥',
style: const TextStyle(
color: AppColors.gold,
fontSize: 30,
fontWeight: FontWeight.bold,
shadows: [Shadow(color: Colors.black, blurRadius: 8)],
),
),
Text(
won ? 'این دست را بردید!' : 'این دست را باختید',
style: TextStyle(
color: won ? AppColors.green : Colors.redAccent,
fontSize: kotWin ? 16 : 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 6),
Text(
'امتیاز: ${r.scores.isNotEmpty ? r.scores[0] : 0} - ${r.scores.length > 1 ? r.scores[1] : 0}',
style: const TextStyle(color: Colors.white70),
if (r.kot && !kotWin)
Padding(
padding: const EdgeInsets.only(top: 6),
child: Text(
r.hakemKot
? 'حاکم‌کُت! (${r.points} امتیاز)'
: 'کُت! (${r.points} امتیاز)',
style: const TextStyle(color: AppColors.gold),
),
),
if (kotWin)
Text('+${r.points} امتیاز',
style: const TextStyle(color: AppColors.gold)),
const SizedBox(height: 6),
Text(
'امتیاز: ${r.scores.isNotEmpty ? r.scores[0] : 0} - ${r.scores.length > 1 ? r.scores[1] : 0}',
style: const TextStyle(color: Colors.white70),
),
],
),
],
),
),
),
],
),
);
}