add auth, format
This commit is contained in:
@@ -82,7 +82,7 @@ class HomeLocalDataSourceImpl implements HomeLocalDataSource {
|
||||
'tier': 'diamond',
|
||||
'points': 9750,
|
||||
'validUntil': '2025-12-31T23:59:59.000Z',
|
||||
'qrData': '0983441099'
|
||||
'qrData': '0983441099',
|
||||
};
|
||||
|
||||
/// Mock JSON data for promotions
|
||||
@@ -115,7 +115,7 @@ class HomeLocalDataSourceImpl implements HomeLocalDataSource {
|
||||
'startDate': '2025-01-01T00:00:00.000Z',
|
||||
'endDate': '2025-12-31T23:59:59.000Z',
|
||||
'discountPercentage': 5,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
/// Constructor
|
||||
|
||||
@@ -15,7 +15,7 @@ enum PromotionStatus {
|
||||
upcoming,
|
||||
|
||||
/// Expired promotion
|
||||
expired;
|
||||
expired,
|
||||
}
|
||||
|
||||
/// Promotion Entity
|
||||
|
||||
@@ -222,7 +222,6 @@ class HomePage extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ class MemberCardWidget extends StatelessWidget {
|
||||
/// Member card data
|
||||
final MemberCard memberCard;
|
||||
|
||||
const MemberCardWidget({
|
||||
super.key,
|
||||
required this.memberCard,
|
||||
});
|
||||
const MemberCardWidget({super.key, required this.memberCard});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -185,8 +182,8 @@ class MemberCardWidget extends StatelessWidget {
|
||||
/// Format points with thousands separator
|
||||
String _formatPoints(int points) {
|
||||
return points.toString().replaceAllMapped(
|
||||
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
|
||||
(Match m) => '${m[1]},',
|
||||
);
|
||||
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
|
||||
(Match m) => '${m[1]},',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ import 'package:worker/features/home/domain/entities/promotion.dart';
|
||||
/// Displays a horizontal scrollable list of promotion cards.
|
||||
/// Each card shows an image, title, and brief description.
|
||||
class PromotionSlider extends StatelessWidget {
|
||||
|
||||
const PromotionSlider({
|
||||
super.key,
|
||||
required this.promotions,
|
||||
this.onPromotionTap,
|
||||
});
|
||||
|
||||
/// List of promotions to display
|
||||
final List<Promotion> promotions;
|
||||
|
||||
@@ -83,11 +83,7 @@ class PromotionSlider extends StatelessWidget {
|
||||
|
||||
/// Individual Promotion Card
|
||||
class _PromotionCard extends StatelessWidget {
|
||||
|
||||
const _PromotionCard({
|
||||
required this.promotion,
|
||||
this.onTap,
|
||||
});
|
||||
const _PromotionCard({required this.promotion, this.onTap});
|
||||
final Promotion promotion;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@@ -115,8 +111,9 @@ class _PromotionCard extends StatelessWidget {
|
||||
children: [
|
||||
// Promotion Image
|
||||
ClipRRect(
|
||||
borderRadius:
|
||||
const BorderRadius.vertical(top: Radius.circular(12)),
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(12),
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: promotion.imageUrl,
|
||||
height: 140,
|
||||
@@ -125,9 +122,7 @@ class _PromotionCard extends StatelessWidget {
|
||||
placeholder: (context, url) => Container(
|
||||
height: 140,
|
||||
color: AppColors.grey100,
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
errorWidget: (context, url, error) => Container(
|
||||
height: 140,
|
||||
|
||||
@@ -63,11 +63,7 @@ class QuickActionItem extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
// Icon
|
||||
Icon(
|
||||
icon,
|
||||
size: 32,
|
||||
color: AppColors.primaryBlue,
|
||||
),
|
||||
Icon(icon, size: 32, color: AppColors.primaryBlue),
|
||||
const SizedBox(height: 8),
|
||||
// Label
|
||||
Text(
|
||||
@@ -97,9 +93,7 @@ class QuickActionItem extends StatelessWidget {
|
||||
color: AppColors.danger,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 20,
|
||||
),
|
||||
constraints: const BoxConstraints(minWidth: 20),
|
||||
child: Text(
|
||||
badge!,
|
||||
style: const TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user