feat: button continue payment validation

This commit is contained in:
efrilm 2025-08-03 21:37:56 +07:00
parent afc030f13f
commit 8f3a19670b

View File

@ -1,4 +1,5 @@
// 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/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';
@ -491,22 +492,64 @@ class _HomePageState extends State<HomePage> {
],
),
SpaceHeight(16.0),
Align(
alignment: Alignment.bottomCenter,
child: Expanded(
child: Button.filled(
borderRadius: 12,
elevation: 1,
onPressed: () {
context.push(ConfirmPaymentPage(
isTable:
widget.table == null ? false : true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran',
),
),
BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
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',
),
),
),
loaded: (items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) =>
Align(
alignment: Alignment.bottomCenter,
child: Expanded(
child: Button.filled(
borderRadius: 12,
elevation: 1,
disabled: items.isEmpty,
onPressed: () {
if (orderType.name == 'dineIn') {
AppFlushbar.showError(context,
'Mohon pilih meja terlebih dahulu');
return;
}
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false
: true,
table: widget.table,
));
},
label: 'Lanjutkan Pembayaran ',
),
),
),
);
},
),
],
),