From fb7c9a19a958a5ca256e0ee0cc03f8e582faa3e4 Mon Sep 17 00:00:00 2001 From: efrilm Date: Fri, 29 Aug 2025 14:25:21 +0700 Subject: [PATCH] feat: reward page --- .../pages/home/widgets/feature_section.dart | 2 +- .../pages/reward/reward_page.dart | 977 ++++++++++++++++++ lib/presentation/router/app_router.dart | 3 + lib/presentation/router/app_router.gr.dart | 113 +- 4 files changed, 1046 insertions(+), 49 deletions(-) create mode 100644 lib/presentation/pages/reward/reward_page.dart diff --git a/lib/presentation/pages/main/pages/home/widgets/feature_section.dart b/lib/presentation/pages/main/pages/home/widgets/feature_section.dart index 314c4c4..5bf1757 100644 --- a/lib/presentation/pages/main/pages/home/widgets/feature_section.dart +++ b/lib/presentation/pages/main/pages/home/widgets/feature_section.dart @@ -17,7 +17,7 @@ class HomeFeatureSection extends StatelessWidget { icon: Icons.card_giftcard, title: 'Reward', iconColor: const Color(0xFF1976D2), - onTap: () => print('Navigate to Reward'), + onTap: () => context.router.push(RewardRoute()), ), HomeFeatureCard( icon: Icons.casino, diff --git a/lib/presentation/pages/reward/reward_page.dart b/lib/presentation/pages/reward/reward_page.dart new file mode 100644 index 0000000..e4f41b5 --- /dev/null +++ b/lib/presentation/pages/reward/reward_page.dart @@ -0,0 +1,977 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; + +import '../../../common/theme/theme.dart'; + +// Models +class PointCard { + final int totalPoints; + final int usedPoints; + final String membershipLevel; + + PointCard({ + required this.totalPoints, + required this.usedPoints, + required this.membershipLevel, + }); + + int get availablePoints => totalPoints - usedPoints; +} + +class Merchant { + final String id; + final String name; + final String logo; + final List categories; + + Merchant({ + required this.id, + required this.name, + required this.logo, + required this.categories, + }); +} + +class Category { + final String id; + final String name; + final String icon; + final List products; + + Category({ + required this.id, + required this.name, + required this.icon, + required this.products, + }); +} + +class Product { + final String id; + final String name; + final String image; + final int pointsRequired; + final String description; + final bool isPopular; + + Product({ + required this.id, + required this.name, + required this.image, + required this.pointsRequired, + required this.description, + this.isPopular = false, + }); +} + +@RoutePage() +class RewardPage extends StatefulWidget { + const RewardPage({super.key}); + + @override + State createState() => _RewardPageState(); +} + +class _RewardPageState extends State { + final ScrollController _scrollController = ScrollController(); + + // Sample data + final PointCard pointCard = PointCard( + totalPoints: 15000, + usedPoints: 3500, + membershipLevel: "Gold Member", + ); + + final List merchants = [ + Merchant( + id: "1", + name: "Starbucks", + logo: "☕", + categories: [ + Category( + id: "c1", + name: "Beverages", + icon: "🥤", + products: [ + Product( + id: "p1", + name: "Americano", + image: "☕", + pointsRequired: 2500, + description: "Classic black coffee", + isPopular: true, + ), + Product( + id: "p2", + name: "Cappuccino", + image: "☕", + pointsRequired: 3000, + description: "Espresso with steamed milk", + ), + Product( + id: "p3", + name: "Frappuccino", + image: "🥤", + pointsRequired: 4000, + description: "Iced blended coffee", + ), + ], + ), + Category( + id: "c2", + name: "Food", + icon: "🍰", + products: [ + Product( + id: "p4", + name: "Croissant", + image: "🥐", + pointsRequired: 1500, + description: "Buttery pastry", + ), + Product( + id: "p5", + name: "Sandwich", + image: "🥪", + pointsRequired: 3500, + description: "Fresh deli sandwich", + ), + ], + ), + ], + ), + Merchant( + id: "2", + name: "McDonald's", + logo: "🍔", + categories: [ + Category( + id: "c3", + name: "Burgers", + icon: "🍔", + products: [ + Product( + id: "p6", + name: "Big Mac", + image: "🍔", + pointsRequired: 5000, + description: "Iconic double burger", + isPopular: true, + ), + Product( + id: "p7", + name: "Quarter Pounder", + image: "🍔", + pointsRequired: 4500, + description: "Fresh beef quarter pound", + ), + ], + ), + Category( + id: "c4", + name: "Drinks", + icon: "🥤", + products: [ + Product( + id: "p8", + name: "Coca Cola", + image: "🥤", + pointsRequired: 1000, + description: "Ice cold soda", + ), + Product( + id: "p9", + name: "McCafe Coffee", + image: "☕", + pointsRequired: + 20000, // High points untuk demonstrasi insufficient + description: "Premium coffee blend", + ), + ], + ), + ], + ), + ]; + + Merchant? selectedMerchant; + Map categoryKeys = {}; + String? selectedMerchantId; // Track merchant ID untuk detect changes + String? activeCategoryId; // Track active category + + @override + void initState() { + super.initState(); + selectedMerchant = merchants.first; + selectedMerchantId = selectedMerchant?.id; + activeCategoryId = + selectedMerchant?.categories.first.id; // Set first category as active + _initializeCategoryKeys(); + } + + void _initializeCategoryKeys() { + categoryKeys.clear(); + for (var category in selectedMerchant?.categories ?? []) { + categoryKeys[category.id] = GlobalKey(); + } + } + + void _scrollToCategory(String categoryId) { + // Update active category state FIRST + setState(() { + activeCategoryId = categoryId; + }); + + // Tunggu sampai widget selesai rebuild dan keys ter-attach + Future.delayed(Duration(milliseconds: 50), () { + final key = categoryKeys[categoryId]; + if (key?.currentContext != null) { + print("Scrolling to category: $categoryId"); // Debug log + + try { + Scrollable.ensureVisible( + key!.currentContext!, + duration: Duration(milliseconds: 500), + curve: Curves.easeInOut, + alignment: 0.1, // Position kategori sedikit dari atas + ); + } catch (e) { + print("Error scrolling to category: $e"); + } + } else { + print("Key not found for category: $categoryId"); // Debug log + print("Available keys: ${categoryKeys.keys.toList()}"); // Debug log + + // Retry dengan delay lebih lama jika belum ready + Future.delayed(Duration(milliseconds: 200), () { + final retryKey = categoryKeys[categoryId]; + if (retryKey?.currentContext != null) { + Scrollable.ensureVisible( + retryKey!.currentContext!, + duration: Duration(milliseconds: 500), + curve: Curves.easeInOut, + alignment: 0.1, + ); + } + }); + } + }); + } + + void _onMerchantChanged(Merchant merchant) { + if (selectedMerchantId == merchant.id) + return; // Prevent unnecessary rebuilds + + setState(() { + selectedMerchant = merchant; + selectedMerchantId = merchant.id; + // Reset active category to first category of new merchant + activeCategoryId = merchant.categories.first.id; + }); + + // Reinitialize category keys for new merchant - immediate call + _initializeCategoryKeys(); + + // Auto scroll to top when merchant changes + if (_scrollController.hasClients) { + _scrollController.animateTo( + 0, + duration: Duration(milliseconds: 300), + curve: Curves.easeOut, + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColor.background, + body: NestedScrollView( + controller: _scrollController, + headerSliverBuilder: (context, innerBoxIsScrolled) { + return [ + // Sticky AppBar + SliverAppBar( + elevation: 0, + backgroundColor: AppColor.white, + title: Text("Rewards"), + centerTitle: true, + floating: false, + pinned: true, // Made sticky + snap: false, + ), + + // Point Card Section + SliverToBoxAdapter(child: _buildPointCard()), + + // Merchant Selection + SliverToBoxAdapter(child: _buildMerchantSelection()), + + // Sticky Category Tabs + SliverPersistentHeader( + pinned: true, + key: ValueKey( + '${selectedMerchant?.id}_$activeCategoryId', + ), // Force rebuild with key + delegate: _StickyHeaderDelegate( + child: _buildCategoryTabs(), + height: 66, + merchantId: selectedMerchant?.id ?? '', // Pass merchant ID + activeCategoryId: activeCategoryId, // Pass active category ID + ), + ), + ]; + }, + body: selectedMerchant == null + ? SizedBox.shrink() + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: selectedMerchant!.categories.length, + itemBuilder: (context, index) { + final category = selectedMerchant!.categories[index]; + return _buildCategorySection(category); + }, + ), + ), + ); + } + + Widget _buildPointCard() { + return Container( + margin: EdgeInsets.all(16), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [AppColor.primary, AppColor.primaryDark], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: AppColor.primary.withOpacity(0.3), + blurRadius: 12, + offset: Offset(0, 6), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + pointCard.membershipLevel, + style: AppStyle.sm.copyWith( + color: AppColor.textWhite.withOpacity(0.9), + fontWeight: FontWeight.w500, + ), + ), + SizedBox(height: 4), + Text( + "${pointCard.availablePoints}", + style: AppStyle.h2.copyWith( + color: AppColor.textWhite, + fontWeight: FontWeight.w700, + ), + ), + Text( + "Available Points", + style: AppStyle.sm.copyWith( + color: AppColor.textWhite.withOpacity(0.9), + ), + ), + ], + ), + Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: AppColor.white.withOpacity(0.2), + borderRadius: BorderRadius.circular(12), + ), + child: Icon( + Icons.stars_rounded, + color: AppColor.textWhite, + size: 32, + ), + ), + ], + ), + SizedBox(height: 16), + Container( + height: 8, + decoration: BoxDecoration( + color: AppColor.white.withOpacity(0.3), + borderRadius: BorderRadius.circular(4), + ), + child: FractionallySizedBox( + widthFactor: + (pointCard.totalPoints - pointCard.usedPoints) / + pointCard.totalPoints, + alignment: Alignment.centerLeft, + child: Container( + decoration: BoxDecoration( + color: AppColor.textWhite, + borderRadius: BorderRadius.circular(4), + ), + ), + ), + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Used: ${pointCard.usedPoints}", + style: AppStyle.xs.copyWith( + color: AppColor.textWhite.withOpacity(0.8), + ), + ), + Text( + "Total: ${pointCard.totalPoints}", + style: AppStyle.xs.copyWith( + color: AppColor.textWhite.withOpacity(0.8), + ), + ), + ], + ), + ], + ), + ); + } + + Widget _buildMerchantSelection() { + return Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Select Merchant", + style: AppStyle.lg.copyWith( + fontWeight: FontWeight.w600, + color: AppColor.textPrimary, + ), + ), + SizedBox(height: 12), + Container( + height: 80, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: merchants.length, + itemBuilder: (context, index) { + final merchant = merchants[index]; + final isSelected = selectedMerchant?.id == merchant.id; + + return GestureDetector( + onTap: () => _onMerchantChanged(merchant), + child: Container( + width: 80, + margin: EdgeInsets.only(right: 12), + decoration: BoxDecoration( + color: isSelected ? AppColor.primary : AppColor.white, + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: isSelected ? AppColor.primary : AppColor.border, + width: 2, + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(merchant.logo, style: TextStyle(fontSize: 24)), + SizedBox(height: 4), + Text( + merchant.name, + style: AppStyle.xs.copyWith( + color: isSelected + ? AppColor.textWhite + : AppColor.textPrimary, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ); + }, + ), + ), + ], + ), + ); + } + + Widget _buildCategoryTabs() { + if (selectedMerchant == null) return SizedBox.shrink(); + + return Container( + color: AppColor.background, // Background untuk sticky header + padding: EdgeInsets.symmetric(vertical: 8), + child: Container( + height: 50, + child: ListView.builder( + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(horizontal: 16), + itemCount: selectedMerchant!.categories.length, + itemBuilder: (context, index) { + final category = selectedMerchant!.categories[index]; + final isActive = + activeCategoryId == + category.id; // Check if this category is active + + return GestureDetector( + onTap: () => _scrollToCategory(category.id), + child: Container( + margin: EdgeInsets.only(right: 12), + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), + decoration: BoxDecoration( + color: isActive + ? AppColor.primary + : AppColor.white, // Change background when active + borderRadius: BorderRadius.circular(25), + border: Border.all( + color: isActive + ? AppColor.primary + : AppColor.border, // Change border when active + width: 2, + ), + boxShadow: [ + BoxShadow( + color: AppColor.textLight.withOpacity(0.1), + blurRadius: 4, + offset: Offset(0, 2), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(category.icon, style: TextStyle(fontSize: 16)), + SizedBox(width: 6), + Text( + category.name, + style: AppStyle.sm.copyWith( + fontWeight: FontWeight.w500, + color: isActive + ? AppColor.textWhite + : AppColor + .textPrimary, // Change text color when active + ), + ), + ], + ), + ), + ); + }, + ), + ), + ); + } + + Widget _buildCategorySection(Category category) { + return Container( + key: categoryKeys[category.id], + margin: EdgeInsets.only(bottom: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Text(category.icon, style: TextStyle(fontSize: 20)), + SizedBox(width: 8), + Text( + category.name, + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.w600, + color: AppColor.textPrimary, + ), + ), + ], + ), + ), + SizedBox(height: 12), + // Fixed height yang lebih besar untuk menghindari overflow + Container( + height: 240, // Increased from 200 to 240 + child: ListView.builder( + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(horizontal: 16), + itemCount: category.products.length, + itemBuilder: (context, index) { + final product = category.products[index]; + return _buildProductCard(product); + }, + ), + ), + ], + ), + ); + } + + Widget _buildProductCard(Product product) { + final canRedeem = pointCard.availablePoints >= product.pointsRequired; + final pointsShortage = canRedeem + ? 0 + : product.pointsRequired - pointCard.availablePoints; + + return Container( + width: 160, + margin: EdgeInsets.only(right: 12), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + color: AppColor.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: AppColor.textLight.withOpacity(0.15), + blurRadius: 8, + offset: Offset(0, 4), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Product Image + Container( + height: 90, // Reduced from 100 to give more space below + width: double.infinity, + decoration: BoxDecoration( + color: AppColor.backgroundLight, + borderRadius: BorderRadius.vertical( + top: Radius.circular(16), + ), + ), + child: Stack( + children: [ + Center( + child: Text( + product.image, + style: TextStyle(fontSize: 36), // Reduced from 40 + ), + ), + if (product.isPopular) + Positioned( + top: 6, // Adjusted position + right: 6, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 6, // Reduced padding + vertical: 3, + ), + decoration: BoxDecoration( + color: AppColor.warning, + borderRadius: BorderRadius.circular(10), + ), + child: Text( + "Popular", + style: AppStyle.xs.copyWith( + color: AppColor.white, + fontWeight: FontWeight.w600, + fontSize: 10, // Smaller font + ), + ), + ), + ), + ], + ), + ), + + // Product Info - Made more flexible + Expanded( + child: Padding( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + product.name, + style: AppStyle.md.copyWith( + fontWeight: FontWeight.w600, + color: canRedeem + ? AppColor.textPrimary + : AppColor.textLight, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + SizedBox(height: 4), + Expanded( + child: Text( + product.description, + style: AppStyle.xs.copyWith( + color: canRedeem + ? AppColor.textSecondary + : AppColor.textLight, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.stars, + size: 14, // Reduced size + color: canRedeem + ? AppColor.warning + : AppColor.textLight, + ), + SizedBox(width: 4), + Expanded( + child: Text( + "${product.pointsRequired}", + style: AppStyle.sm.copyWith( + fontWeight: FontWeight.w600, + color: canRedeem + ? AppColor.primary + : AppColor.textLight, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + SizedBox(height: 8), + SizedBox( + width: double.infinity, + height: 32, // Reduced from 36 + child: ElevatedButton( + onPressed: canRedeem + ? () => _redeemProduct(product) + : null, + style: ElevatedButton.styleFrom( + backgroundColor: canRedeem + ? AppColor.primary + : AppColor.textLight, + foregroundColor: AppColor.white, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: FittedBox( + child: Text( + canRedeem ? "Redeem" : "Insufficient", + style: AppStyle.xs.copyWith( + // Changed to xs + fontWeight: FontWeight.w600, + color: AppColor.white, + ), + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + + // Overlay untuk insufficient points + if (!canRedeem) + Container( + decoration: BoxDecoration( + color: AppColor.textLight.withOpacity(0.7), + borderRadius: BorderRadius.circular(16), + ), + child: Center( + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 12, + vertical: 10, + ), // Reduced padding + decoration: BoxDecoration( + color: AppColor.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.lock_outline, + color: AppColor.textSecondary, + size: 20, // Reduced size + ), + SizedBox(height: 4), + Text( + "Need ${pointsShortage}", + style: AppStyle.xs.copyWith( + fontWeight: FontWeight.w600, + color: AppColor.textSecondary, + fontSize: 10, // Smaller font + ), + textAlign: TextAlign.center, + ), + Text( + "more points", + style: AppStyle.xs.copyWith( + color: AppColor.textSecondary, + fontSize: 10, // Smaller font + ), + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + ], + ), + ); + } + + void _redeemProduct(Product product) { + showDialog( + context: context, + builder: (context) => AlertDialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + title: Text( + "Redeem Product", + style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600), + ), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text(product.image, style: TextStyle(fontSize: 48)), + SizedBox(height: 12), + Text( + product.name, + style: AppStyle.md.copyWith(fontWeight: FontWeight.w600), + ), + SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.stars, color: AppColor.warning, size: 16), + SizedBox(width: 4), + Text( + "${product.pointsRequired} Points", + style: AppStyle.sm.copyWith( + fontWeight: FontWeight.w600, + color: AppColor.primary, + ), + ), + ], + ), + ], + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text( + "Cancel", + style: AppStyle.sm.copyWith(color: AppColor.textSecondary), + ), + ), + ElevatedButton( + onPressed: () { + Navigator.pop(context); + _showRedeemSuccess(product); + }, + style: ElevatedButton.styleFrom( + backgroundColor: AppColor.primary, + foregroundColor: AppColor.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: Text( + "Redeem", + style: AppStyle.sm.copyWith( + fontWeight: FontWeight.w600, + color: AppColor.white, + ), + ), + ), + ], + ), + ); + } + + void _showRedeemSuccess(Product product) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + "Successfully redeemed ${product.name}!", + style: AppStyle.sm.copyWith(color: AppColor.white), + ), + backgroundColor: AppColor.success, + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ); + } + + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } +} + +// Custom SliverPersistentHeaderDelegate untuk sticky category tabs +class _StickyHeaderDelegate extends SliverPersistentHeaderDelegate { + final Widget child; + final double height; + final String merchantId; // Add merchant ID to track changes + final String? activeCategoryId; // Add active category to track changes + + _StickyHeaderDelegate({ + required this.child, + required this.height, + required this.merchantId, // Track merchant changes + required this.activeCategoryId, // Track category changes + }); + + @override + Widget build( + BuildContext context, + double shrinkOffset, + bool overlapsContent, + ) { + return child; + } + + @override + double get maxExtent => height; + + @override + double get minExtent => height; + + @override + bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) { + // Always rebuild when merchant OR active category changes + if (oldDelegate is _StickyHeaderDelegate) { + bool merchantChanged = oldDelegate.merchantId != merchantId; + bool categoryChanged = oldDelegate.activeCategoryId != activeCategoryId; + + print( + "shouldRebuild - Merchant changed: $merchantChanged, Category changed: $categoryChanged", + ); + print( + "Old merchant: ${oldDelegate.merchantId}, New merchant: $merchantId", + ); + print( + "Old category: ${oldDelegate.activeCategoryId}, New category: $activeCategoryId", + ); + + return merchantChanged || categoryChanged; + } + return true; + } +} diff --git a/lib/presentation/router/app_router.dart b/lib/presentation/router/app_router.dart index b658ef3..83a0f1b 100644 --- a/lib/presentation/router/app_router.dart +++ b/lib/presentation/router/app_router.dart @@ -30,5 +30,8 @@ class AppRouter extends RootStackRouter { // Merchant AutoRoute(page: MerchantRoute.page), + + // Reward + AutoRoute(page: RewardRoute.page), ]; } diff --git a/lib/presentation/router/app_router.gr.dart b/lib/presentation/router/app_router.gr.dart index 481ba40..5fdefea 100644 --- a/lib/presentation/router/app_router.gr.dart +++ b/lib/presentation/router/app_router.gr.dart @@ -9,7 +9,7 @@ // coverage:ignore-file // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:auto_route/auto_route.dart' as _i13; +import 'package:auto_route/auto_route.dart' as _i14; import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2; import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i7; import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i8; @@ -23,22 +23,23 @@ import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart' import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart' as _i9; import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart' - as _i12; + as _i13; import 'package:enaklo/presentation/pages/merchant/merchant_page.dart' as _i4; import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart' as _i5; -import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i11; -import 'package:flutter/material.dart' as _i14; +import 'package:enaklo/presentation/pages/reward/reward_page.dart' as _i11; +import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i12; +import 'package:flutter/material.dart' as _i15; /// generated route for /// [_i1.HomePage] -class HomeRoute extends _i13.PageRouteInfo { - const HomeRoute({List<_i13.PageRouteInfo>? children}) +class HomeRoute extends _i14.PageRouteInfo { + const HomeRoute({List<_i14.PageRouteInfo>? children}) : super(HomeRoute.name, initialChildren: children); static const String name = 'HomeRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i1.HomePage(); @@ -48,13 +49,13 @@ class HomeRoute extends _i13.PageRouteInfo { /// generated route for /// [_i2.LoginPage] -class LoginRoute extends _i13.PageRouteInfo { - const LoginRoute({List<_i13.PageRouteInfo>? children}) +class LoginRoute extends _i14.PageRouteInfo { + const LoginRoute({List<_i14.PageRouteInfo>? children}) : super(LoginRoute.name, initialChildren: children); static const String name = 'LoginRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i2.LoginPage(); @@ -64,13 +65,13 @@ class LoginRoute extends _i13.PageRouteInfo { /// generated route for /// [_i3.MainPage] -class MainRoute extends _i13.PageRouteInfo { - const MainRoute({List<_i13.PageRouteInfo>? children}) +class MainRoute extends _i14.PageRouteInfo { + const MainRoute({List<_i14.PageRouteInfo>? children}) : super(MainRoute.name, initialChildren: children); static const String name = 'MainRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i3.MainPage(); @@ -80,13 +81,13 @@ class MainRoute extends _i13.PageRouteInfo { /// generated route for /// [_i4.MerchantPage] -class MerchantRoute extends _i13.PageRouteInfo { - const MerchantRoute({List<_i13.PageRouteInfo>? children}) +class MerchantRoute extends _i14.PageRouteInfo { + const MerchantRoute({List<_i14.PageRouteInfo>? children}) : super(MerchantRoute.name, initialChildren: children); static const String name = 'MerchantRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i4.MerchantPage(); @@ -96,13 +97,13 @@ class MerchantRoute extends _i13.PageRouteInfo { /// generated route for /// [_i5.OnboardingPage] -class OnboardingRoute extends _i13.PageRouteInfo { - const OnboardingRoute({List<_i13.PageRouteInfo>? children}) +class OnboardingRoute extends _i14.PageRouteInfo { + const OnboardingRoute({List<_i14.PageRouteInfo>? children}) : super(OnboardingRoute.name, initialChildren: children); static const String name = 'OnboardingRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i5.OnboardingPage(); @@ -112,13 +113,13 @@ class OnboardingRoute extends _i13.PageRouteInfo { /// generated route for /// [_i6.OrderPage] -class OrderRoute extends _i13.PageRouteInfo { - const OrderRoute({List<_i13.PageRouteInfo>? children}) +class OrderRoute extends _i14.PageRouteInfo { + const OrderRoute({List<_i14.PageRouteInfo>? children}) : super(OrderRoute.name, initialChildren: children); static const String name = 'OrderRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i6.OrderPage(); @@ -128,13 +129,13 @@ class OrderRoute extends _i13.PageRouteInfo { /// generated route for /// [_i7.OtpPage] -class OtpRoute extends _i13.PageRouteInfo { - const OtpRoute({List<_i13.PageRouteInfo>? children}) +class OtpRoute extends _i14.PageRouteInfo { + const OtpRoute({List<_i14.PageRouteInfo>? children}) : super(OtpRoute.name, initialChildren: children); static const String name = 'OtpRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i7.OtpPage(); @@ -144,12 +145,12 @@ class OtpRoute extends _i13.PageRouteInfo { /// generated route for /// [_i8.PinPage] -class PinRoute extends _i13.PageRouteInfo { +class PinRoute extends _i14.PageRouteInfo { PinRoute({ - _i14.Key? key, + _i15.Key? key, bool isCreatePin = true, String? title, - List<_i13.PageRouteInfo>? children, + List<_i14.PageRouteInfo>? children, }) : super( PinRoute.name, args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title), @@ -158,7 +159,7 @@ class PinRoute extends _i13.PageRouteInfo { static const String name = 'PinRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { final args = data.argsAs( @@ -176,7 +177,7 @@ class PinRoute extends _i13.PageRouteInfo { class PinRouteArgs { const PinRouteArgs({this.key, this.isCreatePin = true, this.title}); - final _i14.Key? key; + final _i15.Key? key; final bool isCreatePin; @@ -190,13 +191,13 @@ class PinRouteArgs { /// generated route for /// [_i9.ProfilePage] -class ProfileRoute extends _i13.PageRouteInfo { - const ProfileRoute({List<_i13.PageRouteInfo>? children}) +class ProfileRoute extends _i14.PageRouteInfo { + const ProfileRoute({List<_i14.PageRouteInfo>? children}) : super(ProfileRoute.name, initialChildren: children); static const String name = 'ProfileRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i9.ProfilePage(); @@ -206,13 +207,13 @@ class ProfileRoute extends _i13.PageRouteInfo { /// generated route for /// [_i10.RegisterPage] -class RegisterRoute extends _i13.PageRouteInfo { - const RegisterRoute({List<_i13.PageRouteInfo>? children}) +class RegisterRoute extends _i14.PageRouteInfo { + const RegisterRoute({List<_i14.PageRouteInfo>? children}) : super(RegisterRoute.name, initialChildren: children); static const String name = 'RegisterRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { return const _i10.RegisterPage(); @@ -221,33 +222,49 @@ class RegisterRoute extends _i13.PageRouteInfo { } /// generated route for -/// [_i11.SplashPage] -class SplashRoute extends _i13.PageRouteInfo { - const SplashRoute({List<_i13.PageRouteInfo>? children}) - : super(SplashRoute.name, initialChildren: children); +/// [_i11.RewardPage] +class RewardRoute extends _i14.PageRouteInfo { + const RewardRoute({List<_i14.PageRouteInfo>? children}) + : super(RewardRoute.name, initialChildren: children); - static const String name = 'SplashRoute'; + static const String name = 'RewardRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { - return const _i11.SplashPage(); + return const _i11.RewardPage(); }, ); } /// generated route for -/// [_i12.VoucherPage] -class VoucherRoute extends _i13.PageRouteInfo { - const VoucherRoute({List<_i13.PageRouteInfo>? children}) +/// [_i12.SplashPage] +class SplashRoute extends _i14.PageRouteInfo { + const SplashRoute({List<_i14.PageRouteInfo>? children}) + : super(SplashRoute.name, initialChildren: children); + + static const String name = 'SplashRoute'; + + static _i14.PageInfo page = _i14.PageInfo( + name, + builder: (data) { + return const _i12.SplashPage(); + }, + ); +} + +/// generated route for +/// [_i13.VoucherPage] +class VoucherRoute extends _i14.PageRouteInfo { + const VoucherRoute({List<_i14.PageRouteInfo>? children}) : super(VoucherRoute.name, initialChildren: children); static const String name = 'VoucherRoute'; - static _i13.PageInfo page = _i13.PageInfo( + static _i14.PageInfo page = _i14.PageInfo( name, builder: (data) { - return const _i12.VoucherPage(); + return const _i13.VoucherPage(); }, ); }