Commit c2f92bb8 authored by Dio Maulana's avatar Dio Maulana

webview delivery address and redesign variant modal

parent 208bf8af
{
"base_url": "https://7f25-125-165-111-49.ap.ngrok.io/",
"base_url": "https://6b3f-125-165-111-49.ap.ngrok.io/",
"title": "Ravintola Dev BYOD",
"isResponsive": true,
"debug": true
......
......@@ -6,6 +6,7 @@ import 'package:byod/bloc/view_bill.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/logger.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/models/address_user.dart';
import 'package:byod/models/bill.dart';
import 'package:byod/models/bill_detail.dart';
import 'package:byod/models/feedback_option.dart';
......@@ -42,6 +43,7 @@ import '../models/variants.dart';
// }
// }
const String endPoint = 'romi/api/v2/byod/';
const String endPointRdm = 'rdm/api/';
class Api {
static Future<dynamic> getBranch(String branchCode, String brandCode,
......@@ -2009,4 +2011,48 @@ class Api {
return false;
}
}
static Future<Address> getAddress() async {
String baseUrl = getBaseUrl();
String apiUrl = "$baseUrl${endPointRdm}get_address/";
String sessionId = getSessionId();
Address defaultResult = Address(
id: '',
label: '',
address: '',
locationDetail: '',
lat: '',
long: '',
recepientName: '',
recepientPhone: '',
notes: '',
);
try {
Map data = {
"session_id": sessionId,
};
var bodies = jsonEncode(data);
var jsonObject = await httpPost(apiUrl, bodies, 'getAddress');
if (jsonObject != false) {
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
Map<String, dynamic> data = jsonObject['data'];
return Address.json(data);
}
return defaultResult;
} else {
return defaultResult;
}
} catch (e) {
if (debug) {
logd('API CLASS ON API.DART, FUNGSI: getAddress, URL : $apiUrl',
'ERROR CONNECT TO SERVER, ERROR CATCH : $e');
}
return defaultResult;
}
}
}
import 'package:byod/models/address_user.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../api/api.dart';
class AddressUser extends Cubit<Address> {
AddressUser()
: super(
Address(
id: '',
label: '',
address: '',
locationDetail: '',
lat: '',
long: '',
recepientName: '',
recepientPhone: '',
notes: '',
),
);
void getAddressUser() async {
var result = await Api.getAddress();
emit(result);
}
}
......@@ -619,6 +619,9 @@ const double maxHeightScreens = 600;
const String searchIcon = '\uf002';
const double searchIconSize = 0.03;
const String saveIcon = '\uf0c7';
const double saveIconSize = 17;
const String infoCircle = '\uf05a';
const double infoCircleSize = 0.015;
......
......@@ -17,6 +17,7 @@ Future<dynamic> buttonDialogGlobal(
Color okButtonColor = Colors.indigo,
Color cancelButtonColor = Colors.transparent,
Color textCancelColor = textColorBlack,
bool isOkeButtonShow = true,
}) {
return showDialog(
context: context,
......@@ -39,20 +40,24 @@ Future<dynamic> buttonDialogGlobal(
child: defaultText(
context,
description,
style: textStyleNormalFont(context),
),
),
const SizedBox(height: 10),
GestureDetector(
onTap: () {
ontapOk();
},
child: ButtonComponent(
buttonColor: okButtonColor,
teksButton: textOnOk,
style: textStyleDialog(),
),
),
const SizedBox(height: 10),
(isOkeButtonShow)
? GestureDetector(
onTap: () {
ontapOk();
},
child: ButtonComponent(
buttonColor: okButtonColor,
teksButton: textOnOk,
),
)
: const SizedBox(),
(isOkeButtonShow)
? const SizedBox(height: 10)
: const SizedBox(),
GestureDetector(
onTap: () {
ontapCancel();
......
......@@ -46,6 +46,21 @@ TextStyle emojiStyle({
);
}
TextStyle textStyleDialog({
font = 14,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w400,
FontStyle? fontStyle,
}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: fontWeight,
color: color,
fontStyle: fontStyle,
);
}
TextStyle historyOrderStyle({
font = 12,
Color color = textColorBlack,
......@@ -296,6 +311,18 @@ TextStyle addButton({
);
}
TextStyle addressStyle({
font = 14,
Color color = textColorBlack,
}) {
return TextStyle(
fontFamily: 'OpenSans',
fontSize: font,
fontWeight: FontWeight.w400,
color: color,
);
}
TextStyle rincianPembayaran({
font = 12,
Color color = textColorBlack,
......@@ -347,6 +374,19 @@ TextStyle textAmountButtonBottomCart({
);
}
TextStyle textStyleVariantModal({
font = 12,
Color color = textColorBlack,
FontWeight fontWeight = FontWeight.w300,
}) {
return TextStyle(
fontFamily: (fontFamily == '') ? null : fontFamily,
fontSize: font,
fontWeight: fontWeight,
color: color,
);
}
TextStyle textCountItem({
font = 20,
Color color = textInButton,
......
......@@ -2,6 +2,7 @@
import 'dart:convert';
import 'package:byod/bloc/address_user_bloc.dart';
import 'package:byod/bloc/category_selection.dart';
import 'package:byod/bloc/check_voucher.dart';
import 'package:byod/bloc/member_info.dart';
......@@ -16,6 +17,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_strategy/url_strategy.dart';
import 'package:web_browser_detect/web_browser_detect.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'bloc/branch_exist.dart';
import 'bloc/branch_list.dart';
......@@ -34,7 +36,7 @@ import 'bloc/view_bill.dart';
import 'package:flutter/services.dart' as bundle_root;
import 'bloc/voucher_list.dart';
import 'ui/confirm_order/confirm_order.dart';
import 'ui/webview/webview.dart';
late SharedPreferences prefs;
bool isExcelso = false;
......@@ -192,6 +194,7 @@ class _MyAppState extends State<MyApp> {
BlocProvider(create: (_) => SearchHistory()),
BlocProvider(create: (_) => BranchList()),
BlocProvider(create: (_) => SearchBranch()),
BlocProvider(create: (_) => AddressUser()),
],
child: MaterialApp(
title: (widget.title == null) ? defaultTitle : widget.title,
......@@ -208,7 +211,11 @@ class _MyAppState extends State<MyApp> {
// initialRoute: '/',
// routes: {
// '/': (context) => const ConfirmOrder(),
// '/': (context) => WebViewMap(
// titleAppBar: 'Pilih Alamat',
// url:
// 'https://fdr-dev.ravku.com/web/store_url/706400e0-fb59-4317-a73b-8ff76f32f929/',
// ),
// },
// onGenerateRoute: (routes) {
// return MaterialPageRoute(
......
class Address {
String id;
String label;
String address;
String locationDetail;
String lat;
String long;
String recepientName;
String recepientPhone;
String notes;
Address({
required this.id,
required this.label,
required this.address,
required this.locationDetail,
required this.lat,
required this.long,
required this.recepientName,
required this.recepientPhone,
required this.notes,
});
factory Address.json(Map<String, dynamic> json) {
return Address(
id: json['id'],
label: json['label'],
address: json['address'],
locationDetail: json['location_detail'],
lat: json['lat'],
long: json['long'],
recepientName: json['recipient_name'],
recepientPhone: json['recipient_phone'],
notes: json['notes'],
);
}
}
import 'package:byod/ui/home/variant_cat_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -132,25 +133,19 @@ class ShowMenuBottomSheet extends StatelessWidget {
1,
[]); // check pada bloc untuk mengethui list arraynya
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VariantCat(
namaMenu: menuDetail[i].name,
variantCategories:
menuDetail[i].variantCat,
initPrice: amountParseToInt(
menuDetail[i].price),
idItem: menuDetail[i].id,
imageUrl:
menuDetail[i].imageUrlMedium,
listCurrentOrder: list,
orderDetail: OrderDetail(
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: []),
)));
context,
MaterialPageRoute(
builder: (_) => VariantCatNew(
initPrice:
amountParseToInt(menuDetail[i].price),
variantCategories: menuDetail[i].variantCat,
namaMenu: menuDetail[i].name,
idItem: menuDetail[i].id,
imageUrl: menuDetail[i].imageUrlMedium,
listCurrentOrder: list,
),
),
);
} else {
Navigator.pop(context);
showModalBottomSheet(
......
// ignore_for_file: must_be_immutable
import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:flutter/material.dart';
import '../../helper/helper.dart';
import '../../helper/widget/button_modal.dart';
import '../../models/orders.dart';
import '../../models/variant_categories.dart';
class CustomizeVariantNew extends StatelessWidget {
CustomizeVariantNew({
super.key,
required this.orders,
required this.variantCat,
});
Orders orders;
List<VariantCategories> variantCat;
@override
Widget build(BuildContext context) {
void minus() {}
void plus() {}
double widthScreen = responsiveWidthScreen(context);
return Container(
// width: widthScreen,
height: MediaQuery.of(context).size.height * 0.8,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(19),
topRight: Radius.circular(19),
),
color: backgroundWhite,
),
child: Stack(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 8,
),
Center(
child: Container(
width: 50,
height: 3,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: disabledColor,
),
),
),
const SizedBox(
height: 28,
),
defaultText(
context,
'Nasi Ayam Kecap + Telur',
maxLines: 2,
overFlow: TextOverflow.ellipsis,
style: textStyleVariantModal(
font: 20,
fontWeight: FontWeight.w600,
),
),
const SizedBox(
height: 12,
),
Expanded(
child: ListView.builder(
itemCount: 10,
itemBuilder: (context, i) {
return Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(bottom: 8),
child: defaultText(
context,
'2 X 25,000',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
style: textStyleVariantModal(),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
for (int d = 0; d < 3; d++)
defaultText(
context,
'Pedas ke $d',
maxLines: 1,
overFlow: TextOverflow.ellipsis,
)
],
),
Container(
padding: const EdgeInsets.only(
bottom: 8,
top: 8,
),
child: defaultText(
context,
'Catatan: catatan....',
maxLines: 3,
overFlow: TextOverflow.ellipsis,
style: textStyleVariantModal(),
),
),
],
),
PlusMinusButton(
initialValue: 1,
minus: minus,
plus: plus,
)
],
),
const SizedBox(
height: 12,
),
const Divider(
thickness: 1,
height: 1,
color: dividerGrey,
),
const SizedBox(
height: 16,
),
],
);
}),
)
],
),
),
Positioned(
bottom: 0,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: paddingLeftRight),
height: 43,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: buttonColor,
borderRadius: BorderRadius.circular(48),
),
child: Center(
child: defaultText(
context,
'Tambah Variant',
style: addButton(),
),
),
),
)
],
),
);
}
}
// Positioned(
// bottom: 0,
// child: ButtonComponent(
// buttonColor: buttonColor, teksButton: 'Tambah Variant'),
// )
\ No newline at end of file
......@@ -4,6 +4,7 @@ import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/plus_minus_button.dart';
import 'package:byod/models/orders.dart';
import 'package:byod/ui/home/bottom_sheet_variant_new.dart';
import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -340,11 +341,19 @@ class MenuListUtama extends StatelessWidget {
showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(19),
),
context: context,
builder: (context) {
return CustomizeVariant(
orders: list[indexListOrderan],
variantCat: menuUtama.variantCat);
// return CustomizeVariant(
// orders: list[indexListOrderan],
// variantCat: menuUtama.variantCat,
// );
return CustomizeVariantNew(
orders: list[indexListOrderan],
variantCat: menuUtama.variantCat,
);
},
);
}
......
......@@ -6,6 +6,7 @@ import 'package:byod/helper/helper.dart';
import 'package:byod/helper/prefs.dart';
import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/style.dart';
import 'package:byod/models/address_user.dart';
import 'package:byod/ui/history_order/history_new.dart';
import 'package:byod/ui/payment/payment_balance.dart';
import 'package:byod/ui/screen_responsive.dart';
......@@ -17,6 +18,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:uuid/uuid.dart';
import '../../api/api.dart';
import '../../bloc/address_user_bloc.dart';
import '../../bloc/branch_exist.dart';
import '../../bloc/feedback_option.dart';
import '../../bloc/view_bill.dart';
......@@ -32,6 +34,7 @@ import '../home/new_home2.dart';
import '../payment/function.dart';
import '../payment/payment.dart';
import '../payment/payment_voucher.dart';
import '../webview/webview.dart';
import 'app_bar.dart';
import 'list_order.dart';
import 'rincian_pembayaran.dart';
......@@ -69,6 +72,7 @@ class ViewBillNew extends StatelessWidget {
void getBillFunc(BuildContext context) {
if (!isHistory) {
context.read<ViewBillBloc>().getBill();
context.read<AddressUser>().getAddressUser();
} else {
context.read<ViewBillBloc>().getBill(
orderIdH: orderId,
......@@ -1250,6 +1254,21 @@ class CoreBill extends StatelessWidget {
}
Future<dynamic> modalBottomSelectOption(BuildContext context) {
void ontapOkeChangeOutlet() {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
return showModalBottomSheet(
backgroundColor: backgroundWhite,
context: context,
......@@ -1287,9 +1306,31 @@ class CoreBill extends StatelessWidget {
),
GestureDetector(
onTap: () {
setIsCustomerDelivery(false);
getBillFunc(context);
Navigator.pop(context);
if (getIsPickup()) {
setIsCustomerDelivery(false);
getBillFunc(context);
Navigator.pop(context);
} else {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat menerima pickup order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
}
},
child: Container(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10),
......@@ -1313,9 +1354,31 @@ class CoreBill extends StatelessWidget {
),
GestureDetector(
onTap: () {
setIsCustomerDelivery(true);
getBillFunc(context);
Navigator.pop(context);
if (!getIsDelivery()) {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat delivery order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
} else {
setIsCustomerDelivery(true);
getBillFunc(context);
Navigator.pop(context);
}
},
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 24),
......@@ -1459,118 +1522,276 @@ Apakah ingin melanjutkan ?''';
);
}
Column deliveryOption(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
BlocBuilder deliveryOption(BuildContext context) {
void ontapAddressDetail() {
Navigator.pop(context);
}
return BlocBuilder<AddressUser, Address>(
builder: (context, address) {
if (address.id != '') {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
defaultText(context, 'Alamat Pengantaran'),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
defaultText(
context,
'Detail Alamat:',
style: addressStyle(
font: 10,
),
),
const SizedBox(
height: 6,
),
defaultText(
context,
address.recepientName,
style: addressStyle(
font: 10,
),
),
const SizedBox(
height: 6,
),
defaultText(
context,
address.recepientPhone,
style: addressStyle(
font: 10,
),
),
const SizedBox(
height: 6,
),
defaultText(
context,
address.address,
style: addressStyle(
font: 10,
),
),
// (address.locationDetail != '')
// ? Container(
// padding: const EdgeInsets.only(top: 6),
// child: defaultText(
// context,
// ' Detail: ${address.locationDetail}',
// style: addressStyle(
// font: 10,
// ),
// ),
// )
// : const SizedBox(),
// (address.notes != '')
// ? Container(
// padding: const EdgeInsets.only(top: 6),
// child: defaultText(
// context,
// ' Note: ${address.notes}',
// style: addressStyle(
// font: 10,
// ),
// ),
// )
// : const SizedBox()
],
),
),
const SizedBox(
height: 6,
width: 10,
),
defaultText(context, 'Blok M Barat'),
GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => WebViewMap(
titleAppBar: 'Ganti Alamat',
url:
'${getBaseUrl()}rdm/address/add/?session_id=${getSessionId()}',
),
),
);
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Ganti Alamat',
style: addButton(
font: 8,
color: buttonColor,
),
),
),
),
)
],
),
),
const SizedBox(
width: 5,
),
Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Ganti Alamat',
style: addButton(
font: 8,
color: buttonColor,
),
),
const SizedBox(
height: 21,
),
)
],
),
const SizedBox(
height: 21,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: 100,
height: 23,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: buttonColor,
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
(address.locationDetail != '')
? GestureDetector(
onTap: () {
buttonDialogGlobal(
context,
'Detail Lokasi',
address.locationDetail,
'OK',
'Close',
ontapAddressDetail,
ontapAddressDetail,
isOkeButtonShow: false,
);
},
child: Container(
width: 100,
height: 23,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: buttonColor,
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage(
'assets/icons/pin-address.png'),
),
const SizedBox(
width: 12.6,
),
defaultText(
context,
'Detail Alamat',
style: addButton(
font: 8,
),
)
],
),
),
),
)
: const SizedBox(),
(address.locationDetail != '')
? const SizedBox(
width: 16,
)
: const SizedBox(),
(address.notes != '')
? GestureDetector(
onTap: () {
buttonDialogGlobal(
context,
'Catatan',
address.notes,
'OK',
'Close',
ontapAddressDetail,
ontapAddressDetail,
isOkeButtonShow: false,
);
},
child: Container(
width: 84,
height: 23,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: buttonColor,
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage('assets/icons/note.png'),
),
const SizedBox(
width: 10,
),
defaultText(
context,
'Catatan',
style: addButton(font: 8),
)
],
),
),
),
)
: const SizedBox(),
],
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage('assets/icons/pin-address.png'),
],
);
} else {
return Container(
width: maxWidthScreens,
color: backgroundWhite,
child: Align(
alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => WebViewMap(
titleAppBar: 'Pilih Alamat',
url:
'${getBaseUrl()}rdm/address/add/?session_id=${getSessionId()}'),
),
const SizedBox(
width: 12.6,
);
},
child: Container(
width: 98,
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
defaultText(
),
child: Center(
child: defaultText(
context,
'Detail Alamat',
'Pilih Alamat',
style: addButton(
font: 8,
color: buttonColor,
),
)
],
),
),
),
const SizedBox(
width: 16,
),
Container(
width: 84,
height: 23,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: buttonColor,
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage('assets/icons/note.png'),
),
const SizedBox(
width: 10,
),
defaultText(
context,
'Catatan',
style: addButton(font: 8),
)
],
),
),
),
)
],
),
],
),
);
}
},
);
}
}
......@@ -1616,27 +1837,104 @@ class EmptyBill extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(context, 'Meja $tableNumber',
style: viewbillStyle())),
Container(
width: double.infinity,
color: backgroundWhite,
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
bottom: 18,
),
child: defaultText(
context,
customerName,
style: customerNameViewbill(),
color: backgroundWhite.withOpacity(0.9),
height: 115,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight),
child: defaultText(
context,
(getIsDeliveryPickup())
? (getIsCustomerDelivery())
? 'Delivery'
: 'Pickup'
: 'Meja ${tableNumber}',
style: viewbillStyle()),
),
Container(
padding: const EdgeInsets.only(
left: paddingLeftRight,
right: paddingLeftRight,
// bottom: 18,
),
child: defaultText(context, customerName,
style: customerNameViewbill()),
),
],
),
(getIsDeliveryPickup())
? GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
const SelectBranch(),
),
);
},
child: Container(
height: 30,
width: 80,
margin: const EdgeInsets.only(
right: 20,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(40),
color: backgroundWhite,
border: Border.all(
color: buttonColor,
),
),
child: Center(
child: defaultText(
context,
'Ganti Outlet',
style: addButton(
font: 8,
color: textColorBlack,
),
),
),
),
)
: const SizedBox()
],
),
),
// Container(
// width: double.infinity,
// color: backgroundWhite,
// padding: const EdgeInsets.symmetric(
// horizontal: paddingLeftRight),
// child: defaultText(context, 'Meja $tableNumber',
// style: viewbillStyle()),
// ),
// Container(
// width: double.infinity,
// color: backgroundWhite,
// padding: const EdgeInsets.only(
// left: paddingLeftRight,
// right: paddingLeftRight,
// bottom: 18,
// ),
// child: defaultText(
// context,
// customerName,
// style: customerNameViewbill(),
// ),
// ),
const SizedBox(
height: 24,
),
......
// ignore_for_file: sized_box_for_whitespace
import 'package:byod/ui/home/new_home2.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/address_user_bloc.dart';
import '../../helper/helper.dart';
import '../../helper/widget/style.dart';
......@@ -28,7 +32,12 @@ class CustomAppBar extends StatelessWidget {
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew(),
),
);
},
child: Container(
width: 24,
......@@ -55,12 +64,32 @@ class CustomAppBar extends StatelessWidget {
),
],
),
Container(
width: 24,
height: 24,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), color: buttonColor),
)
GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew(),
),
);
},
child: Row(
children: [
defaultText(
context,
'Simpan',
style: appBarNameViewBill(),
),
const SizedBox(
width: 5,
),
fontAwesomeNew(
saveIcon,
saveIconSize,
),
],
),
),
],
),
);
......
import 'dart:async';
// import 'dart:async';
// import 'package:flutter/material.dart';
// // import 'package:webview_flutter/webview_flutter.dart';
// import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
// import 'package:fwfh_webview/fwfh_webview.dart';
// import '../splash.dart';
// import 'app_bar_webview.dart';
// // import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
// class WebViewMap extends StatelessWidget {
// const WebViewMap({
// super.key,
// required this.titleAppBar,
// required this.url,
// });
// final String titleAppBar;
// final String url;
// Future<bool> tapUrl(x, BuildContext context) async {
// if (x.contains('jasaotp')) {
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (_) => Splash(
// // pathSegmentString: [''],
// // context: context,
// // ),
// // ),
// // );
// }
// return true;
// }
// @override
// Widget build(BuildContext context) {
// return Column(
// children: [
// CustomAppBar(
// titleAppBar: titleAppBar,
// ),
// Expanded(
// child: HtmlWidget(
// '<iframe src="$url"></iframe>',
// factoryBuilder: () => MyWidgetFactory(),
// onTapImage: (x) {
// print(x);
// },
// onTapUrl: (x) {
// return tapUrl(x, context);
// },
// ),
// ),
// // WebView(
// // initialUrl: url,
// // onWebViewCreated: (WebViewController controller) {
// // _controller.complete(controller);
// // },
// // )
// ],
// );
// // return Scaffold(
// // appBar: AppBar(
// // title: const Text('Flutter WebView example'),
// // // actions: <Widget>[
// // // _SampleMenu(_controller.future),
// // // ],
// // ),
// // body: WebView(
// // initialUrl: url,
// // onWebViewCreated: (WebViewController controller) {
// // _controller.complete(controller);
// // },
// // ),
// // );
// }
// }
// class MyWidgetFactory extends WidgetFactory with WebViewFactory {}
// asdal;skda;sldkasd
// import 'package:flutter/material.dart';
// import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
// // import 'package:fwfh_webview/fwfh_webview.dart';
// import '../../helper/prefs.dart';
// import 'app_bar_webview.dart';
// class WebViewMap extends StatefulWidget {
// const WebViewMap({super.key});
// @override
// State<WebViewMap> createState() => _WebViewMapState();
// }
// class _WebViewMapState extends State<WebViewMap> {
// final _webViewPlugin = FlutterWebviewPlugin();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// // on pressing back button, exiting the screen instead of showing loading symbol
// _webViewPlugin.onDestroy.listen((_) {
// if (Navigator.canPop(context)) {
// Navigator.of(context).pop();
// }
// });
// }
// @override
// Widget build(BuildContext context) {
// // WillPopScope will prevent loading
// return Column(
// children: [
// const CustomAppBar(
// titleAppBar: 'Pilih Alamat',
// ),
// Expanded(
// // child: WebviewScaffold(
// // url: '${getBaseUrl()}rdm/address/add/',
// // withLocalStorage: true,
// // withJavascript: true,
// // appCacheEnabled: true,
// // ),
// child: WebviewScaffold(url: '${getBaseUrl()}rdm/address/add/')
// )
// ],
// );
// }
// }
import 'package:byod/bloc/address_user_bloc.dart';
import 'package:byod/ui/viewbill/view_bill_new.dart';
import 'package:byod/ui/webview/app_bar_webview.dart';
import 'package:flutter/material.dart';
// import 'package:webview_flutter/webview_flutter.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:fwfh_webview/fwfh_webview.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:webviewx_plus/webviewx_plus.dart';
import '../splash.dart';
import 'app_bar_webview.dart';
// import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
import '../../helper/helper.dart';
import '../../helper/widget/button_dialog.dart';
class WebViewHtml extends StatelessWidget {
const WebViewHtml({
class WebViewMap extends StatefulWidget {
const WebViewMap({
super.key,
required this.titleAppBar,
required this.url,
});
final String titleAppBar;
final String url;
Future<bool> tapUrl(x, BuildContext context) async {
if (x.contains('jasaotp')) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => Splash(
// pathSegmentString: [''],
// context: context,
// ),
// ),
// );
}
return true;
@override
State<WebViewMap> createState() => _WebViewMapState();
}
class _WebViewMapState extends State<WebViewMap> {
late WebViewXController webviewController;
void onTapOkPop() {
context.read<AddressUser>().getAddressUser();
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew(),
),
);
}
@override
Widget build(BuildContext context) {
return Column(
children: [
CustomAppBar(
titleAppBar: titleAppBar,
),
Expanded(
child: HtmlWidget(
'<iframe src="$url"></iframe>',
factoryBuilder: () => MyWidgetFactory(),
onTapImage: (x) {
print(x);
},
onTapUrl: (x) {
return tapUrl(x, context);
},
),
),
// WebView(
// initialUrl: url,
// onWebViewCreated: (WebViewController controller) {
// _controller.complete(controller);
// },
// )
],
return WillPopScope(
onWillPop: () async {
final shouldPop = await buttonDialogGlobal(
context,
'Konfirmasi',
'Apakah anda sudah mengisi alamat dengan benar ?',
'Ya',
'Batal',
onTapOkPop,
onTapOkPop,
okButtonColor: buttonColor,
cancelButtonColor: cancelColorButton,
);
return shouldPop ?? false;
},
child: Column(
children: [
CustomAppBar(titleAppBar: widget.titleAppBar),
Expanded(
child: WebViewX(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
initialContent: widget.url,
javascriptMode: JavascriptMode.unrestricted,
initialSourceType: SourceType.url,
onWebViewCreated: (controller) {
webviewController = controller;
},
// navigationDelegate: (NavigationRequest request) {
// return NavigationDecision.navigate;
// },
),
)
],
),
);
// return Scaffold(
// appBar: AppBar(
// title: const Text('Flutter WebView example'),
// // actions: <Widget>[
// // _SampleMenu(_controller.future),
// // ],
// ),
// body: WebView(
// initialUrl: url,
// onWebViewCreated: (WebViewController controller) {
// _controller.complete(controller);
// },
// ),
// );
}
}
class MyWidgetFactory extends WidgetFactory with WebViewFactory {}
......@@ -142,6 +142,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_webview_plugin:
dependency: "direct main"
description:
name: flutter_webview_plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
flutter_widget_from_html_core:
dependency: "direct main"
description:
......@@ -218,7 +225,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.4"
version: "0.13.5"
http_parser:
dependency: transitive
description:
......@@ -331,6 +338,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
pointer_interceptor:
dependency: transitive
description:
name: pointer_interceptor
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.3+3"
process:
dependency: transitive
description:
......@@ -595,13 +609,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
webview_flutter_web:
dependency: "direct main"
description:
name: webview_flutter_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0+4"
webview_flutter_wkwebview:
dependency: transitive
description:
......@@ -609,6 +616,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.5"
webviewx_plus:
dependency: "direct main"
description:
name: webviewx_plus
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
win32:
dependency: transitive
description:
......@@ -624,5 +638,5 @@ packages:
source: hosted
version: "0.2.0+1"
sdks:
dart: ">=2.17.3 <3.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.1.0-0"
......@@ -33,6 +33,7 @@ dependencies:
sdk: flutter
flutter_bloc: ^8.0.1
flutter_easyloading: ^3.0.3
flutter_webview_plugin: ^0.4.0
flutter_widget_from_html_core: ^0.8.5+3
fwfh_webview: ^0.6.2+3
geolocator: ^9.0.2
......@@ -48,7 +49,7 @@ dependencies:
url_strategy: ^0.2.0
uuid: ^3.0.6
web_browser_detect: ^2.0.3
webview_flutter_web: ^0.1.0+4
webviewx_plus: ^0.3.2
dev_dependencies:
flutter_lints: ^2.0.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment