fix: payment page

This commit is contained in:
efrilm 2025-08-06 13:51:49 +07:00
parent f067417ab2
commit 20f8d5788c

View File

@ -31,6 +31,13 @@ class _PaymentPageState extends State<PaymentPage> {
final int uangPas2 = 50000;
final int uangPas3 = 100000;
List<OrderItem> getOrderItemPending() {
final itemPending = widget.order.orderItems
?.where((item) => item.status == "pending")
.toList();
return itemPending ?? [];
}
@override
void initState() {
super.initState();
@ -100,7 +107,7 @@ class _PaymentPageState extends State<PaymentPage> {
final items = order.orderItems ?? [];
return Card(
elevation: 4,
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
color: AppColors.white,
child: Padding(
@ -131,11 +138,11 @@ class _PaymentPageState extends State<PaymentPage> {
? const Center(child: Text('Tidak ada item'))
: ListView.separated(
shrinkWrap: true,
itemCount: items.length,
itemCount: getOrderItemPending().length,
separatorBuilder: (_, __) =>
Divider(color: AppColors.grey.withOpacity(0.5)),
itemBuilder: (context, index) {
final item = items[index];
final item = getOrderItemPending()[index];
return ListTile(
contentPadding: EdgeInsets.zero,
title: Text(item.productName ?? '-'),
@ -186,7 +193,7 @@ class _PaymentPageState extends State<PaymentPage> {
Widget _buildPaymentForm(int totalAmount) {
return Card(
elevation: 4,
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
color: AppColors.white,
child: Padding(