feat: integrate enakgame and voucher
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
This commit is contained in:
@@ -21,11 +21,11 @@ class _MainPageState extends State<MainPage> {
|
||||
context.read<AuthBloc>().add(const AuthEvent.fetchCurrentUser());
|
||||
}
|
||||
|
||||
/// Kode bayar di kasir; PIN diminta di halamannya sendiri.
|
||||
void _openPay() {
|
||||
/// Beranda EnakPoint & EnakCoin: tukar, transfer, game, dan voucher.
|
||||
void _openWallet() {
|
||||
final isAuthenticated = context.read<AuthBloc>().state.isAuthenticated;
|
||||
context.router.push(
|
||||
isAuthenticated ? const PaymentCodeRoute() : const OnboardingRoute(),
|
||||
isAuthenticated ? const WalletRoute() : const OnboardingRoute(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ class _MainPageState extends State<MainPage> {
|
||||
body: child,
|
||||
floatingActionButton: isKeyboardOpen
|
||||
? null
|
||||
: MainPayButton(onPressed: _openPay),
|
||||
floatingActionButtonLocation: const MainPayButtonLocation(),
|
||||
: MainWalletButton(onPressed: _openWallet),
|
||||
floatingActionButtonLocation: const MainWalletButtonLocation(),
|
||||
bottomNavigationBar: MainBottomNavbar(
|
||||
tabsRouter: AutoTabsRouter.of(context),
|
||||
onPayTap: _openPay,
|
||||
onWalletTap: _openWallet,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -44,7 +44,7 @@ class HomePointCard extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
isAuthenticated
|
||||
? 'Bayar di kasir, tukar, transfer & main game'
|
||||
? 'Tukar voucher, transfer & main game'
|
||||
: 'Silahkan login untuk melihat EnakPoint kamu',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../../common/constant/app_constant.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../components/assets/assets.gen.dart';
|
||||
import '../../../../../components/toast/flushbar.dart';
|
||||
@@ -38,12 +37,8 @@ class HomeServiceSection extends StatelessWidget {
|
||||
_HomeMenu(
|
||||
label: 'EnakGame',
|
||||
icon: Assets.icons.enakgameIcon,
|
||||
route: WebViewRoute(
|
||||
title: 'EnakGame',
|
||||
url: AppConstant.gameUrl,
|
||||
fullscreen: true,
|
||||
backgroundColor: AppConstant.gameBackgroundColor,
|
||||
),
|
||||
route: const EnakGameRoute(),
|
||||
requiresLogin: true,
|
||||
),
|
||||
_HomeMenu(
|
||||
label: 'EnakTransfer',
|
||||
@@ -55,6 +50,7 @@ class HomeServiceSection extends StatelessWidget {
|
||||
label: 'EnakReward',
|
||||
icon: Assets.icons.enakrewardIcon,
|
||||
route: const RewardRoute(),
|
||||
requiresLogin: true,
|
||||
),
|
||||
_HomeMenu(
|
||||
label: 'EnakPromo',
|
||||
|
||||
@@ -5,29 +5,29 @@ import '../../../../common/theme/theme.dart';
|
||||
|
||||
class MainBottomNavbar extends StatelessWidget {
|
||||
final TabsRouter tabsRouter;
|
||||
final VoidCallback onPayTap;
|
||||
final VoidCallback onWalletTap;
|
||||
const MainBottomNavbar({
|
||||
super.key,
|
||||
required this.tabsRouter,
|
||||
required this.onPayTap,
|
||||
required this.onWalletTap,
|
||||
});
|
||||
|
||||
/// Slot tengah hanya tempat label tombol Bayar; lingkarannya
|
||||
/// [MainPayButton] yang menempel di atas navbar.
|
||||
static const int _payIndex = 2;
|
||||
/// Slot tengah hanya tempat label tombol Poin; lingkarannya
|
||||
/// [MainWalletButton] yang menempel di atas navbar.
|
||||
static const int _walletIndex = 2;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final activeIndex = tabsRouter.activeIndex;
|
||||
|
||||
return BottomNavigationBar(
|
||||
currentIndex: activeIndex >= _payIndex ? activeIndex + 1 : activeIndex,
|
||||
currentIndex: activeIndex >= _walletIndex ? activeIndex + 1 : activeIndex,
|
||||
onTap: (index) {
|
||||
if (index == _payIndex) {
|
||||
onPayTap();
|
||||
if (index == _walletIndex) {
|
||||
onWalletTap();
|
||||
return;
|
||||
}
|
||||
tabsRouter.setActiveIndex(index > _payIndex ? index - 1 : index);
|
||||
tabsRouter.setActiveIndex(index > _walletIndex ? index - 1 : index);
|
||||
},
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
@@ -47,8 +47,8 @@ class MainBottomNavbar extends StatelessWidget {
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: SizedBox(height: 24),
|
||||
label: 'Bayar',
|
||||
tooltip: 'Bayar di kasir',
|
||||
label: 'Poin',
|
||||
tooltip: 'EnakPoint & EnakCoin',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.groups),
|
||||
@@ -66,10 +66,10 @@ class MainBottomNavbar extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Seperti [FloatingActionButtonLocation.centerDocked], tapi tombolnya lebih
|
||||
/// menonjol ke atas supaya tidak menempel ke label "Bayar".
|
||||
class MainPayButtonLocation extends StandardFabLocation
|
||||
/// menonjol ke atas supaya tidak menempel ke label "Poin".
|
||||
class MainWalletButtonLocation extends StandardFabLocation
|
||||
with FabCenterOffsetX, FabDockedOffsetY {
|
||||
const MainPayButtonLocation();
|
||||
const MainWalletButtonLocation();
|
||||
|
||||
static const double _raise = 10;
|
||||
|
||||
@@ -80,10 +80,10 @@ class MainPayButtonLocation extends StandardFabLocation
|
||||
) => super.getOffsetY(scaffoldGeometry, adjustment) - _raise;
|
||||
}
|
||||
|
||||
/// Tombol bulat di tengah navbar, dipasang di [MainPayButtonLocation].
|
||||
class MainPayButton extends StatelessWidget {
|
||||
/// Tombol bulat di tengah navbar, dipasang di [MainWalletButtonLocation].
|
||||
class MainWalletButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
const MainPayButton({super.key, required this.onPressed});
|
||||
const MainWalletButton({super.key, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -92,12 +92,12 @@ class MainPayButton extends StatelessWidget {
|
||||
// Halaman tab (mis. Community) juga punya FAB; tanpa hero supaya tag
|
||||
// default tidak bentrok saat pindah halaman.
|
||||
heroTag: null,
|
||||
tooltip: 'Bayar di kasir',
|
||||
tooltip: 'EnakPoint & EnakCoin',
|
||||
elevation: 4,
|
||||
backgroundColor: AppColor.primary,
|
||||
foregroundColor: AppColor.white,
|
||||
shape: const CircleBorder(),
|
||||
child: const Icon(Icons.qr_code_scanner_rounded, size: 28),
|
||||
child: const Icon(Icons.stars_rounded, size: 30),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user