Files
worker/lib/features/promotions/presentation/widgets/featured_promotion_card.dart
Phuoc Nguyen b5f90c364d update icon
2025-11-14 18:02:37 +07:00

127 lines
3.6 KiB
Dart

/// Featured Promotion Card Widget
///
/// Displays a prominent featured promotion with gradient background,
/// typically shown at the top of the promotions page.
library;
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:worker/core/theme/colors.dart';
/// Featured Promotion Card
///
/// Shows a special promotion with:
/// - Gradient background (primary blue to light blue)
/// - Large title and subtitle
/// - Countdown timer (optional)
/// - Percentage icon
class FeaturedPromotionCard extends StatelessWidget {
/// Card title
final String title;
/// Card subtitle/description
final String subtitle;
/// Optional timer text (e.g., "Còn 2 ngày 15:30:45")
final String? timerText;
/// Optional tap callback
final VoidCallback? onTap;
const FeaturedPromotionCard({
required this.title,
required this.subtitle,
this.timerText,
this.onTap,
super.key,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: double.infinity,
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [AppColors.primaryBlue, AppColors.lightBlue],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: AppColors.primaryBlue.withValues(alpha: 0.3),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: [
// Left side - Text content
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title
Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
const SizedBox(height: 8),
// Subtitle
Text(
subtitle,
style: TextStyle(
fontSize: 14,
color: Colors.white.withValues(alpha: 0.9),
),
),
// Timer (if provided)
if (timerText != null) ...[
const SizedBox(height: 12),
Row(
children: [
FaIcon(
FontAwesomeIcons.clock,
size: 12,
color: Colors.white.withValues(alpha: 0.8),
),
const SizedBox(width: 4),
Text(
timerText!,
style: TextStyle(
fontSize: 12,
color: Colors.white.withValues(alpha: 0.8),
),
),
],
),
],
],
),
),
// Right side - Icon
const SizedBox(width: 16),
FaIcon(
FontAwesomeIcons.percent,
size: 48,
color: Colors.white.withValues(alpha: 0.9),
),
],
),
),
);
}
}