From 30a2bece412f841a69c719dbac129d1a520421d5 Mon Sep 17 00:00:00 2001 From: efrilm Date: Fri, 29 Aug 2025 19:14:47 +0700 Subject: [PATCH] feat: reward -> poin --- lib/common/theme/theme.dart | 13 + .../pages/home/widgets/feature_section.dart | 2 +- .../main/pages/home/widgets/point_card.dart | 245 +++++++++--------- .../product_redeem/product_redeem_page.dart | 2 +- .../reward_page.dart => poin/poin_page.dart} | 17 +- lib/presentation/router/app_router.dart | 4 +- lib/presentation/router/app_router.gr.dart | 66 ++--- 7 files changed, 180 insertions(+), 169 deletions(-) rename lib/presentation/pages/{reward => poin}/pages/product_redeem/product_redeem_page.dart (99%) rename lib/presentation/pages/{reward/reward_page.dart => poin/poin_page.dart} (98%) diff --git a/lib/common/theme/theme.dart b/lib/common/theme/theme.dart index d1f6f19..325e8df 100644 --- a/lib/common/theme/theme.dart +++ b/lib/common/theme/theme.dart @@ -16,6 +16,19 @@ class ThemeApp { fontFamily: FontFamily.quicksand, primaryColor: AppColor.primary, scaffoldBackgroundColor: AppColor.white, + textTheme: TextTheme( + bodySmall: AppStyle.xs, + bodyMedium: AppStyle.md, + bodyLarge: AppStyle.lg, + labelSmall: AppStyle.sm, + labelLarge: AppStyle.xl, + headlineSmall: AppStyle.h6, + headlineMedium: AppStyle.h5, + headlineLarge: AppStyle.h4, + displaySmall: AppStyle.h3, + displayMedium: AppStyle.h2, + displayLarge: AppStyle.h1, + ), appBarTheme: AppBarTheme( backgroundColor: AppColor.white, foregroundColor: AppColor.textPrimary, 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 cce9dd5..574b88b 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: () => context.router.push(RewardRoute()), + onTap: () {}, ), HomeFeatureCard( icon: Icons.casino, diff --git a/lib/presentation/pages/main/pages/home/widgets/point_card.dart b/lib/presentation/pages/main/pages/home/widgets/point_card.dart index b7cd9d1..04cfad2 100644 --- a/lib/presentation/pages/main/pages/home/widgets/point_card.dart +++ b/lib/presentation/pages/main/pages/home/widgets/point_card.dart @@ -1,139 +1,144 @@ +import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import '../../../../../../common/theme/theme.dart'; +import '../../../../../router/app_router.gr.dart'; class HomePointCard extends StatelessWidget { const HomePointCard({super.key}); @override Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - color: AppColor.white, - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: AppColor.textLight.withOpacity(0.15), - spreadRadius: 0, - blurRadius: 20, - offset: const Offset(0, 8), - ), - ], - ), - child: Stack( - children: [ - _buildCoinPattern(), - Padding( - padding: const EdgeInsets.all(16), - child: Column( - children: [ - Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 10, - ), - decoration: BoxDecoration( - color: AppColor.primary, - borderRadius: BorderRadius.circular(25), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - Icons.stars, - color: AppColor.white, - size: 18, - ), - SizedBox(width: 8), - Text( - '148 Poin', - style: AppStyle.md.copyWith( - color: AppColor.white, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - ), - const SizedBox(height: 4), - Text( - 'Kamu punya 148 poin', - style: AppStyle.sm.copyWith( - color: AppColor.textSecondary, - fontSize: 11, - ), - ), - ], - ), - const Spacer(), - SizedBox( - width: 120, - height: 40, - child: Stack( + return GestureDetector( + onTap: () => context.router.push(PoinRoute()), + child: Container( + decoration: BoxDecoration( + color: AppColor.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: AppColor.textLight.withOpacity(0.15), + spreadRadius: 0, + blurRadius: 20, + offset: const Offset(0, 8), + ), + ], + ), + child: Stack( + children: [ + _buildCoinPattern(), + Padding( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildCoin( - right: 0, - top: 0, - size: 24, - color: Colors.amber, + Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), + decoration: BoxDecoration( + color: AppColor.primary, + borderRadius: BorderRadius.circular(25), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.stars, + color: AppColor.white, + size: 18, + ), + SizedBox(width: 8), + Text( + '148 Poin', + style: AppStyle.md.copyWith( + color: AppColor.white, + fontWeight: FontWeight.w600, + ), + ), + ], + ), ), - _buildCoin( - right: 20, - top: 8, - size: 20, - color: Colors.orange, - ), - _buildCoin( - right: 40, - top: 4, - size: 18, - color: Colors.amber, - ), - _buildCoin( - right: 60, - top: 12, - size: 16, - color: Colors.orange, - ), - _buildCoin( - right: 80, - top: 8, - size: 14, - color: Colors.amber, + const SizedBox(height: 4), + Text( + 'Kamu punya 148 poin', + style: AppStyle.sm.copyWith( + color: AppColor.textSecondary, + fontSize: 11, + ), ), ], ), - ), - ], - ), - const SizedBox(height: 12), - Row( - children: [ - Text( - 'Tukarkan poinmu dengan hadiah menarik', - style: AppStyle.sm.copyWith( - color: AppColor.textPrimary, - fontSize: 13, - fontWeight: FontWeight.w500, + const Spacer(), + SizedBox( + width: 120, + height: 40, + child: Stack( + children: [ + _buildCoin( + right: 0, + top: 0, + size: 24, + color: Colors.amber, + ), + _buildCoin( + right: 20, + top: 8, + size: 20, + color: Colors.orange, + ), + _buildCoin( + right: 40, + top: 4, + size: 18, + color: Colors.amber, + ), + _buildCoin( + right: 60, + top: 12, + size: 16, + color: Colors.orange, + ), + _buildCoin( + right: 80, + top: 8, + size: 14, + color: Colors.amber, + ), + ], + ), ), - ), - const Spacer(), - Icon( - Icons.arrow_forward_ios, - color: AppColor.textSecondary, - size: 16, - ), - ], - ), - ], + ], + ), + const SizedBox(height: 12), + Row( + children: [ + Text( + 'Tukarkan poinmu dengan hadiah menarik', + style: AppStyle.sm.copyWith( + color: AppColor.textPrimary, + fontSize: 13, + fontWeight: FontWeight.w500, + ), + ), + const Spacer(), + Icon( + Icons.arrow_forward_ios, + color: AppColor.textSecondary, + size: 16, + ), + ], + ), + ], + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart b/lib/presentation/pages/poin/pages/product_redeem/product_redeem_page.dart similarity index 99% rename from lib/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart rename to lib/presentation/pages/poin/pages/product_redeem/product_redeem_page.dart index 6bb09bb..7e3c08e 100644 --- a/lib/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart +++ b/lib/presentation/pages/poin/pages/product_redeem/product_redeem_page.dart @@ -2,7 +2,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import '../../../../../common/theme/theme.dart'; -import '../../reward_page.dart'; +import '../../poin_page.dart'; @RoutePage() class ProductRedeemPage extends StatefulWidget { diff --git a/lib/presentation/pages/reward/reward_page.dart b/lib/presentation/pages/poin/poin_page.dart similarity index 98% rename from lib/presentation/pages/reward/reward_page.dart rename to lib/presentation/pages/poin/poin_page.dart index 02cfef2..8a1c45b 100644 --- a/lib/presentation/pages/reward/reward_page.dart +++ b/lib/presentation/pages/poin/poin_page.dart @@ -72,14 +72,14 @@ class Product { } @RoutePage() -class RewardPage extends StatefulWidget { - const RewardPage({super.key}); +class PoinPage extends StatefulWidget { + const PoinPage({super.key}); @override - State createState() => _RewardPageState(); + State createState() => _PoinPageState(); } -class _RewardPageState extends State { +class _PoinPageState extends State { final ScrollController _scrollController = ScrollController(); // Sample data @@ -299,14 +299,7 @@ class _RewardPageState extends State { // Sticky AppBar SliverAppBar( elevation: 0, - backgroundColor: AppColor.white, - title: Text( - "Rewards", - style: AppStyle.h5.copyWith( - fontWeight: FontWeight.w600, - color: AppColor.textPrimary, - ), - ), + title: Text("Poin"), centerTitle: true, floating: false, pinned: true, // Made sticky diff --git a/lib/presentation/router/app_router.dart b/lib/presentation/router/app_router.dart index 8dfec6b..479a485 100644 --- a/lib/presentation/router/app_router.dart +++ b/lib/presentation/router/app_router.dart @@ -34,8 +34,8 @@ class AppRouter extends RootStackRouter { AutoRoute(page: MerchantRoute.page), AutoRoute(page: MerchantDetailRoute.page), - // Reward - AutoRoute(page: RewardRoute.page), + // Point + AutoRoute(page: PoinRoute.page), AutoRoute(page: ProductRedeemRoute.page), // Draw diff --git a/lib/presentation/router/app_router.gr.dart b/lib/presentation/router/app_router.gr.dart index 41872cf..95cbfe3 100644 --- a/lib/presentation/router/app_router.gr.dart +++ b/lib/presentation/router/app_router.gr.dart @@ -18,7 +18,7 @@ import 'package:enaklo/presentation/pages/auth/password/password_page.dart' as _i14; import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i15; import 'package:enaklo/presentation/pages/auth/register/register_page.dart' - as _i18; + as _i19; import 'package:enaklo/presentation/pages/draw/draw_page.dart' as _i3; import 'package:enaklo/presentation/pages/draw/pages/draw_detail/draw_detail_page.dart' as _i2; @@ -28,7 +28,7 @@ import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart' import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart' as _i12; import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart' - as _i17; + as _i18; import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart' as _i22; import 'package:enaklo/presentation/pages/merchant/merchant_page.dart' as _i8; @@ -40,9 +40,9 @@ import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart' as _i10; import 'package:enaklo/presentation/pages/order/order_detail/order_detail_page.dart' as _i11; -import 'package:enaklo/presentation/pages/reward/pages/product_redeem/product_redeem_page.dart' - as _i16; -import 'package:enaklo/presentation/pages/reward/reward_page.dart' as _i19; +import 'package:enaklo/presentation/pages/poin/pages/product_redeem/product_redeem_page.dart' + as _i17; +import 'package:enaklo/presentation/pages/poin/poin_page.dart' as _i16; import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i20; import 'package:enaklo/presentation/pages/voucher/voucher_detail/voucher_detail_page.dart' as _i21; @@ -382,13 +382,29 @@ class PinRouteArgs { } /// generated route for -/// [_i16.ProductRedeemPage] +/// [_i16.PoinPage] +class PoinRoute extends _i23.PageRouteInfo { + const PoinRoute({List<_i23.PageRouteInfo>? children}) + : super(PoinRoute.name, initialChildren: children); + + static const String name = 'PoinRoute'; + + static _i23.PageInfo page = _i23.PageInfo( + name, + builder: (data) { + return const _i16.PoinPage(); + }, + ); +} + +/// generated route for +/// [_i17.ProductRedeemPage] class ProductRedeemRoute extends _i23.PageRouteInfo { ProductRedeemRoute({ _i24.Key? key, - required _i19.Product product, - required _i19.Merchant merchant, - required _i19.PointCard pointCard, + required _i16.Product product, + required _i16.Merchant merchant, + required _i16.PointCard pointCard, List<_i23.PageRouteInfo>? children, }) : super( ProductRedeemRoute.name, @@ -407,7 +423,7 @@ class ProductRedeemRoute extends _i23.PageRouteInfo { name, builder: (data) { final args = data.argsAs(); - return _i16.ProductRedeemPage( + return _i17.ProductRedeemPage( key: args.key, product: args.product, merchant: args.merchant, @@ -427,11 +443,11 @@ class ProductRedeemRouteArgs { final _i24.Key? key; - final _i19.Product product; + final _i16.Product product; - final _i19.Merchant merchant; + final _i16.Merchant merchant; - final _i19.PointCard pointCard; + final _i16.PointCard pointCard; @override String toString() { @@ -440,7 +456,7 @@ class ProductRedeemRouteArgs { } /// generated route for -/// [_i17.ProfilePage] +/// [_i18.ProfilePage] class ProfileRoute extends _i23.PageRouteInfo { const ProfileRoute({List<_i23.PageRouteInfo>? children}) : super(ProfileRoute.name, initialChildren: children); @@ -450,13 +466,13 @@ class ProfileRoute extends _i23.PageRouteInfo { static _i23.PageInfo page = _i23.PageInfo( name, builder: (data) { - return const _i17.ProfilePage(); + return const _i18.ProfilePage(); }, ); } /// generated route for -/// [_i18.RegisterPage] +/// [_i19.RegisterPage] class RegisterRoute extends _i23.PageRouteInfo { const RegisterRoute({List<_i23.PageRouteInfo>? children}) : super(RegisterRoute.name, initialChildren: children); @@ -466,23 +482,7 @@ class RegisterRoute extends _i23.PageRouteInfo { static _i23.PageInfo page = _i23.PageInfo( name, builder: (data) { - return const _i18.RegisterPage(); - }, - ); -} - -/// generated route for -/// [_i19.RewardPage] -class RewardRoute extends _i23.PageRouteInfo { - const RewardRoute({List<_i23.PageRouteInfo>? children}) - : super(RewardRoute.name, initialChildren: children); - - static const String name = 'RewardRoute'; - - static _i23.PageInfo page = _i23.PageInfo( - name, - builder: (data) { - return const _i19.RewardPage(); + return const _i19.RegisterPage(); }, ); }