dev #1
@ -1,7 +1,6 @@
|
|||||||
// 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/core/components/flushbar.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/current_outlet/current_outlet_bloc.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/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';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -355,49 +354,40 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: BlocBuilder<CheckoutBloc, CheckoutState>(
|
||||||
padding: const EdgeInsets.all(16.0).copyWith(top: 0),
|
builder: (context, state) {
|
||||||
child: Column(
|
return state.maybeWhen(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
orElse: () => const Center(
|
||||||
children: [
|
child: Text('No Items'),
|
||||||
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,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
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(
|
Padding(
|
||||||
@ -498,21 +488,19 @@ class _HomePageState extends State<HomePage> {
|
|||||||
return state.maybeWhen(
|
return state.maybeWhen(
|
||||||
orElse: () => Align(
|
orElse: () => Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: Expanded(
|
child: Button.filled(
|
||||||
child: Button.filled(
|
borderRadius: 12,
|
||||||
borderRadius: 12,
|
elevation: 1,
|
||||||
elevation: 1,
|
disabled: true,
|
||||||
disabled: true,
|
onPressed: () {
|
||||||
onPressed: () {
|
context.push(ConfirmPaymentPage(
|
||||||
context.push(ConfirmPaymentPage(
|
isTable: widget.table == null
|
||||||
isTable: widget.table == null
|
? false
|
||||||
? false
|
: true,
|
||||||
: true,
|
table: widget.table,
|
||||||
table: widget.table,
|
));
|
||||||
));
|
},
|
||||||
},
|
label: 'Lanjutkan Pembayaran',
|
||||||
label: 'Lanjutkan Pembayaran',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
loaded: (items,
|
loaded: (items,
|
||||||
@ -527,27 +515,25 @@ class _HomePageState extends State<HomePage> {
|
|||||||
orderType) =>
|
orderType) =>
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: Expanded(
|
child: Button.filled(
|
||||||
child: Button.filled(
|
borderRadius: 12,
|
||||||
borderRadius: 12,
|
elevation: 1,
|
||||||
elevation: 1,
|
disabled: items.isEmpty,
|
||||||
disabled: items.isEmpty,
|
onPressed: () {
|
||||||
onPressed: () {
|
if (orderType.name == 'dineIn' &&
|
||||||
if (orderType.name == 'dineIn' &&
|
widget.table == null) {
|
||||||
widget.table == null) {
|
AppFlushbar.showError(context,
|
||||||
AppFlushbar.showError(context,
|
'Mohon pilih meja terlebih dahulu');
|
||||||
'Mohon pilih meja terlebih dahulu');
|
return;
|
||||||
return;
|
}
|
||||||
}
|
context.push(ConfirmPaymentPage(
|
||||||
context.push(ConfirmPaymentPage(
|
isTable: widget.table == null
|
||||||
isTable: widget.table == null
|
? false
|
||||||
? false
|
: true,
|
||||||
: true,
|
table: widget.table,
|
||||||
table: widget.table,
|
));
|
||||||
));
|
},
|
||||||
},
|
label: 'Lanjutkan Pembayaran',
|
||||||
label: 'Lanjutkan Pembayaran',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user