update theme
This commit is contained in:
@@ -28,28 +28,29 @@ class RewardsPage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final filteredGifts = ref.watch(filteredGiftsProvider);
|
||||
final selectedCategory = ref.watch(selectedGiftCategoryProvider);
|
||||
|
||||
return 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: const Text(
|
||||
title: Text(
|
||||
'Đổi quà tặng',
|
||||
style: 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: [
|
||||
IconButton(
|
||||
icon: const FaIcon(FontAwesomeIcons.circleInfo, color: Colors.black, size: 20),
|
||||
onPressed: () => _showInfoDialog(context),
|
||||
icon: FaIcon(FontAwesomeIcons.circleInfo, color: colorScheme.onSurface, size: 20),
|
||||
onPressed: () => _showInfoDialog(context, colorScheme),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
],
|
||||
@@ -71,14 +72,14 @@ class RewardsPage extends ConsumerWidget {
|
||||
|
||||
// Category Filter Pills
|
||||
SliverToBoxAdapter(
|
||||
child: _buildCategoryFilter(context, ref, selectedCategory),
|
||||
child: _buildCategoryFilter(context, ref, selectedCategory, colorScheme),
|
||||
),
|
||||
|
||||
// Rewards Grid
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 24),
|
||||
sliver: filteredGifts.isEmpty
|
||||
? _buildEmptyState()
|
||||
? _buildEmptyState(colorScheme)
|
||||
: SliverGrid(
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
@@ -91,7 +92,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
final gift = filteredGifts[index];
|
||||
return RewardCard(
|
||||
gift: gift,
|
||||
onRedeem: () => _handleRedeemGift(context, ref, gift),
|
||||
onRedeem: () => _handleRedeemGift(context, ref, gift, colorScheme),
|
||||
);
|
||||
}, childCount: filteredGifts.length),
|
||||
),
|
||||
@@ -103,7 +104,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Show info dialog with usage instructions
|
||||
void _showInfoDialog(BuildContext context) {
|
||||
void _showInfoDialog(BuildContext context, ColorScheme colorScheme) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
@@ -123,18 +124,23 @@ class RewardsPage extends ConsumerWidget {
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoItem(
|
||||
'Sử dụng điểm tích lũy của bạn để đổi các phần quà giá trị trong danh mục.',
|
||||
colorScheme,
|
||||
),
|
||||
_buildInfoItem(
|
||||
'Bấm vào một phần quà để xem chi tiết và điều kiện áp dụng.',
|
||||
colorScheme,
|
||||
),
|
||||
_buildInfoItem(
|
||||
'Khi xác nhận đổi quà, bạn có thể chọn "Nhận hàng tại Showroom".',
|
||||
colorScheme,
|
||||
),
|
||||
_buildInfoItem(
|
||||
'Nếu chọn "Nhận hàng tại Showroom", bạn sẽ cần chọn Showroom bạn muốn đến nhận từ danh sách thả xuống.',
|
||||
colorScheme,
|
||||
),
|
||||
_buildInfoItem(
|
||||
'Quà đã đổi sẽ được chuyển vào mục "Quà của tôi" (trong trang Hội viên).',
|
||||
colorScheme,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -143,8 +149,8 @@ class RewardsPage extends ConsumerWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: colorScheme.primary,
|
||||
foregroundColor: colorScheme.onPrimary,
|
||||
minimumSize: const Size(double.infinity, 44),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -161,19 +167,19 @@ class RewardsPage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Build info item with bullet point
|
||||
Widget _buildInfoItem(String text) {
|
||||
Widget _buildInfoItem(String text, ColorScheme colorScheme) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 6),
|
||||
child: FaIcon(FontAwesomeIcons.solidCircle, size: 6, color: AppColors.grey500),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: FaIcon(FontAwesomeIcons.solidCircle, size: 6, color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(text, style: TextStyle(fontSize: 14, height: 1.5)),
|
||||
child: Text(text, style: const TextStyle(fontSize: 14, height: 1.5)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -185,6 +191,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
GiftCategory? selectedCategory,
|
||||
ColorScheme colorScheme,
|
||||
) {
|
||||
return Container(
|
||||
height: 48,
|
||||
@@ -201,6 +208,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
onTap: () {
|
||||
ref.read(selectedGiftCategoryProvider.notifier).clearSelection();
|
||||
},
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -215,6 +223,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
.read(selectedGiftCategoryProvider.notifier)
|
||||
.setCategory(GiftCategory.voucher);
|
||||
},
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -229,6 +238,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
.read(selectedGiftCategoryProvider.notifier)
|
||||
.setCategory(GiftCategory.product);
|
||||
},
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -243,6 +253,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
.read(selectedGiftCategoryProvider.notifier)
|
||||
.setCategory(GiftCategory.service);
|
||||
},
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -257,6 +268,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
.read(selectedGiftCategoryProvider.notifier)
|
||||
.setCategory(GiftCategory.discount);
|
||||
},
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -270,13 +282,14 @@ class RewardsPage extends ConsumerWidget {
|
||||
required String label,
|
||||
required bool isSelected,
|
||||
required VoidCallback onTap,
|
||||
required ColorScheme colorScheme,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColors.primaryBlue : AppColors.grey100,
|
||||
color: isSelected ? colorScheme.primary : colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Center(
|
||||
@@ -285,7 +298,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400,
|
||||
color: isSelected ? Colors.white : AppColors.grey900,
|
||||
color: isSelected ? colorScheme.onPrimary : colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -294,7 +307,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Build empty state
|
||||
Widget _buildEmptyState() {
|
||||
Widget _buildEmptyState(ColorScheme colorScheme) {
|
||||
return SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Column(
|
||||
@@ -303,21 +316,21 @@ class RewardsPage extends ConsumerWidget {
|
||||
FaIcon(
|
||||
FontAwesomeIcons.gift,
|
||||
size: 64,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
Text(
|
||||
'Không có quà tặng nào',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
Text(
|
||||
'Vui lòng thử lại sau',
|
||||
style: TextStyle(fontSize: 14, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -330,6 +343,7 @@ class RewardsPage extends ConsumerWidget {
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
GiftCatalog gift,
|
||||
ColorScheme colorScheme,
|
||||
) {
|
||||
final numberFormat = NumberFormat('#,###', 'vi_VN');
|
||||
final pointsState = ref.read(loyaltyPointsProvider);
|
||||
@@ -342,15 +356,15 @@ class RewardsPage extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Bạn có chắc muốn đổi quà này?',
|
||||
style: const TextStyle(fontSize: 14),
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey50,
|
||||
color: colorScheme.surfaceContainerLowest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
@@ -370,10 +384,10 @@ class RewardsPage extends ConsumerWidget {
|
||||
const Text('Chi phí:', style: TextStyle(fontSize: 13)),
|
||||
Text(
|
||||
'${numberFormat.format(gift.pointsCost)} điểm',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primaryBlue,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -411,8 +425,8 @@ class RewardsPage extends ConsumerWidget {
|
||||
_processRedemption(context, ref, gift);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryBlue,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: colorScheme.primary,
|
||||
foregroundColor: colorScheme.onPrimary,
|
||||
),
|
||||
child: const Text('Xác nhận'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user