Files
front-hokm/lib/feature/tournament/presentation/widgets/tournament_guide.dart
T

219 lines
8.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import '../../../../core/theme/app_theme.dart';
/// راهنمای تورنومنت: توضیحِ گام‌به‌گامِ نحوه‌ی کار (ثبت‌نام، کسبِ امتیاز، جایزه).
class TournamentGuide {
static const _steps = <(IconData, String, String)>[
(
Icons.how_to_reg,
'۱. ثبت‌نام کن',
'با پرداختِ ورودی (سکه) در تورنومنت ثبت‌نام کن. ثبت‌نام تا پیش از پایانِ '
'تورنومنت باز است.',
),
(
Icons.sports_esports,
'۲. بازی کن و امتیاز بگیر',
'در بازه‌ی زمانیِ تورنومنت، عادی بازی کن. هر بازی که ببری ۱۰۰ امتیاز و هر '
'بازی که شرکت کنی ۲۵ امتیاز می‌گیری. هرچه بیشتر ببری، امتیازت بیشتر می‌شود.',
),
(
Icons.leaderboard,
'۳. در جدول بالا برو',
'امتیازِ همه در جدولِ رده‌بندی ثبت می‌شود؛ بیشترین امتیاز بالاتر می‌ایستد. '
'در تساوی، تعدادِ بردِ بیشتر و ثبت‌نامِ زودتر ملاک است.',
),
(
Icons.emoji_events,
'۴. جایزه بگیر',
'وقتی تورنومنت تمام شد، نفراتِ برتر به‌ترتیبِ رتبه جایزه‌ی سکه می‌گیرند. '
'جوایز به‌صورتِ خودکار به کیف‌پولت اضافه می‌شود.',
),
];
static Future<void> show(BuildContext context) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (_) => const _GuideSheet(),
);
}
}
class _GuideSheet extends StatelessWidget {
const _GuideSheet();
@override
Widget build(BuildContext context) {
return SafeArea(
top: false,
child: DraggableScrollableSheet(
initialChildSize: 0.72,
minChildSize: 0.4,
maxChildSize: 0.92,
expand: false,
builder:
(context, controller) => Container(
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColors.lapisMid, AppColors.lapisLo],
),
borderRadius: const BorderRadius.vertical(
top: Radius.circular(24),
),
border: Border.all(color: AppColors.gold, width: 1.6),
),
child: ListView(
controller: controller,
padding: const EdgeInsets.fromLTRB(18, 12, 18, 28),
children: [
Center(
child: Container(
width: 44,
height: 4,
margin: const EdgeInsets.only(bottom: 14),
decoration: BoxDecoration(
color: Colors.white24,
borderRadius: BorderRadius.circular(2),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(Icons.emoji_events, color: AppColors.gold, size: 24),
SizedBox(width: 8),
Text(
'راهنمای تورنومنت',
style: TextStyle(
color: AppColors.gold,
fontSize: 19,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 6),
const Text(
'تورنومنتِ امتیازی؛ بیشتر ببر، بالاتر بایست، جایزه بگیر!',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white60, fontSize: 12.5),
),
const SizedBox(height: 18),
for (final (icon, title, body) in TournamentGuide._steps)
_stepTile(icon, title, body),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: AppColors.gold.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColors.goldFaint),
),
child: const Row(
children: [
Icon(
Icons.lightbulb_outline,
color: AppColors.gold,
size: 18,
),
SizedBox(width: 8),
Expanded(
child: Text(
'نکته: می‌توانی در هر لحظه ثبت‌نام کنی، اما هرچه زودتر شروع '
'کنی فرصتِ بیشتری برای کسبِ امتیاز داری.',
style: TextStyle(
color: Colors.white,
fontSize: 12.5,
height: 1.7,
),
),
),
],
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.gold,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
),
),
onPressed: () => Navigator.pop(context),
child: const Text(
'فهمیدم',
style: TextStyle(
color: AppColors.lapisInk,
fontWeight: FontWeight.bold,
fontSize: 15,
),
),
),
),
],
),
),
),
);
}
Widget _stepTile(IconData icon, String title, String body) {
return Container(
margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.05),
borderRadius: BorderRadius.circular(14),
border: Border.all(color: Colors.white.withValues(alpha: 0.1)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(9),
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [AppColors.gold, AppColors.goldDark],
),
shape: BoxShape.circle,
),
child: Icon(icon, color: AppColors.lapisInk, size: 20),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
color: AppColors.gold,
fontSize: 14.5,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 4),
Text(
body,
style: const TextStyle(
color: Colors.white,
fontSize: 12.5,
height: 1.8,
),
),
],
),
),
],
),
);
}
}