|
|
@ -45,7 +45,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
imageFileList.addAll(selectedImages);
|
|
|
|
imageFileList.addAll(selectedImages);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var res = await AppSettings.uploadImageForFindings(imageFileList);
|
|
|
|
var res = await AppSettings.uploadFindingsGallery(imageFileList);
|
|
|
|
print(jsonDecode(res));
|
|
|
|
print(jsonDecode(res));
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
@ -59,7 +59,7 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
if (image == null) return;
|
|
|
|
if (image == null) return;
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
var res = await AppSettings.uploadImageForFindingsCamera(image);
|
|
|
|
var res = await AppSettings.uploadFindingsCamera(image);
|
|
|
|
print(jsonDecode(res));
|
|
|
|
print(jsonDecode(res));
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
@ -69,7 +69,38 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
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 {
|
|
|
|
Future takeImageFromCameraForReports() async {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -104,18 +135,17 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future takeImageFromCameraForPrescriptions() async {
|
|
|
|
Future takeImageFromCameraForPrescriptions() async {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
final image = await _picker.pickImage(source: ImageSource.camera);
|
|
|
|
final image = await _picker.pickImage(source: ImageSource.camera);
|
|
|
|
if (image == null) return;
|
|
|
|
if (image == null) return;
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
var res = await AppSettings.uploadImageForFindingsCamera(image);
|
|
|
|
var res = await AppSettings.uploadPrescriptionsCamera(image);
|
|
|
|
print(jsonDecode(res));
|
|
|
|
print(jsonDecode(res));
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
uiFindingsImages = jsonDecode(res)['findings'];
|
|
|
|
uiPrescriptionImages = jsonDecode(res)['precription'];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
print('Failed to pick image: $e');
|
|
|
@ -123,14 +153,15 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future pickImageFromGalleryForPrescriptions() async {
|
|
|
|
Future pickImageFromGalleryForPrescriptions() async {
|
|
|
|
imageFileListPrescriptions = [];
|
|
|
|
// imageFileListPrescriptions = [];
|
|
|
|
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
|
|
|
|
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
if (selectedImages!.isNotEmpty) {
|
|
|
|
if (selectedImages!.isNotEmpty) {
|
|
|
|
imageFileListPrescriptions.addAll(selectedImages);
|
|
|
|
imageFileListPrescriptions.addAll(selectedImages);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var res = await AppSettings.uploadImageForPrescriptions(imageFileListPrescriptions);
|
|
|
|
var res = await AppSettings.uploadPrescriptionsGallery(
|
|
|
|
|
|
|
|
imageFileListPrescriptions);
|
|
|
|
print(jsonDecode(res));
|
|
|
|
print(jsonDecode(res));
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
@ -138,8 +169,6 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
@ -233,143 +262,167 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
child: RadioListTile(
|
|
|
|
title: Text("For Yourself"),
|
|
|
|
title: Text("For Yourself"),
|
|
|
|
value: "self",
|
|
|
|
value: "self",
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
onChanged: (value){
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),),
|
|
|
|
),
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
),
|
|
|
|
title: Text("For Family"),
|
|
|
|
Expanded(
|
|
|
|
value: "others",
|
|
|
|
child: RadioListTile(
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
title: Text("For Family"),
|
|
|
|
activeColor: primaryColor,
|
|
|
|
value: "others",
|
|
|
|
onChanged: (value){
|
|
|
|
groupValue: prescriptionFor,
|
|
|
|
setState(() {
|
|
|
|
activeColor: primaryColor,
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
onChanged: (value) {
|
|
|
|
});
|
|
|
|
setState(() {
|
|
|
|
},
|
|
|
|
prescriptionFor = value.toString();
|
|
|
|
),),
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
visible:
|
|
|
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
child: TextFormField(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: patientNameController,
|
|
|
|
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(
|
|
|
|
Visibility(
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
visible:
|
|
|
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
child: TextFormField(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
cursorColor: greyColor,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
controller: patientAgeController,
|
|
|
|
controller: patientAgeController,
|
|
|
|
decoration: textFormFieldDecoration(Icons.person,'Enter patient age'),
|
|
|
|
decoration: textFormFieldDecoration(
|
|
|
|
|
|
|
|
Icons.person, 'Enter patient age'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible:prescriptionFor.toString().toLowerCase()=='others' ,
|
|
|
|
visible:
|
|
|
|
|
|
|
|
prescriptionFor.toString().toLowerCase() == 'others',
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
child: RadioListTile(
|
|
|
|
title: Text("Male",style: TextStyle(fontSize: 10)),
|
|
|
|
title: Text("Male", style: TextStyle(fontSize: 10)),
|
|
|
|
value: "male",
|
|
|
|
value: "male",
|
|
|
|
groupValue: gender,
|
|
|
|
groupValue: gender,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
onChanged: (value){
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
gender = value.toString();
|
|
|
|
gender = value.toString();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),),
|
|
|
|
),
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
),
|
|
|
|
title: Text("Female",style: TextStyle(fontSize: 10),),
|
|
|
|
Expanded(
|
|
|
|
value: "female",
|
|
|
|
child: RadioListTile(
|
|
|
|
groupValue: gender,
|
|
|
|
title: Text(
|
|
|
|
activeColor: primaryColor,
|
|
|
|
"Female",
|
|
|
|
onChanged: (value){
|
|
|
|
style: TextStyle(fontSize: 10),
|
|
|
|
setState(() {
|
|
|
|
),
|
|
|
|
gender = value.toString();
|
|
|
|
value: "female",
|
|
|
|
});
|
|
|
|
groupValue: gender,
|
|
|
|
},
|
|
|
|
activeColor: primaryColor,
|
|
|
|
),),
|
|
|
|
onChanged: (value) {
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
setState(() {
|
|
|
|
title: Text("Others",style: TextStyle(fontSize: 10)),
|
|
|
|
gender = value.toString();
|
|
|
|
value: "other",
|
|
|
|
});
|
|
|
|
groupValue: gender,
|
|
|
|
},
|
|
|
|
activeColor: primaryColor,
|
|
|
|
),
|
|
|
|
onChanged: (value){
|
|
|
|
),
|
|
|
|
setState(() {
|
|
|
|
Expanded(
|
|
|
|
gender = value.toString();
|
|
|
|
child: RadioListTile(
|
|
|
|
});
|
|
|
|
title:
|
|
|
|
},
|
|
|
|
Text("Others", style: TextStyle(fontSize: 10)),
|
|
|
|
),),
|
|
|
|
value: "other",
|
|
|
|
|
|
|
|
groupValue: gender,
|
|
|
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
gender = value.toString();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
),
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
Visibility(
|
|
|
|
context: context,
|
|
|
|
visible: uiFindingsImages.length == 0,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
child: ElevatedButton(
|
|
|
|
return SizedBox(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
height: 200,
|
|
|
|
primary: primaryColor, // background
|
|
|
|
child: Center(
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
child: Row(
|
|
|
|
),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
onPressed: () async {
|
|
|
|
children: <Widget>[
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
GestureDetector(
|
|
|
|
context: context,
|
|
|
|
child: Icon(
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
Icons.camera_alt_outlined,
|
|
|
|
return SizedBox(
|
|
|
|
size: 100,
|
|
|
|
height: 200,
|
|
|
|
color: primaryColor,
|
|
|
|
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);
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
SizedBox(
|
|
|
|
await takeImageFromCamera();
|
|
|
|
width:
|
|
|
|
Navigator.pop(context);
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
},
|
|
|
|
.20,
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
|
|
|
.20,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.photo,
|
|
|
|
|
|
|
|
size: 100,
|
|
|
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
GestureDetector(
|
|
|
|
await pickImageFromGallery();
|
|
|
|
child: Icon(
|
|
|
|
Navigator.pop(context);
|
|
|
|
Icons.photo,
|
|
|
|
},
|
|
|
|
size: 100,
|
|
|
|
),
|
|
|
|
color: primaryColor,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
await pickImageFromGallery();
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text('Select Findings'),
|
|
|
|
child: const Text('Select Findings'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible: uiFindingsImages.length > 0,
|
|
|
|
visible: uiFindingsImages.length > 0,
|
|
|
@ -384,8 +437,11 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Card(
|
|
|
|
Card(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
.30,
|
|
|
|
|
|
|
|
height:
|
|
|
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
|
|
|
.15,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: DecorationImage(
|
|
|
@ -407,54 +463,111 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
ElevatedButton(
|
|
|
|
Visibility(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
visible: uiFindingsImages.length != 0,
|
|
|
|
primary: primaryColor, // background
|
|
|
|
child: ElevatedButton(
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
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'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
),
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
Visibility(
|
|
|
|
context: context,
|
|
|
|
visible: uiReportsImages.length == 0,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
child: ElevatedButton(
|
|
|
|
return SizedBox(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
height: 200,
|
|
|
|
primary: primaryColor, // background
|
|
|
|
child: Center(
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
child: Row(
|
|
|
|
),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
onPressed: () async {
|
|
|
|
children: <Widget>[
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
GestureDetector(
|
|
|
|
context: context,
|
|
|
|
child: Icon(
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
Icons.camera_alt_outlined,
|
|
|
|
return SizedBox(
|
|
|
|
size: 100,
|
|
|
|
height: 200,
|
|
|
|
color: primaryColor,
|
|
|
|
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);
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
SizedBox(
|
|
|
|
await takeImageFromCameraForReports();
|
|
|
|
width:
|
|
|
|
Navigator.pop(context);
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
},
|
|
|
|
.20,
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
|
|
|
.20,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.photo,
|
|
|
|
|
|
|
|
size: 100,
|
|
|
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
GestureDetector(
|
|
|
|
await pickImageFromGalleryForReports();
|
|
|
|
child: Icon(
|
|
|
|
Navigator.pop(context);
|
|
|
|
Icons.photo,
|
|
|
|
},
|
|
|
|
size: 100,
|
|
|
|
),
|
|
|
|
color: primaryColor,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
await pickImageFromGalleryForReports();
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text('Select Reports'),
|
|
|
|
child: const Text('Select Reports'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible: uiReportsImages.length > 0,
|
|
|
|
visible: uiReportsImages.length > 0,
|
|
|
@ -469,15 +582,18 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Card(
|
|
|
|
Card(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
.30,
|
|
|
|
|
|
|
|
height:
|
|
|
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
|
|
|
.15,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
uiReportsImages[index]
|
|
|
|
uiReportsImages[index]
|
|
|
|
['url'])
|
|
|
|
['url'])
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
fit: BoxFit.fill)),
|
|
|
|
fit: BoxFit.fill)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -492,56 +608,112 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
ElevatedButton(
|
|
|
|
Visibility(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
visible: uiReportsImages.length != 0,
|
|
|
|
primary: primaryColor, // background
|
|
|
|
child: ElevatedButton(
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
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'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
),
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
Visibility(
|
|
|
|
context: context,
|
|
|
|
visible: uiPrescriptionImages.length == 0,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
child: ElevatedButton(
|
|
|
|
return SizedBox(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
height: 200,
|
|
|
|
primary: primaryColor, // background
|
|
|
|
child: Center(
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
child: Row(
|
|
|
|
),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
onPressed: () async {
|
|
|
|
children: <Widget>[
|
|
|
|
showModalBottomSheet<void>(
|
|
|
|
GestureDetector(
|
|
|
|
context: context,
|
|
|
|
child: Icon(
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
Icons.camera_alt_outlined,
|
|
|
|
return SizedBox(
|
|
|
|
size: 100,
|
|
|
|
height: 200,
|
|
|
|
color: primaryColor,
|
|
|
|
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);
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
SizedBox(
|
|
|
|
await takeImageFromCameraForPrescriptions();
|
|
|
|
width:
|
|
|
|
Navigator.pop(context);
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
},
|
|
|
|
.20,
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
|
|
|
|
.20,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.photo,
|
|
|
|
|
|
|
|
size: 100,
|
|
|
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
|
|
|
GestureDetector(
|
|
|
|
await pickImageFromGalleryForPrescriptions();
|
|
|
|
child: Icon(
|
|
|
|
Navigator.pop(context);
|
|
|
|
Icons.photo,
|
|
|
|
},
|
|
|
|
size: 100,
|
|
|
|
),
|
|
|
|
color: primaryColor,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
await pickImageFromGalleryForPrescriptions();
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text('Select Prescriptions'),
|
|
|
|
child: const Text('Select Prescriptions'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible: uiPrescriptionImages.length > 0,
|
|
|
|
visible: uiPrescriptionImages.length > 0,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
@ -555,16 +727,44 @@ class _AddReportsState extends State<AddReports> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Card(
|
|
|
|
Card(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: MediaQuery.of(context).size.width * .30,
|
|
|
|
width: MediaQuery.of(context).size.width *
|
|
|
|
height: MediaQuery.of(context).size.height * .15,
|
|
|
|
.30,
|
|
|
|
|
|
|
|
height:
|
|
|
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
|
|
|
.15,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
uiPrescriptionImages[index]
|
|
|
|
uiPrescriptionImages[index]['url'])
|
|
|
|
['url'])
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
|
|
|
fit: BoxFit.fill)),
|
|
|
|
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(
|
|
|
|
/*Expanded(child:IconButton(
|
|
|
@ -578,89 +778,149 @@ 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(
|
|
|
|
Container(
|
|
|
|
width:double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
child: ElevatedButton(
|
|
|
|
child: ElevatedButton(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
primary: buttonColors, // background
|
|
|
|
primary: buttonColors, // background
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async{
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
if (doctorNameController.text != '' &&
|
|
|
|
if(doctorNameController.text!=''&& problemController.text!=''&& dateInput.text!=''&&prescriptionFor!=''){
|
|
|
|
problemController.text != '' &&
|
|
|
|
|
|
|
|
dateInput.text != '' &&
|
|
|
|
String _name='';
|
|
|
|
prescriptionFor != '') {
|
|
|
|
String _age='';
|
|
|
|
String _name = '';
|
|
|
|
String? _gender='';
|
|
|
|
String _age = '';
|
|
|
|
|
|
|
|
String? _gender = '';
|
|
|
|
if(prescriptionFor.toString().toLowerCase()=='others'){
|
|
|
|
|
|
|
|
if(patientNameController!=''&& patientAgeController.text!=''&&gender!=''){
|
|
|
|
if (prescriptionFor.toString().toLowerCase() ==
|
|
|
|
_name=patientNameController.text;
|
|
|
|
'others') {
|
|
|
|
_age=patientAgeController.text;
|
|
|
|
if (patientNameController != '' &&
|
|
|
|
_gender=gender;
|
|
|
|
patientAgeController.text != '' &&
|
|
|
|
|
|
|
|
gender != '') {
|
|
|
|
|
|
|
|
_name = patientNameController.text;
|
|
|
|
|
|
|
|
_age = patientAgeController.text;
|
|
|
|
|
|
|
|
_gender = gender;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
|
|
|
'Please enter details');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
} else {
|
|
|
|
AppSettings.longFailedToast('Please enter details');
|
|
|
|
_name = AppSettings.userName;
|
|
|
|
}
|
|
|
|
_age = AppSettings.age;
|
|
|
|
}
|
|
|
|
_gender = AppSettings.gender;
|
|
|
|
else{
|
|
|
|
|
|
|
|
_name=AppSettings.userName;
|
|
|
|
|
|
|
|
_age=AppSettings.age;
|
|
|
|
|
|
|
|
_gender=AppSettings.gender;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
bool isOnline = await AppSettings.internetConnectivity();
|
|
|
|
bool isOnline =
|
|
|
|
if(isOnline){
|
|
|
|
await AppSettings.internetConnectivity();
|
|
|
|
|
|
|
|
if (isOnline) {
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
payload["problem"] = problemController.text.toString();
|
|
|
|
payload["problem"] =
|
|
|
|
payload["doctorName"] = doctorNameController.text.toString();
|
|
|
|
problemController.text.toString();
|
|
|
|
payload["hospitalName"] = hospitalNameController.text.toString();
|
|
|
|
payload["doctorName"] =
|
|
|
|
payload["date"] = dateInput.text.toString();
|
|
|
|
doctorNameController.text.toString();
|
|
|
|
payload["findings_date"] = '';
|
|
|
|
payload["hospitalName"] =
|
|
|
|
payload["reports_date"] = '';
|
|
|
|
hospitalNameController.text.toString();
|
|
|
|
payload["prescription_date"] = '';
|
|
|
|
payload["date"] = dateInput.text.toString();
|
|
|
|
payload["patientType"] = prescriptionFor.toString();
|
|
|
|
payload["findings_date"] = '';
|
|
|
|
payload["others"] ={
|
|
|
|
payload["reports_date"] = '';
|
|
|
|
"name": _name,
|
|
|
|
payload["prescription_date"] = '';
|
|
|
|
"age": int.parse(_age),
|
|
|
|
payload["patientType"] =
|
|
|
|
"gender": _gender.toString().toLowerCase()
|
|
|
|
prescriptionFor.toString();
|
|
|
|
};
|
|
|
|
payload["others"] = {
|
|
|
|
payload["findings"] =uiFindingsImages;
|
|
|
|
"name": _name,
|
|
|
|
payload["reports"] =uiReportsImages;
|
|
|
|
"age": int.parse(_age),
|
|
|
|
payload["prescription"] =uiPrescriptionImages;
|
|
|
|
"gender": _gender.toString().toLowerCase()
|
|
|
|
|
|
|
|
};
|
|
|
|
bool uploadStatus = await AppSettings.addRecords(payload);
|
|
|
|
payload["findings"] = uiFindingsImages;
|
|
|
|
|
|
|
|
payload["reports"] = uiReportsImages;
|
|
|
|
try{
|
|
|
|
payload["prescription"] = uiPrescriptionImages;
|
|
|
|
if(uploadStatus){
|
|
|
|
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
bool uploadStatus =
|
|
|
|
AppSettings.longSuccessToast('Record added successfully');
|
|
|
|
await AppSettings.addRecords(payload);
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
else{
|
|
|
|
if (uploadStatus) {
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
AppSettings.longFailedToast('Fail to add record details');
|
|
|
|
.pop();
|
|
|
|
}
|
|
|
|
AppSettings.longSuccessToast(
|
|
|
|
|
|
|
|
'Record added successfully');
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
|
|
|
|
.pop();
|
|
|
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
|
|
|
'Fail to add record details');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(e){
|
|
|
|
} catch (e) {
|
|
|
|
print(e);
|
|
|
|
print(e);
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
Navigator.of(context, rootNavigator: true)
|
|
|
|
AppSettings.longFailedToast('Fail to add record details');
|
|
|
|
.pop();
|
|
|
|
}
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
|
|
|
'Fail to add record details');
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
AppSettings.longFailedToast('Please check internet');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
|
|
|
'Please check internet');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
} else {
|
|
|
|
AppSettings.longFailedToast('Please enter valid details');
|
|
|
|
AppSettings.longFailedToast(
|
|
|
|
|
|
|
|
'Please enter valid details');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text('Submit'),
|
|
|
|
child: const Text('Submit'),
|
|
|
|