Tab Community, tombol Bayar di navbar, logo placeholder, fix crash PIN

- Bottom navbar: Home, Pesanan, Bayar (tombol tengah ke kode bayar),
  Community, Profil; menu EnakCommunity di beranda pindah ke tab
- Image placeholder: logo Enaklo diperbesar, ilustrasi gelas dihapus
- Fix assertion Navigator saat PIN gagal karena error non-PIN: flushbar
  kini tampil lewat onFailure setelah sheet PIN tertutup (bayar, tukar,
  transfer)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-10-01 02:05:49 +07:00
co-authored by Claude Opus 5.5
parent f5e3075205
commit bc751246d8
11 changed files with 151 additions and 144 deletions
@@ -1,16 +1,33 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import '../../../../common/theme/theme.dart';
class MainBottomNavbar extends StatelessWidget {
final TabsRouter tabsRouter;
const MainBottomNavbar({super.key, required this.tabsRouter});
final VoidCallback onPayTap;
const MainBottomNavbar({
super.key,
required this.tabsRouter,
required this.onPayTap,
});
/// Slot tengah hanya tempat label tombol Bayar; lingkarannya
/// [MainPayButton] yang menempel di atas navbar.
static const int _payIndex = 2;
@override
Widget build(BuildContext context) {
final activeIndex = tabsRouter.activeIndex;
return BottomNavigationBar(
currentIndex: tabsRouter.activeIndex,
currentIndex: activeIndex >= _payIndex ? activeIndex + 1 : activeIndex,
onTap: (index) {
tabsRouter.setActiveIndex(index);
if (index == _payIndex) {
onPayTap();
return;
}
tabsRouter.setActiveIndex(index > _payIndex ? index - 1 : index);
},
items: const [
BottomNavigationBarItem(
@@ -28,6 +45,16 @@ class MainBottomNavbar extends StatelessWidget {
label: 'Pesanan',
tooltip: 'Pesanan',
),
BottomNavigationBarItem(
icon: SizedBox(height: 24),
label: 'Bayar',
tooltip: 'Bayar di kasir',
),
BottomNavigationBarItem(
icon: Icon(Icons.groups),
label: 'Community',
tooltip: 'Community',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profil',
@@ -37,3 +64,40 @@ class MainBottomNavbar extends StatelessWidget {
);
}
}
/// Seperti [FloatingActionButtonLocation.centerDocked], tapi tombolnya lebih
/// menonjol ke atas supaya tidak menempel ke label "Bayar".
class MainPayButtonLocation extends StandardFabLocation
with FabCenterOffsetX, FabDockedOffsetY {
const MainPayButtonLocation();
static const double _raise = 10;
@override
double getOffsetY(
ScaffoldPrelayoutGeometry scaffoldGeometry,
double adjustment,
) => super.getOffsetY(scaffoldGeometry, adjustment) - _raise;
}
/// Tombol bulat di tengah navbar, dipasang di [MainPayButtonLocation].
class MainPayButton extends StatelessWidget {
final VoidCallback onPressed;
const MainPayButton({super.key, required this.onPressed});
@override
Widget build(BuildContext context) {
return FloatingActionButton(
onPressed: onPressed,
// Halaman tab (mis. Community) juga punya FAB; tanpa hero supaya tag
// default tidak bentrok saat pindah halaman.
heroTag: null,
tooltip: 'Bayar di kasir',
elevation: 4,
backgroundColor: AppColor.primary,
foregroundColor: AppColor.white,
shape: const CircleBorder(),
child: const Icon(Icons.qr_code_scanner_rounded, size: 28),
);
}
}