feat: profile and subs
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:random_avatar/random_avatar.dart';
|
||||
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/widgets/game_ui.dart';
|
||||
import '../auth/auth_cubit.dart';
|
||||
import 'wallet.dart';
|
||||
import 'wallet_cubit.dart';
|
||||
|
||||
/// لابی اصلی: کیفپول، دکمه بازی، فروشگاه، سکه روزانه (ظاهرِ بازیگونه).
|
||||
@@ -31,7 +31,7 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: [
|
||||
_TopBar(wallet: state.wallet, onCoinTap: () => _openShop(context)),
|
||||
_TopBar(walletState: state, onCoinTap: () => _openShop(context)),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
@@ -54,6 +54,19 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
GameButton(
|
||||
label: 'دورهمی',
|
||||
icon: Icons.group_add,
|
||||
width: double.infinity,
|
||||
colors: const [Color(0xFF1565C0), Color(0xFF0A2E57)],
|
||||
onTap: () async {
|
||||
await context.push('/private');
|
||||
if (context.mounted) {
|
||||
context.read<WalletCubit>().load();
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
GameButton(
|
||||
label: 'فروشگاه',
|
||||
icon: Icons.storefront,
|
||||
@@ -111,13 +124,13 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
||||
}
|
||||
|
||||
class _TopBar extends StatelessWidget {
|
||||
final Wallet? wallet;
|
||||
final WalletState walletState;
|
||||
final VoidCallback onCoinTap;
|
||||
const _TopBar({this.wallet, required this.onCoinTap});
|
||||
const _TopBar({required this.walletState, required this.onCoinTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final w = wallet;
|
||||
final w = walletState.wallet;
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
@@ -133,15 +146,23 @@ class _TopBar extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: AppColors.gold, width: 2),
|
||||
),
|
||||
child: const CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: AppColors.panel,
|
||||
child: Icon(Icons.person, color: AppColors.gold),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await context.push('/profile');
|
||||
if (context.mounted) context.read<WalletCubit>().load();
|
||||
},
|
||||
child: Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.panel,
|
||||
border: Border.all(color: AppColors.gold, width: 2),
|
||||
),
|
||||
child: walletState.avatar.isEmpty
|
||||
? const Icon(Icons.person, color: AppColors.gold)
|
||||
: ClipOval(child: RandomAvatar(walletState.avatar)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
@@ -149,6 +170,16 @@ class _TopBar extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(children: [
|
||||
if (walletState.name.isNotEmpty) ...[
|
||||
Text(walletState.name,
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
if (w?.vip == true) const _VipTag(),
|
||||
]),
|
||||
const SizedBox(height: 2),
|
||||
Row(children: [
|
||||
const Icon(Icons.star, color: AppColors.gold, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
@@ -190,3 +221,24 @@ class _TopBar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// نشانِ کوچکِ VIP کنار نام در نوار بالا.
|
||||
class _VipTag extends StatelessWidget {
|
||||
const _VipTag();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFFFD54F), Color(0xFFB8860B)]),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: const Text('VIP',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF3A0A12),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user