update theme
This commit is contained in:
@@ -36,8 +36,10 @@ class AccountPage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF4F6F8),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
body: SafeArea(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
@@ -48,7 +50,7 @@ class AccountPage extends ConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
// Simple Header
|
||||
_buildHeader(),
|
||||
_buildHeader(context),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
|
||||
// User Profile Card - only this depends on provider
|
||||
@@ -76,26 +78,28 @@ class AccountPage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Build simple header with title
|
||||
Widget _buildHeader() {
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Tài khoản',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF212121),
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -103,14 +107,16 @@ class AccountPage extends ConsumerWidget {
|
||||
|
||||
/// Build account menu section
|
||||
Widget _buildAccountMenu(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(AppRadius.card),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -158,14 +164,14 @@ class AccountPage extends ConsumerWidget {
|
||||
context.push(RouteNames.changePassword);
|
||||
},
|
||||
),
|
||||
AccountMenuItem(
|
||||
icon: FontAwesomeIcons.language,
|
||||
title: 'Ngôn ngữ',
|
||||
subtitle: 'Tiếng Việt',
|
||||
onTap: () {
|
||||
_showComingSoon(context);
|
||||
},
|
||||
),
|
||||
// AccountMenuItem(
|
||||
// icon: FontAwesomeIcons.language,
|
||||
// title: 'Ngôn ngữ',
|
||||
// subtitle: 'Tiếng Việt',
|
||||
// onTap: () {
|
||||
// _showComingSoon(context);
|
||||
// },
|
||||
// ),
|
||||
AccountMenuItem(
|
||||
icon: FontAwesomeIcons.palette,
|
||||
title: 'Giao diện',
|
||||
@@ -181,14 +187,16 @@ class AccountPage extends ConsumerWidget {
|
||||
|
||||
/// Build support section
|
||||
Widget _buildSupportSection(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(AppRadius.card),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -198,8 +206,8 @@ class AccountPage extends ConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Section title
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppSpacing.md,
|
||||
AppSpacing.md,
|
||||
AppSpacing.md,
|
||||
@@ -210,7 +218,7 @@ class AccountPage extends ConsumerWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -220,10 +228,10 @@ class AccountPage extends ConsumerWidget {
|
||||
icon: FontAwesomeIcons.headset,
|
||||
title: 'Liên hệ hỗ trợ',
|
||||
subtitle: 'Hotline: 1900 1234',
|
||||
trailing: const FaIcon(
|
||||
trailing: FaIcon(
|
||||
FontAwesomeIcons.phone,
|
||||
size: 18,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -283,7 +291,7 @@ class AccountPage extends ConsumerWidget {
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Ứng dụng dành cho thầu thợ, kiến trúc sư, đại lý và môi giới trong ngành gạch ốp lát và nội thất.',
|
||||
style: TextStyle(fontSize: 14, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -307,27 +315,28 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final userInfoAsync = ref.watch(userInfoProvider);
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
child: userInfoAsync.when(
|
||||
loading: () => _buildLoadingCard(),
|
||||
error: (error, stack) => _buildErrorCard(context, ref, error),
|
||||
data: (userInfo) => _buildProfileCard(context, userInfo),
|
||||
loading: () => _buildLoadingCard(colorScheme),
|
||||
error: (error, stack) => _buildErrorCard(context, ref, error, colorScheme),
|
||||
data: (userInfo) => _buildProfileCard(context, userInfo, colorScheme),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLoadingCard() {
|
||||
Widget _buildLoadingCard(ColorScheme colorScheme) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(AppRadius.card),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -339,13 +348,13 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
child: const Center(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
),
|
||||
@@ -359,7 +368,7 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
height: 20,
|
||||
width: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
@@ -368,7 +377,7 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
height: 14,
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
@@ -380,15 +389,15 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildErrorCard(BuildContext context, WidgetRef ref, Object error) {
|
||||
Widget _buildErrorCard(BuildContext context, WidgetRef ref, Object error, ColorScheme colorScheme) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(AppRadius.card),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -399,9 +408,9 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
child: const Center(
|
||||
child: FaIcon(
|
||||
@@ -416,22 +425,22 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'Không thể tải thông tin',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
GestureDetector(
|
||||
onTap: () => ref.read(userInfoProvider.notifier).refresh(),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Nhấn để thử lại',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -444,15 +453,15 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProfileCard(BuildContext context, domain.UserInfo userInfo) {
|
||||
Widget _buildProfileCard(BuildContext context, domain.UserInfo userInfo, ColorScheme colorScheme) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(AppRadius.card),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -471,17 +480,13 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
placeholder: (context, url) => Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF005B9A), Color(0xFF38B6FF)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: colorScheme.primaryContainer,
|
||||
),
|
||||
child: const Center(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
color: colorScheme.onPrimaryContainer,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
),
|
||||
@@ -489,19 +494,15 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
errorWidget: (context, url, error) => Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF005B9A), Color(0xFF38B6FF)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: colorScheme.primaryContainer,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
userInfo.initials,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimaryContainer,
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -513,19 +514,15 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF005B9A), Color(0xFF38B6FF)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: colorScheme.primaryContainer,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
userInfo.initials,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimaryContainer,
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -541,27 +538,27 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
userInfo.fullName,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
'${_getRoleDisplayName(userInfo.role)} · Hạng ${userInfo.tierDisplayName}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
if (userInfo.phoneNumber != null) ...[
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
userInfo.phoneNumber!,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -594,12 +591,14 @@ class _ProfileCardSection extends ConsumerWidget {
|
||||
class _LogoutButton extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
_showLogoutConfirmation(context, ref);
|
||||
_showLogoutConfirmation(context, ref, colorScheme);
|
||||
},
|
||||
icon: const FaIcon(FontAwesomeIcons.arrowRightFromBracket, size: 18),
|
||||
label: const Text('Đăng xuất'),
|
||||
@@ -616,12 +615,19 @@ class _LogoutButton extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Show logout confirmation dialog
|
||||
void _showLogoutConfirmation(BuildContext context, WidgetRef ref) {
|
||||
void _showLogoutConfirmation(BuildContext context, WidgetRef ref, ColorScheme colorScheme) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Đăng xuất'),
|
||||
content: const Text('Bạn có chắc chắn muốn đăng xuất?'),
|
||||
backgroundColor: colorScheme.surface,
|
||||
title: Text(
|
||||
'Đăng xuất',
|
||||
style: TextStyle(color: colorScheme.onSurface),
|
||||
),
|
||||
content: Text(
|
||||
'Bạn có chắc chắn muốn đăng xuất?',
|
||||
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
|
||||
Reference in New Issue
Block a user