update theme
This commit is contained in:
@@ -78,6 +78,8 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
// Search controller
|
||||
final searchController = useTextEditingController();
|
||||
final searchQuery = useState('');
|
||||
@@ -104,20 +106,20 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF4F6F8),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const FaIcon(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.arrowLeft,
|
||||
color: Colors.black,
|
||||
color: colorScheme.onSurface,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
title: const Text('Yêu thích', style: TextStyle(color: Colors.black)),
|
||||
title: Text('Yêu thích', style: TextStyle(color: colorScheme.onSurface)),
|
||||
elevation: AppBarSpecs.elevation,
|
||||
backgroundColor: AppColors.white,
|
||||
foregroundColor: AppColors.grey900,
|
||||
backgroundColor: colorScheme.surface,
|
||||
foregroundColor: colorScheme.onSurface,
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
// Count badge
|
||||
@@ -127,10 +129,10 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Text(
|
||||
'($favoriteCount)',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -139,9 +141,9 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
// Clear all button
|
||||
if (favoriteCount > 0)
|
||||
IconButton(
|
||||
icon: const FaIcon(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.trashCan,
|
||||
color: Colors.black,
|
||||
color: colorScheme.onSurface,
|
||||
size: 20,
|
||||
),
|
||||
tooltip: 'Xóa tất cả',
|
||||
@@ -177,16 +179,16 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
onChanged: (value) => searchQuery.value = value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Tìm kiếm sản phẩm...',
|
||||
hintStyle: const TextStyle(color: AppColors.grey500),
|
||||
prefixIcon: const Icon(
|
||||
hintStyle: TextStyle(color: colorScheme.onSurfaceVariant),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
suffixIcon: searchQuery.value.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
onPressed: () {
|
||||
searchController.clear();
|
||||
@@ -195,19 +197,19 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: colorScheme.surface,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.button),
|
||||
borderSide: const BorderSide(color: AppColors.grey100),
|
||||
borderSide: BorderSide(color: colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.button),
|
||||
borderSide: const BorderSide(color: AppColors.grey100),
|
||||
borderSide: BorderSide(color: colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.button),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.primaryBlue,
|
||||
borderSide: BorderSide(
|
||||
color: colorScheme.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
@@ -229,9 +231,9 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Tìm thấy ${filteredProducts.length} sản phẩm',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -245,26 +247,26 @@ class FavoritesPage extends HookConsumerWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const FaIcon(
|
||||
FaIcon(
|
||||
FontAwesomeIcons.magnifyingGlass,
|
||||
size: 64,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
Text(
|
||||
'Không tìm thấy "${searchQuery.value}"',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
const Text(
|
||||
Text(
|
||||
'Thử tìm kiếm với từ khóa khác',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -431,6 +433,8 @@ class _EmptyState extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.xl),
|
||||
@@ -441,18 +445,18 @@ class _EmptyState extends StatelessWidget {
|
||||
FaIcon(
|
||||
FontAwesomeIcons.heart,
|
||||
size: 80.0,
|
||||
color: AppColors.grey500.withValues(alpha: 0.5),
|
||||
color: colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
|
||||
// Heading
|
||||
const Text(
|
||||
Text(
|
||||
'Chưa có sản phẩm yêu thích',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -460,9 +464,9 @@ class _EmptyState extends StatelessWidget {
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
|
||||
// Subtext
|
||||
const Text(
|
||||
Text(
|
||||
'Thêm sản phẩm vào danh sách yêu thích để xem lại sau',
|
||||
style: TextStyle(fontSize: 14.0, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 14.0, color: colorScheme.onSurfaceVariant),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
@@ -475,8 +479,8 @@ class _EmptyState extends StatelessWidget {
|
||||
context.pushReplacement('/products');
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
foregroundColor: AppColors.white,
|
||||
backgroundColor: colorScheme.primary,
|
||||
foregroundColor: colorScheme.surface,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xl,
|
||||
vertical: AppSpacing.md,
|
||||
@@ -527,23 +531,25 @@ class _LoadingState extends StatelessWidget {
|
||||
class _ShimmerCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Card(
|
||||
elevation: ProductCardSpecs.elevation,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ProductCardSpecs.borderRadius),
|
||||
),
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: AppColors.grey100,
|
||||
highlightColor: AppColors.grey50,
|
||||
baseColor: colorScheme.surfaceContainerHighest,
|
||||
highlightColor: colorScheme.surfaceContainerLowest,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Image placeholder
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
borderRadius: BorderRadius.vertical(
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(ProductCardSpecs.borderRadius),
|
||||
),
|
||||
),
|
||||
@@ -561,7 +567,7 @@ class _ShimmerCard extends StatelessWidget {
|
||||
height: 14.0,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
),
|
||||
@@ -573,7 +579,7 @@ class _ShimmerCard extends StatelessWidget {
|
||||
height: 12.0,
|
||||
width: 80.0,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
),
|
||||
@@ -585,7 +591,7 @@ class _ShimmerCard extends StatelessWidget {
|
||||
height: 16.0,
|
||||
width: 100.0,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
),
|
||||
@@ -597,7 +603,7 @@ class _ShimmerCard extends StatelessWidget {
|
||||
height: 36.0,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(AppRadius.button),
|
||||
),
|
||||
),
|
||||
@@ -626,6 +632,8 @@ class _ErrorState extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.xl),
|
||||
@@ -642,12 +650,12 @@ class _ErrorState extends StatelessWidget {
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
|
||||
// Title
|
||||
const Text(
|
||||
Text(
|
||||
'Có lỗi xảy ra',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -657,7 +665,7 @@ class _ErrorState extends StatelessWidget {
|
||||
// Error message
|
||||
Text(
|
||||
error.toString(),
|
||||
style: const TextStyle(fontSize: 14.0, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 14.0, color: colorScheme.onSurfaceVariant),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -669,8 +677,8 @@ class _ErrorState extends StatelessWidget {
|
||||
ElevatedButton.icon(
|
||||
onPressed: onRetry,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
foregroundColor: AppColors.white,
|
||||
backgroundColor: colorScheme.primary,
|
||||
foregroundColor: colorScheme.surface,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xl,
|
||||
vertical: AppSpacing.md,
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import 'package:worker/core/constants/ui_constants.dart';
|
||||
import 'package:worker/core/theme/colors.dart';
|
||||
import 'package:worker/core/theme/colors.dart'; // Keep for AppColors.danger and AppColors.white
|
||||
import 'package:worker/features/favorites/presentation/providers/favorites_provider.dart';
|
||||
import 'package:worker/features/products/domain/entities/product.dart';
|
||||
|
||||
@@ -76,6 +76,8 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Card(
|
||||
elevation: ProductCardSpecs.elevation,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -101,16 +103,16 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
memCacheWidth: ImageSpecs.productImageCacheWidth,
|
||||
memCacheHeight: ImageSpecs.productImageCacheHeight,
|
||||
placeholder: (context, url) => Shimmer.fromColors(
|
||||
baseColor: AppColors.grey100,
|
||||
highlightColor: AppColors.grey50,
|
||||
child: Container(color: AppColors.grey100),
|
||||
baseColor: colorScheme.surfaceContainerHighest,
|
||||
highlightColor: colorScheme.surfaceContainerLowest,
|
||||
child: Container(color: colorScheme.surfaceContainerHighest),
|
||||
),
|
||||
errorWidget: (context, url, error) => Container(
|
||||
color: AppColors.grey100,
|
||||
child: const FaIcon(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.image,
|
||||
size: 48.0,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -122,7 +124,7 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
right: AppSpacing.sm,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
color: colorScheme.surface,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@@ -176,9 +178,9 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
if (product.erpnextItemCode != null)
|
||||
Text(
|
||||
'Mã: ${product.erpnextItemCode}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -189,10 +191,10 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
// Price
|
||||
Text(
|
||||
_formatPrice(product.effectivePrice),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -208,9 +210,9 @@ class FavoriteProductCard extends ConsumerWidget {
|
||||
context.push('/products/${product.productId}');
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: AppColors.primaryBlue,
|
||||
side: const BorderSide(
|
||||
color: AppColors.primaryBlue,
|
||||
foregroundColor: colorScheme.primary,
|
||||
side: BorderSide(
|
||||
color: colorScheme.primary,
|
||||
width: 1.5,
|
||||
),
|
||||
elevation: 0,
|
||||
|
||||
Reference in New Issue
Block a user