feat: profile and subs

This commit is contained in:
2026-06-17 11:32:18 +03:30
parent 943ba13872
commit e9f294fa19
19 changed files with 1762 additions and 34 deletions
+93 -1
View File
@@ -15,7 +15,7 @@ class ShopScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 4,
length: 5,
child: Scaffold(
backgroundColor: Colors.transparent,
body: GameBackground(
@@ -68,6 +68,7 @@ class ShopScreen extends StatelessWidget {
_TicketsTab(packages: d.ticketPackages),
_CardsTab(data: d),
_BoostersTab(boosters: d.boosters),
_VipTab(packages: d.vipPackages),
],
);
},
@@ -140,6 +141,7 @@ class _ShopTabs extends StatelessWidget {
Tab(text: 'بلیط'),
Tab(text: 'کارت'),
Tab(text: 'تجهیزات'),
Tab(text: 'VIP'),
],
);
}
@@ -243,6 +245,96 @@ class _BoostersTab extends StatelessWidget {
}
}
class _VipTab extends StatelessWidget {
final List<VIPPackage> packages;
const _VipTab({required this.packages});
@override
Widget build(BuildContext context) {
final isVip = context.select((WalletCubit c) => c.state.wallet?.vip ?? false);
return Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF5A3A00), Color(0xFF2A1A00)]),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColors.gold, width: 1.3),
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.workspace_premium,
color: AppColors.gold, size: 22),
const SizedBox(width: 6),
Text(isVip ? 'شما کاربر VIP هستید' : 'مزایای اشتراک VIP',
style: const TextStyle(
color: AppColors.gold,
fontWeight: FontWeight.bold,
fontSize: 15)),
],
),
const SizedBox(height: 8),
const _Benefit('میزهای خصوصی نامحدود'),
const _Benefit('مشاهده‌ی کامل آمار بازی در پروفایل'),
const _Benefit('۱۰٪ سکه‌ی هدیه در هر خرید'),
],
),
),
),
Expanded(
child: GridView.count(
crossAxisCount: 2,
padding: const EdgeInsets.all(12),
childAspectRatio: 0.74,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
children: [
for (final p in packages)
_ItemCard(
title: p.title,
glowColor: const Color(0xFF8A6D00),
icon: Icons.workspace_premium,
ribbon: p.months >= 6 ? 'بهترین' : null,
subtitle: '${p.months} ماه اشتراک',
action: _PriceButton(
label: '${p.priceToman} تومان',
onTap: () => _do(context,
() => context.read<ShopCubit>().purchase('vip', p.id)),
),
),
],
),
),
],
);
}
}
class _Benefit extends StatelessWidget {
final String text;
const _Benefit(this.text);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: [
const Icon(Icons.check_circle, color: Color(0xFF6FCF7A), size: 16),
const SizedBox(width: 6),
Expanded(
child: Text(text,
style: const TextStyle(color: Colors.white, fontSize: 13))),
],
),
);
}
}
class _CardsTab extends StatelessWidget {
final ShopData data;
const _CardsTab({required this.data});