update theme
This commit is contained in:
@@ -49,6 +49,7 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final cartState = ref.watch(cartProvider);
|
||||
|
||||
final currencyFormatter = NumberFormat.currency(
|
||||
@@ -69,26 +70,26 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xFFF4F6F8),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const FaIcon(FontAwesomeIcons.arrowLeft, color: Colors.black, size: 20),
|
||||
icon: FaIcon(FontAwesomeIcons.arrowLeft, color: colorScheme.onSurface, size: 20),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
title: Text(
|
||||
'Giỏ hàng ($itemCount)',
|
||||
style: const TextStyle(color: Colors.black),
|
||||
style: TextStyle(color: colorScheme.onSurface),
|
||||
),
|
||||
elevation: AppBarSpecs.elevation,
|
||||
backgroundColor: AppColors.white,
|
||||
foregroundColor: AppColors.grey900,
|
||||
backgroundColor: colorScheme.surface,
|
||||
foregroundColor: colorScheme.onSurface,
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
if (cartState.isNotEmpty)
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.trashCan,
|
||||
color: hasSelection ? AppColors.danger : AppColors.grey500,
|
||||
color: hasSelection ? AppColors.danger : colorScheme.onSurfaceVariant,
|
||||
),
|
||||
onPressed: hasSelection
|
||||
? () {
|
||||
@@ -130,7 +131,7 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
// Loading overlay
|
||||
if (cartState.isLoading)
|
||||
Container(
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
color: colorScheme.onSurface.withValues(alpha: 0.1),
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
@@ -155,15 +156,17 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
|
||||
/// Build select all section
|
||||
Widget _buildSelectAllSection(CartState cartState, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
color: colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: colorScheme.onSurface.withValues(alpha: 0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -200,7 +203,7 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
Text(
|
||||
'Đã chọn: ${cartState.selectedCount}/${cartState.itemCount}',
|
||||
style: AppTypography.bodyMedium.copyWith(
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
@@ -218,15 +221,17 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
NumberFormat currencyFormatter,
|
||||
bool hasSelection,
|
||||
) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
border: const Border(
|
||||
top: BorderSide(color: Color(0xFFF0F0F0), width: 2),
|
||||
color: colorScheme.surface,
|
||||
border: Border(
|
||||
top: BorderSide(color: colorScheme.outlineVariant, width: 2),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.08),
|
||||
color: colorScheme.onSurface.withValues(alpha: 0.08),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, -2),
|
||||
),
|
||||
@@ -245,14 +250,14 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
Text(
|
||||
'Tổng tạm tính (${cartState.selectedCount} sản phẩm)',
|
||||
style: AppTypography.bodyMedium.copyWith(
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
currencyFormatter.format(cartState.selectedTotal),
|
||||
style: AppTypography.headlineSmall.copyWith(
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
@@ -302,27 +307,27 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
}
|
||||
: null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
disabledBackgroundColor: AppColors.grey100,
|
||||
backgroundColor: colorScheme.primary,
|
||||
disabledBackgroundColor: colorScheme.inverseSurface.withValues(alpha: 0.6),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: _isSyncing
|
||||
? const SizedBox(
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(AppColors.white),
|
||||
AlwaysStoppedAnimation<Color>(colorScheme.surface),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Tiến hành đặt hàng',
|
||||
style: AppTypography.labelLarge.copyWith(
|
||||
color: AppColors.white,
|
||||
color: colorScheme.surface,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
),
|
||||
@@ -359,6 +364,8 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
|
||||
/// Build error state (shown when cart fails to load and is empty)
|
||||
Widget _buildErrorState(BuildContext context, String errorMessage) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -374,7 +381,7 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Text(
|
||||
errorMessage,
|
||||
style: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
||||
style: AppTypography.bodyMedium.copyWith(color: colorScheme.onSurfaceVariant),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -393,6 +400,8 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
|
||||
/// Build empty cart state
|
||||
Widget _buildEmptyCart(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -400,19 +409,19 @@ class _CartPageState extends ConsumerState<CartPage> {
|
||||
Icon(
|
||||
FontAwesomeIcons.cartShopping,
|
||||
size: 80,
|
||||
color: AppColors.grey500.withValues(alpha: 0.5),
|
||||
color: colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Giỏ hàng trống',
|
||||
style: AppTypography.headlineMedium.copyWith(
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Hãy thêm sản phẩm vào giỏ hàng',
|
||||
style: AppTypography.bodyMedium.copyWith(color: AppColors.grey500),
|
||||
style: AppTypography.bodyMedium.copyWith(color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton.icon(
|
||||
@@ -475,24 +484,26 @@ class _CustomCheckbox extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => onChanged?.call(!value),
|
||||
child: Container(
|
||||
width: 22,
|
||||
height: 22,
|
||||
decoration: BoxDecoration(
|
||||
color: value ? AppColors.primaryBlue : AppColors.white,
|
||||
color: value ? colorScheme.primary : colorScheme.surface,
|
||||
border: Border.all(
|
||||
color: value ? AppColors.primaryBlue : const Color(0xFFCBD5E1),
|
||||
color: value ? colorScheme.primary : colorScheme.outlineVariant,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: value
|
||||
? const Icon(
|
||||
? Icon(
|
||||
FontAwesomeIcons.check,
|
||||
size: 16,
|
||||
color: AppColors.white,
|
||||
color: colorScheme.surface,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
|
||||
@@ -42,6 +42,8 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
// Form key for validation
|
||||
final formKey = useMemoized(() => GlobalKey<FormState>());
|
||||
|
||||
@@ -102,22 +104,22 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
final total = subtotal - memberDiscount + shipping;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF4F6F8),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: colorScheme.surface,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const FaIcon(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.arrowLeft,
|
||||
color: Colors.black,
|
||||
color: colorScheme.onSurface,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
title: const Text(
|
||||
title: Text(
|
||||
'Thanh toán',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
color: colorScheme.onSurface,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -165,11 +167,11 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
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.onSurface.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -183,11 +185,11 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
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.onSurface.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -203,9 +205,9 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Không thể tải phương thức thanh toán',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -225,7 +227,7 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
|
||||
// Discount Code Section
|
||||
_buildDiscountCodeSection(),
|
||||
_buildDiscountCodeSection(context),
|
||||
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
|
||||
@@ -263,13 +265,13 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
},
|
||||
activeColor: AppColors.warning,
|
||||
),
|
||||
const Expanded(
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Yêu cầu hợp đồng',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF212121),
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -281,20 +283,20 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
|
||||
// Terms and Conditions
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: 'Bằng cách đặt hàng, bạn đồng ý với ',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF6B7280),
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Điều khoản & Điều kiện',
|
||||
style: TextStyle(
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
@@ -328,16 +330,18 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
/// Build Discount Code Section (Card 4 from HTML)
|
||||
Widget _buildDiscountCodeSection() {
|
||||
Widget _buildDiscountCodeSection(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
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.onSurface.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -351,16 +355,16 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
children: [
|
||||
Icon(
|
||||
FontAwesomeIcons.ticket,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
Text(
|
||||
'Mã giảm giá',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF212121),
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -377,16 +381,16 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
hintText: 'Nhập mã giảm giá',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Color(0xFFD1D5DB)),
|
||||
borderSide: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Color(0xFFD1D5DB)),
|
||||
borderSide: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.primaryBlue,
|
||||
borderSide: BorderSide(
|
||||
color: colorScheme.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
@@ -403,7 +407,7 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
// TODO: Apply discount code
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
backgroundColor: colorScheme.primary,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 24,
|
||||
vertical: 12,
|
||||
@@ -413,10 +417,10 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Áp dụng',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -436,18 +440,18 @@ class CheckoutPage extends HookConsumerWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
FontAwesomeIcons.circleCheck,
|
||||
color: AppColors.success,
|
||||
size: 18,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Expanded(
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Bạn được giảm 15% (hạng Diamond)',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF166534),
|
||||
color: const Color(0xFF166534),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user