add auth, format

This commit is contained in:
Phuoc Nguyen
2025-11-07 11:52:06 +07:00
parent 24a8508fce
commit 3803bd26e0
173 changed files with 8505 additions and 7116 deletions

View File

@@ -37,13 +37,20 @@ class RewardsPage extends ConsumerWidget {
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => context.pop(),
),
title: const Text('Đổi quà tặng', style: TextStyle(color: Colors.black)),
title: const Text(
'Đổi quà tặng',
style: TextStyle(color: Colors.black),
),
elevation: AppBarSpecs.elevation,
backgroundColor: AppColors.white,
foregroundColor: AppColors.grey900,
centerTitle: false,
actions: const [
SizedBox(width: AppSpacing.sm),
actions: [
IconButton(
icon: const Icon(Icons.info_outline, color: Colors.black),
onPressed: () => _showInfoDialog(context),
),
const SizedBox(width: AppSpacing.sm),
],
),
body: RefreshIndicator(
@@ -72,26 +79,20 @@ class RewardsPage extends ConsumerWidget {
sliver: filteredGifts.isEmpty
? _buildEmptyState()
: SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.7,
crossAxisSpacing: 0,
mainAxisSpacing: 0,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
final gift = filteredGifts[index];
return RewardCard(
gift: gift,
onRedeem: () => _handleRedeemGift(
context,
ref,
gift,
),
);
},
childCount: filteredGifts.length,
),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.7,
crossAxisSpacing: 0,
mainAxisSpacing: 0,
),
delegate: SliverChildBuilderDelegate((context, index) {
final gift = filteredGifts[index];
return RewardCard(
gift: gift,
onRedeem: () => _handleRedeemGift(context, ref, gift),
);
}, childCount: filteredGifts.length),
),
),
],
@@ -100,6 +101,84 @@ class RewardsPage extends ConsumerWidget {
);
}
/// Show info dialog with usage instructions
void _showInfoDialog(BuildContext context) {
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: const Text(
'Hướng dẫn sử dụng',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
),
content: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'Đây là nội dung hướng dẫn sử dụng cho tính năng Đổi quà tặng:',
style: TextStyle(fontSize: 14),
),
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.',
),
_buildInfoItem(
'Bấm vào một phần quà để xem chi tiết và điều kiện áp dụng.',
),
_buildInfoItem(
'Khi xác nhận đổi quà, bạn có thể chọn "Nhận hàng tại Showroom".',
),
_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.',
),
_buildInfoItem(
'Quà đã đổi sẽ được chuyển vào mục "Quà của tôi" (trong trang Hội viên).',
),
],
),
),
actions: [
ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primaryBlue,
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 44),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('Đóng'),
),
],
actionsPadding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
contentPadding: const EdgeInsets.fromLTRB(20, 16, 20, 16),
titlePadding: const EdgeInsets.fromLTRB(20, 20, 20, 8),
),
);
}
/// Build info item with bullet point
Widget _buildInfoItem(String text) {
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(top: 6),
child: Icon(Icons.circle, size: 6, color: AppColors.grey500),
),
const SizedBox(width: 12),
Expanded(
child: Text(text, style: TextStyle(fontSize: 14, height: 1.5)),
),
],
),
);
}
/// Build category filter pills
Widget _buildCategoryFilter(
BuildContext context,
@@ -237,10 +316,7 @@ class RewardsPage extends ConsumerWidget {
const SizedBox(height: 8),
const Text(
'Vui lòng thử lại sau',
style: TextStyle(
fontSize: 14,
color: AppColors.grey500,
),
style: TextStyle(fontSize: 14, color: AppColors.grey500),
),
],
),
@@ -290,10 +366,7 @@ class RewardsPage extends ConsumerWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Chi phí:',
style: TextStyle(fontSize: 13),
),
const Text('Chi phí:', style: TextStyle(fontSize: 13)),
Text(
'${numberFormat.format(gift.pointsCost)} điểm',
style: const TextStyle(
@@ -363,9 +436,7 @@ class RewardsPage extends ConsumerWidget {
children: [
const Icon(Icons.check_circle, color: Colors.white),
const SizedBox(width: 12),
Expanded(
child: Text('Đổi quà "${gift.name}" thành công!'),
),
Expanded(child: Text('Đổi quà "${gift.name}" thành công!')),
],
),
backgroundColor: AppColors.success,