feat: draw page
This commit is contained in:
parent
2870f39bcb
commit
ec1beeeb1b
587
lib/presentation/pages/draw/draw_page.dart
Normal file
587
lib/presentation/pages/draw/draw_page.dart
Normal file
@ -0,0 +1,587 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../common/theme/theme.dart';
|
||||||
|
|
||||||
|
// Models (simplified)
|
||||||
|
class DrawEvent {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String description;
|
||||||
|
final int entryPoints;
|
||||||
|
final String icon;
|
||||||
|
final Color primaryColor;
|
||||||
|
final String prize;
|
||||||
|
final String prizeValue;
|
||||||
|
final DateTime drawDate;
|
||||||
|
final int totalParticipants;
|
||||||
|
final int hadiah;
|
||||||
|
final String status; // 'active', 'ended'
|
||||||
|
final int minSpending;
|
||||||
|
|
||||||
|
DrawEvent({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
required this.entryPoints,
|
||||||
|
required this.icon,
|
||||||
|
required this.primaryColor,
|
||||||
|
required this.prize,
|
||||||
|
required this.prizeValue,
|
||||||
|
required this.drawDate,
|
||||||
|
required this.totalParticipants,
|
||||||
|
required this.hadiah,
|
||||||
|
required this.status,
|
||||||
|
required this.minSpending,
|
||||||
|
});
|
||||||
|
|
||||||
|
bool get isActive => status == 'active';
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserEntry {
|
||||||
|
final String drawId;
|
||||||
|
final DateTime entryDate;
|
||||||
|
|
||||||
|
UserEntry({required this.drawId, required this.entryDate});
|
||||||
|
}
|
||||||
|
|
||||||
|
@RoutePage()
|
||||||
|
class DrawPage extends StatefulWidget {
|
||||||
|
const DrawPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DrawPage> createState() => _DrawPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DrawPageState extends State<DrawPage> {
|
||||||
|
String selectedTab = 'active'; // 'active' or 'finished'
|
||||||
|
|
||||||
|
final List<UserEntry> userEntries = [
|
||||||
|
UserEntry(
|
||||||
|
drawId: "1",
|
||||||
|
entryDate: DateTime.now().subtract(Duration(hours: 3)),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<DrawEvent> drawEvents = [
|
||||||
|
DrawEvent(
|
||||||
|
id: "1",
|
||||||
|
name: "Emas 3 Gram",
|
||||||
|
description: "Gebyar Undian Enaklo\nMenangkan hadiah menarik",
|
||||||
|
entryPoints: 0,
|
||||||
|
icon: "👑",
|
||||||
|
primaryColor: AppColor.primary,
|
||||||
|
prize: "Emas 3 Gram",
|
||||||
|
prizeValue: "Rp 2.500.000",
|
||||||
|
drawDate: DateTime.now().add(Duration(hours: 1, minutes: 20)),
|
||||||
|
totalParticipants: 0,
|
||||||
|
hadiah: 2,
|
||||||
|
status: 'active',
|
||||||
|
minSpending: 50000,
|
||||||
|
),
|
||||||
|
DrawEvent(
|
||||||
|
id: "2",
|
||||||
|
name: "iPhone 15 Pro",
|
||||||
|
description: "Undian Smartphone Premium\nDapatkan iPhone terbaru",
|
||||||
|
entryPoints: 0,
|
||||||
|
icon: "📱",
|
||||||
|
primaryColor: AppColor.info,
|
||||||
|
prize: "iPhone 15 Pro",
|
||||||
|
prizeValue: "Rp 18.000.000",
|
||||||
|
drawDate: DateTime.now().subtract(Duration(days: 1)),
|
||||||
|
totalParticipants: 156,
|
||||||
|
hadiah: 1,
|
||||||
|
status: 'ended',
|
||||||
|
minSpending: 100000,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
List<DrawEvent> get filteredDraws {
|
||||||
|
return drawEvents.where((draw) {
|
||||||
|
if (selectedTab == 'active') {
|
||||||
|
return draw.isActive;
|
||||||
|
} else {
|
||||||
|
return !draw.isActive;
|
||||||
|
}
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isUserEntered(String drawId) {
|
||||||
|
return userEntries.any((entry) => entry.drawId == drawId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getTimeRemaining(DateTime targetDate) {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final difference = targetDate.difference(now);
|
||||||
|
|
||||||
|
if (difference.isNegative) return "Berakhir";
|
||||||
|
|
||||||
|
if (difference.inHours > 0) {
|
||||||
|
return "${difference.inHours}h ${difference.inMinutes % 60}m";
|
||||||
|
} else if (difference.inMinutes > 0) {
|
||||||
|
return "${difference.inMinutes}m";
|
||||||
|
} else {
|
||||||
|
return "Sekarang!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColor.background,
|
||||||
|
appBar: AppBar(title: Text("Undian Enaklo")),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
// Tab selector
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.surface,
|
||||||
|
borderRadius: BorderRadius.circular(25),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppColor.black.withOpacity(0.05),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => setState(() => selectedTab = 'active'),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: selectedTab == 'active'
|
||||||
|
? AppColor.primary
|
||||||
|
: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(25),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Aktif (${drawEvents.where((d) => d.isActive).length})",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
color: selectedTab == 'active'
|
||||||
|
? AppColor.textWhite
|
||||||
|
: AppColor.textSecondary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => setState(() => selectedTab = 'finished'),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: selectedTab == 'finished'
|
||||||
|
? AppColor.primary
|
||||||
|
: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(25),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Selesai (${drawEvents.where((d) => !d.isActive).length})",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
color: selectedTab == 'finished'
|
||||||
|
? AppColor.textWhite
|
||||||
|
: AppColor.textSecondary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Draw list
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
itemCount: filteredDraws.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final draw = filteredDraws[index];
|
||||||
|
return _buildSimpleDrawCard(draw);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSimpleDrawCard(DrawEvent draw) {
|
||||||
|
_isUserEntered(draw.id);
|
||||||
|
final timeRemaining = _getTimeRemaining(draw.drawDate);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.surface,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppColor.black.withOpacity(0.08),
|
||||||
|
blurRadius: 12,
|
||||||
|
offset: Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Header with gradient background
|
||||||
|
Container(
|
||||||
|
height: 160,
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [draw.primaryColor, draw.primaryColor.withOpacity(0.8)],
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
// Background pattern (coins and gold bar)
|
||||||
|
Positioned(
|
||||||
|
right: 20,
|
||||||
|
top: 20,
|
||||||
|
child: Opacity(
|
||||||
|
opacity: 0.3,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
_buildCoin(),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
_buildCoin(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
_buildGoldBar(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Content
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (draw.isActive)
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.success,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"AKTIF",
|
||||||
|
style: AppStyle.xs.copyWith(
|
||||||
|
color: AppColor.textWhite,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
"MAKAN\nDAPAT",
|
||||||
|
style: AppStyle.h5.copyWith(
|
||||||
|
color: AppColor.textWhite,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
height: 0.9,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
draw.description,
|
||||||
|
style: AppStyle.sm.copyWith(color: AppColor.textWhite),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Card content
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Prize info
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(draw.icon, style: AppStyle.h5),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
draw.prize,
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Stats row
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"-",
|
||||||
|
style: AppStyle.h5.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Peserta",
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"${draw.hadiah}",
|
||||||
|
style: AppStyle.h5.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Hadiah",
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"0",
|
||||||
|
style: AppStyle.h5.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColor.error,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Voucher Anda",
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Timer
|
||||||
|
if (draw.isActive)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.access_time, color: AppColor.error, size: 16),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
"Berakhir dalam:",
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Text(
|
||||||
|
timeRemaining,
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: AppColor.error,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Spending requirement
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => _showSpendingInfo(draw),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.backgroundLight,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: AppColor.borderLight, width: 1),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"Belanja min. Rp ${_formatCurrency(draw.minSpending)} untuk berpartisipasi",
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.chevron_right,
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCoin() {
|
||||||
|
return Container(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.warning,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(color: Colors.yellow, width: 1),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"₹",
|
||||||
|
style: AppStyle.xs.copyWith(
|
||||||
|
color: Colors.orange[800],
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildGoldBar() {
|
||||||
|
return Container(
|
||||||
|
width: 30,
|
||||||
|
height: 15,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.warning,
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
border: Border.all(color: Colors.yellow, width: 1),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"GOLD",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.orange[800],
|
||||||
|
fontSize: 6,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _formatCurrency(int amount) {
|
||||||
|
return amount.toString().replaceAllMapped(
|
||||||
|
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
|
||||||
|
(Match m) => '${m[1]}.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showSpendingInfo(DrawEvent draw) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
backgroundColor: AppColor.surface,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||||
|
title: Text(
|
||||||
|
"Syarat Partisipasi",
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Untuk mengikuti undian ${draw.name}, Anda perlu:",
|
||||||
|
style: AppStyle.md.copyWith(color: AppColor.textPrimary),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.shopping_cart, color: draw.primaryColor, size: 20),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"Belanja minimum Rp ${_formatCurrency(draw.minSpending)}",
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.schedule, color: draw.primaryColor, size: 20),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"Sebelum ${_formatDateTime(draw.drawDate)}",
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(
|
||||||
|
"Mengerti",
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
color: AppColor.primary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _formatDateTime(DateTime date) {
|
||||||
|
return "${date.day}/${date.month}/${date.year} ${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,7 +23,7 @@ class HomeFeatureSection extends StatelessWidget {
|
|||||||
icon: Icons.casino,
|
icon: Icons.casino,
|
||||||
title: 'Undian',
|
title: 'Undian',
|
||||||
iconColor: const Color(0xFF7B1FA2),
|
iconColor: const Color(0xFF7B1FA2),
|
||||||
onTap: () => print('Navigate to Undian'),
|
onTap: () => context.router.push(DrawRoute()),
|
||||||
),
|
),
|
||||||
HomeFeatureCard(
|
HomeFeatureCard(
|
||||||
icon: Icons.store,
|
icon: Icons.store,
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {},
|
onPressed: () => context.router.push(const MainRoute()),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Lewati tahap ini',
|
'Lewati tahap ini',
|
||||||
style: AppStyle.md.copyWith(
|
style: AppStyle.md.copyWith(
|
||||||
|
|||||||
@ -34,5 +34,8 @@ class AppRouter extends RootStackRouter {
|
|||||||
// Reward
|
// Reward
|
||||||
AutoRoute(page: RewardRoute.page),
|
AutoRoute(page: RewardRoute.page),
|
||||||
AutoRoute(page: ProductRedeemRoute.page),
|
AutoRoute(page: ProductRedeemRoute.page),
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
AutoRoute(page: DrawRoute.page),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,150 +9,167 @@
|
|||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:auto_route/auto_route.dart' as _i15;
|
import 'package:auto_route/auto_route.dart' as _i16;
|
||||||
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2;
|
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i3;
|
||||||
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i7;
|
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i8;
|
||||||
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i8;
|
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i9;
|
||||||
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
||||||
as _i11;
|
as _i12;
|
||||||
import 'package:enaklo/presentation/pages/main/main_page.dart' as _i3;
|
import 'package:enaklo/presentation/pages/draw/draw_page.dart' as _i1;
|
||||||
|
import 'package:enaklo/presentation/pages/main/main_page.dart' as _i4;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart'
|
||||||
as _i1;
|
as _i2;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart'
|
||||||
as _i6;
|
as _i7;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart'
|
||||||
as _i10;
|
as _i11;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart'
|
||||||
as _i14;
|
as _i15;
|
||||||
import 'package:enaklo/presentation/pages/merchant/merchant_page.dart' as _i4;
|
import 'package:enaklo/presentation/pages/merchant/merchant_page.dart' as _i5;
|
||||||
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
||||||
as _i5;
|
as _i6;
|
||||||
import 'package:enaklo/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart'
|
import 'package:enaklo/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart'
|
||||||
as _i9;
|
as _i10;
|
||||||
import 'package:enaklo/presentation/pages/reward/reward_page.dart' as _i12;
|
import 'package:enaklo/presentation/pages/reward/reward_page.dart' as _i13;
|
||||||
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i13;
|
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i14;
|
||||||
import 'package:flutter/material.dart' as _i16;
|
import 'package:flutter/material.dart' as _i17;
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i1.HomePage]
|
/// [_i1.DrawPage]
|
||||||
class HomeRoute extends _i15.PageRouteInfo<void> {
|
class DrawRoute extends _i16.PageRouteInfo<void> {
|
||||||
const HomeRoute({List<_i15.PageRouteInfo>? children})
|
const DrawRoute({List<_i16.PageRouteInfo>? children})
|
||||||
|
: super(DrawRoute.name, initialChildren: children);
|
||||||
|
|
||||||
|
static const String name = 'DrawRoute';
|
||||||
|
|
||||||
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
|
name,
|
||||||
|
builder: (data) {
|
||||||
|
return const _i1.DrawPage();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// generated route for
|
||||||
|
/// [_i2.HomePage]
|
||||||
|
class HomeRoute extends _i16.PageRouteInfo<void> {
|
||||||
|
const HomeRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(HomeRoute.name, initialChildren: children);
|
: super(HomeRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'HomeRoute';
|
static const String name = 'HomeRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i1.HomePage();
|
return const _i2.HomePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i2.LoginPage]
|
/// [_i3.LoginPage]
|
||||||
class LoginRoute extends _i15.PageRouteInfo<void> {
|
class LoginRoute extends _i16.PageRouteInfo<void> {
|
||||||
const LoginRoute({List<_i15.PageRouteInfo>? children})
|
const LoginRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(LoginRoute.name, initialChildren: children);
|
: super(LoginRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'LoginRoute';
|
static const String name = 'LoginRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i2.LoginPage();
|
return const _i3.LoginPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i3.MainPage]
|
/// [_i4.MainPage]
|
||||||
class MainRoute extends _i15.PageRouteInfo<void> {
|
class MainRoute extends _i16.PageRouteInfo<void> {
|
||||||
const MainRoute({List<_i15.PageRouteInfo>? children})
|
const MainRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(MainRoute.name, initialChildren: children);
|
: super(MainRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'MainRoute';
|
static const String name = 'MainRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i3.MainPage();
|
return const _i4.MainPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i4.MerchantPage]
|
/// [_i5.MerchantPage]
|
||||||
class MerchantRoute extends _i15.PageRouteInfo<void> {
|
class MerchantRoute extends _i16.PageRouteInfo<void> {
|
||||||
const MerchantRoute({List<_i15.PageRouteInfo>? children})
|
const MerchantRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(MerchantRoute.name, initialChildren: children);
|
: super(MerchantRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'MerchantRoute';
|
static const String name = 'MerchantRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i4.MerchantPage();
|
return const _i5.MerchantPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i5.OnboardingPage]
|
/// [_i6.OnboardingPage]
|
||||||
class OnboardingRoute extends _i15.PageRouteInfo<void> {
|
class OnboardingRoute extends _i16.PageRouteInfo<void> {
|
||||||
const OnboardingRoute({List<_i15.PageRouteInfo>? children})
|
const OnboardingRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(OnboardingRoute.name, initialChildren: children);
|
: super(OnboardingRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OnboardingRoute';
|
static const String name = 'OnboardingRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i5.OnboardingPage();
|
return const _i6.OnboardingPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i6.OrderPage]
|
/// [_i7.OrderPage]
|
||||||
class OrderRoute extends _i15.PageRouteInfo<void> {
|
class OrderRoute extends _i16.PageRouteInfo<void> {
|
||||||
const OrderRoute({List<_i15.PageRouteInfo>? children})
|
const OrderRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(OrderRoute.name, initialChildren: children);
|
: super(OrderRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OrderRoute';
|
static const String name = 'OrderRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i6.OrderPage();
|
return const _i7.OrderPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i7.OtpPage]
|
/// [_i8.OtpPage]
|
||||||
class OtpRoute extends _i15.PageRouteInfo<void> {
|
class OtpRoute extends _i16.PageRouteInfo<void> {
|
||||||
const OtpRoute({List<_i15.PageRouteInfo>? children})
|
const OtpRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(OtpRoute.name, initialChildren: children);
|
: super(OtpRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OtpRoute';
|
static const String name = 'OtpRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i7.OtpPage();
|
return const _i8.OtpPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i8.PinPage]
|
/// [_i9.PinPage]
|
||||||
class PinRoute extends _i15.PageRouteInfo<PinRouteArgs> {
|
class PinRoute extends _i16.PageRouteInfo<PinRouteArgs> {
|
||||||
PinRoute({
|
PinRoute({
|
||||||
_i16.Key? key,
|
_i17.Key? key,
|
||||||
bool isCreatePin = true,
|
bool isCreatePin = true,
|
||||||
String? title,
|
String? title,
|
||||||
List<_i15.PageRouteInfo>? children,
|
List<_i16.PageRouteInfo>? children,
|
||||||
}) : super(
|
}) : super(
|
||||||
PinRoute.name,
|
PinRoute.name,
|
||||||
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
||||||
@ -161,13 +178,13 @@ class PinRoute extends _i15.PageRouteInfo<PinRouteArgs> {
|
|||||||
|
|
||||||
static const String name = 'PinRoute';
|
static const String name = 'PinRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
final args = data.argsAs<PinRouteArgs>(
|
final args = data.argsAs<PinRouteArgs>(
|
||||||
orElse: () => const PinRouteArgs(),
|
orElse: () => const PinRouteArgs(),
|
||||||
);
|
);
|
||||||
return _i8.PinPage(
|
return _i9.PinPage(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
isCreatePin: args.isCreatePin,
|
isCreatePin: args.isCreatePin,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
@ -179,7 +196,7 @@ class PinRoute extends _i15.PageRouteInfo<PinRouteArgs> {
|
|||||||
class PinRouteArgs {
|
class PinRouteArgs {
|
||||||
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
||||||
|
|
||||||
final _i16.Key? key;
|
final _i17.Key? key;
|
||||||
|
|
||||||
final bool isCreatePin;
|
final bool isCreatePin;
|
||||||
|
|
||||||
@ -192,14 +209,14 @@ class PinRouteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i9.ProductRedeemPage]
|
/// [_i10.ProductRedeemPage]
|
||||||
class ProductRedeemRoute extends _i15.PageRouteInfo<ProductRedeemRouteArgs> {
|
class ProductRedeemRoute extends _i16.PageRouteInfo<ProductRedeemRouteArgs> {
|
||||||
ProductRedeemRoute({
|
ProductRedeemRoute({
|
||||||
_i16.Key? key,
|
_i17.Key? key,
|
||||||
required _i12.Product product,
|
required _i13.Product product,
|
||||||
required _i12.Merchant merchant,
|
required _i13.Merchant merchant,
|
||||||
required _i12.PointCard pointCard,
|
required _i13.PointCard pointCard,
|
||||||
List<_i15.PageRouteInfo>? children,
|
List<_i16.PageRouteInfo>? children,
|
||||||
}) : super(
|
}) : super(
|
||||||
ProductRedeemRoute.name,
|
ProductRedeemRoute.name,
|
||||||
args: ProductRedeemRouteArgs(
|
args: ProductRedeemRouteArgs(
|
||||||
@ -213,11 +230,11 @@ class ProductRedeemRoute extends _i15.PageRouteInfo<ProductRedeemRouteArgs> {
|
|||||||
|
|
||||||
static const String name = 'ProductRedeemRoute';
|
static const String name = 'ProductRedeemRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
final args = data.argsAs<ProductRedeemRouteArgs>();
|
final args = data.argsAs<ProductRedeemRouteArgs>();
|
||||||
return _i9.ProductRedeemPage(
|
return _i10.ProductRedeemPage(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
product: args.product,
|
product: args.product,
|
||||||
merchant: args.merchant,
|
merchant: args.merchant,
|
||||||
@ -235,13 +252,13 @@ class ProductRedeemRouteArgs {
|
|||||||
required this.pointCard,
|
required this.pointCard,
|
||||||
});
|
});
|
||||||
|
|
||||||
final _i16.Key? key;
|
final _i17.Key? key;
|
||||||
|
|
||||||
final _i12.Product product;
|
final _i13.Product product;
|
||||||
|
|
||||||
final _i12.Merchant merchant;
|
final _i13.Merchant merchant;
|
||||||
|
|
||||||
final _i12.PointCard pointCard;
|
final _i13.PointCard pointCard;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -250,81 +267,81 @@ class ProductRedeemRouteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i10.ProfilePage]
|
/// [_i11.ProfilePage]
|
||||||
class ProfileRoute extends _i15.PageRouteInfo<void> {
|
class ProfileRoute extends _i16.PageRouteInfo<void> {
|
||||||
const ProfileRoute({List<_i15.PageRouteInfo>? children})
|
const ProfileRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(ProfileRoute.name, initialChildren: children);
|
: super(ProfileRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'ProfileRoute';
|
static const String name = 'ProfileRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i10.ProfilePage();
|
return const _i11.ProfilePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i11.RegisterPage]
|
/// [_i12.RegisterPage]
|
||||||
class RegisterRoute extends _i15.PageRouteInfo<void> {
|
class RegisterRoute extends _i16.PageRouteInfo<void> {
|
||||||
const RegisterRoute({List<_i15.PageRouteInfo>? children})
|
const RegisterRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(RegisterRoute.name, initialChildren: children);
|
: super(RegisterRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'RegisterRoute';
|
static const String name = 'RegisterRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i11.RegisterPage();
|
return const _i12.RegisterPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i12.RewardPage]
|
/// [_i13.RewardPage]
|
||||||
class RewardRoute extends _i15.PageRouteInfo<void> {
|
class RewardRoute extends _i16.PageRouteInfo<void> {
|
||||||
const RewardRoute({List<_i15.PageRouteInfo>? children})
|
const RewardRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(RewardRoute.name, initialChildren: children);
|
: super(RewardRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'RewardRoute';
|
static const String name = 'RewardRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i12.RewardPage();
|
return const _i13.RewardPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i13.SplashPage]
|
/// [_i14.SplashPage]
|
||||||
class SplashRoute extends _i15.PageRouteInfo<void> {
|
class SplashRoute extends _i16.PageRouteInfo<void> {
|
||||||
const SplashRoute({List<_i15.PageRouteInfo>? children})
|
const SplashRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(SplashRoute.name, initialChildren: children);
|
: super(SplashRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'SplashRoute';
|
static const String name = 'SplashRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i13.SplashPage();
|
return const _i14.SplashPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i14.VoucherPage]
|
/// [_i15.VoucherPage]
|
||||||
class VoucherRoute extends _i15.PageRouteInfo<void> {
|
class VoucherRoute extends _i16.PageRouteInfo<void> {
|
||||||
const VoucherRoute({List<_i15.PageRouteInfo>? children})
|
const VoucherRoute({List<_i16.PageRouteInfo>? children})
|
||||||
: super(VoucherRoute.name, initialChildren: children);
|
: super(VoucherRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'VoucherRoute';
|
static const String name = 'VoucherRoute';
|
||||||
|
|
||||||
static _i15.PageInfo page = _i15.PageInfo(
|
static _i16.PageInfo page = _i16.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i14.VoucherPage();
|
return const _i15.VoucherPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user