Commit 427674c0 authored by Dio Maulana's avatar Dio Maulana

viewbill page

parent 9473759f
......@@ -771,6 +771,7 @@ class Api {
"service_tax": orderDetail[d]['service_tax'],
"order_status": orderDetail[d]['order_status'],
"notes": orderDetail[d]['notes'],
"image": orderDetail[d]['image_small'],
"variant": variants
};
bill[index].billDetail.add(BillDetail.createBillDetail(z));
......@@ -794,6 +795,7 @@ class Api {
"service_tax": orderDetail[d]['service_tax'],
"order_status": orderDetail[d]['order_status'],
"notes": orderDetail[d]['notes'],
"image": orderDetail[d]['image_small'],
"variant": variants
};
billDetail.add(BillDetail.createBillDetail(z));
......
import 'package:flutter_bloc/flutter_bloc.dart';
class SearchActive extends Cubit<bool> {
SearchActive() : super(false);
void searchClick(bool status) {
emit(!status);
}
}
......@@ -109,7 +109,6 @@ class SearchMenu extends Cubit<List<dynamic>> {
}
}
}
emit([searchMenu, categorySelected, isSearch]);
}
}
......@@ -245,14 +245,17 @@ double heightTombol = 0.06; // untuk dikalikan di height media query
//** core warna */
// const Color backgroundColor = Colors.white;
const Color backgroundColor = Color(0xffF4F4F4);
const Color backgroundWhite = Color(0xffFFFFFF);
const Color dividerGrey = Color(0xff898A8D);
const textColorTabel = Color(0xff333333);
const textColorBlack = Color(0xff000000);
const textColorRed = Color(0xffE73636);
const textColorPlaceHolder = Color(0xffA89C9C);
const textGrey = Color(0xffE0E0E0);
const textGreyBill = Color(0xff828282);
const textGreyDeskripsi = Color(0xffBDBDBD);
const backgroundColorBottomSheet = Color(0xffE5E5E5);
const textColorModalHeaderNama = Color(0xffCCCCFF);
const textColorModalHeaderNama = Color(0xff50555C);
const gridCardBackgroundColor = Color(0xffFFFFFF);
Color buttonColor =
(!isExcelso) ? const Color(0xff003366) : const Color(0xffccb46c);
......
import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../api/api.dart';
import '../../bloc/order_bloc.dart';
import '../../models/filter_menu.dart';
import '../../models/order_variants.dart';
......@@ -9,23 +11,34 @@ import '../../models/orders.dart';
import '../helper.dart';
class NoteModalBottomSheet extends StatelessWidget {
const NoteModalBottomSheet({
NoteModalBottomSheet({
Key? key,
required this.noteController,
required this.initialValue,
required this.orderVariants,
required this.menuItem,
required this.lisrOrders,
required this.from,
this.idOrderan = '',
this.noteInit = '',
required this.contextFrom,
}) : super(key: key);
final TextEditingController noteController;
late TextEditingController noteController;
final int initialValue;
final List<OrderVariant> orderVariants;
final FilterMenu menuItem;
final List<Orders> lisrOrders;
final String from;
final String idOrderan;
final String noteInit;
final BuildContext contextFrom;
@override
Widget build(BuildContext context) {
if (from == fromBill) {
noteController = TextEditingController(text: noteInit);
}
return Container(
margin: const EdgeInsets.symmetric(horizontal: 20),
height: MediaQuery.of(context).size.height * 0.9,
......@@ -73,6 +86,7 @@ class NoteModalBottomSheet extends StatelessWidget {
),
GestureDetector(
onTap: () {
if (from == fromMenu) {
context.read<OrdersBloc>().insertData([
[
menuItem.id,
......@@ -86,6 +100,16 @@ class NoteModalBottomSheet extends StatelessWidget {
noteController.text
]
], context);
} else if (from == fromBill) {
if (idOrderan != '') {
Api.changeOrderDetail(
contextFrom,
idOrderan,
initialValue,
noteController.text,
);
}
}
Navigator.pop(context);
},
child: Align(
......
......@@ -33,6 +33,64 @@ TextStyle appBarNameVariant({font = 17, Color color = textColorBlack}) {
);
}
TextStyle appBarNameViewBill({font = 17, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w700,
color: color,
);
}
TextStyle menuNameListViewBill({font = 17, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w700,
color: color,
);
}
TextStyle descriptionListViewBill(
{font = 14, Color color = textColorPlaceHolder}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
TextStyle viewbillStyle(
{font = 16,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w400}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle customerNameViewbill({font = 14, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
TextStyle noteViewBill({font = 8, Color color = textColorBlack}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
TextStyle tableNameStyle({font = 20, Color color = textColorTabel}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
......@@ -71,7 +129,7 @@ TextStyle menuNameGridFav(
}
TextStyle menuPriceGridFav({
font = 8,
font = 10,
Color color = textColorBlack,
}) {
return TextStyle(
......@@ -106,6 +164,18 @@ TextStyle amountGridFav({
);
}
TextStyle amountViewBillButton({
font = 17,
Color color = textColorBlack,
}) {
return TextStyle(
fontFamily: 'Mulish',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
TextStyle categoryStyle({
font = 14,
Color color = textColorBlack,
......@@ -179,7 +249,7 @@ TextStyle amountMenuStyle({
);
}
TextStyle addButtonMenu({
TextStyle addButton({
font = 12,
Color color = textInButton,
}) {
......@@ -191,6 +261,18 @@ TextStyle addButtonMenu({
);
}
TextStyle rincianPembayaran(
{font = 12,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w400}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle addButtonBottomCart({
font = 16,
Color color = textInButton,
......
......@@ -27,6 +27,7 @@ import 'bloc/menu_selected_bar.dart';
import 'bloc/order_detail_variant.dart';
import 'bloc/order_variant_temporary.dart';
import 'bloc/order_variant_value.dart';
import 'bloc/search_active.dart';
import 'bloc/view_bill.dart';
import 'package:flutter/services.dart' as bundle_root;
......@@ -156,6 +157,7 @@ class MyApp extends StatelessWidget {
BlocProvider(create: (_) => VoucherListBloc()),
BlocProvider(create: (_) => FavSelectedBar()),
BlocProvider(create: (_) => MenuSelectedBar()),
BlocProvider(create: (_) => SearchActive()),
],
child: MaterialApp(
title: (title == null) ? defaultTitle : title,
......
......@@ -10,6 +10,7 @@ class BillDetail {
String serviceTax;
int orderStatus;
String notes;
String imageUrl;
// int paidStatus;
List<String> variant;
......@@ -25,6 +26,7 @@ class BillDetail {
required this.serviceTax,
required this.orderStatus,
required this.notes,
required this.imageUrl,
// required this.paidStatus,
this.variant = const []});
......@@ -41,6 +43,7 @@ class BillDetail {
serviceTax: json['service_tax'],
orderStatus: json['order_status'],
notes: json['notes'],
imageUrl: json['image'] ?? '',
// paidStatus: json['paid_status'],
variant: json['variant']);
}
......
......@@ -222,7 +222,7 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
child: defaultText(
context,
'Tambah',
style: addButtonMenu(),
style: addButton(),
),
),
),
......
......@@ -5,6 +5,7 @@ import 'package:byod/models/fav_group.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/search_active.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/category_list.dart';
......@@ -45,6 +46,7 @@ class _CategoryListHomeState extends State<CategoryListHome> {
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
context.read<SearchActive>().searchClick(true);
context
.read<MenuSelectedBar>()
.selectedBarMenu(i, widget.categoryList[i].id);
......@@ -81,7 +83,8 @@ class _CategoryListHomeState extends State<CategoryListHome> {
margin: const EdgeInsets.only(top: 27),
width: 30,
height: 1,
color: buttonColor)
color: buttonColor,
)
: const SizedBox(
key: Key('underline'),
),
......
......@@ -112,10 +112,6 @@ class FavGridMenu extends StatelessWidget {
width: widthGrid - (2 * paddingLeftRigthGrid),
height: 28,
// color: Colors.blue,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: defaultText(
context,
categoryFavAfterSelect[i].name,
......@@ -123,9 +119,39 @@ class FavGridMenu extends StatelessWidget {
overFlow: TextOverflow.ellipsis,
style: menuNameGridFav(),
),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(
// child: defaultText(
// context,
// categoryFavAfterSelect[i].name,
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
// style: menuNameGridFav(),
// ),
// ),
// Container(
// width: 40,
// child: defaultText(
// context,
// 'Rp ${formatNumber().format(amountParseToInt(categoryFavAfterSelect[i].price))}',
// maxLines: 3,
// overFlow: TextOverflow.ellipsis,
// style: menuPriceGridFav(),
// ),
// )
// ],
// ),
),
const SizedBox(
height: 4,
),
Container(
width: 40,
width: widthGrid - (2 * paddingLeftRigthGrid),
height: 20,
child: Align(
alignment: Alignment.centerRight,
child: defaultText(
context,
'Rp ${formatNumber().format(amountParseToInt(categoryFavAfterSelect[i].price))}',
......@@ -133,13 +159,8 @@ class FavGridMenu extends StatelessWidget {
overFlow: TextOverflow.ellipsis,
style: menuPriceGridFav(),
),
)
],
),
),
const SizedBox(
height: 16,
),
addRemoveQuantity(context, categoryFavAfterSelect[i])
],
),
......@@ -303,6 +324,8 @@ class FavGridMenu extends StatelessWidget {
orderVariants: orderVariants,
menuItem: menuFav,
lisrOrders: list,
from: fromMenu,
contextFrom: context,
);
},
);
......
// ignore_for_file: must_be_immutable
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......
......@@ -232,37 +232,38 @@ class MenuListUtama extends StatelessWidget {
1,
[],
); // check pada bloc untuk mengethui list arraynya
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => VariantCat(
// namaMenu: menuUtama.name,
// variantCategories:
// menuUtama.variantCat,
// initPrice: amountParseToInt(
// menuUtama.price),
// idItem: menuUtama.id,
// imageUrl:
// menuUtama.imageUrlThumbnail,
// listCurrentOrder: list,
// orderDetail: OrderDetail(
// allIdVariant: '',
// totalItem: 0,
// totalHarga: 0,
// note: '',
// orderVariant: [],
// ),
// )));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCatNew(
builder: (_) => VariantCat(
namaMenu: menuUtama.name,
variantCategories: menuUtama.variantCat,
initPrice:
amountParseToInt(menuUtama.price),
variantCategories: menuUtama.variantCat,
idItem: menuUtama.id,
imageUrl: menuUtama.imageUrlThumbnail,
listCurrentOrder: list,
orderDetail: OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: [],
),
),
),
);
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => VariantCatNew(
// initPrice:
// amountParseToInt(menuUtama.price),
// variantCategories: menuUtama.variantCat,
// namaMenu: menuUtama.name,
// ),
// ),
// );
} else {
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
......@@ -316,7 +317,7 @@ class MenuListUtama extends StatelessWidget {
menuUtama.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButtonMenu(),
style: addButton(),
),
),
),
......@@ -348,6 +349,8 @@ class MenuListUtama extends StatelessWidget {
orderVariants: orderVariants,
menuItem: menuUtama,
lisrOrders: list,
from: fromMenu,
contextFrom: context,
);
},
);
......
// // ignore_for_file: sized_box_for_whitespace
// import 'package:byod/helper/helper.dart';
// import 'package:byod/helper/widget/style.dart';
// import 'package:flutter/material.dart';
// import 'cat_list.dart';
// import 'fav_list.dart';
// class NewHome extends StatefulWidget {
// const NewHome({Key? key}) : super(key: key);
// @override
// State<NewHome> createState() => _NewHomeState();
// }
// class _NewHomeState extends State<NewHome> {
// bool isSearchActive = true;
// final searchController = TextEditingController();
// @override
// Widget build(BuildContext context) {
// double paddingLeftRight = 20;
// return SafeArea(
// child: Scaffold(
// backgroundColor: backgroundColor,
// body: Container(
// height: MediaQuery.of(context).size.height,
// margin: EdgeInsets.symmetric(horizontal: paddingLeftRight),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// customAppBar(context, paddingLeftRight),
// SizedBox(
// height: (isSearchActive) ? 16 : 20,
// ),
// AnimatedSwitcher(
// duration: Duration(milliseconds: animatedTime),
// transitionBuilder: (Widget child, Animation<double> animation) {
// return ScaleTransition(scale: animation, child: child);
// },
// child: (isSearchActive)
// ? SizedBox(
// height: 36,
// child: TextField(
// key: const Key('SearchField'),
// style: TextStyle(
// color: Colors.black,
// fontFamily: fontFamily,
// fontSize: 15,
// ),
// decoration: InputDecoration(
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// width: 1,
// color: Colors.grey.withOpacity(0.8),
// ),
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// width: 1,
// color: buttonColor,
// ),
// ),
// prefixIcon: Image(
// image:
// const AssetImage('assets/icons/search.png'),
// color: Colors.grey.withOpacity(0.8),
// height: 20,
// width: 20,
// ),
// hintText: 'Example: nasi',
// hintStyle: TextStyle(
// color: Colors.grey.withOpacity(0.8),
// fontFamily: fontFamily,
// fontSize: 10,
// ),
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(6),
// ),
// ),
// ),
// )
// : const SizedBox(
// key: Key('SearchField'),
// ),
// ),
// SizedBox(
// height: (isSearchActive) ? 20 : 0,
// ),
// Container(
// height: 35,
// child: FavoriteList(),
// ),
// const SizedBox(
// height: 13.5,
// ),
// Container(
// height: 219,
// child: ListView.builder(
// scrollDirection: Axis.horizontal,
// itemCount: 5,
// itemBuilder: (context, i) {
// double paddingLeftRigthGrid = 9;
// double widthGrid = 136;
// return girdFavItem(
// i,
// widthGrid,
// paddingLeftRigthGrid,
// context,
// );
// }),
// ),
// const SizedBox(
// height: 16,
// ),
// defaultText(
// context,
// 'Category',
// style: categoryStyle(),
// ),
// const SizedBox(
// height: 42,
// ),
// Container(
// height: 51,
// child: const CategoryListHome(),
// ),
// const SizedBox(
// height: 25,
// ),
// Expanded(
// child: ListView.builder(
// itemCount: 1000,
// itemBuilder: (context, i) {
// return Text('aaa');
// },
// ),
// )
// ],
// ),
// ),
// ),
// );
// }
// Container girdFavItem(int i, double widthGrid, double paddingLeftRigthGrid,
// BuildContext context) {
// bool addCondition = true;
// return Container(
// margin: EdgeInsets.only(
// left: (i == 0) ? 0 : 8,
// right: (i == 5 - 1) ? 0 : 8,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(5),
// color: gridCardBackgroundColor,
// ),
// height: double.infinity,
// width: widthGrid,
// child: Container(
// margin: EdgeInsets.only(
// top: 8,
// left: paddingLeftRigthGrid,
// right: paddingLeftRigthGrid,
// bottom: 16,
// ),
// // color: Colors.red,
// child: Column(
// children: [
// Container(
// width: widthGrid - (2 * paddingLeftRigthGrid),
// height: widthGrid - (2 * paddingLeftRigthGrid),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Colors.red,
// ),
// ),
// const SizedBox(
// height: 3,
// ),
// Container(
// width: widthGrid - (2 * paddingLeftRigthGrid),
// height: 28,
// // color: Colors.blue,
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(
// child: defaultText(
// context,
// 'BBQ Chicken Nachos',
// maxLines: 2,
// overFlow: TextOverflow.ellipsis,
// style: menuNameGridFav(),
// ),
// ),
// Container(
// width: 40,
// child: defaultText(
// context,
// 'Rp 25,000',
// maxLines: 3,
// overFlow: TextOverflow.ellipsis,
// style: menuPriceGridFav(),
// ),
// )
// ],
// ),
// ),
// const SizedBox(
// height: 16,
// ),
// (addCondition)
// ? Container(
// height: 30,
// width: widthGrid - (2 * paddingLeftRigthGrid),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(6),
// color: buttonColor,
// ),
// child: Center(
// child: defaultText(
// context,
// 'Tambah',
// style: addButtonGridFav(),
// ),
// ),
// )
// : Container(
// height: 30,
// width: widthGrid - (2 * paddingLeftRigthGrid),
// child: Row(
// children: [
// Container(
// width: 27,
// height: 24,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(6),
// color: buttonColor,
// ),
// child: const Center(
// child: Image(
// width: 13.33,
// height: 13.33,
// color: textInButton,
// image: AssetImage('assets/icons/note.png'),
// ),
// ),
// ),
// const SizedBox(
// width: 5,
// ),
// Container(
// width: 22,
// height: 22,
// child: const Image(
// image: AssetImage('assets/icons/minus.png'),
// ),
// ),
// Expanded(
// child: Center(
// child: defaultText(
// context,
// '10',
// style: amountGridFav(),
// ),
// ),
// ),
// Container(
// width: 22,
// height: 22,
// child: const Image(
// image: AssetImage('assets/icons/plus.png'),
// ),
// )
// ],
// ),
// )
// ],
// ),
// ),
// );
// }
// Container customAppBar(BuildContext context, double paddingLeftRight) {
// return Container(
// // color: Colors.red,
// height: 40,
// child: CustomScrollView(
// slivers: [
// SliverAppBar(
// automaticallyImplyLeading: false,
// title: defaultText(
// context,
// 'Meja 12',
// style: tableNameStyle(),
// ),
// backgroundColor: Colors.transparent,
// pinned: true,
// actions: [
// GestureDetector(
// onTap: () {
// setState(() {
// isSearchActive = !isSearchActive;
// });
// },
// child: const Image(
// image: AssetImage('assets/icons/search.png'),
// height: 20,
// width: 20,
// ),
// ),
// const SizedBox(
// width: 16,
// ),
// const Image(
// image: AssetImage('assets/icons/book.png'),
// height: 20,
// width: 20,
// ),
// SizedBox(
// width: paddingLeftRight,
// ),
// ],
// ),
// ],
// ),
// );
// }
// AnimatedSwitcher seearchField(BuildContext context) {
// return AnimatedSwitcher(
// duration: const Duration(milliseconds: 500),
// transitionBuilder: (Widget child, Animation<double> animation) {
// return ScaleTransition(scale: animation, child: child);
// },
// child: TextField(
// key: const Key('SearchField'),
// decoration: InputDecoration(
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// width: 1,
// color: buttonColor,
// ),
// ),
// prefixIcon: const Image(
// image: AssetImage('assets/icons/search.png'),
// height: 20,
// width: 20,
// ),
// hintText: 'Example: nasi',
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(6),
// ),
// ),
// ),
// );
// }
// }
......@@ -4,6 +4,7 @@ import 'package:byod/bloc/branch_exist.dart';
import 'package:byod/bloc/fav_selected_bar.dart';
import 'package:byod/bloc/menu_selected_bar.dart';
import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/bloc/search_active.dart';
import 'package:byod/bloc/search_menu.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart';
......@@ -28,6 +29,7 @@ import '../checkout/checkout.dart';
import '../checkout/fuction.dart';
import '../screen_responsive.dart';
import '../viewbill/view_bill.dart';
import '../viewbill/view_bill_new.dart';
import 'bottom_sheet_menu.dart';
import 'bottom_sheet_variant.dart';
import 'cat_list.dart';
......@@ -44,12 +46,12 @@ class NewHome2 extends StatefulWidget {
}
class _NewHome2State extends State<NewHome2> {
bool isSearchActive = false;
// bool isSearchActive = false;
bool isFirstLoad = true;
final searchController = TextEditingController();
final _scrollController = ScrollController();
final _scrollFavItem = ScrollController();
final _scrollMenuItem = ScrollController();
// final _scrollMenuItem = ScrollController();
final scrollMenuItemList = ItemScrollController();
late bool isScrollableMenu = false;
......@@ -175,7 +177,7 @@ class _NewHome2State extends State<NewHome2> {
@override
void dispose() {
_scrollController.removeListener(() {});
_scrollMenuItem.removeListener(() {});
// _scrollMenuItem.removeListener(() {});
super.dispose();
}
......@@ -186,25 +188,25 @@ class _NewHome2State extends State<NewHome2> {
double searchFieldHeight = 36;
double spacerHeight = 20;
double favListHeight = 35;
double favItemHeight = 219;
double favItemHeight = 227;
double spacerAboveCat = 16;
double categoryFont = 14;
double spacerAboveCatList = 42;
double catListHeight = 51;
double spacerAboveMenuItem = 25;
double heightLeft = (isSearchActive)
? heightTotal -
appBarHeight -
searchFieldHeight -
spacerHeight -
favListHeight -
categoryFont -
spacerAboveCatList
: heightTotal -
appBarHeight -
favListHeight -
categoryFont -
spacerAboveCatList;
// double heightLeft = (isSearchActive)
// ? heightTotal -
// appBarHeight -
// searchFieldHeight -
// spacerHeight -
// favListHeight -
// categoryFont -
// spacerAboveCatList
// : heightTotal -
// appBarHeight -
// favListHeight -
// categoryFont -
// spacerAboveCatList;
int tableMode = prefs.getInt('table_mode') ?? defaultTable;
String tableNumber = prefs.getString("table_number") ?? "";
......@@ -275,7 +277,7 @@ class _NewHome2State extends State<NewHome2> {
List<CategoryList> catListTempMenu = [];
var nn = {
"name": "All",
"id": "0",
"id": "",
"offset": 0,
}; // all dulu, biar ada bisa klik all
catListTemp
......@@ -335,8 +337,10 @@ class _NewHome2State extends State<NewHome2> {
categoryFavAfterSelect = temporSelectedFav;
}
return BlocBuilder<SearchActive, bool>(
builder: (contextSearch, isSearchActive) {
return BlocBuilder<SearchMenu, List<dynamic>>(
builder: (contextSearch, listSearch) {
builder: (contextSearchActive, listSearch) {
return BlocBuilder<MenuSelectedBar,
Map<String, dynamic>>(
builder: (contextSelectedBarMenu,
......@@ -346,13 +350,16 @@ class _NewHome2State extends State<NewHome2> {
if (categoryNonFav.isNotEmpty &&
categoryList.isNotEmpty) {
if (listSearch[0].length == 1 &&
listSearch[0][0].id == 'start') {
List<FilterMenu> temprSelectedMenu =
[];
for (var nameCat in categoryNonFav) {
listSearch[0][0].id ==
'start') {
List<FilterMenu>
temprSelectedMenu = [];
for (var nameCat
in categoryNonFav) {
if (nameCat.categoryId ==
listDynamicBarMenu['id']) {
temprSelectedMenu.add(nameCat);
temprSelectedMenu
.add(nameCat);
}
}
if (listDynamicBarMenu['index'] ==
......@@ -364,13 +371,16 @@ class _NewHome2State extends State<NewHome2> {
temprSelectedMenu;
}
} else {
if (listDynamicBarMenu['id'] != "0") {
List<FilterMenu> temprSearchMenu =
[];
if (listDynamicBarMenu['id'] !=
"") {
List<FilterMenu>
temprSearchMenu = [];
for (var nameMenuSearch
in listSearch[0]) {
if (listDynamicBarMenu['id'] ==
nameMenuSearch.categoryId) {
if (listDynamicBarMenu[
'id'] ==
nameMenuSearch
.categoryId) {
temprSearchMenu
.add(nameMenuSearch);
}
......@@ -383,34 +393,35 @@ class _NewHome2State extends State<NewHome2> {
}
}
}
for (var nameCatAfterSelect
in categoryMenuAfterSelect) {
if (nameCatAfterSelect.type ==
typeCategory) {
var nn = {
"id": nameCatAfterSelect.id,
"name":
nameCatAfterSelect.categoryName,
"name": nameCatAfterSelect
.categoryName,
};
catListMenuTmp.add(
CategoryList.createCategoryList(
nn));
catListMenuTmp.add(CategoryList
.createCategoryList(nn));
}
}
categoryListMenu = catListMenuTmp;
} else {
if (categoryNonFav.isNotEmpty &&
categoryList.isNotEmpty) {
List<FilterMenu> temprSelectedMenu = [];
List<FilterMenu> temprSelectedMenu =
[];
for (var nameCat in categoryNonFav) {
for (var nameCat
in categoryNonFav) {
if (nameCat.categoryId ==
listDynamicBarMenu['id']) {
temprSelectedMenu.add(nameCat);
}
}
if (listDynamicBarMenu['index'] == 0) {
if (listDynamicBarMenu['index'] ==
0) {
categoryMenuAfterSelect =
categoryNonFav;
} else {
......@@ -427,9 +438,8 @@ class _NewHome2State extends State<NewHome2> {
"name": nameCatAfterSelect
.categoryName,
};
catListMenuTmp.add(
CategoryList.createCategoryList(
nn));
catListMenuTmp.add(CategoryList
.createCategoryList(nn));
}
}
categoryListMenu = catListMenuTmp;
......@@ -444,7 +454,8 @@ class _NewHome2State extends State<NewHome2> {
if (listOrders.isNotEmpty) {
int fixTotalHarga = 0;
int totalHargaOrderDetail = 0;
int totalHargaBukanOrderDetail = 0;
int totalHargaBukanOrderDetail =
0;
int fixTotalItem = 0;
int totalItemOrderDetail = 0;
......@@ -459,7 +470,8 @@ class _NewHome2State extends State<NewHome2> {
.isEmpty) {
totalHargaBukanOrderDetail +=
(listOrders[i].totalItem *
listOrders[i].totalHarga);
listOrders[i]
.totalHarga);
totalItemBukanOrderDetail +=
listOrders[i].totalItem;
} else {
......@@ -505,14 +517,16 @@ class _NewHome2State extends State<NewHome2> {
spacerAboveCatList,
catListHeight,
spacerAboveMenuItem,
heightLeft,
totalItem,
listOrders,
totalHarga,
tableMode,
isSearchActive,
),
widthScreen:
MediaQuery.of(context).size.width,
MediaQuery.of(context)
.size
.width,
isCoreLayout: true,
);
},
......@@ -521,6 +535,8 @@ class _NewHome2State extends State<NewHome2> {
);
},
);
},
);
});
},
)
......@@ -567,11 +583,12 @@ class _NewHome2State extends State<NewHome2> {
double spacerAboveCatList,
double catListHeight,
double spacerAboveMenuItem,
double heightLeft,
int totalItem,
List<Orders> listOrders,
int totalHarga,
int tableMode) {
int tableMode,
bool isSearchActive,
) {
return Stack(
children: [
Container(
......@@ -587,6 +604,7 @@ class _NewHome2State extends State<NewHome2> {
appBarHeight,
tableNumber,
userName,
isSearchActive,
),
SizedBox(
height: (isSearchActive) ? 16 : 20,
......@@ -692,24 +710,6 @@ class _NewHome2State extends State<NewHome2> {
height: spacerAboveMenuItem,
),
),
// MultiSliver(pushPinnedChildren: true, children: [
// SliverPinnedHeader(child: Text('Pined1')),
// SliverList(
// delegate: SliverChildListDelegate.fixed(List.generate(
// 100,
// (index) => ListTile(
// title: Text('Ke $index'),
// ))))
// ]),
// MultiSliver(pushPinnedChildren: true, children: [
// SliverPinnedHeader(child: Text('Pined2')),
// SliverList(
// delegate: SliverChildListDelegate.fixed(List.generate(
// 100,
// (index) => ListTile(
// title: Text('Ke $index'),
// ))))
// ]),
for (int i = 0; i < categoryListMenu.length; i++)
MultiSliver(
......@@ -729,7 +729,7 @@ class _NewHome2State extends State<NewHome2> {
style: categoryNameStyle(),
),
const Divider(
thickness: 0.5,
thickness: 0.1,
color: textColorBlack,
),
],
......@@ -748,404 +748,8 @@ class _NewHome2State extends State<NewHome2> {
);
}, childCount: categoryMenuAfterSelect.length),
),
// for (var menu in categoryMenuAfterSelect)
// (menu.categoryId == categoryListMenu[i].id &&
// menu.type != typeCategory &&
// menu.type == typeGroup)
// ? Container(
// margin: const EdgeInsets.only(
// top: 6,
// ),
// child: defaultText(
// context,
// maxLines: 3,
// overFlow: TextOverflow.ellipsis,
// categoryNonFav[i].groupName,
// style: subCategoryStyle(),
// ),
// )
// : (menu.categoryId == categoryListMenu[i].id &&
// menu.type != typeCategory &&
// menu.type == typeMenu)
// ? Container(
// margin: EdgeInsets.only(
// top: 19,
// bottom: (i + 1 ==
// categoryMenuAfterSelect
// .length)
// ? 85
// : 19,
// ),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Container(
// height: 125,
// width: double.infinity,
// child: Row(
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment
// .start,
// children: [
// defaultText(
// context,
// menu.name,
// style:
// menuNameStyle(),
// ),
// const Spacer(),
// defaultText(
// maxLines: 2,
// overFlow: TextOverflow
// .ellipsis,
// context,
// menu.description,
// style:
// deskripsiMenuStyle(),
// ),
// const SizedBox(
// height: 4,
// ),
// defaultText(
// maxLines: 1,
// overFlow: TextOverflow
// .ellipsis,
// context,
// 'Rp ${formatNumber().format(amountParseToInt(menu.price))}',
// style:
// amountMenuStyle(),
// )
// ],
// ),
// ),
// Container(
// width: 12,
// height: double.infinity,
// ),
// GestureDetector(
// onTap: () {
// FocusScopeNode
// currentFocus =
// FocusScope.of(
// context);
// if (!currentFocus
// .hasPrimaryFocus) {
// currentFocus.unfocus();
// }
// showModalBottomSheet(
// backgroundColor:
// Colors.white,
// isScrollControlled:
// true,
// context: context,
// builder: (context) {
// return ShowMenuModal(
// imageUrl: menu
// .imageUrlMedium,
// namaMenu: menu.name,
// hargaMenu:
// amountParseToInt(
// menu.price),
// isHavevariant: menu
// .variantCat
// .isNotEmpty
// ? true
// : false,
// description: menu
// .description,
// id: menu.id,
// variantCat:
// menu.variantCat,
// isSell: menu.isSell,
// );
// },
// );
// },
// child: Container(
// width: 125,
// height: 125,
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius
// .circular(14),
// color: disabledColor
// .withOpacity(0.8),
// ),
// child: ClipRRect(
// borderRadius:
// BorderRadius
// .circular(14),
// child:
// (menu.imageUrlMedium !=
// '')
// ? Image(
// fit: BoxFit
// .fill,
// image:
// NetworkImage(
// menu.imageUrlMedium,
// ),
// )
// : const Image(
// fit: BoxFit
// .fill,
// image: AssetImage(
// 'assets/noimage.png'),
// ),
// ),
// ),
// )
// ],
// ),
// ),
// Container(
// height: 8,
// width: double.infinity,
// ),
// addRemoveQuantity(context, menu)
// ],
// ),
// )
// : const SizedBox()
],
),
// for (int i = 0; i < categoryMenuAfterSelect.length; i++)
// (categoryMenuAfterSelect[i].type == typeCategory)
// ? SliverAppBar(
// shadowColor: Colors.transparent,
// centerTitle: false,
// titleSpacing: 0,
// backgroundColor: backgroundColor,
// automaticallyImplyLeading: false,
// title: defaultText(
// context,
// categoryMenuAfterSelect[i].categoryName,
// maxLines: 1,
// overFlow: TextOverflow.ellipsis,
// style: categoryNameStyle(),
// ),
// pinned: true,
// bottom: const PreferredSize(
// preferredSize: Size.fromHeight(0.5),
// child: Divider(
// thickness: 0.5,
// color: textColorBlack,
// ),
// ),
// )
// // MultiSliver(
// // pushPinnedChildren: true,
// // children: [
// // SliverPinnedHeader(
// // child: Container(
// // color: backgroundColor,
// // child: defaultText(
// // context,
// // categoryMenuAfterSelect[i].categoryName,
// // maxLines: 1,
// // overFlow: TextOverflow.ellipsis,
// // style: categoryNameStyle(),
// // ),
// // ),
// // ),
// // const Divider(
// // thickness: 0.5,
// // color: textColorBlack,
// // ),
// // ],
// // )
// : (categoryMenuAfterSelect[i].type == typeGroup)
// ? MultiSliver(
// pushPinnedChildren: true,
// children: [
// Container(
// margin: const EdgeInsets.only(
// top: 6,
// ),
// child: defaultText(
// context,
// maxLines: 3,
// overFlow: TextOverflow.ellipsis,
// categoryNonFav[i].groupName,
// style: subCategoryStyle(),
// ),
// ),
// ],
// )
// : MultiSliver(
// pushPinnedChildren: true,
// children: [
// Container(
// margin: EdgeInsets.only(
// top: 19,
// bottom: (i + 1 ==
// categoryMenuAfterSelect.length)
// ? 85
// : 19,
// ),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Container(
// height: 125,
// width: double.infinity,
// child: Row(
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment
// .start,
// children: [
// defaultText(
// context,
// categoryMenuAfterSelect[
// i]
// .name,
// style: menuNameStyle(),
// ),
// const Spacer(),
// defaultText(
// maxLines: 2,
// overFlow: TextOverflow
// .ellipsis,
// context,
// categoryMenuAfterSelect[
// i]
// .description,
// style:
// deskripsiMenuStyle(),
// ),
// const SizedBox(
// height: 4,
// ),
// defaultText(
// maxLines: 1,
// overFlow: TextOverflow
// .ellipsis,
// context,
// 'Rp ${formatNumber().format(amountParseToInt(categoryMenuAfterSelect[i].price))}',
// style:
// amountMenuStyle(),
// )
// ],
// ),
// ),
// Container(
// width: 12,
// height: double.infinity,
// ),
// GestureDetector(
// onTap: () {
// FocusScopeNode
// currentFocus =
// FocusScope.of(context);
// if (!currentFocus
// .hasPrimaryFocus) {
// currentFocus.unfocus();
// }
// showModalBottomSheet(
// backgroundColor:
// Colors.white,
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return ShowMenuModal(
// imageUrl:
// categoryMenuAfterSelect[
// i]
// .imageUrlMedium,
// namaMenu:
// categoryMenuAfterSelect[
// i]
// .name,
// hargaMenu:
// amountParseToInt(
// categoryMenuAfterSelect[
// i]
// .price),
// isHavevariant:
// categoryMenuAfterSelect[
// i]
// .variantCat
// .isNotEmpty
// ? true
// : false,
// description:
// categoryMenuAfterSelect[
// i]
// .description,
// id: categoryMenuAfterSelect[
// i]
// .id,
// variantCat:
// categoryMenuAfterSelect[
// i]
// .variantCat,
// isSell:
// categoryMenuAfterSelect[
// i]
// .isSell,
// );
// },
// );
// },
// child: Container(
// width: 125,
// height: 125,
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(
// 14),
// color: disabledColor
// .withOpacity(0.8),
// ),
// child: ClipRRect(
// borderRadius:
// BorderRadius.circular(
// 14),
// child: (categoryMenuAfterSelect[
// i]
// .imageUrlMedium !=
// '')
// ? Image(
// fit: BoxFit.fill,
// image:
// NetworkImage(
// categoryMenuAfterSelect[
// i]
// .imageUrlMedium,
// ),
// )
// : const Image(
// fit: BoxFit.fill,
// image: AssetImage(
// 'assets/noimage.png'),
// ),
// ),
// ),
// )
// ],
// ),
// ),
// Container(
// height: 8,
// width: double.infinity,
// ),
// addRemoveQuantity(
// context, categoryNonFav[i])
// ],
// ),
// ),
// ],
// ),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (context, index) {
......@@ -1198,6 +802,7 @@ class _NewHome2State extends State<NewHome2> {
margin: const EdgeInsets.only(bottom: 5),
height: searchFieldHeight,
child: TextField(
autofocus: true,
onChanged: (sarchValue) {
context.read<SearchMenu>().searchMenu(
categoryNonFav,
......@@ -1468,8 +1073,13 @@ class _NewHome2State extends State<NewHome2> {
);
}
Container customAppBar(BuildContext context, double paddingLeftRight,
double appBarHeight, String tableNumber, String userName) {
Container customAppBar(
BuildContext context,
double paddingLeftRight,
double appBarHeight,
String tableNumber,
String userName,
bool isSearchActive) {
String barName;
if (userName != '') {
barName = 'Meja $tableNumber - $userName';
......@@ -1489,9 +1099,20 @@ class _NewHome2State extends State<NewHome2> {
const Spacer(),
GestureDetector(
onTap: () {
setState(() {
isSearchActive = !isSearchActive;
});
context.read<SearchActive>().searchClick(isSearchActive);
context.read<MenuSelectedBar>().selectedBarMenu(0, '');
context.read<SearchMenu>().searchMenu(
categoryNonFav,
keyword: '',
isSearch: true,
);
_scrollController.animateTo(
(favList.isNotEmpty)
? 371
: 0, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
);
},
child: const Image(
image: AssetImage('assets/icons/search.png'),
......@@ -1504,8 +1125,10 @@ class _NewHome2State extends State<NewHome2> {
),
GestureDetector(
onTap: () {
// Navigator.push(
// context, MaterialPageRoute(builder: (_) => ViewBill()));
Navigator.push(
context, MaterialPageRoute(builder: (_) => ViewBill()));
context, MaterialPageRoute(builder: (_) => ViewBillNew()));
},
child: const Image(
image: AssetImage('assets/icons/book.png'),
......@@ -1539,318 +1162,6 @@ class _NewHome2State extends State<NewHome2> {
),
);
}
BlocBuilder addRemoveQuantity(BuildContext context, FilterMenu menuUtama) {
List<OrderVariant> orderVariants = [];
return BlocBuilder<OrdersBloc, List<Orders>>(
builder: (contextOrders, list) {
bool
addCondition; // true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
int indexListOrderan =
list.indexWhere((listOrderan) => listOrderan.id == menuUtama.id);
int initialValue;
if (indexListOrderan != -1) {
if (menuUtama.variantCat.isNotEmpty) {
addCondition = true; // kalau menu itu ada variantnya, biarin true
} else {
addCondition = false;
}
initialValue = list[indexListOrderan].totalItem;
} else {
addCondition = true;
initialValue = 0;
}
String variantButtonCount = '';
if (initialValue == 1 && menuUtama.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Item';
} else if (initialValue > 1 && menuUtama.variantCat.isNotEmpty) {
variantButtonCount = '$initialValue Items';
}
final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : '');
return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (addCondition)
? Container(
key: const Key('AddButtonMenuKey'),
height: 36,
width: double.infinity,
child: Row(
children: [
const Spacer(),
GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (menuUtama.isSell) {
if (menuUtama.variantCat.isNotEmpty) {
if (indexListOrderan == -1) {
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(
menuUtama.id,
amountParseToInt(menuUtama.price),
1,
[],
); // check pada bloc untuk mengethui list arraynya
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => VariantCat(
// namaMenu: menuUtama.name,
// variantCategories:
// menuUtama.variantCat,
// initPrice: amountParseToInt(
// menuUtama.price),
// idItem: menuUtama.id,
// imageUrl:
// menuUtama.imageUrlThumbnail,
// listCurrentOrder: list,
// orderDetail: OrderDetail(
// allIdVariant: '',
// totalItem: 0,
// totalHarga: 0,
// note: '',
// orderVariant: [],
// ),
// )));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCatNew(
initPrice:
amountParseToInt(menuUtama.price),
variantCategories: menuUtama.variantCat,
),
),
);
} else {
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true,
context: context,
builder: (context) {
return CustomizeVariant(
orders: list[indexListOrderan],
variantCat: menuUtama.variantCat);
},
);
}
} else {
if (initialValue == 0) {
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
}
}
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: buttonColor,
),
height: double.infinity,
width: 125,
child: Center(
child: defaultText(
context,
(menuUtama.isSell == false)
? 'Habis'
: (initialValue == 0)
? 'Tambah'
: (initialValue > 0 &&
menuUtama.variantCat.isNotEmpty)
? variantButtonCount
: 'Tambah',
style: addButtonMenu(),
),
),
),
)
],
),
)
: Container(
key: const Key('AddButtonMenuKey'),
height: 36,
width: 125,
child: Row(
children: [
GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: orderVariants,
menuItem: menuUtama,
lisrOrders: list,
);
},
);
},
child: Container(
width: 27,
height: 24,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: buttonColor,
),
child: const Center(
child: Image(
width: 13.33,
height: 13.33,
color: textInButton,
image: AssetImage('assets/icons/note.png'),
),
),
),
),
const SizedBox(
width: 5,
),
Expanded(
child: Container(
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white,
),
child: Stack(
children: [
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (initialValue > 0) {
initialValue -= 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: ''
]
], context);
// setState(() {});
}
},
child: Container(
width: 22,
height: 22,
child: Image(
color: buttonColor,
image: const AssetImage(
'assets/icons/minus-blue.png'),
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuUtama.id,
menuUtama.name,
initialValue,
amountParseToInt(menuUtama.price),
list,
menuUtama.imageUrlMedium,
orderVariants,
amountParseToInt(menuUtama.price),
(indexListOrderan != -1)
? list[indexListOrderan].note
: '',
]
], context);
},
child: Container(
width: 22,
height: 22,
child: const Image(
image:
AssetImage('assets/icons/plus.png'),
),
),
),
),
Center(
child: Container(
height: 22,
child: Center(
child: defaultText(
context,
initialValue.toString(),
style: amountGridFav(),
),
),
),
),
],
),
),
),
],
),
),
);
},
);
}
}
class Delegate extends SliverPersistentHeaderDelegate {
......@@ -1898,21 +1209,6 @@ class CustomClipPath extends CustomClipper<Path> {
Path getClip(Size size) {
// buat clipnya di https://shapemaker.web.app/#/
// Path path0 = Path();
// path0.moveTo(0, 0);
// path0.lineTo(0, size.height);
// path0.lineTo(size.width, size.height);
// path0.quadraticBezierTo(size.width, size.height * 0.6250000, size.width,
// size.height * 0.5042857);
// path0.cubicTo(
// size.width * 0.8616667,
// size.height * 0.4364286,
// size.width * 0.9810417,
// size.height * 0.0007143,
// size.width * 0.7191667,
// 0);
// path0.quadraticBezierTo(size.width * 0.5468750, 0, 0, 0);
// path0.close();
double w = size.width;
Path path0 = Path();
path0.moveTo(0, 0);
......
......@@ -14,10 +14,12 @@ import '../../models/variant_categories.dart';
class VariantCatNew extends StatefulWidget {
final List<VariantCategories> variantCategories;
final int initPrice;
final String namaMenu;
const VariantCatNew({
Key? key,
required this.variantCategories,
required this.initPrice,
required this.namaMenu,
}) : super(key: key);
@override
......@@ -88,7 +90,9 @@ class _VariantCatNewState extends State<VariantCatNew> {
Center(
child: defaultText(
context,
'Custom Pesanan',
widget.namaMenu,
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameVariant(),
),
),
......
......@@ -14,7 +14,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import '../bloc/branch_exist.dart';
import '../main.dart';
import 'package:flutter/services.dart' as bundle_root;
import 'home/new_home.dart';
import 'home/new_home2.dart';
import 'home/shimmer_menu.dart';
import 'screen_responsive.dart';
......
// ignore_for_file: sized_box_for_whitespace
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/branch_exist.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../main.dart';
import '../home/new_home2.dart';
class CustomAppBar extends StatelessWidget {
const CustomAppBar({
Key? key,
required this.isHistory,
}) : super(key: key);
final bool isHistory;
@override
Widget build(BuildContext context) {
String branchCode = prefs.getString('outlet') ?? '';
String brandCode = prefs.getString('brand') ?? '';
String role = prefs.getString('role') ?? '';
String cashierName = prefs.getString('cashier_name') ?? '';
String sessionId = prefs.getString('sessionId') ?? '';
return Container(
margin: const EdgeInsets.only(
top: 15,
bottom: 30,
),
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
if (!isHistory) {
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (_) => const NewHome2()));
context.read<BranchExist>().branchExist(
branchCode, brandCode, role, cashierName, sessionId);
} else {
Navigator.pop(context);
}
},
child: Container(
width: 24,
height: 24,
child: Center(
child: fontAwesomeNew(
arrowBack,
arrowBackSize,
),
),
),
),
const SizedBox(
width: 16,
),
Center(
child: defaultText(
context,
'Check-Out',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(),
),
),
],
),
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:flutter/material.dart';
import '../../models/bill_detail.dart';
import 'order_view_bill_new.dart';
class ListOrder extends StatelessWidget {
const ListOrder({
Key? key,
required this.billDetail,
}) : super(key: key);
final List<BillDetail> billDetail;
@override
Widget build(BuildContext context) {
int itemCounts = billDetail.length;
return ListView.builder(
physics: const NeverScrollableScrollPhysics(), // to disable scrolling
shrinkWrap: true,
itemCount: itemCounts,
itemBuilder: (ctx, i) {
return OrderViewBillNew(
billDetail: billDetail[i],
lastItem: (i + 1 == itemCounts) ? true : false,
);
},
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/models/filter_menu.dart';
import 'package:flutter/material.dart';
import '../../api/api.dart';
import '../../helper/helper.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../helper/widget/style.dart';
import '../../models/bill_detail.dart';
import 'view_bill_new.dart';
class OrderViewBillNew extends StatefulWidget {
final BillDetail billDetail;
final bool lastItem;
const OrderViewBillNew({
Key? key,
required this.billDetail,
this.lastItem = false,
}) : super(key: key);
@override
State<OrderViewBillNew> createState() => _OrderViewBillNewState();
}
class _OrderViewBillNewState extends State<OrderViewBillNew> {
void ontapOkDelete() {
Api.deleteOrderDetail(widget.billDetail.id).then((value) {
Navigator.pop(context);
if (value == true) {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => const ViewBillNew()));
}
});
}
void ontapCancelDelete() {
Navigator.pop(context);
}
void changeOrderDetail(
BuildContext context,
String id,
int initialValue,
String notes,
) {
Api.changeOrderDetail(
context,
id,
initialValue,
notes,
);
// Api.deleteOrderDetail(widget.billDetail.id).then((value) {
// Navigator.pop(context);
// if (value == true) {
// Navigator.pushReplacement(
// context, MaterialPageRoute(builder: (_) => const ViewBill()));
// }
// });
}
late int initialValue;
late int amount;
late int amountPeritem;
late String noteDetail;
final noteController = TextEditingController();
@override
void initState() {
//** intial value for quantity order */
initialValue = widget.billDetail.quantity;
var perItem =
amountParseToInt(widget.billDetail.total) / widget.billDetail.quantity;
amountPeritem = perItem.toInt();
amount = amountPeritem * widget.billDetail.quantity;
//** intial value for quantity order */
noteDetail = widget.billDetail.notes;
super.initState();
}
@override
void dispose() {
noteController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
double paddingLeftRightBill = 32;
return Container(
// padding: const EdgeInsets.symmetric(horizontal: 32),
margin: EdgeInsets.only(
top: 18,
bottom: (widget.lastItem) ? 11 : 0,
),
width: double.infinity,
// color: Colors.blue,
child: Column(
children: [
Container(
width: double.infinity,
// color: Colors.red,
child: Column(
children: [
Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill,
right: paddingLeftRightBill),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Image(
width: 52,
height: 52,
image: NetworkImage(
widget.billDetail.imageUrl,
),
),
),
const SizedBox(
width: 8,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
widget.billDetail.menuName,
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: menuNameListViewBill(),
),
(widget.billDetail.notes != '')
? defaultText(
context,
'Catatan: ${widget.billDetail.notes}',
style: descriptionListViewBill(),
)
: const SizedBox(),
const SizedBox(
height: 9,
),
defaultText(
context,
'Rp ${formatNumber().format(amountParseToInt(widget.billDetail.price))}',
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
),
)
],
))
],
),
),
],
),
),
Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill, right: paddingLeftRightBill),
child: const Divider(
thickness: 1,
color: dividerGrey,
),
),
const SizedBox(
height: 11,
),
Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill, right: paddingLeftRightBill),
child: Row(
children: [
GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
showModalBottomSheet(
backgroundColor: backgroundColor,
isScrollControlled: true,
context: context,
builder: (context) {
return NoteModalBottomSheet(
noteController: noteController,
initialValue: initialValue,
orderVariants: const [],
menuItem: FilterMenu(
id: '',
name: '',
price: '',
originalPrice: '',
imageUrlMedium: '',
imageUrlThumbnail: '',
isSell: false,
type: typeMenu,
categoryName: '',
categoryId: '',
description: '',
groupName: '',
groupId: ''),
lisrOrders: const [],
from: fromBill,
idOrderan: widget.billDetail.id,
noteInit: widget.billDetail.notes,
contextFrom: context,
);
},
);
},
child: Container(
height: 30,
width: 98,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21),
color: buttonColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Image(
height: 16,
width: 16,
image: AssetImage('assets/icons/note.png'),
),
const SizedBox(
width: 10,
),
Container(
height: 16,
child: Center(
child: defaultText(
context,
(widget.billDetail.notes != '')
? 'Ubah'
: 'Catatan',
style: noteViewBill(
color: textInButton,
),
),
),
)
],
),
),
),
const Spacer(),
Stack(
children: [
Container(
width: 94,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: backgroundColor,
),
child: Center(
child: defaultText(
context,
widget.billDetail.quantity.toString(),
style: amountViewBillButton(),
),
),
),
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
if (initialValue > 1) {
setState(() {
initialValue -= 1;
amount = initialValue * amountPeritem;
});
changeOrderDetail(context, widget.billDetail.id,
initialValue, widget.billDetail.notes);
} else {
deleteOrder(context, widget.billDetail.menuName,
ontapOkDelete, ontapCancelDelete);
}
},
child: Container(
width: 22,
height: 22,
child: Image(
color: buttonColor,
image: const AssetImage(
'assets/icons/minus-blue.png'),
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
setState(() {
initialValue += 1;
amount = initialValue * amountPeritem;
});
// await Api.changeOrderDetail(
// context,
// widget.billDetail.id,
// initialValue,
// widget.billDetail.notes,
// );
changeOrderDetail(context, widget.billDetail.id,
initialValue, widget.billDetail.notes);
},
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage('assets/icons/plus.png'),
),
),
),
)
],
),
const SizedBox(
width: 12,
)
],
),
),
(widget.lastItem)
? const SizedBox(
height: 11,
)
: const SizedBox(),
(widget.lastItem)
? const Divider(
thickness: 1,
color: dividerGrey,
)
: const SizedBox()
],
));
}
Future<dynamic> deleteOrder(BuildContext context, String menuName,
void Function() ontapOkDelete, void Function() ontapCancelDelete) {
return buttonDialogGlobal(
context,
'Konfirmasi Delete Order',
'Yakin menghapus orderan $menuName ?',
'Hapus',
'Batal',
ontapOkDelete,
ontapCancelDelete,
okButtonColor: buttonColor,
cancelButtonColor: cancelColorButton,
);
}
}
import 'package:flutter/material.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../../models/bill.dart';
class RincianPembayaran extends StatelessWidget {
const RincianPembayaran({
Key? key,
required this.dataBill,
required this.totalDiscount,
required this.outStandingAll,
}) : super(key: key);
final List<Bill> dataBill;
final int totalDiscount;
final int outStandingAll;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
vertical: 16,
),
height: 209,
// color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
'Rincian Pembayaran',
style: rincianPembayaran(font: 14),
),
const SizedBox(
height: 20,
),
const Divider(
thickness: 0.3,
color: dividerGrey,
),
Row(
children: [
defaultText(
context,
'Subtotal',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
const Spacer(),
defaultText(
context,
'Rp ${formatNumber().format(amountParseToInt(dataBill[0].subTotalSeluruhOrderan))}',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
],
),
const SizedBox(
height: 8,
),
Row(
children: [
defaultText(
context,
'Discount',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
const Spacer(),
defaultText(
context,
(totalDiscount == 0)
? '-'
: 'Rp ${formatNumber().format(totalDiscount)}',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
],
),
const SizedBox(
height: 8,
),
Row(
children: [
defaultText(
context,
'Total',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
const Spacer(),
defaultText(
context,
'Rp ${formatNumber().format(amountParseToInt(dataBill[0].totalSeluruhOrderan))}',
style: rincianPembayaran(
font: 12,
color: textGreyBill,
),
),
],
),
const SizedBox(
height: 8,
),
const Divider(
thickness: 0.3,
color: dividerGrey,
),
const SizedBox(
height: 8,
),
Row(
children: [
defaultText(
context,
'Unpaid',
style: rincianPembayaran(
font: 12,
),
),
const Spacer(),
defaultText(
context,
(outStandingAll == 0)
? '-'
: 'Rp ${formatNumber().format(outStandingAll)}',
style: rincianPembayaran(
font: 12,
),
),
],
),
],
),
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:uuid/uuid.dart';
import '../../api/api.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart';
import '../../bloc/view_bill.dart';
import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/emoticon_rate.dart';
import '../../main.dart';
import '../../models/bill.dart';
import '../../models/bill_detail.dart';
import '../build_version.dart';
import '../history_order/history.dart';
import '../home/new_home2.dart';
import 'app_bar.dart';
import 'list_order.dart';
import 'rincian_pembayaran.dart';
import 'shimmer_bill.dart';
class ViewBillNew extends StatelessWidget {
// const ViewBillNew({Key? key}) : super(key: key);
final bool isHistory;
final String sessionId;
final String branchCode;
final String brandCodeH;
final String tableNumberH;
final String token;
final String userName;
const ViewBillNew({
Key? key,
this.isHistory = false,
this.sessionId = '',
this.branchCode = '',
this.brandCodeH = '',
this.tableNumberH = '',
this.token = '',
this.userName = '',
}) : super(key: key);
// final RefreshController _refreshController =
// RefreshController(initialRefresh: false);
void saveBillDetail(List<Bill> dataBill) async {
await prefs.setString('total_order', dataBill[0].totalSeluruhOrderan);
await prefs.setString('date_order', dataBill[0].dateOrder);
}
@override
Widget build(BuildContext context) {
context.read<FeedBackOptionBloc>().getOptionFeedback();
context.read<ViewBillBloc>().backToDefault();
if (!isHistory) {
context.read<ViewBillBloc>().getBill();
} else {
context.read<ViewBillBloc>().getBill(
sessionIdH: sessionId,
branchCodeH: brandCodeH,
brandCodeH: brandCodeH,
tableNumberH: tableNumberH,
tokenH: token,
userNameH: userName,
);
}
double widthScreen = responsiveWidthScreen(context);
double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
double currentScreen = MediaQuery.of(context).size.width;
//**UUID */
const uuidInit = Uuid();
var uuid = uuidInit.v4();
//** UUID */
String branchCode = prefs.getString("outlet") ?? '';
String brandCode = prefs.getString("brand") ?? '';
String tableNumber = prefs.getString("table_number") ?? '';
String role = prefs.getString("role") ?? '';
String customerName = prefs.getString("userName") ?? '';
String cashierName = prefs.getString("cashier_name") ?? '';
// String token = prefs.getString("token") ?? '';
String sessionID = prefs.getString("sessionId") ?? uuid;
int tableMode = prefs.getInt('table_mode') ?? defaultTable;
List<String> historyOrder = prefs.getStringList('list_history') ?? [];
return SafeArea(
child: Scaffold(
backgroundColor: backgroundWhite,
body: BlocBuilder<ViewBillBloc, List<Bill>>(
builder: (ctxViewBill, dataBill) {
if (dataBill.isNotEmpty) {
if (dataBill[0].id == defaultViewBill) {
return ScreenResponsive(
// widget: waitingBill(
// context,
// widthScreen,
// maxWidthScreen,
// ),
widget: ShimmerBill(
widthScreen: widthScreen,
maxWidthScreen: maxWidthScreen,
context: context,
),
widthScreen: currentScreen,
isCoreLayout: true,
);
} else {
saveBillDetail(dataBill);
int totalService = 0;
int totalServiceTax = 0;
int individuTotalPayment = 0;
int individuPaymentPaid = 0;
int outStandingIndividu = 0;
int allPaymentPaid = 0;
int outStandingAll = 0;
int totalDiscount = 0;
bool isIndividuHaveWaitingPayment = false;
String paymentToRedirect = '';
String paymentId = '';
// check payment pending ketika table di lock backend
bool isStillHavePaymentPending = false;
if (dataBill.isNotEmpty) {
int indexWherePendingPayment = dataBill[0]
.paymentList
.indexWhere((element) => element.isApproved == false);
if (indexWherePendingPayment != -1) {
isStillHavePaymentPending = true;
}
//service and servicetax
totalService = amountParseToInt(dataBill[0].totalService);
totalServiceTax =
amountParseToInt(dataBill[0].totalServiceTax);
for (var x in dataBill) {
if (x.customerName == customerName) {
individuTotalPayment = x.totalPerCustomer;
}
//service and tax
// for (var bd in x.billDetail) {
// totalService += amountParseToInt(bd.service);
// totalServiceTax += amountParseToInt(bd.serviceTax);
// }
}
if (dataBill[0].paymentList.isNotEmpty) {
for (var p in dataBill[0].paymentList) {
// if (p.isApproved && p.customerNamePay == customerName) {
// individuPaymentPaid += amountParseToInt(p.amount);
// }
if (p.isApproved) {
allPaymentPaid += amountParseToInt(p.amount);
}
if (!p.isApproved) {
if (p.paymentUrl != '' &&
p.customerNamePay == customerName) {
isIndividuHaveWaitingPayment = true;
paymentToRedirect = p.paymentUrl;
paymentId = p.id;
}
}
}
}
outStandingAll = amountParseToInt(dataBill[0].outStandingPay);
totalDiscount = amountParseToInt(dataBill[0].discountTotal);
outStandingIndividu =
amountParseToInt(dataBill[0].outStandingIndividu);
}
void ontapOkAfterCashier() async {
Api.addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCash,
fullPayment,
'',
outStandingAll,
).then((value) {
if (value == 'OK') {
ratingModal(
context,
dataBill,
isHistory,
sessionID: sessionId,
);
}
});
Navigator.pop(context);
// Navigator.push(context,
// MaterialPageRoute(builder: (_) => FinishOrder()));
}
void ontapCancelAfterCashier() {
Navigator.pop(context);
}
void onTapCashier() {
String title;
String description;
String textOnOk = 'OK';
String textOnCancel = 'Batal';
// if (outStandingAll > 0) {
// Navigator.pop(context);
title = 'Tutup Pesanan';
description = '''
Selesaikan transaksi dan tutup pesanan ?
Mohon menuju kasir untuk meminta bukti pembayaran''';
// } else {
// // // Navigator.pop(context);
// // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar');
// title = 'Tutup Pesanan & Minta Bill';
// description =
// 'Transaksi akan ditutup dan silakan meminta bill di kasir';
// }
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkAfterCashier,
ontapCancelAfterCashier,
okButtonColor: buttonColor,
cancelButtonColor: cancelColorButton,
);
}
return ScreenResponsive(
widget: CoreBill(
widthScreen: widthScreen,
dataBill: dataBill,
outStandingAll: outStandingAll,
totalDiscount: totalDiscount,
isHistory: isHistory,
),
widthScreen: MediaQuery.of(context).size.width,
isCoreLayout: true,
);
}
} else {
return ScreenResponsive(
widget: emptyBill(
widthScreen,
maxWidthScreen,
historyOrder,
context,
),
widthScreen: currentScreen,
isCoreLayout: true,
);
}
},
),
),
);
}
Future<dynamic> ratingModal(
BuildContext context, List<Bill> dataBill, bool isHistory,
{String sessionID = ''}) {
return showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di excelso ?',
style: textStyleNormalFont(context),
),
content: EmoticonRate(
bill: dataBill[0],
isHistory: isHistory,
sessionId: sessionID,
),
),
);
}
Container emptyBill(double widthScreen, double maxWidthScreen,
List<String> historyOrder, BuildContext context) {
String branchCode = prefs.getString('outlet') ?? '';
String tableNumber = prefs.getString('table_number') ?? '';
String brandCode = prefs.getString('brand') ?? '';
String role = prefs.getString('role') ?? '';
String cashierName = prefs.getString('cashier_name') ?? '';
String sessionID = prefs.getString('sessionId') ?? '';
return Container(
padding:
EdgeInsets.only(left: widthScreen * 0.01, right: widthScreen * 0.01),
width: (widthScreen > maxWidthScreen) ? maxWidthScreen : widthScreen,
// color: Colors.red,
child: SingleChildScrollView(
child: Stack(
children: [
Column(
children: [
CustomAppBar(
isHistory: isHistory,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.92,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Icon(
// Icons.assignment,
// size: 80,
// color: buttonColor,
// ),
fontAwesome(
context,
listPesanan,
listPesananSizeViewBill,
color: buttonColor,
),
defaultText(
context,
"Belum Ada Orderan",
textAlign: TextAlign.center,
style: textStyleMenuList(context),
),
(historyOrder.isNotEmpty)
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
context.read<BranchExist>().branchExist(
branchCode,
brandCode,
role,
cashierName,
sessionID,
);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()));
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: widthScreen * 0.02,
vertical:
MediaQuery.of(context).size.height *
0.01,
),
margin: EdgeInsets.symmetric(
vertical:
MediaQuery.of(context).size.height *
0.01),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
roundedSmallButton),
color: buttonColor,
),
child: defaultText(
context,
'Buat Pesanan Baru',
textAlign: TextAlign.center,
maxLines: 2,
style: textStyleTambahPesanan(context),
),
),
),
(historyOrder.isNotEmpty)
? SizedBox(
width: widthScreen * 0.01,
)
: const SizedBox(),
(historyOrder.isNotEmpty)
? GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => HistoryOrder(
historyOrder: historyOrder,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: widthScreen * 0.02,
vertical: MediaQuery.of(context)
.size
.height *
0.01,
),
margin: EdgeInsets.symmetric(
vertical: MediaQuery.of(context)
.size
.height *
0.01),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
roundedSmallButton),
color: buttonColor,
),
child: defaultText(
context,
'Lihat Transaksi Terakhir',
textAlign: TextAlign.center,
maxLines: 2,
style:
textStyleTambahPesanan(context),
),
),
)
: const SizedBox()
],
)
: const SizedBox()
],
),
)
],
),
Positioned(
bottom: 10,
child: Container(
width: widthScreen,
child: const BuildVersion(),
),
)
],
),
),
);
}
}
class CoreBill extends StatelessWidget {
const CoreBill({
Key? key,
required this.widthScreen,
required this.dataBill,
required this.outStandingAll,
required this.totalDiscount,
required this.isHistory,
}) : super(key: key);
final double widthScreen;
final List<Bill> dataBill;
final int outStandingAll;
final int totalDiscount;
final bool isHistory;
@override
Widget build(BuildContext context) {
return Container(
width: widthScreen,
// padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(
isHistory: isHistory,
),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(context, 'Meja ${dataBill[0].tableName}',
style: viewbillStyle())),
Container(
padding:
const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: defaultText(context, dataBill[0].customerName,
style: customerNameViewbill()),
),
const SizedBox(
height: 18,
),
const Divider(
color: backgroundColor,
thickness: 24,
),
const SizedBox(
height: 16,
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: defaultText(
context,
'Daftar Order',
style: viewbillStyle(
font: 14,
fontWeight: FontWeight.w600,
),
),
),
ListOrder(
billDetail: dataBill[0].billDetail,
),
const SizedBox(
height: 11,
),
const Divider(
color: backgroundColor,
thickness: 24,
),
const AddMoreOrder(),
const Divider(
color: backgroundColor,
thickness: 24,
),
RincianPembayaran(
dataBill: dataBill,
totalDiscount: totalDiscount,
outStandingAll: outStandingAll,
),
const Divider(
color: backgroundColor,
thickness: 24,
),
],
),
))
],
),
);
}
}
class AddMoreOrder extends StatelessWidget {
const AddMoreOrder({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 80,
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
// color: Colors.red,
child: Row(
children: [
Expanded(
child: defaultText(
context,
'Apakah anda masih ingin memesan ?',
style: viewbillStyle(
font: 16,
fontWeight: FontWeight.w400,
),
),
),
const SizedBox(
width: 19,
),
GestureDetector(
onTap: () {
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,
),
),
),
),
)
],
),
);
}
}
......@@ -261,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.3"
pull_to_refresh:
dependency: "direct main"
description:
name: pull_to_refresh
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
scrollable_positioned_list:
dependency: "direct main"
description:
......@@ -336,6 +343,13 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
sliver_tools:
dependency: "direct main"
description:
name: sliver_tools
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.8"
source_span:
dependency: transitive
description:
......
......@@ -34,6 +34,7 @@ dependencies:
http: ^0.13.4
intl: ^0.17.0
loading_animations: ^2.2.0
pull_to_refresh: ^2.0.0
scrollable_positioned_list: ^0.3.4
shared_preferences: ^2.0.15
shimmer: ^2.0.0
......
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