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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user