|
|
|
@ -45,7 +45,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
imageFileList.addAll(selectedImages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var res = await AppSettings.uploadImageForFindings(imageFileList);
|
|
|
|
|
var res = await AppSettings.uploadFindingsGallery(imageFileList);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
@ -59,7 +59,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
if (image == null) return;
|
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
var res = await AppSettings.uploadImageForFindingsCamera(image);
|
|
|
|
|
var res = await AppSettings.uploadFindingsCamera(image);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
@ -69,7 +69,38 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*Future pickImageFromGalleryForUpdate() async {
|
|
|
|
|
imageFileList = [];
|
|
|
|
|
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
if (selectedImages!.isNotEmpty) {
|
|
|
|
|
imageFileList.addAll(selectedImages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var res = await AppSettings.updateFindingsGallery(imageFileList,widget.recordId);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.imageDetails = jsonDecode(res)['findings'];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future takeImageFromCameraForUpdate() 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.updateFindingsCamera(image,widget.recordId);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.imageDetails = jsonDecode(res)['findings'];
|
|
|
|
|
});
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
Future takeImageFromCameraForReports() async {
|
|
|
|
|
try {
|
|
|
|
@ -104,18 +135,17 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future takeImageFromCameraForPrescriptions() 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.uploadImageForFindingsCamera(image);
|
|
|
|
|
var res = await AppSettings.uploadPrescriptionsCamera(image);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
|
uiFindingsImages = jsonDecode(res)['findings'];
|
|
|
|
|
uiPrescriptionImages = jsonDecode(res)['precription'];
|
|
|
|
|
});
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
@ -123,14 +153,15 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future pickImageFromGalleryForPrescriptions() async {
|
|
|
|
|
imageFileListPrescriptions = [];
|
|
|
|
|
// imageFileListPrescriptions = [];
|
|
|
|
|
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
if (selectedImages!.isNotEmpty) {
|
|
|
|
|
imageFileListPrescriptions.addAll(selectedImages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var res = await AppSettings.uploadImageForPrescriptions(imageFileListPrescriptions);
|
|
|
|
|
var res = await AppSettings.uploadPrescriptionsGallery(
|
|
|
|
|
imageFileListPrescriptions);
|
|
|
|
|
print(jsonDecode(res));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
@ -138,8 +169,6 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
@ -233,8 +262,8 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
title: Text("For Yourself"),
|
|
|
|
|
value: "self",
|
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
@ -244,8 +273,10 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
title: Text("For Family"),
|
|
|
|
|
value: "others",
|
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
@ -255,39 +286,47 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
|
visible:
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
|
child: Container(
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
cursorColor: greyColor,
|
|
|
|
|
controller: patientNameController,
|
|
|
|
|
decoration: textFormFieldDecoration(Icons.person,'Enter patient name'),
|
|
|
|
|
|
|
|
|
|
decoration: textFormFieldDecoration(
|
|
|
|
|
Icons.person, 'Enter patient name'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * .02,
|
|
|
|
|
),
|
|
|
|
|
),),
|
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
|
visible:
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
|
child: Container(
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
cursorColor: greyColor,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: patientAgeController,
|
|
|
|
|
decoration: textFormFieldDecoration(Icons.person,'Enter patient age'),
|
|
|
|
|
|
|
|
|
|
decoration: textFormFieldDecoration(
|
|
|
|
|
Icons.person, 'Enter patient age'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
|
visible:
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
title: Text("Male", style: TextStyle(fontSize: 10)),
|
|
|
|
|
value: "male",
|
|
|
|
|
groupValue: gender,
|
|
|
|
@ -297,9 +336,14 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
gender = value.toString();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
|
title: Text("Female",style: TextStyle(fontSize: 10),),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
"Female",
|
|
|
|
|
style: TextStyle(fontSize: 10),
|
|
|
|
|
),
|
|
|
|
|
value: "female",
|
|
|
|
|
groupValue: gender,
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
@ -308,9 +352,12 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
gender = value.toString();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
|
title: Text("Others",style: TextStyle(fontSize: 10)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RadioListTile(
|
|
|
|
|
title:
|
|
|
|
|
Text("Others", style: TextStyle(fontSize: 10)),
|
|
|
|
|
value: "other",
|
|
|
|
|
groupValue: gender,
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
@ -319,10 +366,14 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
gender = value.toString();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiFindingsImages.length == 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
@ -349,7 +400,8 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
.20,
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
@ -371,6 +423,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Select Findings'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiFindingsImages.length > 0,
|
|
|
|
|
child: Container(
|
|
|
|
@ -384,8 +437,11 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
children: [
|
|
|
|
|
Card(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
.30,
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
.15,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
@ -407,7 +463,62 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiFindingsImages.length != 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: Colors.red, // 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('Add Findings'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiReportsImages.length == 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
@ -434,7 +545,8 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
.20,
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
@ -456,6 +568,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Select Reports'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiReportsImages.length > 0,
|
|
|
|
|
child: Container(
|
|
|
|
@ -469,8 +582,11 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
children: [
|
|
|
|
|
Card(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
.30,
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
.15,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
@ -492,7 +608,62 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiReportsImages.length != 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: Colors.red, // 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 takeImageFromCameraForReports();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
.20,
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.photo,
|
|
|
|
|
size: 100,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
onTap: () async {
|
|
|
|
|
await pickImageFromGalleryForReports();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Add Reports'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiPrescriptionImages.length == 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
@ -519,7 +690,8 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
.20,
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
@ -541,7 +713,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Select Prescriptions'),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiPrescriptionImages.length > 0,
|
|
|
|
|
child: Container(
|
|
|
|
@ -555,16 +727,44 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
children: [
|
|
|
|
|
Card(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
.30,
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
.15,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: NetworkImage(
|
|
|
|
|
uiPrescriptionImages[index]
|
|
|
|
|
['url'])
|
|
|
|
|
uiPrescriptionImages[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.cancel,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
|
|
|
|
|
String fileName = uiPrescriptionImages[index]['url'].split('/').last;
|
|
|
|
|
var response = await AppSettings.deletePrescriptions(fileName);
|
|
|
|
|
print(jsonDecode(response));
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
setState(() {
|
|
|
|
|
uiPrescriptionImages = jsonDecode(response)['precription'];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
/*Expanded(child:IconButton(
|
|
|
|
@ -578,7 +778,59 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: uiPrescriptionImages.length != 0,
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
primary: Colors.red, // 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 takeImageFromCameraForPrescriptions();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
.20,
|
|
|
|
|
),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.photo,
|
|
|
|
|
size: 100,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
onTap: () async {
|
|
|
|
|
await pickImageFromGalleryForPrescriptions();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Add Prescriptions'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
@ -588,41 +840,48 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
|
|
if(doctorNameController.text!=''&& problemController.text!=''&& dateInput.text!=''&&prescriptionFor!=''){
|
|
|
|
|
|
|
|
|
|
if (doctorNameController.text != '' &&
|
|
|
|
|
problemController.text != '' &&
|
|
|
|
|
dateInput.text != '' &&
|
|
|
|
|
prescriptionFor != '') {
|
|
|
|
|
String _name = '';
|
|
|
|
|
String _age = '';
|
|
|
|
|
String? _gender = '';
|
|
|
|
|
|
|
|
|
|
if(prescriptionFor.toString().toLowerCase()=='others'){
|
|
|
|
|
if(patientNameController!=''&& patientAgeController.text!=''&&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{
|
|
|
|
|
AppSettings.longFailedToast('Please enter details');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
_name = AppSettings.userName;
|
|
|
|
|
_age = AppSettings.age;
|
|
|
|
|
_gender = AppSettings.gender;
|
|
|
|
|
}
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
bool isOnline = await AppSettings.internetConnectivity();
|
|
|
|
|
bool isOnline =
|
|
|
|
|
await AppSettings.internetConnectivity();
|
|
|
|
|
if (isOnline) {
|
|
|
|
|
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["problem"] = problemController.text.toString();
|
|
|
|
|
payload["doctorName"] = doctorNameController.text.toString();
|
|
|
|
|
payload["hospitalName"] = hospitalNameController.text.toString();
|
|
|
|
|
payload["problem"] =
|
|
|
|
|
problemController.text.toString();
|
|
|
|
|
payload["doctorName"] =
|
|
|
|
|
doctorNameController.text.toString();
|
|
|
|
|
payload["hospitalName"] =
|
|
|
|
|
hospitalNameController.text.toString();
|
|
|
|
|
payload["date"] = dateInput.text.toString();
|
|
|
|
|
payload["findings_date"] = '';
|
|
|
|
|
payload["reports_date"] = '';
|
|
|
|
|
payload["prescription_date"] = '';
|
|
|
|
|
payload["patientType"] = prescriptionFor.toString();
|
|
|
|
|
payload["patientType"] =
|
|
|
|
|
prescriptionFor.toString();
|
|
|
|
|
payload["others"] = {
|
|
|
|
|
"name": _name,
|
|
|
|
|
"age": int.parse(_age),
|
|
|
|
@ -632,35 +891,36 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
|
payload["reports"] = uiReportsImages;
|
|
|
|
|
payload["prescription"] = uiPrescriptionImages;
|
|
|
|
|
|
|
|
|
|
bool uploadStatus = await AppSettings.addRecords(payload);
|
|
|
|
|
bool uploadStatus =
|
|
|
|
|
await AppSettings.addRecords(payload);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (uploadStatus) {
|
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longSuccessToast('Record added successfully');
|
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
|
.pop();
|
|
|
|
|
AppSettings.longSuccessToast(
|
|
|
|
|
'Record added successfully');
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
|
.pop();
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
'Fail to add record details');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longFailedToast('Fail to add record details');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(e){
|
|
|
|
|
} catch (e) {
|
|
|
|
|
print(e);
|
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
|
AppSettings.longFailedToast('Fail to add record details');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('Please check internet');
|
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
|
.pop();
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
'Fail to add record details');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
'Please check internet');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('Please enter valid details');
|
|
|
|
|
} else {
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
'Please enter valid details');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Submit'),
|
|
|
|
|