merge-requests/508/head
haroon amjad 3 years ago
parent a9bd9f1fdf
commit a3fdb35c30

@ -200,7 +200,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotal).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,

@ -40,7 +40,7 @@ class PaymentBottomWidget extends StatelessWidget {
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),

@ -22,17 +22,14 @@ class PharmacyAddressesPage extends StatefulWidget {
final bool isUpdate;
const PharmacyAddressesPage(
{Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState})
: super(key: key);
const PharmacyAddressesPage({Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState}) : super(key: key);
@override
_PharmacyAddressesState createState() => _PharmacyAddressesState();
}
class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
void navigateToAddressPage(
BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) {
void navigateToAddressPage(BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) {
Navigator.push(
ctx,
FadePage(
@ -48,7 +45,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
return BaseView<PharmacyAddressesViewModel>(
onModelReady: (model) => model.getAddressesList(),
builder: (_, model, wi) => AppScaffold(
appBarTitle: widget.isUpdate?TranslationBase.of(context).changeAddress:"Add Address",
appBarTitle: widget.isUpdate ? TranslationBase.of(context).changeAddress : "Add Address",
isShowAppBar: true,
isPharmacy: true,
baseViewModel: model,
@ -123,12 +120,8 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
vPadding: 8,
handler: () {
//TODO Elham*
widget.orderPreviewViewModel.paymentCheckoutData
.address =
Addresses.fromJson(
model.addresses[model.selectedAddressIndex].toJson());
model.saveSelectedAddressLocally(
model.addresses[model.selectedAddressIndex]);
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
_navigateToPaymentOption(model);
},
),
@ -141,15 +134,13 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
}
_navigateToPaymentOption(model) {
if(widget.isUpdate) {
print("sfsf");
if (widget.isUpdate) {
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
widget.changeMainState();
Navigator.pop(context);
return;
}
Navigator.push(
context,
FadePage(
@ -159,8 +150,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
setState(() {
if (result != null) {
var paymentOption = result;
widget.orderPreviewViewModel.paymentCheckoutData.paymentOption =
paymentOption;
widget.orderPreviewViewModel.paymentCheckoutData.paymentOption = paymentOption;
}
// widget.changeMainState();
})
@ -175,8 +165,7 @@ class AddressItemWidget extends StatelessWidget {
final bool isSelected;
final Function(AddressInfo) onTabEditAddress;
AddressItemWidget(this.model, this.address, this.selectAddress,
this.isSelected, this.onTabEditAddress);
AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress);
@override
Widget build(BuildContext context) {
@ -202,18 +191,13 @@ class AddressItemWidget extends StatelessWidget {
decoration: new BoxDecoration(
color: !isSelected ? Colors.white : Colors.green,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0),
border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0),
),
child: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: isSelected
? Colors.white
: Colors.transparent,
color: isSelected ? Colors.white : Colors.transparent,
size: 25,
),
),
@ -226,8 +210,7 @@ class AddressItemWidget extends StatelessWidget {
Expanded(
child: Container(
child: Container(
margin:
EdgeInsets.symmetric(vertical: 12, horizontal: 12),
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -290,8 +273,7 @@ class AddressItemWidget extends StatelessWidget {
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: SizedBox(
child: Container(
width: 1,
@ -309,21 +291,13 @@ class AddressItemWidget extends StatelessWidget {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
title: "Are you sure want to delete",
confirmMessage:
"${address.address1} ${address.address2}",
okText:
TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context)
.cancel_nocaps,
confirmMessage: "${address.address1} ${address.address2}",
okText: TranslationBase.of(context).delete,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
model
.deleteAddresses(address)
.then((_) {
ConfirmDialog.closeAlertDialog(
context);
AppToast.showErrorToast(
message:
"Address has been deleted");
model.deleteAddresses(address).then((_) {
ConfirmDialog.closeAlertDialog(context);
AppToast.showErrorToast(message: "Address has been deleted");
})
},
cancelFunction: () => {});

Loading…
Cancel
Save