Merge branch 'h2o_improvement' into 'development'

H2o improvement

See merge request Cloud_Solution/diplomatic-quarter!259
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 1d724a8db6

@ -306,8 +306,11 @@ const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo';
const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies';
// H2O // H2O
const H2O_GET_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New";
const H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New";
const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress";
const H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; const H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity";
const H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity";
//E_Referral Services //E_Referral Services
const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes";

File diff suppressed because it is too large Load Diff

@ -0,0 +1,104 @@
class UserDetailModel {
int userID;
int patientID;
int patientType;
bool patientOutSA;
String firstName;
String middleName;
String lastName;
String firstNameN;
String middleNameN;
String lastNameN;
String identificationNo;
String mobile;
String emailID;
String zipCode;
String dOB;
String gender;
int activityID;
String createdDate;
double height;
double weight;
bool isHeightInCM;
bool isWeightInKG;
bool isNotificationON;
UserDetailModel(
{this.userID,
this.patientID,
this.patientType,
this.patientOutSA,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.identificationNo,
this.mobile,
this.emailID,
this.zipCode,
this.dOB,
this.gender,
this.activityID,
this.createdDate,
this.height,
this.weight,
this.isHeightInCM,
this.isWeightInKG,
this.isNotificationON});
UserDetailModel.fromJson(Map<String, dynamic> json) {
userID = json['UserID'];
patientID = json['PatientID'];
patientType = json['PatientType'];
patientOutSA = json['PatientOutSA'];
firstName = json['FirstName'];
middleName = json['MiddleName'];
lastName = json['LastName'];
firstNameN = json['FirstNameN'];
middleNameN = json['MiddleNameN'];
lastNameN = json['LastNameN'];
identificationNo = json['IdentificationNo'];
mobile = json['Mobile'];
emailID = json['EmailID'];
zipCode = json['ZipCode'];
dOB = json['DOB'];
gender = json['Gender'];
activityID = json['ActivityID'];
createdDate = json['CreatedDate'];
height = json['Height'];
weight = json['Weight'];
isHeightInCM = json['IsHeightInCM'];
isWeightInKG = json['IsWeightInKG'];
isNotificationON = json['IsNotificationON'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['UserID'] = this.userID;
data['PatientID'] = this.patientID;
data['PatientType'] = this.patientType;
data['PatientOutSA'] = this.patientOutSA;
data['FirstName'] = this.firstName;
data['MiddleName'] = this.middleName;
data['LastName'] = this.lastName;
data['FirstNameN'] = this.firstNameN;
data['MiddleNameN'] = this.middleNameN;
data['LastNameN'] = this.lastNameN;
data['IdentificationNo'] = this.identificationNo;
data['Mobile'] = this.mobile;
data['EmailID'] = this.emailID;
data['ZipCode'] = this.zipCode;
data['DOB'] = this.dOB;
data['Gender'] = this.gender;
data['ActivityID'] = this.activityID;
data['CreatedDate'] = this.createdDate;
data['Height'] = this.height;
data['Weight'] = this.weight;
data['IsHeightInCM'] = this.isHeightInCM;
data['IsWeightInKG'] = this.isWeightInKG;
data['IsNotificationON'] = this.isNotificationON;
return data;
}
}

@ -0,0 +1,124 @@
class UserDetailRequestModel {
String activityID;
int channel;
int deviceTypeID;
String dOB;
String email;
String firstName;
String gender;
String generalid;
double height;
String identificationNo;
String iPAdress;
bool isDentalAllowedBackend;
bool isHeightInCM;
bool isNotificationOn;
bool isWeightInKG;
int languageID;
String lastName;
String middleName;
String mobileNumber;
int patientID;
int patientOutSA;
int patientType;
int patientTypeID;
String sessionID;
String tokenID;
double versionID;
double weight;
String zipCode;
UserDetailRequestModel(
{this.activityID,
this.channel,
this.deviceTypeID,
this.dOB,
this.email,
this.firstName,
this.gender,
this.generalid,
this.height,
this.identificationNo,
this.iPAdress,
this.isDentalAllowedBackend,
this.isHeightInCM,
this.isNotificationOn,
this.isWeightInKG,
this.languageID,
this.lastName,
this.middleName,
this.mobileNumber,
this.patientID,
this.patientOutSA,
this.patientType,
this.patientTypeID,
this.sessionID,
this.tokenID,
this.versionID,
this.weight,
this.zipCode});
UserDetailRequestModel.fromJson(Map<String, dynamic> json) {
activityID = json['ActivityID'];
channel = json['Channel'];
deviceTypeID = json['DeviceTypeID'];
dOB = json['DOB'];
email = json['Email'];
firstName = json['FirstName'];
gender = json['Gender'];
generalid = json['generalid'];
height = json['Height'];
identificationNo = json['IdentificationNo'];
iPAdress = json['IPAdress'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
isHeightInCM = json['IsHeightInCM'];
isNotificationOn = json['isNotificationOn'];
isWeightInKG = json['IsWeightInKG'];
languageID = json['LanguageID'];
lastName = json['LastName'];
middleName = json['MiddleName'];
mobileNumber = json['MobileNumber'];
patientID = json['PatientID'];
patientOutSA = json['PatientOutSA'];
patientType = json['PatientType'];
patientTypeID = json['PatientTypeID'];
sessionID = json['SessionID'];
tokenID = json['TokenID'];
versionID = json['VersionID'];
weight = json['Weight'];
zipCode = json['ZipCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ActivityID'] = this.activityID;
data['Channel'] = this.channel;
data['DeviceTypeID'] = this.deviceTypeID;
data['DOB'] = this.dOB;
data['Email'] = this.email;
data['FirstName'] = this.firstName;
data['Gender'] = this.gender;
data['generalid'] = this.generalid;
data['Height'] = this.height;
data['IdentificationNo'] = this.identificationNo;
data['IPAdress'] = this.iPAdress;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['IsHeightInCM'] = this.isHeightInCM;
data['isNotificationOn'] = this.isNotificationOn;
data['IsWeightInKG'] = this.isWeightInKG;
data['LanguageID'] = this.languageID;
data['LastName'] = this.lastName;
data['MiddleName'] = this.middleName;
data['MobileNumber'] = this.mobileNumber;
data['PatientID'] = this.patientID;
data['PatientOutSA'] = this.patientOutSA;
data['PatientType'] = this.patientType;
data['PatientTypeID'] = this.patientTypeID;
data['SessionID'] = this.sessionID;
data['TokenID'] = this.tokenID;
data['VersionID'] = this.versionID;
data['Weight'] = this.weight;
data['ZipCode'] = this.zipCode;
return data;
}
}

@ -1,5 +1,7 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart';
@ -10,8 +12,66 @@ class H2OService extends BaseService {
List<UserProgressForTodayDataModel> userProgressForTodayDataList = List(); List<UserProgressForTodayDataModel> userProgressForTodayDataList = List();
List<UserProgressForWeekDataModel> userProgressForWeekDataList = List(); List<UserProgressForWeekDataModel> userProgressForWeekDataList = List();
List<UserProgressForMonthDataModel> userProgressForMonthDataList = List(); List<UserProgressForMonthDataModel> userProgressForMonthDataList = List();
UserProgressRequestModel userProgressRequestModel = UserProgressRequestModel userProgressRequestModel = UserProgressRequestModel();
UserProgressRequestModel();
UserDetailModel userDetailModel = UserDetailModel();
Future getUserDetail() async {
userProgressRequestModel.progress = 1;
userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1);
userProgressRequestModel.identificationNo = user.patientIdentificationNo;
hasError = false;
await baseAppClient.post(H2O_GET_USER_DETAIL, onSuccess: (dynamic response, int statusCode) {
userDetailModel = UserDetailModel.fromJson(response["UserDetailData_New"]);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: userProgressRequestModel.toJson());
}
Future updateUserDetail(UserDetailModel userDetail) async {
userProgressRequestModel.progress = 1;
userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1);
userProgressRequestModel.identificationNo = user.patientIdentificationNo;
UserDetailRequestModel _requestModel = UserDetailRequestModel();
_requestModel.activityID = userDetail.activityID.toString();
_requestModel.channel = userProgressRequestModel.channel;
_requestModel.dOB = userDetail.dOB;
_requestModel.deviceTypeID = userProgressRequestModel.deviceTypeID;
_requestModel.email = userDetail.emailID;
_requestModel.firstName = userDetail.firstName;
_requestModel.gender = userDetail.gender;
_requestModel.height = userDetail.height;
_requestModel.iPAdress = userProgressRequestModel.iPAdress;
_requestModel.identificationNo = userProgressRequestModel.identificationNo;
_requestModel.isHeightInCM = userDetail.isHeightInCM;
_requestModel.isWeightInKG = userDetail.isWeightInKG;
_requestModel.languageID = userProgressRequestModel.languageID;
_requestModel.mobileNumber = userProgressRequestModel.mobileNumber;
_requestModel.patientID = userProgressRequestModel.patientID;
_requestModel.patientOutSA = userProgressRequestModel.patientOutSA;
_requestModel.patientType = userProgressRequestModel.patientType;
_requestModel.patientTypeID = userProgressRequestModel.patientOutSA;
_requestModel.sessionID = userProgressRequestModel.sessionID;
_requestModel.tokenID = userProgressRequestModel.tokenID;
_requestModel.versionID = userProgressRequestModel.versionID;
_requestModel.zipCode = userDetail.zipCode;
_requestModel.weight = userDetail.weight;
_requestModel.generalid = userProgressRequestModel.generalid;
_requestModel.isDentalAllowedBackend = userProgressRequestModel.isDentalAllowedBackend;
_requestModel.isNotificationOn = userDetail.isNotificationON;
hasError = false;
await baseAppClient.post(H2O_UPDATE_USER_DETAIL, onSuccess: (dynamic response, int statusCode) {
userDetailModel = userDetail;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestModel.toJson());
}
Future getUserProgressForTodayData() async { Future getUserProgressForTodayData() async {
userProgressRequestModel.progress = 1; userProgressRequestModel.progress = 1;
@ -19,12 +79,10 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = user.patientIdentificationNo; userProgressRequestModel.identificationNo = user.patientIdentificationNo;
hasError = false; hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS, await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear(); userProgressForTodayDataList.clear();
response['UserProgressForTodayData'].forEach((progressData) { response['UserProgressForTodayData'].forEach((progressData) {
userProgressForTodayDataList userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData));
.add(UserProgressForTodayDataModel.fromJson(progressData));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -38,16 +96,15 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; userProgressRequestModel.identificationNo = super.user.patientIdentificationNo;
hasError = false; hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS, await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { userProgressForWeekDataList.clear();
userProgressForTodayDataList.clear(); response['UserProgressForWeekData'].forEach((hospital) {
response['UserProgressForWeekData'].forEach((hospital) { userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital));
userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital)); });
}); }, onFailure: (String error, int statusCode) {
}, onFailure: (String error, int statusCode) { hasError = true;
hasError = true; super.error = error;
super.error = error; }, body: userProgressRequestModel.toJson());
}, body: userProgressRequestModel.toJson());
} }
Future getUserProgressForMonthData() async { Future getUserProgressForMonthData() async {
@ -56,8 +113,7 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; userProgressRequestModel.identificationNo = super.user.patientIdentificationNo;
hasError = false; hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS, await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
userProgressForMonthDataList.clear(); userProgressForMonthDataList.clear();
response['UserProgressForMonthData'].forEach((hospital) { response['UserProgressForMonthData'].forEach((hospital) {
userProgressForMonthDataList.add(UserProgressForMonthDataModel.fromJson(hospital)); userProgressForMonthDataList.add(UserProgressForMonthDataModel.fromJson(hospital));
@ -68,22 +124,33 @@ class H2OService extends BaseService {
}, body: userProgressRequestModel.toJson()); }, body: userProgressRequestModel.toJson());
} }
Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async { Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async {
hasError = false;
await baseAppClient.post(H2O_INSERT_USER_ACTIVITY, onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear();
response['UserProgressForTodayData'].forEach((progressData) {
userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: insertUserActivityRequestModel.toJson());
}
Future undoUserActivity() async {
userProgressRequestModel.progress = 1;
userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1);
userProgressRequestModel.identificationNo = user.patientIdentificationNo;
hasError = false; hasError = false;
await baseAppClient.post(H2O_INSERT_USER_ACTIVITY, await baseAppClient.post(H2O_UNDO_USER_ACTIVITY, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { userProgressForTodayDataList.clear();
userProgressForTodayDataList.clear(); response['UserProgressForTodayData'].forEach((progressData) {
response['UserProgressForTodayData'].forEach((progressData) { userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData));
userProgressForTodayDataList });
.add(UserProgressForTodayDataModel.fromJson(progressData)); }, onFailure: (String error, int statusCode) {
}); hasError = true;
}, onFailure: (String error, int statusCode) { super.error = error;
hasError = true; }, body: userProgressRequestModel.toJson());
super.error = error;
}, body: insertUserActivityRequestModel.toJson());
} }
} }

@ -1,26 +1,54 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/flutter.dart' as charts;
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../locator.dart'; import '../../../locator.dart';
class H2OViewModel extends BaseViewModel { class H2OViewModel extends BaseViewModel {
H2OService _h2OService = locator<H2OService>(); H2OService _h2OService = locator<H2OService>();
List<charts.Series> userProgressForWeekDataSeries; List<charts.Series> userProgressForWeekDataSeries;
List<charts.Series> userProgressForMonthDataSeries; List<charts.Series> userProgressForMonthDataSeries;
UserDetailModel get userDetail => _h2OService.userDetailModel;
UserProgressForTodayDataModel get userProgressData { UserProgressForTodayDataModel get userProgressData {
if (_h2OService.userProgressForTodayDataList.length != 0) if (_h2OService.userProgressForTodayDataList.length != 0) return _h2OService.userProgressForTodayDataList[0];
return _h2OService.userProgressForTodayDataList[0]; return null;
return null;
} }
Future getUserDetail() async {
// if(_h2OService.userProgressForTodayDataList.length==0){
setState(ViewState.Busy);
await _h2OService.getUserDetail();
if (_h2OService.hasError) {
error = _h2OService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future updateUserDetail(UserDetailModel userDetailModel, Function(bool) onResponse) async {
setState(ViewState.Busy);
await _h2OService.updateUserDetail(userDetailModel);
if (_h2OService.hasError) {
error = _h2OService.error;
setState(ViewState.Error);
onResponse(false);
} else {
_h2OService.userDetailModel = userDetailModel;
setState(ViewState.Idle);
onResponse(true);
}
}
Future getUserProgressForTodayData() async { Future getUserProgressForTodayData() async {
// if(_h2OService.userProgressForTodayDataList.length==0){ // if(_h2OService.userProgressForTodayDataList.length==0){
@ -58,13 +86,9 @@ class H2OViewModel extends BaseViewModel {
} }
} }
List<charts.Series<ChartSeries, String>> createUserProgressForWeekDataSeries() {
List<charts.Series<ChartSeries, List<ChartSeries> globalData = [];
String>> createUserProgressForWeekDataSeries() { _h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) {
List<ChartSeries> globalData = [
];
_h2OService.userProgressForWeekDataList.forEach((
UserProgressForWeekDataModel data) {
globalData.add(new ChartSeries(data.dayName, data.percentageConsumed)); globalData.add(new ChartSeries(data.dayName, data.percentageConsumed));
}); });
return [ return [
@ -77,12 +101,9 @@ class H2OViewModel extends BaseViewModel {
]; ];
} }
List<charts.Series<ChartSeries, List<charts.Series<ChartSeries, String>> createUserProgressForMonthDataSeries() {
String>> createUserProgressForMonthDataSeries() { List<ChartSeries> globalData = [];
List<ChartSeries> globalData = [ _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) {
];
_h2OService.userProgressForMonthDataList.forEach((
UserProgressForMonthDataModel data) {
globalData.add(new ChartSeries(data.monthName, data.percentageConsumed)); globalData.add(new ChartSeries(data.monthName, data.percentageConsumed));
}); });
return [ return [
@ -95,14 +116,10 @@ class H2OViewModel extends BaseViewModel {
]; ];
} }
Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async {
Future insertUserActivity(
InsertUserActivityRequestModel insertUserActivityRequestModel) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
insertUserActivityRequestModel.mobileNumber = insertUserActivityRequestModel.mobileNumber = user.mobileNumber.substring(1);
user.mobileNumber.substring(1); insertUserActivityRequestModel.identificationNo = user.patientIdentificationNo;
insertUserActivityRequestModel.identificationNo =
user.patientIdentificationNo;
await _h2OService.insertUserActivity(insertUserActivityRequestModel); await _h2OService.insertUserActivity(insertUserActivityRequestModel);
if (_h2OService.hasError) { if (_h2OService.hasError) {
@ -113,9 +130,18 @@ class H2OViewModel extends BaseViewModel {
} }
} }
Future undoUserActivity() async {
setState(ViewState.BusyLocal);
await _h2OService.undoUserActivity();
if (_h2OService.hasError) {
error = _h2OService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
} }
/// Sample ordinal data type. /// Sample ordinal data type.
class ChartSeries { class ChartSeries {
final String y; final String y;

@ -16,30 +16,22 @@ import 'base_view_model.dart';
class PharmacyCategoriseViewModel extends BaseViewModel { class PharmacyCategoriseViewModel extends BaseViewModel {
bool hasError = false; bool hasError = false;
PharmacyCategoriseService _pharmacyCategoriseService = PharmacyCategoriseService _pharmacyCategoriseService = locator<PharmacyCategoriseService>();
locator<PharmacyCategoriseService>();
List<PharmacyCategorise> get categorise => List<PharmacyCategorise> get categorise => _pharmacyCategoriseService.categoriseList;
_pharmacyCategoriseService.categoriseList;
List<CategoriseParentModel> get categoriseParent => List<CategoriseParentModel> get categoriseParent => _pharmacyCategoriseService.parentCategoriseList;
_pharmacyCategoriseService.parentCategoriseList;
List<ParentProductsModel> get parentProducts => List<ParentProductsModel> get parentProducts => _pharmacyCategoriseService.parentProductsList;
_pharmacyCategoriseService.parentProductsList;
List<SubCategoriesModel> get subCategorise => List<SubCategoriesModel> get subCategorise => _pharmacyCategoriseService.subCategoriseList;
_pharmacyCategoriseService.subCategoriseList;
List<SubProductsModel> get subProducts => List<SubProductsModel> get subProducts => _pharmacyCategoriseService.subProductsList;
_pharmacyCategoriseService.subProductsList;
List<FinalProductsModel> get finalProducts => List<FinalProductsModel> get finalProducts => _pharmacyCategoriseService.finalProducts;
_pharmacyCategoriseService.finalProducts;
List<BrandsModel> get brandsList => _pharmacyCategoriseService.brandsList; List<BrandsModel> get brandsList => _pharmacyCategoriseService.brandsList;
List<SearchProductsModel> get searchList => List<SearchProductsModel> get searchList => _pharmacyCategoriseService.searchList;
_pharmacyCategoriseService.searchList;
List<ScanQrModel> get scanList => _pharmacyCategoriseService.scanList; List<ScanQrModel> get scanList => _pharmacyCategoriseService.scanList;

@ -37,6 +37,8 @@ import 'package:geolocator/geolocator.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'h2o/h2o_page.dart';
class AllHabibMedicalService extends StatefulWidget { class AllHabibMedicalService extends StatefulWidget {
//TODO //TODO
final Function goToMyProfile; final Function goToMyProfile;
@ -56,12 +58,8 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
@override @override
void initState() { void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
locationUtils = locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
new LocationUtils(isShowConfirmDialog: true, context: context); WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))});
WidgetsBinding.instance.addPostFrameCallback((_) => {
Geolocator.getLastKnownPosition()
.then((value) => setLocation(value))
});
}); });
super.initState(); super.initState();
} }
@ -100,8 +98,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
TranslationBase.of(context) TranslationBase.of(context).healthWeatherIndicators,
.healthWeatherIndicators,
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -134,11 +131,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
width: 60, width: 60,
height: 60, height: 60,
), ),
Directionality( Directionality(textDirection: TextDirection.ltr, child: AppText(weather, fontSize: 22, color: Colors.white))
textDirection: TextDirection.ltr,
child: AppText(weather,
fontSize: 22,
color: Colors.white))
], ],
), ),
Texts( Texts(
@ -158,8 +151,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
Navigator.pop(context); Navigator.pop(context);
widget.goToMyProfile(); widget.goToMyProfile();
}, },
imageLocation: imageLocation: 'assets/images/new-design/my_file_bottom_bar.png',
'assets/images/new-design/my_file_bottom_bar.png',
title: TranslationBase.of(context).myMedicalFile, title: TranslationBase.of(context).myMedicalFile,
), ),
ServicesContainer( ServicesContainer(
@ -181,8 +173,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
), ),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/booking_icon_active.png',
'assets/images/new-design/booking_icon_active.png',
title: TranslationBase.of(context).bookAppo, title: TranslationBase.of(context).bookAppo,
), ),
ServicesContainer( ServicesContainer(
@ -192,8 +183,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: PaymentService(), page: PaymentService(),
), ),
), ),
imageLocation: imageLocation: 'assets/images/al-habib_online_payment_service_icon.png',
'assets/images/al-habib_online_payment_service_icon.png',
title: TranslationBase.of(context).onlinePaymentService, title: TranslationBase.of(context).onlinePaymentService,
), ),
ServicesContainer( ServicesContainer(
@ -201,8 +191,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
context, context,
FadePage(), FadePage(),
), ),
imageLocation: imageLocation: 'assets/images/al-habib_online_payment_service_icon.png',
'assets/images/al-habib_online_payment_service_icon.png',
title: TranslationBase.of(context).covid19_driveThrueTest, title: TranslationBase.of(context).covid19_driveThrueTest,
), ),
ServicesContainer( ServicesContainer(
@ -235,17 +224,13 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: InsuranceUpdate(), page: InsuranceUpdate(),
), ),
), ),
imageLocation: imageLocation: 'assets/images/medical/insurance_card_icon.png',
'assets/images/medical/insurance_card_icon.png',
title: TranslationBase.of(context).updateInsurance, title: TranslationBase.of(context).updateInsurance,
), ),
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(page: authUser.patientID == null ? EReferralIndexPage() : EReferralPage()),
page: authUser.patientID == null
? EReferralIndexPage()
: EReferralPage()),
), ),
imageLocation: 'assets/images/ereferral_service_icon.png', imageLocation: 'assets/images/ereferral_service_icon.png',
title: TranslationBase.of(context).ereferral, title: TranslationBase.of(context).ereferral,
@ -257,20 +242,18 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: MyFamily(), page: MyFamily(),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/family_menu_icon_red.png',
'assets/images/new-design/family_menu_icon_red.png',
title: TranslationBase.of(context).myFamily, title: TranslationBase.of(context).myFamily,
), ),
if(projectViewModel.havePrivilege(35)) if (projectViewModel.havePrivilege(35))
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage(page: ChildVaccinesPage()), FadePage(page: ChildVaccinesPage()),
),
imageLocation: 'assets/images/new-design/children_vaccines_icon.png',
title: TranslationBase.of(context).childVaccine,
), ),
imageLocation:
'assets/images/new-design/children_vaccines_icon.png',
title: TranslationBase.of(context).childVaccine,
),
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
@ -278,27 +261,26 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: ToDo(isShowAppBar: true), page: ToDo(isShowAppBar: true),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png',
'assets/images/new-design/upcoming_icon_bottom_bar.png',
title: TranslationBase.of(context).todoList, title: TranslationBase.of(context).todoList,
), ),
if(projectViewModel.havePrivilege(42)) if (projectViewModel.havePrivilege(42))
ServicesContainer(
onTap: () => Navigator.push(
context,
FadePage(page: SymptomInfo()),
),
imageLocation: 'assets/images/new-design/body_icon.png',
title: TranslationBase.of(context).symptomCheckerTitle),
if(projectViewModel.havePrivilege(36))
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage(page: BloodDonationPage()), FadePage(page: SymptomInfo()),
),
imageLocation: 'assets/images/new-design/body_icon.png',
title: TranslationBase.of(context).symptomCheckerTitle),
if (projectViewModel.havePrivilege(36))
ServicesContainer(
onTap: () => Navigator.push(
context,
FadePage(page: BloodDonationPage()),
),
imageLocation: 'assets/images/new-design/blood_icon.png',
title: TranslationBase.of(context).bloodD,
), ),
imageLocation: 'assets/images/new-design/blood_icon.png',
title: TranslationBase.of(context).bloodD,
),
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
@ -306,8 +288,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: (HealthCalculators()), page: (HealthCalculators()),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/health_calculator_icon.png',
'assets/images/new-design/health_calculator_icon.png',
title: TranslationBase.of(context).calculators, title: TranslationBase.of(context).calculators,
), ),
ServicesContainer( ServicesContainer(
@ -317,30 +298,30 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: HealthConverter(), page: HealthConverter(),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/health_convertor_icon.png',
'assets/images/new-design/health_convertor_icon.png',
title: TranslationBase.of(context).converters, title: TranslationBase.of(context).converters,
), ),
if(projectViewModel.havePrivilege(38)) if (projectViewModel.havePrivilege(38))
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(context, FadePage(page: H2OPage())),
context, // Navigator.push(
FadePage( // context,
page: H2OPageIndexPage(), // FadePage(
), // page: H2OPageIndexPage(),
// ),
// ),
imageLocation: 'assets/images/new-design/water_icon.png',
title: TranslationBase.of(context).h2o,
), ),
imageLocation: 'assets/images/new-design/water_icon.png', if (projectViewModel.havePrivilege(41))
title: 'H2O', ServicesContainer(
), onTap: () => Navigator.push(
if(projectViewModel.havePrivilege(41)) context,
ServicesContainer( FadePage(),
onTap: () => Navigator.push( ),
context, imageLocation: 'assets/images/new-design/smartwatch_icon.png',
FadePage(), title: TranslationBase.of(context).smartWatches,
), ),
imageLocation: 'assets/images/new-design/smartwatch_icon.png',
title: TranslationBase.of(context).smartWatches,
),
ServicesContainer( ServicesContainer(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
@ -348,15 +329,12 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
page: ParkingPage(), page: ParkingPage(),
), ),
), ),
imageLocation: imageLocation: 'assets/images/new-design/parking_system_icon.png',
'assets/images/new-design/parking_system_icon.png',
title: TranslationBase.of(context).parking, title: TranslationBase.of(context).parking,
), ),
ServicesContainer( ServicesContainer(
onTap: () => launch( onTap: () => launch("https://hmgwebservices.com/vt_mobile/html/index.html"),
"https://hmgwebservices.com/vt_mobile/html/index.html"), imageLocation: 'assets/images/new-design/virtual_tour_icon.png',
imageLocation:
'assets/images/new-design/virtual_tour_icon.png',
title: TranslationBase.of(context).vTour, title: TranslationBase.of(context).vTour,
), ),
ServicesContainer( ServicesContainer(
@ -364,12 +342,10 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
Navigator.of(context).push(MaterialPageRoute( Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => MyWebView( builder: (BuildContext context) => MyWebView(
title: "HMG News", title: "HMG News",
selectedUrl: selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live",
"https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live",
))); )));
}, },
imageLocation: imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png',
'assets/images/new-design/twitter_dashboard_icon.png',
title: TranslationBase.of(context).latestNews, title: TranslationBase.of(context).latestNews,
), ),
ServicesContainer( ServicesContainer(
@ -392,8 +368,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
getAuthUser() async { getAuthUser() async {
if (await this.sharedPref.getObject(USER_PROFILE) != null) { if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson( var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
await this.sharedPref.getObject(USER_PROFILE));
setState(() { setState(() {
authUser = data; authUser = data;
}); });
@ -407,8 +382,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
}); });
} else { } else {
setState(() { setState(() {
weather = weather = data != null ? data['Temperature'].toString() + '\u2103' : '--';
data != null ? data['Temperature'].toString() + '\u2103' : '--';
}); });
} }
} }

@ -12,9 +12,7 @@ class ConfirmAddAmountDialog extends StatefulWidget {
final String unit; final String unit;
final H2OViewModel model; final H2OViewModel model;
ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"});
ConfirmAddAmountDialog(
{Key key, this.model,this.amount,this.unit ="ml"});
@override @override
_ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState();
@ -29,10 +27,12 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return SimpleDialog(
contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0),
titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0),
title: Center( title: Center(
child: Texts( child: Texts(
"Confirm", TranslationBase.of(context).confirm,
textAlign: TextAlign.center,
color: Colors.black, color: Colors.black,
), ),
), ),
@ -42,12 +42,13 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
Divider(), Divider(),
Center( Center(
child: Texts( child: Texts(
"Are you sure you want to Add ${widget.amount} ${widget.unit} ?", "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?",
textAlign: TextAlign.center,
color: Colors.grey, color: Colors.grey,
), ),
), ),
SizedBox( SizedBox(
height: 5.0, height: 16.0,
), ),
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -79,8 +80,8 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
Expanded( Expanded(
flex: 1, flex: 1,
child: InkWell( child: InkWell(
onTap: () async{ onTap: () async {
InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount ); InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount);
await widget.model.insertUserActivity(insertUserActivityRequestModel); await widget.model.insertUserActivity(insertUserActivityRequestModel);
Navigator.pop(context); Navigator.pop(context);
}, },
@ -88,20 +89,17 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts( child: Texts(
TranslationBase.of(context).ok, TranslationBase.of(context).ok.toUpperCase(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
)), )),
), ),
), ),
), ),
], ],
) ),
], ],
) )
], ],
); );
} }
} }

@ -1,3 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -5,25 +7,32 @@ import 'package:flutter/material.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class SelectAmountDialog extends StatefulWidget { class SelectAmountDialog extends StatefulWidget {
List<AmountModel> searchAmount = [
AmountModel(name: "l",nameAr:"لتر",value: 1),
AmountModel(name: "ml",nameAr:"مم لتر",value: 2),
];
final Function(AmountModel) onValueSelected; final Function(AmountModel) onValueSelected;
AmountModel selectedAmount; AmountModel selectedAmount;
SelectAmountDialog( SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount});
{Key key, this.onValueSelected, this.selectedAmount});
@override @override
_SelectAmountDialogState createState() => _SelectAmountDialogState(); _SelectAmountDialogState createState() => _SelectAmountDialogState();
} }
class _SelectAmountDialogState extends State<SelectAmountDialog> { class _SelectAmountDialogState extends State<SelectAmountDialog> {
List<AmountModel> searchAmount = [
AmountModel(name: "l", nameAr: "لتر", value: 1),
AmountModel(name: "ml", nameAr: "مم لتر", value: 2),
];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
widget.selectedAmount = widget.selectedAmount ?? widget.searchAmount[0]; widget.selectedAmount = widget.selectedAmount ?? searchAmount[0];
getLanguage();
}
String languageID = "en";
void getLanguage() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {});
} }
@override @override
@ -32,11 +41,14 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
children: [ children: [
Column( Column(
children: [ children: [
Texts("Select the preferred unit", fontSize: 20,), Texts(
TranslationBase.of(context).preferredunit,
fontSize: 20,
),
Divider(), Divider(),
...List.generate( ...List.generate(
widget.searchAmount.length, searchAmount.length,
(index) => Column( (index) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
@ -49,13 +61,13 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
widget.selectedAmount = widget.searchAmount[index]; widget.selectedAmount = searchAmount[index];
}); });
}, },
child: ListTile( child: ListTile(
title: Text(widget.searchAmount[index].name), title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name),
leading: Radio( leading: Radio(
value: widget.searchAmount[index], value: searchAmount[index],
groupValue: widget.selectedAmount, groupValue: widget.selectedAmount,
activeColor: Colors.red[800], activeColor: Colors.red[800],
onChanged: (value) { onChanged: (value) {
@ -116,9 +128,9 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts( child: Texts(
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
)), )),
), ),
), ),
), ),
@ -130,6 +142,7 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
); );
} }
} }
class AmountModel { class AmountModel {
String name; String name;
String nameAr; String nameAr;
@ -151,7 +164,3 @@ class AmountModel {
return data; return data;
} }
} }

@ -0,0 +1,101 @@
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class CommonRadioButtonDialog extends StatefulWidget {
final List<String> list;
final String title;
final int selectedIndex;
final Function(int) onSelect;
CommonRadioButtonDialog({Key key, this.title = "", this.selectedIndex = 0, this.list, this.onSelect}) : super(key: key);
@override
_CommonRadioButtonDialogState createState() {
return _CommonRadioButtonDialogState();
}
}
class _CommonRadioButtonDialogState extends State<CommonRadioButtonDialog> {
int _selectedIndex = 0;
@override
void initState() {
super.initState();
_selectedIndex = widget.selectedIndex;
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
elevation: 0,
backgroundColor: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: widget.title == "" ? 24 : 50,
alignment: Alignment.center,
child: Text(
widget.title,
style: TextStyle(color: Colors.black87, fontSize: 18, fontWeight: FontWeight.w500),
),
),
Divider(height: 1, color: Colors.black38),
ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.only(top: 4, bottom: 4),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return RadioListTile(
value: index,
dense: true,
activeColor: Colors.black54,
groupValue: _selectedIndex,
onChanged: (_index) => setState(() => _selectedIndex = _index),
title: Text(
widget.list[index],
style: TextStyle(fontWeight: FontWeight.w500),
),
);
},
itemCount: widget.list?.length ?? 0,
),
Divider(height: 1, color: Colors.black38),
Container(
height: 50,
alignment: Alignment.center,
child: Row(
children: [
Expanded(
child: FlatButton(
child: Text(
TranslationBase.of(context).cancel,
style: TextStyle(color: Colors.redAccent, fontSize: 16, fontWeight: FontWeight.w500),
),
onPressed: () => Navigator.pop(context),
),
),
Expanded(
child: FlatButton(
child: Text(
TranslationBase.of(context).ok,
style: TextStyle(color: Colors.black87, fontSize: 16, fontWeight: FontWeight.w500),
),
onPressed: () => widget.onSelect(_selectedIndex),
),
)
],
),
),
],
),
);
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart';
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -36,7 +37,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: "Enter amount", appBarTitle:TranslationBase.of(context).customLabel,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
@ -51,7 +52,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
height: 12, height: 12,
), ),
NewTextFields( NewTextFields(
hintText: "Enter the amount of water:", hintText: TranslationBase.of(context).h2oAmountOfWater,
// type: "Number", // type: "Number",
controller: _nameTextController, controller: _nameTextController,
), ),
@ -81,7 +82,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
), ),
SecondaryButton( SecondaryButton(
textColor: Colors.white, textColor: Colors.white,
label: "OK", label: TranslationBase.of(context).ok,
onTap: () async { onTap: () async {
Navigator.of(context).pop(); Navigator.of(context).pop();
showConfirmMessage (int.parse(_nameTextController.text), widget.model); showConfirmMessage (int.parse(_nameTextController.text), widget.model);
@ -120,7 +121,7 @@ void confirmAmountTypeDialog() {
if (selectedAmount != null) if (selectedAmount != null)
return selectedAmount.name; return selectedAmount.name;
else else
return "Select unit"; return TranslationBase.of(context).selectUnit;
} }

@ -1,12 +1,15 @@
import 'dart:ui'; import 'dart:ui';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -34,9 +37,26 @@ class _H2OPageState extends State<H2OPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<H2OViewModel>( return BaseView<H2OViewModel>(
onModelReady: (model) => model.getUserDetail(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: "Water Tracker", appBarTitle: TranslationBase.of(context).waterTracker,
showHomeAppBarIcon: false,
baseViewModel: model,
appBarIcons: [
IconButton(
icon: Image.asset("assets/images/new-design/setting_gear_icon.png"),
color: Colors.white,
onPressed: () {
Navigator.push(
context,
FadePage(
page: H2oSetting(userDetailModel: model.userDetail, viewModel: model),
),
);
},
),
],
body: Scaffold( body: Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: PreferredSize( appBar: PreferredSize(
@ -50,9 +70,7 @@ class _H2OPageState extends State<H2OPage>
child: BackdropFilter( child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container( child: Container(
color: Theme.of(context) color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8),
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0, height: 70.0,
), ),
), ),
@ -60,48 +78,46 @@ class _H2OPageState extends State<H2OPage>
Center( Center(
child: Container( child: Container(
height: 60.0, height: 60.0,
margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center,
width: MediaQuery.of(context).size.width * 0.9, // margin: EdgeInsets.only(top: 10.0),
// width: MediaQuery.of(context).size.width * 0.9,
child: Center( child: TabBar(
child: TabBar( isScrollable: false,
isScrollable: false, controller: _tabController,
controller: _tabController, indicatorWeight: 5.0,
indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.tab,
indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800],
indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor,
labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0),
labelPadding: unselectedLabelColor: Colors.grey[800],
EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), tabs: [
unselectedLabelColor: Colors.grey[800], Container(
tabs: [ width: MediaQuery.of(context).size.width * 0.28,
Container( child: Center(
width: MediaQuery.of(context).size.width * 0.28, child: Texts(TranslationBase.of(context).today),
child: Center(
child: Texts(
"Today"),
),
), ),
Container( ),
width: MediaQuery.of(context).size.width * 0.28, Container(
child: Center( width: MediaQuery.of(context).size.width * 0.28,
child: Texts("Week"), child: Center(
), child: Texts(TranslationBase.of(context).week),
), ),
Container( ),
width: MediaQuery.of(context).size.width * 0.28, Container(
child: Center( width: MediaQuery.of(context).size.width * 0.28,
child: Texts("Month"), child: Center(
), child: Texts(TranslationBase.of(context).month),
), ),
], ),
), ],
), ),
), ),
), ),
], ],
), ),
), ),
backgroundColor: Colors.white,
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(

@ -1,11 +1,13 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart';
import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class MonthPage extends StatelessWidget { class MonthPage extends StatelessWidget {
@override @override
@ -14,12 +16,39 @@ class MonthPage extends StatelessWidget {
onModelReady: (model) => model.getUserProgressForMonthData(), onModelReady: (model) => model.getUserProgressForMonthData(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
appBarTitle: "Water Tracker", appBarTitle: TranslationBase.of(context).h2o,
baseViewModel:model , baseViewModel: model,
body: SingleChildScrollView( body: Padding(
padding: EdgeInsets.symmetric(vertical: 12), padding: EdgeInsets.all(8.0),
child: AppBarChart( child: ListView(
seriesList: model.userProgressForMonthDataSeries), children: [
Center(
child: Text(
TranslationBase.of(context).waterConsumedInMonth,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0, color: Colors.black87),
),
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 10,
width: 40,
color: Colors.blue,
),
SizedBox(width: 8),
Text(
TranslationBase.of(context).waterConsumedInMonth,
style: TextStyle(fontSize: 12.0),
),
],
),
// SizedBox(height: 8),
AppBarChart(seriesList: model.userProgressForMonthDataSeries),
],
),
), ),
), ),
); );

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -14,7 +15,7 @@ class TodayPage extends StatelessWidget {
onModelReady: (model) => model.getUserProgressForTodayData(), onModelReady: (model) => model.getUserProgressForTodayData(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
appBarTitle: "Water Tracker", appBarTitle: TranslationBase.of(context).h2o,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 12), padding: EdgeInsets.symmetric(vertical: 12),
@ -36,13 +37,14 @@ class TodayPage extends StatelessWidget {
//, //,
center: Center( center: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
children: [ children: [
SizedBox( // SizedBox(
height: 40, // height: 40,
), // ),
Text( Text(
"Consumed", TranslationBase.of(context).consumed,
style: TextStyle(fontSize: 20.0), style: TextStyle(fontSize: 16.0),
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -50,13 +52,8 @@ class TodayPage extends StatelessWidget {
Text( Text(
model.userProgressData == null model.userProgressData == null
? "0.0" ? "0.0"
: model.userProgressData.quantityConsumed : model.userProgressData.quantityConsumed.toString() + TranslationBase.of(context).ml,
.toString() + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")),
'ml',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
color: HexColor("#60BCF9")),
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -70,8 +67,8 @@ class TodayPage extends StatelessWidget {
height: 4, height: 4,
), ),
Text( Text(
"Remaining", TranslationBase.of(context).remaining,
style: TextStyle(fontSize: 20.0), style: TextStyle(fontSize: 16.0),
), ),
SizedBox( SizedBox(
height: 4, height: 4,
@ -79,18 +76,11 @@ class TodayPage extends StatelessWidget {
Text( Text(
model.userProgressData == null model.userProgressData == null
? "0.0" ? "0.0"
: (model.userProgressData.quantityLimit - : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed) < 0
model.userProgressData ? "0 ${TranslationBase.of(context).ml}"
.quantityConsumed) < : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed).toString() +
0 ' ${TranslationBase.of(context).ml}',
? "0 ml" style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0),
: (model.userProgressData.quantityLimit -
model.userProgressData
.quantityConsumed)
.toString() +
' ml',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 18.0),
), ),
], ],
), ),
@ -104,42 +94,32 @@ class TodayPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Center( Container(
child: Container( margin: EdgeInsets.only(bottom: 16),
margin: EdgeInsets.only(left: 20), height: 30,
height: 30, width: 70,
width: 70, decoration: BoxDecoration(color: HexColor("#D1E3F6"), borderRadius: BorderRadius.all(Radius.circular(30))),
decoration: BoxDecoration(
color: HexColor("#D1E3F6"),
borderRadius:
BorderRadius.all(Radius.circular(30))),
),
), ),
Text( Text(
"Remaining % ", "${TranslationBase.of(context).remaining} %",
style: TextStyle(fontSize: 20.0), style: TextStyle(fontSize: 16.0),
) )
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Center( Container(
child: Container( margin: EdgeInsets.only(bottom: 16),
margin: EdgeInsets.only(left: 20), height: 30,
height: 30, width: 70,
width: 70, decoration: BoxDecoration(color: HexColor("#60BCF9"), borderRadius: BorderRadius.all(Radius.circular(30))),
decoration: BoxDecoration(
color: HexColor("#60BCF9"),
borderRadius:
BorderRadius.all(Radius.circular(30))),
),
), ),
Text( Text(
"Consumed % ", "${TranslationBase.of(context).consumed} %",
style: TextStyle(fontSize: 20.0), style: TextStyle(fontSize: 16.0),
) )
], ],
) )

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart';
import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -15,16 +16,41 @@ class WeekPage extends StatelessWidget {
onModelReady: (model) => model.getUserProgressForWeekData(), onModelReady: (model) => model.getUserProgressForWeekData(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
appBarTitle: "Water Tracker", appBarTitle: TranslationBase.of(context).h2o,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: Padding(
padding: EdgeInsets.symmetric(vertical: 12), padding: EdgeInsets.all(8.0),
child: AppBarChart(seriesList: model.userProgressForWeekDataSeries), child: ListView(
children: [
Center(
child: Text(
TranslationBase.of(context).waterConsumedInWeek,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0, color: Colors.black87),
),
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 10,
width: 40,
color: Colors.blue,
),
SizedBox(width: 8),
Text(
TranslationBase.of(context).waterConsumedInWeek,
style: TextStyle(fontSize: 12.0),
),
],
),
// SizedBox(height: 8),
AppBarChart(seriesList: model.userProgressForWeekDataSeries),
],
),
), ),
), ),
); );
} }
} }

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -12,13 +13,7 @@ import 'package:flutter/material.dart';
import '../add_custom_amount.dart'; import '../add_custom_amount.dart';
class H20FloatingActionButton extends StatefulWidget { class H20FloatingActionButton extends StatefulWidget {
const H20FloatingActionButton({ const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key);
Key key,
@required AnimationController controller,
@required this.model
}) :
super(key: key);
final H2OViewModel model; final H2OViewModel model;
@ -26,7 +21,7 @@ class H20FloatingActionButton extends StatefulWidget {
_H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState();
} }
class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with TickerProviderStateMixin { class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with TickerProviderStateMixin {
AnimationController _controller; AnimationController _controller;
@override @override
void initState() { void initState() {
@ -37,15 +32,20 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
super.initState(); super.initState();
} }
void showConfirmMessage(int amount, H2OViewModel model) {
showDialog(
context: context,
child: ConfirmAddAmountDialog(
model: model,
amount: amount,
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
void showConfirmMessage(int amount, H2OViewModel model) {
showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,));
}
return Container( return Container(
margin: EdgeInsets.only(left: 20), margin: EdgeInsets.only(left: 20, right: 20),
child: new Column(mainAxisSize: MainAxisSize.min, children: [ child: new Column(mainAxisSize: MainAxisSize.min, children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -55,21 +55,21 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
children: [ children: [
ActionButton( ActionButton(
controller: _controller, controller: _controller,
text: "600ml", text: "600${TranslationBase.of(context).ml}",
onTap: () { onTap: () {
showConfirmMessage(600, widget.model); showConfirmMessage(600, widget.model);
}, },
), ),
ActionButton( ActionButton(
controller: _controller, controller: _controller,
text: "330ml", text: "330${TranslationBase.of(context).ml}",
onTap: () { onTap: () {
showConfirmMessage(330, widget.model); showConfirmMessage(330, widget.model);
}, },
), ),
ActionButton( ActionButton(
controller: _controller, controller: _controller,
text: "200ml", text: "200${TranslationBase.of(context).ml}",
onTap: () { onTap: () {
showConfirmMessage(200, widget.model); showConfirmMessage(200, widget.model);
}, },
@ -87,11 +87,9 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
animation: _controller, animation: _controller,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new Transform( return new Transform(
transform: new Matrix4.rotationZ( transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi),
_controller.value * 0.5 * math.pi),
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new Icon( child: new Icon(_controller.isDismissed ? Icons.add : Icons.close),
_controller.isDismissed ? Icons.add : Icons.close),
); );
}, },
), ),
@ -104,21 +102,21 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
}, },
), ),
new Container( new Container(
margin: EdgeInsets.only(left: 8, bottom: 4),
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
child: new ScaleTransition( child: new ScaleTransition(
scale: new CurvedAnimation( scale: new CurvedAnimation(
parent: _controller, parent: _controller,
curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut),
curve: Curves.easeOut),
), ),
child: new FloatingActionButton( child: new FloatingActionButton(
backgroundColor: Colors.white, backgroundColor: Colors.white,
heroTag: null, heroTag: null,
mini: true, // mini: true,
child: Text( child: Text(
"Custom", TranslationBase.of(context).custom,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.0, color: Colors.grey), style: TextStyle(fontSize: 12, color: Colors.grey),
), ),
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -134,23 +132,23 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
), ),
), ),
new Container( new Container(
margin: EdgeInsets.only(left: 8, bottom: 4),
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
child: new ScaleTransition( child: new ScaleTransition(
scale: new CurvedAnimation( scale: new CurvedAnimation(
parent: _controller, parent: _controller,
curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut),
curve: Curves.easeOut),
), ),
child: new FloatingActionButton( child: new FloatingActionButton(
backgroundColor: Colors.white, backgroundColor: Colors.white,
heroTag: null, heroTag: null,
mini: true, //mini: true,
child: Text( child: Text(
"Undo", TranslationBase.of(context).undo,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.0, color: Colors.grey), style: TextStyle(fontSize: 12.0, color: Colors.grey),
), ),
onPressed: () {}, onPressed: undoVolume,
), ),
), ),
), ),
@ -159,14 +157,16 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
]), ]),
); );
} }
void undoVolume() async {
GifLoaderDialogUtils.showMyDialog(context);
await widget.model.undoUserActivity();
GifLoaderDialogUtils.hideDialog(context);
}
} }
class ActionButton extends StatelessWidget { class ActionButton extends StatelessWidget {
const ActionButton( const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap})
{Key key,
@required AnimationController controller,
@required this.text,
this.onTap})
: _controller = controller, : _controller = controller,
super(key: key); super(key: key);
@ -177,6 +177,7 @@ class ActionButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.only(left: 4, bottom: 8),
alignment: FractionalOffset.topCenter, alignment: FractionalOffset.topCenter,
child: new ScaleTransition( child: new ScaleTransition(
scale: new CurvedAnimation( scale: new CurvedAnimation(
@ -184,16 +185,15 @@ class ActionButton extends StatelessWidget {
curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut),
), ),
child: new FloatingActionButton( child: new FloatingActionButton(
heroTag: null, heroTag: null,
backgroundColor: Colors.white, backgroundColor: Colors.white,
mini: true, //mini: true,
child: Text( child: Text(
text, text,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.0, color: Colors.grey), style: TextStyle(fontSize: 12.0, color: Colors.grey),
), ),
onPressed: onTap onPressed: onTap),
),
), ),
); );
} }

File diff suppressed because it is too large Load Diff

@ -13,30 +13,38 @@ class AppBarChart extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: 400, height: 400,
margin: EdgeInsets.only(top: 60), //margin: EdgeInsets.only(top: 60),
child: charts.BarChart( child: charts.BarChart(
seriesList, seriesList,
// animate: animate, // animate: animate,
domainAxis: charts.OrdinalAxisSpec(
renderSpec: charts.GridlineRendererSpec(
labelAnchor: charts.TickLabelAnchor.after,
labelRotation: -30,
labelOffsetFromAxisPx: 30,
labelOffsetFromTickPx: 15,
labelJustification: charts.TickLabelJustification.inside,
),
),
/// Customize the primary measure axis using a small tick renderer. /// Customize the primary measure axis using a small tick renderer.
/// Use String instead of num for ordinal domain axis /// Use String instead of num for ordinal domain axis
/// (typically bar charts). /// (typically bar charts).
primaryMeasureAxis: new charts.NumericAxisSpec( primaryMeasureAxis: new charts.NumericAxisSpec(
renderSpec: new charts.GridlineRendererSpec( renderSpec: new charts.GridlineRendererSpec(
// Display the measure axis labels below the gridline. // Display the measure axis labels below the gridline.
// //
// 'Before' & 'after' follow the axis value direction. // 'Before' & 'after' follow the axis value direction.
// Vertical axes draw 'before' below & 'after' above the tick. // Vertical axes draw 'before' below & 'after' above the tick.
// Horizontal axes draw 'before' left & 'after' right the tick. // Horizontal axes draw 'before' left & 'after' right the tick.
labelAnchor: charts.TickLabelAnchor.before, labelAnchor: charts.TickLabelAnchor.before,
// Left justify the text in the axis. // Left justify the text in the axis.
// //
// Note: outside means that the secondary measure axis would right // Note: outside means that the secondary measure axis would right
// justify. // justify.
labelJustification: labelJustification: charts.TickLabelJustification.outside,
charts.TickLabelJustification.outside, )),
)),
), ),
); );
} }

@ -44,78 +44,89 @@ class AppScaffold extends StatelessWidget {
final List<String> infoList; final List<String> infoList;
final Color backgroundColor; final Color backgroundColor;
final double preferredSize; final double preferredSize;
final bool showHomeAppBarIcon;
final List<Widget> appBarIcons; final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo; final List<ImagesInfo> imagesInfo;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
this.appBarTitle = '', this.appBarTitle = '',
this.isLoading = false, this.isLoading = false,
this.isShowAppBar = false, this.isShowAppBar = false,
this.hasAppBarParam, this.hasAppBarParam,
this.bottomSheet, this.bottomSheet,
this.baseViewModel, this.baseViewModel,
this.floatingActionButton, this.floatingActionButton,
this.isPharmacy = false, this.isPharmacy = false,
this.title, this.title,
this.description, this.description,
this.isShowDecPage = true, this.isShowDecPage = true,
this.isBottomBar, this.isBottomBar,
this.backgroundColor, this.backgroundColor,
this.preferredSize = 0.0, this.preferredSize = 0.0,
this.appBarIcons, this.showHomeAppBarIcon = true,
this.infoList, this.imagesInfo}); this.appBarIcons,
this.infoList,
this.imagesInfo});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.context = context; AppGlobal.context = context;
return Scaffold( return Scaffold(
backgroundColor: backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar? AppBarWidget( appBar: isShowAppBar
appBarTitle:appBarTitle, ? AppBarWidget(
appBarIcons:appBarIcons, appBarTitle: appBarTitle,
isPharmacy: isPharmacy, appBarIcons: appBarIcons,
isShowDecPage: isShowDecPage, showHomeAppBarIcon: showHomeAppBarIcon,
):null, isPharmacy: isPharmacy,
isShowDecPage: isShowDecPage,
)
: null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage) isShowDecPage)
? NotAutPage( ? NotAutPage(
title: title ?? appBarTitle, title: title ?? appBarTitle,
description: description, description: description,
infoList: infoList, infoList: infoList,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
) )
: baseViewModel != null : baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: body, child: body,
baseViewModel: baseViewModel, baseViewModel: baseViewModel,
) )
: body, : body,
floatingActionButton: floatingActionButton,
); );
} }
buildAppLoaderWidget(bool isLoading) { buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container(); return isLoading ? AppLoaderWidget() : Container();
} }
} }
class AppBarWidget extends StatelessWidget with PreferredSizeWidget { class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject = final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
final String appBarTitle; final String appBarTitle;
final bool showHomeAppBarIcon;
final List<Widget> appBarIcons; final List<Widget> appBarIcons;
final bool isPharmacy; final bool isPharmacy;
final bool isShowDecPage; final bool isShowDecPage;
AppBarWidget({this.appBarTitle, this.appBarIcons, AppBarWidget(
this.isPharmacy = true, this.isShowDecPage = true}); {this.appBarTitle,
this.showHomeAppBarIcon,
this.appBarIcons,
this.isPharmacy = true,
this.isShowDecPage = true});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -127,10 +138,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
return AppBar( return AppBar(
elevation: 0, elevation: 0,
backgroundColor: backgroundColor:
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme( textTheme: TextTheme(
headline6: headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
), ),
title: Text( title: Text(
authenticatedUserObject.isLogin || !isShowDecPage authenticatedUserObject.isLogin || !isShowDecPage
@ -139,8 +149,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
fontFamily: fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return ArrowBack(); return ArrowBack();
@ -150,27 +159,25 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
actions: <Widget>[ actions: <Widget>[
isPharmacy isPharmacy
? IconButton( ? IconButton(
icon: Icon(Icons.shopping_cart), icon: Icon(Icons.shopping_cart),
color: Colors.white,
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
})
: Container(),
if (showHomeAppBarIcon)
IconButton(
icon: Icon(FontAwesomeIcons.home),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.pushAndRemoveUntil(
.popUntil(ModalRoute.withName('/')); context,
}) MaterialPageRoute(builder: (context) => LandingPage()),
: Container(), (Route<dynamic> r) => false);
IconButton( },
icon: Icon(FontAwesomeIcons.home), ),
color: Colors.white,
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
},
),
if (appBarIcons != null) ...appBarIcons if (appBarIcons != null) ...appBarIcons
], ],
); );
} }

Loading…
Cancel
Save