patient dashboard

master
Sneha 8 months ago
parent a771c0829a
commit 4cb7b6093c

@ -14,6 +14,8 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<application
android:label="doctor"
android:name="${applicationName}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:doctor/common/qrcode_display.dart';
import 'package:doctor/common/updateprofile.dart';
import 'package:doctor/connected_patients/connected_patients.dart';
import 'package:doctor/patient_dashboard/patient_dashboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
@ -149,7 +150,7 @@ class _DashboardState extends State<Dashboard> {
),
],
),
/*Column(
Column(
children: [
GestureDetector(
child: Container(
@ -160,23 +161,23 @@ class _DashboardState extends State<Dashboard> {
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/reports.png"), // picked file
"images/myconnections.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
*//*Navigator.push(
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AllReports()),
);*//*
builder: (context) => const PatientDashboard()),
);
},
),
Text(
'Records',
'Patient Dashboard',
style: dashboardTextStyle(),
),
],
),*/
),
],
),
),
@ -622,6 +623,34 @@ class _DashboardState extends State<Dashboard> {
);
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/editprofile.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('Video Call', style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UpdateProfile()),
);
},
),
/*Divider(
color: Colors.grey,
),

@ -199,6 +199,48 @@ InputDecoration textFormFieldDecoration(IconData icon, var text) {
);
}
InputDecoration textFormFieldDecorationGrey(IconData icon, var text) {
return InputDecoration(
prefixIcon: Icon(
icon,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: text,
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
);
}
InputDecoration textFormFieldDecorationInsideApp(IconData icon, var text) {
return InputDecoration(
prefixIcon: Icon(
icon,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: text,
labelStyle: TextStyle(
color: primaryColor, //<-- SEE HERE
),
);
}
InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
return InputDecoration(
//filled: true,
@ -216,7 +258,7 @@ InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
),
labelText: text,
labelStyle: TextStyle(
//color: Colors.black, //<-- SEE HERE
color: Colors.grey, //<-- SEE HERE
),
);
}
@ -283,9 +325,37 @@ class AppSettings {
static String generateQRCodeUrl = host + 'generate-qrcode-doctor';
static String getAllConectedPatientsDataUrl = host + 'customerDetails';
static String getRecordsDataUrl = host + 'getAllRecords';
static String deleteRecordUrl = host + 'deleteRecord';
static String getDynamicCodeUrl = host + 'records';
static String dynamicCodeVerificationUrl = host + 'verifyDynamicCode';
static String getPatientInformationBasedOnMobileNumberUrl = host + 'getInfoCustomerDataPhone';
static String getBmiHistoryUrl = host + 'usersbmi';
static String getBpHistoryUrl = host + 'usersbp';
static String getSugarHistoryUrl = host + 'userssugar';
static String bmiCaluculateUrl = host + 'insertBMI';
static String bpCaluculateUrl = host + 'insertBP';
static String sugarCaluculateUrl = host + 'insertSugar';
static String deleteBMIDetailsUrl = host + 'deleteBMI';
static String deleteBPDetailsUrl = host + 'deleteBP';
static String deleteSugarDetailsUrl = host + 'deleteSugar';
static String findingsUploadPicUrl = host + 'uploads-findings-prescription';
static String addFindingsUrl = host + 'update-uploads-findingsPictureId-prescription';
static String addReportsUrl = host + 'update-uploads-reportsPictureId-prescription';
static String addPrescriptionsUrl = host + 'update-uploads-prescriptionPictureId-prescription';
static String updateFindingsUploadPicUrl = host + 'update-uploads-findings-prescription';
static String updateReportsUploadPicUrl = host + 'update-uploads-reports-prescription';
static String reportsUploadPicUrl = host + 'uploads-reports-prescription';
static String prescriptionUploadPicUrl = host + 'uploads-prescription-prescription';
static String updatePrescriptionPicUrl = host + 'update-uploads-prescription-prescription';
static String deleteRecordsUrl = host + 'delete-url';
static String updateRecordsUrl = host + 'records';
static String deleteFindingsUrl = host + 'delete-uploads-findings';
static String deletePrescriptionsUrl = host + 'delete-prescription';
static String deleteReportsUrl = host + 'delete-report';
static String getAllConnectedDoctorsDataUrl = host + 'connected-doctors';
static String addRecordsUrl = host + 'add-record';
static String addPrescriptionUrl = host + 'add-prescription-details';
static String getAllReportProblemDetalisUrl = host + 'userreport';
static File? updatedImage;
@ -615,6 +685,37 @@ class AppSettings {
}
}
static Future<bool> deleteRecord(recordId) async {
var uri = Uri.parse(deleteRecordUrl + '/' + recordId);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<String> getDynamicCode(payload) async {
var uri = Uri.parse(getDynamicCodeUrl );
//uri = uri.replace(query: 'customerId=$customerId');
@ -662,6 +763,742 @@ class AppSettings {
}
}
static Future<String> getPatientInformationBasedOnMobileNumber(phoneNumber) async {
var uri = Uri.parse(getPatientInformationBasedOnMobileNumberUrl + '/' + phoneNumber);
//uri = uri.replace(query: 'customerId=$customerId');
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> getBmiHistory(var customerId) async {
var uri = Uri.parse(getBmiHistoryUrl + '/' + customerId);
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> getBPHistory(var customerId) async {
var uri = Uri.parse(getBpHistoryUrl + '/' + customerId);
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> getSugarHistory(var customerId) async {
var uri = Uri.parse(getSugarHistoryUrl + '/' + customerId);
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> calculateBmi(payload,customerId) async {
var uri = Uri.parse(bmiCaluculateUrl + '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> calculateBP(payload,customerId) async {
var uri = Uri.parse(bpCaluculateUrl + '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> calculateSugar(payload,customerId) async {
var uri = Uri.parse(sugarCaluculateUrl + '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<bool> deleteBMIDetails(bmiId,customerId) async {
var uri = Uri.parse(deleteBMIDetailsUrl + '/' + customerId+'/'+ bmiId);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<bool> deleteBPDetails(bmiId,customerId) async {
var uri = Uri.parse(deleteBPDetailsUrl + '/' + customerId+'/'+ bmiId);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<bool> deleteSugarDetails(bmiId,customerId) async {
var uri = Uri.parse(deleteSugarDetailsUrl + '/' + customerId+'/'+ bmiId);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
/*upload and update findings*/
static Future<String> uploadFindingsGallery(file,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(findingsUploadPicUrl + '/' + customerId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> uploadFindingsCamera(file,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(findingsUploadPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addFindingsGallery(file,pictureId,customerId) async {
var request = http.MultipartRequest(
'PUT', Uri.parse(addFindingsUrl + '/' + customerId+"/"+pictureId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addFindingsCamera(file,pictureId,customerId) async {
var request = http.MultipartRequest('PUT', Uri.parse(addFindingsUrl + '/' + customerId+"/"+pictureId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updateFindingsGallery(file,var recordId,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(updateFindingsUploadPicUrl + '/' + customerId+'/'+recordId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updateFindingsCamera(file,var recordId,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(updateFindingsUploadPicUrl + '/' + customerId+'/'+recordId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
/*End*/
/*upload and update Reports*/
static Future<String> uploadReportsGallery(file,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(reportsUploadPicUrl + '/' + customerId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> uploadReportsCamera(file,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(reportsUploadPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addReportsGallery(file,pictureId,customerId) async {
var request = http.MultipartRequest(
'PUT', Uri.parse(addReportsUrl + '/' + customerId+"/"+pictureId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addReportsCamera(file,pictureId,customerId) async {
var request = http.MultipartRequest('PUT', Uri.parse(addReportsUrl + '/' + customerId+"/"+pictureId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updateReportsGallery(file,var recordId,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(updateReportsUploadPicUrl + '/' + customerId+'/'+recordId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updateReportsCamera(file,var recordId,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(updateReportsUploadPicUrl + '/' + customerId+'/'+recordId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
/*End*/
/*upload and update Prescriptions*/
static Future<String> uploadPrescriptionsGallery(file,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> uploadPrescriptionsCamera(file,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addPrescriptionsGallery(file,pictureId,customerId) async {
var request = http.MultipartRequest(
'PUT', Uri.parse(addPrescriptionsUrl + '/' + customerId+"/"+pictureId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> addPrescriptionsCamera(file,pictureId,customerId) async {
var request = http.MultipartRequest('PUT', Uri.parse(addPrescriptionsUrl + '/' + customerId+"/"+pictureId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updatePrescriptionsGallery(file,var recordId,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(updatePrescriptionPicUrl + '/' + customerId+'/'+recordId));
if (file.length > 0) {
for (var i = 0; i < file.length; i++) {
request.files.add(await http.MultipartFile.fromPath('picture', file[i].path));
}}
// request.files.add(await http.MultipartFile.fromPath('picture', images.toString().replaceAll('[', '').replaceAll(']','')));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> updatePrescriptionsCamera(file,var recordId,customerId) async {
var request = http.MultipartRequest('POST', Uri.parse(updatePrescriptionPicUrl + '/' + customerId+'/'+recordId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
/*End*/
static Future<String> deleteRecordsNew(payload, recordId,customerId) async {
var uri = Uri.parse(deleteRecordsUrl + '/' + customerId+'/'+recordId);
try {
var response = await http.post(uri, body: json.encode(payload),headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
} catch (e) {
print(e);
return '';
}
}
static Future<bool> updateRecord(payload,recordId) async {
var uri = Uri.parse(updateRecordsUrl + '/' + recordId);
var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
print(e);
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> deleteFindings(fileName,findingsId,customerId) async {
var uri = Uri.parse(deleteFindingsUrl + '/' + customerId+'/'+findingsId+'/'+fileName);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
} catch (e) {
print(e);
return '';
}
}
static Future<String> deletePrescriptions(fileName,prescriptionId,customerId) async {
var uri = Uri.parse(deletePrescriptionsUrl + '/' + customerId+'/'+prescriptionId+'/'+fileName);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
} catch (e) {
print(e);
return '';
}
}
static Future<String> deleteReports(fileName,reportsId,customerId) async {
var uri = Uri.parse(deleteReportsUrl + '/' + customerId+'/'+reportsId+'/'+fileName);
try {
var response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.delete(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
} catch (e) {
print(e);
return '';
}
}
static Future<String> getAllConnectedDoctors(customerId) async {
var uri = Uri.parse(getAllConnectedDoctorsDataUrl + '/' + customerId);
//uri = uri.replace(query: 'customerId=$customerId');
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<bool> addRecords(payload,customerId) async {
var uri = Uri.parse(addRecordsUrl + '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
print(e);
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> uploadImageHTTPForPrescriptions(file,customerId) async {
var request = http.MultipartRequest(
'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<bool> addPrescription(payload,customerId) async {
var uri = Uri.parse(addPrescriptionUrl + '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
print(e);
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> getAllReportProblemDetalis(customerId) async {
var uri = Uri.parse(getAllReportProblemDetalisUrl+'/'+customerId);
//uri = uri.replace(query: 'customerId=$customerId');
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
/*Apis ends here*/

@ -0,0 +1,33 @@
import 'package:intl/intl.dart';
class AllProblemsModel {
String problem='';
String audio='';
String description='';
String video='';
String date='';
String problemId='';
List picture = [];
String image='';
bool isAudioButtonEnabled=false;
DateTime dateForFilter=new DateTime.now();
String dateNew='';
AllProblemsModel();
factory AllProblemsModel.fromJson(Map<String, dynamic> json){
AllProblemsModel rtvm = new AllProblemsModel();
rtvm.problem = json['name'] ?? '';
rtvm.audio = json['audio'] ?? '';
rtvm.description = json['description'] ?? '';
rtvm.video = json['video'] ?? '';
rtvm.date = json['date'] ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
rtvm.problemId = json['reportId'] ?? '';
rtvm.picture = json['picture'] ?? [];
rtvm.image=json['picture'][0]['url']??'';
return rtvm;
}
}

@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class BmiHistoryModel {
String bmiValue = '';
String height= '';
String weight= '';
String date= '';
String actualDate= '';
String displayDate='';
DateTime dateForFilter=new DateTime.now();
String bmiInfoId = '';
String bmiText = '';
Color bmiTextColor = Colors.black;
var number1;
var number2;
BmiHistoryModel();
factory BmiHistoryModel.fromJson(Map<String, dynamic> json){
BmiHistoryModel rtvm = new BmiHistoryModel();
rtvm.bmiValue = json['bmivalue'].toString() ?? '';
rtvm.bmiInfoId = json['bmiinfoid'].toString() ?? '';
rtvm.height = json['height'].toString() ?? '';
rtvm.weight = json['weight'].toString() ?? '';
rtvm.number1 = double.parse( rtvm.bmiValue);
rtvm.number2 = double.parse( rtvm.bmiValue);
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
if(double.parse(rtvm.bmiValue)<18.5){
rtvm.bmiText='Underweight';
rtvm.bmiTextColor=Colors.red;
}
else if(double.parse(rtvm.bmiValue)>=18.5&&double.parse(rtvm.bmiValue)<=24.9){
rtvm.bmiText='Normal weight';
rtvm.bmiTextColor=buttonColors;
}
else if(double.parse(rtvm.bmiValue)>=25&&double.parse(rtvm.bmiValue)<=29.9){
rtvm.bmiText='Overweight';
rtvm.bmiTextColor=Colors.red;
}
else if(double.parse(rtvm.bmiValue)>=30){
rtvm.bmiText='Obesity';
rtvm.bmiTextColor=Colors.red;
}
return rtvm;
}
}

@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class BPHistoryModel {
String bpText = '';
String systolic= '';
String diastolic= '';
String date= '';
String bpId= '';
String displayDate='';
String actualDate='';
DateTime dateForFilter=new DateTime.now();
BPHistoryModel();
factory BPHistoryModel.fromJson(Map<String, dynamic> json){
BPHistoryModel rtvm = new BPHistoryModel();
rtvm.bpText = json['bpCategory'].toString() ?? '';
rtvm.systolic = json['Systolic'].toString() ?? '';
rtvm.diastolic = json['Diastolic'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.bpId= json['bpinfoid'].toString() ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
}
}

@ -0,0 +1,30 @@
class GetConnectedDoctorsModel {
String doctor_name='';
String doctor_id='';
String specialization='';
String qualification='';
String practiceplace1='';
String practiceplace2='';
String practiceplace3='';
String hospital_name='';
GetConnectedDoctorsModel();
factory GetConnectedDoctorsModel.fromJson(Map<String, dynamic> json){
GetConnectedDoctorsModel rtvm = new GetConnectedDoctorsModel();
rtvm.doctor_name = json['doctorName'] ?? '';
rtvm.specialization = json['specialization'] ?? '';
rtvm.qualification = json['qualification'] ?? '';
rtvm.doctor_id = json['doctorId'] ?? '';
rtvm.hospital_name = json['placeOfPractice'][0]['hospitalName'] ?? '';
return rtvm;
}
}

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
class PrescriptionsModel {
String prescription_name = '';
String patient_name='';
String prescription_url='';
String age='';
String gender='';
String patient_type='';
List prescriptionUrls=[];
PrescriptionsModel();
factory PrescriptionsModel.fromJson(Map<String, dynamic> json){
PrescriptionsModel rtvm = new PrescriptionsModel();
rtvm.prescriptionUrls=json['precription']??[];
/*rtvm.prescription_name = json['name'] ?? '';
rtvm.patient_type = json['patientType'] ?? '';
rtvm.prescription_url = json['pictureUrl'][0] ?? '';
if(rtvm.patient_type.toString().toLowerCase()=='self'){
rtvm.age=AppSettings.age;
rtvm.gender=AppSettings.gender;
rtvm.patient_name=AppSettings.userName;
}
else{
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}*/
return rtvm;
}
}

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class ReportsModel {
String patient_name='';
String age='';
String gender='';
String patient_type='';
String problem='';
String doctorName='';
String hospitalName='';
String date='';
String recordId='';
List findingsImages = [];
List reportImages = [];
List prescriptionImages = [];
DateTime dateForFilter=new DateTime.now();
ReportsModel();
factory ReportsModel.fromJson(Map<String, dynamic> json){
ReportsModel rtvm = new ReportsModel();
rtvm.patient_type = json['patientType'] ?? '';
rtvm.doctorName = json['doctorName'] ?? '';
rtvm.hospitalName = json['hospitalName'] ?? '';
rtvm.problem = json['problem'] ?? '';
rtvm.date = json['date'] ?? '';
rtvm.recordId = json['recordId'] ?? '';
rtvm.findingsImages = json['findings'] ?? [];
rtvm.reportImages = json['reports'] ?? [];
rtvm.prescriptionImages = json['prescription'] ?? [];
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
if(rtvm.patient_type.toString().toLowerCase()!='self'){
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}
return rtvm;
}
}

@ -0,0 +1,62 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class SugarHistoryModel {
String sugartText = '';
String sugarValue = '';
String fasting= '';
String postPrandial= '';
String date= '';
String displayDate='';
String actualDate='';
String sugarInfoId='';
DateTime dateForFilter=new DateTime.now();
Color sugarValueColor=Colors.black;
SugarHistoryModel();
factory SugarHistoryModel.fromJson(Map<String, dynamic> json){
SugarHistoryModel rtvm = new SugarHistoryModel();
rtvm.sugartText = json['sugarCategory'].toString() ?? '';
rtvm.sugarValue = json['sugarValue'].toString() ?? '';
rtvm.fasting = json['fasting'].toString() ?? '';
rtvm.postPrandial = json['postPrandial'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.sugarInfoId = json['sugarinfoid'].toString() ?? '';
if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
rtvm.sugarValueColor=buttonColors;
}
else{
rtvm.sugarValueColor=Colors.black;
}
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
}
}

@ -0,0 +1,539 @@
import 'dart:convert';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BMI/bmi_history.dart';
import 'package:doctor/common/settings.dart';
class BMICalculator extends StatefulWidget {
String? customerId;
BMICalculator({this.customerId});
@override
State<BMICalculator> createState() => _BMICalculatorState();
}
class _BMICalculatorState extends State<BMICalculator> {
TextEditingController heightController = TextEditingController();
TextEditingController inchesController = TextEditingController();
TextEditingController cmsController = TextEditingController();
TextEditingController weightController = TextEditingController();
TextEditingController ageController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String bmiValue = '';
String bmiText = '';
Color bmiTextColor = Colors.black;
var heightUnitItems = [
'feet',
'cm',
];
var heightUnits = 'feet';
var weightUnitItems = [
'kg',
];
var weightUnits = 'kg';
@override
void initState() {
ageController.text = AppSettings.age;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Calculate BMI'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: ageController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
suffixText: "Yrs",
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
DropdownButtonFormField(
// Initial Value
value: heightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Height units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: heightUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
heightUnits = newValue!;
});
},
),
SizedBox(height: 10),
Visibility(
visible: heightUnits == 'feet',
child: Container(
//height: 60,
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: heightController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Feets',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: inchesController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Inches',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
],
),
),
),
Visibility(
visible: heightUnits == 'cm',
child: Container(
//height: 60,
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: cmsController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter height in cms',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
],
),
),
),
SizedBox(height: 10),
Container(
//height: 40,
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: weightController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.line_weight_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Weight',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
Expanded(
child: DropdownButtonFormField(
// Initial Value
value: weightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: weightUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
weightUnits = newValue!;
});
},
),
)
],
),
),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (ageController.text != '' &&
heightController.text != '' ||
cmsController.text != '' &&
weightController.text != '' &&
dateInput.text != '') {
if (int.parse(heightController.text) > 7) {
AppSettings.longFailedToast(
'Please enter feet below 8 feets');
} else if (int.parse(inchesController.text) > 12) {
AppSettings.longFailedToast(
'Please enter inches below 12');
} else if (int.parse(heightController.text) == 0 &&
int.parse(inchesController.text) < 6) {
AppSettings.longFailedToast(
'Please enter inches above 6');
} else {
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
if (heightUnits.toString().toLowerCase() ==
'feet') {
cmsController.text = '';
} else {
heightController.text = '';
inchesController.text = '';
}
payload["age"] =
int.parse(ageController.text.toString());
payload["feet"] = heightController.text.toString();
payload["inches"] =
inchesController.text.toString();
payload["height"] = cmsController.text.toString();
payload["weight"] =
weightController.text.toString();
payload["heightUnit"] = heightUnits.toString();
payload["weightUnit"] = weightUnits.toString();
payload["date"] = dateInput.text.toString();
try {
var value =
await AppSettings.calculateBmi(payload,widget.customerId);
var valueResponse = jsonDecode(value);
Navigator.of(context, rootNavigator: true).pop();
heightController.clear();
cmsController.clear();
inchesController.clear();
weightController.clear();
dateInput.clear();
setState(() {
bmiValue = valueResponse['userDetails']
['bmivalue']
.toString();
if (double.parse(bmiValue) < 18.5) {
bmiText = 'Underweight';
bmiTextColor=Colors.red;
} else if (double.parse(bmiValue) >= 18.5 &&
double.parse(bmiValue) <= 24.9) {
bmiText = 'Normal weight';
bmiTextColor=buttonColors;
} else if (double.parse(bmiValue) >= 25 &&
double.parse(bmiValue) <= 29.9) {
bmiText = 'Overweight';
bmiTextColor=Colors.red;
} else if (double.parse(bmiValue) >= 30) {
bmiText = 'Obesity';
bmiTextColor=Colors.red;
}
});
} catch (e) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
'Calculating BMI failed');
}
}
} else {
AppSettings.longFailedToast(
'Please enter valid details');
}
},
child: const Text('Calculate BMI'),
)),
SizedBox(height: 20),
Container(
child: Row(
children: [
Text(
'Your BMI value: $bmiValue',
style:
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
SizedBox(
width: 10,
),
Text(bmiText,
style: TextStyle(
color: bmiTextColor, fontWeight: FontWeight.bold,fontSize: 20)),
],
)),
SizedBox(height: 30),
Container(
child: Text(
'Underweight = <18.5',
style: bmiTextStyle(),
),
),
SizedBox(height: 10),
Container(
child:
Text('Normal weight = 18.524.9', style: bmiTextStyle()),
),
SizedBox(height: 10),
Container(
child: Text('Overweight = 2529.9', style: bmiTextStyle()),
),
SizedBox(height: 10),
Container(
child: Text('Obesity = BMI of 30 or greater',
style: bmiTextStyle()),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BMIHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(
padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Container(
child: Text('History',
style: TextStyle(
color: Colors.black,
fontSize: 12,
fontWeight: FontWeight.bold,
)),
),
)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)),
));
}
}

@ -0,0 +1,424 @@
import 'dart:convert';
import 'package:doctor/patient_dashboard/BMI/bmi_caluculator.dart';
import 'package:flutter/material.dart';
import 'package:doctor/models/bmi_history_model.dart';
import 'package:doctor/common/settings.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class BMIHistory extends StatefulWidget {
String? customerId;
BMIHistory({this.customerId});
@override
State<BMIHistory> createState() => _BMIHistoryState();
}
class _BMIHistoryState extends State<BMIHistory> {
bool isLoading = false;
List<BmiHistoryModel> bmiHistoryList = [];
List<BmiHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getBmiHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getBmiHistory(widget.customerId);
print(response1);
setState(() {
bmiHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return BmiHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
//reportsList=reportsListOriginal.reversed.toList();
}).toList();
}
else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
}
else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
}
else {
FilteredList = bmiHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getBmiHistoryDetails(dateItemsVariable);
super.initState();
}
deleteBmiHistory(bmiId) async{
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteBMIDetails(bmiId,widget.customerId);
if(status){
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BMI record deleted successfully");
await getBmiHistoryDetails(dateItemsVariable);
}
else{
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BMI record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => a.actualDate.compareTo(b.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dateItemsVariable = newValue!;
});
getBmiHistoryDetails(dateItemsVariable);
},
),
),
IconButton(
onPressed: () {
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BmiChart()),
);*/
/*Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new BmiChart(myObject: FilteredList)));*/
// showBMIAdddialog();
},
icon: Icon(
Icons.auto_graph,
color: primaryColor,
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteBmiHistory(FilteredList[index].bmiInfoId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteBmiHistory(FilteredList[index].bmiInfoId);
},
),
/*SlidableAction(
onPressed: doNothing,
backgroundColor: Color(0xFF21B7CA),
foregroundColor: Colors.white,
icon: Icons.share,
label: 'Share',
),*/
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.height
.toString()
.toUpperCase() +
' cms',
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/weight.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.weight
.toString()
.toUpperCase() +
' Kgs',
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image:
const AssetImage('images/date.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/bmi.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.bmiValue
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/bmi.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index].bmiText
.toString()
.toUpperCase(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,color: FilteredList[index].bmiTextColor
)),
)
],
),
],
),
),
],
),
),
),
);
})),
]);
}
else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No Data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BMICalculator(customerId:widget.customerId))).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Body Mass Index'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BMICalculator(customerId: widget.customerId,))).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
);
}
}

@ -0,0 +1,228 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BP/bp_history.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class BPCalculator extends StatefulWidget {
String? customerId;
BPCalculator({this.customerId});
@override
State<BPCalculator> createState() => _BPCalculatorState();
}
class _BPCalculatorState extends State<BPCalculator> {
TextEditingController systoloicController = TextEditingController();
TextEditingController diastolicController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String bpValue = '';
String bpText = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Blood Pressure'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: systoloicController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.upload,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter systolic value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
TextFormField(
cursorColor: greyColor,
controller: diastolicController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.download,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter diastolic value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height:
MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (systoloicController.text != '' &&
diastolicController.text != ''&&dateInput.text!='') {
if(int.parse(systoloicController.text)>int.parse(diastolicController.text)){
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["Systolic"] = double.parse(systoloicController.text.toString());
payload["Diastolic"] = double.parse(diastolicController.text.toString());
payload["date"] =dateInput.text.toString();
var value = await AppSettings.calculateBP(payload,widget.customerId);
var valueResponse = jsonDecode(value);
print(valueResponse);
setState(() {
bpValue = valueResponse['userDetails']['bpCategory'].toString();
});
systoloicController.clear();
diastolicController.clear();
dateInput.clear();
Navigator.of(context,rootNavigator: true).pop();
}
else{
AppSettings.longFailedToast('Please enter diastolic value less than systolic value');
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: const Text('Check BP'),
)),
SizedBox(height: 20),
Container(
child: Row(
children: [
Text(bpValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),),
],
)
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BPHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
),)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)
),
)
);
}
}

@ -0,0 +1,372 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BP/bp_calculator.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/models/bp_history_model.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class BPHistory extends StatefulWidget {
String? customerId;
BPHistory({this.customerId});
@override
State<BPHistory> createState() => _BPHistoryState();
}
class _BPHistoryState extends State<BPHistory> {
bool isLoading = false;
List<BPHistoryModel> BpHistoryList = [];
List<BPHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getBPHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getBPHistory(widget.customerId);
print(response1);
setState(() {
BpHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return BPHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
} else {
FilteredList = BpHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getBPHistoryDetails(dateItemsVariable);
super.initState();
}
deleteBpRecord(bpId) async {
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteBPDetails(bpId,widget.customerId);
if (status) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BP record deleted successfully");
await getBPHistoryDetails(dateItemsVariable);
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BP record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dateItemsVariable = newValue!;
});
getBPHistoryDetails(dateItemsVariable);
},
),
),
IconButton(
onPressed: () {
/* Navigator.push(
context,
MaterialPageRoute(builder: (context) => Bpchart()),
);*/
// showBMIAdddialog();
},
icon: Icon(
Icons.auto_graph,
color: primaryColor,
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteBpRecord(FilteredList[index].bpId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteBpRecord(FilteredList[index].bpId);
},
),
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child: Container(
//width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/* Image(
image: const AssetImage('images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),*/
Text(
'Systolic',
style: TextStyle(color: primaryColor),
),
SizedBox(
width: 5,
),
Padding(
padding: EdgeInsets.all(1),
child: Text(
FilteredList[index]
.systolic
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Diastolic',
style: TextStyle(color: primaryColor),
),
Padding(
padding: EdgeInsets.all(1),
child: Text(
FilteredList[index]
.diastolic
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.bpText
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image:
const AssetImage('images/date.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
],
),
),
),
));
})),
]);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BPCalculator(customerId: widget.customerId,))).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Blood Pressure'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BPCalculator(customerId: widget.customerId,))).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,257 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_history.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class SugarCalculator extends StatefulWidget {
String? customerId;
SugarCalculator({this.customerId});
@override
State<SugarCalculator> createState() => _SugarCalculatorState();
}
class _SugarCalculatorState extends State<SugarCalculator> {
TextEditingController fastingValueController = TextEditingController();
TextEditingController postParandialValueController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String sugarValue = '';
Color sugarValueColor = Colors.black;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Diabetes'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: fastingValueController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter fasting blood sugar value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
TextFormField(
cursorColor: greyColor,
controller: postParandialValueController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter PostPrandial value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height:
MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (fastingValueController.text != '' &&
postParandialValueController.text != ''&& dateInput.text!='') {
if(int.parse(fastingValueController.text)>int.parse(postParandialValueController.text)){
AppSettings.longFailedToast('Please enter post parandial value is higher than fasting blood sugar value details');
}
else{
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["fasting"] = double.parse(fastingValueController.text.toString());
payload["postPrandial"] = double.parse(postParandialValueController.text.toString());
payload["date"] = dateInput.text.toString();
var value = await AppSettings.calculateSugar(payload,widget.customerId);
var valueResponse = jsonDecode(value);
print(valueResponse);
setState(() {
sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
if(sugarValue.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
sugarValueColor=buttonColors;
}
});
fastingValueController.clear();
postParandialValueController.clear();
dateInput.clear();
Navigator.of(context,rootNavigator: true).pop();
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: const Text('Check Diabetes'),
)),
SizedBox(height: 10),
Container(
child: Row(
children: [
Text(sugarValue,style: TextStyle(color: sugarValueColor,fontWeight: FontWeight.bold,fontSize: 20),),
Visibility(
visible:sugarValue!='' ,
child: Icon(
Icons.emoji_emotions_outlined,
color: buttonColors,
size: 40,
),)
],
)
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SugarHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
),)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)
),
)
);
}
}

@ -0,0 +1,354 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_calculator.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/models/sugar_history_model.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class SugarHistory extends StatefulWidget {
String? customerId;
SugarHistory({this.customerId});
@override
State<SugarHistory> createState() => _SugarHistoryState();
}
class _SugarHistoryState extends State<SugarHistory> {
bool isLoading = false;
List<SugarHistoryModel> sugarHistoryList = [];
List<SugarHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getSugarHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getSugarHistory(widget.customerId);
print(response1);
setState(() {
sugarHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return SugarHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
} else {
FilteredList = sugarHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getSugarHistoryDetails(dateItemsVariable);
super.initState();
}
deleteSugarRecord(sugarInfoId) async {
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteSugarDetails(sugarInfoId,widget.customerId);
if (status) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BP record deleted successfully");
await getSugarHistoryDetails(dateItemsVariable);
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BP record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dateItemsVariable = newValue!;
});
getSugarHistoryDetails(dateItemsVariable);
},
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteSugarRecord(FilteredList[index].sugarInfoId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteSugarRecord(FilteredList[index].sugarInfoId);
},
),
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Fasting Sugar Value',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'PostPrandial Sugar Value',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Sugar Status',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Date',
style: labelTextStyle(),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Expanded(child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
FilteredList[index]
.fasting
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.postPrandial
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.sugartText
.toString()
.toUpperCase(),
style: TextStyle(
color: FilteredList[index]
.sugarValueColor,
fontSize: 12,
fontWeight: FontWeight.bold,
overflow: TextOverflow.ellipsis,
)),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
],
),)
],
),
),
));
})),
]);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => SugarCalculator(customerId:widget.customerId))).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Diabetes'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => SugarCalculator(customerId: widget.customerId,))).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
),
],
),
),
),
);
}
}

@ -0,0 +1,159 @@
import 'package:doctor/common/settings.dart';
import 'package:doctor/patient_dashboard/patient_dshboard_details.dart';
import 'package:flutter/material.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:flutter/services.dart';
class PatientDashboard extends StatefulWidget {
const PatientDashboard({Key? key}) : super(key: key);
@override
State<PatientDashboard> createState() => _PatientDashboardState();
}
class _PatientDashboardState extends State<PatientDashboard> {
bool isScannerVisible=true;
TextEditingController mobileNumberController = TextEditingController();
final List<String> images = [
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
];
Future<void> scanQR() async {
String barcodeScanRes;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
'#ff6666', 'Cancel', true, ScanMode.QR);
print(barcodeScanRes);
setState(() {
});
} on PlatformException {
barcodeScanRes = 'Failed to get platform version.';
}}
Future<bool> onWillPop() async {
final shouldPop = await showDialog<bool>(context: context, builder: (context) {
return AlertDialog(
title: const Text('Do you want to leave this page',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
actionsAlignment: MainAxisAlignment.spaceBetween,
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text('Yes',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: const Text('No',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
],
);
},
);
return shouldPop!;
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => onWillPop(),
child: Scaffold(
appBar: AppSettings.appBar('Patient Dashboard'),
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
height:MediaQuery.of(context).size.height * .02,
),
Visibility(
visible: isScannerVisible,
child:Center(
child: Container(
child: Column(
children: [
IconButton(
onPressed: (){
scanQR();
},
icon: Icon(
Icons.qr_code_scanner,
color: primaryColor,
),
),
Text('Scan Qr Code',style: TextStyle(fontSize: 12,color: primaryColor),)
],
)
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: primaryColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
textCapitalization: TextCapitalization.characters,
decoration: textFormFieldDecorationInsideApp(Icons.phone,'Enter mobile number'),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
if(mobileNumberController.text!=''){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PatientDashboardDetails(mobileNumber: mobileNumberController.text.toString(),)),
);
}
else{
AppSettings.longFailedToast('Please enter details');
}
},
child: Text('Go to details'),
)),
]
))) ) ),
);
}
}

@ -0,0 +1,245 @@
import 'dart:convert';
import 'package:doctor/common/settings.dart';
import 'package:doctor/patient_dashboard/BMI/bmi_history.dart';
import 'package:doctor/patient_dashboard/BP/bp_history.dart';
import 'package:doctor/patient_dashboard/Reports/allreports.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_history.dart';
import 'package:doctor/patient_dashboard/prescriptions/prescriptions.dart';
import 'package:doctor/patient_dashboard/problems/all_problems.dart';
import 'package:flutter/material.dart';
class PatientDashboardDetails extends StatefulWidget {
String? mobileNumber;
PatientDashboardDetails({this.mobileNumber});
@override
State<PatientDashboardDetails> createState() => _PatientDashboardDetailsState();
}
class _PatientDashboardDetailsState extends State<PatientDashboardDetails> {
bool isDataLoading=false;
bool isSereverIssue=false;
String? customerId;
String? patientName;
String? patientAge;
String? patientGender;
String? patientContactNumber;
final List<String> images = [
'images/bp.png',
'images/sugar.png',
'images/bmi.png',
'images/health_records.png',
'images/prescriptions.png',
'images/medicines.png',
'images/new_problem.png',
'images/get_checkup.png',
'images/resources.png',
];
final List<String> labels = [
'Bp',
'Sugar',
'BMI',
'Health Records',
'Prescriptions',
'Medicines',
'New Problem',
'Get Checkup',
'Resources',
];
Map<String,dynamic> patDetails={};
Future<void> getPatientInformation() async {
isDataLoading=true;
try {
var response = await AppSettings.getPatientInformationBasedOnMobileNumber(widget.mobileNumber);
print(jsonDecode(response));
setState(() {
customerId=jsonDecode(response)[0]['customerId'];
patientName=jsonDecode(response)[0]['profile']['firstName'];
patientAge=jsonDecode(response)[0]['age'].toString();
patientGender=jsonDecode(response)[0]['gender'];
patientContactNumber=jsonDecode(response)[0]['profile']['contactNumber'];
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getPatientInformation();
super.initState();
}
_onTap(int index){
if(index==0){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BPHistory(customerId:customerId,)),
);
}
else if(index==1){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SugarHistory(customerId:customerId,)),
);
}
else if(index==2){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BMIHistory(customerId:customerId,)),
);
}
else if(index==3){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllReports(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==4){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Prescriptions(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==6){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllProblemsReportMyself(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==7){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllProblemsReportMyself(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
}
Widget _dashboard(){
return Column(
children: [
Padding(padding: EdgeInsets.all(10),
child: Align(child: Text('Patient Information',style: TextStyle(color: primaryColor,fontSize: 16),),
alignment: Alignment.topLeft),),
Padding(padding: EdgeInsets.all(10),
child: Card(child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Name'),
Text('Age'),
Text('Gender'),
Text('Contact Number')
],
),
SizedBox(
width:MediaQuery.of(context).size.width * .02,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(':'),
Text(':'),
Text(':'),
Text(':')
],
),
SizedBox(
width:MediaQuery.of(context).size.width * .02,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(patientName!),
Text(patientAge!),
Text(patientGender!),
Text(patientContactNumber!)
],
),
],
),),),
Expanded(child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: GridView.builder(
itemCount: images.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0,
),
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
_onTap(index);
},
child: Column(
children: [
Expanded(child: Container(
decoration: BoxDecoration(
color: secondaryColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30),
image: DecorationImage(
image: AssetImage(images[index],) , // picked file
fit: BoxFit.fitWidth)),
//color: secondaryColor,
)),
Padding(padding: EdgeInsets.all(10),
child: Text(labels[index]),),
/*Divider(
color: Colors.grey,
height: 1.0,
),*/
],
)
);
},
),
)
))
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Patient Dashboard Details'),
body: Container(
child: isDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _dashboard(),
),
);
}
}

@ -0,0 +1,418 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/patient_dashboard/prescriptions/prescriptions.dart';
import 'package:image_picker/image_picker.dart';
import 'package:photo_view/photo_view.dart';
import 'package:pinch_zoom/pinch_zoom.dart';
class AddPrescription extends StatefulWidget {
String? customerId;
String? patName;
String? patAge;
String? patGender;
AddPrescription({this.customerId,this.patName,this.patAge,this.patGender});
@override
State<AddPrescription> createState() => _AddPrescriptionState();
}
class _AddPrescriptionState extends State<AddPrescription> {
final ImagePicker _picker = ImagePicker();
String Url = '';
final _transformationController = TransformationController();
TapDownDetails _doubleTapDetails=TapDownDetails();
TextEditingController prescriptionNameController = TextEditingController();
TextEditingController patientNameController = TextEditingController();
TextEditingController patientAgeController = TextEditingController();
String? prescriptionFor;
String? gender;
Future pickImageFromGallery() async {
try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeImageFromCamera() async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Widget zoomPhoto(var imageUrl){
return Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
)
);
}
showPicDialog(var imageUrl){
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: const Text(''),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .10,
height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
)
],
),
),
actions: <Widget>[
TextButton(
child: Text('Close', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
},
);
}
void _handleDoubleTap() {
if (_transformationController.value != Matrix4.identity()) {
_transformationController.value = Matrix4.identity();
} else {
final position = _doubleTapDetails.localPosition;
// For a 3x zoom
_transformationController.value = Matrix4.identity()
..translate(-position.dx * 2, -position.dy * 2)
..scale(3.0);
// Fox a 2x zoom
// ..translate(-position.dx, -position.dy)
// ..scale(2.0);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Add Prescription'),
body:SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width * .20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
});
},
child: const Text('Select image'),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Visibility(
visible: Url != '',
child: GestureDetector(
child:
/*,*/
/*Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
child: PhotoView(
imageProvider: NetworkImage(Url) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
),*/
Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(Url) as ImageProvider, // picked file
fit: BoxFit.fill)),
),
onTap: (){
showPicDialog(Url);
},
)
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: prescriptionNameController,
decoration: textFormFieldDecoration(Icons.edit,'Enter Prescription name'),
),
),
Row(
children: [
Expanded(child: RadioListTile(
title: Text("For Yourself"),
value: "self",
groupValue: prescriptionFor,
activeColor: primaryColor,
onChanged: (value){
setState(() {
prescriptionFor = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("For Family"),
value: "others",
groupValue: prescriptionFor,
activeColor: primaryColor,
onChanged: (value){
setState(() {
prescriptionFor = value.toString();
});
},
),),
],
),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Container(
child: TextFormField(
cursorColor: greyColor,
controller: patientNameController,
decoration: textFormFieldDecoration(Icons.person,'Enter patient name'),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Container(
child: TextFormField(
cursorColor: greyColor,
keyboardType: TextInputType.number,
controller: patientAgeController,
decoration: textFormFieldDecoration(Icons.person,'Enter patient age'),
),
),),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(fontSize: 10)),
value: "male",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style: TextStyle(fontSize: 10),),
value: "female",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(fontSize: 10)),
value: "other",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async{
if(Url!=''&& prescriptionNameController.text!=''&&prescriptionFor!=''){
String _name='';
String _age='';
String? _gender='';
if(prescriptionFor.toString().toLowerCase()=='others'){
if(patientNameController!=''&& patientAgeController.text!=''&&gender!=''){
_name=patientNameController.text;
_age=patientAgeController.text;
_gender=gender;
}
else{
AppSettings.longFailedToast('Please enter details');
}
}
else{
_name=widget.patName!;
_age=widget.patAge!;
_gender=widget.patGender!;
}
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
var payload = new Map<String, dynamic>();
payload["name"] = prescriptionNameController.text.toString();
payload["pictureUrl"] = Url.toString();
payload["patientType"] = prescriptionFor.toString();
payload["others"] ={
"name": _name,
"age": int.parse(_age),
"gender": _gender.toString().toLowerCase()
};
bool uploadStatus = await AppSettings.addPrescription(payload,widget.customerId);
try{
if(uploadStatus){
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longSuccessToast('Prescription added successfully');
Navigator.pop(context);
/* await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Prescriptions()),
);*/
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add prescription details');
}
}
catch(e){
print(e);
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add prescription details');
}
}
else{
AppSettings.longFailedToast('Please check internet');
}
}
else{
AppSettings.longFailedToast('Please upload image');
}
},
child: const Text('Upload'),
)),
],
),
)) ,
)
);
}
}

@ -0,0 +1,976 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:doctor/patient_dashboard//Reports/add_reports.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/common/zoom_image.dart';
import 'package:doctor/models/reports_model.dart';
import 'package:image_picker/image_picker.dart';
import 'package:photo_view/photo_view.dart';
import 'package:intl/intl.dart';
class Prescriptions extends StatefulWidget {
String? customerId;
String? patName;
String? patAge;
String? patGender;
Prescriptions({this.customerId,this.patName,this.patAge,this.patGender});
@override
State<Prescriptions> createState() => _PrescriptionsState();
}
class _PrescriptionsState extends State<Prescriptions> {
final ImagePicker _picker = ImagePicker();
String Url = '';
List<ReportsModel> reportsList = [];
List<ReportsModel> reportsListOriginal = [];
bool isPharmacyDataLoading = false;
bool isPrescriptionsDataLoading = false;
bool isSereverIssue = false;
double lat = 0;
double lng = 0;
String userAddress = '';
String dropdownArea = '2';
var AreaItems = ['2', '5', '10', '25', '50', '100'];
List pharmaciesCheckboxes = [];
bool isLoading=false;
final ImagePicker imagePicker = ImagePicker();
List imageFileList = [];
List uiPrescriptionImages = [];
TextEditingController searchController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String dropdownSearchType = 'Problem';
var typeOfSearchItems = [
'Problem',
'Doctor',
'Date',
];
Future<void> getAllRecords() async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByProblemName(var problem) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.problem.toString().toLowerCase().contains(problem.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByDoctorName(var doctor) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.doctorName.toString().toLowerCase().contains(doctor.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByDate(var date) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.date.toString().toLowerCase().contains(date.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getAllRecords();
super.initState();
}
Future pickImageFromGallery() async {
try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeImageFromCamera() async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future pickImageFromGalleryForUpdate(var recordId) async {
imageFileList = [];
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
AppSettings.preLoaderDialog(context);
if (selectedImages!.isNotEmpty) {
imageFileList.addAll(selectedImages);
}
var res = await AppSettings.updatePrescriptionsGallery(imageFileList,recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
getAllRecords();
}
Future takeImageFromCameraForUpdate(var recordId) async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.updatePrescriptionsCamera(image,recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
getAllRecords();
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
showPicDialog(var imageUrl){
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: const Text(''),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .10,
height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
)
],
),
),
actions: <Widget>[
TextButton(
child: Text('Close', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
},
);
}
Widget prescriptions(var obj){
if(obj.prescriptionImages.length!=0){
return Container(
//color: secondaryColor,
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: Row(
children: [
Expanded(child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: obj.prescriptionImages.length,
itemBuilder: (context, index) {
return Row(
children: [
Card(
child: GestureDetector(
onTap: (){
//showPicDialog(obj.prescriptionImages[index]['url']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Prescriptions',imageDetails:obj.prescriptionImages[index]['url'])));},
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
obj.prescriptionImages[index]['url'])
as ImageProvider, // picked file
fit: BoxFit.fill)),
child: Stack(children: [
Positioned(
right: 0,
child: Container(
child: IconButton(
iconSize: 30,
icon: const Icon(
Icons.delete,
color: Colors.red,
),
onPressed: () async {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) => AlertDialog(
title:
const Text('Do you want to delete image?',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
actionsAlignment:
MainAxisAlignment.spaceBetween,
actions: [
TextButton(
onPressed: () async {
AppSettings.preLoaderDialog(context);
String fileName = obj.prescriptionImages[index]['url']
.split('/')
.last;
var payload =
new Map<String, dynamic>();
payload["urlType"] = 'prescription';
payload["url"] = obj.prescriptionImages[index]['url'];
try {
var res = await AppSettings.deleteRecordsNew(payload, obj.recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).pop(true);
AppSettings.longSuccessToast("Image deleted Successfully");
setState(() {
obj.prescriptionImages =
jsonDecode(
res)['remainingUrls'];
});
} catch (e) {
print(e);
Navigator.of(context,
rootNavigator: true)
.pop();
Navigator.of(context).pop(true);
AppSettings.longFailedToast(
"Image deletion failed");
}
},
child: const Text('Yes',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text('No',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
],
),
);
},
),
),
)
]),
),
),
)
],
);
}),),
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.green,
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCameraForUpdate(obj.recordId);
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGalleryForUpdate(obj.recordId);
Navigator.pop(context);
},
),
],
),
),
);
});
},
)
],
)
);
}
else{
return Row(
children: [
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.green,
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCameraForUpdate(obj.recordId);
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGalleryForUpdate(obj.recordId);
Navigator.pop(context);
},
),
],
),
),
);
});
},
),
Text('Add Prescriptions',style: textButtonStyle(),)
],
);
}
}
Widget _filtereddata(){
if (reportsList.length != 0) {
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:ListView.builder(
padding: EdgeInsets.all(0),
itemCount: reportsList.length,
itemBuilder: (BuildContext context, int index) {
if(reportsList[index].patient_type.toString().toLowerCase()=='self'){
reportsList[index].age=widget.patAge!;
reportsList[index].gender=widget.patGender!;
reportsList[index].patient_name=widget.patName!;
}
else{
reportsList[index].age=reportsList[index].age;
reportsList[index].gender=reportsList[index].gender;
reportsList[index].patient_name=reportsList[index].patient_name;
}
return Visibility(
visible: true,
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding:EdgeInsets.all(8) ,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Problem: '+reportsList[index].problem.toString().toUpperCase(),style: problemTextStyle()),
Text(reportsList[index].doctorName.toString().toUpperCase(),style: valuesTextStyle()),
Text(reportsList[index].hospitalName.toString().toUpperCase(),style: valuesTextStyle()),
Text(reportsList[index].date.toString().toUpperCase(),style: valuesTextStyle()),
Text('Patient Details: ',style: problemTextStyle()),
Text(reportsList[index].patient_name.toString().toUpperCase(),style: valuesTextStyle()),
Row(
children: [
Text(reportsList[index].gender.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(width:MediaQuery.of(context).size.width * .05,),
Text(reportsList[index].age.toString().toUpperCase()+" Yrs",style: valuesTextStyle()),
],
),
],
),
),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
prescriptions(reportsList[index]),
],
),
),
));
}) ),
]);
}
else{
return Padding(padding: EdgeInsets.fromLTRB(60,10,60,10),
child: Column(
children: [
Text('No prescriptions found related to your search'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: Colors.red,
radius: 30,
child: const Icon(
Icons.info,
color: Colors.white,
),
)
],
),);
}
}
Widget _allPrescriptions(){
if(reportsListOriginal.length!=0){
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: DropdownButtonFormField(
// Initial Value
value: dropdownSearchType,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.search,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Search By',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Select Search Type'),
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: typeOfSearchItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dropdownSearchType = newValue!;
});
},
),
),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='problem' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByProblemName(string);
}
else{
getAllRecords();
}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
/*suffixIcon: Icon(
Icons.clear,
color: greyColor,
),*/
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by problem',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='doctor' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByDoctorName(string);
}
else{
getAllRecords();
}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
/*suffixIcon: Icon(
Icons.clear,
color: greyColor,
),*/
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by doctor',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='date' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByDate(string);
}
else{
getAllRecords();
}
},
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
searchController.text = formattedDate; //set output date to TextField value.
});
getRecordsByDate(searchController.text);
} else {}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by date',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),
),
Expanded(child: _filtereddata()),
Padding(
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
child: CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async{
/*await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddPrescription()),
);*/
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports(customerId:widget.customerId,patName: widget.patName,patAge: widget.patAge,patGender: widget.patGender,))).then((value) {
getAllRecords();
});
//showBoreAddingDialog();
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
]);
}
else{
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: MediaQuery.of(context).size.height * .25,),
Text('Click below icon to add new Record'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports(customerId:widget.customerId,patName: widget.patName,patAge: widget.patAge,patGender: widget.patGender,))).then((value) {
getAllRecords();
});
},
),
)
],
),
)
);
}
}
/**/
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Prescriptions'),
body: isPrescriptionsDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _allPrescriptions(),
);
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:flick_video_player/flick_video_player.dart';
class ProblemVideo extends StatefulWidget {
var videoUrl;
ProblemVideo({this.videoUrl});
@override
State<ProblemVideo> createState() => _ProblemVideoState();
}
class _ProblemVideoState extends State<ProblemVideo> {
late VideoPlayerController _controller;
late Future<void> _initializeVideoPlayerFuture;
late FlickManager flickManager;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.networkUrl(
Uri.parse(widget.videoUrl,),
);
flickManager = FlickManager(
videoPlayerController:
VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl,),)
);
_initializeVideoPlayerFuture = _controller.initialize();
_controller.setLooping(false);
}
@override
void dispose() {
// Ensure disposing of the VideoPlayerController to free up resources.
_controller.dispose();
flickManager.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .30,
width: double.infinity,
child:FlickVideoPlayer(
flickManager: flickManager,
flickVideoWithControls: FlickVideoWithControls(
videoFit: BoxFit.fill,
controls: FlickPortraitControls(
progressBarSettings:
FlickProgressBarSettings(playedColor: Colors.green),
),
),
),
);
}
}

@ -0,0 +1,19 @@
import 'package:doctor/common/settings.dart';
import 'package:flutter/material.dart';
class VideoCall extends StatefulWidget {
const VideoCall({Key? key}) : super(key: key);
@override
State<VideoCall> createState() => _VideoCallState();
}
class _VideoCallState extends State<VideoCall> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Video Call'),
body: Container(),
);
}
}

@ -370,6 +370,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_barcode_scanner:
dependency: "direct main"
description:
name: flutter_barcode_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_cupertino_datetime_picker:
dependency: "direct main"
description:

@ -61,6 +61,7 @@ dependencies:
flutter_launcher_icons: ^0.11.0
share: ^2.0.4
flutter_share: ^2.0.0
flutter_barcode_scanner: ^2.0.0
dev_dependencies:
flutter_test:

Loading…
Cancel
Save