fix: bug prod

This commit is contained in:
efrilm 2025-08-04 15:39:11 +07:00
parent a63328d953
commit 04e1edbe79

View File

@ -1,7 +1,6 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:enaklo_pos/core/components/flushbar.dart';
import 'package:enaklo_pos/presentation/home/bloc/current_outlet/current_outlet_bloc.dart';
import 'package:enaklo_pos/presentation/home/bloc/outlet_loader/outlet_loader_bloc.dart';
import 'package:enaklo_pos/presentation/home/bloc/product_loader/product_loader_bloc.dart';
import 'package:enaklo_pos/presentation/home/widgets/home_right_title.dart';
import 'package:flutter/material.dart';
@ -355,49 +354,40 @@ class _HomePageState extends State<HomePage> {
),
),
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16.0).copyWith(top: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
);
}
return ListView.separated(
shrinkWrap: true,
physics:
const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) =>
OrderMenu(data: products[index]),
separatorBuilder: (context, index) =>
const SpaceHeight(1.0),
itemCount: products.length,
);
},
);
},
child: BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const Center(
child: Text('No Items'),
),
const SpaceHeight(8.0),
],
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
);
}
return ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: 16),
itemBuilder: (context, index) =>
OrderMenu(data: products[index]),
separatorBuilder: (context, index) =>
const SpaceHeight(1.0),
itemCount: products.length,
);
},
);
},
),
),
Padding(
@ -498,21 +488,19 @@ class _HomePageState extends State<HomePage> {
return state.maybeWhen(
orElse: () => Align(
alignment: Alignment.bottomCenter,
child: Expanded(
child: Button.filled(
borderRadius: 12,
elevation: 1,
disabled: true,
onPressed: () {
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false
: true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran',
),
child: Button.filled(
borderRadius: 12,
elevation: 1,
disabled: true,
onPressed: () {
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false
: true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran',
),
),
loaded: (items,
@ -527,27 +515,25 @@ class _HomePageState extends State<HomePage> {
orderType) =>
Align(
alignment: Alignment.bottomCenter,
child: Expanded(
child: Button.filled(
borderRadius: 12,
elevation: 1,
disabled: items.isEmpty,
onPressed: () {
if (orderType.name == 'dineIn' &&
widget.table == null) {
AppFlushbar.showError(context,
'Mohon pilih meja terlebih dahulu');
return;
}
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false
: true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran',
),
child: Button.filled(
borderRadius: 12,
elevation: 1,
disabled: items.isEmpty,
onPressed: () {
if (orderType.name == 'dineIn' &&
widget.table == null) {
AppFlushbar.showError(context,
'Mohon pilih meja terlebih dahulu');
return;
}
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false
: true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran',
),
),
);