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 // 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/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/bloc/product_loader/product_loader_bloc.dart';
import 'package:enaklo_pos/presentation/home/widgets/home_right_title.dart'; import 'package:enaklo_pos/presentation/home/widgets/home_right_title.dart';
@ -491,22 +492,64 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
SpaceHeight(16.0), SpaceHeight(16.0),
Align( BlocBuilder<CheckoutBloc, CheckoutState>(
alignment: Alignment.bottomCenter, builder: (context, state) {
child: Expanded( return state.maybeWhen(
child: Button.filled( orElse: () => Align(
borderRadius: 12, alignment: Alignment.bottomCenter,
elevation: 1, child: Expanded(
onPressed: () { child: Button.filled(
context.push(ConfirmPaymentPage( borderRadius: 12,
isTable: elevation: 1,
widget.table == null ? false : true, disabled: true,
table: widget.table, onPressed: () {
)); context.push(ConfirmPaymentPage(
}, isTable: widget.table == null
label: 'Lanjutkan Pembayaran', ? 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 ',
),
),
),
);
},
), ),
], ],
), ),