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

@@ -25,10 +25,7 @@ import 'package:worker/features/promotions/presentation/widgets/promotion_sectio
/// Full-screen detail view of a promotion with scrollable content
/// and fixed bottom action bar.
class PromotionDetailPage extends ConsumerStatefulWidget {
const PromotionDetailPage({
this.promotionId,
super.key,
});
const PromotionDetailPage({this.promotionId, super.key});
/// Promotion ID
final String? promotionId;
@@ -62,15 +59,16 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => context.pop(),
),
title: const Text('Chi tiết khuyến mãi', style: TextStyle(color: Colors.black)),
title: const Text(
'Chi tiết khuyến mãi',
style: TextStyle(color: Colors.black),
),
elevation: AppBarSpecs.elevation,
backgroundColor: AppColors.white,
foregroundColor: AppColors.grey900,
centerTitle: false,
),
body: const Center(
child: CircularProgressIndicator(),
),
body: const Center(child: CircularProgressIndicator()),
),
error: (error, stack) => Scaffold(
appBar: AppBar(
@@ -78,7 +76,10 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => context.pop(),
),
title: const Text('Chi tiết khuyến mãi', style: TextStyle(color: Colors.black)),
title: const Text(
'Chi tiết khuyến mãi',
style: TextStyle(color: Colors.black),
),
elevation: AppBarSpecs.elevation,
backgroundColor: AppColors.white,
foregroundColor: AppColors.grey900,
@@ -96,18 +97,12 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
const SizedBox(height: 16),
const Text(
'Không thể tải thông tin khuyến mãi',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
const SizedBox(height: 8),
Text(
error.toString(),
style: const TextStyle(
fontSize: 14,
color: AppColors.grey500,
),
style: const TextStyle(fontSize: 14, color: AppColors.grey500),
textAlign: TextAlign.center,
),
],
@@ -118,7 +113,6 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
}
Widget _buildDetailContent(Promotion promotion) {
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
@@ -189,12 +183,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
),
// Fixed Bottom Action Bar
Positioned(
left: 0,
right: 0,
bottom: 0,
child: _buildActionBar(),
),
Positioned(left: 0, right: 0, bottom: 0, child: _buildActionBar()),
],
),
);
@@ -210,9 +199,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
placeholder: (context, url) => Container(
height: 200,
color: AppColors.grey100,
child: const Center(
child: CircularProgressIndicator(),
),
child: const Center(child: CircularProgressIndicator()),
),
errorWidget: (context, url, error) => Container(
height: 200,
@@ -233,12 +220,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
return Container(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color(0xFFE2E8F0),
width: 1,
),
),
border: Border(bottom: BorderSide(color: Color(0xFFE2E8F0), width: 1)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -331,10 +313,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
),
// Discount Details
PromotionContentText(
'Ưu đãi chi tiết:',
isBold: true,
),
PromotionContentText('Ưu đãi chi tiết:', isBold: true),
PromotionBulletList(
items: [
'Gạch men 60x60cm: Giảm 25% - 30%',
@@ -348,10 +327,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
SizedBox(height: 16),
// Additional Benefits
PromotionContentText(
'Ưu đãi bổ sung:',
isBold: true,
),
PromotionContentText('Ưu đãi bổ sung:', isBold: true),
PromotionBulletList(
items: [
'Miễn phí vận chuyển cho đơn hàng từ 500m²',
@@ -398,14 +374,8 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
label: 'Hotline',
value: '1900-xxxx (8:00 - 18:00 hàng ngày)',
),
ContactInfo(
label: 'Email',
value: 'promotion@company.com',
),
ContactInfo(
label: 'Zalo',
value: '0123.456.789',
),
ContactInfo(label: 'Email', value: 'promotion@company.com'),
ContactInfo(label: 'Zalo', value: '0123.456.789'),
],
),
);
@@ -417,10 +387,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
decoration: BoxDecoration(
color: Colors.white,
border: const Border(
top: BorderSide(
color: Color(0xFFE2E8F0),
width: 1,
),
top: BorderSide(color: Color(0xFFE2E8F0), width: 1),
),
boxShadow: [
BoxShadow(
@@ -451,10 +418,7 @@ class _PromotionDetailPageState extends ConsumerState<PromotionDetailPage> {
SizedBox(width: 8),
Text(
'Xem sản phẩm áp dụng',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
],
),

View File

@@ -40,13 +40,9 @@ class PromotionsPage extends ConsumerWidget {
// Scrollable content
Expanded(
child: promotionsAsync.when(
data: (promotions) => _buildPromotionsContent(
context,
promotions,
),
loading: () => const Center(
child: CircularProgressIndicator(),
),
data: (promotions) =>
_buildPromotionsContent(context, promotions),
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) => Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -138,10 +134,7 @@ class PromotionsPage extends ConsumerWidget {
const SizedBox(height: 8),
Text(
'Hãy quay lại sau để xem các ưu đãi mới',
style: const TextStyle(
fontSize: 14,
color: AppColors.grey500,
),
style: const TextStyle(fontSize: 14, color: AppColors.grey500),
),
],
),
@@ -185,11 +178,8 @@ class PromotionsPage extends ConsumerWidget {
),
// Bottom padding for navigation clearance
const SliverToBoxAdapter(
child: SizedBox(height: 16),
),
const SliverToBoxAdapter(child: SizedBox(height: 16)),
],
);
}
}