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", "title": "Ravintola Dev BYOD",
"isResponsive": true, "isResponsive": true,
"debug": true "debug": true
......
...@@ -6,6 +6,7 @@ import 'package:byod/bloc/view_bill.dart'; ...@@ -6,6 +6,7 @@ import 'package:byod/bloc/view_bill.dart';
import 'package:byod/helper/helper.dart'; import 'package:byod/helper/helper.dart';
import 'package:byod/helper/logger.dart'; import 'package:byod/helper/logger.dart';
import 'package:byod/helper/prefs.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.dart';
import 'package:byod/models/bill_detail.dart'; import 'package:byod/models/bill_detail.dart';
import 'package:byod/models/feedback_option.dart'; import 'package:byod/models/feedback_option.dart';
...@@ -42,6 +43,7 @@ import '../models/variants.dart'; ...@@ -42,6 +43,7 @@ import '../models/variants.dart';
// } // }
// } // }
const String endPoint = 'romi/api/v2/byod/'; const String endPoint = 'romi/api/v2/byod/';
const String endPointRdm = 'rdm/api/';
class Api { class Api {
static Future<dynamic> getBranch(String branchCode, String brandCode, static Future<dynamic> getBranch(String branchCode, String brandCode,
...@@ -2009,4 +2011,48 @@ class Api { ...@@ -2009,4 +2011,48 @@ class Api {
return false; 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; ...@@ -619,6 +619,9 @@ const double maxHeightScreens = 600;
const String searchIcon = '\uf002'; const String searchIcon = '\uf002';
const double searchIconSize = 0.03; const double searchIconSize = 0.03;
const String saveIcon = '\uf0c7';
const double saveIconSize = 17;
const String infoCircle = '\uf05a'; const String infoCircle = '\uf05a';
const double infoCircleSize = 0.015; const double infoCircleSize = 0.015;
......
...@@ -17,6 +17,7 @@ Future<dynamic> buttonDialogGlobal( ...@@ -17,6 +17,7 @@ Future<dynamic> buttonDialogGlobal(
Color okButtonColor = Colors.indigo, Color okButtonColor = Colors.indigo,
Color cancelButtonColor = Colors.transparent, Color cancelButtonColor = Colors.transparent,
Color textCancelColor = textColorBlack, Color textCancelColor = textColorBlack,
bool isOkeButtonShow = true,
}) { }) {
return showDialog( return showDialog(
context: context, context: context,
...@@ -39,20 +40,24 @@ Future<dynamic> buttonDialogGlobal( ...@@ -39,20 +40,24 @@ Future<dynamic> buttonDialogGlobal(
child: defaultText( child: defaultText(
context, context,
description, description,
style: textStyleNormalFont(context), style: textStyleDialog(),
),
),
const SizedBox(height: 10),
GestureDetector(
onTap: () {
ontapOk();
},
child: ButtonComponent(
buttonColor: okButtonColor,
teksButton: textOnOk,
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
(isOkeButtonShow)
? GestureDetector(
onTap: () {
ontapOk();
},
child: ButtonComponent(
buttonColor: okButtonColor,
teksButton: textOnOk,
),
)
: const SizedBox(),
(isOkeButtonShow)
? const SizedBox(height: 10)
: const SizedBox(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
ontapCancel(); ontapCancel();
......
...@@ -46,6 +46,21 @@ TextStyle emojiStyle({ ...@@ -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({ TextStyle historyOrderStyle({
font = 12, font = 12,
Color color = textColorBlack, Color color = textColorBlack,
...@@ -296,6 +311,18 @@ TextStyle addButton({ ...@@ -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({ TextStyle rincianPembayaran({
font = 12, font = 12,
Color color = textColorBlack, Color color = textColorBlack,
...@@ -347,6 +374,19 @@ TextStyle textAmountButtonBottomCart({ ...@@ -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({ TextStyle textCountItem({
font = 20, font = 20,
Color color = textInButton, Color color = textInButton,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:byod/bloc/address_user_bloc.dart';
import 'package:byod/bloc/category_selection.dart'; import 'package:byod/bloc/category_selection.dart';
import 'package:byod/bloc/check_voucher.dart'; import 'package:byod/bloc/check_voucher.dart';
import 'package:byod/bloc/member_info.dart'; import 'package:byod/bloc/member_info.dart';
...@@ -16,6 +17,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; ...@@ -16,6 +17,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_strategy/url_strategy.dart'; import 'package:url_strategy/url_strategy.dart';
import 'package:web_browser_detect/web_browser_detect.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_exist.dart';
import 'bloc/branch_list.dart'; import 'bloc/branch_list.dart';
...@@ -34,7 +36,7 @@ import 'bloc/view_bill.dart'; ...@@ -34,7 +36,7 @@ import 'bloc/view_bill.dart';
import 'package:flutter/services.dart' as bundle_root; import 'package:flutter/services.dart' as bundle_root;
import 'bloc/voucher_list.dart'; import 'bloc/voucher_list.dart';
import 'ui/confirm_order/confirm_order.dart'; import 'ui/webview/webview.dart';
late SharedPreferences prefs; late SharedPreferences prefs;
bool isExcelso = false; bool isExcelso = false;
...@@ -192,6 +194,7 @@ class _MyAppState extends State<MyApp> { ...@@ -192,6 +194,7 @@ class _MyAppState extends State<MyApp> {
BlocProvider(create: (_) => SearchHistory()), BlocProvider(create: (_) => SearchHistory()),
BlocProvider(create: (_) => BranchList()), BlocProvider(create: (_) => BranchList()),
BlocProvider(create: (_) => SearchBranch()), BlocProvider(create: (_) => SearchBranch()),
BlocProvider(create: (_) => AddressUser()),
], ],
child: MaterialApp( child: MaterialApp(
title: (widget.title == null) ? defaultTitle : widget.title, title: (widget.title == null) ? defaultTitle : widget.title,
...@@ -208,7 +211,11 @@ class _MyAppState extends State<MyApp> { ...@@ -208,7 +211,11 @@ class _MyAppState extends State<MyApp> {
// initialRoute: '/', // initialRoute: '/',
// routes: { // 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) { // onGenerateRoute: (routes) {
// return MaterialPageRoute( // 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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -132,25 +133,19 @@ class ShowMenuBottomSheet extends StatelessWidget { ...@@ -132,25 +133,19 @@ class ShowMenuBottomSheet extends StatelessWidget {
1, 1,
[]); // check pada bloc untuk mengethui list arraynya []); // check pada bloc untuk mengethui list arraynya
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => VariantCat( builder: (_) => VariantCatNew(
namaMenu: menuDetail[i].name, initPrice:
variantCategories: amountParseToInt(menuDetail[i].price),
menuDetail[i].variantCat, variantCategories: menuDetail[i].variantCat,
initPrice: amountParseToInt( namaMenu: menuDetail[i].name,
menuDetail[i].price), idItem: menuDetail[i].id,
idItem: menuDetail[i].id, imageUrl: menuDetail[i].imageUrlMedium,
imageUrl: listCurrentOrder: list,
menuDetail[i].imageUrlMedium, ),
listCurrentOrder: list, ),
orderDetail: OrderDetail( );
allIdVariant: '',
totalItem: 0,
totalHarga: 0,
note: '',
orderVariant: []),
)));
} else { } else {
Navigator.pop(context); Navigator.pop(context);
showModalBottomSheet( 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'; ...@@ -4,6 +4,7 @@ import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/helper/widget/button_modal.dart'; import 'package:byod/helper/widget/button_modal.dart';
import 'package:byod/helper/widget/plus_minus_button.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/bottom_sheet_variant_new.dart';
import 'package:byod/ui/screen_responsive.dart'; import 'package:byod/ui/screen_responsive.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -340,11 +341,19 @@ class MenuListUtama extends StatelessWidget { ...@@ -340,11 +341,19 @@ class MenuListUtama extends StatelessWidget {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white.withOpacity(0), backgroundColor: Colors.white.withOpacity(0),
isScrollControlled: true, isScrollControlled: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(19),
),
context: context, context: context,
builder: (context) { builder: (context) {
return CustomizeVariant( // return CustomizeVariant(
orders: list[indexListOrderan], // orders: list[indexListOrderan],
variantCat: menuUtama.variantCat); // variantCat: menuUtama.variantCat,
// );
return CustomizeVariantNew(
orders: list[indexListOrderan],
variantCat: menuUtama.variantCat,
);
}, },
); );
} }
......
This diff is collapsed.
// ignore_for_file: sized_box_for_whitespace // 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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/address_user_bloc.dart';
import '../../helper/helper.dart'; import '../../helper/helper.dart';
import '../../helper/widget/style.dart'; import '../../helper/widget/style.dart';
...@@ -28,7 +32,12 @@ class CustomAppBar extends StatelessWidget { ...@@ -28,7 +32,12 @@ class CustomAppBar extends StatelessWidget {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const ViewBillNew(),
),
);
}, },
child: Container( child: Container(
width: 24, width: 24,
...@@ -55,12 +64,32 @@ class CustomAppBar extends StatelessWidget { ...@@ -55,12 +64,32 @@ class CustomAppBar extends StatelessWidget {
), ),
], ],
), ),
Container( GestureDetector(
width: 24, onTap: () {
height: 24, Navigator.pushReplacement(
decoration: BoxDecoration( context,
borderRadius: BorderRadius.circular(10), color: buttonColor), 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:flutter/material.dart';
// import 'package:webview_flutter/webview_flutter.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart'; import 'package:webviewx_plus/webviewx_plus.dart';
import 'package:fwfh_webview/fwfh_webview.dart';
import '../splash.dart'; import '../../helper/helper.dart';
import 'app_bar_webview.dart'; import '../../helper/widget/button_dialog.dart';
// import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
class WebViewHtml extends StatelessWidget { class WebViewMap extends StatefulWidget {
const WebViewHtml({ const WebViewMap({
super.key, super.key,
required this.titleAppBar, required this.titleAppBar,
required this.url, required this.url,
}); });
final String titleAppBar; final String titleAppBar;
final String url; final String url;
Future<bool> tapUrl(x, BuildContext context) async { @override
if (x.contains('jasaotp')) { State<WebViewMap> createState() => _WebViewMapState();
// Navigator.push( }
// context,
// MaterialPageRoute( class _WebViewMapState extends State<WebViewMap> {
// builder: (_) => Splash( late WebViewXController webviewController;
// pathSegmentString: [''], void onTapOkPop() {
// context: context, context.read<AddressUser>().getAddressUser();
// ), Navigator.pushReplacement(
// ), context,
// ); MaterialPageRoute(
} builder: (_) => const ViewBillNew(),
return true; ),
);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return WillPopScope(
children: [ onWillPop: () async {
CustomAppBar( final shouldPop = await buttonDialogGlobal(
titleAppBar: titleAppBar, context,
), 'Konfirmasi',
Expanded( 'Apakah anda sudah mengisi alamat dengan benar ?',
child: HtmlWidget( 'Ya',
'<iframe src="$url"></iframe>', 'Batal',
factoryBuilder: () => MyWidgetFactory(), onTapOkPop,
onTapImage: (x) { onTapOkPop,
print(x); okButtonColor: buttonColor,
}, cancelButtonColor: cancelColorButton,
onTapUrl: (x) { );
return tapUrl(x, context);
}, return shouldPop ?? false;
), },
), child: Column(
// WebView( children: [
// initialUrl: url, CustomAppBar(titleAppBar: widget.titleAppBar),
// onWebViewCreated: (WebViewController controller) { Expanded(
// _controller.complete(controller); 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: ...@@ -142,6 +142,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" 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: flutter_widget_from_html_core:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -218,7 +225,7 @@ packages: ...@@ -218,7 +225,7 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.13.4" version: "0.13.5"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
...@@ -331,6 +338,13 @@ packages: ...@@ -331,6 +338,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" 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: process:
dependency: transitive dependency: transitive
description: description:
...@@ -595,13 +609,6 @@ packages: ...@@ -595,13 +609,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.5" 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: webview_flutter_wkwebview:
dependency: transitive dependency: transitive
description: description:
...@@ -609,6 +616,13 @@ packages: ...@@ -609,6 +616,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.9.5" 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: win32:
dependency: transitive dependency: transitive
description: description:
...@@ -624,5 +638,5 @@ packages: ...@@ -624,5 +638,5 @@ packages:
source: hosted source: hosted
version: "0.2.0+1" version: "0.2.0+1"
sdks: sdks:
dart: ">=2.17.3 <3.0.0" dart: ">=2.18.0 <3.0.0"
flutter: ">=3.1.0-0" flutter: ">=3.1.0-0"
...@@ -33,6 +33,7 @@ dependencies: ...@@ -33,6 +33,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter_bloc: ^8.0.1 flutter_bloc: ^8.0.1
flutter_easyloading: ^3.0.3 flutter_easyloading: ^3.0.3
flutter_webview_plugin: ^0.4.0
flutter_widget_from_html_core: ^0.8.5+3 flutter_widget_from_html_core: ^0.8.5+3
fwfh_webview: ^0.6.2+3 fwfh_webview: ^0.6.2+3
geolocator: ^9.0.2 geolocator: ^9.0.2
...@@ -48,7 +49,7 @@ dependencies: ...@@ -48,7 +49,7 @@ dependencies:
url_strategy: ^0.2.0 url_strategy: ^0.2.0
uuid: ^3.0.6 uuid: ^3.0.6
web_browser_detect: ^2.0.3 web_browser_detect: ^2.0.3
webview_flutter_web: ^0.1.0+4 webviewx_plus: ^0.3.2
dev_dependencies: dev_dependencies:
flutter_lints: ^2.0.0 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