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

viewbill new pge

parent 4dcaa98f
...@@ -77,7 +77,10 @@ class Api { ...@@ -77,7 +77,10 @@ class Api {
"table": tableNumber, "table": tableNumber,
"user_name": userName, "user_name": userName,
"total_order": totalOrder, "total_order": totalOrder,
"date_order": dateOrder, "date_order": localDate(
dateOrder,
isHistory: true,
),
"branch_code": branchCode, "branch_code": branchCode,
"brand": brandCode, "brand": brandCode,
"token": token, "token": token,
...@@ -88,6 +91,8 @@ class Api { ...@@ -88,6 +91,8 @@ class Api {
} }
await prefs.setString('sessionId', jsonObject['data']['session_id']); await prefs.setString('sessionId', jsonObject['data']['session_id']);
await prefs.setInt('table_mode', jsonObject['data']['table_mode']); await prefs.setInt('table_mode', jsonObject['data']['table_mode']);
await prefs.setString('logoUrl', jsonObject['data']['image']);
//** save sessionID and Table Mode */ //** save sessionID and Table Mode */
// return jsonObject['data']['name']; // return jsonObject['data']['name'];
......
import 'package:flutter_bloc/flutter_bloc.dart';
class SearchHistory extends Cubit<List<String>> {
SearchHistory() : super(['start']);
void search(List<String> historyOrder, String keyword) {
if (keyword == '') {
emit(historyOrder);
} else {
List<String> result = [];
for (var history in historyOrder) {
if (history.toLowerCase().contains(keyword.toLowerCase())) {
result.add(history);
}
}
emit(result);
}
}
}
...@@ -229,7 +229,7 @@ String localDate(String date, {isHistory = false}) { ...@@ -229,7 +229,7 @@ String localDate(String date, {isHistory = false}) {
} }
break; break;
} }
return "$day $resultMonth $year"; return "$day-$resultMonth-$year";
} }
//** convert UTC to local */ //** convert UTC to local */
...@@ -242,6 +242,12 @@ String localDate(String date, {isHistory = false}) { ...@@ -242,6 +242,12 @@ String localDate(String date, {isHistory = false}) {
double heightTombol = 0.06; // untuk dikalikan di height media query double heightTombol = 0.06; // untuk dikalikan di height media query
//**Height tombol */ //**Height tombol */
//** kalkulasi pixel dihome */
double imageHeight = 96;
double heighScrollWithImage = 371 + imageHeight;
double heighScrollWithOutImage = 371;
//** */
//** core warna */ //** core warna */
// const Color backgroundColor = Colors.white; // const Color backgroundColor = Colors.white;
const Color backgroundColor = Color(0xffF4F4F4); const Color backgroundColor = Color(0xffF4F4F4);
...@@ -484,6 +490,9 @@ const double backIconSize = 0.03; ...@@ -484,6 +490,9 @@ const double backIconSize = 0.03;
const String arrowBack = '\uf060'; const String arrowBack = '\uf060';
const double arrowBackSize = 17; const double arrowBackSize = 17;
const String arrowNext = '\uf105';
const double arrowNextSize = 14;
const String shopingBag = '\uf290'; const String shopingBag = '\uf290';
const double shopingBagSize = 0.03; const double shopingBagSize = 0.03;
......
...@@ -15,7 +15,6 @@ Future<dynamic> buttonDialogGlobal( ...@@ -15,7 +15,6 @@ Future<dynamic> buttonDialogGlobal(
void Function() ontapCancel, void Function() ontapCancel,
{Color okButtonColor = Colors.indigo, {Color okButtonColor = Colors.indigo,
Color cancelButtonColor = Colors.red}) { Color cancelButtonColor = Colors.red}) {
double widthScreen = responsiveWidthScreen(context);
return showDialog( return showDialog(
context: context, context: context,
builder: (BuildContext context) => AlertDialog( builder: (BuildContext context) => AlertDialog(
...@@ -29,108 +28,65 @@ Future<dynamic> buttonDialogGlobal( ...@@ -29,108 +28,65 @@ Future<dynamic> buttonDialogGlobal(
title, title,
// style: textStyleNormalFont(context), // style: textStyleNormalFont(context),
), ),
content: SizedBox( content: Column(
height: MediaQuery.of(context).size.height * 0.38, mainAxisSize: MainAxisSize.min,
width: widthScreen * widhtDialog, children: [
child: Column( Align(
children: [ alignment: Alignment.topLeft,
Container( child: defaultText(
height: MediaQuery.of(context).size.height * 0.2, context,
child: Align( description,
alignment: Alignment.topLeft, style: textStyleNormalFont(context),
// child: Text( ),
// description, ),
// textScaleFactor: textScaleFactor, const SizedBox(height: 10),
// style: textStyleNormalFont(context), GestureDetector(
// // style: TextStyle( onTap: () {
// // fontWeight: FontWeight.w400, ontapOk();
// // fontSize: },
// // MediaQuery.of(context).size.height * normalFont), child: Container(
// ), width: double.infinity,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: okButtonColor),
child: Center(
child: defaultText( child: defaultText(
context, context,
description, textOnOk,
style: textStyleNormalFont(context), style: textStyleNormalFont(
),
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.01),
GestureDetector(
onTap: () {
ontapOk();
},
child: Container(
height: MediaQuery.of(context).size.height * heightTombol,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton),
color: okButtonColor),
child: Align(
// child: Text(
// textOnOk,
// textScaleFactor: textScaleFactor,
// // style: TextStyle(
// // fontWeight: FontWeight.w500,
// // fontSize:
// // MediaQuery.of(context).size.height * normalFont,
// // color: textInButton,
// // ),
// style: textStyleNormalFont(
// context,
// color: textInButton,
// ),
// ),
child: defaultText(
context, context,
textOnOk, color: textInButton,
style: textStyleNormalFont(
context,
color: textInButton,
),
), ),
), ),
), ),
), ),
SizedBox( ),
height: MediaQuery.of(context).size.height * 0.02, const SizedBox(height: 10),
), GestureDetector(
GestureDetector( onTap: () {
onTap: () { ontapCancel();
ontapCancel(); },
}, child: Container(
child: Container( width: double.infinity,
height: MediaQuery.of(context).size.height * heightTombol, height: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButton), borderRadius: BorderRadius.circular(roundedButton),
color: Colors.transparent, color: Colors.transparent,
), ),
child: Align( child: Center(
// child: Text( child: defaultText(
// textOnCancel, context,
// textScaleFactor: textScaleFactor, textOnCancel,
// // style: TextStyle( style: textStyleNormalFont(
// // fontWeight: FontWeight.w500,
// // fontSize:
// // MediaQuery.of(context).size.height * normalFont,
// // color: textInButton,
// // ),
// style: textStyleNormalFont(
// context,
// color: textInButton,
// ),
// ),
child: defaultText(
context, context,
textOnCancel, color: textCancelColor,
style: textStyleNormalFont(
context,
color: textCancelColor,
),
), ),
), ),
), ),
) ),
], )
), ],
), ),
)); ));
} }
...@@ -74,6 +74,7 @@ class EmoticonRateNew extends StatelessWidget { ...@@ -74,6 +74,7 @@ class EmoticonRateNew extends StatelessWidget {
defaultText( defaultText(
context, context,
'Bagaimana pengalaman anda bertransaksi di excelso ?', 'Bagaimana pengalaman anda bertransaksi di excelso ?',
textAlign: TextAlign.center,
style: emojiStyle(), style: emojiStyle(),
), ),
const SizedBox( const SizedBox(
......
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart';
import '../helper.dart';
class PlusMinusButton extends StatelessWidget {
const PlusMinusButton({
Key? key,
required this.initialValue,
required this.minus,
required this.plus,
this.backgroundAmountColor = backgroundColor,
this.isFromVariant = false,
this.widthInitialValue = 94,
}) : super(key: key);
final int initialValue;
final void Function() minus;
final void Function() plus;
final Color backgroundAmountColor;
final bool isFromVariant;
final double widthInitialValue;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
width: widthInitialValue,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: backgroundAmountColor,
),
child: Center(
child: defaultText(
context,
initialValue.toString(),
style: amountViewBillButton(),
),
),
),
Positioned(
left: 0,
child: GestureDetector(
onTap: () {
// if (initialValue > 1) {
// initialValue += -1;
// context
// .read<OrderVariantTemporaryBloc>()
// .insertDataVariant(itemId, satuanPrice,
// initialValue, []);
// }
minus();
},
child: Container(
width: 22,
height: 22,
child: Image(
image: AssetImage((initialValue < 2 && isFromVariant)
? 'assets/icons/minus.png'
: 'assets/icons/minus-blue.png'),
),
),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
// initialValue += 1;
// context
// .read<OrderVariantTemporaryBloc>()
// .insertDataVariant(
// itemId, satuanPrice, initialValue, []);
plus();
},
child: Container(
width: 22,
height: 22,
child: const Image(
image: AssetImage('assets/icons/plus.png'),
),
),
),
)
],
);
}
}
...@@ -46,6 +46,19 @@ TextStyle emojiStyle({ ...@@ -46,6 +46,19 @@ TextStyle emojiStyle({
); );
} }
TextStyle historyOrderStyle({
font = 12,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w400,
}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle appBarNameViewBill({font = 17, Color color = textColorBlack}) { TextStyle appBarNameViewBill({font = 17, Color color = textColorBlack}) {
return TextStyle( return TextStyle(
fontFamily: 'Mulish', fontFamily: 'Mulish',
...@@ -281,7 +294,7 @@ TextStyle rincianPembayaran({ ...@@ -281,7 +294,7 @@ TextStyle rincianPembayaran({
FontStyle? fontStyle, FontStyle? fontStyle,
}) { }) {
return TextStyle( return TextStyle(
fontFamily: 'OpenSans', fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font, fontSize: font,
fontWeight: fontWeight, fontWeight: fontWeight,
color: color, color: color,
......
...@@ -28,6 +28,7 @@ import 'bloc/order_detail_variant.dart'; ...@@ -28,6 +28,7 @@ import 'bloc/order_detail_variant.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 'bloc/search_active.dart'; import 'bloc/search_active.dart';
import 'bloc/search_history.dart';
import 'bloc/view_bill.dart'; import 'bloc/view_bill.dart';
import 'package:flutter/services.dart' as bundle_root; import 'package:flutter/services.dart' as bundle_root;
...@@ -158,6 +159,7 @@ class MyApp extends StatelessWidget { ...@@ -158,6 +159,7 @@ class MyApp extends StatelessWidget {
BlocProvider(create: (_) => FavSelectedBar()), BlocProvider(create: (_) => FavSelectedBar()),
BlocProvider(create: (_) => MenuSelectedBar()), BlocProvider(create: (_) => MenuSelectedBar()),
BlocProvider(create: (_) => SearchActive()), BlocProvider(create: (_) => SearchActive()),
BlocProvider(create: (_) => SearchHistory()),
], ],
child: MaterialApp( child: MaterialApp(
title: (title == null) ? defaultTitle : title, title: (title == null) ? defaultTitle : title,
......
// ignore_for_file: sized_box_for_whitespace
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/search_history.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
class CustomAppBar extends StatelessWidget {
CustomAppBar({
Key? key,
required this.historyOrder,
}) : super(key: key);
final List<String> historyOrder;
final _searchController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
color: backgroundWhite,
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: 15),
child: Column(
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
width: 24,
height: 24,
child: Center(
child: fontAwesomeNew(
arrowBack,
arrowBackSize,
),
),
),
),
const SizedBox(
width: 16,
),
Center(
child: defaultText(
context,
'Riwayat Transaksi',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(),
),
),
],
),
const SizedBox(
height: 16,
),
Container(
height: 36,
child: TextField(
controller: _searchController,
// autofocus: true,
onChanged: (sarchValue) {
context.read<SearchHistory>().search(
historyOrder,
_searchController.text,
);
},
key: const Key('SearchField'),
style: TextStyle(
color: Colors.black,
fontFamily: fontFamily,
fontSize: 15,
),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
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: September',
hintStyle: TextStyle(
color: Colors.grey.withOpacity(0.8),
fontFamily: fontFamily,
fontSize: 10,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
),
),
),
),
],
),
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'dart:convert';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/history_order/app_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/search_history.dart';
import '../viewbill/view_bill_new.dart';
class HistoryOrderNew extends StatelessWidget {
const HistoryOrderNew({
super.key,
required this.historyOrder,
});
final List<String> historyOrder;
@override
Widget build(BuildContext context) {
return SafeArea(
child: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
child: Scaffold(
backgroundColor: backgroundColor,
body: Column(
children: [
CustomAppBar(
historyOrder: historyOrder,
),
const SizedBox(
height: 16,
),
BlocBuilder<SearchHistory, List<String>>(
builder: (ctxSearch, historyOrderSearch) {
List<String> historyOrderAfterSearch;
if (historyOrderSearch.isNotEmpty &&
historyOrderSearch[0] == 'start') {
historyOrderAfterSearch = historyOrder;
} else {
historyOrderAfterSearch = historyOrderSearch;
}
return Expanded(
child: ListView.builder(
itemCount: historyOrderAfterSearch.length,
itemBuilder: (ctxHistory, i) {
var jsonDecodeHistory = jsonDecode(
historyOrderAfterSearch[
historyOrderAfterSearch.length - (i + 1)]);
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ViewBillNew(
isHistory: true,
sessionId: jsonDecodeHistory['session'],
branchCodeH: jsonDecodeHistory['branch_code'],
brandCodeH: jsonDecodeHistory['brand'],
token: jsonDecodeHistory['token'],
userName: jsonDecodeHistory['user_name'],
),
),
);
},
child: Container(
margin: const EdgeInsets.only(
bottom: 8,
left: paddingLeftRight,
right: paddingLeftRight,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: backgroundWhite,
),
height: 72,
child: Container(
padding: const EdgeInsets.only(
left: 16,
right: 12,
bottom: 16,
top: 5,
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
defaultText(
context,
jsonDecodeHistory['user_name'],
style: historyOrderStyle(),
),
const SizedBox(
height: 4,
),
defaultText(
context,
"Rp ${formatNumber().format(amountParseToInt(jsonDecodeHistory['total_order']))}",
style: historyOrderStyle(),
)
],
),
),
Container(
width: 145,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
defaultText(
context,
(jsonDecodeHistory['date_order'] ==
null)
? ''
: jsonDecodeHistory['date_order'],
style: historyOrderStyle(
color: textGreyDeskripsi,
),
),
const SizedBox(
height: 15,
),
fontAwesomeNew(
arrowNext,
16,
)
],
),
)
],
),
),
),
);
},
),
);
},
)
],
),
),
));
}
}
...@@ -52,8 +52,8 @@ class _CategoryListHomeState extends State<CategoryListHome> { ...@@ -52,8 +52,8 @@ class _CategoryListHomeState extends State<CategoryListHome> {
.selectedBarMenu(i, widget.categoryList[i].id); .selectedBarMenu(i, widget.categoryList[i].id);
widget.scrollController.animateTo( widget.scrollController.animateTo(
(widget.favList.isNotEmpty) (widget.favList.isNotEmpty)
? 371 ? heighScrollWithImage
: 0, // 371 sudah dihituing pixelnya untuk awal banget dari menu item : imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
); );
......
// ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers // ignore_for_file: sized_box_for_whitespace, avoid_unnecessary_containers
import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.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';
...@@ -211,6 +212,54 @@ class FavGridMenu extends StatelessWidget { ...@@ -211,6 +212,54 @@ class FavGridMenu extends StatelessWidget {
} }
final noteController = TextEditingController( final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : ''); text: (indexListOrderan != -1) ? list[indexListOrderan].note : '');
void minus() {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (initialValue > 0) {
initialValue -= 1;
context.read<OrdersBloc>().insertData([
[
menuFav.id,
menuFav.name,
initialValue,
amountParseToInt(menuFav.price),
list,
menuFav.imageUrlMedium,
orderVariants,
amountParseToInt(menuFav.price),
(indexListOrderan != -1) ? list[indexListOrderan].note : ''
]
], context);
// setState(() {});
}
}
void plus() {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
initialValue += 1;
context.read<OrdersBloc>().insertData([
[
menuFav.id,
menuFav.name,
initialValue,
amountParseToInt(menuFav.price),
list,
menuFav.imageUrlMedium,
orderVariants,
amountParseToInt(menuFav.price),
(indexListOrderan != -1) ? list[indexListOrderan].note : '',
]
], context);
}
return AnimatedSwitcher( return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) { transitionBuilder: (Widget child, Animation<double> animation) {
...@@ -363,82 +412,89 @@ class FavGridMenu extends StatelessWidget { ...@@ -363,82 +412,89 @@ class FavGridMenu extends StatelessWidget {
const SizedBox( const SizedBox(
width: 5, width: 5,
), ),
GestureDetector( PlusMinusButton(
onTap: () { initialValue: initialValue,
FocusScopeNode currentFocus = FocusScope.of(context); minus: minus,
plus: plus,
backgroundAmountColor: backgroundWhite,
widthInitialValue: 86,
)
// GestureDetector(
// onTap: () {
// FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { // if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); // currentFocus.unfocus();
} // }
if (initialValue > 0) { // if (initialValue > 0) {
initialValue -= 1; // initialValue -= 1;
context.read<OrdersBloc>().insertData([ // context.read<OrdersBloc>().insertData([
[ // [
menuFav.id, // menuFav.id,
menuFav.name, // menuFav.name,
initialValue, // initialValue,
amountParseToInt(menuFav.price), // amountParseToInt(menuFav.price),
list, // list,
menuFav.imageUrlMedium, // menuFav.imageUrlMedium,
orderVariants, // orderVariants,
amountParseToInt(menuFav.price), // amountParseToInt(menuFav.price),
(indexListOrderan != -1) // (indexListOrderan != -1)
? list[indexListOrderan].note // ? list[indexListOrderan].note
: '' // : ''
] // ]
], context); // ], context);
// setState(() {}); // // setState(() {});
} // }
}, // },
child: Container( // child: Container(
width: 22, // width: 22,
height: 22, // height: 22,
child: const Image( // child: const Image(
image: AssetImage('assets/icons/minus-blue.png'), // image: AssetImage('assets/icons/minus-blue.png'),
), // ),
), // ),
), // ),
Expanded( // Expanded(
child: Center( // child: Center(
child: defaultText( // child: defaultText(
context, // context,
initialValue.toString(), // initialValue.toString(),
style: amountGridFav(), // style: amountGridFav(),
), // ),
), // ),
), // ),
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context); // FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { // if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); // currentFocus.unfocus();
} // }
initialValue += 1; // initialValue += 1;
context.read<OrdersBloc>().insertData([ // context.read<OrdersBloc>().insertData([
[ // [
menuFav.id, // menuFav.id,
menuFav.name, // menuFav.name,
initialValue, // initialValue,
amountParseToInt(menuFav.price), // amountParseToInt(menuFav.price),
list, // list,
menuFav.imageUrlMedium, // menuFav.imageUrlMedium,
orderVariants, // orderVariants,
amountParseToInt(menuFav.price), // amountParseToInt(menuFav.price),
(indexListOrderan != -1) // (indexListOrderan != -1)
? list[indexListOrderan].note // ? list[indexListOrderan].note
: '', // : '',
] // ]
], context); // ], context);
}, // },
child: Container( // child: Container(
width: 22, // width: 22,
height: 22, // height: 22,
child: const Image( // child: const Image(
image: AssetImage('assets/icons/plus.png'), // image: AssetImage('assets/icons/plus.png'),
), // ),
), // ),
) // )
], ],
), ),
), ),
......
// ignore_for_file: sized_box_for_whitespace // ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/order_bloc.dart'; import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/models/orders.dart'; import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/variant_cat.dart'; import 'package:byod/ui/home/variant_cat.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
...@@ -16,6 +17,7 @@ import '../../models/order_details.dart'; ...@@ -16,6 +17,7 @@ import '../../models/order_details.dart';
import '../../models/order_variants.dart'; import '../../models/order_variants.dart';
import 'bottom_sheet_menu_new.dart'; import 'bottom_sheet_menu_new.dart';
import 'bottom_sheet_variant.dart'; import 'bottom_sheet_variant.dart';
import 'variant_cat_new.dart';
class MenuListUtama extends StatelessWidget { class MenuListUtama extends StatelessWidget {
const MenuListUtama({ const MenuListUtama({
...@@ -213,6 +215,54 @@ class MenuListUtama extends StatelessWidget { ...@@ -213,6 +215,54 @@ class MenuListUtama extends StatelessWidget {
} }
final noteController = TextEditingController( final noteController = TextEditingController(
text: (indexListOrderan != -1) ? list[indexListOrderan].note : ''); text: (indexListOrderan != -1) ? list[indexListOrderan].note : '');
void minus() {
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(() {});
}
}
void plus() {
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);
}
return AnimatedSwitcher( return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) { transitionBuilder: (Widget child, Animation<double> animation) {
...@@ -245,38 +295,38 @@ class MenuListUtama extends StatelessWidget { ...@@ -245,38 +295,38 @@ class MenuListUtama extends StatelessWidget {
1, 1,
[], [],
); // check pada bloc untuk mengethui list arraynya ); // 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( // Navigator.push(
// context, // context,
// MaterialPageRoute( // MaterialPageRoute(
// builder: (_) => VariantCatNew( // builder: (_) => VariantCat(
// namaMenu: menuUtama.name,
// variantCategories: menuUtama.variantCat,
// initPrice: // initPrice:
// amountParseToInt(menuUtama.price), // amountParseToInt(menuUtama.price),
// variantCategories: menuUtama.variantCat, // idItem: menuUtama.id,
// namaMenu: menuUtama.name, // 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 { } else {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0), backgroundColor: Colors.white.withOpacity(0),
...@@ -389,107 +439,106 @@ class MenuListUtama extends StatelessWidget { ...@@ -389,107 +439,106 @@ class MenuListUtama extends StatelessWidget {
width: 5, width: 5,
), ),
Expanded( Expanded(
child: Container( child: PlusMinusButton(
height: 22, initialValue: initialValue,
decoration: BoxDecoration( plus: plus,
borderRadius: BorderRadius.circular(30), minus: minus,
color: Colors.white, backgroundAmountColor: backgroundWhite,
), ),
child: Stack( // child: Stack(
children: [ // children: [
Positioned( // Positioned(
left: 0, // left: 0,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
FocusScopeNode currentFocus = // FocusScopeNode currentFocus =
FocusScope.of(context); // FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { // if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); // currentFocus.unfocus();
} // }
if (initialValue > 0) { // if (initialValue > 0) {
initialValue -= 1; // initialValue -= 1;
context.read<OrdersBloc>().insertData([ // context.read<OrdersBloc>().insertData([
[ // [
menuUtama.id, // menuUtama.id,
menuUtama.name, // menuUtama.name,
initialValue, // initialValue,
amountParseToInt(menuUtama.price), // amountParseToInt(menuUtama.price),
list, // list,
menuUtama.imageUrlMedium, // menuUtama.imageUrlMedium,
orderVariants, // orderVariants,
amountParseToInt(menuUtama.price), // amountParseToInt(menuUtama.price),
(indexListOrderan != -1) // (indexListOrderan != -1)
? list[indexListOrderan].note // ? list[indexListOrderan].note
: '' // : ''
] // ]
], context); // ], context);
// setState(() {}); // // setState(() {});
} // }
}, // },
child: Container( // child: Container(
width: 22, // width: 22,
height: 22, // height: 22,
child: Image( // child: Image(
color: buttonColor, // color: buttonColor,
image: const AssetImage( // image: const AssetImage(
'assets/icons/minus-blue.png'), // 'assets/icons/minus-blue.png'),
), // ),
), // ),
), // ),
), // ),
Positioned( // Positioned(
right: 0, // right: 0,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
FocusScopeNode currentFocus = // FocusScopeNode currentFocus =
FocusScope.of(context); // FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { // if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); // currentFocus.unfocus();
} // }
initialValue += 1; // initialValue += 1;
context.read<OrdersBloc>().insertData([ // context.read<OrdersBloc>().insertData([
[ // [
menuUtama.id, // menuUtama.id,
menuUtama.name, // menuUtama.name,
initialValue, // initialValue,
amountParseToInt(menuUtama.price), // amountParseToInt(menuUtama.price),
list, // list,
menuUtama.imageUrlMedium, // menuUtama.imageUrlMedium,
orderVariants, // orderVariants,
amountParseToInt(menuUtama.price), // amountParseToInt(menuUtama.price),
(indexListOrderan != -1) // (indexListOrderan != -1)
? list[indexListOrderan].note // ? list[indexListOrderan].note
: '', // : '',
] // ]
], context); // ], context);
}, // },
child: Container( // child: Container(
width: 22, // width: 22,
height: 22, // height: 22,
child: const Image( // child: const Image(
image: // image:
AssetImage('assets/icons/plus.png'), // AssetImage('assets/icons/plus.png'),
), // ),
), // ),
), // ),
), // ),
Center( // Center(
child: Container( // child: Container(
height: 22, // height: 22,
child: Center( // child: Center(
child: defaultText( // child: defaultText(
context, // context,
initialValue.toString(), // initialValue.toString(),
style: amountGridFav(), // style: amountGridFav(),
), // ),
), // ),
), // ),
), // ),
], // ],
), // ),
),
), ),
], ],
), ),
......
...@@ -591,35 +591,83 @@ class _NewHome2State extends State<NewHome2> { ...@@ -591,35 +591,83 @@ class _NewHome2State extends State<NewHome2> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
customAppBar( // customAppBar(
context, // context,
paddingLeftRight, // paddingLeftRight,
appBarHeight, // appBarHeight,
tableNumber, // tableNumber,
userName, // userName,
isSearchActive, // isSearchActive,
), // ),
SizedBox( // SizedBox(
height: (isSearchActive) ? 16 : 20, // height: (isSearchActive) ? 16 : 20,
), // ),
AnimatedSwitcher( // AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime), // duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) { // transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child); // return ScaleTransition(scale: animation, child: child);
}, // },
child: (isSearchActive) // child: (isSearchActive)
? searchField( // ? searchField(
searchFieldHeight, // searchFieldHeight,
categoryNonFav, // categoryNonFav,
) // )
: const SizedBox( // : const SizedBox(
key: Key('SearchField'), // key: Key('SearchField'),
), // ),
), // ),
Expanded( Expanded(
child: CustomScrollView( child: CustomScrollView(
controller: _scrollController, controller: _scrollController,
slivers: [ slivers: [
SliverToBoxAdapter(
child: Container(
padding: const EdgeInsets.only(
top: 16,
),
child: Row(
children: [
const Spacer(),
Container(
width: 209,
height: 80,
child: const Image(
width: 209,
height: 80,
fit: BoxFit.fill,
image: AssetImage('assets/emoji/excelso.png'),
),
),
const Spacer(),
],
),
),
),
SliverPersistentHeader(
pinned: true,
delegate: DelegateAppBar(
appBarHeight + searchFieldHeight,
customAppBar(
context,
paddingLeftRight,
appBarHeight + searchFieldHeight,
tableNumber,
userName,
isSearchActive,
),
),
),
SliverPersistentHeader(
pinned: true,
delegate: DelegateSearchField(
isSearchActive,
searchFieldHeight,
searchField(
searchFieldHeight,
categoryNonFav,
),
),
),
SliverToBoxAdapter( SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
height: (isSearchActive) ? spacerHeight : 0, height: (isSearchActive) ? spacerHeight : 0,
...@@ -792,10 +840,12 @@ class _NewHome2State extends State<NewHome2> { ...@@ -792,10 +840,12 @@ class _NewHome2State extends State<NewHome2> {
Container searchField( Container searchField(
double searchFieldHeight, List<FilterMenu> categoryNonFav) { double searchFieldHeight, List<FilterMenu> categoryNonFav) {
return Container( return Container(
margin: const EdgeInsets.only(bottom: 5), padding: const EdgeInsets.only(bottom: 10),
height: searchFieldHeight, height: searchFieldHeight,
color: backgroundColor,
child: TextField( child: TextField(
autofocus: true, autofocus: true,
textAlignVertical: TextAlignVertical.center,
onChanged: (sarchValue) { onChanged: (sarchValue) {
context.read<SearchMenu>().searchMenu( context.read<SearchMenu>().searchMenu(
categoryNonFav, categoryNonFav,
...@@ -812,6 +862,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -812,6 +862,7 @@ class _NewHome2State extends State<NewHome2> {
decoration: InputDecoration( decoration: InputDecoration(
filled: true, filled: true,
fillColor: Colors.white, fillColor: Colors.white,
contentPadding: EdgeInsets.zero,
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
width: 1, width: 1,
...@@ -1080,8 +1131,9 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1080,8 +1131,9 @@ class _NewHome2State extends State<NewHome2> {
barName = "Meja $tableNumber"; barName = "Meja $tableNumber";
} }
return Container( return Container(
margin: const EdgeInsets.only(top: 24), padding: const EdgeInsets.only(top: 10),
height: appBarHeight, height: appBarHeight,
color: backgroundColor,
child: Row( child: Row(
children: [ children: [
defaultText( defaultText(
...@@ -1101,8 +1153,8 @@ class _NewHome2State extends State<NewHome2> { ...@@ -1101,8 +1153,8 @@ class _NewHome2State extends State<NewHome2> {
); );
_scrollController.animateTo( _scrollController.animateTo(
(favList.isNotEmpty) (favList.isNotEmpty)
? 371 ? heighScrollWithImage
: 0, // 371 sudah dihituing pixelnya untuk awal banget dari menu item : imageHeight, // 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
); );
...@@ -1197,6 +1249,65 @@ class Delegate extends SliverPersistentHeaderDelegate { ...@@ -1197,6 +1249,65 @@ class Delegate extends SliverPersistentHeaderDelegate {
} }
} }
class DelegateAppBar extends SliverPersistentHeaderDelegate {
final double appBarHeight;
final Widget customAppBar;
DelegateAppBar(
this.appBarHeight,
this.customAppBar,
);
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return customAppBar;
}
@override
double get maxExtent => appBarHeight;
@override
double get minExtent => appBarHeight;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
}
class DelegateSearchField extends SliverPersistentHeaderDelegate {
final bool isSearchActive;
final double searchFieldHeight;
final Widget searchField;
DelegateSearchField(
this.isSearchActive, this.searchFieldHeight, this.searchField);
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return AnimatedSwitcher(
duration: Duration(milliseconds: animatedTime),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(scale: animation, child: child);
},
child: (isSearchActive)
? searchField
: const SizedBox(
key: Key('SearchField'),
),
);
}
@override
double get maxExtent => (isSearchActive) ? searchFieldHeight : 0;
@override
double get minExtent => (isSearchActive) ? searchFieldHeight : 0;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
}
class CustomClipPath extends CustomClipper<Path> { class CustomClipPath extends CustomClipper<Path> {
@override @override
Path getClip(Size size) { Path getClip(Size size) {
......
...@@ -4,11 +4,15 @@ import 'package:byod/helper/helper.dart'; ...@@ -4,11 +4,15 @@ import 'package:byod/helper/helper.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:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.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 '../../main.dart'; import '../../main.dart';
import '../../models/order_variants.dart';
import '../../models/variant_categories.dart'; import '../../models/variant_categories.dart';
class VariantCatNew extends StatefulWidget { class VariantCatNew extends StatefulWidget {
...@@ -48,7 +52,7 @@ class _VariantCatNewState extends State<VariantCatNew> { ...@@ -48,7 +52,7 @@ class _VariantCatNewState extends State<VariantCatNew> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
// double widthScreen = responsiveWidthScreen(context); double widthScreen = responsiveWidthScreen(context);
return SafeArea( return SafeArea(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
...@@ -58,215 +62,363 @@ class _VariantCatNewState extends State<VariantCatNew> { ...@@ -58,215 +62,363 @@ class _VariantCatNewState extends State<VariantCatNew> {
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
body: Container( body: BlocBuilder<OrderVariantValueBloc, List<OrderVariant>>(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight), builder: (contextVB, orderVariants) {
child: Column( return BlocBuilder<OrderVariantTemporaryBloc, List<dynamic>>(
children: [ builder: (contextTmp, listOrders) {
Container( var listOrder = listOrders[0];
margin: const EdgeInsets.only( var itemId = listOrder[0];
top: 15, var satuanPrice = listOrder[1];
bottom: 20, int totalPrice;
), var initialValue = listOrder[2];
child: Row( // var listVariant = listOrder[3];
children: [ if (orderVariants.isNotEmpty) {
GestureDetector( // totalPrice = 0;
onTap: () { int priceVariant = 0;
Navigator.pop(context); for (int z = 0; z < orderVariants.length; z++) {
}, priceVariant += orderVariants[z].price;
child: Container( }
width: 24, totalPrice = (listOrder[1] + priceVariant) * initialValue;
height: 24, } else {
child: Center( totalPrice = listOrder[1] * initialValue;
child: fontAwesomeNew( }
arrowBack, return ScreenResponsive(
arrowBackSize, widget: CoreVariant(
widthScreen: widthScreen,
widget: widget,
orderDetail: orderDetail,
currentFocus: currentFocus,
initialValue: initialValue,
itemId: itemId,
satuanPrice: satuanPrice,
totalPrice: totalPrice,
context: context,
),
isCoreLayout: true,
widthScreen: MediaQuery.of(context).size.width,
);
},
);
},
),
),
));
}
}
class CoreVariant extends StatelessWidget {
CoreVariant({
Key? key,
required this.widthScreen,
required this.widget,
required this.orderDetail,
required this.currentFocus,
required this.initialValue,
required this.itemId,
required this.satuanPrice,
required this.totalPrice,
required this.context,
}) : super(key: key);
final double widthScreen;
final VariantCatNew widget;
final OrderDetail orderDetail;
final FocusScopeNode currentFocus;
late int initialValue;
final String itemId;
final int satuanPrice;
final int totalPrice;
final BuildContext context;
void plus() {
initialValue += 1;
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(itemId, satuanPrice, initialValue, []);
}
void minus() {
if (initialValue > 1) {
initialValue += -1;
context
.read<OrderVariantTemporaryBloc>()
.insertDataVariant(itemId, satuanPrice, initialValue, []);
}
}
@override
Widget build(BuildContext context) {
return Container(
width: widthScreen,
child: Stack(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column(
children: [
Container(
margin: const EdgeInsets.only(
top: 15,
bottom: 20,
),
child: Row(
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
width: 24,
height: 24,
child: Center(
child: fontAwesomeNew(
arrowBack,
arrowBackSize,
),
), ),
), ),
), ),
), const SizedBox(
const SizedBox( width: 16,
width: 16,
),
Center(
child: defaultText(
context,
widget.namaMenu,
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameVariant(),
), ),
), Center(
], child: defaultText(
context,
widget.namaMenu,
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameVariant(),
),
),
],
),
), ),
), Expanded(
Expanded( child: ListView(
child: ListView( children: [
children: [ ListView.builder(
ListView.builder( physics:
physics: const NeverScrollableScrollPhysics(), // to disable GridView's scrolling
const NeverScrollableScrollPhysics(), // to disable GridView's scrolling shrinkWrap: true,
shrinkWrap: true, itemCount: widget.variantCategories.length,
itemCount: widget.variantCategories.length, itemBuilder: ((context, index) {
itemBuilder: ((context, index) { return Container(
return Container( width: double.infinity,
width: double.infinity, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Container(
Container( margin: EdgeInsets.only(
margin: EdgeInsets.only( bottom:
bottom: MediaQuery.of(context).size.height *
MediaQuery.of(context).size.height * 0.01,
0.01, top:
top: MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.01), 0.01),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
defaultText( defaultText(
context, context,
widget.variantCategories[index].caption, widget
style: variantStyleText(), .variantCategories[index].caption,
), style: variantStyleText(),
defaultText(
context,
(widget.variantCategories[index].type ==
typeMandatory)
? 'Pilih Salah Satu'
: (widget.variantCategories[index]
.type ==
typeAutoInsert)
? 'Sudah termasuk'
: 'Optional',
style: variantStyleText(
font: 12,
fontWeight: FontWeight.w300,
), ),
) defaultText(
], context,
(widget.variantCategories[index]
.type ==
typeMandatory)
? 'Pilih Salah Satu'
: (widget.variantCategories[index]
.type ==
typeAutoInsert)
? 'Sudah termasuk'
: 'Optional',
style: variantStyleText(
font: 12,
fontWeight: FontWeight.w300,
),
)
],
),
), ),
), const Divider(
const Divider( thickness: 0.5,
thickness: 0.5, color: textColorBlack,
color: textColorBlack, ),
), VariantNew(
VariantNew( variants:
variants: widget.variantCategories[index].variant,
widget.variantCategories[index].variant, captioncategories:
captioncategories: widget.variantCategories[index].caption,
widget.variantCategories[index].caption, type: widget.variantCategories[index].type,
type: widget.variantCategories[index].type, initPrice: widget.initPrice,
initPrice: widget.initPrice, idCategory:
idCategory: widget.variantCategories[index].id,
widget.variantCategories[index].id, orderDetail: orderDetail,
orderDetail: orderDetail, ),
), ],
], ),
), );
); })),
})), const SizedBox(
const SizedBox( height: 74,
height: 74,
),
defaultText(
context,
"Note :",
style: variantStyleText(
font: 20,
fontWeight: FontWeight.w400,
), ),
), defaultText(
const SizedBox( context,
height: 12, "Note :",
), style: variantStyleText(
// TextField( font: 20,
// maxLength: maxLengthTextField,
// maxLines: 2,
// autofocus: false,
// keyboardType: TextInputType.text,
// controller: noteCatController,
// style: textStyleNormalFont(context),
// decoration: InputDecoration(
// prefixIcon: Image(
// image: const AssetImage('assets/icons/search.png'),
// color: Colors.grey.withOpacity(0.8),
// height: 20,
// width: 20,
// ),
// hintText: placeHolderNote,
// hintStyle: TextStyle(
// color: Colors.grey,
// fontSize:
// MediaQuery.of(context).size.height * normalFont,
// ),
// ),
// ),
Container(
height: 35,
child: TextField(
maxLength: maxLengthTextField,
autofocus: false,
style: const TextStyle(
color: textColorBlack,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
textAlignVertical: TextAlignVertical.center, ),
decoration: InputDecoration( const SizedBox(
counterText: "", height: 12,
filled: true, ),
enabledBorder: OutlineInputBorder( // TextField(
borderSide: const BorderSide( // maxLength: maxLengthTextField,
width: 1, // maxLines: 2,
// autofocus: false,
// keyboardType: TextInputType.text,
// controller: noteCatController,
// style: textStyleNormalFont(context),
// decoration: InputDecoration(
// prefixIcon: Image(
// image: const AssetImage('assets/icons/search.png'),
// color: Colors.grey.withOpacity(0.8),
// height: 20,
// width: 20,
// ),
// hintText: placeHolderNote,
// hintStyle: TextStyle(
// color: Colors.grey,
// fontSize:
// MediaQuery.of(context).size.height * normalFont,
// ),
// ),
// ),
Container(
height: 35,
child: TextField(
maxLength: maxLengthTextField,
autofocus: false,
style: const TextStyle(
color: textColorBlack,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400,
),
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
counterText: "",
filled: true,
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(
width: 1,
color: textColorPlaceHolder,
),
borderRadius: BorderRadius.circular(21),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
width: 1,
color: textColorPlaceHolder,
),
borderRadius: BorderRadius.circular(21),
),
prefixIcon: const Image(
image: AssetImage('assets/icons/note-grey.png'),
color: textColorPlaceHolder, color: textColorPlaceHolder,
height: 13.33,
width: 13.33,
), ),
borderRadius: BorderRadius.circular(21), fillColor: backgroundColor,
), contentPadding: EdgeInsets.zero,
focusedBorder: OutlineInputBorder( hintText: placeHolderNote,
borderSide: const BorderSide( hintStyle: const TextStyle(
width: 1,
color: textColorPlaceHolder, color: textColorPlaceHolder,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400,
), ),
borderRadius: BorderRadius.circular(21),
),
prefixIcon: const Image(
image: AssetImage('assets/icons/note-grey.png'),
color: textColorPlaceHolder,
height: 13.33,
width: 13.33,
),
fillColor: backgroundColor,
contentPadding: EdgeInsets.zero,
hintText: placeHolderNote,
hintStyle: const TextStyle(
color: textColorPlaceHolder,
fontFamily: 'OpenSans',
fontSize: 10,
fontWeight: FontWeight.w400,
), ),
), ),
), ),
SizedBox(
height: MediaQuery.of(context).size.height * 0.03,
),
(isExcelso)
? (!currentFocus.hasPrimaryFocus)
? SizedBox(
height:
MediaQuery.of(context).size.height * 0.5,
)
: const SizedBox()
: const SizedBox()
],
),
)
],
),
),
Positioned(
bottom: 0,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
width: widthScreen,
height: 118,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
color: backgroundWhite,
),
child: Column(
children: [
const SizedBox(
height: 21,
),
Row(
children: [
defaultText(context, 'Jumlah Pesanan'),
const Spacer(),
PlusMinusButton(
initialValue: initialValue,
plus: plus,
minus: minus,
isFromVariant: true,
),
],
),
const SizedBox(
height: 14,
),
Container(
height: 43,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(33),
color: buttonColor,
), ),
SizedBox( child: Center(
height: MediaQuery.of(context).size.height * 0.03, child: defaultText(
context,
'Tambahkan - Rp ${formatNumber().format(totalPrice)}',
style: addButton(
font: 14,
),
),
), ),
(isExcelso) )
? (!currentFocus.hasPrimaryFocus) ],
? SizedBox( ),
height: ),
MediaQuery.of(context).size.height * 0.5, )
) ],
: const SizedBox()
: const SizedBox()
],
),
)
],
),
),
), ),
)); );
} }
} }
...@@ -25,11 +25,14 @@ class CustomAppBar extends StatelessWidget { ...@@ -25,11 +25,14 @@ class CustomAppBar extends StatelessWidget {
String cashierName = prefs.getString('cashier_name') ?? ''; String cashierName = prefs.getString('cashier_name') ?? '';
String sessionId = prefs.getString('sessionId') ?? ''; String sessionId = prefs.getString('sessionId') ?? '';
return Container( return Container(
margin: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 15, top: 15,
bottom: 30, bottom: 19,
left: paddingLeftRight,
right: paddingLeftRight,
), ),
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight), // padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
color: backgroundWhite,
child: Row( child: Row(
// mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
......
...@@ -7,6 +7,7 @@ import '../../api/api.dart'; ...@@ -7,6 +7,7 @@ import '../../api/api.dart';
import '../../helper/helper.dart'; import '../../helper/helper.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/note_modal_bottom_sheet.dart'; import '../../helper/widget/note_modal_bottom_sheet.dart';
import '../../helper/widget/plus_minus_button.dart';
import '../../helper/widget/style.dart'; import '../../helper/widget/style.dart';
import '../../models/bill_detail.dart'; import '../../models/bill_detail.dart';
import 'view_bill_new.dart'; import 'view_bill_new.dart';
...@@ -89,17 +90,46 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -89,17 +90,46 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
super.dispose(); super.dispose();
} }
void minus() {
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);
}
}
void plus() {
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);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double paddingLeftRightBill = 32; double paddingLeftRightBill = 32;
return Container( return Container(
// padding: const EdgeInsets.symmetric(horizontal: 32), // padding: const EdgeInsets.symmetric(horizontal: 32),
margin: EdgeInsets.only( padding: EdgeInsets.only(
top: 18, top: 18,
bottom: (widget.lastItem) ? 11 : 0, bottom: (widget.lastItem) ? 11 : 0,
), ),
width: double.infinity, width: double.infinity,
// color: Colors.blue, color: backgroundWhite,
child: Column( child: Column(
children: [ children: [
Container( Container(
...@@ -118,8 +148,9 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -118,8 +148,9 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
child: Image( child: Image(
width: 52, width: 80,
height: 52, height: 80,
fit: BoxFit.fill,
image: NetworkImage( image: NetworkImage(
widget.billDetail.imageUrl, widget.billDetail.imageUrl,
), ),
...@@ -139,15 +170,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -139,15 +170,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
style: menuNameListViewBill(), style: menuNameListViewBill(),
), ),
(widget.billDetail.notes != '')
? defaultText(
context,
'Catatan: ${widget.billDetail.notes}',
style: descriptionListViewBill(),
)
: const SizedBox(),
const SizedBox( const SizedBox(
height: 9, height: 6,
), ),
defaultText( defaultText(
context, context,
...@@ -156,7 +180,22 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -156,7 +180,22 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
font: 12, font: 12,
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
) ),
const SizedBox(
height: 6,
),
(widget.billDetail.notes != '')
? defaultText(
context,
'Catatan: ${widget.billDetail.notes}',
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
),
)
: const SizedBox(),
], ],
)) ))
], ],
...@@ -170,12 +209,14 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -170,12 +209,14 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
left: paddingLeftRightBill, right: paddingLeftRightBill), left: paddingLeftRightBill, right: paddingLeftRightBill),
child: const Divider( child: const Divider(
thickness: 1, thickness: 1,
color: dividerGrey, color: backgroundColor,
), ),
), ),
const SizedBox( (!widget.isHistory && widget.tableStatus == tableStatusOpen)
height: 11, ? const SizedBox(
), height: 11,
)
: const SizedBox(),
(!widget.isHistory && widget.tableStatus == tableStatusOpen) (!widget.isHistory && widget.tableStatus == tableStatusOpen)
? Container( ? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
...@@ -261,87 +302,92 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -261,87 +302,92 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
), ),
), ),
const Spacer(), const Spacer(),
Stack( PlusMinusButton(
children: [ initialValue: widget.billDetail.quantity,
Container( plus: plus,
width: 94, minus: minus,
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'),
),
),
),
)
],
), ),
// 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( const SizedBox(
width: 12, width: 12,
) )
......
...@@ -24,7 +24,7 @@ class RincianPembayaran extends StatelessWidget { ...@@ -24,7 +24,7 @@ class RincianPembayaran extends StatelessWidget {
vertical: 16, vertical: 16,
), ),
height: 209, height: 209,
// color: Colors.red, color: backgroundWhite,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
......
...@@ -7,6 +7,7 @@ import 'package:byod/bloc/feedback_select.dart'; ...@@ -7,6 +7,7 @@ import 'package:byod/bloc/feedback_select.dart';
import 'package:byod/bloc/member_info.dart'; import 'package:byod/bloc/member_info.dart';
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/helper/widget/style.dart'; import 'package:byod/helper/widget/style.dart';
import 'package:byod/ui/history_order/history_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';
...@@ -14,12 +15,14 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; ...@@ -14,12 +15,14 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../../api/api.dart'; import '../../api/api.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart'; import '../../bloc/feedback_option.dart';
import '../../bloc/view_bill.dart'; import '../../bloc/view_bill.dart';
import '../../bloc/voucher_list.dart'; import '../../bloc/voucher_list.dart';
import '../../helper/widget/button_dialog.dart'; import '../../helper/widget/button_dialog.dart';
import '../../helper/widget/emoticon_rate.dart'; import '../../helper/widget/emoticon_rate.dart';
import '../../helper/widget/emoticon_rate_new.dart'; import '../../helper/widget/emoticon_rate_new.dart';
import '../../helper/widget/open_url.dart';
import '../../helper/widget/thousand_formatter.dart'; import '../../helper/widget/thousand_formatter.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/bill.dart'; import '../../models/bill.dart';
...@@ -27,6 +30,7 @@ import '../../models/feedback_option.dart'; ...@@ -27,6 +30,7 @@ import '../../models/feedback_option.dart';
import '../../models/member_info.dart'; import '../../models/member_info.dart';
import '../../models/rate_value_selected.dart'; import '../../models/rate_value_selected.dart';
import '../build_version.dart'; import '../build_version.dart';
import '../history_order/history.dart';
import '../home/new_home2.dart'; import '../home/new_home2.dart';
import '../payment/function.dart'; import '../payment/function.dart';
import '../payment/payment.dart'; import '../payment/payment.dart';
...@@ -64,10 +68,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -64,10 +68,7 @@ class ViewBillNew extends StatelessWidget {
await prefs.setString('date_order', dataBill[0].dateOrder); await prefs.setString('date_order', dataBill[0].dateOrder);
} }
@override void getBillFunc(BuildContext context) {
Widget build(BuildContext context) {
context.read<FeedBackOptionBloc>().getOptionFeedback();
context.read<ViewBillBloc>().backToDefault();
if (!isHistory) { if (!isHistory) {
context.read<ViewBillBloc>().getBill(); context.read<ViewBillBloc>().getBill();
} else { } else {
...@@ -80,7 +81,13 @@ class ViewBillNew extends StatelessWidget { ...@@ -80,7 +81,13 @@ class ViewBillNew extends StatelessWidget {
userNameH: userName, userNameH: userName,
); );
} }
}
@override
Widget build(BuildContext context) {
context.read<FeedBackOptionBloc>().getOptionFeedback();
context.read<ViewBillBloc>().backToDefault();
getBillFunc(context);
double widthScreen = responsiveWidthScreen(context); double widthScreen = responsiveWidthScreen(context);
double maxWidthScreen = getMaxWidthScreen(context, useResponsive); double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
double currentScreen = MediaQuery.of(context).size.width; double currentScreen = MediaQuery.of(context).size.width;
...@@ -102,7 +109,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -102,7 +109,7 @@ class ViewBillNew extends StatelessWidget {
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundWhite, backgroundColor: backgroundColorViewBill,
body: RefreshIndicator( body: RefreshIndicator(
color: buttonColor, color: buttonColor,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
...@@ -110,7 +117,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -110,7 +117,7 @@ class ViewBillNew extends StatelessWidget {
return Future.delayed( return Future.delayed(
const Duration(milliseconds: 1500), const Duration(milliseconds: 1500),
() { () {
context.read<ViewBillBloc>().getBill(); getBillFunc(context);
}, },
); );
}, },
...@@ -241,9 +248,9 @@ class ViewBillNew extends StatelessWidget { ...@@ -241,9 +248,9 @@ class ViewBillNew extends StatelessWidget {
// Navigator.pop(context); // Navigator.pop(context);
title = 'Tutup Pesanan'; title = 'Tutup Pesanan';
description = ''' description = '''
Selesaikan transaksi dan tutup pesanan ? Selesaikan transaksi dan tutup pesanan ?
Mohon menuju kasir untuk meminta bukti pembayaran'''; Mohon menuju kasir untuk meminta bukti pembayaran''';
// } else { // } else {
// // // Navigator.pop(context); // // // Navigator.pop(context);
// // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar'); // // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar');
...@@ -293,6 +300,7 @@ class ViewBillNew extends StatelessWidget { ...@@ -293,6 +300,7 @@ class ViewBillNew extends StatelessWidget {
customerName: customerName, customerName: customerName,
isHistory: isHistory, isHistory: isHistory,
sessionId: sessionID, sessionId: sessionID,
historyOrder: historyOrder,
), ),
widthScreen: currentScreen, widthScreen: currentScreen,
isCoreLayout: true, isCoreLayout: true,
...@@ -377,31 +385,116 @@ class CoreBill extends StatelessWidget { ...@@ -377,31 +385,116 @@ class CoreBill extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: const EdgeInsets.symmetric( width: double.infinity,
horizontal: paddingLeftRight), color: backgroundWhite,
child: defaultText(
context, 'Meja ${dataBill[0].tableName}',
style: viewbillStyle())),
Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight), horizontal: paddingLeftRight),
child: defaultText(
context, 'Meja ${dataBill[0].tableName}',
style: viewbillStyle()),
),
Container(
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
bottom: 18,
),
child: defaultText( child: defaultText(
context, dataBill[0].customerName, context, dataBill[0].customerName,
style: customerNameViewbill()), style: customerNameViewbill()),
), ),
// const Divider(
// color: backgroundColorViewBill,
// thickness: 24,
// ),
const SizedBox( const SizedBox(
height: 18, height: 24,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
),
const SizedBox(
height: 16,
), ),
(dataBill[0].isFeedBack == false &&
dataBill[0].tableStatus != tableStatusOpen)
? Column(
children: [
GestureDetector(
onTap: () {
ratingModal(
context, dataBill, isHistory);
},
child: Container(
height: 197,
width: double.infinity,
color: backgroundWhite,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
defaultText(
context,
'Berikan Rating',
style: emojiStyle(),
),
const SizedBox(
height: 15,
),
defaultText(
context,
'Bagaimana pengalaman anda bertransaksi di excelso',
style: emojiStyle(),
),
const SizedBox(
height: 19,
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: const [
Image(
width: 76,
height: 76,
image: AssetImage(
'assets/emoji/bad_grey.png'),
),
SizedBox(
width: 28,
),
Image(
width: 76,
height: 76,
image: AssetImage(
'assets/emoji/neutral_grey.png'),
),
SizedBox(
width: 28,
),
Image(
width: 76,
height: 76,
image: AssetImage(
'assets/emoji/good_grey.png'),
)
],
)
],
),
),
),
const SizedBox(
height: 24,
),
],
)
: const SizedBox(),
Container( Container(
padding: const EdgeInsets.symmetric( width: double.infinity,
horizontal: paddingLeftRight), color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
top: 16,
),
child: defaultText( child: defaultText(
context, context,
'Daftar Order', 'Daftar Order',
...@@ -417,11 +510,7 @@ class CoreBill extends StatelessWidget { ...@@ -417,11 +510,7 @@ class CoreBill extends StatelessWidget {
tableStatus: dataBill[0].tableStatus, tableStatus: dataBill[0].tableStatus,
), ),
const SizedBox( const SizedBox(
height: 11, height: 24,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
), ),
const AddMoreOrder(), const AddMoreOrder(),
const Divider( const Divider(
...@@ -433,30 +522,281 @@ class CoreBill extends StatelessWidget { ...@@ -433,30 +522,281 @@ class CoreBill extends StatelessWidget {
totalDiscount: totalDiscount, totalDiscount: totalDiscount,
outStandingAll: outStandingAll, outStandingAll: outStandingAll,
), ),
const Divider( (dataBill[0].paymentList.isNotEmpty)
color: backgroundColorViewBill, ? Column(
thickness: 24, mainAxisSize: MainAxisSize.min,
), children: [
// (dataBill[0].paymentList.isNotEmpty) const SizedBox(
// ? Container( height: 24,
// padding: , ),
// ) Container(
// : const SizedBox(), width: widthScreen,
const SizedBox( color: backgroundWhite,
height: 5, child: Column(
), crossAxisAlignment:
Align( CrossAxisAlignment.start,
alignment: Alignment.center, children: [
child: defaultText( Container(
context, padding: const EdgeInsets.only(
"Harga sudah termasuk pajak", left: paddingLeftRight,
style: rincianPembayaran( right: paddingLeftRight,
fontStyle: FontStyle.italic, top: 16,
bottom: 20,
),
child: defaultText(
context,
'Payment List',
style: viewbillStyle(
font: 14,
),
),
),
Container(
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
bottom: 12,
),
child: const Divider(
thickness: 0.3,
color: dividerGrey,
),
),
Container(
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (int i = 0;
i <
dataBill[0]
.paymentList
.length;
i++)
Column(
children: [
GestureDetector(
onTap: () async {
// hanya payment yang belum approve, method doku only dan payment url tidak string kosong
if (dataBill[0]
.paymentList[
i]
.method ==
payCard &&
dataBill[0]
.paymentList[
i]
.paymentUrl !=
'' &&
dataBill[0]
.paymentList[
i]
.isApproved ==
false) {
await EasyLoading
.show(
status:
'Harap tunggu...',
maskType:
EasyLoadingMaskType
.none,
);
await EasyLoading
.dismiss();
htmlOpenLink(dataBill[
0]
.paymentList[i]
.paymentUrl);
}
},
child: Container(
height: 72,
padding:
const EdgeInsets
.all(16),
decoration:
BoxDecoration(
borderRadius:
BorderRadius
.circular(
9),
color:
backgroundWhite,
boxShadow: const [
BoxShadow(
color:
Colors.grey,
blurRadius: 5.0,
)
],
),
child: Row(
children: [
Expanded(
child:
Container(
height: double
.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
defaultText(
context,
dataBill[0]
.paymentList[i]
.customerNamePay,
maxLines:
1,
overFlow:
TextOverflow.ellipsis,
style:
viewbillStyle(
font:
12,
),
),
defaultText(
context,
dataBill[0]
.paymentList[i]
.name,
maxLines:
1,
overFlow:
TextOverflow.ellipsis,
style:
viewbillStyle(
font:
12,
color:
textGreyBill,
),
),
],
),
),
),
Container(
width: 110,
height: double
.infinity,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.end,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
defaultText(
context,
"Rp ${formatNumber().format(amountParseToInt(dataBill[0].paymentList[i].amount))}",
maxLines:
1,
overFlow:
TextOverflow
.ellipsis,
style:
viewbillStyle(
font:
12,
),
),
defaultText(
context,
getpaymentStatus(
dataBill[0]
.paymentList[i]
.isApproved,
dataBill[0]
.paymentList[i]
.method,
),
maxLines:
1,
overFlow:
TextOverflow
.ellipsis,
style:
viewbillStyle(
font:
12,
color:
getPaymentStatusColor(
dataBill[0]
.paymentList[i]
.isApproved,
),
),
),
],
),
)
],
),
),
),
const SizedBox(
height: 5,
)
],
),
],
),
// child: ListView.builder(
// itemCount: 3,
// itemBuilder: (ctxPayment, i) {
// return Container(
// height: 72,
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(
// 9),
// color: backgroundWhite,
// boxShadow: const [
// BoxShadow(
// color: Colors.grey,
// blurRadius: 10.0,
// )
// ],
// ),
// );
// },
// ),
)
],
),
)
],
)
: const SizedBox(),
Container(
padding: const EdgeInsets.only(top: 5, bottom: 5),
color: backgroundWhite,
width: double.infinity,
child: Align(
alignment: Alignment.center,
child: defaultText(
context,
"Harga sudah termasuk pajak",
style: rincianPembayaran(
fontStyle: FontStyle.italic,
),
), ),
), ),
), ),
const SizedBox( SizedBox(
height: 180, height: (dataBill[0].tableStatus == tableStatusOpen)
? 180
: 120,
) )
], ],
), ),
...@@ -467,10 +807,22 @@ class CoreBill extends StatelessWidget { ...@@ -467,10 +807,22 @@ class CoreBill extends StatelessWidget {
Positioned( Positioned(
bottom: 0, bottom: 0,
child: Container( child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
color: backgroundWhite,
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 10.0,
)
],
),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: paddingLeftRight), horizontal: paddingLeftRight, vertical: paddingLeftRight),
width: widthScreen, width: widthScreen,
color: backgroundWhite,
child: Column( child: Column(
children: [ children: [
GestureDetector( GestureDetector(
...@@ -511,7 +863,7 @@ class CoreBill extends StatelessWidget { ...@@ -511,7 +863,7 @@ class CoreBill extends StatelessWidget {
height: 43, height: 43,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(33),
color: (dataBill[0].tableStatus == tableStatusOpen) color: (dataBill[0].tableStatus == tableStatusOpen)
? buttonColor ? buttonColor
: disabledColor, : disabledColor,
...@@ -527,7 +879,8 @@ class CoreBill extends StatelessWidget { ...@@ -527,7 +879,8 @@ class CoreBill extends StatelessWidget {
), ),
), ),
), ),
(dataBill[0].isFeedBack == false) (dataBill[0].isFeedBack == false &&
dataBill[0].tableStatus == tableStatusOpen)
? GestureDetector( ? GestureDetector(
onTap: () { onTap: () {
if (dataBill[0].tableStatus == if (dataBill[0].tableStatus ==
...@@ -549,7 +902,7 @@ class CoreBill extends StatelessWidget { ...@@ -549,7 +902,7 @@ class CoreBill extends StatelessWidget {
height: 43, height: 43,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(33),
color: successColor, color: successColor,
), ),
child: Center( child: Center(
...@@ -589,6 +942,7 @@ class EmptyBill extends StatelessWidget { ...@@ -589,6 +942,7 @@ class EmptyBill extends StatelessWidget {
required this.branchCode, required this.branchCode,
required this.brandCode, required this.brandCode,
required this.sessionId, required this.sessionId,
required this.historyOrder,
}) : super(key: key); }) : super(key: key);
final double widthScreen; final double widthScreen;
...@@ -598,6 +952,11 @@ class EmptyBill extends StatelessWidget { ...@@ -598,6 +952,11 @@ class EmptyBill extends StatelessWidget {
final String brandCode; final String brandCode;
final String sessionId; final String sessionId;
final String tableNumber = prefs.getString("table_number") ?? ''; final String tableNumber = prefs.getString("table_number") ?? '';
final List<String> historyOrder;
final String role = prefs.getString('role') ?? '';
final String cashierName = prefs.getString('cashier_name') ?? '';
final String sessionID = prefs.getString('sessionId') ?? '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<MemberInfoBloc, MemberInfo>( return BlocBuilder<MemberInfoBloc, MemberInfo>(
...@@ -618,54 +977,138 @@ class EmptyBill extends StatelessWidget { ...@@ -618,54 +977,138 @@ class EmptyBill extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight), horizontal: paddingLeftRight),
child: defaultText(context, 'Meja $tableNumber', child: defaultText(context, 'Meja $tableNumber',
style: viewbillStyle())), style: viewbillStyle())),
Container( Container(
padding: const EdgeInsets.symmetric( width: double.infinity,
horizontal: paddingLeftRight), color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
bottom: 18,
),
child: defaultText(context, customerName, child: defaultText(context, customerName,
style: customerNameViewbill()), style: customerNameViewbill()),
), ),
const SizedBox( const SizedBox(
height: 18, height: 24,
),
const Divider(
color: backgroundColorViewBill,
thickness: 24,
), ),
const Spacer(), Expanded(
Container( child: Container(
padding: const EdgeInsets.symmetric( width: double.infinity,
horizontal: paddingLeftRight), color: backgroundWhite,
child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Image( Container(
width: 187, padding: const EdgeInsets.symmetric(
height: 173, horizontal: paddingLeftRight),
image: child: Center(
AssetImage('assets/icons/big-cart.png'), child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const Image(
width: 187,
height: 173,
image: AssetImage(
'assets/icons/big-cart.png'),
),
const SizedBox(
height: 24,
),
defaultText(
context,
'Belum Ada Orderan',
style: rincianPembayaran(
font: 16,
fontWeight: FontWeight.w700,
color: backgroundColorViewBill,
),
)
],
),
),
), ),
const SizedBox( const SizedBox(
height: 24, height: 21,
), ),
defaultText( GestureDetector(
context, onTap: () {
'Belum Ada Orderan', context.read<BranchExist>().branchExist(
style: rincianPembayaran( branchCode,
font: 16, brandCode,
fontWeight: FontWeight.w700, role,
color: backgroundColorViewBill, cashierName,
sessionID,
);
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()));
},
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
height: 43,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Buat Pesanan Baru',
style: addButton(
font: 14,
),
),
),
), ),
) ),
const SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => HistoryOrderNew(
historyOrder: historyOrder,
),
),
);
},
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
height: 43,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: buttonColor,
),
child: Center(
child: defaultText(
context,
'Lihat Transaksi Terakhir',
style: addButton(
font: 14,
),
),
),
),
),
], ],
), ),
), ),
), )
const Spacer(),
], ],
), ),
) )
...@@ -677,7 +1120,6 @@ class EmptyBill extends StatelessWidget { ...@@ -677,7 +1120,6 @@ class EmptyBill extends StatelessWidget {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: paddingLeftRight), horizontal: paddingLeftRight, vertical: paddingLeftRight),
width: widthScreen, width: widthScreen,
color: backgroundWhite,
child: Column( child: Column(
children: const [ children: const [
SizedBox( SizedBox(
...@@ -1178,17 +1620,22 @@ class AddMoreOrder extends StatelessWidget { ...@@ -1178,17 +1620,22 @@ class AddMoreOrder extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: 80, height: 80,
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight), padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
// color: Colors.red, // color: Colors.red,
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: defaultText( child: Container(
context, child: defaultText(
'Apakah anda masih ingin memesan ?', context,
style: viewbillStyle( 'Apa anda masih ingin memesan ?',
font: 16, style: viewbillStyle(
fontWeight: FontWeight.w400, font: 16,
fontWeight: FontWeight.w400,
),
), ),
), ),
), ),
......
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