Commit 0d8c9359 authored by Dio Maulana's avatar Dio Maulana

perbaikan untuk multi

parent 89abd9a1
...@@ -6,7 +6,7 @@ import '../models/orders.dart'; ...@@ -6,7 +6,7 @@ import '../models/orders.dart';
class OrdersBloc extends Cubit<List<Orders>> { class OrdersBloc extends Cubit<List<Orders>> {
OrdersBloc() : super([]); OrdersBloc() : super([]);
void insertData(List<dynamic> list, BuildContext context) { void insertData(List<dynamic> list) {
if (list[0][0] == 'editVariant') { if (list[0][0] == 'editVariant') {
// hanya ketika bottom sheet muncul untuk order yang mempunyai variant // hanya ketika bottom sheet muncul untuk order yang mempunyai variant
// Orders singleOrder = list[0][1]; // Orders singleOrder = list[0][1];
......
...@@ -25,15 +25,15 @@ class OrderDetailVariant extends Cubit<OrderDetail> { ...@@ -25,15 +25,15 @@ class OrderDetailVariant extends Cubit<OrderDetail> {
Orders orders, Orders orders,
List<Orders> listCurrentOrder) { List<Orders> listCurrentOrder) {
OrderDetail orderDetailNow = OrderDetail( OrderDetail orderDetailNow = OrderDetail(
allIdVariant: allIdVariant, allIdVariant: allIdVariant,
totalItem: totalItem, totalItem: totalItem,
totalHarga: totalHarga, totalHarga: totalHarga,
note: note, note: note,
orderVariant: orderVariant); orderVariant: orderVariant,
);
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData([
['editVariant', orders, listCurrentOrder, orderDetailNow] ['editVariant', orders, listCurrentOrder, orderDetailNow]
], context); ]);
emit(orderDetailNow); emit(orderDetailNow);
} }
} }
...@@ -98,7 +98,7 @@ class NoteModalBottomSheet extends StatelessWidget { ...@@ -98,7 +98,7 @@ class NoteModalBottomSheet extends StatelessWidget {
amountParseToInt(menuItem.price), amountParseToInt(menuItem.price),
noteController.text noteController.text
] ]
], context); ]);
} else if (from == fromBill) { } else if (from == fromBill) {
if (idOrderan != '') { if (idOrderan != '') {
Api.changeOrderDetail( Api.changeOrderDetail(
......
...@@ -185,8 +185,9 @@ class _ShowMenuModalState extends State<ShowMenuModal> { ...@@ -185,8 +185,9 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( return CustomizeVariant(
orders: list[indexListOrderan], orders: list[indexListOrderan],
variantCat: widget.variantCat); variantCat: widget.variantCat,
);
}, },
); );
} }
...@@ -206,7 +207,7 @@ class _ShowMenuModalState extends State<ShowMenuModal> { ...@@ -206,7 +207,7 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
? list[indexListOrderan].note ? list[indexListOrderan].note
: '', : '',
] ]
], context); ]);
Navigator.pop(context); Navigator.pop(context);
} }
} }
......
...@@ -151,8 +151,9 @@ class ShowMenuBottomSheet extends StatelessWidget { ...@@ -151,8 +151,9 @@ class ShowMenuBottomSheet extends StatelessWidget {
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( return CustomizeVariant(
orders: list[indexListOrderan], orders: list[indexListOrderan],
variantCat: menuDetail[i].variantCat); variantCat: menuDetail[i].variantCat,
);
}, },
); );
} }
...@@ -172,7 +173,7 @@ class ShowMenuBottomSheet extends StatelessWidget { ...@@ -172,7 +173,7 @@ class ShowMenuBottomSheet extends StatelessWidget {
? list[indexListOrderan].note ? list[indexListOrderan].note
: '', : '',
] ]
], context); ]);
Navigator.pop(context); Navigator.pop(context);
} }
} }
......
...@@ -121,7 +121,7 @@ GestureDetector noteMenu( ...@@ -121,7 +121,7 @@ GestureDetector noteMenu(
hargaFix, hargaFix,
noteController.text noteController.text
] ]
], context); ]);
} else if (callFrom == fromBill) { } else if (callFrom == fromBill) {
await Api.changeOrderDetail( await Api.changeOrderDetail(
context, context,
......
...@@ -234,7 +234,7 @@ class FavGridMenu extends StatelessWidget { ...@@ -234,7 +234,7 @@ class FavGridMenu extends StatelessWidget {
amountParseToInt(menuFav.price), amountParseToInt(menuFav.price),
(indexListOrderan != -1) ? list[indexListOrderan].note : '' (indexListOrderan != -1) ? list[indexListOrderan].note : ''
] ]
], context); ]);
// setState(() {}); // setState(() {});
} }
} }
...@@ -258,7 +258,7 @@ class FavGridMenu extends StatelessWidget { ...@@ -258,7 +258,7 @@ class FavGridMenu extends StatelessWidget {
amountParseToInt(menuFav.price), amountParseToInt(menuFav.price),
(indexListOrderan != -1) ? list[indexListOrderan].note : '', (indexListOrderan != -1) ? list[indexListOrderan].note : '',
] ]
], context); ]);
} }
return AnimatedSwitcher( return AnimatedSwitcher(
...@@ -312,8 +312,9 @@ class FavGridMenu extends StatelessWidget { ...@@ -312,8 +312,9 @@ class FavGridMenu extends StatelessWidget {
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( return CustomizeVariant(
orders: list[indexListOrderan], orders: list[indexListOrderan],
variantCat: menuFav.variantCat); variantCat: menuFav.variantCat,
);
}, },
); );
} }
...@@ -334,7 +335,7 @@ class FavGridMenu extends StatelessWidget { ...@@ -334,7 +335,7 @@ class FavGridMenu extends StatelessWidget {
? list[indexListOrderan].note ? list[indexListOrderan].note
: '' : ''
] ]
], context); ]);
// setState(() {}); // setState(() {});
} }
} }
......
...@@ -270,29 +270,32 @@ class _MenuViewState extends State<MenuView> { ...@@ -270,29 +270,32 @@ class _MenuViewState extends State<MenuView> {
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( return CustomizeVariant(
orders: list[indexListOrderan], orders: list[indexListOrderan],
variantCat: widget.variantCat); variantCat: widget.variantCat,
);
}, },
); );
} }
} else { } else {
if (initialValue == 0) { if (initialValue == 0) {
initialValue += 1; initialValue += 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
widget.id, [
widget.namaMenu, widget.id,
initialValue, widget.namaMenu,
widget.hargaFix, initialValue,
list, widget.hargaFix,
widget.imageUrl, list,
orderVariants, widget.imageUrl,
widget.hargaFix, orderVariants,
(indexListOrderan != -1) widget.hargaFix,
? list[indexListOrderan].note (indexListOrderan != -1)
: '' ? list[indexListOrderan].note
] : ''
], context); ]
],
);
// setState(() {}); // setState(() {});
} }
} }
...@@ -341,22 +344,24 @@ class _MenuViewState extends State<MenuView> { ...@@ -341,22 +344,24 @@ class _MenuViewState extends State<MenuView> {
initialValue -= 1; initialValue -= 1;
context context
.read<OrdersBloc>() .read<OrdersBloc>()
.insertData([ .insertData(
[ [
widget.id, [
widget.namaMenu, widget.id,
initialValue, widget.namaMenu,
widget.hargaFix, initialValue,
list, widget.hargaFix,
widget.imageUrl, list,
orderVariants, widget.imageUrl,
widget.hargaFix, orderVariants,
(indexListOrderan != -1) widget.hargaFix,
? list[indexListOrderan] (indexListOrderan != -1)
.note ? list[indexListOrderan]
: '' .note
] : ''
], context); ]
],
);
// setState(() {}); // setState(() {});
} }
}, },
...@@ -394,23 +399,24 @@ class _MenuViewState extends State<MenuView> { ...@@ -394,23 +399,24 @@ class _MenuViewState extends State<MenuView> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
initialValue += 1; initialValue += 1;
context context.read<OrdersBloc>().insertData(
.read<OrdersBloc>()
.insertData([
[ [
widget.id, [
widget.namaMenu, widget.id,
initialValue, widget.namaMenu,
widget.hargaFix, initialValue,
list, widget.hargaFix,
widget.imageUrl, list,
orderVariants, widget.imageUrl,
widget.hargaFix, orderVariants,
(indexListOrderan != -1) widget.hargaFix,
? list[indexListOrderan].note (indexListOrderan != -1)
: '', ? list[indexListOrderan]
] .note
], context); : '',
]
],
);
// setState(() {}); // setState(() {});
}, },
child: Container( child: Container(
......
...@@ -100,7 +100,7 @@ class _MenuFavoriteState extends State<MenuFavorite> { ...@@ -100,7 +100,7 @@ class _MenuFavoriteState extends State<MenuFavorite> {
initialValue += 1; initialValue += 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData([
[widget.id, widget.namaMenu, 1, widget.hargaFix, list] [widget.id, widget.namaMenu, 1, widget.hargaFix, list]
], context); ]);
setState(() {}); setState(() {});
} }
}, },
...@@ -123,15 +123,17 @@ class _MenuFavoriteState extends State<MenuFavorite> { ...@@ -123,15 +123,17 @@ class _MenuFavoriteState extends State<MenuFavorite> {
onTap: () { onTap: () {
if (initialValue > 0) { if (initialValue > 0) {
initialValue -= 1; initialValue -= 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
widget.id, [
widget.namaMenu, widget.id,
-1, widget.namaMenu,
widget.hargaFix, -1,
list widget.hargaFix,
] list
], context); ]
],
);
setState(() {}); setState(() {});
} }
}, },
...@@ -152,15 +154,17 @@ class _MenuFavoriteState extends State<MenuFavorite> { ...@@ -152,15 +154,17 @@ class _MenuFavoriteState extends State<MenuFavorite> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
initialValue += 1; initialValue += 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
widget.id, [
widget.namaMenu, widget.id,
1, widget.namaMenu,
widget.hargaFix, 1,
list widget.hargaFix,
] list
], context); ]
],
);
setState(() {}); setState(() {});
}, },
child: Icon( child: Icon(
......
...@@ -190,12 +190,12 @@ class MenuListUtama extends StatelessWidget { ...@@ -190,12 +190,12 @@ class MenuListUtama extends StatelessWidget {
BlocBuilder addRemoveQuantity(BuildContext context, FilterMenu menuUtama) { BlocBuilder addRemoveQuantity(BuildContext context, FilterMenu menuUtama) {
List<OrderVariant> orderVariants = []; List<OrderVariant> orderVariants = [];
return BlocBuilder<OrdersBloc, List<Orders>>( return BlocBuilder<OrdersBloc, List<Orders>>(
builder: (contextOrders, list) { builder: (context, listOrders) {
bool bool
addCondition; // true untuk menampilkan tambah, false untuk menampilkan quantity plus minus addCondition; // true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
int indexListOrderan = int indexListOrderan = listOrders
list.indexWhere((listOrderan) => listOrderan.id == menuUtama.id); .indexWhere((listOrderan) => listOrderan.id == menuUtama.id);
int initialValue; int initialValue = 0;
if (indexListOrderan != -1) { if (indexListOrderan != -1) {
if (menuUtama.variantCat.isNotEmpty) { if (menuUtama.variantCat.isNotEmpty) {
addCondition = true; // kalau menu itu ada variantnya, biarin true addCondition = true; // kalau menu itu ada variantnya, biarin true
...@@ -203,7 +203,16 @@ class MenuListUtama extends StatelessWidget { ...@@ -203,7 +203,16 @@ class MenuListUtama extends StatelessWidget {
addCondition = false; addCondition = false;
} }
initialValue = list[indexListOrderan].totalItem; if (listOrders[indexListOrderan].orderDetail.isNotEmpty) {
for (int d = 0;
d < listOrders[indexListOrderan].orderDetail.length;
d++) {
initialValue +=
listOrders[indexListOrderan].orderDetail[d].totalItem;
}
} else {
initialValue = listOrders[indexListOrderan].totalItem;
}
} else { } else {
addCondition = true; addCondition = true;
initialValue = 0; initialValue = 0;
...@@ -215,7 +224,9 @@ class MenuListUtama extends StatelessWidget { ...@@ -215,7 +224,9 @@ class MenuListUtama extends StatelessWidget {
variantButtonCount = '$initialValue Items'; variantButtonCount = '$initialValue Items';
} }
final noteController = TextEditingController( final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : ''); text: (indexListOrderan != -1)
? listOrders[indexListOrderan].note
: '');
void minus() { void minus() {
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
...@@ -231,13 +242,15 @@ class MenuListUtama extends StatelessWidget { ...@@ -231,13 +242,15 @@ class MenuListUtama extends StatelessWidget {
menuUtama.name, menuUtama.name,
initialValue, initialValue,
amountParseToInt(menuUtama.price), amountParseToInt(menuUtama.price),
list, listOrders,
menuUtama.imageUrlMedium, menuUtama.imageUrlMedium,
orderVariants, orderVariants,
amountParseToInt(menuUtama.price), amountParseToInt(menuUtama.price),
(indexListOrderan != -1) ? list[indexListOrderan].note : '' (indexListOrderan != -1)
? listOrders[indexListOrderan].note
: ''
] ]
], context); ]);
// setState(() {}); // setState(() {});
} }
} }
...@@ -249,19 +262,23 @@ class MenuListUtama extends StatelessWidget { ...@@ -249,19 +262,23 @@ class MenuListUtama extends StatelessWidget {
currentFocus.unfocus(); currentFocus.unfocus();
} }
initialValue += 1; initialValue += 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
menuUtama.id, [
menuUtama.name, menuUtama.id,
initialValue, menuUtama.name,
amountParseToInt(menuUtama.price), initialValue,
list, amountParseToInt(menuUtama.price),
menuUtama.imageUrlMedium, listOrders,
orderVariants, menuUtama.imageUrlMedium,
amountParseToInt(menuUtama.price), orderVariants,
(indexListOrderan != -1) ? list[indexListOrderan].note : '', amountParseToInt(menuUtama.price),
] (indexListOrderan != -1)
], context); ? listOrders[indexListOrderan].note
: '',
]
],
);
} }
return AnimatedSwitcher( return AnimatedSwitcher(
...@@ -325,6 +342,9 @@ class MenuListUtama extends StatelessWidget { ...@@ -325,6 +342,9 @@ class MenuListUtama extends StatelessWidget {
amountParseToInt(menuUtama.price), amountParseToInt(menuUtama.price),
variantCategories: menuUtama.variantCat, variantCategories: menuUtama.variantCat,
namaMenu: menuUtama.name, namaMenu: menuUtama.name,
idItem: menuUtama.id,
listCurrentOrder: listOrders,
imageUrl: menuUtama.imageUrlMedium,
), ),
), ),
); );
...@@ -335,29 +355,32 @@ class MenuListUtama extends StatelessWidget { ...@@ -335,29 +355,32 @@ class MenuListUtama extends StatelessWidget {
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( return CustomizeVariant(
orders: list[indexListOrderan], orders: listOrders[indexListOrderan],
variantCat: menuUtama.variantCat); variantCat: menuUtama.variantCat,
);
}, },
); );
} }
} else { } else {
if (initialValue == 0) { if (initialValue == 0) {
initialValue += 1; initialValue += 1;
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
menuUtama.id, [
menuUtama.name, menuUtama.id,
initialValue, menuUtama.name,
amountParseToInt(menuUtama.price), initialValue,
list, amountParseToInt(menuUtama.price),
menuUtama.imageUrlMedium, listOrders,
orderVariants, menuUtama.imageUrlMedium,
amountParseToInt(menuUtama.price), orderVariants,
(indexListOrderan != -1) amountParseToInt(menuUtama.price),
? list[indexListOrderan].note (indexListOrderan != -1)
: '' ? listOrders[indexListOrderan].note
] : ''
], context); ]
],
);
// setState(() {}); // setState(() {});
} }
} }
...@@ -426,7 +449,7 @@ class MenuListUtama extends StatelessWidget { ...@@ -426,7 +449,7 @@ class MenuListUtama extends StatelessWidget {
initialValue: initialValue, initialValue: initialValue,
orderVariants: orderVariants, orderVariants: orderVariants,
menuItem: menuUtama, menuItem: menuUtama,
lisrOrders: list, lisrOrders: listOrders,
from: fromMenu, from: fromMenu,
contextFrom: context, contextFrom: context,
); );
......
...@@ -441,7 +441,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -441,7 +441,7 @@ class _NewHome2State extends State<NewHome2> {
return BlocBuilder<OrdersBloc, return BlocBuilder<OrdersBloc,
List<Orders>>( List<Orders>>(
builder: (contextOrders, listOrders) { builder: (context, listOrders) {
int totalItem = 0; int totalItem = 0;
int totalHarga = 0; int totalHarga = 0;
if (listOrders.isNotEmpty) { if (listOrders.isNotEmpty) {
...@@ -907,11 +907,11 @@ class _NewHome2State extends State<NewHome2> { ...@@ -907,11 +907,11 @@ class _NewHome2State extends State<NewHome2> {
int tableMode, int tableMode,
String namaPelanggan, String namaPelanggan,
double widthScreen) { double widthScreen) {
String itemString; String totalItemString;
if (totalItem > 1) { if (totalItem > 1) {
itemString = '$totalItem Items'; totalItemString = '$totalItem Items';
} else { } else {
itemString = '$totalItem Item'; totalItemString = '$totalItem Item';
} }
final nameController = TextEditingController(); final nameController = TextEditingController();
return GestureDetector( return GestureDetector(
...@@ -1111,7 +1111,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1111,7 +1111,7 @@ class _NewHome2State extends State<NewHome2> {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: defaultText( child: defaultText(
context, context,
itemString, totalItemString,
style: textCountItem(), style: textCountItem(),
), ),
), ),
......
...@@ -345,21 +345,23 @@ class _VariantCatState extends State<VariantCat> { ...@@ -345,21 +345,23 @@ class _VariantCatState extends State<VariantCat> {
} }
} }
if (prosesOrderan) { if (prosesOrderan) {
context.read<OrdersBloc>().insertData([ context.read<OrdersBloc>().insertData(
[ [
widget.idItem, [
widget.namaMenu, widget.idItem,
initialValue, widget.namaMenu,
widget.initPrice, initialValue,
widget.listCurrentOrder, widget.initPrice,
widget.imageUrl, widget.listCurrentOrder,
orderVariants, widget.imageUrl,
totalPrice, orderVariants,
(noteCatController.text.isEmpty) totalPrice,
? '' (noteCatController.text.isEmpty)
: noteCatController.text ? ''
] : noteCatController.text
], context); ]
],
);
Navigator.pop(context); Navigator.pop(context);
} else { } else {
EasyLoading.showToast( EasyLoading.showToast(
......
// ignore_for_file: sized_box_for_whitespace, must_be_immutable // ignore_for_file: sized_box_for_whitespace, must_be_immutable
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/style.dart'; import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/order_details.dart'; import 'package:byod/models/order_details.dart';
import 'package:byod/ui/home/variant_new.dart'; import 'package:byod/ui/home/variant_new.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../bloc/order_bloc.dart';
import '../../bloc/order_variant_temporary.dart'; import '../../bloc/order_variant_temporary.dart';
import '../../bloc/order_variant_value.dart'; import '../../bloc/order_variant_value.dart';
import '../../helper/widget/plus_minus_button.dart'; import '../../helper/widget/plus_minus_button.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/order_variants.dart'; import '../../models/order_variants.dart';
import '../../models/orders.dart';
import '../../models/variant_categories.dart'; import '../../models/variant_categories.dart';
class VariantCatNew extends StatefulWidget { class VariantCatNew extends StatefulWidget {
final List<VariantCategories> variantCategories; final List<VariantCategories> variantCategories;
final int initPrice; final int initPrice;
final String namaMenu; final String namaMenu;
final String idItem;
final List<Orders> listCurrentOrder;
final String imageUrl;
const VariantCatNew({ const VariantCatNew({
Key? key, Key? key,
required this.variantCategories, required this.variantCategories,
required this.initPrice, required this.initPrice,
required this.namaMenu, required this.namaMenu,
required this.idItem,
required this.listCurrentOrder,
required this.imageUrl,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -93,6 +103,8 @@ class _VariantCatNewState extends State<VariantCatNew> { ...@@ -93,6 +103,8 @@ class _VariantCatNewState extends State<VariantCatNew> {
satuanPrice: satuanPrice, satuanPrice: satuanPrice,
totalPrice: totalPrice, totalPrice: totalPrice,
context: context, context: context,
orderVariants: orderVariants,
noteCatController: noteCatController,
), ),
isCoreLayout: true, isCoreLayout: true,
widthScreen: MediaQuery.of(context).size.width, widthScreen: MediaQuery.of(context).size.width,
...@@ -118,6 +130,8 @@ class CoreVariant extends StatelessWidget { ...@@ -118,6 +130,8 @@ class CoreVariant extends StatelessWidget {
required this.satuanPrice, required this.satuanPrice,
required this.totalPrice, required this.totalPrice,
required this.context, required this.context,
required this.orderVariants,
required this.noteCatController,
}) : super(key: key); }) : super(key: key);
final double widthScreen; final double widthScreen;
...@@ -129,6 +143,8 @@ class CoreVariant extends StatelessWidget { ...@@ -129,6 +143,8 @@ class CoreVariant extends StatelessWidget {
final int satuanPrice; final int satuanPrice;
final int totalPrice; final int totalPrice;
final BuildContext context; final BuildContext context;
final List<OrderVariant> orderVariants;
final TextEditingController noteCatController;
void plus() { void plus() {
initialValue += 1; initialValue += 1;
context context
...@@ -301,6 +317,7 @@ class CoreVariant extends StatelessWidget { ...@@ -301,6 +317,7 @@ class CoreVariant extends StatelessWidget {
Container( Container(
height: 35, height: 35,
child: TextField( child: TextField(
controller: noteCatController,
maxLength: maxLengthTextField, maxLength: maxLengthTextField,
autofocus: false, autofocus: false,
style: const TextStyle( style: const TextStyle(
...@@ -397,21 +414,49 @@ class CoreVariant extends StatelessWidget { ...@@ -397,21 +414,49 @@ class CoreVariant extends StatelessWidget {
const SizedBox( const SizedBox(
height: 14, height: 14,
), ),
Container( GestureDetector(
height: 43, onTap: () {
decoration: BoxDecoration( bool prosesOrderan = true;
borderRadius: BorderRadius.circular(33), for (int y = 0;
color: buttonColor, y < widget.variantCategories.length;
), y++) {
child: Center( if (widget.variantCategories[y].type == typeMandatory) {
child: defaultText( int index = orderVariants.indexWhere((order) =>
context, order.categoryId ==
'Tambahkan - Rp ${formatNumber().format(totalPrice)}', widget.variantCategories[y].id);
style: addButton( if (index == -1) {
font: 14, prosesOrderan = false;
), }
), }
), }
if (prosesOrderan) {
context.read<OrdersBloc>().insertData(
[
[
widget.idItem,
widget.namaMenu,
initialValue,
widget.initPrice,
widget.listCurrentOrder,
widget.imageUrl,
orderVariants,
totalPrice,
(noteCatController.text.isEmpty)
? ''
: noteCatController.text
]
],
);
Navigator.pop(context);
} else {
EasyLoading.showToast(
'Masih ada variant yang belum dipilih');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Tambahkan - Rp ${formatNumber().format(totalPrice)}'),
) )
], ],
), ),
......
...@@ -512,10 +512,9 @@ class CoreBill extends StatelessWidget { ...@@ -512,10 +512,9 @@ class CoreBill extends StatelessWidget {
isHistory: isHistory, isHistory: isHistory,
tableStatus: dataBill[0].tableStatus, tableStatus: dataBill[0].tableStatus,
), ),
const SizedBox( (dataBill[0].tableStatus == tableStatusOpen)
height: 24, ? const AddMoreOrder()
), : const SizedBox(),
const AddMoreOrder(),
const SizedBox( const SizedBox(
height: 24, height: 24,
), ),
...@@ -1838,52 +1837,59 @@ class AddMoreOrder extends StatelessWidget { ...@@ -1838,52 +1837,59 @@ class AddMoreOrder extends StatelessWidget {
color: backgroundWhite, color: backgroundWhite,
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight), padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
// color: Colors.red, // color: Colors.red,
child: Row( child: Column(
children: [ children: [
Expanded(
child: Container(
child: defaultText(
context,
'Tambahkan menu lainnya?',
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(
font: 16,
fontWeight: FontWeight.w400,
),
),
),
),
const SizedBox( const SizedBox(
width: 19, height: 24,
), ),
GestureDetector( Row(
onTap: () { children: [
Navigator.push( Expanded(
context, child: Container(
MaterialPageRoute( child: defaultText(
builder: (_) => const NewHome2(), context,
'Tambahkan menu lainnya?',
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(
font: 16,
fontWeight: FontWeight.w400,
),
),
), ),
);
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor,
), ),
child: Center( const SizedBox(
child: defaultText( width: 19,
context, ),
'Tambah', GestureDetector(
style: addButton( onTap: () {
font: 8, Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2(),
),
);
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Tambah',
style: addButton(
font: 8,
),
),
), ),
), ),
), )
), ],
) ),
], ],
), ),
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment