merge-update-with-lab-changes
haroon amjad 4 years ago
parent a9bd9f1fdf
commit a3fdb35c30

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

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

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

Loading…
Cancel
Save