feat: delivery type

This commit is contained in:
efrilm
2025-08-06 18:47:20 +07:00
parent a46a2cfa7c
commit 6fdaac2c0f
22 changed files with 1560 additions and 679 deletions
+38 -22
View File
@@ -307,16 +307,19 @@ class _HomePageState extends State<HomePage> {
orElse: () => const Center(
child: Text('No Items'),
),
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return const Center(
child: Text('No Items'),
@@ -358,16 +361,19 @@ class _HomePageState extends State<HomePage> {
builder: (context, state) {
final tax = state.maybeWhen(
orElse: () => 0,
loaded: (products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType) {
loaded: (
products,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
if (products.isEmpty) {
return 0;
}
@@ -409,7 +415,8 @@ class _HomePageState extends State<HomePage> {
totalQuantity,
totalPrice,
draftName,
orderType) {
orderType,
deliveryType) {
if (products.isEmpty) {
return 0;
}
@@ -462,7 +469,8 @@ class _HomePageState extends State<HomePage> {
totalQuantity,
totalPrice,
draftName,
orderType) =>
orderType,
deliveryType) =>
Align(
alignment: Alignment.bottomCenter,
child: Button.filled(
@@ -476,6 +484,14 @@ class _HomePageState extends State<HomePage> {
'Mohon pilih meja terlebih dahulu');
return;
}
if (orderType.name == 'delivery' &&
deliveryType == null) {
AppFlushbar.showError(context,
'Mohon pilih pengiriman terlebih dahulu');
return;
}
context.push(ConfirmPaymentPage(
isTable: widget.table == null
? false