Commit 3e82ff72 authored by Dio Maulana's avatar Dio Maulana

04/10/22

parent 1296ca98
......@@ -21,6 +21,7 @@ import 'package:uuid/uuid.dart';
import '../bloc/order_bloc.dart';
import '../helper/widget/open_url.dart';
import '../main.dart';
import '../models/branchs.dart';
import '../models/variant_categories.dart';
import '../models/variants.dart';
// ignore: avoid_web_libraries_in_flutter
......@@ -50,6 +51,8 @@ class Api {
String latitude = getLatitude();
String longitude = getLongitude();
String currentSessionId = getSessionId();
int urlType = getUrlType();
String currentOrderId;
const uuidInit = Uuid();
var uuid = uuidInit.v4();
String sessionId;
......@@ -58,18 +61,38 @@ class Api {
} else {
sessionId = uuid;
}
List<String> listTypeUrl = getListTypeUrl();
int indexTypeUrl = listTypeUrl.indexWhere(
(element) => jsonDecode(element)['url_type'] == urlType,
);
if (indexTypeUrl != -1) {
currentOrderId = jsonDecode(listTypeUrl[indexTypeUrl])['order_id'];
} else {
currentOrderId = getOrderId();
}
var uuidOrderId = uuidInit.v4();
String orderID;
if (currentOrderId != '') {
orderID = currentOrderId;
} else {
orderID = uuidOrderId;
}
try {
Map data = {
"branch_code": branchCode,
"brand_code": brandCode,
"role": role,
"cashier_name": cashierName,
"order_id": orderId,
"order_id": orderID,
"session_id": sessionId,
"from": fromByod,
"url_lookup": 'https://dimas.com',
"url_lookup": (urlType == typeUrlTiga) ? 'https://dimas.com' : '',
"customer_lat": latitude,
"customer_long": longitude,
"type_url": urlType,
};
var bodies = json.encode(data);
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
......@@ -87,7 +110,7 @@ class Api {
String branchCode = getBranchPref();
String brandCode = getBrand();
String token = getToken();
if (orderId != jsonObject['data']['order_id']) {
if (orderID != jsonObject['data']['order_id']) {
Map historyOrder = {
"order_id": orderId,
"table": tableNumber,
......@@ -105,7 +128,22 @@ class Api {
listHistory.add(historySave);
setListHistory(listHistory);
}
if (indexTypeUrl != -1) {
listTypeUrl.removeWhere(
(element) => jsonDecode(element)['url_type'] == urlType);
}
Map saveTypeUrlAndOrderId = {
"url_type": urlType,
"order_id": jsonObject['data']['order_id'],
};
listTypeUrl.add(
jsonEncode(saveTypeUrlAndOrderId),
);
setListTypeUrl(listTypeUrl);
setOrderId(jsonObject['data']['order_id']);
setTypeOrder(jsonObject['data']['type_order']);
setLogoUrl(jsonObject['data']['logo']);
setSesssionId(jsonObject['data']['session_id']);
setSecretKey(jsonObject['data']['secret_key']);
......@@ -1247,6 +1285,7 @@ class Api {
String sessionId = getSessionId();
String signString = signApi();
int sessionC = getSessionCounter();
int typeOrder = getTypeOrder();
try {
Map data = {
......@@ -1262,7 +1301,8 @@ class Api {
"order_id": orderId,
"menu": variantData,
'secure_token': secureToken,
"from": fromByod
"from": fromByod,
"type_order": typeOrder
};
var bodies = jsonEncode(data);
// var apiResult = await http.post(Uri.parse(urlCheckout), body: bodies);
......@@ -1809,4 +1849,110 @@ class Api {
return feedBack;
}
}
static Future<bool> setToPendingOrder() async {
String baseUrl = getBaseUrl();
String apiUrl = "$baseUrl${endPoint}order";
String sessionId = getSessionId();
String signString = signApi();
int sessionC = getSessionCounter();
String branchCode = getBranchPref();
String brandCode = getBrand();
String role = getRole();
String cashierName = getCashierName();
String userName = getCustomerName();
String orderID = getOrderId();
try {
Map data = {
"session_id": sessionId,
"count": sessionC,
"sign": signString,
"branch_code": branchCode,
"brand_code": brandCode,
"role": role,
"cashier_name": cashierName,
"customer_name": userName,
"from": fromByod,
"order_id": orderID
};
var bodies = jsonEncode(data);
var jsonObject = await httpPost(apiUrl, bodies, 'setToPendingOrder');
if (jsonObject != false) {
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
EasyLoading.showToast(
'Orderan telah dikrim, menunggu untuk di setujui');
return true;
}
EasyLoading.showToast(jsonObject['msg']);
return false;
} else {
EasyLoading.showToast('Something went wrong with our server');
return false;
}
} catch (e) {
if (debug) {
logd('API CLASS ON API.DART, FUNGSI: setToPendingOrder, URL : $apiUrl',
'ERROR CONNECT TO SERVER, ERROR CATCH : $e');
}
EasyLoading.showToast('Something went wrong with our server');
return false;
}
}
static Future<List<Branch>> getBranchList() async {
String baseUrl = getBaseUrl();
String apiUrl = "$baseUrl${endPoint}get_branch_list";
String sessionId = getSessionId();
String signString = signApi();
int sessionC = getSessionCounter();
String brandCode = getBrand();
String role = getRole();
String cashierName = getCashierName();
String userName = getCustomerName();
List<Branch> branchList = [];
try {
Map data = {
"session_id": sessionId,
"count": sessionC,
"sign": signString,
"brand_code": brandCode,
"role": role,
"cashier_name": cashierName,
"customer_name": userName,
"from": fromByod,
"is_pickup": false,
"is_delivery": false,
"customer_lat": getLatitude(),
"customer_long": getLongitude(),
};
var bodies = jsonEncode(data);
var jsonObject = await httpPost(apiUrl, bodies, 'getBranchList');
if (jsonObject != false) {
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
List<dynamic> data = (jsonObject as Map<dynamic, dynamic>)['data'];
for (int d = 0; d < data.length; d++) {
branchList.add(
Branch.json(data[d]),
);
}
return branchList;
}
return branchList;
} else {
return branchList;
}
} catch (e) {
if (debug) {
logd('API CLASS ON API.DART, FUNGSI: getBranchList, URL : $apiUrl',
'ERROR CONNECT TO SERVER, ERROR CATCH : $e');
}
return branchList;
}
}
}
import 'package:byod/bloc/branch_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -15,15 +16,25 @@ class BranchExist extends Cubit<String> {
return apiGetBranch;
}
void branchExist(String branchCode, String brandCode, String role,
String cashierName, String orderId, BuildContext context,
{bool getMenu = false}) {
void branchExist(
String branchCode,
String brandCode,
String role,
String cashierName,
String orderId,
BuildContext context, {
bool getMenu = false,
bool getBrancList = false,
}) {
getBranch(branchCode, brandCode, role, cashierName, orderId).then((value) {
if (getMenu) {
context
.read<FilterMenuBloc>()
.catAndMenu(branchCode, brandCode, role, cashierName, orderId);
}
if (getBrancList) {
context.read<BranchList>().getBranchList();
}
emit(value);
});
......
import 'package:byod/models/branchs.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../api/api.dart';
class BranchList extends Cubit<List<Branch>> {
BranchList() : super([]);
void getBranchList() async {
List<Branch> result = await Api.getBranchList();
emit(result);
}
}
import 'package:byod/models/branchs.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SearchBranch extends Cubit<List<Branch>> {
SearchBranch()
: super([
Branch(
id: '0',
branchCode: '',
name: '',
image: '',
logo: '',
isDineIn: false,
isDelivery: false,
isPickup: false,
distance: 0,
)
]);
void search(String keyword, List<Branch> allBranch) {
List<Branch> result = [];
if (keyword.isNotEmpty) {
for (var x in allBranch) {
if (x.name.toLowerCase().contains(keyword.toLowerCase())) {
result.add(x);
}
}
emit(result);
} else {
emit(allBranch);
}
}
}
......@@ -273,6 +273,99 @@ String signApi() {
//** Generate SIGN */
//** untuk mengembalikan warna pada tombol tambah di checkout */
Color getAddMoreColorButton(int orderState) {
if (orderState == orderStateCreated || orderState == orderStateApproved) {
return buttonColor;
} else {
return disabledColor;
}
}
//** untuk mengembalikan warna pada tombol tambah di checkout */
bool isCanTapAddMoreButton(int orderState) {
int paymentMethod = getPaymentMode();
if (paymentMethod == closebill) {
if (orderState == orderStatePending) {
return false;
}
}
return true;
}
bool isVisibleAddMoreButton(int tableStatus, int orderState) {
int paymentMethod = getPaymentMode();
if (tableStatus == tableStatusOpen) {
if (paymentMethod == closebill) {
if (orderState == orderStatePending ||
orderState == orderStateCreated ||
orderState == orderStateApproved) {
return true;
}
} else {
if (orderState == orderStatePending ||
orderState == orderStateCreated ||
orderState == orderStateReady) {
return true;
}
}
}
return false;
}
bool isVisibleAddRemoveQuantityButtonCheckout(bool isHistory, int orderStatus) {
int paymentMethod = getPaymentMode();
if (!isHistory && paymentMethod == closebill && orderStatus == pendingOrder) {
return true;
}
return false;
}
String textButtonCheckout(int orderState) {
int paymentMethod = getPaymentMode();
if (paymentMethod == closebill && orderState == orderStateCreated) {
return 'Pesan';
} else if (paymentMethod == closebill &&
(orderState == orderStatePending ||
orderState == orderStateApproved) ||
paymentMethod == openBill &&
(orderState == orderStateCreated ||
orderState == orderStatePending)) {
return 'Bayar';
} else if (paymentMethod == closebill &&
(orderState == orderStatePaid ||
orderState == orderStateInproses ||
orderState == orderStateReady)) {
return 'Pesanan Diproses';
} else if (orderState == orderStateDone) {
return 'Buat Pesanan Baru';
} else if (orderState == orderStateCanceled) {
return 'Transaksi Dibatalkan';
} else {
return '';
}
}
bool isCanButtonCheckoutToTap(int orderState) {
int paymentMethod = getPaymentMode();
if (paymentMethod == closebill) {
if (orderState == orderStateCreated ||
orderState == orderStateApproved ||
orderState == orderStateDone) {
return true;
} else {
return false;
}
} else {
if (orderState == orderStateCanceled) {
return false;
} else {
return true;
}
}
}
//** END FUNCTION */
//** START CONSTANT */
......@@ -382,6 +475,8 @@ const int orderStateCreated = 0;
const int orderStatePending = 1;
const int orderStateApproved = 2;
const int orderStatePaid = 3;
const int orderStateInproses = 4;
const int orderStateReady = 5;
const int orderStateDone = 99;
//** constanta order status bill */
......@@ -589,4 +684,17 @@ String locationPermissinDenied = 'locationdisabled';
String configError = 'configError';
String titleError = 'titleError';
//** No Route Identification */
//** Type Url */
const int typeUrlSatu = 1;
const int typeUrlDua = 2;
const int typeUrlTiga = 3;
//** Type Url */
//** Type ORder */
const int typeOrderDelivery = 0;
const int typeOrderDineIn = 1;
const int typeOrderPickup = 1;
//** Type ORder */
//** END CONSTANT */
......@@ -24,6 +24,11 @@ const String _latitude = 'lat';
const String _longitude = 'long';
const String _titleWeb = 'title';
const String _isDeliveryPickup = 'is_delivery_pickup';
const String _typeUrl = 'urlType';
const String _listTypeUrl = 'urlTypeList';
const String _orderType = 'orderType';
const String _isDelivery = 'isDelivery';
const String _isPickup = 'isPickup';
String getBaseUrl() {
return prefs.getString(_baseUrl) ?? '';
......@@ -133,11 +138,11 @@ Future<void> setListHistory(List<String> value) async {
prefs.setStringList(_listHistory, value);
}
int getTableMode() {
int getPaymentMode() {
return prefs.getInt(_tableMode) ?? defaultBillTable;
}
Future<void> setTableMode(int value) async {
Future<void> setPaymentMode(int value) async {
prefs.setInt(_tableMode, value);
}
......@@ -204,3 +209,43 @@ bool getIsDeliveryPickup() {
Future<void> setIsDeliveryPickup(bool value) async {
prefs.setBool(_isDeliveryPickup, value);
}
int getUrlType() {
return prefs.getInt(_typeUrl) ?? 0; // 0 biar error kalau belum di set
}
Future<void> setUrlType(int value) async {
prefs.setInt(_typeUrl, value);
}
List<String> getListTypeUrl() {
return prefs.getStringList(_listTypeUrl) ?? [];
}
Future<void> setListTypeUrl(List<String> value) async {
prefs.setStringList(_listTypeUrl, value);
}
int getTypeOrder() {
return prefs.getInt(_orderType) ?? -1; // -1 biar ketahuan kalau ada error
}
Future<void> setTypeOrder(int value) async {
prefs.setInt(_orderType, value);
}
bool getIsPickup() {
return prefs.getBool(_isPickup) ?? false;
}
Future<void> setIsPickup(bool value) async {
prefs.setBool(_isPickup, value);
}
bool getIsDelivery() {
return prefs.getBool(_isDelivery) ?? false;
}
Future<void> setIsDelivery(bool value) async {
prefs.setBool(_isDelivery, value);
}
......@@ -4,7 +4,6 @@ import 'dart:convert';
import 'package:byod/bloc/feedback_option.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/main.dart';
import 'package:byod/models/bill.dart';
import 'package:byod/models/feedback_option.dart';
import 'package:byod/models/rate_value_selected.dart';
......
......@@ -10,7 +10,6 @@ import '../../api/api.dart';
import '../../bloc/feedback_option.dart';
import '../../bloc/feedback_select.dart';
import '../../bloc/view_bill.dart';
import '../../main.dart';
import '../../models/bill.dart';
import '../../models/feedback_option.dart';
import '../../models/rate_value_selected.dart';
......
This diff is collapsed.
class Branch {
final String id;
final String branchCode;
final String name;
final String image;
final String logo;
final bool isDineIn;
final bool isDelivery;
final bool isPickup;
final double distance;
Branch({
required this.id,
required this.branchCode,
required this.name,
required this.image,
required this.logo,
required this.isDineIn,
required this.isDelivery,
required this.isPickup,
required this.distance,
});
factory Branch.json(Map<String, dynamic> json) {
return Branch(
id: json['id'],
branchCode: json['code'],
name: json['name'],
image: json['image'],
logo: json['logo'],
isDineIn: json['is_dinein'],
isDelivery: json['is_delivery'],
isPickup: json['is_pickup'],
distance: json['distance'],
);
}
}
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/search_branch.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
import '../bloc/branch_list.dart';
import '../models/branchs.dart';
class CustomAppBar extends StatelessWidget {
CustomAppBar({
Key? key,
// required this.allBranch,
}) : super(key: key);
// final List<Branch> allBranch;
final _searchController = TextEditingController();
@override
Widget build(BuildContext context) {
return BlocBuilder<BranchList, List<Branch>>(
builder: (context, allBranch) {
return Container(
color: backgroundWhite,
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight, vertical: 15),
child: Column(
children: [
Center(
child: defaultText(
context,
'Silahkan Pilih Outlet',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: appBarNameViewBill(),
),
),
const SizedBox(
height: 16,
),
Container(
height: 36,
child: TextField(
controller: _searchController,
// autofocus: true,
onChanged: (sarchValue) {
context.read<SearchBranch>().search(sarchValue, allBranch);
},
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: 'Excelso Puri Indah Mall',
hintStyle: TextStyle(
color: Colors.grey.withOpacity(0.8),
fontFamily: fontFamily,
fontSize: 10,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
),
),
),
),
],
),
);
},
);
}
}
......@@ -8,7 +8,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../helper/helper.dart';
import '../../main.dart';
import '../../models/order_variants.dart';
import '../../models/orders.dart';
import 'fuction.dart';
......@@ -81,7 +80,7 @@ class _CheckOutState extends State<CheckOut> {
double widthScreen = responsiveWidthScreen(context);
double currentScreen = MediaQuery.of(context).size.width;
double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
int tableMode = getTableMode();
int paymentMode = getPaymentMode();
return SafeArea(
child: Scaffold(
backgroundColor: backgroundColor,
......@@ -142,7 +141,7 @@ class _CheckOutState extends State<CheckOut> {
indexTidakAdaVariant,
listOrders,
indexAdaVariant,
tableMode,
paymentMode,
totalHarga,
widthScreen,
maxWidthScreen),
......
......@@ -20,7 +20,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../bloc/branch_exist.dart';
import '../../helper/widget/button_dialog.dart';
import '../../main.dart';
import '../../models/fav_group.dart';
import '../checkout/fuction.dart';
import 'shimmer_menu.dart';
......@@ -76,7 +75,7 @@ class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
int tableMode = getTableMode();
int paymentMode = getPaymentMode();
// context.read<FeedBackOptionBloc>().getOptionFeedback();
double widthScreen = responsiveWidthScreen(context);
double maxWidthScreen = getMaxWidthScreen(context, useResponsive);
......@@ -169,7 +168,7 @@ class _HomeState extends State<Home> {
widthScreen,
maxWidthScreen,
context,
tableMode,
paymentMode,
favList,
),
widthScreen: MediaQuery.of(context).size.width,
......
......@@ -30,7 +30,6 @@ import 'cat_list.dart';
import 'fav_grid_menu.dart';
import 'fav_list.dart';
import 'package:byod/models/category_list.dart';
import 'shimmer_menu.dart';
import 'shimmer_menu_new.dart';
class NewHome2 extends StatefulWidget {
......@@ -203,7 +202,7 @@ class _NewHome2State extends State<NewHome2> {
// categoryFont -
// spacerAboveCatList;
int tableMode = getTableMode();
int paymentMode = getPaymentMode();
String tableNumber = getTabelNumber();
String userName = getCustomerName();
double widthScreen = responsiveWidthScreen(context);
......@@ -521,7 +520,7 @@ class _NewHome2State extends State<NewHome2> {
totalItem,
listOrders,
totalHarga,
tableMode,
paymentMode,
isSearchActive,
),
widthScreen:
......@@ -584,7 +583,7 @@ class _NewHome2State extends State<NewHome2> {
int totalItem,
List<Orders> listOrders,
int totalHarga,
int tableMode,
int paymentMode,
bool isSearchActive,
) {
String logoUrl = getLogoUrl();
......@@ -832,7 +831,7 @@ class _NewHome2State extends State<NewHome2> {
paddingLeftRight,
totalItem,
totalHarga,
tableMode,
paymentMode,
userName,
widthScreen,
)
......@@ -909,7 +908,7 @@ class _NewHome2State extends State<NewHome2> {
double paddingLeftRight,
int totalItem,
int totalHarga,
int tableMode,
int paymentMode,
String namaPelanggan,
double widthScreen) {
String itemString;
......@@ -921,7 +920,7 @@ class _NewHome2State extends State<NewHome2> {
final nameController = TextEditingController();
return GestureDetector(
onTap: () {
if (tableMode == closebill) {
if (paymentMode == closebill) {
if (namaPelanggan != '') {
checkOut(context, listOrders, namaPelanggan);
} else {
......
......@@ -5,6 +5,7 @@ import 'package:byod/helper/prefs.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:geolocator/geolocator.dart';
import '../helper/widget/button_modal.dart';
......@@ -75,7 +76,8 @@ class NoRoute extends StatelessWidget {
? GestureDetector(
onTap: () {
Geolocator.requestPermission().then((value) {
if (value != LocationPermission.denied) {
if (value != LocationPermission.denied &&
value != LocationPermission.deniedForever) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
......@@ -84,6 +86,9 @@ class NoRoute extends StatelessWidget {
),
),
);
} else {
EasyLoading.showToast(
'Silahkan aktifkan lokasi browser anda');
}
});
},
......
......@@ -10,7 +10,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../api/api.dart';
import '../../main.dart';
import '../../models/bill.dart';
import 'function.dart';
import 'list_voucher.dart';
......
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/bloc/branch_list.dart';
import 'package:byod/bloc/filter_menu.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/models/branchs.dart';
import 'package:byod/ui/home/new_home2.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../bloc/search_branch.dart';
import '../helper/widget/style.dart';
import 'app_bar_select_branch.dart';
class SelectBranch extends StatelessWidget {
const SelectBranch({super.key});
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: backgroundColor,
body: ScreenResponsive(
widget: const CoreBranch(),
widthScreen: MediaQuery.of(context).size.width,
isCoreLayout: true,
),
),
);
}
}
class CoreBranch extends StatelessWidget {
const CoreBranch({super.key});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: BlocBuilder<BranchList, List<Branch>>(
builder: (context, listB) {
return BlocBuilder<SearchBranch, List<Branch>>(
builder: (contextSearch, listSearch) {
List<Branch> listBranch;
if (listSearch.isNotEmpty) {
if (listSearch[0].id == '0') {
listBranch = listB;
} else {
listBranch = listSearch;
}
} else {
listBranch = listSearch;
}
return Column(
children: [
CustomAppBar(
// allBranch: listB,
),
const SizedBox(
height: 16,
),
Expanded(
child: ListView.builder(
itemCount: listBranch.length,
itemBuilder: (context, i) {
return GestureDetector(
onTap: () {
context.read<FilterMenuBloc>().catAndMenu(
listBranch[i].branchCode,
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
);
setIsDelivery(listBranch[i].isDelivery);
setIsPickup(listBranch[i].isPickup);
setBranch(listBranch[i].branchCode);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()),
);
},
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,
listBranch[i].name,
style: historyOrderStyle(),
),
const SizedBox(
height: 4,
),
defaultText(
context,
"${listBranch[i].distance} KM",
style: historyOrderStyle(),
)
],
),
),
Container(
width: 145,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
defaultText(
context,
(listBranch[i].isDelivery)
? 'Delivery Tersedia'
: 'Delivery Tidak Tersedia',
style: historyOrderStyle(
color: textGreyDeskripsi,
),
),
const SizedBox(
height: 15,
),
defaultText(
context,
(listBranch[i].isPickup)
? 'Pickup Tersedia'
: 'Pickup Tidak Tersedia',
style: historyOrderStyle(
color: textGreyDeskripsi,
),
),
],
),
)
],
),
),
),
);
}),
),
],
);
},
);
},
),
);
}
}
This diff is collapsed.
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/helper/prefs.dart';
import 'package:byod/models/filter_menu.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -225,7 +226,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
],
),
),
(!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.billDetail.orderStatus)
? Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill,
......@@ -236,12 +238,14 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
),
)
: const SizedBox(),
(!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.billDetail.orderStatus)
? const SizedBox(
height: 11,
)
: const SizedBox(),
(!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
isVisibleAddRemoveQuantityButtonCheckout(widget.isHistory,
widget.billDetail.orderStatus)
? Container(
padding: EdgeInsets.only(
left: paddingLeftRightBill,
......@@ -331,87 +335,6 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
plus: plus,
minus: minus,
),
// 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,
)
......
This diff is collapsed.
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