style
This commit is contained in:
@@ -31,11 +31,13 @@ class ShopScreen extends StatelessWidget {
|
||||
final s = state.actionStatus;
|
||||
if (s is ActionSuccess) {
|
||||
context.read<WalletBloc>().add(LoadWalletEvent());
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text(s.message)));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(s.message)));
|
||||
} else if (s is ActionError) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text(s.message)));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(s.message)));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
@@ -52,8 +54,10 @@ class ShopScreen extends StatelessWidget {
|
||||
colors: [Color(0xFF4A0C16), Color(0xFF2A0710)],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border:
|
||||
Border.all(color: AppColors.goldDark, width: 1.5),
|
||||
border: Border.all(
|
||||
color: AppColors.goldDark,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -87,51 +91,65 @@ class ShopScreen extends StatelessWidget {
|
||||
}
|
||||
if (status is ShopLoadError) {
|
||||
return Center(
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text(status.message),
|
||||
TextButton(
|
||||
onPressed: () => context.read<ShopBloc>().add(LoadShopEvent()),
|
||||
child: const Text('تلاش مجدد'),
|
||||
),
|
||||
]),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(status.message),
|
||||
TextButton(
|
||||
onPressed: () => context.read<ShopBloc>().add(LoadShopEvent()),
|
||||
child: const Text('تلاش مجدد'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return const Center(child: CircularProgressIndicator(color: AppColors.gold));
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: AppColors.gold),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _header(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(children: [
|
||||
GestureDetector(
|
||||
onTap: () => context.pop(),
|
||||
child: Container(
|
||||
width: 46,
|
||||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.panel,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.gold, width: 1.5),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => context.pop(),
|
||||
child: Container(
|
||||
width: 46,
|
||||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.panel,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.gold, width: 1.5),
|
||||
),
|
||||
child: const Icon(Icons.arrow_back, color: AppColors.gold),
|
||||
),
|
||||
child: const Icon(Icons.arrow_back, color: AppColors.gold),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
BlocBuilder<WalletBloc, WalletBlocState>(
|
||||
builder: (context, s) {
|
||||
final w = s.walletStatus is WalletLoaded
|
||||
? (s.walletStatus as WalletLoaded).wallet
|
||||
: null;
|
||||
return Row(children: [
|
||||
StatChip(
|
||||
icon: Icons.confirmation_number,
|
||||
value: '${w?.tickets ?? 0}'),
|
||||
const SizedBox(width: 8),
|
||||
StatChip(icon: Icons.monetization_on, value: '${w?.coins ?? 0}'),
|
||||
]);
|
||||
},
|
||||
),
|
||||
]),
|
||||
const Spacer(),
|
||||
BlocBuilder<WalletBloc, WalletBlocState>(
|
||||
builder: (context, s) {
|
||||
final w =
|
||||
s.walletStatus is WalletLoaded
|
||||
? (s.walletStatus as WalletLoaded).wallet
|
||||
: null;
|
||||
return Row(
|
||||
children: [
|
||||
StatChip(
|
||||
icon: Icons.confirmation_number,
|
||||
value: '${w?.tickets ?? 0}',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
StatChip(
|
||||
icon: Icons.monetization_on,
|
||||
value: '${w?.coins ?? 0}',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +165,7 @@ class _ShopTabs extends StatelessWidget {
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Color(0xFFC62828), Color(0xFF7B0E14)],
|
||||
),
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
||||
borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)),
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
labelColor: AppColors.gold,
|
||||
@@ -198,8 +216,9 @@ class _CoinsTab extends StatelessWidget {
|
||||
'${p.coins} سکه${p.vipDays > 0 ? ' + ${p.vipDays} روز VIP' : ''}',
|
||||
action: _PriceButton(
|
||||
label: '${p.priceToman} تومان',
|
||||
onTap: () =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('coin', p.id)),
|
||||
onTap:
|
||||
() =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('coin', p.id)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -223,8 +242,10 @@ class _TicketsTab extends StatelessWidget {
|
||||
subtitle: '${p.tickets} بلیط',
|
||||
action: _PriceButton(
|
||||
label: '${p.priceToman} تومان',
|
||||
onTap: () =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('ticket', p.id)),
|
||||
onTap:
|
||||
() => context.read<ShopBloc>().add(
|
||||
PurchaseEvent('ticket', p.id),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -248,8 +269,10 @@ class _BoostersTab extends StatelessWidget {
|
||||
subtitle: 'تجربه ×${b.multiplier} — ${b.hours} ساعت',
|
||||
action: _PriceButton(
|
||||
label: '${b.priceToman} تومان',
|
||||
onTap: () =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('booster', b.id)),
|
||||
onTap:
|
||||
() => context.read<ShopBloc>().add(
|
||||
PurchaseEvent('booster', b.id),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -274,8 +297,9 @@ class _VipTab extends StatelessWidget {
|
||||
subtitle: '${p.months} ماه اشتراک',
|
||||
action: _PriceButton(
|
||||
label: '${p.priceToman} تومان',
|
||||
onTap: () =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('vip', p.id)),
|
||||
onTap:
|
||||
() =>
|
||||
context.read<ShopBloc>().add(PurchaseEvent('vip', p.id)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -328,9 +352,11 @@ Widget _grid({required String note, required List<Widget> children}) {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 6),
|
||||
child: Text(note,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: AppColors.gold, fontSize: 13)),
|
||||
child: Text(
|
||||
note,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: AppColors.gold, fontSize: 13),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.count(
|
||||
@@ -382,43 +408,55 @@ class _ItemCard extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.gold, fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.gold,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Expanded(child: _GlowArt(color: glowColor, icon: icon)),
|
||||
const SizedBox(height: 4),
|
||||
Text(subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 11)),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 11),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
SizedBox(width: double.infinity, child: action),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (ribbon == null) return card;
|
||||
return Stack(clipBehavior: Clip.none, children: [
|
||||
card,
|
||||
Positioned(
|
||||
top: 8,
|
||||
left: -22,
|
||||
child: Transform.rotate(
|
||||
angle: -0.7,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 3),
|
||||
color: const Color(0xFF2E7D32),
|
||||
child: Text(ribbon!,
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
card,
|
||||
Positioned(
|
||||
top: 8,
|
||||
left: -22,
|
||||
child: Transform.rotate(
|
||||
angle: -0.7,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 3),
|
||||
color: const Color(0xFF2E7D32),
|
||||
child: Text(
|
||||
ribbon!,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold)),
|
||||
color: Colors.white,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,9 +498,10 @@ class _PriceButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final busy = context.select((ShopBloc c) => c.state.busy);
|
||||
final colors = disabled
|
||||
? const [Color(0xFF555555), Color(0xFF333333)]
|
||||
: green
|
||||
final colors =
|
||||
disabled
|
||||
? const [Color(0xFF555555), Color(0xFF333333)]
|
||||
: green
|
||||
? const [Color(0xFF3FA34D), Color(0xFF1B5E20)]
|
||||
: const [Color(0xFFD83A4A), Color(0xFF8E0E1B)];
|
||||
return Opacity(
|
||||
@@ -482,21 +521,31 @@ class _PriceButton extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: AppColors.gold, width: 1.2),
|
||||
),
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
if (coin) ...[
|
||||
const Icon(Icons.monetization_on, color: AppColors.gold, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
Flexible(
|
||||
child: Text(label,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (coin) ...[
|
||||
const Icon(
|
||||
Icons.monetization_on,
|
||||
color: AppColors.gold,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
Flexible(
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold)),
|
||||
),
|
||||
]),
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user