update theme

This commit is contained in:
Phuoc Nguyen
2025-12-02 15:20:54 +07:00
parent 12bd70479c
commit 49a41d24eb
78 changed files with 3263 additions and 2756 deletions

View File

@@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:worker/core/theme/colors.dart';
import 'package:worker/features/loyalty/domain/entities/gift_catalog.dart';
import 'package:worker/features/loyalty/presentation/providers/loyalty_points_provider.dart';
@@ -27,6 +26,7 @@ class RewardCard extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final colorScheme = Theme.of(context).colorScheme;
final hasEnoughPoints = ref.watch(hasEnoughPointsProvider(gift.pointsCost));
final numberFormat = NumberFormat('#,###', 'vi_VN');
@@ -39,7 +39,7 @@ class RewardCard extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Gift Image
_buildImage(),
_buildImage(colorScheme),
// Gift Info
Expanded(
@@ -51,10 +51,10 @@ class RewardCard extends ConsumerWidget {
// Gift Name
Text(
gift.name,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.grey900,
color: colorScheme.onSurface,
height: 1.3,
),
maxLines: 2,
@@ -66,9 +66,9 @@ class RewardCard extends ConsumerWidget {
if (gift.description != null && gift.description!.isNotEmpty)
Text(
gift.description!,
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: AppColors.grey500,
color: colorScheme.onSurfaceVariant,
height: 1.2,
),
maxLines: 1,
@@ -81,10 +81,10 @@ class RewardCard extends ConsumerWidget {
// Points Cost (at bottom)
Text(
'${numberFormat.format(gift.pointsCost)} điểm',
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
color: AppColors.primaryBlue,
color: colorScheme.primary,
),
),
const SizedBox(height: 8),
@@ -101,8 +101,8 @@ class RewardCard extends ConsumerWidget {
FontAwesomeIcons.gift,
size: 14,
color: hasEnoughPoints && gift.isAvailable
? Colors.white
: AppColors.grey500,
? colorScheme.onPrimary
: colorScheme.onSurfaceVariant,
),
label: Text(
hasEnoughPoints && gift.isAvailable
@@ -115,11 +115,11 @@ class RewardCard extends ConsumerWidget {
),
style: ElevatedButton.styleFrom(
backgroundColor: hasEnoughPoints && gift.isAvailable
? AppColors.primaryBlue
: AppColors.grey100,
? colorScheme.primary
: colorScheme.surfaceContainerHighest,
foregroundColor: hasEnoughPoints && gift.isAvailable
? Colors.white
: AppColors.grey500,
? colorScheme.onPrimary
: colorScheme.onSurfaceVariant,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@@ -141,7 +141,7 @@ class RewardCard extends ConsumerWidget {
}
/// Build gift image
Widget _buildImage() {
Widget _buildImage(ColorScheme colorScheme) {
return SizedBox(
height: 120,
child: gift.imageUrl != null && gift.imageUrl!.isNotEmpty
@@ -149,26 +149,26 @@ class RewardCard extends ConsumerWidget {
imageUrl: gift.imageUrl!,
fit: BoxFit.cover,
placeholder: (context, url) => Container(
color: AppColors.grey100,
color: colorScheme.surfaceContainerHighest,
child: const Center(
child: CircularProgressIndicator(strokeWidth: 2),
),
),
errorWidget: (context, url, error) => Container(
color: AppColors.grey100,
child: const FaIcon(
color: colorScheme.surfaceContainerHighest,
child: FaIcon(
FontAwesomeIcons.gift,
size: 48,
color: AppColors.grey500,
color: colorScheme.onSurfaceVariant,
),
),
)
: Container(
color: AppColors.grey100,
child: const FaIcon(
color: colorScheme.surfaceContainerHighest,
child: FaIcon(
FontAwesomeIcons.gift,
size: 48,
color: AppColors.grey500,
color: colorScheme.onSurfaceVariant,
),
),
);