Merge branch 'h2o_improvement' into 'development'

H2o improvement

See merge request Cloud_Solution/diplomatic-quarter!259
merge-requests/260/merge
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';
// 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_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity";
const H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity";
//E_Referral Services
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/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_today_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<UserProgressForWeekDataModel> userProgressForWeekDataList = 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 {
userProgressRequestModel.progress = 1;
@ -19,12 +79,10 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = user.patientIdentificationNo;
hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear();
response['UserProgressForTodayData'].forEach((progressData) {
userProgressForTodayDataList
.add(UserProgressForTodayDataModel.fromJson(progressData));
userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -38,16 +96,15 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = super.user.patientIdentificationNo;
hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS,
onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear();
response['UserProgressForWeekData'].forEach((hospital) {
userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: userProgressRequestModel.toJson());
await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
userProgressForWeekDataList.clear();
response['UserProgressForWeekData'].forEach((hospital) {
userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: userProgressRequestModel.toJson());
}
Future getUserProgressForMonthData() async {
@ -56,8 +113,7 @@ class H2OService extends BaseService {
userProgressRequestModel.identificationNo = super.user.patientIdentificationNo;
hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) {
userProgressForMonthDataList.clear();
response['UserProgressForMonthData'].forEach((hospital) {
userProgressForMonthDataList.add(UserProgressForMonthDataModel.fromJson(hospital));
@ -68,22 +124,33 @@ class H2OService extends BaseService {
}, body: userProgressRequestModel.toJson());
}
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;
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());
await baseAppClient.post(H2O_UNDO_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: userProgressRequestModel.toJson());
}
}

@ -1,26 +1,54 @@
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/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_today_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/viewModels/base_view_model.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../locator.dart';
class H2OViewModel extends BaseViewModel {
H2OService _h2OService = locator<H2OService>();
List<charts.Series> userProgressForWeekDataSeries;
List<charts.Series> userProgressForMonthDataSeries;
UserDetailModel get userDetail => _h2OService.userDetailModel;
UserProgressForTodayDataModel get userProgressData {
if (_h2OService.userProgressForTodayDataList.length != 0)
return _h2OService.userProgressForTodayDataList[0];
return null;
if (_h2OService.userProgressForTodayDataList.length != 0) return _h2OService.userProgressForTodayDataList[0];
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 {
// if(_h2OService.userProgressForTodayDataList.length==0){
@ -58,13 +86,9 @@ class H2OViewModel extends BaseViewModel {
}
}
List<charts.Series<ChartSeries,
String>> createUserProgressForWeekDataSeries() {
List<ChartSeries> globalData = [
];
_h2OService.userProgressForWeekDataList.forEach((
UserProgressForWeekDataModel data) {
List<charts.Series<ChartSeries, String>> createUserProgressForWeekDataSeries() {
List<ChartSeries> globalData = [];
_h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) {
globalData.add(new ChartSeries(data.dayName, data.percentageConsumed));
});
return [
@ -77,12 +101,9 @@ class H2OViewModel extends BaseViewModel {
];
}
List<charts.Series<ChartSeries,
String>> createUserProgressForMonthDataSeries() {
List<ChartSeries> globalData = [
];
_h2OService.userProgressForMonthDataList.forEach((
UserProgressForMonthDataModel data) {
List<charts.Series<ChartSeries, String>> createUserProgressForMonthDataSeries() {
List<ChartSeries> globalData = [];
_h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) {
globalData.add(new ChartSeries(data.monthName, data.percentageConsumed));
});
return [
@ -95,14 +116,10 @@ class H2OViewModel extends BaseViewModel {
];
}
Future insertUserActivity(
InsertUserActivityRequestModel insertUserActivityRequestModel) async {
Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async {
setState(ViewState.BusyLocal);
insertUserActivityRequestModel.mobileNumber =
user.mobileNumber.substring(1);
insertUserActivityRequestModel.identificationNo =
user.patientIdentificationNo;
insertUserActivityRequestModel.mobileNumber = user.mobileNumber.substring(1);
insertUserActivityRequestModel.identificationNo = user.patientIdentificationNo;
await _h2OService.insertUserActivity(insertUserActivityRequestModel);
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.
class ChartSeries {
final String y;

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

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

@ -12,9 +12,7 @@ class ConfirmAddAmountDialog extends StatefulWidget {
final String unit;
final H2OViewModel model;
ConfirmAddAmountDialog(
{Key key, this.model,this.amount,this.unit ="ml"});
ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"});
@override
_ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState();
@ -29,10 +27,12 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
@override
Widget build(BuildContext context) {
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(
child: Texts(
"Confirm",
TranslationBase.of(context).confirm,
textAlign: TextAlign.center,
color: Colors.black,
),
),
@ -42,12 +42,13 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
Divider(),
Center(
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,
),
),
SizedBox(
height: 5.0,
height: 16.0,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -79,8 +80,8 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
Expanded(
flex: 1,
child: InkWell(
onTap: () async{
InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount );
onTap: () async {
InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount);
await widget.model.insertUserActivity(insertUserActivityRequestModel);
Navigator.pop(context);
},
@ -88,20 +89,17 @@ class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
)),
TranslationBase.of(context).ok.toUpperCase(),
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/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
@ -5,25 +7,32 @@ import 'package:flutter/material.dart';
// ignore: must_be_immutable
class SelectAmountDialog extends StatefulWidget {
List<AmountModel> searchAmount = [
AmountModel(name: "l",nameAr:"لتر",value: 1),
AmountModel(name: "ml",nameAr:"مم لتر",value: 2),
];
final Function(AmountModel) onValueSelected;
AmountModel selectedAmount;
SelectAmountDialog(
{Key key, this.onValueSelected, this.selectedAmount});
SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount});
@override
_SelectAmountDialogState createState() => _SelectAmountDialogState();
}
class _SelectAmountDialogState extends State<SelectAmountDialog> {
List<AmountModel> searchAmount = [
AmountModel(name: "l", nameAr: "لتر", value: 1),
AmountModel(name: "ml", nameAr: "مم لتر", value: 2),
];
@override
void 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
@ -32,11 +41,14 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
children: [
Column(
children: [
Texts("Select the preferred unit", fontSize: 20,),
Texts(
TranslationBase.of(context).preferredunit,
fontSize: 20,
),
Divider(),
...List.generate(
widget.searchAmount.length,
(index) => Column(
searchAmount.length,
(index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
@ -49,13 +61,13 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
child: InkWell(
onTap: () {
setState(() {
widget.selectedAmount = widget.searchAmount[index];
widget.selectedAmount = searchAmount[index];
});
},
child: ListTile(
title: Text(widget.searchAmount[index].name),
title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name),
leading: Radio(
value: widget.searchAmount[index],
value: searchAmount[index],
groupValue: widget.selectedAmount,
activeColor: Colors.red[800],
onChanged: (value) {
@ -116,9 +128,9 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
)),
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
)),
),
),
),
@ -130,6 +142,7 @@ class _SelectAmountDialogState extends State<SelectAmountDialog> {
);
}
}
class AmountModel {
String name;
String nameAr;
@ -151,7 +164,3 @@ class AmountModel {
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/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.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/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -36,7 +37,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: "Enter amount",
appBarTitle:TranslationBase.of(context).customLabel,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
@ -51,7 +52,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
height: 12,
),
NewTextFields(
hintText: "Enter the amount of water:",
hintText: TranslationBase.of(context).h2oAmountOfWater,
// type: "Number",
controller: _nameTextController,
),
@ -81,7 +82,7 @@ class _AddCustomAmountState extends State<AddCustomAmount> {
),
SecondaryButton(
textColor: Colors.white,
label: "OK",
label: TranslationBase.of(context).ok,
onTap: () async {
Navigator.of(context).pop();
showConfirmMessage (int.parse(_nameTextController.text), widget.model);
@ -120,7 +121,7 @@ void confirmAmountTypeDialog() {
if (selectedAmount != null)
return selectedAmount.name;
else
return "Select unit";
return TranslationBase.of(context).selectUnit;
}

@ -1,12 +1,15 @@
import 'dart:ui';
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/today_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.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/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -34,9 +37,26 @@ class _H2OPageState extends State<H2OPage>
@override
Widget build(BuildContext context) {
return BaseView<H2OViewModel>(
onModelReady: (model) => model.getUserDetail(),
builder: (_, model, widget) => AppScaffold(
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(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
@ -50,9 +70,7 @@ class _H2OPageState extends State<H2OPage>
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8),
height: 70.0,
),
),
@ -60,48 +78,46 @@ class _H2OPageState extends State<H2OPage>
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
alignment: Alignment.center,
// margin: EdgeInsets.only(top: 10.0),
// width: MediaQuery.of(context).size.width * 0.9,
child: Center(
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts(
"Today"),
),
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts(TranslationBase.of(context).today),
),
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts("Week"),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts(TranslationBase.of(context).week),
),
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts("Month"),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.28,
child: Center(
child: Texts(TranslationBase.of(context).month),
),
],
),
),
],
),
),
),
],
),
),
backgroundColor: Colors.white,
body: Column(
children: <Widget>[
Expanded(

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

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.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/errors/app_embedded_error.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -15,16 +16,41 @@ class WeekPage extends StatelessWidget {
onModelReady: (model) => model.getUserProgressForWeekData(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: false,
appBarTitle: "Water Tracker",
appBarTitle: TranslationBase.of(context).h2o,
baseViewModel: model,
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 12),
child: AppBarChart(seriesList: model.userProgressForWeekDataSeries),
body: Padding(
padding: EdgeInsets.all(8.0),
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/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.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/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -12,13 +13,7 @@ import 'package:flutter/material.dart';
import '../add_custom_amount.dart';
class H20FloatingActionButton extends StatefulWidget {
const H20FloatingActionButton({
Key key,
@required AnimationController controller,
@required this.model
}) :
super(key: key);
const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key);
final H2OViewModel model;
@ -26,7 +21,7 @@ class H20FloatingActionButton extends StatefulWidget {
_H20FloatingActionButtonState createState() => _H20FloatingActionButtonState();
}
class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with TickerProviderStateMixin {
class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with TickerProviderStateMixin {
AnimationController _controller;
@override
void initState() {
@ -37,15 +32,20 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
super.initState();
}
void showConfirmMessage(int amount, H2OViewModel model) {
showDialog(
context: context,
child: ConfirmAddAmountDialog(
model: model,
amount: amount,
),
);
}
@override
Widget build(BuildContext context) {
void showConfirmMessage(int amount, H2OViewModel model) {
showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,));
}
return Container(
margin: EdgeInsets.only(left: 20),
margin: EdgeInsets.only(left: 20, right: 20),
child: new Column(mainAxisSize: MainAxisSize.min, children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
@ -55,21 +55,21 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
children: [
ActionButton(
controller: _controller,
text: "600ml",
text: "600${TranslationBase.of(context).ml}",
onTap: () {
showConfirmMessage(600, widget.model);
},
),
ActionButton(
controller: _controller,
text: "330ml",
text: "330${TranslationBase.of(context).ml}",
onTap: () {
showConfirmMessage(330, widget.model);
},
),
ActionButton(
controller: _controller,
text: "200ml",
text: "200${TranslationBase.of(context).ml}",
onTap: () {
showConfirmMessage(200, widget.model);
},
@ -87,11 +87,9 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
animation: _controller,
builder: (BuildContext context, Widget child) {
return new Transform(
transform: new Matrix4.rotationZ(
_controller.value * 0.5 * math.pi),
transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi),
alignment: FractionalOffset.center,
child: new Icon(
_controller.isDismissed ? Icons.add : Icons.close),
child: new Icon(_controller.isDismissed ? Icons.add : Icons.close),
);
},
),
@ -104,21 +102,21 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
},
),
new Container(
margin: EdgeInsets.only(left: 8, bottom: 4),
alignment: FractionalOffset.topCenter,
child: new ScaleTransition(
scale: new CurvedAnimation(
parent: _controller,
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(
backgroundColor: Colors.white,
heroTag: null,
mini: true,
// mini: true,
child: Text(
"Custom",
TranslationBase.of(context).custom,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.0, color: Colors.grey),
style: TextStyle(fontSize: 12, color: Colors.grey),
),
onPressed: () {
Navigator.push(
@ -134,23 +132,23 @@ class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with
),
),
new Container(
margin: EdgeInsets.only(left: 8, bottom: 4),
alignment: FractionalOffset.topCenter,
child: new ScaleTransition(
scale: new CurvedAnimation(
parent: _controller,
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(
backgroundColor: Colors.white,
heroTag: null,
mini: true,
//mini: true,
child: Text(
"Undo",
TranslationBase.of(context).undo,
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 {
const ActionButton(
{Key key,
@required AnimationController controller,
@required this.text,
this.onTap})
const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap})
: _controller = controller,
super(key: key);
@ -177,6 +177,7 @@ class ActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 4, bottom: 8),
alignment: FractionalOffset.topCenter,
child: new ScaleTransition(
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),
),
child: new FloatingActionButton(
heroTag: null,
backgroundColor: Colors.white,
mini: true,
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.0, color: Colors.grey),
),
onPressed: onTap
),
heroTag: null,
backgroundColor: Colors.white,
//mini: true,
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12.0, color: Colors.grey),
),
onPressed: onTap),
),
);
}

File diff suppressed because it is too large Load Diff

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

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

Loading…
Cancel
Save