Merge branch 'development_new_design_2.0' into Fatima-New-Design

merge-requests/533/head
Fatimah Alshammari 4 years ago
commit a2a6da1527

@ -1,128 +1,128 @@
{
"images":[
{
"idiom":"iphone",
"size":"20x20",
"scale":"2x",
"filename":"Icon-App-20x20@2x.png"
},
{
"idiom":"iphone",
"size":"20x20",
"scale":"3x",
"filename":"Icon-App-20x20@3x.png"
},
{
"idiom":"iphone",
"size":"29x29",
"scale":"1x",
"filename":"Icon-App-29x29@1x.png"
},
{
"idiom":"iphone",
"size":"29x29",
"scale":"2x",
"filename":"Icon-App-29x29@2x.png"
},
{
"idiom":"iphone",
"size":"29x29",
"scale":"3x",
"filename":"Icon-App-29x29@3x.png"
},
{
"idiom":"iphone",
"size":"40x40",
"scale":"2x",
"filename":"Icon-App-40x40@2x.png"
},
{
"idiom":"iphone",
"size":"40x40",
"scale":"3x",
"filename":"Icon-App-40x40@3x.png"
},
{
"idiom":"iphone",
"size":"60x60",
"scale":"2x",
"filename":"Icon-App-60x60@2x.png"
},
{
"idiom":"iphone",
"size":"60x60",
"scale":"3x",
"filename":"Icon-App-60x60@3x.png"
},
{
"idiom":"iphone",
"size":"76x76",
"scale":"2x",
"filename":"Icon-App-76x76@2x.png"
},
{
"idiom":"ipad",
"size":"20x20",
"scale":"1x",
"filename":"Icon-App-20x20@1x.png"
},
{
"idiom":"ipad",
"size":"20x20",
"scale":"2x",
"filename":"Icon-App-20x20@2x.png"
},
{
"idiom":"ipad",
"size":"29x29",
"scale":"1x",
"filename":"Icon-App-29x29@1x.png"
},
{
"idiom":"ipad",
"size":"29x29",
"scale":"2x",
"filename":"Icon-App-29x29@2x.png"
},
{
"idiom":"ipad",
"size":"40x40",
"scale":"1x",
"filename":"Icon-App-40x40@1x.png"
},
{
"idiom":"ipad",
"size":"40x40",
"scale":"2x",
"filename":"Icon-App-40x40@2x.png"
},
{
"idiom":"ipad",
"size":"76x76",
"scale":"1x",
"filename":"Icon-App-76x76@1x.png"
},
{
"idiom":"ipad",
"size":"76x76",
"scale":"2x",
"filename":"Icon-App-76x76@2x.png"
},
{
"idiom":"ipad",
"size":"83.5x83.5",
"scale":"2x",
"filename":"Icon-App-83.5x83.5@2x.png"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"scale" : "1x",
"filename" : "ItunesArtwork@2x.png"
}
],
"info":{
"version":1,
"author":"easyappicon"
"images" : [
{
"filename" : "Icon-App-20x20@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-App-20x20@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "Icon-App-29x29@1x.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "Icon-App-40x40@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-App-40x40@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "Icon-App-60x60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "Icon-App-60x60@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "Icon-App-20x20@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "Icon-App-20x20@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-App-29x29@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-App-29x29@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-App-40x40@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "Icon-App-40x40@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-App-76x76@1x.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "Icon-App-76x76@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "Icon-App-83.5x83.5@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "icon.jpg",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"filename" : "Icon-App-76x76@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "76x76"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

@ -1729,4 +1729,5 @@ const Map localizedValues = {
"gramsPerDay": {"en": "Grams Per Day", "ar": "غرام في اليوم"},
"gr": {"en": "gr", "ar": "غرام"},
"gramsPerMeal": {"en": "Grams Per Meal", "ar": "عدد الجرامات لكل وجبة"},
"syncSuccess": {"en": "Data Synced Successfully", "ar": "تمت مزامنة البيانات بنجاح"},
};

@ -2,35 +2,35 @@ import 'PointsAmountPerYear.dart';
import 'PointsDetails.dart';
class LakumInquiryInformationObjVersion {
int accountNumber;
num accountNumber;
String accountStatus;
String barCode;
int consumedPoints;
num consumedPoints;
String consumedPointsAmount;
List<PointsAmountPerYear> consumedPointsAmountPerYear;
List<PointsDetails> consumedPointsDetails;
String createdDate;
int expiredPoints;
num expiredPoints;
String expiryDate;
int gainedPoints;
num gainedPoints;
List<PointsAmountPerYear> gainedPointsAmountPerYear;
List<PointsDetails> gainedPointsDetails;
String lakumMessageStatus;
String memberName;
String memberUniversalId;
String mobileNumber;
int pointsBalance;
int pointsBalanceAmount;
int pointsWillBeExpired;
num pointsBalance;
num pointsBalanceAmount;
num pointsWillBeExpired;
String prefLang;
int statusCode;
int transferPoints;
num statusCode;
num transferPoints;
List<PointsAmountPerYear> transferPointsAmountPerYear;
List<PointsDetails> transferPointsDetails;
dynamic waitingPoints;
dynamic loyalityAmount;
dynamic loyalityPoints;
int purchaseRate;
num purchaseRate;
LakumInquiryInformationObjVersion(
{this.accountNumber,

@ -1,10 +1,10 @@
import 'PointsAmountPerMonth.dart';
class PointsAmountPerYear {
int amountPerYear;
num amountPerYear;
List<PointsAmountPerMonth> pointsAmountPerMonth;
int pointsPerYear;
int year;
num pointsPerYear;
num year;
PointsAmountPerYear(
{this.amountPerYear,

@ -11,7 +11,7 @@ class PaymentCheckoutData {
LacumAccountInformation lacumInformation;
bool cartDataVisible;
ShippingOption shippingOption;
int usedLakumPoints;
num usedLakumPoints;
PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0});

@ -467,7 +467,9 @@ class BaseAppClient {
onFailure(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode);
Navigator.of(AppGlobal.context).pushNamed(HOME);
} else {
onFailure('Error While Fetching data', statusCode);
var bodyUtf = json.decode(utf8.decode(response.bodyBytes));
print(bodyUtf);
onFailure(bodyUtf['error']['ErrorEndUserMsg'], statusCode);
}
} else {
// var parsed = json.decode(response.body.toString());

@ -166,8 +166,7 @@ class OrderPreviewViewModel extends BaseViewModel {
}
getInformationsByAddress(String identificationNo) async {
await getShippingOption();
await getLacumAccountInformation(identificationNo);
await getShippingOption(identificationNo);
}
getLacumAccountInformation(String identificationNo) async {
@ -194,18 +193,18 @@ class OrderPreviewViewModel extends BaseViewModel {
}
}
getShippingOption() async {
Future getShippingOption(String identificationNo) async {
setState(ViewState.Busy);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
setState(ViewState.Idle);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) async {
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
setState(ViewState.Idle);
await getLacumAccountInformation(identificationNo);
}
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future makeOrder() async {

@ -4,15 +4,13 @@ class healthData {
String MachineDate;
double Value;
int TransactionsListID;
String Notes;
healthData({
this.MedCategoryID,
this.MedSubCategoryID,
this.MachineDate,
this.Value,
this.TransactionsListID,
this.Notes,
this.TransactionsListID
});
healthData.fromJson(Map<String, dynamic> json) {
@ -21,7 +19,6 @@ class healthData {
MachineDate = json['MachineDate'];
Value = json['Value'];
TransactionsListID = json['TransactionsListID'];
Notes = json['Notes'];
}
Map<String, dynamic> toJson() {
@ -31,7 +28,6 @@ class healthData {
data['MachineDate'] = this.MachineDate;
data['Value'] = this.Value;
data['TransactionsListID'] = this.TransactionsListID;
data['Notes'] = this.Notes;
return data;
}
}

@ -271,7 +271,6 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
});
});
});
print("Has Reminder: " + hasReminder.toString());
}
cancelReminders() async {

@ -1,6 +1,7 @@
import 'package:collection/collection.dart';
import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart';
import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -149,8 +150,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
}
}
date = DateUtil.convertDateToString(date);
Med_InsertTransactionsInputsList.add(
healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++, Notes: ""));
Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++));
});
}
}
@ -197,27 +197,17 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
// to convert from meter to km
totalDistance += (element['Value'] * 0.001);
} else if (element['MedCategoryID'] == 3) {
print("HeartRate");
// print("HeartRate");
MedCategoryID = 3;
counter++;
totalHeartRate += element['Value'];
} else if (element['MedCategoryID'] == 4) {
print("sleeeeep");
sleepDataList.add(new healthData(
MedCategoryID: 4,
MedSubCategoryID: element['MedSubCategoryID'],
MachineDate: DateUtil.convertDateToString(date),
Value: element['Value'],
TransactionsListID: TransactionsListID++,
Notes: ""));
MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++));
Med_InsertTransactionsInputsList2.add(new healthData(
MedCategoryID: 4,
MedSubCategoryID: element['MedSubCategoryID'],
MachineDate: DateUtil.convertDateToString(date),
Value: element['Value'],
TransactionsListID: TransactionsListID++,
Notes: ""));
MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++));
}
// else if(element['MedCategoryID'] == 8){
//
@ -235,27 +225,16 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
}
Med_InsertTransactionsInputsList2.add(
new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: ""));
new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalSteps, TransactionsListID: TransactionsListID++));
Med_InsertTransactionsInputsList2.add(
new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: ""));
new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalDistance, TransactionsListID: TransactionsListID++));
Med_InsertTransactionsInputsList2.add(
new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: ""));
new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++));
});
addInsertTransactionsInputsList();
GifLoaderDialogUtils.hideDialog(context);
// AlertDialogBox dialog = new AlertDialogBox(
// context: context,
// confirmMessage: TranslationBase.of(context).alreadySynced,
// okText: TranslationBase.of(context).ok,
// okFunction: () => {
// AlertDialogBox.closeAlertDialog(context),
// },
// );
// dialog.showAlertDialog(context);
}
addInsertTransactionsInputsList() {
@ -264,7 +243,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
SmartWatchIntegrationService service = new SmartWatchIntegrationService();
service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
print(res);
AppToast.showSuccessToast(message: TranslationBase.of(context).syncSuccess);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);

@ -1,24 +1,7 @@
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';
@ -37,6 +20,7 @@ class _LakumWidgetState extends State<LakumWidget> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
_pointsController.text = widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString();
return Container(
color: Colors.white,
@ -80,74 +64,39 @@ class _LakumWidgetState extends State<LakumWidget> {
fontWeight: FontWeight.bold,
),
Container(
margin: projectProvider.isArabic
? EdgeInsets.only(right: 4)
: EdgeInsets.only(left: 4),
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),
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)),
? 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),
borderSide: BorderSide(color: Colors.black, width: 0.4),
gapPadding: 0,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
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,
color: widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount > 0 ? Colors.black : Colors.grey,
),
enabled: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount ==
0
? false
: true,
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;
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}";
_pointsController.text = "${widget.model.paymentCheckoutData.usedLakumPoints}";
},
),
),
@ -158,12 +107,8 @@ class _LakumWidgetState extends State<LakumWidget> {
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)),
? 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,

@ -370,8 +370,8 @@ class LacumPointsWidget extends StatelessWidget {
final MediaQueryData mediaQuery;
final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer
final String title;
final int riyal;
final int point;
final num riyal;
final num point;
Color titleColor;
final List<PointsAmountPerYear> pointsAmountPerYear;

@ -1,11 +1,15 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import '../../../../../locator.dart';
@ -35,6 +39,7 @@ class _FooterWidgetState extends State<FooterWidget> {
double quantityUI = 80;
bool showUI = false;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppSharedPreferences sharedPref = new AppSharedPreferences();
@override
Widget build(BuildContext context) {
@ -182,9 +187,7 @@ class _FooterWidgetState extends State<FooterWidget> {
disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx,
onTap: () async {
if (!authenticatedUserObject.isLogin) {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
login();
} else
await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
},
@ -204,12 +207,9 @@ class _FooterWidgetState extends State<FooterWidget> {
disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx,
onTap: () async {
if (!authenticatedUserObject.isLogin) {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
login();
} else {
await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
}
},
fontWeight: FontWeight.w600,
@ -227,6 +227,37 @@ class _FooterWidgetState extends State<FooterWidget> {
);
}
void setUserValues(value) async {
if (value != null) sharedPref.setObject(IMEI_USER_DATA, value);
}
login() async {
final authService = new AuthProvider();
var data = await sharedPref.getObject(IMEI_USER_DATA);
sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
if (data != null) {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
GifLoaderDialogUtils.showMyDialog(context);
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context);
if (value != null) {
setUserValues(value);
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
});
}
}
onChangeValue(int i) {
setState(() {
widget.quantity = i;

@ -126,11 +126,16 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
GifLoaderDialogUtils.showMyDialog(context);
await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo);
await widget.orderPreviewViewModel.getShoppingCart();
// widget.changeMainState();
GifLoaderDialogUtils.hideDialog(context);
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
_navigateToPaymentOption(model);
if (widget.orderPreviewViewModel.error == "") {
await widget.orderPreviewViewModel.getShoppingCart();
GifLoaderDialogUtils.hideDialog(context);
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
_navigateToPaymentOption(model);
} else {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.orderPreviewViewModel.error);
return;
}
},
),
),

@ -18,7 +18,6 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -84,8 +83,6 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
);
}
}
// this.isLogin = user != null;
}
void initState() {
@ -101,511 +98,512 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
@override
Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>(
onModelReady: (model) async {
// var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
// var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
// GifLoaderDialogUtils.showMyDialog(context);
// model.getOrder(customerId, customerGUID, page_id);
// GifLoaderDialogUtils.hideDialog(context);
},
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true,
isShowDecPage: true,
isPharmacy: true,
onModelReady: (model) async {
// var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
// var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
// GifLoaderDialogUtils.showMyDialog(context);
// model.getOrder(customerId, customerGUID, page_id);
// GifLoaderDialogUtils.hideDialog(context);
},
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true,
isShowDecPage: true,
isPharmacy: true,
//isBottomBar: true,
isMainPharmacyPages: true,
body: user != null
? Container(
color: Colors.white,
child: SingleChildScrollView(
child: Column(
//isBottomBar: true,
isMainPharmacyPages: true,
body: user != null
? Container(
color: Colors.white,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 20.0,
left: 10.0,
right: 10.0,
bottom: 10.0,
),
child: LargeAvatar(
name: user.firstName.toString(),
url: '',
),
),
Column(children: <Widget>[
Row(children: <Widget>[
Text(
TranslationBase.of(context).welcome,
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey),
),
]),
SizedBox(
height: 10,
),
Row(children: <Widget>[
Text(
languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold),
),
]),
]),
],
padding: EdgeInsets.only(
top: 20.0,
left: 10.0,
right: 10.0,
bottom: 10.0,
),
)
],
),
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 15,
),
Container(
child: Row(
children: <Widget>[
Expanded(
child: InkWell(
onTap: () {
if (customerId == null) {
AppToast.showErrorToast(message: "Customer not found");
return;
}
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID)));
},
child: Column(
children: <Widget>[
// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
child: LargeAvatar(
name: user.firstName.toString(),
url: '',
),
),
),
Expanded(
child: InkWell(
onTap: () {
if (customerId == null || customerId == '')
Navigator.push(context, FadePage(page: LakumActivationVidaPage()));
else
Navigator.push(context, FadePage(page: LakumMainPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold),
),
],
Column(children: <Widget>[
Row(children: <Widget>[
Text(
TranslationBase.of(context).welcome,
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey),
),
]),
SizedBox(
height: 10,
),
Row(children: <Widget>[
Text(
languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold),
),
]),
]),
],
),
)
],
),
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 15,
),
Container(
child: Row(
children: <Widget>[
Expanded(
child: InkWell(
onTap: () {
if (customerId == null) {
AppToast.showErrorToast(message: "Customer not found");
return;
}
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID)));
},
child: Column(
children: <Widget>[
// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: WishlistPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
SizedBox(
height: 5,
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyReviewsPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
Text(
TranslationBase.of(context).orders,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
),
],
)),
SizedBox(
height: 15,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
],
),
),
Container(
padding: EdgeInsets.only(left: 10.0),
),
Expanded(
child: InkWell(
onTap: () {
if (customerId == null || customerId == '')
Navigator.push(context, FadePage(page: LakumActivationVidaPage()));
else
Navigator.push(context, FadePage(page: LakumMainPage()));
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase.of(context).myAccount,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 10,
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
Text(
TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold),
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,
),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context).myPrescription,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: WishlistPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: ComparePage()));
},
child: Row(
children: <Widget>[
Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context).compare,
style: TextStyle(
fontSize: 13.0,
),
),
],
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyReviewsPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).medicationsRefill,
style: TextStyle(
fontSize: 13.0,
),
),
],
Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
)),
SizedBox(
height: 15,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase.of(context).myAccount,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
),
SizedBox(
height: 10,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,
),
SizedBox(
height: 5,
width: 15,
),
Divider(
color: Colors.grey,
height: 20,
Text(
TranslationBase.of(context).myPrescription,
style: TextStyle(
fontSize: 13.0,
),
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyFamily()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).family,
style: TextStyle(
fontSize: 13.0,
),
),
],
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: ComparePage()));
},
child: Row(
children: <Widget>[
Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context).compare,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 30,
height: 30,
),
SizedBox(
height: 5,
width: 20,
),
Text(
TranslationBase.of(context).medicationsRefill,
style: TextStyle(
fontSize: 13.0,
),
),
Divider(
color: Colors.grey,
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyFamily()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).shippingAddresses,
style: TextStyle(
fontSize: 13.0,
),
),
],
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).family,
style: TextStyle(
fontSize: 13.0,
),
),
SizedBox(
height: 5,
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg',
width: 30,
height: 30,
),
Divider(
color: Colors.grey,
height: 20,
SizedBox(
width: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PharmacyTermsConditions()));
},
child: Row(
children: <Widget>[
Image.asset(
'assets/images/pharmacy/terms.png',
width: 25,
height: 25,
),
SizedBox(
width: 10,
),
Text(
TranslationBase.of(context).conditionsHMG,
style: TextStyle(
fontSize: 13.0,
),
),
],
Text(
TranslationBase.of(context).shippingAddresses,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PharmacyTermsConditions()));
},
child: Row(
children: <Widget>[
Image.asset(
'assets/images/pharmacy/terms.png',
width: 25,
height: 25,
),
SizedBox(
height: 5,
width: 10,
),
Divider(
color: Colors.grey,
height: 20,
Text(
TranslationBase.of(context).conditionsHMG,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId)));
},
child: Row(
children: <Widget>[
Image.asset(
'assets/images/pharmacy/terms.png',
width: 25,
height: 25,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId)));
},
child: Row(
children: <Widget>[
Image.asset(
'assets/images/pharmacy/terms.png',
width: 25,
height: 25,
),
// IconButton(icon: Icon(Icons.error_outline), iconSize: 30,
// color: Colors.black,),
SizedBox(
width: 10,
),
Text(
TranslationBase.of(context).conditions,
style: TextStyle(
fontSize: 13.0,
),
),
],
SizedBox(
width: 10,
),
Text(
TranslationBase.of(context).conditions,
style: TextStyle(
fontSize: 13.0,
),
),
],
),
),
],
),
),
SizedBox(
height: 10,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase.of(context).reachUs,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
),
SizedBox(
height: 10,
height: 5,
),
Divider(
color: Colors.grey[350],
color: Colors.grey,
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LiveChatPage()));
},
child: Row(
children: <Widget>[
Text(
TranslationBase.of(context).reachUs,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
width: 20,
height: 20,
),
SizedBox(
height: 5,
width: 20,
),
Divider(
color: Colors.grey,
height: 20,
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LiveChatPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
width: 20,
height: 20,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: FindUsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,
),
SizedBox(
height: 5,
width: 20,
),
Divider(
color: Colors.grey,
height: 20,
Text(
TranslationBase.of(context).ourLocations,
style: TextStyle(fontSize: 13.0),
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: FindUsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).ourLocations,
style: TextStyle(fontSize: 13.0),
),
],
),
)
],
),
)
],
),
),
)
: Container(),
));
)
],
),
),
)
: Container(),
),
);
}
}

@ -2792,6 +2792,7 @@ class TranslationBase {
String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode];
String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode];
String get syncSuccess => localizedValues["syncSuccess"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -48,9 +48,9 @@ class MyInAppBrowser extends InAppBrowser {
static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess';
static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed';
static List<String> successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete'];
static List<String> successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails'];
static List<String> errorURLS = ['PayfortCancel', 'errorpage', 'Failed'];
static List<String> errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails'];
final Function onExitCallback;
final Function onLoadStartCallback;

@ -1,16 +1,16 @@
import 'package:diplomaticquarterapp/Constants.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
class BottomNavPharmacyItem extends StatelessWidget {
final String title;
final IconData icon;
@ -22,15 +22,10 @@ class BottomNavPharmacyItem extends StatelessWidget {
final bool isHome;
final IconData activeIcon;
BottomNavPharmacyItem(
{this.icon,
this.changeIndex,
this.index,
this.currentIndex,
this.activeIcon,
this.title,
this.onTap,
this.isHome = false});
BottomNavPharmacyItem({this.icon, this.changeIndex, this.index, this.currentIndex, this.activeIcon, this.title, this.onTap, this.isHome = false});
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
Widget build(BuildContext context) {
@ -39,7 +34,7 @@ class BottomNavPharmacyItem extends StatelessWidget {
return Expanded(
child: SizedBox(
height: 66.0,
height: 66.0,
child: Stack(
clipBehavior: Clip.none,
children: [
@ -49,13 +44,8 @@ class BottomNavPharmacyItem extends StatelessWidget {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
if (!Provider.of<ProjectViewModel>(context, listen: false)
.isLogin &&
(currentIndex == 2 || currentIndex == 3))
Navigator.push(
context,
FadePage(page: WelcomeLogin()),
);
if (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && (currentIndex == 2 || currentIndex == 3))
login(context);
else
changeIndex(currentIndex);
},
@ -63,9 +53,6 @@ class BottomNavPharmacyItem extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// SizedBox(
// height: 15,
// ),
currentIndex == index
? Divider(
color: Color(0xff5AB133),
@ -93,20 +80,14 @@ class BottomNavPharmacyItem extends StatelessWidget {
title,
textAlign: TextAlign.center,
color: currentIndex == index ? Colors.grey : Colors.grey,
fontWeight: currentIndex == index
? FontWeight.normal
: FontWeight.w400,
fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400,
fontSize: currentIndex == index ? 11 : 9,
),
],
),
),
),
if (currentIndex == 3 &&
Provider.of<OrderPreviewViewModel>(context, listen: false)
.cartResponse
.quantityCount !=
0)
if (currentIndex == 3 && Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount != 0)
Positioned(
top: 11.5,
right: -3.5,
@ -131,4 +112,35 @@ class BottomNavPharmacyItem extends StatelessWidget {
),
);
}
void setUserValues(value) async {
if (value != null) sharedPref.setObject(IMEI_USER_DATA, value);
}
login(BuildContext context) async {
final authService = new AuthProvider();
var data = await sharedPref.getObject(IMEI_USER_DATA);
sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
if (data != null) {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
GifLoaderDialogUtils.showMyDialog(context);
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context);
if (value != null) {
setUserValues(value);
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
});
}
}
}

Loading…
Cancel
Save