Merge branch 'cart' into 'development'

Cart

See merge request Cloud_Solution/diplomatic-quarter!434
merge-update-with-lab-changes
Mohammad Aljammal 4 years ago
commit 0590642854

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'ShippingOption.dart';
class PaymentCheckoutData with ChangeNotifier{
class PaymentCheckoutData {
Addresses address;
PaymentOption paymentOption;
LacumAccountInformation lacumInformation;
@ -15,7 +15,5 @@ class PaymentCheckoutData with ChangeNotifier{
PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0});
void updateData() {
notifyListeners();
}
}

@ -192,7 +192,7 @@ class OrderPreviewViewModel extends BaseViewModel {
.getShippingOption(paymentCheckoutData.address)
.then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
paymentCheckoutData.updateData();
setState(ViewState.Idle);
});
if (_orderService.hasError) {
error = _orderService.error;

@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';

@ -1,903 +0,0 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class OrderPreviewPage extends StatefulWidget {
final List<Addresses> addresses;
OrderPreviewPage(this.addresses);
@override
_OrderPreviewPageState createState() => _OrderPreviewPageState();
}
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser;
bool isLoading = true;
@override
void initState() {
super.initState();
getData();
}
void getData() async {
if (isLoading)
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
OrderPreviewViewModel model = Provider.of(context);
return AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
isLoading: isLoading,
isLocalLoader: true,
backgroundColor: Colors.white,
// baseViewModel: model,
body: Container(
color: Color(0xFFF1F1F1),
height: height * 0.90,
child: SingleChildScrollView(
child: Container(
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model, widget.addresses),
SizedBox(
height: 10,
),
SelectPaymentOptionWidget(model),
SizedBox(
height: 10,
),
Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
paymentData.lacumInformation != null
? Container(
child: Column(
children: [
LakumWidget(model),
SizedBox(
height: 10,
),
],
),
)
: Container()),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) => ProductOrderPreviewItem(
model.cartResponse.shoppingCarts[index]),
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
child: model.cartResponse.subtotal != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
)
],
),
),
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
color: Colors.white,
child: PaymentBottomWidget(model),
),
);
}
}
class SelectAddressWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final List<Addresses> addresses;
SelectAddressWidget(this.model, this.addresses);
@override
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Addresses address;
_navigateToAddressPage() {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
/* setState(() {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
})*/
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.address != null) {
address = widget.model.paymentCheckoutData.address;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) => Container(
color: Colors.white,
child: address == null
? InkWell(
onTap: () => {_navigateToAddressPage()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_address.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_mark.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).shippingAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToAddressPage()},
child: Texts(
TranslationBase.of(context).changeAddress,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.firstName} ${address.lastName}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
),
),
Row(
children: [
Container(
margin: const EdgeInsets.only(right: 8),
child: Icon(
Icons.phone,
size: 20,
color: Colors.black,
),
),
Texts(
"${address.phoneNumber}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
],
),
Container(
margin: EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
height: 2,
width: double.infinity,
child: Container(
color: Color(0xffefefef),
),
),
),
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_truck.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
"${TranslationBase.of(context).shipBy}",
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Container(
child: Image.asset(
paymentData.shippingOption
.shippingRateComputationMethodSystemName ==
"Shipping.FixedOrByWeight"
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,
),
margin: EdgeInsets.symmetric(horizontal: 8),
),
],
),
],
),
),
), // ic_shipping_mark.png
),
);
}
}
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
SelectPaymentOptionWidget(this.model);
@override
_SelectPaymentOptionWidgetState createState() =>
_SelectPaymentOptionWidgetState();
}
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
widget.model.paymentCheckoutData.updateData();
}
})
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.paymentOption != null) {
paymentOption = widget.model.paymentCheckoutData.paymentOption;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: paymentOption == null
? InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectPaymentOption,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
decoration: new BoxDecoration(
color: Colors.grey.shade100,
shape: BoxShape.rectangle,
),
child: Image.asset(
widget.model.getPaymentOptionImage(paymentOption),
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
widget.model.getPaymentOptionName(paymentOption),
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Texts(
TranslationBase.of(context).changeMethod,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
),
);
}
}
class LakumWidget extends StatefulWidget {
final OrderPreviewViewModel model;
LakumWidget(this.model);
@override
_LakumWidgetState createState() => _LakumWidgetState();
}
class _LakumWidgetState extends State<LakumWidget> {
TextEditingController _pointsController = new TextEditingController();
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
width: 30.0,
fit: BoxFit.scaleDown,
),
Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"${TranslationBase.of(context).lakumPoints}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Texts(
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
fontSize: 12,
fontWeight: FontWeight.normal,
),
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
"${TranslationBase.of(context).riyal}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Container(
margin: projectProvider.isArabic
? EdgeInsets.only(right: 4)
: EdgeInsets.only(left: 4),
width: 60,
height: 50,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.2),
gapPadding: 0,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8))
: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.4),
gapPadding: 0,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
),
controller: _pointsController,
keyboardType: TextInputType.number,
style: TextStyle(
fontSize: 14,
color: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount >
0
? Colors.black
: Colors.grey,
),
enabled: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount ==
0
? false
: true,
onChanged: (val) {
var value = int.tryParse(val);
if (value != null &&
value <=
widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount) {
widget.model.paymentCheckoutData.usedLakumPoints =
value;
} else {
widget.model.paymentCheckoutData.usedLakumPoints = 0;
}
_pointsController.text =
"${widget.model.paymentCheckoutData.usedLakumPoints}";
},
),
),
Container(
height: 50,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: new BoxDecoration(
color: Color(0xff3666E0),
shape: BoxShape.rectangle,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topLeft: Radius.circular(6),
bottomLeft: Radius.circular(6))
: BorderRadius.only(
topRight: Radius.circular(6),
bottomRight: Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: Color(0xff3666E0),
width: 0.8,
)),
),
child: Texts(
"${TranslationBase.of(context).use}",
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
);
}
}
class PaymentBottomWidget extends StatelessWidget {
final OrderPreviewViewModel model;
BuildContext context;
MyInAppBrowser browser;
PaymentBottomWidget(this.model);
@override
Widget build(BuildContext context) {
final scaffold = Scaffold.of(context);
this.context = context;
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) => paymentData.cartDataVisible
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Color(0xff929295),
fontWeight: FontWeight.w600,
),
),
],
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
Container(
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Color(0xff929295),
width: 1,
),
),
onPressed: (paymentData.address != null &&
paymentData.paymentOption != null)
? () async {
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message:
"Order has been placed successfully!!");
openPayment(
model.orderListModel[0], model.user);
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: new Text(
"${TranslationBase.of(context).proceedPay}",
style: new TextStyle(
color: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.white
: Colors.grey.shade400,
fontWeight: FontWeight.bold,
fontSize: 12),
),
),
color: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.green
: Color(0xff929295),
disabledColor: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.green
: Color(0xff929295),
),
),
],
),
)
: Container(),
),
);
}
openPayment(
OrderDetailModel order,
AuthenticatedUser authenticatedUser,
) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(
order,
order.orderTotal,
'ePharmacy Order',
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);
}
onBrowserLoadStart(String url) {
print("onBrowserLoadStart");
print(url);
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
});
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = false;
return;
}
});
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
} else {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
}
}
}

@ -1,13 +1,10 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
@ -16,7 +13,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';
class CartOrderPage extends StatefulWidget {
@ -55,7 +51,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
showHomeAppBarIcon: false,
isShowDecPage: true,
baseViewModel: model,
backButtonTab: widget.changeTab != null ? () => widget.changeTab(0) : null,
backButtonTab:
widget.changeTab != null ? () => widget.changeTab(0) : null,
backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)

@ -0,0 +1,238 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'lakum_widget.dart';
class OrderPreviewPage extends StatefulWidget {
final List<Addresses> addresses;
OrderPreviewPage(this.addresses);
@override
_OrderPreviewPageState createState() => _OrderPreviewPageState();
}
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser;
bool isLoading = true;
@override
void initState() {
super.initState();
getData();
}
void getData() async {
if (isLoading)
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
OrderPreviewViewModel model = Provider.of(context);
return AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
isLoading: isLoading,
isLocalLoader: true,
backgroundColor: Colors.white,
// baseViewModel: model,
body: Container(
color: Color(0xFFF1F1F1),
height: height * 0.90,
child: SingleChildScrollView(
child: Container(
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model, widget.addresses),
SizedBox(
height: 10,
),
SelectPaymentOptionWidget(model),
SizedBox(
height: 10,
),
model.paymentCheckoutData.lacumInformation != null
? Container(
child: Column(
children: [
LakumWidget(model),
SizedBox(
height: 10,
),
],
),
)
: Container(),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) => ProductOrderPreviewItem(
model.cartResponse.shoppingCarts[index]),
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
child: model.cartResponse.subtotal != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
),
SizedBox(
height: model.cartResponse.shoppingCarts != null
? height * 0.10
: 0,
)
],
),
),
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
color: Colors.white,
child: PaymentBottomWidget(model),
),
);
}
}

@ -0,0 +1,187 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class LakumWidget extends StatefulWidget {
final OrderPreviewViewModel model;
LakumWidget(this.model);
@override
_LakumWidgetState createState() => _LakumWidgetState();
}
class _LakumWidgetState extends State<LakumWidget> {
TextEditingController _pointsController = new TextEditingController();
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
width: 30.0,
fit: BoxFit.scaleDown,
),
Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"${TranslationBase.of(context).lakumPoints}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Texts(
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
fontSize: 12,
fontWeight: FontWeight.normal,
),
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
"${TranslationBase.of(context).riyal}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Container(
margin: projectProvider.isArabic
? EdgeInsets.only(right: 4)
: EdgeInsets.only(left: 4),
width: 60,
height: 50,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.2),
gapPadding: 0,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8))
: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.4),
gapPadding: 0,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
),
controller: _pointsController,
keyboardType: TextInputType.number,
style: TextStyle(
fontSize: 14,
color: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount >
0
? Colors.black
: Colors.grey,
),
enabled: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount ==
0
? false
: true,
onChanged: (val) {
var value = int.tryParse(val);
if (value != null &&
value <=
widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount) {
widget.model.paymentCheckoutData.usedLakumPoints =
value;
} else {
widget.model.paymentCheckoutData.usedLakumPoints = 0;
}
_pointsController.text =
"${widget.model.paymentCheckoutData.usedLakumPoints}";
},
),
),
Container(
height: 50,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: new BoxDecoration(
color: Color(0xff3666E0),
shape: BoxShape.rectangle,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topLeft: Radius.circular(6),
bottomLeft: Radius.circular(6))
: BorderRadius.only(
topRight: Radius.circular(6),
bottomRight: Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: Color(0xff3666E0),
width: 0.8,
)),
),
child: Texts(
"${TranslationBase.of(context).use}",
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
);
}
}

@ -0,0 +1,195 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PaymentBottomWidget extends StatelessWidget {
final OrderPreviewViewModel model;
BuildContext context;
MyInAppBrowser browser;
PaymentBottomWidget(this.model);
@override
Widget build(BuildContext context) {
final scaffold = Scaffold.of(context);
this.context = context;
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: orderPreviewViewModel.paymentCheckoutData.cartDataVisible
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Color(0xff929295),
fontWeight: FontWeight.w600,
),
),
],
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
Container(
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Color(0xff929295),
width: 1,
),
),
onPressed: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? () async {
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message:
"Order has been placed successfully!!");
openPayment(
model.orderListModel[0], model.user);
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: new Text(
"${TranslationBase.of(context).proceedPay}",
style: new TextStyle(
color: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel.paymentCheckoutData
.paymentOption !=
null)
? Colors.white
: Colors.grey.shade400,
fontWeight: FontWeight.bold,
fontSize: 12),
),
),
color:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
disabledColor:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
),
),
],
),
)
: Container(),
);
}
openPayment(
OrderDetailModel order,
AuthenticatedUser authenticatedUser,
) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(
order,
order.orderTotal,
'ePharmacy Order',
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);
}
onBrowserLoadStart(String url) {
print("onBrowserLoadStart");
print(url);
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
});
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = false;
return;
}
});
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
} else {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
}
}
}

@ -0,0 +1,226 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SelectAddressWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final List<Addresses> addresses;
SelectAddressWidget(this.model, this.addresses);
@override
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Addresses address;
_navigateToAddressPage() {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
/* setState(() {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
})*/
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.address != null) {
address = widget.model.paymentCheckoutData.address;
}
super.initState();
}
@override
Widget build(BuildContext context) {
OrderPreviewViewModel model = Provider.of(context);
return Container(
color: Colors.white,
child: address == null
? InkWell(
onTap: () => {_navigateToAddressPage()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_address.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_mark.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).shippingAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToAddressPage()},
child: Texts(
TranslationBase.of(context).changeAddress,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.firstName} ${address.lastName}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
),
),
Row(
children: [
Container(
margin: const EdgeInsets.only(right: 8),
child: Icon(
Icons.phone,
size: 20,
color: Colors.black,
),
),
Texts(
"${address.phoneNumber}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
],
),
Container(
margin: EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
height: 2,
width: double.infinity,
child: Container(
color: Color(0xffefefef),
),
),
),
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_truck.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
"${TranslationBase.of(context).shipBy}",
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Container(
child: Image.asset(
model.paymentCheckoutData.shippingOption == null
? ""
: model.paymentCheckoutData.shippingOption
.shippingRateComputationMethodSystemName ==
"Shipping.FixedOrByWeight"
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,
),
margin: EdgeInsets.symmetric(horizontal: 8),
),
],
),
],
),
),
), // ic_shipping_mark.png
);
}
}

@ -0,0 +1,146 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
SelectPaymentOptionWidget(this.model);
@override
_SelectPaymentOptionWidgetState createState() =>
_SelectPaymentOptionWidgetState();
}
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
}
})
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.paymentOption != null) {
paymentOption = widget.model.paymentCheckoutData.paymentOption;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: paymentOption == null
? InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectPaymentOption,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
decoration: new BoxDecoration(
color: Colors.grey.shade100,
shape: BoxShape.rectangle,
),
child: Image.asset(
widget.model.getPaymentOptionImage(paymentOption),
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
widget.model.getPaymentOptionName(paymentOption),
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Texts(
TranslationBase.of(context).changeMethod,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
),
);
}
}

@ -10,7 +10,7 @@ import 'package:hexcolor/hexcolor.dart';
import '../../../../../locator.dart';
import '../../../../../routes.dart';
import '../../cart-order-page.dart';
import '../../cart-page/cart-order-page.dart';
import '../product-detail.dart';
class FooterWidget extends StatefulWidget {

@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
import '../../../../../locator.dart';
import '../../../compare-list.dart';
import '../../cart-order-page.dart';
import '../../cart-page/cart-order-page.dart';
import 'icon_with_bg.dart';
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {

@ -78,6 +78,8 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
},
),
),
SizedBox(height: height * 0.10,)
],
),
),

@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreview
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';

@ -1,6 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';

Loading…
Cancel
Save