Merge branch 'master' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into my_trackers
Conflicts: lib/pages/landing/home_page.dartmerge-update-with-lab-changes
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
class List_BabyInformationModel {
|
||||
int alertBy;
|
||||
int babyID;
|
||||
String babyName;
|
||||
DateTime dOB;
|
||||
int gender;
|
||||
String genderDescription;
|
||||
int patientID;
|
||||
int userID;
|
||||
|
||||
List_BabyInformationModel(
|
||||
{this.alertBy,
|
||||
this.babyID,
|
||||
this.babyName,
|
||||
this.dOB,
|
||||
this.gender,
|
||||
this.genderDescription,
|
||||
this.patientID,
|
||||
this.userID});
|
||||
|
||||
List_BabyInformationModel.fromJson(Map<String, dynamic> json) {
|
||||
alertBy = json['AlertBy'];
|
||||
babyID = json['BabyID'];
|
||||
babyName = json['BabyName'];
|
||||
dOB = DateUtil.convertStringToDate(json['DOB']);
|
||||
gender = json['Gender'];
|
||||
genderDescription = json['GenderDescription'];
|
||||
patientID = json['PatientID'];
|
||||
userID = json['UserID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['AlertBy'] = this.alertBy;
|
||||
data['BabyID'] = this.babyID;
|
||||
data['BabyName'] = this.babyName;
|
||||
data['DOB'] = this.dOB;
|
||||
data['Gender'] = this.gender;
|
||||
data['GenderDescription'] = this.genderDescription;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['UserID'] = this.userID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
class CreateNewBaby {
|
||||
String babyName;
|
||||
String gender;
|
||||
String strDOB;
|
||||
int editedBy;
|
||||
int createdBy;
|
||||
bool tempValue;
|
||||
int userID;
|
||||
bool isLogin;
|
||||
int alertBy;
|
||||
double versionID;
|
||||
int channel;
|
||||
int languageID;
|
||||
String iPAdress;
|
||||
String generalid;
|
||||
int patientOutSA;
|
||||
String sessionID;
|
||||
bool isDentalAllowedBackend;
|
||||
int deviceTypeID;
|
||||
int patientID;
|
||||
String tokenID;
|
||||
int patientTypeID;
|
||||
int patientType;
|
||||
|
||||
CreateNewBaby(
|
||||
{this.babyName,
|
||||
this.gender,
|
||||
this.strDOB,
|
||||
this.editedBy,
|
||||
this.createdBy,
|
||||
this.tempValue,
|
||||
this.userID,
|
||||
this.isLogin,
|
||||
this.alertBy,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.patientID,
|
||||
this.tokenID,
|
||||
this.patientTypeID,
|
||||
this.patientType});
|
||||
|
||||
CreateNewBaby.fromJson(Map<String, dynamic> json) {
|
||||
babyName = json['BabyName'];
|
||||
gender = json['Gender'];
|
||||
strDOB = json['StrDOB'];
|
||||
editedBy = json['EditedBy'];
|
||||
createdBy = json['CreatedBy'];
|
||||
tempValue = json['TempValue'];
|
||||
userID = json['UserID'];
|
||||
isLogin = json['IsLogin'];
|
||||
alertBy = json['AlertBy'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
patientID = json['PatientID'];
|
||||
tokenID = json['TokenID'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
patientType = json['PatientType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['BabyName'] = this.babyName;
|
||||
data['Gender'] = this.gender;
|
||||
data['StrDOB'] = this.strDOB;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['TempValue'] = this.tempValue;
|
||||
data['UserID'] = this.userID;
|
||||
data['IsLogin'] = this.isLogin;
|
||||
data['AlertBy'] = this.alertBy;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
data['PatientType'] = this.patientType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
class CreateNewUser_New {
|
||||
Null date;
|
||||
int languageID;
|
||||
int serviceName;
|
||||
Null time;
|
||||
Null androidLink;
|
||||
Null authenticationTokenID;
|
||||
Null data;
|
||||
bool dataw;
|
||||
int dietType;
|
||||
Null errorCode;
|
||||
Null errorEndUserMessage;
|
||||
Null errorEndUserMessageN;
|
||||
Null errorMessage;
|
||||
int errorType;
|
||||
int foodCategory;
|
||||
Null iOSLink;
|
||||
bool isAuthenticated;
|
||||
int mealOrderStatus;
|
||||
int mealType;
|
||||
int messageStatus;
|
||||
int numberOfResultRecords;
|
||||
Null patientBlodType;
|
||||
Null successMsg;
|
||||
Null successMsgN;
|
||||
Null htmlResult;
|
||||
bool isHMGPatient;
|
||||
bool isRegister;
|
||||
bool isSendSMS;
|
||||
Null listBabyInformationModel;
|
||||
Null listBabyNeedReminderModel;
|
||||
Null listCreateVaccinationTableModel;
|
||||
Null listHisPatientModel;
|
||||
Null listUserInformationModel;
|
||||
Null listUserInformationModelNew;
|
||||
Null listVaccinationTableModel;
|
||||
Null tokinID;
|
||||
int userID;
|
||||
Null verificationCode;
|
||||
|
||||
CreateNewUser_New(
|
||||
{this.date,
|
||||
this.languageID,
|
||||
this.serviceName,
|
||||
this.time,
|
||||
this.androidLink,
|
||||
this.authenticationTokenID,
|
||||
this.data,
|
||||
this.dataw,
|
||||
this.dietType,
|
||||
this.errorCode,
|
||||
this.errorEndUserMessage,
|
||||
this.errorEndUserMessageN,
|
||||
this.errorMessage,
|
||||
this.errorType,
|
||||
this.foodCategory,
|
||||
this.iOSLink,
|
||||
this.isAuthenticated,
|
||||
this.mealOrderStatus,
|
||||
this.mealType,
|
||||
this.messageStatus,
|
||||
this.numberOfResultRecords,
|
||||
this.patientBlodType,
|
||||
this.successMsg,
|
||||
this.successMsgN,
|
||||
this.htmlResult,
|
||||
this.isHMGPatient,
|
||||
this.isRegister,
|
||||
this.isSendSMS,
|
||||
this.listBabyInformationModel,
|
||||
this.listBabyNeedReminderModel,
|
||||
this.listCreateVaccinationTableModel,
|
||||
this.listHisPatientModel,
|
||||
this.listUserInformationModel,
|
||||
this.listUserInformationModelNew,
|
||||
this.listVaccinationTableModel,
|
||||
this.tokinID,
|
||||
this.userID,
|
||||
this.verificationCode});
|
||||
|
||||
CreateNewUser_New.fromJson(Map<String, dynamic> json) {
|
||||
date = json['Date'];
|
||||
languageID = json['LanguageID'];
|
||||
serviceName = json['ServiceName'];
|
||||
time = json['Time'];
|
||||
androidLink = json['AndroidLink'];
|
||||
authenticationTokenID = json['AuthenticationTokenID'];
|
||||
data = json['Data'];
|
||||
dataw = json['Dataw'];
|
||||
dietType = json['DietType'];
|
||||
errorCode = json['ErrorCode'];
|
||||
errorEndUserMessage = json['ErrorEndUserMessage'];
|
||||
errorEndUserMessageN = json['ErrorEndUserMessageN'];
|
||||
errorMessage = json['ErrorMessage'];
|
||||
errorType = json['ErrorType'];
|
||||
foodCategory = json['FoodCategory'];
|
||||
iOSLink = json['IOSLink'];
|
||||
isAuthenticated = json['IsAuthenticated'];
|
||||
mealOrderStatus = json['MealOrderStatus'];
|
||||
mealType = json['MealType'];
|
||||
messageStatus = json['MessageStatus'];
|
||||
numberOfResultRecords = json['NumberOfResultRecords'];
|
||||
patientBlodType = json['PatientBlodType'];
|
||||
successMsg = json['SuccessMsg'];
|
||||
successMsgN = json['SuccessMsgN'];
|
||||
htmlResult = json['HtmlResult'];
|
||||
isHMGPatient = json['IsHMGPatient'];
|
||||
isRegister = json['IsRegister'];
|
||||
isSendSMS = json['IsSendSMS'];
|
||||
listBabyInformationModel = json['List_BabyInformationModel'];
|
||||
listBabyNeedReminderModel = json['List_BabyNeedReminderModel'];
|
||||
listCreateVaccinationTableModel = json['List_CreateVaccinationTableModel'];
|
||||
listHisPatientModel = json['List_His_PatientModel'];
|
||||
listUserInformationModel = json['List_UserInformationModel'];
|
||||
listUserInformationModelNew = json['List_UserInformationModel_New'];
|
||||
listVaccinationTableModel = json['List_VaccinationTableModel'];
|
||||
tokinID = json['TokinID'];
|
||||
userID = json['UserID'];
|
||||
verificationCode = json['VerificationCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Date'] = this.date;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['ServiceName'] = this.serviceName;
|
||||
data['Time'] = this.time;
|
||||
data['AndroidLink'] = this.androidLink;
|
||||
data['AuthenticationTokenID'] = this.authenticationTokenID;
|
||||
data['Data'] = this.data;
|
||||
data['Dataw'] = this.dataw;
|
||||
data['DietType'] = this.dietType;
|
||||
data['ErrorCode'] = this.errorCode;
|
||||
data['ErrorEndUserMessage'] = this.errorEndUserMessage;
|
||||
data['ErrorEndUserMessageN'] = this.errorEndUserMessageN;
|
||||
data['ErrorMessage'] = this.errorMessage;
|
||||
data['ErrorType'] = this.errorType;
|
||||
data['FoodCategory'] = this.foodCategory;
|
||||
data['IOSLink'] = this.iOSLink;
|
||||
data['IsAuthenticated'] = this.isAuthenticated;
|
||||
data['MealOrderStatus'] = this.mealOrderStatus;
|
||||
data['MealType'] = this.mealType;
|
||||
data['MessageStatus'] = this.messageStatus;
|
||||
data['NumberOfResultRecords'] = this.numberOfResultRecords;
|
||||
data['PatientBlodType'] = this.patientBlodType;
|
||||
data['SuccessMsg'] = this.successMsg;
|
||||
data['SuccessMsgN'] = this.successMsgN;
|
||||
data['HtmlResult'] = this.htmlResult;
|
||||
data['IsHMGPatient'] = this.isHMGPatient;
|
||||
data['IsRegister'] = this.isRegister;
|
||||
data['IsSendSMS'] = this.isSendSMS;
|
||||
data['List_BabyInformationModel'] = this.listBabyInformationModel;
|
||||
data['List_BabyNeedReminderModel'] = this.listBabyNeedReminderModel;
|
||||
data['List_CreateVaccinationTableModel'] =
|
||||
this.listCreateVaccinationTableModel;
|
||||
data['List_His_PatientModel'] = this.listHisPatientModel;
|
||||
data['List_UserInformationModel'] = this.listUserInformationModel;
|
||||
data['List_UserInformationModel_New'] = this.listUserInformationModelNew;
|
||||
data['List_VaccinationTableModel'] = this.listVaccinationTableModel;
|
||||
data['TokinID'] = this.tokinID;
|
||||
data['UserID'] = this.userID;
|
||||
data['VerificationCode'] = this.verificationCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
class CreateVaccinationTable {
|
||||
String givenAt;
|
||||
String status;
|
||||
String vaccinesDescription;
|
||||
String visit;
|
||||
|
||||
CreateVaccinationTable(
|
||||
{this.givenAt, this.status, this.vaccinesDescription, this.visit});
|
||||
|
||||
CreateVaccinationTable.fromJson(Map<String, dynamic> json) {
|
||||
givenAt = json['GivenAt'];
|
||||
status = json['Status'];
|
||||
vaccinesDescription = json['VaccinesDescription'];
|
||||
visit = json['Visit'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['GivenAt'] = this.givenAt;
|
||||
data['Status'] = this.status;
|
||||
data['VaccinesDescription'] = this.vaccinesDescription;
|
||||
data['Visit'] = this.visit;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
class DeleteBaby {
|
||||
bool isLogin;
|
||||
int babyID;
|
||||
int editedBy;
|
||||
double versionID;
|
||||
int channel;
|
||||
int languageID;
|
||||
String iPAdress;
|
||||
String generalid;
|
||||
int patientOutSA;
|
||||
String sessionID;
|
||||
bool isDentalAllowedBackend;
|
||||
int deviceTypeID;
|
||||
int patientID;
|
||||
String tokenID;
|
||||
int patientTypeID;
|
||||
int patientType;
|
||||
|
||||
DeleteBaby(
|
||||
{this.isLogin,
|
||||
this.babyID,
|
||||
this.editedBy,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.patientID,
|
||||
this.tokenID,
|
||||
this.patientTypeID,
|
||||
this.patientType});
|
||||
|
||||
DeleteBaby.fromJson(Map<String, dynamic> json) {
|
||||
isLogin = json['IsLogin'];
|
||||
babyID = json['BabyID'];
|
||||
editedBy = json['EditedBy'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
patientID = json['PatientID'];
|
||||
tokenID = json['TokenID'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
patientType = json['PatientType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['IsLogin'] = this.isLogin;
|
||||
data['BabyID'] = this.babyID;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
data['PatientType'] = this.patientType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
class GET_VACCINATIONS_ITEMSMODEL {
|
||||
String dESCRIPTION;
|
||||
String iTEMCODE;
|
||||
|
||||
GET_VACCINATIONS_ITEMSMODEL({this.dESCRIPTION, this.iTEMCODE});
|
||||
|
||||
GET_VACCINATIONS_ITEMSMODEL.fromJson(Map<String, dynamic> json) {
|
||||
dESCRIPTION = json['DESCRIPTION'];
|
||||
iTEMCODE = json['ITEM_CODE'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DESCRIPTION'] = this.dESCRIPTION;
|
||||
data['ITEM_CODE'] = this.iTEMCODE;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
class List_UserInformationModel {
|
||||
int userID;
|
||||
String mobileNumber;
|
||||
String nationalID;
|
||||
String emailAddress;
|
||||
int patientID;
|
||||
int patientType;
|
||||
bool patientOutSA;
|
||||
int createdBy;
|
||||
int editedBy;
|
||||
|
||||
List_UserInformationModel(
|
||||
{this.userID,
|
||||
this.mobileNumber,
|
||||
this.nationalID,
|
||||
this.emailAddress,
|
||||
this.patientID,
|
||||
this.patientType,
|
||||
this.patientOutSA,
|
||||
this.createdBy,
|
||||
this.editedBy});
|
||||
|
||||
List_UserInformationModel.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['UserID'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
nationalID = json['NationalID'];
|
||||
emailAddress = json['EmailAddress'];
|
||||
patientID = json['PatientID'];
|
||||
patientType = json['PatientType'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
createdBy = json['CreatedBy'];
|
||||
editedBy = json['EditedBy'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['UserID'] = this.userID;
|
||||
data['MobileNumber'] = this.mobileNumber;
|
||||
data['NationalID'] = this.nationalID;
|
||||
data['EmailAddress'] = this.emailAddress;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import '../base_service.dart';
|
||||
|
||||
class CreteNewBabyService extends BaseService {
|
||||
List<CreateNewBaby> createNewBabyModelList = List();
|
||||
List<List_UserInformationModel> userModelList = List();
|
||||
List<CreateNewUser_New> newUserModelList = List();
|
||||
|
||||
|
||||
|
||||
Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async {
|
||||
hasError = false;
|
||||
await getUser();
|
||||
Map<String, dynamic> body = Map.from(newChild.toJson());
|
||||
body['CreatedBy'] = 102;
|
||||
body['EditedBy'] = 102;
|
||||
body['UserID'] = userID;
|
||||
body['AlertBy'] = 2;
|
||||
body['EmailAddress'] = user.emailAddress;
|
||||
body['IsLogin'] = true;
|
||||
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||
body['MobileNumber'] = user.mobileNumber;
|
||||
body['NationalID'] = user.nationalityID;
|
||||
body['ZipCode'] = user.zipCode;
|
||||
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
|
||||
await baseAppClient.post(GET_NEWCHILD_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
var asd ="";
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import '../base_service.dart';
|
||||
|
||||
class ChildVaccinesService extends BaseService {
|
||||
List<List_BabyInformationModel> babyInformationModelList = List();
|
||||
List<List_UserInformationModel> userInformationModelList = List();
|
||||
int userID = 0;
|
||||
|
||||
Future getAllBabyInformationOrders() async {
|
||||
Map<String, dynamic> body = Map();
|
||||
hasError = false;
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
body['IsLogin'] = true;
|
||||
body['UserID'] = userID;
|
||||
await baseAppClient.post(GET_BABY_BY_USER_ID,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
babyInformationModelList.clear();
|
||||
response['List_BabyInformationModel'].forEach((vital) {
|
||||
babyInformationModelList.add(List_BabyInformationModel.fromJson(vital));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
|
||||
Future getNewUserOrders() async {
|
||||
Map<String, dynamic> body = Map();
|
||||
hasError = false;
|
||||
await getUser();
|
||||
body['CreatedBy'] = 102;
|
||||
body['EditedBy'] = 102;
|
||||
body['UserID'] = userID;
|
||||
body['AlertBy'] = 2;
|
||||
body['EmailAddress'] = user.emailAddress;
|
||||
body['IsLogin'] = true;
|
||||
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||
body['MobileNumber'] = user.mobileNumber;
|
||||
body['NationalID'] = user.nationalityID;
|
||||
body['ZipCode'] = user.zipCode;
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
|
||||
await baseAppClient.post(GET_NEW_USER_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
userID = response['UserID'];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import '../base_service.dart';
|
||||
|
||||
|
||||
|
||||
class DeleteBabyService extends BaseService{
|
||||
|
||||
List<CreateNewBaby> createNewBabyModelList = List();
|
||||
List<List_UserInformationModel> userModelList = List();
|
||||
List<CreateNewUser_New> newUserModelList = List();
|
||||
|
||||
List<DeleteBaby> deleteBabyModelList= List();
|
||||
|
||||
|
||||
Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async {
|
||||
hasError = false;
|
||||
await getUser();
|
||||
Map<String, dynamic> body = Map.from(deleteChild.toJson());
|
||||
// body['CreatedBy'] = 102;
|
||||
body['EditedBy'] = 102;
|
||||
//body['BabyID'] = babyID;
|
||||
//body['BabyID'] = createNewBabyModelList ;
|
||||
// body['AlertBy'] = 2;
|
||||
// body['EmailAddress'] = user.emailAddress;
|
||||
body['IsLogin'] = true;
|
||||
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||
body['MobileNumber'] = user.mobileNumber;
|
||||
body['NationalID'] = user.nationalityID;
|
||||
body['ZipCode'] = user.zipCode;
|
||||
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
|
||||
await baseAppClient.post(DELETE_CHILD_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
var asd ="";
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
|
||||
// Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async {
|
||||
// hasError = false;
|
||||
// await getUser();
|
||||
// Map<String, dynamic> body = Map.from(newChild.toJson());
|
||||
// body['CreatedBy'] = 102;
|
||||
// body['EditedBy'] = 102;
|
||||
// body['UserID'] = userID;
|
||||
// body['AlertBy'] = 2;
|
||||
// body['EmailAddress'] = user.emailAddress;
|
||||
// body['IsLogin'] = true;
|
||||
// body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||
// body['MobileNumber'] = user.mobileNumber;
|
||||
// body['NationalID'] = user.nationalityID;
|
||||
// body['ZipCode'] = user.zipCode;
|
||||
//
|
||||
// body['isDentalAllowedBackend'] = false;
|
||||
//
|
||||
// await baseAppClient.post(GET_NEWCHILD_REQUEST,
|
||||
// onSuccess: (dynamic response, int statusCode) {
|
||||
// var asd ="";
|
||||
// },
|
||||
// onFailure: (String error, int statusCode) {
|
||||
// hasError = true;
|
||||
// super.error = error;
|
||||
// }, body: body);
|
||||
// }
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart';
|
||||
|
||||
import '../base_service.dart';
|
||||
|
||||
class GetVccinationsItemsService extends BaseService {
|
||||
List<GET_VACCINATIONS_ITEMSMODEL> getVaccinationsItemModelList = List();
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
|
||||
|
||||
Future getaccinationsitemOrders() async {
|
||||
hasError = false;
|
||||
await baseAppClient.post(GET_TABLE_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
getVaccinationsItemModelList.clear();
|
||||
response['List_CreateVaccinationTableModel'].forEach((vital) {
|
||||
getVaccinationsItemModelList.add(
|
||||
GET_VACCINATIONS_ITEMSMODEL.fromJson(vital));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import '../base_service.dart';
|
||||
|
||||
class UserInformationService extends BaseService {
|
||||
List<List_UserInformationModel> userInformationModelList = List();
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
Future getUserInformationOrders() async {
|
||||
hasError = false;
|
||||
await getUser();
|
||||
body['CreatedBy'] = 102;
|
||||
body['EditedBy'] = 102;
|
||||
body['EmailAddress'] = user.emailAddress;
|
||||
body['IsLogin'] = true;
|
||||
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
|
||||
body['MobileNumber'] = user.mobileNumber;
|
||||
body['NationalID'] = user.nationalityID;
|
||||
body['ZipCode'] = user.zipCode;
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
|
||||
await baseAppClient.post(GET_USERINFORMATION_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
userInformationModelList.clear();
|
||||
|
||||
response['List_UserInformationModel_New'].forEach((vital) {
|
||||
userInformationModelList.add(List_UserInformationModel.fromJson(vital));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import '../base_service.dart';
|
||||
|
||||
class VaccinationTableService extends BaseService {
|
||||
List<CreateVaccinationTable> createVaccinationTableModelList = List();
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
|
||||
|
||||
Future getCreateVaccinationTableOrders() async {
|
||||
hasError = false;
|
||||
await getUser();
|
||||
body['BabyName']="fffffffffff eeeeeeeeeeeeee";
|
||||
body['DOB'] = "/Date(1585774800000+0300)/";
|
||||
body['EmailAddress'] = user.emailAddress;
|
||||
body['isDentalAllowedBackend'] = false;
|
||||
body['SendEmail'] = false;
|
||||
body['IsLogin'] =true;
|
||||
|
||||
|
||||
|
||||
|
||||
await baseAppClient.post(GET_TABLE_REQUEST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
createVaccinationTableModelList.clear();
|
||||
response['List_CreateVaccinationTableModel'].forEach((vital) {
|
||||
createVaccinationTableModelList.add(
|
||||
CreateVaccinationTable.fromJson(vital));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: body);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/delete_baby_service.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
|
||||
class AddNewChildViewModel extends BaseViewModel {
|
||||
|
||||
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
|
||||
ChildVaccinesService _childVaccinesService = locator<ChildVaccinesService>();
|
||||
// DeleteBabyService _deleteBabyService = locator<DeleteBabyService>();
|
||||
bool isAdded = false;
|
||||
///create new baby
|
||||
createNewBabyOrders({ CreateNewBaby newChild}) async {
|
||||
setState(ViewState.Busy);
|
||||
await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID);
|
||||
if (_creteNewBabyService.hasError) {
|
||||
error = _creteNewBabyService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
isAdded = true;
|
||||
setState(ViewState.Idle);
|
||||
await _childVaccinesService.getAllBabyInformationOrders();
|
||||
if (_childVaccinesService.hasError) {
|
||||
error = _childVaccinesService.error;
|
||||
setState(ViewState.Error);
|
||||
} else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart';
|
||||
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart';
|
||||
//========
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/delete_baby_service.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
class ChildVaccinesViewModel extends BaseViewModel{
|
||||
ChildVaccinesService _childVaccinesService = locator<ChildVaccinesService>();
|
||||
|
||||
List<List_BabyInformationModel> get babyInformationModelList=> _childVaccinesService.babyInformationModelList;
|
||||
|
||||
|
||||
//===========
|
||||
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
|
||||
|
||||
DeleteBabyService _deleteBabyService = locator<DeleteBabyService>();
|
||||
bool isAdded = false;
|
||||
bool isDeleted = false;
|
||||
//============
|
||||
|
||||
|
||||
getNewUserOrders() async {
|
||||
setState(ViewState.Busy);
|
||||
await _childVaccinesService.getNewUserOrders();
|
||||
if (_childVaccinesService.hasError) {
|
||||
error = _childVaccinesService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
getBabyInformatioRequestOrders();
|
||||
}
|
||||
|
||||
getBabyInformatioRequestOrders() async {
|
||||
await _childVaccinesService.getAllBabyInformationOrders();
|
||||
if (_childVaccinesService.hasError) {
|
||||
error = _childVaccinesService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
///delete baby
|
||||
deleteBabyOrders({ DeleteBaby newChild}) async {
|
||||
setState(ViewState.Busy);
|
||||
//await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID);
|
||||
await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID);
|
||||
//getDeleteBabyOrder(deleteChild: newChild,);
|
||||
// getDeleteBabyOrder
|
||||
if (_creteNewBabyService.hasError) {
|
||||
error = _creteNewBabyService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
isDeleted = true;
|
||||
setState(ViewState.Idle);
|
||||
await _childVaccinesService.getAllBabyInformationOrders();
|
||||
if (_childVaccinesService.hasError) {
|
||||
error = _childVaccinesService.error;
|
||||
setState(ViewState.Error);
|
||||
} else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/user_information_service.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
|
||||
class UserInformationViewModel extends BaseViewModel {
|
||||
UserInformationService _userInformationService =
|
||||
locator<UserInformationService>();
|
||||
|
||||
List<List_UserInformationModel> get userInformationModelList =>
|
||||
_userInformationService.userInformationModelList;
|
||||
|
||||
getUserInformationRequestOrders() async {
|
||||
setState(ViewState.Busy);
|
||||
await _userInformationService.getUserInformationOrders();
|
||||
if (_userInformationService.hasError) {
|
||||
error = _userInformationService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
|
||||
class VaccinationTableViewModel extends BaseViewModel{
|
||||
|
||||
VaccinationTableService _creteVaccinationTableService = locator<VaccinationTableService>();
|
||||
|
||||
// String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent;
|
||||
//String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent;
|
||||
List<CreateVaccinationTable> get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList;
|
||||
getCreateVaccinationTable() async {
|
||||
setState(ViewState.Busy);
|
||||
|
||||
await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders();
|
||||
|
||||
if ( _creteVaccinationTableService.hasError) {
|
||||
error = _creteVaccinationTableService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
class CovidPaymentInfoResponse {
|
||||
dynamic propertyChanged;
|
||||
dynamic cashPriceField;
|
||||
dynamic cashPriceTaxField;
|
||||
dynamic cashPriceWithTaxField;
|
||||
dynamic companyIdField;
|
||||
String companyNameField;
|
||||
dynamic companyShareWithTaxField;
|
||||
dynamic errCodeField;
|
||||
dynamic groupIDField;
|
||||
dynamic insurancePolicyNoField;
|
||||
String messageField;
|
||||
dynamic patientCardIDField;
|
||||
dynamic patientShareField;
|
||||
dynamic patientShareWithTaxField;
|
||||
dynamic patientTaxAmountField;
|
||||
dynamic policyIdField;
|
||||
dynamic policyNameField;
|
||||
String procedureNameField;
|
||||
dynamic setupIDField;
|
||||
dynamic statusCodeField;
|
||||
dynamic subPolicyNoField;
|
||||
|
||||
CovidPaymentInfoResponse(
|
||||
{this.propertyChanged,
|
||||
this.cashPriceField,
|
||||
this.cashPriceTaxField,
|
||||
this.cashPriceWithTaxField,
|
||||
this.companyIdField,
|
||||
this.companyNameField,
|
||||
this.companyShareWithTaxField,
|
||||
this.errCodeField,
|
||||
this.groupIDField,
|
||||
this.insurancePolicyNoField,
|
||||
this.messageField,
|
||||
this.patientCardIDField,
|
||||
this.patientShareField,
|
||||
this.patientShareWithTaxField,
|
||||
this.patientTaxAmountField,
|
||||
this.policyIdField,
|
||||
this.policyNameField,
|
||||
this.procedureNameField,
|
||||
this.setupIDField,
|
||||
this.statusCodeField,
|
||||
this.subPolicyNoField});
|
||||
|
||||
CovidPaymentInfoResponse.fromJson(Map<String, dynamic> json) {
|
||||
propertyChanged = json['PropertyChanged'];
|
||||
cashPriceField = json['cashPriceField'];
|
||||
cashPriceTaxField = json['cashPriceTaxField'];
|
||||
cashPriceWithTaxField = json['cashPriceWithTaxField'];
|
||||
companyIdField = json['companyIdField'];
|
||||
companyNameField = json['companyNameField'];
|
||||
companyShareWithTaxField = json['companyShareWithTaxField'];
|
||||
errCodeField = json['errCodeField'];
|
||||
groupIDField = json['groupIDField'];
|
||||
insurancePolicyNoField = json['insurancePolicyNoField'];
|
||||
messageField = json['messageField'];
|
||||
patientCardIDField = json['patientCardIDField'];
|
||||
patientShareField = json['patientShareField'];
|
||||
patientShareWithTaxField = json['patientShareWithTaxField'];
|
||||
patientTaxAmountField = json['patientTaxAmountField'];
|
||||
policyIdField = json['policyIdField'];
|
||||
policyNameField = json['policyNameField'];
|
||||
procedureNameField = json['procedureNameField'];
|
||||
setupIDField = json['setupIDField'];
|
||||
statusCodeField = json['statusCodeField'];
|
||||
subPolicyNoField = json['subPolicyNoField'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PropertyChanged'] = this.propertyChanged;
|
||||
data['cashPriceField'] = this.cashPriceField;
|
||||
data['cashPriceTaxField'] = this.cashPriceTaxField;
|
||||
data['cashPriceWithTaxField'] = this.cashPriceWithTaxField;
|
||||
data['companyIdField'] = this.companyIdField;
|
||||
data['companyNameField'] = this.companyNameField;
|
||||
data['companyShareWithTaxField'] = this.companyShareWithTaxField;
|
||||
data['errCodeField'] = this.errCodeField;
|
||||
data['groupIDField'] = this.groupIDField;
|
||||
data['insurancePolicyNoField'] = this.insurancePolicyNoField;
|
||||
data['messageField'] = this.messageField;
|
||||
data['patientCardIDField'] = this.patientCardIDField;
|
||||
data['patientShareField'] = this.patientShareField;
|
||||
data['patientShareWithTaxField'] = this.patientShareWithTaxField;
|
||||
data['patientTaxAmountField'] = this.patientTaxAmountField;
|
||||
data['policyIdField'] = this.policyIdField;
|
||||
data['policyNameField'] = this.policyNameField;
|
||||
data['procedureNameField'] = this.procedureNameField;
|
||||
data['setupIDField'] = this.setupIDField;
|
||||
data['statusCodeField'] = this.statusCodeField;
|
||||
data['subPolicyNoField'] = this.subPolicyNoField;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
class DriveThroughTestingCenterModel {
|
||||
int rowID;
|
||||
int iD;
|
||||
int projectID;
|
||||
String setupID;
|
||||
double longitude;
|
||||
double latitude;
|
||||
int numberOfTracks;
|
||||
bool isActive;
|
||||
int createdBy;
|
||||
String createdOn;
|
||||
dynamic editedBy;
|
||||
dynamic editedON;
|
||||
dynamic projectName;
|
||||
dynamic projectNameN;
|
||||
|
||||
DriveThroughTestingCenterModel(
|
||||
{this.rowID,
|
||||
this.iD,
|
||||
this.projectID,
|
||||
this.setupID,
|
||||
this.longitude,
|
||||
this.latitude,
|
||||
this.numberOfTracks,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedON,
|
||||
this.projectName,
|
||||
this.projectNameN});
|
||||
|
||||
DriveThroughTestingCenterModel.fromJson(Map<String, dynamic> json) {
|
||||
rowID = json['RowID'];
|
||||
iD = json['ID'];
|
||||
projectID = json['ProjectID'];
|
||||
setupID = json['SetupID'];
|
||||
longitude = json['Longitude'];
|
||||
latitude = json['Latitude'];
|
||||
numberOfTracks = json['NumberOfTracks'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedON = json['EditedON'];
|
||||
projectName = json['ProjectName'];
|
||||
projectNameN = json['ProjectNameN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['RowID'] = this.rowID;
|
||||
data['ID'] = this.iD;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['Longitude'] = this.longitude;
|
||||
data['Latitude'] = this.latitude;
|
||||
data['NumberOfTracks'] = this.numberOfTracks;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedON'] = this.editedON;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['ProjectNameN'] = this.projectNameN;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
class LiveCareScheduleClinicsListResponse {
|
||||
List<ClinicsHaveScheduleList> clinicsHaveScheduleList;
|
||||
|
||||
LiveCareScheduleClinicsListResponse({this.clinicsHaveScheduleList});
|
||||
|
||||
LiveCareScheduleClinicsListResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json['ClinicsHaveScheduleList'] != null) {
|
||||
clinicsHaveScheduleList = new List<ClinicsHaveScheduleList>();
|
||||
json['ClinicsHaveScheduleList'].forEach((v) {
|
||||
clinicsHaveScheduleList.add(new ClinicsHaveScheduleList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.clinicsHaveScheduleList != null) {
|
||||
data['ClinicsHaveScheduleList'] =
|
||||
this.clinicsHaveScheduleList.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ClinicsHaveScheduleList {
|
||||
int clinicID;
|
||||
int serviceID;
|
||||
int projectID;
|
||||
String clinicDesc;
|
||||
String clinicDescN;
|
||||
String projectDesc;
|
||||
String projectDescN;
|
||||
|
||||
ClinicsHaveScheduleList(
|
||||
{this.clinicID,
|
||||
this.serviceID,
|
||||
this.projectID,
|
||||
this.clinicDesc,
|
||||
this.clinicDescN,
|
||||
this.projectDesc,
|
||||
this.projectDescN});
|
||||
|
||||
ClinicsHaveScheduleList.fromJson(Map<String, dynamic> json) {
|
||||
clinicID = json['ClinicID'];
|
||||
serviceID = json['ServiceID'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicDesc = json['ClinicDesc'];
|
||||
clinicDescN = json['ClinicDescN'];
|
||||
projectDesc = json['ProjectDesc'];
|
||||
projectDescN = json['ProjectDescN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['ServiceID'] = this.serviceID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicDesc'] = this.clinicDesc;
|
||||
data['ClinicDescN'] = this.clinicDescN;
|
||||
data['ProjectDesc'] = this.projectDesc;
|
||||
data['ProjectDescN'] = this.projectDescN;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
class insertVIDARequest {
|
||||
int patientID;
|
||||
int acceptedBy;
|
||||
int appointmentNo;
|
||||
String deviceToken;
|
||||
double latitude;
|
||||
double longitude;
|
||||
int serviceID;
|
||||
int projectID;
|
||||
int clinicID;
|
||||
String deviceType;
|
||||
String voipToken;
|
||||
double versionID;
|
||||
int channel;
|
||||
int languageID;
|
||||
String iPAdress;
|
||||
String generalid;
|
||||
int patientOutSA;
|
||||
String sessionID;
|
||||
bool isDentalAllowedBackend;
|
||||
int deviceTypeID;
|
||||
|
||||
insertVIDARequest(
|
||||
{this.patientID,
|
||||
this.acceptedBy,
|
||||
this.appointmentNo,
|
||||
this.deviceToken,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.serviceID,
|
||||
this.projectID,
|
||||
this.clinicID,
|
||||
this.deviceType,
|
||||
this.voipToken,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID});
|
||||
|
||||
insertVIDARequest.fromJson(Map<String, dynamic> json) {
|
||||
patientID = json['PatientID'];
|
||||
acceptedBy = json['AcceptedBy'];
|
||||
appointmentNo = json['AppointmentNo'];
|
||||
deviceToken = json['DeviceToken'];
|
||||
latitude = json['Latitude'];
|
||||
longitude = json['Longitude'];
|
||||
serviceID = json['ServiceID'];
|
||||
projectID = json['ProjectID'];
|
||||
clinicID = json['ClinicID'];
|
||||
deviceType = json['DeviceType'];
|
||||
voipToken = json['VoipToken'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientID'] = this.patientID;
|
||||
data['AcceptedBy'] = this.acceptedBy;
|
||||
data['AppointmentNo'] = this.appointmentNo;
|
||||
data['DeviceToken'] = this.deviceToken;
|
||||
data['Latitude'] = this.latitude;
|
||||
data['Longitude'] = this.longitude;
|
||||
data['ServiceID'] = this.serviceID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['DeviceType'] = this.deviceType;
|
||||
data['VoipToken'] = this.voipToken;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,522 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:math';
|
||||
|
||||
import 'result_page.dart';
|
||||
|
||||
const activeCardColor = Color(0xff70777A);
|
||||
const inactiveCardColor = Color(0xffFAFAFd);
|
||||
|
||||
class BMICalculator extends StatefulWidget {
|
||||
@override
|
||||
_BMICalculatorState createState() => _BMICalculatorState();
|
||||
}
|
||||
|
||||
class _BMICalculatorState extends State<BMICalculator> {
|
||||
TextEditingController textController = new TextEditingController();
|
||||
String textResult;
|
||||
String msg;
|
||||
double bmiResult;
|
||||
int height = 150;
|
||||
int weight = 40;
|
||||
Color cmCard = activeCardColor;
|
||||
Color ftCard = inactiveCardColor;
|
||||
Color lbCard = inactiveCardColor;
|
||||
Color kgCard = activeCardColor;
|
||||
void updateColor(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (cmCard == inactiveCardColor) {
|
||||
cmCard = activeCardColor;
|
||||
ftCard = inactiveCardColor;
|
||||
} else {
|
||||
cmCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (ftCard == inactiveCardColor) {
|
||||
ftCard = activeCardColor;
|
||||
cmCard = inactiveCardColor;
|
||||
} else {
|
||||
ftCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateColorWeight(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (kgCard == inactiveCardColor) {
|
||||
kgCard = activeCardColor;
|
||||
lbCard = inactiveCardColor;
|
||||
} else {
|
||||
kgCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (lbCard == inactiveCardColor) {
|
||||
lbCard = activeCardColor;
|
||||
kgCard = inactiveCardColor;
|
||||
} else {
|
||||
lbCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double convertToCm(double number) {
|
||||
return number * 30.48;
|
||||
}
|
||||
|
||||
double convertToKg(double number) {
|
||||
return number / 2.205;
|
||||
}
|
||||
|
||||
double calculateBMI() {
|
||||
if (ftCard == activeCardColor) {
|
||||
convertToCm(height.toDouble());
|
||||
}
|
||||
bmiResult = weight / pow(height / 100, 2);
|
||||
|
||||
return bmiResult;
|
||||
}
|
||||
|
||||
void showTextResult() {
|
||||
if (bmiResult >= 30) {
|
||||
textResult = 'Obese';
|
||||
} else if (bmiResult < 30 && bmiResult >= 25) {
|
||||
textResult = 'OverWeight';
|
||||
} else if (bmiResult < 25 && bmiResult >= 18.5) {
|
||||
textResult = 'Healthy';
|
||||
} else if (bmiResult < 18.5) {
|
||||
textResult = 'UnderWeight';
|
||||
}
|
||||
}
|
||||
|
||||
void showMsg() {
|
||||
if (bmiResult >= 30) {
|
||||
msg =
|
||||
'A BMI of over 30 indicates that are heavily overweight. Health may be at risk if not lose weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.';
|
||||
} else if (bmiResult < 30 && bmiResult >= 25) {
|
||||
msg =
|
||||
'A BMI of 25 - 30 indicates that are slightly overweight. May be advised to lose some weight for health reasons. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get ';
|
||||
} else if (bmiResult < 25 && bmiResult >= 18.5) {
|
||||
msg =
|
||||
'A BMI of 18.5 - 25 indicates that are at a healthy weight for the height. By maintaining a healthy weight, lower the risk of developing severe health problems. To book an appointment, click below to get started.';
|
||||
} else if (bmiResult < 18.5) {
|
||||
msg =
|
||||
'A BMI of less than 18.5 indicates that are underweight, so may need to put on some weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
textController.text = '0'; // Setting the initial value for the field.
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'BMI Calculator',
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 350.0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15.0),
|
||||
child: Text(
|
||||
'Calculate the BMI value and weight\n status to identify the healthy weight .\n Not appropriate for children and women\n who are pregnant or breastfeeding',
|
||||
style: TextStyle(fontSize: 18.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 200.0,
|
||||
width: 350.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Texts('Height'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(height.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height < 250) height++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height > 120) height--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Slider(
|
||||
value: height.toDouble(),
|
||||
min: 120,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
height = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Texts('Select Unit'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColor(1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: cmCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('CM')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColor(2);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: ftCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('FT')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25.0,
|
||||
),
|
||||
Container(
|
||||
height: 200.0,
|
||||
width: 350.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Texts('Weight'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(weight.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight < 250) weight++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight > 40) weight--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Slider(
|
||||
value: weight.toDouble(),
|
||||
min: 40,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
weight = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Texts('Select Unit'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: kgCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('KG')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(2);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: lbCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('LB')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
calculateBMI();
|
||||
showTextResult();
|
||||
showMsg();
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ResultPage(
|
||||
finalResult: bmiResult,
|
||||
textResult: textResult,
|
||||
msg: msg,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/percent_indicator.dart';
|
||||
|
||||
class ResultPage extends StatelessWidget {
|
||||
final double finalResult;
|
||||
final String textResult;
|
||||
final String msg;
|
||||
|
||||
ResultPage({this.finalResult, this.textResult, this.msg});
|
||||
Color inductorColor;
|
||||
double percent;
|
||||
|
||||
Color colorInductor() {
|
||||
if (finalResult >= 30) {
|
||||
inductorColor = Color(0xffC70D00);
|
||||
} else if (finalResult < 30 && finalResult >= 25) {
|
||||
inductorColor = Color(0xffC25400);
|
||||
} else if (finalResult < 25 && finalResult >= 18.5) {
|
||||
inductorColor = Color(0xff36D600);
|
||||
} else if (finalResult < 18.5) {
|
||||
inductorColor = Color(0xff1BE0EE);
|
||||
}
|
||||
return inductorColor;
|
||||
}
|
||||
|
||||
double percentInductor() {
|
||||
if (finalResult >= 30) {
|
||||
percent = 1.0;
|
||||
} else if (finalResult < 30 && finalResult >= 25) {
|
||||
percent = 0.73;
|
||||
} else if (finalResult < 25 && finalResult >= 18.5) {
|
||||
percent = 0.5;
|
||||
} else if (finalResult < 18.5) {
|
||||
percent = 0.25;
|
||||
}
|
||||
return percent;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: "BMI Calculator",
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
// height: 40.0,
|
||||
),
|
||||
Center(
|
||||
child: CircularPercentIndicator(
|
||||
radius: 220.0,
|
||||
lineWidth: 20.0,
|
||||
percent: percentInductor(),
|
||||
center: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
finalResult.toStringAsFixed(1),
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Text(
|
||||
textResult,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
progressColor: colorInductor(),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 120,
|
||||
width: 280.0,
|
||||
child: Texts(msg),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
|
||||
class BmrResultPage extends StatelessWidget {
|
||||
final double bmrResult;
|
||||
final double calories;
|
||||
BmrResultPage({this.bmrResult, this.calories});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'BMR Calculator',
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Center(
|
||||
child: CircularPercentIndicator(
|
||||
radius: 220.0,
|
||||
lineWidth: 20.0,
|
||||
percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
|
||||
center: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
bmrResult.toStringAsFixed(1),
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Text(
|
||||
'Calories/Day',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
progressColor: Color(0xff3C3939),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 120,
|
||||
width: 280.0,
|
||||
child: Texts(
|
||||
'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.'),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
|
||||
class FatResult extends StatelessWidget {
|
||||
final double bodyFat;
|
||||
final double fat;
|
||||
final String textResult;
|
||||
|
||||
FatResult({this.bodyFat, this.fat, this.textResult = ''});
|
||||
Color inductorColor;
|
||||
Color colorInductor() {
|
||||
if (bodyFat >= 17) {
|
||||
inductorColor = Color(0xffC70D00);
|
||||
} else if (bodyFat < 20 && bodyFat >= 24) {
|
||||
inductorColor = Color(0xffC25400);
|
||||
} else if (bodyFat < 24 && bodyFat >= 31) {
|
||||
inductorColor = Color(0xff36D600);
|
||||
} else if (bodyFat > 45) {
|
||||
inductorColor = Color(0xff1BE0EE);
|
||||
}
|
||||
return inductorColor;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Body Fat',
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
// height: 40.0,
|
||||
),
|
||||
Center(
|
||||
child: CircularPercentIndicator(
|
||||
radius: 220.0,
|
||||
lineWidth: 20.0,
|
||||
percent: ((fat > 70) ? 100 : fat / 100),
|
||||
center: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
fat.toStringAsFixed(1) + '%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
progressColor: inductorColor,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 120,
|
||||
width: 280.0,
|
||||
child: Texts(textResult),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,677 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'calorie_result_page.dart';
|
||||
|
||||
const activeCardColorGender = Color(0xffC5272D);
|
||||
const inactiveCardColorGender = Color(0xffFAFAFd);
|
||||
const activeCardColor = Color(0xff70777A);
|
||||
const inactiveCardColor = Color(0xffFAFAFd);
|
||||
|
||||
class CalorieCalculator extends StatefulWidget {
|
||||
@override
|
||||
_CalorieCalculatorState createState() => _CalorieCalculatorState();
|
||||
}
|
||||
|
||||
class _CalorieCalculatorState extends State<CalorieCalculator> {
|
||||
bool isMale = false;
|
||||
Color maleCard = activeCardColorGender;
|
||||
Color femaleCard = inactiveCardColorGender;
|
||||
Color kgCard = activeCardColor;
|
||||
Color lbCard = inactiveCardColor;
|
||||
Color cmCard = activeCardColor;
|
||||
Color ftCard = inactiveCardColor;
|
||||
int age = 0;
|
||||
int height = 0;
|
||||
int weight = 0;
|
||||
double calories;
|
||||
String dropdownValue;
|
||||
void updateColor(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (maleCard == inactiveCardColorGender) {
|
||||
maleCard = activeCardColorGender;
|
||||
femaleCard = inactiveCardColorGender;
|
||||
} else {
|
||||
maleCard = inactiveCardColorGender;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (femaleCard == inactiveCardColorGender) {
|
||||
femaleCard = activeCardColorGender;
|
||||
maleCard = inactiveCardColorGender;
|
||||
} else {
|
||||
femaleCard = inactiveCardColorGender;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateColorWeight(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (kgCard == inactiveCardColor) {
|
||||
kgCard = activeCardColor;
|
||||
lbCard = inactiveCardColor;
|
||||
} else {
|
||||
kgCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (lbCard == inactiveCardColor) {
|
||||
lbCard = activeCardColor;
|
||||
kgCard = inactiveCardColor;
|
||||
} else {
|
||||
lbCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateColorHeight(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (cmCard == inactiveCardColor) {
|
||||
cmCard = activeCardColor;
|
||||
ftCard = inactiveCardColor;
|
||||
} else {
|
||||
cmCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (ftCard == inactiveCardColor) {
|
||||
ftCard = activeCardColor;
|
||||
cmCard = inactiveCardColor;
|
||||
} else {
|
||||
ftCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void calculateCalories() {
|
||||
if (isMale == true) {
|
||||
calories = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age);
|
||||
} else if (isMale == false) {
|
||||
calories =
|
||||
655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Calorie Calculator',
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 890.0,
|
||||
child: Column(
|
||||
//mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Texts(
|
||||
'Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity rate',
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 10.0, vertical: 15.0),
|
||||
child: Texts('Gender'),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(35.0),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.black45,
|
||||
)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColor(1);
|
||||
isMale = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 170.0,
|
||||
decoration: BoxDecoration(
|
||||
color: maleCard,
|
||||
borderRadius: BorderRadius.circular(35.0),
|
||||
),
|
||||
child: Center(child: Texts('FEMALE')),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColor(2);
|
||||
isMale = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 170.0,
|
||||
decoration: BoxDecoration(
|
||||
color: femaleCard,
|
||||
borderRadius: BorderRadius.circular(35.0),
|
||||
),
|
||||
child: Center(child: Texts('MALE')),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.0,
|
||||
),
|
||||
Texts(
|
||||
'The Age ( 11 - 120 ) yrs',
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(age.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (age < 120) age++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (age > 0) age--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: age.toDouble(),
|
||||
min: 0,
|
||||
max: 120,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
age = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
'Height',
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(height.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height < 250) height++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height > 0) height--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: height.toDouble(),
|
||||
min: 0,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
height = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts('Select Unit'),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorHeight(1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: cmCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('CM')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorHeight(2);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: ftCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('Ft')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Texts(
|
||||
'Weight',
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(weight.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight < 250) weight++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight > 0) weight--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: weight.toDouble(),
|
||||
min: 0,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
weight = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts('Select Unit'),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: kgCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('KG')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(2);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: lbCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('LB')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Texts('Activity level'),
|
||||
Container(
|
||||
width: 300,
|
||||
child: DropdownButton<String>(
|
||||
value: dropdownValue,
|
||||
icon: Icon(Icons.arrow_downward),
|
||||
iconSize: 24,
|
||||
elevation: 16,
|
||||
style: TextStyle(color: Colors.black87),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.black54,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
dropdownValue = newValue;
|
||||
});
|
||||
},
|
||||
items: <String>[
|
||||
'Almost Inactive(Little or no exercises)',
|
||||
'Lighty Active (1-3) days per week',
|
||||
'very Active(6-7) days per week',
|
||||
'Super Active(very hard exercises)'
|
||||
].map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
calculateCalories();
|
||||
print(calories);
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CalorieResultPage(
|
||||
calorie: calories,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
|
||||
class CalorieResultPage extends StatelessWidget {
|
||||
final double calorie;
|
||||
|
||||
CalorieResultPage({this.calorie});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: 'Calorie Calculator',
|
||||
isShowAppBar: true,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Center(
|
||||
child: CircularPercentIndicator(
|
||||
radius: 220.0,
|
||||
lineWidth: 20.0,
|
||||
percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500),
|
||||
center: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
calorie.toStringAsFixed(1),
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Texts('Calories'),
|
||||
],
|
||||
),
|
||||
progressColor: Color(0xff3C3939),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child:
|
||||
Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,367 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:math';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'carbs_result_page.dart';
|
||||
|
||||
class Carbs extends StatefulWidget {
|
||||
@override
|
||||
_CarbsState createState() => _CarbsState();
|
||||
}
|
||||
|
||||
class _CarbsState extends State<Carbs> {
|
||||
TextEditingController textController = new TextEditingController();
|
||||
int calories;
|
||||
String dropdownValue;
|
||||
bool _visible = false;
|
||||
int meals;
|
||||
int protein;
|
||||
int carbs;
|
||||
|
||||
int fat;
|
||||
double pCal;
|
||||
double cCal;
|
||||
double fCal;
|
||||
double pCalGram;
|
||||
double cCalGram;
|
||||
double fCalGram;
|
||||
double pCalMeal;
|
||||
double cCalMeal;
|
||||
double fCalMeal;
|
||||
|
||||
void calculateDietRatios() {
|
||||
if (dropdownValue == 'Very Low Carb') {
|
||||
meals = 3;
|
||||
protein = 45;
|
||||
carbs = 10;
|
||||
fat = 45;
|
||||
} else if (dropdownValue == 'Low Carb') {
|
||||
meals = 3;
|
||||
protein = 40;
|
||||
carbs = 30;
|
||||
fat = 30;
|
||||
} else if (dropdownValue == 'Moderate Carb') {
|
||||
meals = 3;
|
||||
protein = 25;
|
||||
carbs = 50;
|
||||
fat = 25;
|
||||
} else if (dropdownValue == 'USDA Gudilines') {
|
||||
meals = 3;
|
||||
protein = 15;
|
||||
carbs = 55;
|
||||
fat = 30;
|
||||
} else if (dropdownValue == 'Zone Diet') {
|
||||
meals = 3;
|
||||
protein = 30;
|
||||
carbs = 40;
|
||||
fat = 30;
|
||||
}
|
||||
}
|
||||
|
||||
void calculate() {
|
||||
pCal = (protein / 100.0) * int.parse(textController.text).ceil();
|
||||
cCal = (carbs / 100.0) * int.parse(textController.text);
|
||||
;
|
||||
fCal = (fat / 100) * int.parse(textController.text);
|
||||
;
|
||||
pCalGram = pCal / 4.0;
|
||||
cCalGram = cCal / 4.0;
|
||||
fCalGram = fCal / 9.0;
|
||||
pCalMeal = pCalGram / meals.ceil();
|
||||
cCalMeal = cCalGram / meals.ceil();
|
||||
fCalMeal = fCalGram / meals.ceil();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Carb Protein Fat',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio',
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.0,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 300.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: TextFormField(
|
||||
controller: textController,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter
|
||||
.digitsOnly
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
hintText: " The Calories per day ",
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
int currentValue = int.parse(
|
||||
textController.text);
|
||||
currentValue++;
|
||||
textController.text =
|
||||
(currentValue).toString();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
int currentValue = int.parse(
|
||||
textController.text);
|
||||
currentValue--;
|
||||
textController.text =
|
||||
(currentValue).toString();
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Button(
|
||||
backgroundColor: Color(0xffC5272D),
|
||||
label: 'NOT SURE? CLICK HERE ',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CalorieCalculator()),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Select Diet Type'),
|
||||
Container(
|
||||
width: 400,
|
||||
child: DropdownButton<String>(
|
||||
value: dropdownValue,
|
||||
icon: Icon(Icons.arrow_downward),
|
||||
iconSize: 24,
|
||||
elevation: 16,
|
||||
style: TextStyle(color: Colors.black87),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.black54,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
dropdownValue = newValue;
|
||||
calculateDietRatios();
|
||||
|
||||
dropdownValue == null
|
||||
? _visible = false
|
||||
: _visible = true;
|
||||
});
|
||||
},
|
||||
items: <String>[
|
||||
'Very Low Carb',
|
||||
'Low Carb',
|
||||
'Moderate Carb',
|
||||
'USDA Gudilines',
|
||||
'Zone Diet',
|
||||
].map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: _visible,
|
||||
child: Container(
|
||||
height: 170.0,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Texts(
|
||||
'Ratios are divided according to the selected diet'),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Colors.black),
|
||||
children: [
|
||||
TextSpan(text: 'Meals Per Day '),
|
||||
TextSpan(
|
||||
text: '$meals',
|
||||
style: TextStyle(color: Color(0xffC5272D)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Colors.black),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Protein ',
|
||||
),
|
||||
TextSpan(
|
||||
text: '$protein%',
|
||||
style: TextStyle(color: Color(0xffC5272D)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Colors.black),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Carbohydrate ',
|
||||
),
|
||||
TextSpan(
|
||||
text: '$carbs%',
|
||||
style: TextStyle(color: Color(0xffC5272D)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Colors.black),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Fat ',
|
||||
),
|
||||
TextSpan(
|
||||
text: '$fat%',
|
||||
style: TextStyle(color: Color(0xffC5272D)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 55.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
{
|
||||
calculate();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CarbsResult(
|
||||
cCal: cCal,
|
||||
pCal: pCal,
|
||||
fCal: fCal,
|
||||
pCalGram: pCalGram,
|
||||
pCalMeal: pCalMeal,
|
||||
fCalGram: fCalGram,
|
||||
fCalMeal: fCalMeal,
|
||||
cCalGram: cCalGram,
|
||||
cCalMeal: cCalMeal,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,175 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/painting.dart';
|
||||
|
||||
class CarbsResult extends StatelessWidget {
|
||||
double pCal;
|
||||
double cCal;
|
||||
double fCal;
|
||||
double pCalGram;
|
||||
double cCalGram;
|
||||
double fCalGram;
|
||||
double pCalMeal;
|
||||
double cCalMeal;
|
||||
double fCalMeal;
|
||||
|
||||
CarbsResult(
|
||||
{this.pCal,
|
||||
this.cCal,
|
||||
this.fCal,
|
||||
this.pCalGram,
|
||||
this.cCalGram,
|
||||
this.fCalGram,
|
||||
this.fCalMeal,
|
||||
this.cCalMeal,
|
||||
this.pCalMeal});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Carb Protein Fat',
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0),
|
||||
child: Table(
|
||||
border: TableBorder(
|
||||
verticalInside: BorderSide(width: 1, color: Colors.black54),
|
||||
bottom: BorderSide(width: 1, color: Colors.black54),
|
||||
left: BorderSide(width: 1, color: Colors.black54),
|
||||
right: BorderSide(width: 1, color: Colors.black54),
|
||||
top: BorderSide(width: 1, color: Colors.black54),
|
||||
),
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
children: [
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts('Description'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts('Protein'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
'Carbohydrate',
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts('Fat'),
|
||||
),
|
||||
),
|
||||
]),
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: TableCell(
|
||||
child: Center(
|
||||
child: Texts('Calories\n Per Day'),
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(pCal.ceil().toString() + ' Cals'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(cCal.ceil().toString() + ' Cals'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(fCal.ceil().toString() + ' Cals'),
|
||||
),
|
||||
),
|
||||
]),
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: TableCell(
|
||||
child: Center(
|
||||
child: Texts('Grams Per\n Day'),
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(pCalGram.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(cCalGram.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(fCalGram.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
]),
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: TableCell(
|
||||
child: Center(
|
||||
child: Texts('Grams Per\n Meal'),
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(pCalMeal.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(cCalMeal.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Center(
|
||||
child: Texts(fCalMeal.ceil().toString() + ' gr'),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Texts(pCal.ceil().toString()),
|
||||
// Texts(cCal.ceil().toString()),
|
||||
// Texts(fCal.ceil().toString()),
|
||||
// Texts(pCalGram.ceil().toString()),
|
||||
// Texts(cCalGram.ceil().toString()),
|
||||
// Texts(fCalGram.ceil().toString()),
|
||||
// Texts(pCalMeal.ceil().toString()),
|
||||
// Texts(cCalMeal.ceil().toString()),
|
||||
// Texts(fCalMeal.ceil().toString()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'delivery_due_result_page.dart';
|
||||
|
||||
class DeliveryDue extends StatefulWidget {
|
||||
@override
|
||||
_DeliveryDueState createState() => _DeliveryDueState();
|
||||
}
|
||||
|
||||
class _DeliveryDueState extends State<DeliveryDue> {
|
||||
DateTime bloodSugarDate = DateTime.now();
|
||||
DateTime timeSugarDate = DateTime.now();
|
||||
var dateFrom = DateTime.now();
|
||||
var dateTo = DateTime.now();
|
||||
var conceivedDate = DateTime.now();
|
||||
var deliveryDue = DateTime.now();
|
||||
var firstTrimester = DateTime.now();
|
||||
var secondTrimester = DateTime.now();
|
||||
var thirdTrimester = DateTime.now();
|
||||
var dt = DateTime.now();
|
||||
var newFormat = DateFormat("yy-MM-dd");
|
||||
|
||||
String getDate() {
|
||||
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}";
|
||||
}
|
||||
|
||||
String getTime() {
|
||||
return " ${timeSugarDate.hour}:${timeSugarDate.minute}";
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Delivery Due Date',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 20.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
//mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Texts(
|
||||
'Congratulations, you are pregnant! Now when will the new baby arrive? To estimate the due date, enter the date when the last menstrual perios began (the first day), then click calculate.',
|
||||
),
|
||||
Divider(
|
||||
//height: 2,
|
||||
thickness: 2,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Texts(
|
||||
'What was the date of the first day of the last period?',
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
DatePicker.showDatePicker(
|
||||
context,
|
||||
showTitleActions: true,
|
||||
minTime: DateTime(DateTime.now().year - 1, 1, 1),
|
||||
maxTime: DateTime.now(),
|
||||
onConfirm: (date) {
|
||||
print('confirm $date');
|
||||
setState(() {
|
||||
bloodSugarDate == date
|
||||
? null
|
||||
: bloodSugarDate = DateTime.now();
|
||||
dateFrom = date.add(Duration(days: 10));
|
||||
|
||||
dateTo = date.add(Duration(days: 20));
|
||||
conceivedDate = date.add(Duration(days: 14));
|
||||
deliveryDue = date.add(Duration(days: 280));
|
||||
firstTrimester = date.add(Duration(days: 85));
|
||||
secondTrimester = date.add(Duration(days: 190));
|
||||
thirdTrimester = date.add(Duration(days: 280));
|
||||
});
|
||||
},
|
||||
currentTime: DateTime.now(),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
width: double.infinity,
|
||||
height: 65,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.date_range),
|
||||
Texts('Date'),
|
||||
],
|
||||
),
|
||||
Texts(getDate()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 280.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DeliveryDueResult(
|
||||
conceivedDate: conceivedDate,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
deliveryDue: deliveryDue,
|
||||
firstTrimester: firstTrimester,
|
||||
secondTrimester: secondTrimester,
|
||||
thirdTrimester: thirdTrimester,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DeliveryDueResult extends StatelessWidget {
|
||||
var dateFrom;
|
||||
var dateTo;
|
||||
var conceivedDate;
|
||||
var deliveryDue;
|
||||
var firstTrimester;
|
||||
var secondTrimester;
|
||||
var thirdTrimester;
|
||||
DeliveryDueResult(
|
||||
{this.dateFrom,
|
||||
this.dateTo,
|
||||
this.conceivedDate,
|
||||
this.deliveryDue,
|
||||
this.firstTrimester,
|
||||
this.secondTrimester,
|
||||
this.thirdTrimester});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Delivery Due Date',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 12.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 750.0,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Texts(
|
||||
'The next ovulation period is estimated to be:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
'From:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(DateFormat.yMMMEd().format(dateFrom),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
color: Color(0xffC5272D)),
|
||||
Texts(
|
||||
'To:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(DateFormat.yMMMEd().format(dateTo),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
color: Color(0xffC5272D)),
|
||||
Texts(
|
||||
'You have conceived on:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(conceivedDate),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'First Trimester Ends (12 weeks):',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(firstTrimester),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'Second Trimester Ends (27 weeks):',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(secondTrimester),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'Third Trimester, Estimated Due Date (40 weeks):',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(thirdTrimester),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,557 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:math';
|
||||
|
||||
import 'ideal_body_result_page.dart';
|
||||
|
||||
const activeCardColor = Color(0xff70777A);
|
||||
const inactiveCardColor = Color(0xffFAFAFd);
|
||||
|
||||
class IdealBody extends StatefulWidget {
|
||||
@override
|
||||
_IdealBodyState createState() => _IdealBodyState();
|
||||
}
|
||||
|
||||
class _IdealBodyState extends State<IdealBody> {
|
||||
bool isMale = false;
|
||||
bool isHeightCm = true;
|
||||
|
||||
Color kgCard = activeCardColor;
|
||||
Color lbCard = inactiveCardColor;
|
||||
Color cmCard = activeCardColor;
|
||||
Color ftCard = inactiveCardColor;
|
||||
int age = 0;
|
||||
int height = 0;
|
||||
double heightInches;
|
||||
double minRange;
|
||||
double maxRange;
|
||||
double overWeightBy;
|
||||
int weight = 0;
|
||||
double idealWeight = 0;
|
||||
String dropdownValue = 'Medium(fingers touch)';
|
||||
double calories = 0;
|
||||
String textResult = '';
|
||||
double maxIdealWeight;
|
||||
double heightFeet;
|
||||
|
||||
void updateColorHeight(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (cmCard == inactiveCardColor) {
|
||||
cmCard = activeCardColor;
|
||||
ftCard = inactiveCardColor;
|
||||
} else {
|
||||
cmCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (ftCard == inactiveCardColor) {
|
||||
ftCard = activeCardColor;
|
||||
cmCard = inactiveCardColor;
|
||||
} else {
|
||||
ftCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateColorWeight(int type) {
|
||||
//MG/DLT card
|
||||
if (type == 1) {
|
||||
if (kgCard == inactiveCardColor) {
|
||||
kgCard = activeCardColor;
|
||||
lbCard = inactiveCardColor;
|
||||
} else {
|
||||
kgCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
if (type == 2) {
|
||||
if (lbCard == inactiveCardColor) {
|
||||
lbCard = activeCardColor;
|
||||
kgCard = inactiveCardColor;
|
||||
} else {
|
||||
lbCard = inactiveCardColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void calculateIdealWeight() {
|
||||
heightInches = height * .39370078740157477;
|
||||
heightFeet = heightInches / 12;
|
||||
idealWeight = (50 + 2.3 * (heightInches - 60));
|
||||
if (dropdownValue == 'Small(fingers overlap)') {
|
||||
idealWeight = idealWeight - 10;
|
||||
} else if (dropdownValue == 'Medium(fingers touch)') {
|
||||
idealWeight = idealWeight;
|
||||
} else if (dropdownValue == 'Large(fingers don\'n touch)') {
|
||||
idealWeight = idealWeight + 10;
|
||||
}
|
||||
|
||||
maxIdealWeight = (((idealWeight) * 1.1).round() * 100) / 100;
|
||||
overWeightBy = weight - maxIdealWeight.roundToDouble();
|
||||
minRange = ((idealWeight / 1.1) * 10).round() / 10;
|
||||
maxRange = maxIdealWeight;
|
||||
idealWeight = idealWeight;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Ideal Body Weight',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 800.0,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: Texts(
|
||||
'Calculates the ideal body weight based on height, Weight, and Body Size',
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
thickness: 2.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
'Height',
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(height.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height < 250)
|
||||
height++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (height > 0) height--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: height.toDouble(),
|
||||
min: 0,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
height = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts('Select Unit'),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorHeight(1);
|
||||
isHeightCm = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset: Offset(
|
||||
0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: cmCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('CM')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorHeight(2);
|
||||
isHeightCm = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: ftCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset: Offset(
|
||||
0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('Ft')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 45.0,
|
||||
),
|
||||
Divider(
|
||||
thickness: 2.0,
|
||||
),
|
||||
Texts(
|
||||
'Weight',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(weight.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight < 250)
|
||||
weight++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (weight > 0) weight--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: weight.toDouble(),
|
||||
min: 0,
|
||||
max: 250,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
weight = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts('Select Unit'),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(1);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset: Offset(
|
||||
0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: kgCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 0.0, horizontal: 18.0),
|
||||
child: Center(child: Texts('KG')),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
updateColorWeight(2);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 55.0,
|
||||
width: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
color: lbCard,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7,
|
||||
offset: Offset(
|
||||
0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(child: Texts('LB')),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 45.0,
|
||||
),
|
||||
Divider(
|
||||
thickness: 2.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Texts('Body Frame Size'),
|
||||
Container(
|
||||
width: 300,
|
||||
child: DropdownButton<String>(
|
||||
value: dropdownValue,
|
||||
icon: Icon(Icons.arrow_downward),
|
||||
iconSize: 24,
|
||||
elevation: 16,
|
||||
style: TextStyle(color: Colors.black87),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.black54,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
dropdownValue = newValue;
|
||||
});
|
||||
},
|
||||
items: <String>[
|
||||
'Small(fingers overlap)',
|
||||
'Medium(fingers touch)',
|
||||
'Large(fingers don\'n touch)',
|
||||
].map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
// calculateBmr();
|
||||
// calculateCalories();
|
||||
calculateIdealWeight();
|
||||
|
||||
print(idealWeight);
|
||||
//print(overWeightBy);
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => IdealBodyResult(
|
||||
idealBodyWeight: idealWeight,
|
||||
minRange: minRange,
|
||||
mixRange: maxRange,
|
||||
overWeightBy: overWeightBy,
|
||||
textResult: textResult,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,170 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:math';
|
||||
|
||||
class IdealBodyResult extends StatelessWidget {
|
||||
final double idealBodyWeight;
|
||||
final double minRange;
|
||||
final double mixRange;
|
||||
final double overWeightBy;
|
||||
final String textResult;
|
||||
|
||||
IdealBodyResult(
|
||||
{this.idealBodyWeight,
|
||||
this.minRange,
|
||||
this.mixRange,
|
||||
this.overWeightBy,
|
||||
this.textResult});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Ideal Body Weight',
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Texts(
|
||||
'Ideal weight range is',
|
||||
fontSize: 23.0,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
minRange.toStringAsFixed(1),
|
||||
fontSize: 30.0,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8.0, left: 4.0),
|
||||
child: Text(
|
||||
'Kg',
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Colors.red,
|
||||
size: 55.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
mixRange.toStringAsFixed(1),
|
||||
fontSize: 30.0,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8.0, left: 4.0),
|
||||
child: Text(
|
||||
'Kg',
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
overWeightBy >= 0 && overWeightBy <= 10
|
||||
? Column(
|
||||
children: [
|
||||
Texts(
|
||||
'Congratulations! The current weight is\n perfect and considered healthy',
|
||||
fontSize: 20.0,
|
||||
),
|
||||
],
|
||||
)
|
||||
: overWeightBy > 10 && overWeightBy < 17
|
||||
? Column(
|
||||
children: [
|
||||
Texts(
|
||||
'This means that the weight is a little bit more than ideal weight by'),
|
||||
Texts(overWeightBy.toStringAsFixed(1)),
|
||||
Texts(
|
||||
'May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
|
||||
],
|
||||
)
|
||||
: overWeightBy >= 18
|
||||
? Container(
|
||||
height: 250.0,
|
||||
width: 350,
|
||||
child: Column(
|
||||
children: [
|
||||
Texts(
|
||||
'Means that you suffer from excessive\n obesity by',
|
||||
),
|
||||
SizedBox(
|
||||
height: 55.0,
|
||||
),
|
||||
Texts(
|
||||
overWeightBy.toStringAsFixed(1),
|
||||
fontSize: 40.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 25.0,
|
||||
),
|
||||
Texts(
|
||||
'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
|
||||
],
|
||||
),
|
||||
)
|
||||
: overWeightBy < -18
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Texts(
|
||||
'Under Weight',
|
||||
fontSize: 18.0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 55.0,
|
||||
),
|
||||
Texts(
|
||||
overWeightBy.toStringAsFixed(1),
|
||||
fontSize: 20.0,
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
height: 250.0,
|
||||
width: 350.0,
|
||||
child: Column(
|
||||
children: [
|
||||
Texts(
|
||||
'under wheight',
|
||||
fontSize: 20.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 55.0,
|
||||
),
|
||||
Texts(
|
||||
overWeightBy.toStringAsFixed(1),
|
||||
fontSize: 20.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 25.0,
|
||||
),
|
||||
Texts(
|
||||
'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,351 @@
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'ovulation_result_page.dart';
|
||||
|
||||
class OvulationPeriod extends StatefulWidget {
|
||||
@override
|
||||
_OvulationPeriodState createState() => _OvulationPeriodState();
|
||||
}
|
||||
|
||||
class _OvulationPeriodState extends State<OvulationPeriod> {
|
||||
DateTime bloodSugarDate = DateTime.now();
|
||||
DateTime timeSugarDate = DateTime.now();
|
||||
int cycleLength = 0;
|
||||
int lutealPhaseLength = 0;
|
||||
String selectedDate;
|
||||
var dateFrom = DateTime.now();
|
||||
var dateTo = DateTime.now();
|
||||
var conceivedDate = DateTime.now();
|
||||
var deliveryDue = DateTime.now();
|
||||
var dt = DateTime.now();
|
||||
var newFormat = DateFormat("yy-MM-dd");
|
||||
String updatedDt;
|
||||
|
||||
String getTime() {
|
||||
return " ${timeSugarDate.hour}:${timeSugarDate.minute}";
|
||||
}
|
||||
|
||||
String getDate() {
|
||||
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}";
|
||||
}
|
||||
|
||||
// void calculate() {}
|
||||
//
|
||||
// void calculateFertility(DateTime selectedDate) {const diff = Date.}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Ovulation Period',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 700.0,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts('Calculates Ovulation Period'),
|
||||
SizedBox(
|
||||
height: 12.0,
|
||||
),
|
||||
Divider(
|
||||
//height: 2,
|
||||
thickness: 2,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12.0,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
DatePicker.showDatePicker(
|
||||
context,
|
||||
showTitleActions: true,
|
||||
minTime: DateTime(DateTime.now().year - 1, 1, 1),
|
||||
maxTime: DateTime.now(),
|
||||
onConfirm: (date) {
|
||||
print('confirm $date');
|
||||
setState(() {
|
||||
bloodSugarDate = date;
|
||||
dateFrom = date.add(Duration(days: 10));
|
||||
updatedDt = DateFormat.yMMMEd().format(dateFrom);
|
||||
|
||||
dateTo = date.add(Duration(days: 20));
|
||||
conceivedDate = date.add(Duration(days: 14));
|
||||
deliveryDue = date.add(Duration(days: 280));
|
||||
});
|
||||
},
|
||||
currentTime: DateTime.now(),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
width: double.infinity,
|
||||
height: 65,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts('Date'),
|
||||
Texts(getDate()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Texts(
|
||||
'Average Cycle Length (usually 28 days):',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(cycleLength.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (cycleLength < 45)
|
||||
cycleLength++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (cycleLength > 0)
|
||||
cycleLength--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: cycleLength.toDouble(),
|
||||
min: 0,
|
||||
max: 45,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
cycleLength = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
'Average Luteal Phase Length (usually 14 days):',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 340.0,
|
||||
height: 60.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 8.0),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 60.0,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child:
|
||||
Text(lutealPhaseLength.toString()),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 38.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (lutealPhaseLength < 15)
|
||||
lutealPhaseLength++;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 18.0,
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (lutealPhaseLength > 0)
|
||||
lutealPhaseLength--;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: lutealPhaseLength.toDouble(),
|
||||
min: 0,
|
||||
max: 15,
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
lutealPhaseLength = newValue.round();
|
||||
});
|
||||
},
|
||||
activeColor: Color(0xffC5272D),
|
||||
inactiveColor: Color(0xffF3C5C6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 220.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 350.0,
|
||||
child: Button(
|
||||
label: 'CALCULATE',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
{
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => OvulationResult(
|
||||
conceivedDate: conceivedDate,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
deliveryDue: deliveryDue,
|
||||
)),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class OvulationResult extends StatelessWidget {
|
||||
var dateFrom;
|
||||
var dateTo;
|
||||
var conceivedDate;
|
||||
var deliveryDue;
|
||||
OvulationResult(
|
||||
{this.dateFrom, this.dateTo, this.deliveryDue, this.conceivedDate});
|
||||
//var newFormat = DateFormat("yy-MM-dd");
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Ovulation Period',
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: 750.0,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Texts(
|
||||
'The next ovulation period is estimated to be:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
'From:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(dateFrom),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'To:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(dateTo),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'Useful Information:',
|
||||
color: Color(0xffC5272D),
|
||||
),
|
||||
Texts(
|
||||
'You have conceived on:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(conceivedDate),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'The baby\'s age right now:',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
'5 Weeks, 2',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Texts(
|
||||
'The delivery due date is estimated to be on the: ',
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
Texts(
|
||||
DateFormat.yMMMEd().format(deliveryDue),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 21.0,
|
||||
),
|
||||
Container(
|
||||
width: 350,
|
||||
child: Button(
|
||||
label: 'See List Of Doctors',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,281 @@
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
|
||||
import 'health_calculator/bmi_calculator/bmi_calculator.dart';
|
||||
import 'health_calculator/bmr_calculator/bmr_calculator.dart';
|
||||
import 'health_calculator/calorie_calculator/calorie_calculator.dart';
|
||||
import 'health_calculator/delivery_due/delivery_due.dart';
|
||||
import 'health_calculator/ideal_body/ideal_body.dart';
|
||||
|
||||
class HealthCalculators extends StatefulWidget {
|
||||
@override
|
||||
_HealthCalculatorsState createState() => _HealthCalculatorsState();
|
||||
}
|
||||
|
||||
class _HealthCalculatorsState extends State<HealthCalculators>
|
||||
with SingleTickerProviderStateMixin {
|
||||
TabController _tabController;
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_tabController.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: 'Health Calculators',
|
||||
body: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(70.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
height: 60.0,
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
width: MediaQuery.of(context).size.width * 1.9,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 5.7,
|
||||
),
|
||||
),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Center(
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
indicatorWeight: 4.0,
|
||||
indicatorColor: Colors.red,
|
||||
labelColor: Theme.of(context).primaryColor,
|
||||
labelPadding:
|
||||
EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0),
|
||||
unselectedLabelColor: Colors.grey,
|
||||
tabs: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.35,
|
||||
child: Center(
|
||||
child: Texts('General Health'),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.35,
|
||||
child: Center(
|
||||
child: Texts("Women's Health"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: [
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 80,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(page: BMICalculator()),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'BMI',
|
||||
imagePath: 'bmi_health_calculator.png',
|
||||
subTitle: 'Calculators',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: CalorieCalculator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Calories',
|
||||
imagePath: 'calories-calculator.png',
|
||||
subTitle: 'Calculators',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: BmrCalculator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'BMR',
|
||||
imagePath: 'BMR_calculator.png',
|
||||
subTitle: 'Calculators',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: IdealBody(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Ideal Body',
|
||||
imagePath: 'body_weight.png',
|
||||
subTitle: 'Weight',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: BodyFat(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Body',
|
||||
imagePath: 'body_fat.png',
|
||||
subTitle: 'Fat',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: Carbs(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Carbohydrate',
|
||||
imagePath: 'carb_protein.png',
|
||||
subTitle: 'Protein Fat',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 80,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(page: OvulationPeriod()),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Ovulation',
|
||||
imagePath: 'ovulation_period_icon.png',
|
||||
subTitle: 'Period',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: DeliveryDue(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MedicalProfileItem(
|
||||
title: 'Delivery',
|
||||
imagePath: 'delivery_date_icon.png',
|
||||
subTitle: 'Due Date',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,322 @@
|
||||
import 'package:device_calendar/device_calendar.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.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';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
|
||||
enum Gender { Male, Female, NON }
|
||||
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
||||
|
||||
class AddNewChildPage extends StatefulWidget {
|
||||
final int frequency;
|
||||
final int days;
|
||||
final String itemDescription;
|
||||
String dateAdd;
|
||||
|
||||
List<DateTime> _scheduleList = List();
|
||||
List<DayOfWeek> daysOfWeek = [
|
||||
DayOfWeek.Monday,
|
||||
DayOfWeek.Tuesday,
|
||||
DayOfWeek.Wednesday,
|
||||
DayOfWeek.Thursday,
|
||||
DayOfWeek.Friday,
|
||||
DayOfWeek.Saturday,
|
||||
DayOfWeek.Sunday
|
||||
];
|
||||
|
||||
DateTime startDay;
|
||||
DateTime endDay;
|
||||
|
||||
//AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key);
|
||||
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
|
||||
startDay = DateTime.now();
|
||||
endDay =
|
||||
DateTime.now(); //endDay = DateTime.now().add(Duration(days: days));
|
||||
int hour = 24; //(24 / frequency).round();
|
||||
int durations = 24 ~/ hour;
|
||||
for (int count = 0; count < durations; count++) {
|
||||
_scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month,
|
||||
DateTime.now().day, (hour * count)));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
_AddNewChildPageState createState() => _AddNewChildPageState();
|
||||
}
|
||||
|
||||
class _AddNewChildPageState extends State<AddNewChildPage> {
|
||||
int tappedIndex;
|
||||
int checkedValue;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
tappedIndex = -1;
|
||||
}
|
||||
|
||||
TextEditingController _firstTextController = TextEditingController();
|
||||
TextEditingController _secondTextController = TextEditingController();
|
||||
TextEditingController _notesTextController = TextEditingController();
|
||||
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
||||
Gender gender = Gender.Male;
|
||||
CreateNewUser_New newUserChild = CreateNewUser_New();
|
||||
|
||||
//ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel();
|
||||
List_BabyInformationModel addvancedModel = List_BabyInformationModel();
|
||||
CreateNewBaby newChild = CreateNewBaby();
|
||||
List_UserInformationModel informationModel = List_UserInformationModel();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<AddNewChildViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: "Vaccintion",
|
||||
body: SingleChildScrollView(
|
||||
physics: ScrollPhysics(),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(12),
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Texts(
|
||||
"Add the child's information below to recieve the schedule of vaccinations.",
|
||||
//+model.user.firstName,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
NewTextFields(
|
||||
hintText: "First Name",
|
||||
controller: _firstTextController,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
NewTextFields(
|
||||
hintText: "Second Name",
|
||||
controller: _secondTextController,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Gender:",
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(12),
|
||||
|
||||
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: 175,
|
||||
color: Colors.white,
|
||||
child: SecondaryButton(
|
||||
textColor:
|
||||
checkedValue == 1 ? Colors.white : Colors.black,
|
||||
color: checkedValue == 1 ? Colors.red : Colors.white,
|
||||
|
||||
label: "Male",
|
||||
//
|
||||
onTap: () {
|
||||
|
||||
setState(() {
|
||||
checkedValue = 1;
|
||||
print("checkedValue=" + checkedValue.toString());
|
||||
});
|
||||
|
||||
// bloodDetails.
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: 175,
|
||||
color: Colors.white,
|
||||
child: SecondaryButton(
|
||||
textColor:
|
||||
checkedValue == 2 ? Colors.white : Colors.black,
|
||||
color: checkedValue == 2 ? Colors.red : Colors.white,
|
||||
label: "Female",
|
||||
//
|
||||
onTap: () {
|
||||
setState(() {
|
||||
checkedValue = 2;
|
||||
print("checkedValue=" + checkedValue.toString());
|
||||
});
|
||||
// bloodDetails.city=_selectedHospital.toString();
|
||||
|
||||
// bloodDetails.
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
//==========
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Date Of Birth::",
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
DatePicker.showDatePicker(
|
||||
context,
|
||||
showTitleActions: true,
|
||||
// minTime: DateTime(
|
||||
// DateTime.now().year, DateTime.now().month - 1, 1),
|
||||
minTime: DateTime(1, 1, 1),
|
||||
maxTime: DateTime.now(),
|
||||
onConfirm: (date) {
|
||||
setState(() {
|
||||
widget.startDay = date;
|
||||
});
|
||||
},
|
||||
currentTime: widget.startDay,
|
||||
// locale: projectViewModel.localeType
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
width: double.infinity,
|
||||
height: 65,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(//getStartDay()
|
||||
// DateUtil.yearMonthDay(DateTime.now())
|
||||
getStartDay()),
|
||||
Icon(
|
||||
Icons.calendar_today,
|
||||
color: Colors.black,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: SecondaryButton(
|
||||
textColor: Colors.white,
|
||||
color: checkedValue == false
|
||||
? Colors.white24
|
||||
: Color.fromRGBO(
|
||||
63,
|
||||
72,
|
||||
74,
|
||||
1,
|
||||
),
|
||||
label: "Add",
|
||||
//
|
||||
onTap: () async{
|
||||
newChild.babyName = _firstTextController.text + " " + _secondTextController.text;
|
||||
newChild.gender = checkedValue.toString();
|
||||
newChild.strDOB = getStartDay();
|
||||
newChild.tempValue = true;
|
||||
newChild.isLogin = true;
|
||||
|
||||
await model.createNewBabyOrders(newChild: newChild);
|
||||
if(model.isAdded){
|
||||
AppToast.showSuccessToast(message: "Record Added");
|
||||
Navigator.pop(context,model.isAdded);
|
||||
}else{
|
||||
|
||||
//TODO handling error
|
||||
}
|
||||
|
||||
},
|
||||
),
|
||||
),
|
||||
//=========
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// bottomSheet:
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getStartDay() {
|
||||
return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}";
|
||||
}
|
||||
|
||||
String getEndDay() {
|
||||
return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}";
|
||||
}
|
||||
|
||||
String getDateTime(DateTime dateTime) {
|
||||
return '${dateTime.hour}:${dateTime.minute}';
|
||||
}
|
||||
|
||||
String getDays() {
|
||||
String days = "";
|
||||
widget.daysOfWeek.forEach((element) {
|
||||
days += "${DateUtil.getDay(element)},";
|
||||
});
|
||||
return days;
|
||||
}
|
||||
|
||||
void confirmSelectDayDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: DayCheckBoxDialog(
|
||||
title: 'Select Day',
|
||||
selectedDaysOfWeek: widget.daysOfWeek,
|
||||
onValueSelected: (value) {
|
||||
setState(() {
|
||||
widget.daysOfWeek = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,202 @@
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.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';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
|
||||
import 'dialogs/delete_child.dart';
|
||||
|
||||
class ChildPage extends StatefulWidget {
|
||||
@override
|
||||
_ChildPageState createState() => _ChildPageState();
|
||||
}
|
||||
|
||||
class _ChildPageState extends State<ChildPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
|
||||
DeleteBaby deleteBaby = DeleteBaby();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var checkedValue = true;
|
||||
return BaseView<ChildVaccinesViewModel>(
|
||||
onModelReady: (model) => model.getNewUserOrders(),
|
||||
builder: (_, model, widget) => AppScaffold(
|
||||
isShowAppBar: true,
|
||||
appBarTitle: " Vaccination",
|
||||
baseViewModel: model,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15, top: 70),
|
||||
child: Column(
|
||||
children: [
|
||||
...List.generate(
|
||||
model.babyInformationModelList.length,
|
||||
(index) => Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 0, right: 0, bottom: 20),
|
||||
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
color: Colors.white, width: 0.5),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(5)),
|
||||
color: Colors.white,
|
||||
),
|
||||
padding: EdgeInsets.all(12),
|
||||
width: 200,//double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(children: [
|
||||
Texts("CHILD NAME"),
|
||||
]),
|
||||
Row(children: [
|
||||
Texts(model
|
||||
.babyInformationModelList[index]
|
||||
.babyName
|
||||
.trim()),
|
||||
]),
|
||||
Row(children: [
|
||||
IconButton(
|
||||
icon: Image.asset(model
|
||||
.babyInformationModelList[
|
||||
index]
|
||||
.gender ==
|
||||
1
|
||||
? 'assets/images/new-design/male.png'
|
||||
: 'assets/images/new-design/female.png'),
|
||||
tooltip: '',
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
// _volume += 10;
|
||||
// launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
|
||||
});
|
||||
},
|
||||
),
|
||||
Texts(model
|
||||
.babyInformationModelList[index]
|
||||
.genderDescription),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: Colors.red,
|
||||
),
|
||||
tooltip: '',
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
|
||||
|
||||
page: VaccinationTablePage(),
|
||||
|
||||
|
||||
),
|
||||
);
|
||||
|
||||
},
|
||||
)
|
||||
]),
|
||||
Row(children: [
|
||||
Texts("Birthday"),
|
||||
]),
|
||||
Row(children: [
|
||||
IconButton(
|
||||
icon: new Image.asset(
|
||||
'assets/images/new-design/calender-secondary.png'),
|
||||
tooltip: '',
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
),
|
||||
Texts(DateUtil.yearMonthDay(model
|
||||
.babyInformationModelList[index]
|
||||
.dOB)),
|
||||
]),
|
||||
Row(children: [
|
||||
IconButton(
|
||||
icon: new Image.asset(
|
||||
'assets/images/new-design/garbage.png'),
|
||||
tooltip: '',
|
||||
onPressed: ()async {
|
||||
|
||||
//=====================
|
||||
await model.deleteBabyOrders(newChild:deleteBaby );
|
||||
|
||||
|
||||
deleteBaby.babyID=model.babyInformationModelList[index]
|
||||
.babyID;
|
||||
|
||||
await model.deleteBabyOrders(newChild:deleteBaby );
|
||||
if(model.isDeleted){
|
||||
AppToast.showSuccessToast(message: "Record Deleted");
|
||||
Navigator.pop(context,model.isDeleted);
|
||||
}else{
|
||||
|
||||
//TODO handling error
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
),
|
||||
Texts("Delete"),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
|
||||
)
|
||||
],
|
||||
))
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: SecondaryButton(
|
||||
textColor: Colors.white,
|
||||
color: checkedValue == false
|
||||
? Colors.white24
|
||||
: Color.fromRGBO(
|
||||
63,
|
||||
72,
|
||||
74,
|
||||
1,
|
||||
),
|
||||
label: "ADD NEW CHILD ",
|
||||
//
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AddNewChildPage(),
|
||||
),
|
||||
).then((value) {
|
||||
if (value) model.getNewUserOrders();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,226 @@
|
||||
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/input/text_field.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';
|
||||
|
||||
|
||||
|
||||
class ChildVaccinesPage extends StatefulWidget {
|
||||
@override
|
||||
_ChildVaccinesPageState createState() => _ChildVaccinesPageState();
|
||||
}
|
||||
|
||||
class _ChildVaccinesPageState extends State<ChildVaccinesPage>
|
||||
with SingleTickerProviderStateMixin{
|
||||
TextEditingController titleController = TextEditingController();
|
||||
var checkedValue=false;
|
||||
String addEmail="";
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return BaseView<UserInformationViewModel>(
|
||||
onModelReady: (model) => model.getUserInformationRequestOrders(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
isShowAppBar: true,
|
||||
baseViewModel: model,
|
||||
appBarTitle: " Vaccination",//TranslationBase.of(context).advancePayment,
|
||||
body: SingleChildScrollView(
|
||||
physics: ScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child:Container(
|
||||
child: Texts("Welcome back",fontSize: 20,),
|
||||
) ,
|
||||
),
|
||||
Divider(color:Colors.black , indent: 10,
|
||||
endIndent: 10,),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child:Container(
|
||||
child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,),
|
||||
) ,
|
||||
),
|
||||
|
||||
Divider(color:Colors.black , indent: 10,
|
||||
endIndent: 10,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child:Container(
|
||||
|
||||
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
|
||||
child: TextFields(
|
||||
fillColor: Colors.red,
|
||||
|
||||
hintText: model.user.emailAddress,
|
||||
controller: titleController,
|
||||
fontSize: 20,
|
||||
hintColor: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
onChanged: (text) {
|
||||
addEmail=text;
|
||||
model.user.emailAddress==addEmail?checkedValue=false:checkedValue=true;
|
||||
|
||||
|
||||
},
|
||||
validator: (value) {
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return model.user.emailAddress;
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
return model.user.emailAddress;}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
|
||||
padding: EdgeInsets.all(15),
|
||||
child: SecondaryButton(
|
||||
textColor: Colors.white,
|
||||
color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,),
|
||||
label: "UPDATE EMAIL",
|
||||
//
|
||||
onTap: (){
|
||||
model.user.emailAddress=addEmail.toString();
|
||||
AppToast.showSuccessToast(
|
||||
message: "Email updated");
|
||||
// bloodDetails.city=_selectedHospital.toString();
|
||||
|
||||
// bloodDetails.
|
||||
},
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
|
||||
padding: EdgeInsets.all(15),
|
||||
child: SecondaryButton(
|
||||
textColor: Colors.white,
|
||||
color: Color.fromRGBO(63, 72, 74, 1,),
|
||||
label: " VIEW LIST OF CHILDREN",
|
||||
//
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: ChildPage(),
|
||||
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
// Texts(
|
||||
// // TranslationBase.of(context).advancePaymentLabel,
|
||||
// model.user.emailAddress,
|
||||
// textAlign: TextAlign.center,
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Center(
|
||||
// child: Container(
|
||||
// color: Colors.white,
|
||||
// width: 350,
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (_) =>
|
||||
// AssetGiffyDialog(
|
||||
// title: Text(
|
||||
// "",
|
||||
// style: TextStyle(
|
||||
// fontSize: 22.0,
|
||||
// fontWeight:
|
||||
// FontWeight
|
||||
// .w600),
|
||||
// ),
|
||||
// image: Image.asset(
|
||||
// 'assets/images/BloodChrt_EN.png'),
|
||||
// buttonCancelText:
|
||||
// Text('cancel'),
|
||||
// buttonCancelColor:
|
||||
// Colors.grey,
|
||||
// onlyCancelButton: true,
|
||||
// ));
|
||||
// },
|
||||
// child: Container(
|
||||
// width: 250,
|
||||
// height: 200,
|
||||
// child:Image.asset(
|
||||
// 'assets/images/BloodChrt_EN.png')),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.15,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SelectGenderDialog extends StatefulWidget {
|
||||
final Email;
|
||||
|
||||
const SelectGenderDialog({Key key, this.Email}) : super(key: key);
|
||||
@override
|
||||
_SelectGenderDialogState createState() => _SelectGenderDialogState();
|
||||
}
|
||||
|
||||
class _SelectGenderDialogState extends State<SelectGenderDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
children: [
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
//beneficiaryType = Gender.Male;
|
||||
});
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "),
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).cancel.toUpperCase(),
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 30,
|
||||
color: Colors.grey[500],
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
AppToast.showSuccessToast(message: "Email Sended");
|
||||
// widget.onValueSelected(beneficiaryType);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).ok,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class DeleteChild extends StatefulWidget {
|
||||
@override
|
||||
_DeleteChildState createState() => _DeleteChildState();
|
||||
}
|
||||
|
||||
class _DeleteChildState extends State<DeleteChild> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
children: [
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
//beneficiaryType = Gender.Male;
|
||||
});
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text("Delete the child "),
|
||||
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).cancel.toUpperCase(),
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 30,
|
||||
color: Colors.grey[500],
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
// widget.onValueSelected(beneficiaryType);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).ok,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
|
||||
import 'dialogs/SelectGenderDialog.dart';
|
||||
|
||||
class VaccinationTablePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var checkedValue;
|
||||
return BaseView<VaccinationTableViewModel>(
|
||||
onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
isShowAppBar: true,
|
||||
baseViewModel: model,
|
||||
appBarTitle: "Vaccination",
|
||||
body: SingleChildScrollView(
|
||||
child:Container(
|
||||
margin: EdgeInsets.only(left: 15,right: 15,top: 70),
|
||||
child: Column(
|
||||
children: [//babyInformationModelList.length
|
||||
...List.generate(model.creteVaccinationTableModelList.length, (index) =>
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.white, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: Colors.white,
|
||||
|
||||
),
|
||||
padding: EdgeInsets.all(12),
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
|
||||
children: [
|
||||
Row(children: [
|
||||
Text(model.creteVaccinationTableModelList[index].visit),
|
||||
SizedBox(width: 10,),
|
||||
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Html(
|
||||
// data:"<html><head><style type='text/css'>.Test {list-style-image:url('http://10.50.100.198:4444/Images/Bullet_List_Small.png');}</style></head><body><table><tr align='left'><td align='left'>BCG</td></tr><tr align='left'><td align='left'>HEPATITIS B</td></tr></table></body></html>"//model.creteVaccinationTableModelList[index].vaccinesDescription
|
||||
data:model.creteVaccinationTableModelList[index].vaccinesDescription,
|
||||
|
||||
),
|
||||
],),
|
||||
),
|
||||
Text(model.creteVaccinationTableModelList[index].givenAt),
|
||||
|
||||
|
||||
],),
|
||||
Divider(color:Colors.black ,),
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
width: double.infinity,
|
||||
|
||||
padding: EdgeInsets.all(12),
|
||||
child: SecondaryButton(
|
||||
textColor: Colors.white,
|
||||
color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,),
|
||||
label: "Send Email ",
|
||||
//
|
||||
onTap: () {
|
||||
//SelectGenderDialog();
|
||||
//===============
|
||||
showDialog(
|
||||
context: context,
|
||||
child: SelectGenderDialog(
|
||||
),
|
||||
);
|
||||
//=========
|
||||
}
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,599 @@
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart';
|
||||
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart';
|
||||
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||
import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
|
||||
class CovidTimeSlots extends StatefulWidget {
|
||||
int projectID;
|
||||
static bool areSlotsAvailable = false;
|
||||
static DateTime selectedAppoDateTime;
|
||||
static String selectedDate;
|
||||
static String selectedTime;
|
||||
|
||||
int selectedClinicID;
|
||||
int selectedDoctorID;
|
||||
|
||||
PatientShareResponse patientShareResponse;
|
||||
|
||||
CovidTimeSlots({@required this.projectID});
|
||||
|
||||
@override
|
||||
_CovidTimeSlotsState createState() => _CovidTimeSlotsState();
|
||||
}
|
||||
|
||||
class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
||||
with TickerProviderStateMixin {
|
||||
Map<DateTime, List> _events;
|
||||
AnimationController _animationController;
|
||||
CalendarController _calendarController;
|
||||
|
||||
AppSharedPreferences sharedPref = new AppSharedPreferences();
|
||||
|
||||
var selectedDate = "";
|
||||
dynamic selectedDateJSON;
|
||||
dynamic jsonFreeSlots;
|
||||
|
||||
List<TimeSlot> docFreeSlots = [];
|
||||
List<TimeSlot> dayEvents = [];
|
||||
|
||||
int selectedButtonIndex = 0;
|
||||
|
||||
dynamic freeSlotsResponse;
|
||||
|
||||
ScrollController _scrollController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
final _selectedDay = DateTime.now();
|
||||
|
||||
widget.patientShareResponse = new PatientShareResponse();
|
||||
|
||||
_scrollController = new ScrollController();
|
||||
|
||||
_events = {
|
||||
_selectedDay: ['Event A0']
|
||||
};
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => getCovidFreeSlots(context, widget.projectID));
|
||||
|
||||
_calendarController = CalendarController();
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 50),
|
||||
);
|
||||
|
||||
_animationController.forward();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
_calendarController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onDaySelected(DateTime day, List events) {
|
||||
final DateFormat formatter = DateFormat('yyyy-MM-dd');
|
||||
setState(() {
|
||||
this.selectedDate = DateUtil.getMonthDayYearDateFormatted(day);
|
||||
openTimeSlotsPickerForDate(day, docFreeSlots);
|
||||
CovidTimeSlots.selectedDate = formatter.format(day);
|
||||
print(CovidTimeSlots.selectedDate);
|
||||
});
|
||||
}
|
||||
|
||||
void _onVisibleDaysChanged(
|
||||
DateTime first, DateTime last, CalendarFormat format) {
|
||||
print('CALLBACK: _onVisibleDaysChanged');
|
||||
}
|
||||
|
||||
void _onCalendarCreated(
|
||||
DateTime first, DateTime last, CalendarFormat format) {
|
||||
print('CALLBACK: _onCalendarCreated');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: "COVID-19 TEST",
|
||||
isShowAppBar: true,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
"assets/images/new-design/covid-19-big-banner-bg.png"),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/new-design/covid-19-car.svg',
|
||||
width: 90.0,
|
||||
height: 90.0),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.0, right: 20.0, top: 40.0),
|
||||
child: Text("COVID-19 TEST",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24.0)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.0, right: 20.0, top: 10.0),
|
||||
child: Text("Drive-Thru",
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 24.0)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
color: Colors.white),
|
||||
margin: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 5.0),
|
||||
padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height * 0.65,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.all(10.0),
|
||||
child: Text(
|
||||
"Kindly select one of the available appointments from below: ",
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 16.0)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
alignment: Alignment.center,
|
||||
child: Text(selectedDate,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
margin: EdgeInsets.all(20.0),
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: dayEvents.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(right: 10.0),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
side: BorderSide(
|
||||
color: Colors.blue[400],
|
||||
//Color of the border
|
||||
style: BorderStyle.solid,
|
||||
//Style of the border
|
||||
width: 1.5, //width of the border
|
||||
),
|
||||
),
|
||||
minWidth:
|
||||
MediaQuery.of(context).size.width * 0.2,
|
||||
child: index == selectedButtonIndex
|
||||
? getSelectedButton(index)
|
||||
: getNormalButton(index)),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
_buildTableCalendarWithBuilders(),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 100.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
margin: EdgeInsets.all(10.0),
|
||||
child: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width * 0.7,
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xFF60686b),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: Colors.grey[500],
|
||||
onPressed: () {
|
||||
bookCovidTestAppointment();
|
||||
},
|
||||
child: Text("BOOK", style: TextStyle(fontSize: 18.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTableCalendarWithBuilders() {
|
||||
return TableCalendar(
|
||||
locale: 'en_US',
|
||||
calendarController: _calendarController,
|
||||
events: _events,
|
||||
initialCalendarFormat: CalendarFormat.month,
|
||||
startDay: DateTime.now(),
|
||||
formatAnimation: FormatAnimation.slide,
|
||||
startingDayOfWeek: StartingDayOfWeek.sunday,
|
||||
weekendDays: [DateTime.friday, DateTime.saturday],
|
||||
availableGestures: AvailableGestures.horizontalSwipe,
|
||||
availableCalendarFormats: const {
|
||||
CalendarFormat.month: '',
|
||||
CalendarFormat.week: '',
|
||||
},
|
||||
calendarStyle: CalendarStyle(
|
||||
outsideDaysVisible: false,
|
||||
weekendStyle: TextStyle().copyWith(color: Colors.blue[800]),
|
||||
holidayStyle: TextStyle().copyWith(color: Colors.blue[800]),
|
||||
),
|
||||
daysOfWeekStyle: DaysOfWeekStyle(
|
||||
weekendStyle: TextStyle().copyWith(color: Colors.blue[600]),
|
||||
),
|
||||
headerStyle: HeaderStyle(
|
||||
centerHeaderTitle: true,
|
||||
formatButtonVisible: false,
|
||||
),
|
||||
builders: CalendarBuilders(
|
||||
selectedDayBuilder: (context, date, _) {
|
||||
return FadeTransition(
|
||||
opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(4.0),
|
||||
padding: const EdgeInsets.only(top: 5.0, left: 6.0),
|
||||
color: Colors.transparent,
|
||||
width: 0,
|
||||
height: 0,
|
||||
child: Text(
|
||||
'${date.day}',
|
||||
style: TextStyle().copyWith(fontSize: 16.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
todayDayBuilder: (context, date, _) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: _calendarController.isSelected(date)
|
||||
? Colors.green[400]
|
||||
: _calendarController.isToday(date)
|
||||
? Colors.brown[300]
|
||||
: Colors.blue[400],
|
||||
),
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${date.day}',
|
||||
style: TextStyle().copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
markersBuilder: (context, date, events, holidays) {
|
||||
final children = <Widget>[];
|
||||
|
||||
if (events.isNotEmpty) {
|
||||
children.add(
|
||||
Positioned(
|
||||
right: 4,
|
||||
bottom: 4,
|
||||
child: _buildEventsMarker(date, events),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return children;
|
||||
},
|
||||
),
|
||||
onDaySelected: (date, events) {
|
||||
_onDaySelected(date, events);
|
||||
_animationController.forward(from: 0.0);
|
||||
},
|
||||
onVisibleDaysChanged: _onVisibleDaysChanged,
|
||||
onCalendarCreated: _onCalendarCreated,
|
||||
);
|
||||
}
|
||||
|
||||
openTimeSlotsPickerForDate(DateTime dateStart, List<TimeSlot> freeSlots) {
|
||||
dayEvents.clear();
|
||||
DateTime dateStartObj = new DateTime(
|
||||
dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0);
|
||||
|
||||
freeSlots.forEach((v) {
|
||||
if (v.start == dateStartObj) dayEvents.add(v);
|
||||
});
|
||||
|
||||
setState(() {
|
||||
if (dayEvents.length != 0)
|
||||
CovidTimeSlots.areSlotsAvailable = true;
|
||||
else
|
||||
CovidTimeSlots.areSlotsAvailable = false;
|
||||
|
||||
selectedButtonIndex = 0;
|
||||
|
||||
CovidTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime;
|
||||
});
|
||||
}
|
||||
|
||||
Future<Map<DateTime, List>> _getJSONSlots() async {
|
||||
Map<DateTime, List> _eventsParsed;
|
||||
List<FreeSlot> slotsList = [];
|
||||
DateTime date;
|
||||
final DateFormat formatter = DateFormat('HH:mm');
|
||||
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
|
||||
for (var i = 0; i < freeSlotsResponse.length; i++) {
|
||||
date =
|
||||
DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']);
|
||||
slotsList.add(FreeSlot(date, ['slot']));
|
||||
docFreeSlots.add(TimeSlot(
|
||||
isoTime: formatter.format(date),
|
||||
start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0),
|
||||
end: date));
|
||||
}
|
||||
_eventsParsed =
|
||||
Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event);
|
||||
setState(() {
|
||||
CovidTimeSlots.selectedDate = dateFormatter.format(
|
||||
DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots']));
|
||||
selectedDate = DateUtil.getMonthDayYearDateFormatted(
|
||||
DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots']));
|
||||
selectedDateJSON = freeSlotsResponse[0]['FreeTimeSlots'];
|
||||
});
|
||||
openTimeSlotsPickerForDate(
|
||||
DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots);
|
||||
_calendarController
|
||||
.setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON));
|
||||
return _eventsParsed;
|
||||
}
|
||||
|
||||
Widget _buildEventsMarker(DateTime date, List events) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: _calendarController.isSelected(date)
|
||||
? Colors.green[400]
|
||||
: _calendarController.isToday(date)
|
||||
? Colors.brown[300]
|
||||
: Colors.blue[400],
|
||||
),
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${date.day}',
|
||||
style: TextStyle().copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getNormalButton(int index) {
|
||||
return RaisedButton(
|
||||
color: Colors.white,
|
||||
textColor: new Color(0xFF60686b),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
selectedButtonIndex = index;
|
||||
CovidTimeSlots.selectedTime = dayEvents[index].isoTime;
|
||||
print(CovidTimeSlots.selectedTime);
|
||||
});
|
||||
},
|
||||
child: Text(dayEvents[index].isoTime,
|
||||
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSelectedButton(int index) {
|
||||
return RaisedButton(
|
||||
color: Colors.blue[400],
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
selectedButtonIndex = index;
|
||||
CovidTimeSlots.selectedTime = dayEvents[index].isoTime;
|
||||
print(CovidTimeSlots.selectedTime);
|
||||
});
|
||||
},
|
||||
child: Text(dayEvents[index].isoTime,
|
||||
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
||||
);
|
||||
}
|
||||
|
||||
bookCovidTestAppointment() {
|
||||
// Navigator.push(context,
|
||||
// MaterialPageRoute(builder: (context) => CovidPaymentAlert()));
|
||||
|
||||
DoctorList docObject = new DoctorList();
|
||||
docObject.doctorID = widget.selectedDoctorID;
|
||||
docObject.clinicID = widget.selectedClinicID;
|
||||
docObject.projectID = widget.projectID;
|
||||
insertAppointmentCovidTest(context, docObject);
|
||||
}
|
||||
|
||||
insertAppointmentCovidTest(context, DoctorList docObject) {
|
||||
DoctorsListService service = new DoctorsListService();
|
||||
AppoitmentAllHistoryResultList appo;
|
||||
service
|
||||
.insertAppointment(
|
||||
docObject.doctorID,
|
||||
docObject.clinicID,
|
||||
docObject.projectID,
|
||||
CovidTimeSlots.selectedTime,
|
||||
CovidTimeSlots.selectedDate,
|
||||
context)
|
||||
.then((res) {
|
||||
print(res);
|
||||
if (res['MessageStatus'] == 1) {
|
||||
AppToast.showSuccessToast(message: "Appointment Booked Successfully");
|
||||
Future.delayed(new Duration(milliseconds: 1800), () {
|
||||
getPatientShare(context, res['AppointmentNo'], docObject.clinicID,
|
||||
docObject.projectID, docObject);
|
||||
});
|
||||
} else {
|
||||
appo = new AppoitmentAllHistoryResultList();
|
||||
appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo'];
|
||||
appo.clinicID = res['SameClinicApptList'][0]['DoctorID'];
|
||||
appo.projectID = res['SameClinicApptList'][0]['ProjectID'];
|
||||
appo.endTime = res['SameClinicApptList'][0]['EndTime'];
|
||||
appo.startTime = res['SameClinicApptList'][0]['StartTime'];
|
||||
appo.doctorID = res['SameClinicApptList'][0]['DoctorID'];
|
||||
appo.isLiveCareAppointment = false;
|
||||
appo.originalClinicID = 0;
|
||||
appo.originalProjectID = 0;
|
||||
appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate'];
|
||||
|
||||
ConfirmDialog dialog = new ConfirmDialog(
|
||||
context: context,
|
||||
confirmMessage: res['ErrorEndUserMessage'],
|
||||
okText: TranslationBase.of(context).confirm,
|
||||
cancelText: TranslationBase.of(context).cancel_nocaps,
|
||||
okFunction: () => {cancelAppointment(docObject, appo, context)},
|
||||
cancelFunction: () => {});
|
||||
dialog.showAlertDialog(context);
|
||||
}
|
||||
}).catchError((err) {
|
||||
AppToast.showErrorToast(message: err);
|
||||
print(err);
|
||||
}).showProgressBar(
|
||||
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||
}
|
||||
|
||||
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo,
|
||||
BuildContext context) {
|
||||
ConfirmDialog.closeAlertDialog(context);
|
||||
DoctorsListService service = new DoctorsListService();
|
||||
service.cancelAppointment(appo, context).then((res) {
|
||||
if (res['MessageStatus'] == 1) {
|
||||
Future.delayed(new Duration(milliseconds: 1500), () {
|
||||
insertAppointmentCovidTest(context, docObject);
|
||||
});
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||
}
|
||||
}).catchError((err) {
|
||||
print(err);
|
||||
}).showProgressBar(
|
||||
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||
}
|
||||
|
||||
getPatientShare(context, String appointmentNo, int clinicID, int projectID,
|
||||
DoctorList docObject) {
|
||||
DoctorsListService service = new DoctorsListService();
|
||||
service
|
||||
.getPatientShare(appointmentNo, clinicID, projectID, context)
|
||||
.then((res) {
|
||||
print(res);
|
||||
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
|
||||
})
|
||||
.catchError((err) {
|
||||
print(err);
|
||||
})
|
||||
.showProgressBar(
|
||||
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
|
||||
.then((value) {
|
||||
navigateToPaymentAlert();
|
||||
});
|
||||
}
|
||||
|
||||
navigateToPaymentAlert() {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CovidPaymentAlert(
|
||||
patientShareResponse: widget.patientShareResponse)));
|
||||
}
|
||||
|
||||
getCovidFreeSlots(BuildContext context, int projectID) {
|
||||
CovidDriveThruService service = new CovidDriveThruService();
|
||||
service.getCovidFreeSlots(context, projectID).then((res) {
|
||||
print(res['COVID19_FreeTimeSlots']);
|
||||
if (res['MessageStatus'] == 1) {
|
||||
if (res['COVID19_FreeTimeSlots'].length != 0) {
|
||||
freeSlotsResponse = res['COVID19_FreeTimeSlots'];
|
||||
print(res['COVID19_FreeTimeSlots'].length);
|
||||
_getJSONSlots().then((value) => {
|
||||
setState(() => {
|
||||
widget.selectedClinicID =
|
||||
freeSlotsResponse[0]['ClinicID'],
|
||||
widget.selectedDoctorID =
|
||||
freeSlotsResponse[0]['DoctorID'],
|
||||
_events.clear(),
|
||||
_events = value
|
||||
})
|
||||
});
|
||||
} else {}
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||
}
|
||||
}).catchError((err) {
|
||||
print(err);
|
||||
}).showProgressBar(
|
||||
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,257 @@
|
||||
import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart';
|
||||
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.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:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class CovidPaymentDetails extends StatefulWidget {
|
||||
CovidPaymentInfoResponse covidPaymentInfoResponse;
|
||||
int projectID;
|
||||
|
||||
CovidPaymentDetails(
|
||||
{@required this.covidPaymentInfoResponse, @required this.projectID});
|
||||
|
||||
@override
|
||||
_CovidPaymentDetailsState createState() => _CovidPaymentDetailsState();
|
||||
}
|
||||
|
||||
class _CovidPaymentDetailsState extends State<CovidPaymentDetails> {
|
||||
bool isAgree = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: "COVID-19 TEST",
|
||||
isShowAppBar: true,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 150.0,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
"assets/images/new-design/covid-19-big-banner-bg.png"),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/new-design/covid-19-car.svg',
|
||||
width: 90.0,
|
||||
height: 90.0),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.0, right: 20.0, top: 40.0),
|
||||
child: Text("COVID-19 TEST",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24.0)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.0, right: 20.0, top: 10.0),
|
||||
child: Text("Drive-Thru",
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 24.0)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
color: Colors.white),
|
||||
margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 5.0),
|
||||
padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
margin:
|
||||
EdgeInsets.only(left: 0.0, right: 20.0, top: 30.0),
|
||||
child: Text("Test Fees",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.0,
|
||||
fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Table(
|
||||
children: [
|
||||
TableRow(children: [
|
||||
TableCell(
|
||||
child: _getNormalText(TranslationBase.of(context)
|
||||
.patientShareToDo)),
|
||||
TableCell(
|
||||
child: _getNormalText(widget
|
||||
.covidPaymentInfoResponse.patientShareField
|
||||
.toString())),
|
||||
]),
|
||||
TableRow(children: [
|
||||
TableCell(
|
||||
child: _getNormalText(
|
||||
TranslationBase.of(context).patientTaxToDo)),
|
||||
TableCell(
|
||||
child: _getNormalText(widget
|
||||
.covidPaymentInfoResponse
|
||||
.patientTaxAmountField
|
||||
.toString())),
|
||||
]),
|
||||
TableRow(children: [
|
||||
TableCell(
|
||||
child: _getNormalText(TranslationBase.of(context)
|
||||
.patientShareTotalToDo)),
|
||||
TableCell(
|
||||
child: _getNormalText(widget
|
||||
.covidPaymentInfoResponse
|
||||
.patientShareWithTaxField
|
||||
.toString())),
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 5.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: isAgree,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
isAgree = !isAgree;
|
||||
});
|
||||
},
|
||||
activeColor: Colors.blue,
|
||||
),
|
||||
Texts(TranslationBase.of(context)
|
||||
.iAgreeToTheTermsAndConditions),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 5.0),
|
||||
child: Text("You can pay by following options: ",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: "Open-Sans")),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0),
|
||||
child: Image.asset(
|
||||
"assets/images/new-design/payment_options_invoice_confirmation.png",
|
||||
width: 300),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 20.0),
|
||||
child: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width * 0.7,
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xFF60686b),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: Colors.grey[500],
|
||||
onPressed: () {
|
||||
cancel();
|
||||
},
|
||||
child: Text("CANCEL", style: TextStyle(fontSize: 18.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width * 0.7,
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xFF60686b),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: Colors.grey[500],
|
||||
onPressed: isAgree ? next : null,
|
||||
child: Text("NEXT", style: TextStyle(fontSize: 18.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void next() {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CovidTimeSlots(
|
||||
projectID: widget.projectID,
|
||||
)));
|
||||
}
|
||||
|
||||
cancel() {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
_getNormalText(text) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 20.0, right: 10.0),
|
||||
child: Text(text,
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontFamily: 'Open-Sans',
|
||||
letterSpacing: 0.5,
|
||||
color: Colors.grey[700])),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScheduleClinicCard extends StatefulWidget {
|
||||
bool isSelected;
|
||||
final ClinicsHaveScheduleList clinicsHaveScheduleList;
|
||||
var languageID;
|
||||
|
||||
ScheduleClinicCard(
|
||||
{this.isSelected,
|
||||
this.languageID,
|
||||
@required this.clinicsHaveScheduleList});
|
||||
|
||||
@override
|
||||
_ScheduleClinicCardState createState() => _ScheduleClinicCardState();
|
||||
}
|
||||
|
||||
class _ScheduleClinicCardState extends State<ScheduleClinicCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Card(
|
||||
margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0),
|
||||
color: widget.isSelected ? Colors.blue : Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
widget.languageID == 'ar'
|
||||
? widget.clinicsHaveScheduleList.clinicDescN
|
||||
: widget.clinicsHaveScheduleList.clinicDesc,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color:
|
||||
widget.isSelected ? Colors.white : Colors.black)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,227 @@
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class LiveCareTypeSelect extends StatefulWidget {
|
||||
@override
|
||||
_LiveCareTypeSelectState createState() => _LiveCareTypeSelectState();
|
||||
}
|
||||
|
||||
class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
|
||||
var languageID;
|
||||
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getLanguageID();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context, null);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
title: Text(TranslationBase.of(context).bookAppo,
|
||||
style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 20.0, right: 20.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(top: 15.0, bottom: 10.0),
|
||||
child: Image.asset(
|
||||
languageID == 'ar'
|
||||
? "assets/images/new-design/liveCare_ar_bg.png"
|
||||
: "assets/images/new-design/liveCare_en_bg.png",
|
||||
width: 120),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text("LiveCare Service",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 20.0))),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"is to obtain medical advice with a specialist doctor Via a video call",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 18.0))),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 15.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("WHY LIVECARE?",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 20.0))),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20.0, left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SvgPicture.asset("assets/images/new-design/check_icon.svg",
|
||||
width: 25),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.72,
|
||||
margin: EdgeInsets.all(10.0),
|
||||
child: Text(
|
||||
"No need to wait, you will get Medical consultation immediately via Video call.",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(fontSize: 14.0)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0, left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SvgPicture.asset("assets/images/new-design/check_icon.svg",
|
||||
width: 25),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.72,
|
||||
margin: EdgeInsets.all(10.0),
|
||||
child: Text("The doctor will see your medical file.",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(fontSize: 14.0)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0, left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SvgPicture.asset("assets/images/new-design/check_icon.svg",
|
||||
width: 25),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.72,
|
||||
margin: EdgeInsets.all(10.0),
|
||||
child: Text("Free Prescription delivery service.",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(fontSize: 14.0)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20.0),
|
||||
child: Text(
|
||||
"** The service is included with some insurance companies according to the terms and conditions With our best wishes for health and wellness",
|
||||
style: TextStyle(fontSize: 16.0))),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Navigator.pop(context, "immediate");
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red[900],
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
height: 120.0,
|
||||
margin: EdgeInsets.only(top: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.0),
|
||||
child: SvgPicture.asset(
|
||||
"assets/images/new-design/liveCare_logo_icon_white.svg",
|
||||
width: 80),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.56,
|
||||
margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text("Get Medical consultation immediately",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18.0,
|
||||
color: Colors.white)),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("Instant video call",
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, color: Colors.white)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Navigator.pop(context, "schedule");
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[700],
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
height: 120.0,
|
||||
margin: EdgeInsets.only(top: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.0),
|
||||
child: Image.asset(
|
||||
"assets/images/new-design/calendar.png",
|
||||
width: 70),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.58,
|
||||
margin: EdgeInsets.fromLTRB(30.0, 30.0, 0.0, 0.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("Book Appointment",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18.0,
|
||||
color: Colors.white)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("Schedule Video Call",
|
||||
style: TextStyle(
|
||||
fontSize: 18.0, color: Colors.white)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getLanguageID() async {
|
||||
var languageID = await sharedPref.getString(APP_LANGUAGE);
|
||||
setState(() {
|
||||
this.languageID = languageID;
|
||||
});
|
||||
}
|
||||
}
|
||||