Merge branch 'nov_fixes' into 'development_new_design_2.0'

fix as first step

See merge request Cloud_Solution/diplomatic-quarter!542
merge-requests/542/merge
Elham Ali 4 years ago
commit a8f41dfd9f

@ -546,8 +546,8 @@ const SUBSCRIBE_PRODUCT = "subscribe?";
const GET_ORDER = "orders?";
const GET_ORDER_DETAILS = "orders/";
const ADD_CUSTOMER_ADDRESS = "addcustomeraddress";
const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress";
const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress";
const EDIT_CUSTOMER_ADDRESS = "editcustomeraddress";
const DELETE_CUSTOMER_ADDRESS = "deletecustomeraddress";
const GET_ADDRESS = "Customers/";
const GET_Cancel_ORDER = "cancelorder/";
const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8";

@ -1734,4 +1734,7 @@ const Map localizedValues = {
"points": {"en": "Points", "ar": "نقاط"},
"availableBalance": {"en": "Available Balance", "ar": "الرصيد المتوفر"},
"ordersDashboard": {"en": "My Orders", "ar": "طلباتي"},
"productOutOfStock": {"en": "Out Of Stock", "ar": "إنتهى من المخزن"},
"productQuantity": {"en": "Quantity", "ar": "كمية"},
};

@ -66,12 +66,12 @@ class CustomerAddressesService extends BaseService {
class CustomerInfo {
bool isRegistered;
String userName;
dynamic userName;
dynamic password;
String email;
dynamic email;
dynamic errorMessage;
String mobileNumber;
int customerId;
dynamic mobileNumber;
dynamic customerId;
CustomerInfo({this.isRegistered, this.userName, this.password, this.email, this.errorMessage, this.mobileNumber, this.customerId});
@ -104,7 +104,7 @@ class AddressInfo {
String lastName;
String email;
dynamic company;
int countryId;
dynamic countryId;
String country;
dynamic stateProvinceId;
String city;

@ -75,7 +75,6 @@ class PharmacyAddressesViewModel extends BaseViewModel {
sendingAddress.faxNumber = user.faxNumber;
sendingAddress.customerAttributes = "";
sendingAddress.createdOnUtc = DateTime.now().toString();
if (editedAddress == null) {
///TODO Fatima*
@ -83,15 +82,21 @@ class PharmacyAddressesViewModel extends BaseViewModel {
} else {
await _pharmacyAddressService.editCustomerAddress(sendingAddress);
}
if (_pharmacyAddressService.hasError) {
error = _pharmacyAddressService.error;
Utils.showErrorToast(error);
setState(ViewState.Error);
await _pharmacyAddressService.getAddresses();
setState(ViewState.Idle);
// setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future deleteAddresses(AddressInfo sendingAddress) async {

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart';
import '../../../../../locator.dart';
@ -28,8 +29,13 @@ class FooterWidget extends StatefulWidget {
int quantity;
bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item,
{this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model});
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
{this.quantity,
this.isOverQuantity = false,
this.addToCartFunction,
this.addToShoppingCartFunction,
this.model});
@override
_FooterWidgetState createState() => _FooterWidgetState();
@ -38,7 +44,8 @@ class FooterWidget extends StatefulWidget {
class _FooterWidgetState extends State<FooterWidget> {
double quantityUI = 80;
bool showUI = false;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppSharedPreferences sharedPref = new AppSharedPreferences();
@override
@ -74,7 +81,8 @@ class _FooterWidgetState extends State<FooterWidget> {
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).quantity,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
),
),
InkWell(
@ -97,7 +105,11 @@ class _FooterWidgetState extends State<FooterWidget> {
SizedBox(
width: 5,
),
for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i),
for (int i = 1; i <= 10; i++)
QuantityBox(
label: i,
onTapFunc: onChangeValue,
isSelected: widget.quantity == i),
Container(
width: 100,
decoration: BoxDecoration(
@ -105,14 +117,16 @@ class _FooterWidgetState extends State<FooterWidget> {
color: Colors.white,
),
child: TextField(
decoration: InputDecoration(labelText: ' Quantity # '),
decoration: InputDecoration(
labelText: ' Quantity # '),
onChanged: (text) {
if (int.tryParse(text) == null) {
text = '';
} else {
setState(() {
widget.quantity = int.parse(text);
if (widget.quantity >= widget.quantityLimit) {
if (widget.quantity >=
widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
@ -133,31 +147,50 @@ class _FooterWidgetState extends State<FooterWidget> {
height: 20,
),
Container(
height: 55,
height: 58,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 90,
height: 60,
child: FlatButton(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
child: Row(
children: [
Expanded(
flex: 4,
child: Text(
widget.quantity.toString(),
style: TextStyle(fontSize: 20),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).productQuantity,
fontSize: 10,
),
Row(
children: [
AppText(
widget.quantity.toString(),
fontSize: 16,
fontWeight: FontWeight.bold,
),
SizedBox(
width: 20,
),
Icon(Icons.keyboard_arrow_down,color: Color(0xFF2E303A),size: 25,)
],
),
],
),
Expanded(
flex: 5,
child: Text(
TranslationBase.of(context).quantityShortcut,
style: TextStyle(fontSize: 16),
SizedBox(
width: 10,
),
SizedBox(
height: 40,
width: 1,
child: Container(
color: Color(0xFFEFEFEF),
),
),
],
@ -184,17 +217,22 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton(
label: TranslationBase.of(context).addToCart.toUpperCase(),
disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx,
disabled: (!widget.isAvailable && widget.quantity > 0) ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx,
onTap: () async {
if (!authenticatedUserObject.isLogin) {
login();
} else
await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
await widget.addToCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
},
fontWeight: FontWeight.w600,
borderColor: Color(0xFF4CAF50),
borderRadius: 3,
color: Color(0xFF4CAF50),
borderColor: Color(0xFF4CAF50).withOpacity(0.7),
borderRadius: 6,
color: Color(0xFF5AB145).withOpacity(0.7),
),
),
SizedBox(
@ -204,19 +242,28 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton(
label: TranslationBase.of(context).buyNow.toUpperCase(),
disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx,
disabled: (!widget.isAvailable && widget.quantity > 0) ||
(widget.quantity > widget.quantityLimit) ||
widget.item.isRx,
onTap: () async {
if (!authenticatedUserObject.isLogin) {
login();
} else {
await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
await widget.addToShoppingCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
}
},
fontWeight: FontWeight.w600,
borderColor: Colors.grey[800],
borderRadius: 3,
borderColor: Colors.grey[800].withOpacity(0.7),
borderRadius: 6,
disableColor: Colors.grey[700],
color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.isRx ? Colors.grey : Colors.grey[800],
color: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx
? Color(0xFF535353).withOpacity(0.7)
: Colors.grey[800],
),
),
],
@ -239,7 +286,9 @@ class _FooterWidgetState extends State<FooterWidget> {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
GifLoaderDialogUtils.showMyDialog(context);
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) {
authService
.selectDeviceImei(DEVICE_TOKEN)
.then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context);
if (value != null) {
setUserValues(value);

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -121,12 +122,39 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
child: Column(
children: [
if (widget.product.images.isNotEmpty)
Container(
height: MediaQuery.of(context).size.height * .40,
child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
Stack(
children: [
Container(
height: MediaQuery.of(context).size.height * .40,
child: Center(
child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
),
),
if(model.isStockAvailable!= null && !model.isStockAvailable)
Container(
height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.75),
// child: AppText("Out of Stock"),
),
if(model.isStockAvailable!= null && !model.isStockAvailable)
Positioned(
// bottom: 10,
top: MediaQuery.of(context).size.height *.088,
left: MediaQuery.of(context).size.width *.32,
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * .40,
// color: Colors.white.withOpacity(0.75),
child: RotationTransition(
turns: new AlwaysStoppedAnimation(310 / 360),
child: AppText(TranslationBase.of(context).productOutOfStock ,color:Color(0xFF000000).withOpacity(0.1),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)),
),
),
),
],
),
if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
],
@ -251,7 +279,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Column(
children: [
FlatButton(
onPressed: model.isStockAvailable
onPressed: model.isStockAvailable !=null && model.isStockAvailable
? () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getProductLocationData(widget.product.sku);

@ -49,6 +49,7 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20),
if(widget.isStockAvailable != null)
Texts(
widget.stockAvailability,
fontWeight: FontWeight.bold,

@ -57,10 +57,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
IconWithBg(
icon: Icons.arrow_back,
color: Colors.grey,
icon: Icons.arrow_back_ios,
color: Color(0xFF2B353E),
onPress: () {
Navigator.pop(context);
},
@ -74,7 +75,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
children: [
IconWithBg(
icon: Icons.shopping_cart,
color: Colors.grey[800],
color: Color(0xFF2B353E),
onPress: () {
Navigator.pushAndRemoveUntil(
locator<NavigationService>()
@ -112,7 +113,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
.quantityCount
.toString(),
style: "caption",
medium: true,
// medium: true,
color: Colors.white,
)),
),
@ -124,7 +125,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
),
IconWithBg(
icon: FontAwesomeIcons.ellipsisV,
color: Colors.grey,
color: Color(0xFF2B353E),
onPress: () {
settingModalBottomSheet(context);
},

@ -34,9 +34,11 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
Navigator.push(
ctx,
FadePage(
page: AddAddressPage(address, (pickResult) {
page: AddAddressPage(address, (pickResult) async {
model.addEditAddress(pickResult, address);
})));
await model.getAddressesList();
})));
}
Widget build(BuildContext context) {

@ -72,7 +72,10 @@ class PharmacyAddressService extends BaseService {
}
Future addCustomerAddress(AddressInfo address) async {
makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS);
await makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS);
// if(!hasError) {
selectedAddressIndex = addresses.length +1;
// }
}
Future editCustomerAddress(AddressInfo address) async {

@ -1117,6 +1117,7 @@ class TranslationBase {
String get myPrescription => localizedValues['myPrescription'][locale.languageCode];
String get quantity => localizedValues['quantity'][locale.languageCode];
String get productQuantity => localizedValues['productQuantity'][locale.languageCode];
String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode];
@ -1827,6 +1828,7 @@ class TranslationBase {
String get needPrescription => localizedValues['needPrescription'][locale.languageCode];
String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode];
String get productOutOfStock => localizedValues['productOutOfStock'][locale.languageCode];
String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode];

@ -248,10 +248,10 @@ class _SecondaryButtonState extends State<SecondaryButton>
style: TextStyle(
color: widget.textColor,
fontSize: widget.small ? 12.0 : 14.0,
fontWeight: FontWeight.w600,
fontWeight: FontWeight.w700,
fontFamily: projectViewModel.isArabic
? 'Cairo'
: 'WorkSans'
: 'Poppins'
),
),
)

@ -272,7 +272,7 @@ class _TextsState extends State<Texts> {
style: _getFontStyle().copyWith(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.w800,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans',
fontFamily: projectViewModel.isArabic ? 'Poppins' : 'Poppins',
),
),
),

@ -60,11 +60,13 @@ class _AppTextState extends State<AppText> {
widget.data,
textAlign: widget.textAlign,
overflow: TextOverflow.clip,
style: TextStyle(
color: widget.color == null ? Theme.of(context).textTheme.bodyText1.color : widget.color,
fontWeight: widget.fontWeight,
fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2),
height: widget.height,
fontFamily: "Poppins",
letterSpacing: widget.letterSpacing,
// fontFamily: widget.fontFamily == null
// ? projectViewModel.isArabic

Loading…
Cancel
Save