Compare commits

..

7 Commits
dev ... master

@ -0,0 +1,67 @@
{
"project_info": {
"project_number": "60196905754",
"project_id": "health-pharma-67443",
"storage_bucket": "health-pharma-67443.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:60196905754:android:05ea9ecef5280e578a42a3",
"android_client_info": {
"package_name": "com.arminta.healthcare_pharmacy"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:60196905754:android:44f95d2cea26698a8a42a3",
"android_client_info": {
"package_name": "com.arminta.healthcare_user"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:60196905754:android:a35c084e291315488a42a3",
"android_client_info": {
"package_name": "com.arminta.healthparma"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

@ -0,0 +1,6 @@
package com.arminta.healthcare_user;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

@ -12,7 +12,6 @@ class BMICalculator extends StatefulWidget {
} }
class _BMICalculatorState extends State<BMICalculator> { class _BMICalculatorState extends State<BMICalculator> {
TextEditingController heightController = TextEditingController(); TextEditingController heightController = TextEditingController();
TextEditingController inchesController = TextEditingController(); TextEditingController inchesController = TextEditingController();
TextEditingController cmsController = TextEditingController(); TextEditingController cmsController = TextEditingController();
@ -22,6 +21,7 @@ class _BMICalculatorState extends State<BMICalculator> {
String bmiValue = ''; String bmiValue = '';
String bmiText = ''; String bmiText = '';
Color bmiTextColor = Colors.black;
var heightUnitItems = [ var heightUnitItems = [
'feet', 'feet',
'cm', 'cm',
@ -32,12 +32,12 @@ class _BMICalculatorState extends State<BMICalculator> {
]; ];
var weightUnits = 'kg'; var weightUnits = 'kg';
@override @override
void initState() { void initState() {
ageController.text=AppSettings.age; ageController.text = AppSettings.age;
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -125,7 +125,7 @@ class _BMICalculatorState extends State<BMICalculator> {
), ),
SizedBox(height: 10), SizedBox(height: 10),
Visibility( Visibility(
visible:heightUnits=='feet', visible: heightUnits == 'feet',
child: Container( child: Container(
//height: 60, //height: 60,
child: Row( child: Row(
@ -184,12 +184,12 @@ class _BMICalculatorState extends State<BMICalculator> {
), ),
), ),
SizedBox(width: 5), SizedBox(width: 5),
], ],
), ),
),), ),
),
Visibility( Visibility(
visible:heightUnits=='cm', visible: heightUnits == 'cm',
child: Container( child: Container(
//height: 60, //height: 60,
child: Row( child: Row(
@ -220,10 +220,10 @@ class _BMICalculatorState extends State<BMICalculator> {
), ),
), ),
), ),
], ],
), ),
),), ),
),
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
//height: 40, //height: 40,
@ -357,8 +357,7 @@ class _BMICalculatorState extends State<BMICalculator> {
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
width: double.infinity, width: double.infinity,
height: height: MediaQuery.of(context).size.height * .05,
MediaQuery.of(context).size.height * .05,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: buttonColors, // background primary: buttonColors, // background
@ -366,31 +365,47 @@ class _BMICalculatorState extends State<BMICalculator> {
), ),
onPressed: () async { onPressed: () async {
if (ageController.text != '' && if (ageController.text != '' &&
heightController.text != '' ||cmsController.text!=''&& heightController.text != '' ||
weightController.text != ''&&dateInput.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); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
if(heightUnits.toString().toLowerCase()=='feet'){ if (heightUnits.toString().toLowerCase() ==
cmsController.text=''; 'feet') {
} cmsController.text = '';
else{ } else {
heightController.text=''; heightController.text = '';
inchesController.text=''; inchesController.text = '';
} }
payload["age"] = int.parse(ageController.text.toString()); payload["age"] =
int.parse(ageController.text.toString());
payload["feet"] = heightController.text.toString(); payload["feet"] = heightController.text.toString();
payload["inches"] = inchesController.text.toString(); payload["inches"] =
inchesController.text.toString();
payload["height"] = cmsController.text.toString(); payload["height"] = cmsController.text.toString();
payload["weight"] = weightController.text.toString(); payload["weight"] =
weightController.text.toString();
payload["heightUnit"] = heightUnits.toString(); payload["heightUnit"] = heightUnits.toString();
payload["weightUnit"] = weightUnits.toString(); payload["weightUnit"] = weightUnits.toString();
payload["date"] = dateInput.text.toString(); payload["date"] = dateInput.text.toString();
try{ try {
var value = await AppSettings.calculateBmi(payload); var value =
await AppSettings.calculateBmi(payload);
var valueResponse = jsonDecode(value); var valueResponse = jsonDecode(value);
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
heightController.clear(); heightController.clear();
@ -399,36 +414,34 @@ class _BMICalculatorState extends State<BMICalculator> {
weightController.clear(); weightController.clear();
dateInput.clear(); dateInput.clear();
setState(() { setState(() {
bmiValue = valueResponse['userDetails']['bmivalue'].toString(); bmiValue = valueResponse['userDetails']
if(double.parse(bmiValue)<18.5){ ['bmivalue']
bmiText='Underweight'; .toString();
} if (double.parse(bmiValue) < 18.5) {
else if(double.parse(bmiValue)>=18.5&&double.parse(bmiValue)<=24.9){ bmiText = 'Underweight';
bmiText='Normal weight'; bmiTextColor=Colors.red;
} } else if (double.parse(bmiValue) >= 18.5 &&
else if(double.parse(bmiValue)>=25&&double.parse(bmiValue)<=29.9){ double.parse(bmiValue) <= 24.9) {
bmiText='Overweight'; 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;
} }
else if(double.parse(bmiValue)>=30){
bmiText='Obesity';
}
}); });
} catch (e) {
}
catch(e){
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast('Calculating BMI failed'); AppSettings.longFailedToast(
'Calculating BMI failed');
} }
} }
else{ } else {
AppSettings.longFailedToast('Please enter valid details'); AppSettings.longFailedToast(
'Please enter valid details');
} }
}, },
child: const Text('Calculate BMI'), child: const Text('Calculate BMI'),
@ -437,29 +450,46 @@ class _BMICalculatorState extends State<BMICalculator> {
Container( Container(
child: Row( child: Row(
children: [ children: [
Text('Your BMI value: $bmiValue',style: TextStyle(fontSize:15,fontWeight: FontWeight.bold),), Text(
SizedBox(width: 10,), 'Your BMI value: $bmiValue',
Text(bmiText,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold)), style:
], TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
) ),
SizedBox(
width: 10,
), ),
Text(bmiText,
style: TextStyle(
color: bmiTextColor, fontWeight: FontWeight.bold,fontSize: 20)),
],
)),
SizedBox(height: 30), SizedBox(height: 30),
Container( Container(
child: Text('Underweight = <18.5',style: bmiTextStyle(),), child: Text(
'Underweight = <18.5',
style: bmiTextStyle(),
),
), ),
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
child: Text('Normal weight = 18.524.9',style: bmiTextStyle()), child:
Text('Normal weight = 18.524.9', style: bmiTextStyle()),
), ),
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
child: Text('Overweight = 2529.9',style: bmiTextStyle()), child: Text('Overweight = 2529.9', style: bmiTextStyle()),
), ),
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
child: Text('Obesity = BMI of 30 or greater',style: bmiTextStyle()), child: Text('Obesity = BMI of 30 or greater',
style: bmiTextStyle()),
), ),
SizedBox(height: 20), SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton( IconButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -475,16 +505,34 @@ class _BMICalculatorState extends State<BMICalculator> {
), ),
), ),
SizedBox(height: 10), SizedBox(height: 10),
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0), Padding(
padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Container( child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)), 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'),
) )
); ],
)
],
),
)),
));
} }
} }

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:healthcare_user/BMI/bmi_caluculator.dart';
import 'package:healthcare_user/chart/bmi_chart.dart'; import 'package:healthcare_user/chart/bmi_chart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/models/bmi_history_model.dart'; import 'package:healthcare_user/models/bmi_history_model.dart';
@ -44,17 +45,20 @@ class _BMIHistoryState extends State<BMIHistory> {
return now_1w.isBefore(date); return now_1w.isBefore(date);
//reportsList=reportsListOriginal.reversed.toList(); //reportsList=reportsListOriginal.reversed.toList();
}).toList(); }).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') { }
else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = bmiHistoryList.where((product) { FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter; final date = product.dateForFilter;
return now_1m.isBefore(date); return now_1m.isBefore(date);
}).toList(); }).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') { }
else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = bmiHistoryList.where((product) { FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter; final date = product.dateForFilter;
return now_1y.isBefore(date); return now_1y.isBefore(date);
}).toList(); }).toList();
} else { }
else {
FilteredList = bmiHistoryList; FilteredList = bmiHistoryList;
} }
@ -90,7 +94,8 @@ class _BMIHistoryState extends State<BMIHistory> {
} }
Widget renderzUi() { Widget renderzUi() {
if (bmiHistoryList.length != 0) { if (FilteredList.length != 0) {
FilteredList.sort((a, b) => a.actualDate.compareTo(b.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [ return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding( Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10), padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
@ -315,7 +320,10 @@ class _BMIHistoryState extends State<BMIHistory> {
FilteredList[index].bmiText FilteredList[index].bmiText
.toString() .toString()
.toUpperCase(), .toUpperCase(),
style: valuesTextStyle()), style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,color: FilteredList[index].bmiTextColor
)),
) )
], ],
), ),
@ -330,7 +338,8 @@ class _BMIHistoryState extends State<BMIHistory> {
})), })),
]); ]);
} else { }
else {
return Center( return Center(
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0), padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
@ -350,10 +359,14 @@ class _BMIHistoryState extends State<BMIHistory> {
child: IconButton( child: IconButton(
iconSize: 40, iconSize: 40,
icon: const Icon( icon: const Icon(
Icons.info, Icons.add,
color: Colors.white, color: Colors.white,
), ),
onPressed: () async {}, onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BMICalculator())).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
), ),
) )
], ],
@ -374,6 +387,37 @@ class _BMIHistoryState extends State<BMIHistory> {
), ),
) )
: renderzUi(), : 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())).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
); );
} }
} }

@ -138,6 +138,8 @@ class _BPCalculatorState extends State<BPCalculator> {
onPressed: () async { onPressed: () async {
if (systoloicController.text != '' && if (systoloicController.text != '' &&
diastolicController.text != ''&&dateInput.text!='') { diastolicController.text != ''&&dateInput.text!='') {
if(int.parse(systoloicController.text)>int.parse(diastolicController.text)){
AppSettings.preLoaderDialog(context); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
@ -156,6 +158,10 @@ class _BPCalculatorState extends State<BPCalculator> {
dateInput.clear(); dateInput.clear();
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
} }
else{
AppSettings.longFailedToast('Please enter diastolic value less than systolic value');
}
}
else{ else{
AppSettings.longFailedToast('Please enter valid details'); AppSettings.longFailedToast('Please enter valid details');
} }
@ -171,6 +177,11 @@ class _BPCalculatorState extends State<BPCalculator> {
) )
), ),
SizedBox(height: 20), SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton( IconButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -190,6 +201,21 @@ class _BPCalculatorState extends State<BPCalculator> {
child: Container( child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)), 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'),
)
],
)
], ],
), ),

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/BP/bp_calculator.dart';
import 'package:healthcare_user/chart/bpchart.dart'; import 'package:healthcare_user/chart/bpchart.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/bp_history_model.dart'; import 'package:healthcare_user/models/bp_history_model.dart';
@ -84,7 +85,8 @@ class _BPHistoryState extends State<BPHistory> {
} }
Widget renderzUi() { Widget renderzUi() {
if (BpHistoryList.length != 0) { if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding( Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10), padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
@ -306,10 +308,14 @@ class _BPHistoryState extends State<BPHistory> {
child: IconButton( child: IconButton(
iconSize: 40, iconSize: 40,
icon: const Icon( icon: const Icon(
Icons.info, Icons.add,
color: Colors.white, color: Colors.white,
), ),
onPressed: () async {}, onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BPCalculator())).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
), ),
) )
], ],
@ -330,6 +336,37 @@ class _BPHistoryState extends State<BPHistory> {
), ),
) )
: renderzUi(), : 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())).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
); );
} }
} }

@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/zoom_image.dart'; import 'package:healthcare_user/common/zoom_image.dart';
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
import 'package:healthcare_user/my_connections/add-doctor.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:multi_image_picker/multi_image_picker.dart'; import 'package:multi_image_picker/multi_image_picker.dart';
@ -16,6 +18,7 @@ class AddReports extends StatefulWidget {
} }
class _AddReportsState extends State<AddReports> { class _AddReportsState extends State<AddReports> {
TextEditingController doctorNameController = TextEditingController(); TextEditingController doctorNameController = TextEditingController();
TextEditingController hospitalNameController = TextEditingController(); TextEditingController hospitalNameController = TextEditingController();
TextEditingController problemController = TextEditingController(); TextEditingController problemController = TextEditingController();
@ -31,7 +34,6 @@ class _AddReportsState extends State<AddReports> {
List uiFindingsImages = []; List uiFindingsImages = [];
List uiReportsImages = []; List uiReportsImages = [];
List uiPrescriptionImages = []; List uiPrescriptionImages = [];
Map<String,dynamic> findings={}; Map<String,dynamic> findings={};
List<Asset> images = <Asset>[]; List<Asset> images = <Asset>[];
String _error = 'No Error Dectected'; String _error = 'No Error Dectected';
@ -42,7 +44,33 @@ class _AddReportsState extends State<AddReports> {
Map<String,dynamic> reports={}; Map<String,dynamic> reports={};
Map<String,dynamic> prescriptions={}; Map<String,dynamic> prescriptions={};
String? prescriptionFor; String? prescriptionFor;
String? problemCategory;
String? gender; String? gender;
var doctorNameVariable;
List<GetConnectedDoctorsModel> connectedDoctorsListOriginal = [];
Future<void> getAllConnectedDoctors() async {
try {
var response = await AppSettings.getAllConnectedDoctors();
setState(() {
connectedDoctorsListOriginal = ((jsonDecode(response)['doctors']) as List)
.map((dynamic model) {
return GetConnectedDoctorsModel.fromJson(model);
}).toList();
//connectedDoctorsListOriginal=connectedDoctorsListOriginal.reversed.toList();
//dateItemsVariable=connectedDoctorsListOriginal[0].doctor_name;
});
} catch (e) {
AppSettings.longFailedToast('There is an issue please wait some time');
}
}
@override
void initState() {
getAllConnectedDoctors();
super.initState();
}
Future pickImageFromGallery() async { Future pickImageFromGallery() async {
imageFileList = []; imageFileList = [];
@ -120,39 +148,6 @@ class _AddReportsState extends State<AddReports> {
} }
} }
/*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 {
final image = await _picker.pickImage(source: ImageSource.camera); final image = await _picker.pickImage(source: ImageSource.camera);
@ -227,8 +222,6 @@ 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);
@ -348,7 +341,7 @@ class _AddReportsState extends State<AddReports> {
return WillPopScope( return WillPopScope(
onWillPop: () async => onWillPop(), onWillPop: () async => onWillPop(),
child: Scaffold( child: Scaffold(
appBar: AppSettings.appBar('Reports'), appBar: AppSettings.appBar('Add Record'),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Padding( child: Padding(
@ -357,26 +350,64 @@ class _AddReportsState extends State<AddReports> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
child: TextFormField( child: connectedDoctorsListOriginal.length!=0?DropdownButtonFormField(
cursorColor: greyColor, value: doctorNameVariable,
controller: doctorNameController, isExpanded: true,
textCapitalization: TextCapitalization.words, decoration: const InputDecoration(
decoration: textFormFieldDecoration( prefixIcon: Icon(
Icons.person, 'Enter Doctor name'), Icons.person,
color: greyColor,
), ),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
), ),
SizedBox( enabledBorder: OutlineInputBorder(
height: MediaQuery.of(context).size.height * .02, borderSide: BorderSide(color: primaryColor),
), ),
Container( labelText: 'Select Doctor',
child: TextFormField( labelStyle: TextStyle(
cursorColor: greyColor, color: greyColor, //<-- SEE HERE
controller: hospitalNameController,
textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(
Icons.location_city_outlined, 'Enter Hospital name'),
), ),
), ),
hint: Text('Please Select Doctor'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: connectedDoctorsListOriginal.map((items) {
return DropdownMenuItem(
value: items,
child: Text(
items.doctor_name,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: ( newValue) {
setState(() {
doctorNameVariable = newValue;
});
},
):
IconButton(
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddDoctor())).then((value) {
getAllConnectedDoctors();
});
},
icon: Icon(
Icons.add,
color: primaryColor,
size: 40,
),
),),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * .02, height: MediaQuery.of(context).size.height * .02,
), ),
@ -385,7 +416,7 @@ class _AddReportsState extends State<AddReports> {
cursorColor: greyColor, cursorColor: greyColor,
controller: problemController, controller: problemController,
textCapitalization: TextCapitalization.words, textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration( decoration: textFormFieldDecorationGrey(
Icons.report_problem, 'Enter Problem'), Icons.report_problem, 'Enter Problem'),
), ),
), ),
@ -396,7 +427,7 @@ class _AddReportsState extends State<AddReports> {
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: dateInput, controller: dateInput,
decoration: textFormFieldDecoration( decoration: textFormFieldDecorationGrey(
Icons.calendar_today, 'Enter Date'), Icons.calendar_today, 'Enter Date'),
readOnly: true, readOnly: true,
onTap: () async { onTap: () async {
@ -436,6 +467,43 @@ class _AddReportsState extends State<AddReports> {
}, },
), ),
), ),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
Text('Select Problem Category',
style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),),
Row(
children: [
Expanded(
child: RadioListTile(
title: Text("General"),
value: "general",
groupValue: problemCategory,
activeColor: primaryColor,
onChanged: (value) {
setState(() {
problemCategory = value.toString();
});
},
),
),
Expanded(
child: RadioListTile(
title: Text("Confidential"),
value: "confidential",
groupValue: problemCategory,
activeColor: primaryColor,
onChanged: (value) {
setState(() {
problemCategory = value.toString();
});
},
),
),
],
),
Text('Select Problem For',
style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 14),),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -547,6 +615,7 @@ class _AddReportsState extends State<AddReports> {
], ],
), ),
), ),
/*findings*/ /*findings*/
Visibility( Visibility(
visible: uiFindingsImages.length == 0, visible: uiFindingsImages.length == 0,
@ -1098,6 +1167,7 @@ class _AddReportsState extends State<AddReports> {
child: const Text('Add Prescriptions'), 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,
@ -1107,10 +1177,9 @@ class _AddReportsState extends State<AddReports> {
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () async { onPressed: () async {
if (doctorNameController.text != '' && if (doctorNameVariable!=''&&problemController.text != '' &&
problemController.text != '' &&
dateInput.text != '' && dateInput.text != '' &&
prescriptionFor != '') { prescriptionFor != ''&&problemCategory!='') {
String _name = ''; String _name = '';
String _age = ''; String _age = '';
String? _gender = ''; String? _gender = '';
@ -1139,16 +1208,15 @@ class _AddReportsState extends State<AddReports> {
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
payload["problem"] = payload["problem"] =
problemController.text.toString(); problemController.text.toString();
payload["doctorName"] = payload["doctorName"] = doctorNameVariable.doctor_name.toString();
doctorNameController.text.toString(); payload["hospitalName"] = doctorNameVariable.hospital_name.toString();
payload["hospitalName"] = payload["doctorId"] = doctorNameVariable.doctor_id.toString();
hospitalNameController.text.toString();
payload["date"] = dateInput.text.toString(); payload["date"] = dateInput.text.toString();
payload["findings_date"] = ''; payload["findings_date"] = '';
payload["reports_date"] = ''; payload["reports_date"] = '';
payload["prescription_date"] = ''; payload["prescription_date"] = '';
payload["patientType"] = payload["patientType"] = prescriptionFor.toString();
prescriptionFor.toString(); payload["problemCategory"] = problemCategory.toString();
payload["others"] = { payload["others"] = {
"name": _name, "name": _name,
"age": int.parse(_age), "age": int.parse(_age),

@ -159,8 +159,7 @@ class _AllReportsTabState extends State<AllReportsTab>
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Expanded( Expanded(child: GridView.builder(
child: GridView.builder(
itemCount: widget.recordDetails.findingsImages.length, itemCount: widget.recordDetails.findingsImages.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: 3,

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/Reports/add_reports.dart'; import 'package:healthcare_user/Reports/add_reports.dart';
import 'package:healthcare_user/Reports/all_records_tab.dart'; import 'package:healthcare_user/Reports/all_records_tab.dart';
@ -10,6 +11,7 @@ import 'package:healthcare_user/Reports/update_report.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/zoom_image.dart'; import 'package:healthcare_user/common/zoom_image.dart';
import 'package:healthcare_user/models/reports_model.dart'; import 'package:healthcare_user/models/reports_model.dart';
import 'package:healthcare_user/report_problem/all-records_onclick_new.dart';
import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -29,12 +31,22 @@ class _AllReportsState extends State<AllReports> {
bool isSereverIssue = false; bool isSereverIssue = false;
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
TextEditingController dateInput = TextEditingController(); TextEditingController dateInput = TextEditingController();
TextEditingController fromdateController = TextEditingController();
TextEditingController todateController = TextEditingController();
DateTime fromDate=DateTime.now();
String dropdownSearchType = 'Problem'; String dropdownSearchType = 'Problem';
String? searchBy;
var typeOfSearchItems = [ var typeOfSearchItems = [
'Problem', 'Problem',
'Doctor', 'Doctor',
'Date', 'Date',
]; ];
final List<String> imgList = [
'images/mobilebg.png',
'images/mobilebg2.png',
'images/mobilebg3.png'
];
List images = ['img1', 'img2', 'img3'];
Future<void> getAllRecords() async { Future<void> getAllRecords() async {
isReportsDataLoading=true; isReportsDataLoading=true;
@ -57,7 +69,6 @@ class _AllReportsState extends State<AllReports> {
} }
} }
Future<void> getRecordsByProblemName(var problem) async { Future<void> getRecordsByProblemName(var problem) async {
isReportsDataLoading=true; isReportsDataLoading=true;
@ -133,54 +144,58 @@ class _AllReportsState extends State<AllReports> {
} }
} }
@override Future<void> getRecordsByDateRange(var fromDate,var toDate) async {
void initState() { isReportsDataLoading = true;
getAllRecords();
super.initState();
}
try {
var response = await AppSettings.getAllRecords();
showPicDialog(var imageUrl){ setState(() {
return showDialog( reportsListOriginal = ((jsonDecode(response)) as List)
context: context, .map((dynamic model) {
barrierDismissible: false, return ReportsModel.fromJson(model);
builder: (BuildContext context) { }).toList();
return StatefulBuilder( reportsList=reportsListOriginal.reversed.toList();
builder: (BuildContext context, StateSetter setState) { var dateToCheck = DateTime.now().add(Duration(days: -1));
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,
) reportsList = reportsListOriginal.reversed.where((product) {
) final date = product.dateForFilter;
], final startDate =DateFormat('dd-MM-yyyy').parse(fromDate);
), final endDate = DateFormat('dd-MM-yyyy').parse(toDate);
), return date.isAfter(startDate) && date.isBefore(endDate);
actions: <Widget>[
TextButton( //reportsList=reportsListOriginal.reversed.toList();
child: Text('Close', style: textButtonStyle()), }).toList();
onPressed: () {
Navigator.of(context).pop(); /*if( dateToCheck.isAfter(startDate) && dateToCheck.isBefore(endDate))
}, {
), print("dateToCheck is between now and lastYear");
], }
); else
{
print("dateToCheck is not between now and lastYear");
}*/
isReportsDataLoading = false;
}); });
}, } catch (e) {
); setState(() {
isReportsDataLoading = false;
isSereverIssue = true;
});
}
} }
@override
void initState() {
getAllRecords();
var now = new DateTime.now();
String formattedDate = DateFormat('dd-MM-yyyy').format(now);
fromdateController.text=formattedDate;
todateController.text=formattedDate;
super.initState();
}
Widget findings(var obj){ Widget findings(var obj){
return Container( return Container(
@ -333,9 +348,52 @@ class _AllReportsState extends State<AllReports> {
Widget _filtereddata(){ Widget _filtereddata(){
if(reportsList.length!=0){ if(reportsList.length!=0){
return ListView.builder( reportsList.sort((a, b) => b.date.compareTo(a.date));
return ListView.separated(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
itemCount: reportsList.length, itemCount: reportsList.length,
separatorBuilder: (context, index) {
if ((index + 1) % 2 == 0) {
return CarouselSlider(
options: CarouselOptions(
height: MediaQuery.of(context).size.height * .200,
aspectRatio: 16 / 9,
viewportFraction: 0.8,
initialPage: 0,
enableInfiniteScroll: true,
reverse: false,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.ease,
enlargeCenterPage: true,
enlargeFactor: 0.2,
scrollDirection: Axis.horizontal,
),
items: imgList.map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .250,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
//color: Colors.red,
child: FittedBox(
child: Image(
image: AssetImage(i),
),
fit: BoxFit.fill,
));
},
);
}).toList(),
);
} else {
return Container();
}
},
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: (){
@ -343,7 +401,7 @@ class _AllReportsState extends State<AllReports> {
Navigator.push( Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) { builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
getAllRecords(); getAllRecords();
}); });
}, },
@ -470,18 +528,18 @@ class _AllReportsState extends State<AllReports> {
onPrimary: Colors.white, // foreground onPrimary: Colors.white, // foreground
), ),
onPressed: () async { onPressed: () async {
/*Navigator.push( Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new FindingImages(imageDetails:reportsList[index].findingsImages,recordId: reportsList[index].recordId,))).then((value) { builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
getAllRecords(); getAllRecords();
});*/ });
Navigator.push( /*Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) { builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
getAllRecords(); getAllRecords();
}); });*/
}, },
child: Text('Findings: '+reportsList[index].findingsImages.length.toString(),style:textButtonStyleReports(),), child: Text('Findings: '+reportsList[index].findingsImages.length.toString(),style:textButtonStyleReports(),),
), ),
@ -494,18 +552,18 @@ class _AllReportsState extends State<AllReports> {
onPrimary: Colors.white, // foreground onPrimary: Colors.white, // foreground
), ),
onPressed: () async { onPressed: () async {
/*Navigator.push( Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new ReportImages(imageDetails:reportsList[index].reportImages,recordId:reportsList[index].recordId ,))).then((value) { builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
getAllRecords(); getAllRecords();
});*/ });
Navigator.push( /*Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 1,))).then((value) { builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 1,))).then((value) {
getAllRecords(); getAllRecords();
}); });*/
}, },
child: Text('Reports: '+reportsList[index].reportImages.length.toString(),style:textButtonStyleReports()), child: Text('Reports: '+reportsList[index].reportImages.length.toString(),style:textButtonStyleReports()),
@ -519,19 +577,19 @@ class _AllReportsState extends State<AllReports> {
onPrimary: Colors.white, // foreground onPrimary: Colors.white, // foreground
), ),
onPressed: () async { onPressed: () async {
/*Navigator.push( Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new PrescriptionImages(imageDetails:reportsList[index].prescriptionImages,recordId: reportsList[index].recordId,familyDetails:reportsList[index],details:reportsList[index] ,))).then((value) { builder: (__) => new AllRecordsOnClick(recordDetails:reportsList[index],initialIndex: 0,))).then((value) {
getAllRecords(); getAllRecords();
});*/ });
Navigator.push( /*Navigator.push(
context, context,
new MaterialPageRoute( new MaterialPageRoute(
builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 2,))).then((value) { builder: (__) => new AllReportsTab(recordDetails:reportsList[index],initialIndex: 2,))).then((value) {
getAllRecords(); getAllRecords();
}); });*/
}, },
child: Text('Prescriptions: '+reportsList[index].prescriptionImages.length.toString(),style:textButtonStyleReports()), child: Text('Prescriptions: '+reportsList[index].prescriptionImages.length.toString(),style:textButtonStyleReports()),
@ -596,7 +654,7 @@ class _AllReportsState extends State<AllReports> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Container( /*Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: DropdownButtonFormField( child: DropdownButtonFormField(
// Initial Value // Initial Value
@ -640,9 +698,69 @@ class _AllReportsState extends State<AllReports> {
}); });
}, },
), ),
),*/
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(padding: EdgeInsets.fromLTRB(10,10,0,0),
child: Text('Please select search option',style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 16),),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: RadioListTile(
title: Text("Problem", style: TextStyle(fontSize: 10)),
value: "problem",
groupValue: searchBy,
activeColor: primaryColor,
onChanged: (value) {
setState(() {
searchBy = value.toString();
});
},
),
),
Expanded(
child: RadioListTile(
title: Text(
"Doctor",
style: TextStyle(fontSize: 10),
),
value: "doctor",
groupValue: searchBy,
activeColor: primaryColor,
onChanged: (value) {
setState(() {
searchBy = value.toString();
});
},
),
),
Expanded(
child: RadioListTile(
title:
Text("Date", style: TextStyle(fontSize: 10)),
value: "date",
groupValue: searchBy,
activeColor: primaryColor,
onChanged: (value) {
setState(() {
searchBy = value.toString();
});
},
),
),
],
),
],
)
), ),
Visibility( Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='problem' , visible:searchBy.toString().toLowerCase()=='problem' ,
child: Container( child: Container(
height: MediaQuery.of(context).size.height * .07, height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -707,7 +825,7 @@ class _AllReportsState extends State<AllReports> {
),) ),)
),), ),),
Visibility( Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='doctor' , visible:searchBy.toString().toLowerCase()=='doctor' ,
child: Container( child: Container(
height: MediaQuery.of(context).size.height * .07, height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -772,7 +890,204 @@ class _AllReportsState extends State<AllReports> {
),) ),)
),), ),),
Visibility( Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='date' , visible:searchBy.toString().toLowerCase()=='date',
child: Container(
//height: 60,
padding: EdgeInsets.all(5),
child: Row(
children: [
Expanded(
child: TextField(
cursorColor: primaryColor,
controller: fromdateController,
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(() {
fromDate=pickedDate;
fromdateController.text = formattedDate; //set output date to TextField value.
});
getRecordsByDateRange(fromdateController.text,todateController.text);
} else {}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
suffixIcon: fromdateController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
fromdateController.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: 'From date',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
Expanded(
child: TextField(
cursorColor: primaryColor,
controller: todateController,
onChanged: (string) {
if(string.length>=1){
//getRecordsByDate(string);
}
else{
getAllRecords();
}
},
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: fromDate,
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(() {
todateController.text = formattedDate; //set output date to TextField value.
});
getRecordsByDateRange(fromdateController.text,todateController.text);
} else {}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
suffixIcon: todateController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
todateController.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: 'To date',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
],
),
),),
/*Visibility(
visible:searchBy.toString().toLowerCase()=='date' ,
child: Container( child: Container(
height: MediaQuery.of(context).size.height * .07, height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -870,45 +1185,9 @@ class _AllReportsState extends State<AllReports> {
), ),
), ),*/
Expanded(child: _filtereddata()), 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())).then((value) {
getAllRecords();
});
//showBoreAddingDialog();
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
]); ]);
@ -961,6 +1240,43 @@ class _AllReportsState extends State<AllReports> {
strokeWidth: 5.0, strokeWidth: 5.0,
), ),
): _allreports(), ): _allreports(),
floatingActionButton: Visibility(
visible:reportsListOriginal.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{
/*await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddPrescription()),
);*/
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports())).then((value) {
getAllRecords();
});
//showBoreAddingDialog();
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
); );
} }
} }

@ -18,6 +18,7 @@ class _SugarCalculatorState extends State<SugarCalculator> {
TextEditingController postParandialValueController = TextEditingController(); TextEditingController postParandialValueController = TextEditingController();
TextEditingController dateInput = TextEditingController(); TextEditingController dateInput = TextEditingController();
String sugarValue = ''; String sugarValue = '';
Color sugarValueColor = Colors.black;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -48,7 +49,7 @@ class _SugarCalculatorState extends State<SugarCalculator> {
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: primaryColor),
), ),
labelText: 'Enter fasting sugar value', labelText: 'Enter fasting blood sugar value',
labelStyle: TextStyle( labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
@ -138,6 +139,11 @@ class _SugarCalculatorState extends State<SugarCalculator> {
onPressed: () async { onPressed: () async {
if (fastingValueController.text != '' && if (fastingValueController.text != '' &&
postParandialValueController.text != ''&& dateInput.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); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
@ -150,6 +156,24 @@ class _SugarCalculatorState extends State<SugarCalculator> {
print(valueResponse); print(valueResponse);
setState(() { setState(() {
sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString(); 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(); fastingValueController.clear();
@ -157,6 +181,9 @@ class _SugarCalculatorState extends State<SugarCalculator> {
dateInput.clear(); dateInput.clear();
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
} }
}
else{ else{
AppSettings.longFailedToast('Please enter valid details'); AppSettings.longFailedToast('Please enter valid details');
} }
@ -167,11 +194,23 @@ class _SugarCalculatorState extends State<SugarCalculator> {
Container( Container(
child: Row( child: Row(
children: [ children: [
Text(sugarValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),), 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), SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton( IconButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -191,6 +230,21 @@ class _SugarCalculatorState extends State<SugarCalculator> {
child: Container( child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)), 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'),
)
],
)
], ],
), ),

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/Sugar/sugar_calculator.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/sugar_history_model.dart'; import 'package:healthcare_user/models/sugar_history_model.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -83,7 +84,8 @@ class _SugarHistoryState extends State<SugarHistory> {
} }
Widget renderzUi() { Widget renderzUi() {
if (sugarHistoryList.length != 0) { if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [ return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding( Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10), padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
@ -191,11 +193,6 @@ class _SugarHistoryState extends State<SugarHistory> {
style: labelTextStyle(), style: labelTextStyle(),
), ),
SizedBox(height:MediaQuery.of(context).size.height * .01,), SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Actual Sugar Value',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text( Text(
'Sugar Status', 'Sugar Status',
style: labelTextStyle(), style: labelTextStyle(),
@ -231,11 +228,6 @@ class _SugarHistoryState extends State<SugarHistory> {
':', ':',
style: labelTextStyle(), style: labelTextStyle(),
), ),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
], ],
), ),
SizedBox(width:MediaQuery.of(context).size.width * .01,), SizedBox(width:MediaQuery.of(context).size.width * .01,),
@ -257,19 +249,18 @@ class _SugarHistoryState extends State<SugarHistory> {
.toUpperCase(), .toUpperCase(),
style: valuesTextStyle()), style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,), SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.sugarValue
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text( Text(
FilteredList[index] FilteredList[index]
.sugartText .sugartText
.toString() .toString()
.toUpperCase(), .toUpperCase(),
style: wrapTextStyleBlack()), style: TextStyle(
color: FilteredList[index]
.sugarValueColor,
fontSize: 12,
fontWeight: FontWeight.bold,
overflow: TextOverflow.ellipsis,
)),
SizedBox(height:MediaQuery.of(context).size.height * .01,), SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text( Text(
FilteredList[index] FilteredList[index]
@ -279,126 +270,6 @@ class _SugarHistoryState extends State<SugarHistory> {
style: valuesTextStyle()), style: valuesTextStyle()),
], ],
),) ),)
/*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(
'Fasting Sugar Value',
style: TextStyle(color: primaryColor),
),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.fasting
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'PostPrandial Sugar Value',
style: TextStyle(color: primaryColor),
),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.postPrandial
.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]
.sugarValue
.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]
.sugartText
.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()),
)
],
),
],
),*/
], ],
), ),
), ),
@ -425,10 +296,14 @@ class _SugarHistoryState extends State<SugarHistory> {
child: IconButton( child: IconButton(
iconSize: 40, iconSize: 40,
icon: const Icon( icon: const Icon(
Icons.info, Icons.add,
color: Colors.white, color: Colors.white,
), ),
onPressed: () async {}, onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => SugarCalculator())).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
), ),
) )
], ],
@ -449,6 +324,30 @@ class _SugarHistoryState extends State<SugarHistory> {
), ),
) )
: renderzUi(), : 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())).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
),
],
),
),
),
); );
} }
} }

@ -0,0 +1,88 @@
import 'dart:io';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'chatmessage.dart';
class ChatController extends GetxController {
final CollectionReference _messagesCollection =
FirebaseFirestore.instance.collection('messages');
// Observable list of messages
RxList<ChatMessage> messages = <ChatMessage>[].obs;
void sendMessage(String messageContent, String messageType, bool isText) async {
try {
await _messagesCollection.add({
'messageContent': messageContent,
'messageType': messageType,
'isText': isText,
'timestamp': Timestamp.now(),
});
print("Message sent successfully");
} catch (e) {
print('Error sending message: $e');
}
}
Future<String> uploadImage(File image, String id) async {
try {
String fileName = DateTime.now().millisecondsSinceEpoch.toString();
Reference storageReference =
FirebaseStorage.instance.ref().child('products/$fileName');
SettableMetadata metadata = SettableMetadata(contentType: 'image/jpeg');
UploadTask uploadTask = storageReference.putFile(image, metadata);
String temporaryMessageId = UniqueKey().toString();
messages.add(ChatMessage(
messageContent: 'Uploading...',
messageType: id,
isText: true,
temporaryMessageId: temporaryMessageId,
));
TaskSnapshot taskSnapshot = await uploadTask;
String downloadURL = await storageReference.getDownloadURL();
// Replace the temporary message with the uploaded image
int index = messages.indexWhere((message) => message.temporaryMessageId == temporaryMessageId);
if (index != -1) {
messages[index] = ChatMessage(
messageContent: downloadURL,
messageType: id,
isText: false,
temporaryMessageId: '',
);
}
print('Image uploaded successfully. Download URL: $downloadURL');
return downloadURL;
} catch (e) {
print('Error uploading image: $e');
throw e;
}
}
Stream<QuerySnapshot> getMessagesStream() {
return _messagesCollection.orderBy('timestamp').snapshots();
}
@override
void onInit() {
super.onInit();
// Listen for changes in the messages collection and update the local list
getMessagesStream().listen((QuerySnapshot snapshot) {
messages.assignAll(snapshot.docs.map((doc) => ChatMessage(
messageContent: doc['messageContent'],
messageType: doc['messageType'],
isText: doc['isText'],
temporaryMessageId: '',
)));
});
}
}

@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
class ChatMessage {
String messageContent;
String messageType;
bool isText;
String temporaryMessageId; // New property for temporary message identifier
ChatMessage({
required this.messageContent,
required this.messageType,
required this.isText,
required this.temporaryMessageId, // Include in the constructor
});
}

@ -0,0 +1,235 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:healthcare_user/chat/chatzoomable_image.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/pages/index.dart';
import 'package:image_picker/image_picker.dart';
import 'chat_controller.dart';
import 'chatmessage.dart';
import 'package:photo_view/photo_view.dart';
class ChatPage extends StatefulWidget {
const ChatPage({Key? key});
@override
State<ChatPage> createState() => _ChatPageState();
}
class _ChatPageState extends State<ChatPage> {
final ChatController chatController = Get.put(ChatController());
final TextEditingController content = TextEditingController();
final ImagePicker _picker = ImagePicker();
XFile? _image;
var id="1";
bool _sending = false;
final ScrollController _scrollController = ScrollController();
@override
void initState() {
super.initState();
_scrollToBottom();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor:Colors.green,
elevation: 0,
automaticallyImplyLeading: false,
flexibleSpace: SafeArea(
child: Container(
padding: EdgeInsets.only(right: 16),
child: Row(
children: <Widget>[
IconButton(
onPressed: (){
Navigator.pop(context);
},
icon: Icon(Icons.arrow_back,color: Colors.black,),
),
SizedBox(width: 2,),
CircleAvatar(
backgroundImage: NetworkImage(AppSettings.profilePictureUrl),
maxRadius: 20,
),
SizedBox(width: 12,),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(AppSettings.userName,style: TextStyle( fontSize: 16 ,fontWeight: FontWeight.w600),),
// SizedBox(height: 6,),
// Text("Online",style: TextStyle(color: Colors.grey.shade600, fontSize: 13),),
],
),
),
/*IconButton(
onPressed: () {
UrlLauncher.launch("tel://8328206298");
},
icon: Icon(Icons.call, color: Colors.black),
),*/
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => IndexPage()),
);
},
icon: Icon(Icons.videocam, color: Colors.black),
),
],
),
),
),
),
body: Stack(
children: [
Obx(() => ListView.builder(
itemCount: chatController.messages.length,
shrinkWrap: true,
padding: EdgeInsets.only(top: 10, bottom: 80), // Adjust bottom padding to accommodate the input field
physics: ScrollPhysics(),
controller: _scrollController,
itemBuilder: (context, index) {
final data = chatController.messages[index];
return Container(
padding: EdgeInsets.only(
left: 14, right: 14, top: 10, bottom: 10),
child: Align(
alignment: (data.messageType != id ? Alignment.topLeft : Alignment.topRight),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChatZoomableImage(data.messageContent),
),
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: (data.messageType != id
? Colors.grey.shade200
: Colors.blue[200]),
),
padding: EdgeInsets.all(16),
child: data.isText
? Text(data.messageContent, style: TextStyle(fontSize: 15))
: Image.network(
data.messageContent,
scale: 3,
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
),
),
);
},
)),
Align(alignment: Alignment.bottomCenter,child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Container(
height: 60,
width: double.infinity,
color: Colors.white,
child: Row(
children: <Widget>[
GestureDetector(
onTap: getImage,
child: Container(
height: 30,
width: 30,
decoration: BoxDecoration(
color: Colors.lightBlue,
borderRadius: BorderRadius.circular(30),
),
child: Icon(Icons.add, color: Colors.white, size: 20),
),
),
SizedBox(width: 15),
Expanded(
child: TextField(
controller: content,
decoration: InputDecoration(
hintText: "Write message...",
hintStyle: TextStyle(color: Colors.black54),
border: InputBorder.none,
),
),
),
SizedBox(width: 15),
FloatingActionButton(
onPressed: () {
sendMessage();
},
child: Icon(Icons.send, color: Colors.white, size: 18),
backgroundColor: Colors.blue,
elevation: 0,
),
],
),
),
),)
],
),
);
}
void _scrollToBottom() {
Future.delayed(Duration(milliseconds: 300), () {
if (_scrollController.hasClients) {
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
});
}
Future getImage() async {
final XFile? image =
await _picker.pickImage(source: ImageSource.gallery);
if (image != null) {
setState(() {
_image = image;
});
sendMessage(); // Call sendMessage function to send the selected image immediately
}
}
void sendMessage() async {
String messageContent = content.text.trim();
if (messageContent.isNotEmpty || _image != null) {
setState(() {
_sending = true;
});
try {
if (_image != null) {
String imageUrl =
await chatController.uploadImage(File(_image!.path),'$id');
chatController.sendMessage(imageUrl, '$id', false);
_image = null; // Clear the selected image after sending
}
if (messageContent.isNotEmpty) {
chatController.sendMessage(messageContent, '$id', true);
content.clear();
}
} finally {
setState(() {
_sending = false;
});
}
_scrollToBottom(); // Scroll to the bottom after sending message
}
}
}

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:photo_view/photo_view.dart';
class ChatZoomableImage extends StatelessWidget {
final String imageUrl;
ChatZoomableImage(this.imageUrl);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primaryColor, // Set the background color
title: Text('Preview Image'), // Set the title text
actions: [
IconButton(
icon: Icon(Icons.close),
onPressed: () {
Navigator.pop(context);
},
),
],
),
body: Center(
child: imageUrl.isNotEmpty
? PhotoView(
imageProvider: NetworkImage(imageUrl),
minScale: PhotoViewComputedScale.contained,
maxScale: PhotoViewComputedScale.contained * 3.0,
)
: Image.asset(
'images/mobilebg.png', // Path to your default image
fit: BoxFit.cover,
),
),
);
}
}

@ -2,13 +2,18 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:healthcare_user/Reports/allreports.dart'; import 'package:healthcare_user/Reports/allreports.dart';
import 'package:healthcare_user/chat/chatpage.dart';
import 'package:healthcare_user/common/qrcode_display.dart';
import 'package:healthcare_user/common/updateprofile.dart'; import 'package:healthcare_user/common/updateprofile.dart';
import 'package:healthcare_user/emergency.dart'; import 'package:healthcare_user/emergency.dart';
import 'package:healthcare_user/howareufeeling_today.dart'; import 'package:healthcare_user/howareufeeling_today.dart';
import 'package:healthcare_user/invitations/invitations.dart'; import 'package:healthcare_user/invitations/invitations.dart';
import 'package:healthcare_user/medicines.dart'; import 'package:healthcare_user/medicines.dart';
import 'package:healthcare_user/my_connections/all_connections.dart';
import 'package:healthcare_user/my_connections/dynamic_code_doctor.dart';
import 'package:healthcare_user/my_health.dart'; import 'package:healthcare_user/my_health.dart';
import 'package:healthcare_user/my_medicine_timings.dart'; import 'package:healthcare_user/my_medicine_timings.dart';
import 'package:healthcare_user/orders/quotations.dart';
import 'package:healthcare_user/prescriptions/prescriptions.dart'; import 'package:healthcare_user/prescriptions/prescriptions.dart';
import 'package:healthcare_user/report_problem/report_my_self.dart'; import 'package:healthcare_user/report_problem/report_my_self.dart';
import 'package:healthcare_user/Reports/add_reports.dart'; import 'package:healthcare_user/Reports/add_reports.dart';
@ -16,6 +21,7 @@ import 'package:healthcare_user/report_problem/all_problems.dart';
import 'package:healthcare_user/seekopinion.dart'; import 'package:healthcare_user/seekopinion.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/updates/update_location.dart'; import 'package:healthcare_user/updates/update_location.dart';
import 'package:healthcare_user/updates/update_pin.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
import 'dart:ui' as ui; import 'dart:ui' as ui;
@ -376,7 +382,11 @@ class _DashboardState extends State<Dashboard> {
fit: BoxFit.fitWidth)), fit: BoxFit.fitWidth)),
), ),
onTap: () { onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AllConnections()),
);
}, },
), ),
Text( Text(
@ -556,18 +566,21 @@ class _DashboardState extends State<Dashboard> {
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: buttonColors, color: buttonColors,
), ),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Column( Expanded(child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Expanded( GestureDetector(
child: GestureDetector(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * .20, width: MediaQuery.of(context).size.width * .20,
height: height:
MediaQuery.of(context).size.height * .15, MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
image: DecorationImage( image: DecorationImage(
image: (AppSettings.profilePictureUrl != image: (AppSettings.profilePictureUrl !=
@ -578,8 +591,11 @@ class _DashboardState extends State<Dashboard> {
.profilePictureUrl) .profilePictureUrl)
as ImageProvider as ImageProvider
: AssetImage( : AssetImage(
"images/profile_pic.png"), // picked file "images/profile_pic.png"),
fit: BoxFit.fitWidth)),
fit:BoxFit.fitWidth // picked file
),
),
), ),
onTap: () { onTap: () {
showModalBottomSheet<void>( showModalBottomSheet<void>(
@ -627,7 +643,62 @@ class _DashboardState extends State<Dashboard> {
}); });
}, },
), ),
Container(
child: AppSettings.qrCode==''?TextButton(
child: Text(
'GetQR',
style: TextStyle(
fontSize: 15,
color: Colors.white,
decoration: TextDecoration.underline,
),
), ),
onPressed: () async{
AppSettings.preLoaderDialog(context);
try{
var value = await AppSettings.generateQRCode();
var valueResponse = jsonDecode(value);
String dataUri = jsonDecode(value)['qrCodeData'];
List<String> parts = dataUri.split(",");
String? base64String = parts.length == 2 ? parts[1] : null;
if (base64String != null) {
print(base64String);
AppSettings.qrCode=base64String;
} else {
print("Invalid data URI");
}
Navigator.of(context, rootNavigator: true).pop();
}
catch(e){
Navigator.of(context, rootNavigator: true).pop();
}
},
):GestureDetector(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DisplayQrCode()),
);
},
child: Container(
height:MediaQuery.of(context).size.height * .20,
width:MediaQuery.of(context).size.width * .1,
child: Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode))),
),
),
)
],
),),
Text( Text(
AppSettings.userName, AppSettings.userName,
style: drawerHeaderTextStyleNew(), style: drawerHeaderTextStyleNew(),
@ -662,10 +733,7 @@ class _DashboardState extends State<Dashboard> {
], ],
) )
], ],
), ),),
Container()
],
)),
ListTile( ListTile(
title: Row( title: Row(
children: [ children: [
@ -708,7 +776,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('My Health', style: drawerListItemsTextStyle()), Text('My Health (Sugar/BP/BMI)', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () { onTap: () {
@ -852,7 +920,41 @@ class _DashboardState extends State<Dashboard> {
Text('Update Pin', style: drawerListItemsTextStyle()), Text('Update Pin', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UpdatePin()),
);
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/updatepin.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('Chats', style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ChatPage()),
);
},
), ),
Divider( Divider(
color: Colors.grey, color: Colors.grey,
@ -910,6 +1012,64 @@ class _DashboardState extends State<Dashboard> {
Divider( Divider(
color: Colors.grey, color: Colors.grey,
), ),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/updatemylocation.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('Dynamic Code',
style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DynamicCode()),
);
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/updatemylocation.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('Quotations',
style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AllQuotations()),
);
},
),
Divider(
color: Colors.grey,
),
ListTile( ListTile(
title: Row( title: Row(
children: [ children: [

@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
class Forgotpassword extends StatefulWidget {
@override
State<Forgotpassword> createState() => _ForgotpasswordState();
}
class _ForgotpasswordState extends State<Forgotpassword> {
TextEditingController emailController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: primaryColor,
body: Stack(children: <Widget>[
/*Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("images/backgroundimage.png"),
fit: BoxFit.cover,
),
),
),*/
GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: SafeArea(
child: SingleChildScrollView(
child: Column(children: <Widget>[
const SizedBox(
height: 50,
),
Container(
child: Image(
image: const AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .20,
)),
const SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(10),
child: const Text(
'Enter Your Email Address and we will send a link to reset your password',
style: TextStyle(fontSize: 12, color: greyColor),
),
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: emailController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.email,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter email ID',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
const SizedBox(
height: 20,
),
Container(
width: 400,
height: 50,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () {},
child: const Text('Send'),
)),
])))),
]));
}
}

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:healthcare_user/common/dashboard.dart'; import 'package:healthcare_user/common/dashboard.dart';
import 'package:healthcare_user/common/forgotpassword.dart';
import 'package:healthcare_user/common/otpscreen_forgotpassword.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/signup.dart'; import 'package:healthcare_user/common/signup.dart';
import 'package:path/path.dart' as Path; import 'package:path/path.dart' as Path;
@ -102,7 +104,8 @@ class _LoginState extends State<Login> {
), ),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
controller: mobileNumberController, controller: mobileNumberController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'), decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
@ -112,29 +115,30 @@ class _LoginState extends State<Login> {
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
obscureText: isObscureText, obscureText: isObscureText,
controller: passwordController, controller: passwordController,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: primaryColor,
filled: true, filled: true,
labelText: 'Password', labelText: 'Password',
prefixIcon: const Icon(Icons.password, color: greyColor,), prefixIcon: const Icon(Icons.password, color: Colors.white,),
labelStyle: const TextStyle( labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE color: Colors.white, //<-- SEE HERE
), ),
border: const OutlineInputBorder( border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: Colors.white)),
focusedBorder: const OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
enabledBorder: const OutlineInputBorder( enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
Icons.visibility_off_outlined, Icons.visibility_off_outlined,
color: isObscureText==true?greyColor:primaryColor, color: isObscureText==true?buttonColors:Colors.white,
), ),
onPressed: () { onPressed: () {
@ -155,10 +159,10 @@ class _LoginState extends State<Login> {
child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0), child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
/*Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => OtpScreen()), MaterialPageRoute(builder: (context) => OtpScreencForgotPassword()),
);*/ );
}, },
child: const Text( child: const Text(
'Forgot Password?', 'Forgot Password?',

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/common/dashboard.dart';
import 'package:healthcare_user/common/login.dart'; import 'package:healthcare_user/common/login.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
class OtpScreen extends StatefulWidget { class OtpScreen extends StatefulWidget {
@ -179,7 +180,7 @@ class _OtpScreenState extends State<OtpScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const Login()), builder: (context) => const Dashboard()),
); );
} }
else{ else{

@ -0,0 +1,269 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/login.dart';
import 'package:healthcare_user/common/settings.dart';
class OtpScreencForgotPassword extends StatefulWidget {
const OtpScreencForgotPassword({Key? key}) : super(key: key);
@override
State<OtpScreencForgotPassword> createState() => _OtpScreencForgotPasswordState();
}
class _OtpScreencForgotPasswordState extends State<OtpScreencForgotPassword> {
final TextEditingController _fieldOne = TextEditingController();
final TextEditingController _fieldTwo = TextEditingController();
final TextEditingController _fieldThree = TextEditingController();
final TextEditingController _fieldFour = TextEditingController();
final TextEditingController _fieldFive = TextEditingController();
final TextEditingController _fieldSix = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController passwordController = TextEditingController();
bool isTextfieldVisible=true;
bool isOtpVisible=false;
bool isObscureText=true;
// This is the entered code
// It will be displayed in a Text widget
String? _otp;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: primaryColor,
body: Padding(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Phone Number Verification',style: TextStyle(color: Colors.white),),
SizedBox(
height:MediaQuery.of(context).size.height * .02,
),
Visibility(
visible: isTextfieldVisible,
child: Container(
child: TextFormField(
cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
),
),),
const SizedBox(
height: 30,
),
Visibility(
visible: isTextfieldVisible,
child: 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(mobileNumberController.text.length>=10){
var payload = new Map<String, dynamic>();
payload["phone"] = mobileNumberController.text.toString();
bool forgotPwd = await AppSettings.forgotPassword(payload);
if(forgotPwd){
setState(() {
isTextfieldVisible=false;
isOtpVisible=true;
});
}
else{
AppSettings.longFailedToast('Please enter valid registered mobile number');
}
}
else{
AppSettings.longFailedToast('Please enter 10 digits of mobile number');
}
},
child: const Text('Submit')),
),),
// Implement 4 input fields
Visibility(
visible:isOtpVisible,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
OtpInput(_fieldOne, true), // auto focus
OtpInput(_fieldTwo, false),
OtpInput(_fieldThree, false),
OtpInput(_fieldFour, false),
OtpInput(_fieldFive, false),
OtpInput(_fieldSix, false),
],
),),
const SizedBox(
height: 30,
),
Visibility(
visible: isOtpVisible,
child: Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: TextFormField(
cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
obscureText: isObscureText,
controller: passwordController,
decoration: InputDecoration(
filled: true,
fillColor: primaryColor,
labelText: 'Password',
prefixIcon: const Icon(Icons.password, color: Colors.white,),
labelStyle: const TextStyle(
color: Colors.white, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isObscureText==true?buttonColors:Colors.white,
),
onPressed: () {
print("show password");
setState(() {
isObscureText = !isObscureText;
});
},
),
),
),
),),
const SizedBox(
height: 30,
),
Visibility(
visible: isOtpVisible,
child: 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 {
setState(() {
_otp = _fieldOne.text +
_fieldTwo.text +
_fieldThree.text +
_fieldFour.text+
_fieldFive.text +
_fieldSix.text;
});
if (_otp!.length == 6&&passwordController.text!='') {
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
var payload = new Map<String, dynamic>();
payload["phone"] = mobileNumberController.text.toString();
payload["resetPasswordCode"] = _otp.toString();
payload["newPassword"] = passwordController.text.toString();
bool signinStatus = await AppSettings.resetPassword(payload);
try{
if (signinStatus) {
Navigator.of(context,rootNavigator: true).pop();
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => Login()),
);
AppSettings.longSuccessToast("Password reset successfully");
} else {
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Please enter valid details");
}
}
catch(exception){
Navigator.of(context,rootNavigator: true).pop();
print(exception);
}
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Please Check internet");
}
}
else{
AppSettings.longFailedToast("Please enter valid details");
}
},
child: const Text('Submit')),
)
)
],
),
)
);
}
}
// Create an input widget that takes only one digit
class OtpInput extends StatelessWidget {
final TextEditingController controller;
final bool autoFocus;
const OtpInput(this.controller, this.autoFocus, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 60,
width: 50,
child: TextField(
autofocus: autoFocus,
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
controller: controller,
maxLength: 1,
cursorColor: Colors.black,
decoration: const InputDecoration(
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
counterText: '',
hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)),
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
}
},
),
);
}
}

@ -0,0 +1,124 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:flutter_share/flutter_share.dart';
import 'package:share/share.dart';
import 'dart:typed_data';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;
import 'package:qr_flutter/qr_flutter.dart';
class DisplayQrCode extends StatefulWidget {
const DisplayQrCode({Key? key}) : super(key: key);
@override
State<DisplayQrCode> createState() => _DisplayQrCodeState();
}
class _DisplayQrCodeState extends State<DisplayQrCode> {
Future<void> share(var qr) async {
await FlutterShare.share(
title: 'Example share',
text: 'Example share text',
linkUrl: qr,
chooserTitle: 'Example Chooser Title');
}
Future<void> shareQRCodeImage1(qrData) async {
final tempDir = await getTemporaryDirectory();
final file = File('${tempDir.path}/qr_code.png');
await file.writeAsBytes(Uint8List.fromList(base64.decode(qrData)));
// Share the image using the share package
Share.shareFiles([file.path], text: 'Check out this QR code');
}
String imagePath = '';
Future<void> downloadQRImage() async {
final response = await http.get(Uri.parse(AppSettings.qrCode));
if (response.statusCode == 200) {
final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/qr_image.png';
final File file = File(filePath);
await file.writeAsBytes(response.bodyBytes);
setState(() {
imagePath = filePath;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Qr Code'),
body: Container(
child: Padding(padding: EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
width: MediaQuery.of(context).size.width * .60, // Set the desired width
height: MediaQuery.of(context).size.height * .35, // Set the desired height
child:
Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),
fit: BoxFit.fill),
),
),
SizedBox(
height:MediaQuery.of(context).size.height * .05,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
//share(AppSettings.qrCode);
shareQRCodeImage1(AppSettings.qrCode);
},
icon: Icon(
Icons.share,
color: primaryColor,
size: 40,
),
),
/*IconButton(
onPressed: () {
downloadQRImage();
},
icon: Icon(
Icons.download,
color: primaryColor,
size: 40,
),
),*/
],
)
/*Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: Center(child: Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),),),
)*/
],
),),
),
);
}
}

@ -22,6 +22,8 @@ const Color textFieldStartColor = Colors.grey;
const Color screenBackgroundColor = Color(0XFFEAF6FF); const Color screenBackgroundColor = Color(0XFFEAF6FF);
const Color screenBackgroundColord = Colors.black12; const Color screenBackgroundColord = Colors.black12;
const Color dashboardbackground = Color(0XFFF5F5F5); const Color dashboardbackground = Color(0XFFF5F5F5);
const appId="e5b593d506884e32856b5d6b1d72860f";
const token="007eJxTYDibv+bcAy2rY7+OVHIEfQj1+/0y//Sai9e3BXUrfzsU+G65AkOqaZKppXGKqYGZhYVJqrGRhalZkmmKWZJhirmRhZlBmt9i4bSGQEaG63HbWBkZIBDEZ2FITszJYWAAAHfyIs8=";
//Color AppBarGradient_1 = Color(0XFF1258F6); //Color AppBarGradient_1 = Color(0XFF1258F6);
Color AppBarGradient_1 = Color(0XFF68A85D); Color AppBarGradient_1 = Color(0XFF68A85D);
@ -172,24 +174,53 @@ TextStyle drawerHeaderTextStyleNew() {
return TextStyle(color: Colors.black, fontSize: 15); return TextStyle(color: Colors.black, fontSize: 15);
} }
TextStyle radioHeadingTextStyle() {
return TextStyle(color: Colors.white);
}
TextStyle radioItemsTextStyle() {
return TextStyle(color: Colors.white,fontSize: 11);
}
InputDecoration textFormFieldDecoration(IconData icon, var text) { InputDecoration textFormFieldDecoration(IconData icon, var text) {
return InputDecoration( return InputDecoration(
filled: true, filled: true,
fillColor: Colors.white, fillColor: primaryColor,
prefixIcon: Icon(
icon,
color: Colors.white,
),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelText: text,
labelStyle: TextStyle(
color: Colors.white, //<-- SEE HERE
),
);
}
InputDecoration textFormFieldDecorationGrey(IconData icon, var text) {
return InputDecoration(
prefixIcon: Icon( prefixIcon: Icon(
icon, icon,
color: greyColor, color: greyColor,
), ),
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)), border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: greyColor),
), ),
labelText: text, labelText: text,
labelStyle: TextStyle( labelStyle: TextStyle(
color: Colors.black, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
); );
} }
@ -211,12 +242,13 @@ InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
), ),
labelText: text, labelText: text,
labelStyle: TextStyle( labelStyle: TextStyle(
//color: Colors.black, //<-- SEE HERE color: Colors.grey, //<-- SEE HERE
), ),
); );
} }
final GlobalKey<State> preloaderWindowKey = new GlobalKey<State>(); final GlobalKey<State> preloaderWindowKey = new GlobalKey<State>();
Future<void> preloaderWindow(BuildContext context) async { Future<void> preloaderWindow(BuildContext context) async {
try { try {
Dialogs.showLoadingDialog(context, preloaderWindowKey); Dialogs.showLoadingDialog(context, preloaderWindowKey);
@ -228,6 +260,14 @@ class AppSettings {
SharedPreferences.getInstance() as SharedPreferences; SharedPreferences.getInstance() as SharedPreferences;
static String userName = ''; static String userName = '';
static String userAddress = ''; static String userAddress = '';
static String detailedAddress = '';
static String emergencyContactNumber1 = '';
static String emergencyContactNumber2 = '';
static String emergencyRelation1 = '';
static String emergencyRelation2 = '';
static String emergencyRelationName1 = '';
static String emergencyRelationName2 = '';
static String bloodGroup = '';
static String email = ''; static String email = '';
static String age = ''; static String age = '';
static String gender = ''; static String gender = '';
@ -249,15 +289,21 @@ class AppSettings {
static String long = "", lat = ""; static String long = "", lat = "";
late StreamSubscription<Position> positionStream; late StreamSubscription<Position> positionStream;
static String fcmId = ''; static String fcmId = '';
static String originalQrCode = '';
static String qrCode = '';
static String serverToken = static String serverToken =
'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO'; 'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO';
//api urls //api urls
static String host = 'http://35.200.129.165:4000/api/'; //static String host = 'http://35.200.129.165:4000/api/';
static String host = 'http://cloudh.in:4000/api/';
static String loginUrl = host + 'login'; static String loginUrl = host + 'login';
static String signUpUrl = host + 'users'; static String signUpUrl = host + 'users';
static String generateQRCodeUrl = host + 'generate-qrcode';
static String sendSmsUrl = host + 'sendSms'; static String sendSmsUrl = host + 'sendSms';
static String phoneVerificationUrl = host + 'phone'; static String phoneVerificationUrl = host + 'phone';
static String forgotPasswordUrl = host + 'forgotpassword';
static String resetPasswordUrl = host + 'resetpassword';
static String verifyPhnUrl = host + 'phone'; static String verifyPhnUrl = host + 'phone';
static String resetTokenUrl = host + 'reset_token'; static String resetTokenUrl = host + 'reset_token';
static String bmiCaluculateUrl = host + 'insertBMI'; static String bmiCaluculateUrl = host + 'insertBMI';
@ -267,7 +313,9 @@ class AppSettings {
static String inviteFriendUrl = host + 'sendInviteLink'; static String inviteFriendUrl = host + 'sendInviteLink';
static String updateProfileUrl = host + 'update/currentUser'; static String updateProfileUrl = host + 'update/currentUser';
static String updateLocationUrl = host + 'updateLocation'; static String updateLocationUrl = host + 'updateLocation';
static String updatePinUrl = host + 'updateUserProfile';
static String uploadPicUrl = host + 'uploads'; static String uploadPicUrl = host + 'uploads';
static String uploadBloodGroupPicUrl = host + 'uploads-bloodGroup';
static String getBmiHistoryUrl = host + 'usersbmi'; static String getBmiHistoryUrl = host + 'usersbmi';
static String getBpHistoryUrl = host + 'usersbp'; static String getBpHistoryUrl = host + 'usersbp';
static String getSugarHistoryUrl = host + 'userssugar'; static String getSugarHistoryUrl = host + 'userssugar';
@ -292,7 +340,6 @@ class AppSettings {
static String updateRecordsUrl = host + 'records'; static String updateRecordsUrl = host + 'records';
static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo'; static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo';
static String uploadReportMyselfPictureUrl = host + 'reportProblemPicture'; static String uploadReportMyselfPictureUrl = host + 'reportProblemPicture';
//static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription'; //static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription';
static String getAllPrescriptionsDataUrl = host + 'getAllPrescriptionDetails'; static String getAllPrescriptionsDataUrl = host + 'getAllPrescriptionDetails';
static String getRecordsDataUrl = host + 'getAllRecords'; static String getRecordsDataUrl = host + 'getAllRecords';
@ -307,17 +354,20 @@ class AppSettings {
static String addReportMySelfProblemUrl = host + 'insertReport'; static String addReportMySelfProblemUrl = host + 'insertReport';
static String getAllReportProblemDetalisUrl = host + 'userreport'; static String getAllReportProblemDetalisUrl = host + 'userreport';
static String deleteReportMySelfProblemUrl = host + 'deleteReportProblem'; static String deleteReportMySelfProblemUrl = host + 'deleteReportProblem';
static String getAllConnectedDoctorsDataUrl = host + 'connected-doctors';
static String getAllQuotationsDataUrl = host + 'getquotationsofUser';
static String getAllCartItemsUrl = host + 'getcartofParticularPharmacyAndUser';
static String getAllOffersUnderPharmacyDataUrl = host + 'getActivePharmacyOfferdata';
static String addDoctorUrl = host + 'user/connect-doctors';
static String getDynamicCodeDataUrl = host + 'getDoctorInfo';
static String orderNowUrl = host + 'OrderNow';
static File? updatedImage; static File? updatedImage;
static String image = ''; static String image = '';
static String profilePictureUrl = ''; static String profilePictureUrl = '';
static String bloodGroupPictureUrl = '';
static var api = { static var api = {
'signIn': host + '/login', 'signIn': host + '/login',
}; };
@ -471,6 +521,29 @@ class AppSettings {
} }
} }
static Future<String> generateQRCode() async {
var uri = Uri.parse(generateQRCodeUrl + '/' + customerId);
var response = await http.post(uri, headers: await buildPutRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri, headers: await buildPutRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<bool> sendSms(payload) async { static Future<bool> sendSms(payload) async {
var response = await http.post(Uri.parse(sendSmsUrl), var response = await http.post(Uri.parse(sendSmsUrl),
body: json.encode(payload), body: json.encode(payload),
@ -487,10 +560,89 @@ class AppSettings {
body: json.encode(payload), body: json.encode(payload),
headers: {'Content-type': 'application/json'}); headers: {'Content-type': 'application/json'});
if (response.statusCode == 200) { if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response['simplydata']['error']);
if (_response['simplydata']['error'] == false) {
await saveAvailableReportAndLocationsInMemory(_response);
//await saveProfilePic(_response);
return true; return true;
} else { } else {
return false; return false;
} }
} catch (e) {
// display error toast
return false;
}
}
else {
return false;
}
}
static Future<bool> forgotPassword(payload) async {
var uri = Uri.parse(forgotPasswordUrl);
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) {
// display error toast
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<bool> resetPassword(payload) async {
var uri = Uri.parse(resetPasswordUrl);
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) {
// display error toast
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> calculateBmi(payload) async { static Future<String> calculateBmi(payload) async {
@ -692,11 +844,28 @@ class AppSettings {
userName = _response['username']; userName = _response['username'];
phoneNumber = _response['phone']; phoneNumber = _response['phone'];
email = _response['emails'][0]['email']; email = _response['emails'][0]['email'];
emergencyContactNumber1 = _response['emergencyContacts'][0]['contactNumber'];
emergencyContactNumber2 = _response['emergencyContacts'][1]['contactNumber'];
emergencyRelation1 = _response['emergencyContacts'][0]['relationship'];
emergencyRelation2 = _response['emergencyContacts'][1]['relationship'];
emergencyRelationName1 = _response['emergencyContacts'][0]['name'];
emergencyRelationName2 = _response['emergencyContacts'][1]['name'];
bloodGroup = _response['bloodGroup'];
age = _response['age'].toString(); age = _response['age'].toString();
await saveData('phone', _response['phone'], 'STRING'); await saveData('phone', _response['phone'], 'STRING');
await saveData('email', _response['emails'][0]['email'], 'STRING'); await saveData('email', _response['emails'][0]['email'], 'STRING');
await saveData('username', _response['username'], 'STRING'); await saveData('username', _response['username'], 'STRING');
await saveData('age', _response['age'].toString(), 'STRING'); await saveData('age', _response['age'].toString(), 'STRING');
await saveData('emergencyContactNumber1', _response['emergencyContacts'][0]['contactNumber'].toString(), 'STRING');
await saveData('emergencyContactNumber2',_response['emergencyContacts'][1]['contactNumber'].toString(), 'STRING');
await saveData('emergencyRelation1', _response['emergencyContacts'][0]['relationship'].toString(), 'STRING');
await saveData('emergencyRelation2', _response['emergencyContacts'][1]['relationship'].toString(), 'STRING');
await saveData('emergencyRelationName1', _response['emergencyContacts'][0]['name'].toString(), 'STRING');
await saveData('emergencyRelationName2', _response['emergencyContacts'][1]['name'].toString(), 'STRING');
await saveData('bloodGroup', _response['bloodGroup'].toString(), 'STRING');
await saveData('bloodGroupPicture', _response['blood_Group_picture'].toString(), 'STRING');
await loadDataFromMemory(); await loadDataFromMemory();
return true; return true;
} else { } else {
@ -710,6 +879,42 @@ class AppSettings {
static Future<bool> updateLocation(payload) async { static Future<bool> updateLocation(payload) async {
var uri = Uri.parse(updateLocationUrl + '/' + customerId); var uri = Uri.parse(updateLocationUrl + '/' + customerId);
try {
var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
var _response = json.decode(response.body);
print(_response);
userAddress = _response['user']['profile']['address1'];
detailedAddress = _response['user']['profile']['address2'];
userLatitude = _response['user']['latitude'];
userLongitude =_response['user']['longitude'];
await saveData('user_address', _response['user']['profile']['address1'], 'STRING');
await saveData('detailedAddress', _response['user']['profile']['address2'], 'STRING');
if(_response['user']['latitude']==0){
_response['user']['latitude']=0.0;
}
if(_response['user']['longitude']==0){
_response['user']['longitude']=0.0;
}
await saveData('latitude', _response['user']['latitude'], 'DOUBLE');
await saveData('longitude', _response['user']['longitude'], 'DOUBLE');
await loadDataFromMemory();
return true;
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<bool> updatePin(payload) async {
var uri = Uri.parse(updatePinUrl + '/' + customerId);
try { try {
var response = await http.put(uri, var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders()); body: json.encode(payload), headers: await buildRequestHeaders());
@ -822,6 +1027,15 @@ class AppSettings {
return response.body; return response.body;
} }
static Future<String> uploadBloodGroupImage(file) async {
var request = http.MultipartRequest(
'POST', Uri.parse(uploadBloodGroupPicUrl + '/' + 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> uploadImageHTTPForPrescriptions(file) async { static Future<String> uploadImageHTTPForPrescriptions(file) async {
var request = http.MultipartRequest( var request = http.MultipartRequest(
'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId)); 'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
@ -1043,13 +1257,6 @@ class AppSettings {
/*End*/ /*End*/
static Future<String> uploadImageForReports(file) async { static Future<String> uploadImageForReports(file) async {
var request = http.MultipartRequest( var request = http.MultipartRequest(
@ -1064,7 +1271,6 @@ class AppSettings {
return response.body; return response.body;
} }
static Future<String> uploadImageForFindingsCamera(file) async { static Future<String> uploadImageForFindingsCamera(file) async {
var request = http.MultipartRequest( var request = http.MultipartRequest(
@ -1075,9 +1281,6 @@ class AppSettings {
return response.body; return response.body;
} }
static Future<String> uploadVideoInReportMySelf(file) async { static Future<String> uploadVideoInReportMySelf(file) async {
var request = http.MultipartRequest( var request = http.MultipartRequest(
'POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId)); 'POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId));
@ -1087,7 +1290,6 @@ class AppSettings {
return response.body; return response.body;
} }
static Future<String> uploadReportMyselfPicture(file) async { static Future<String> uploadReportMyselfPicture(file) async {
var request = http.MultipartRequest('POST', Uri.parse(uploadReportMyselfPictureUrl + '/' + customerId)); var request = http.MultipartRequest('POST', Uri.parse(uploadReportMyselfPictureUrl + '/' + customerId));
@ -1282,7 +1484,6 @@ class AppSettings {
} }
} }
static Future<bool> addRecords(payload) async { static Future<bool> addRecords(payload) async {
var uri = Uri.parse(addRecordsUrl + '/' + customerId); var uri = Uri.parse(addRecordsUrl + '/' + customerId);
var response = await http.post(uri, var response = await http.post(uri,
@ -1371,7 +1572,6 @@ class AppSettings {
} }
} }
static Future<String> getAllRecords() async { static Future<String> getAllRecords() async {
var uri = Uri.parse(getRecordsDataUrl + '/' + customerId); var uri = Uri.parse(getRecordsDataUrl + '/' + customerId);
//uri = uri.replace(query: 'customerId=$customerId'); //uri = uri.replace(query: 'customerId=$customerId');
@ -1396,7 +1596,6 @@ class AppSettings {
} }
} }
static Future<bool> deleteRecord(recordId) async { static Future<bool> deleteRecord(recordId) async {
var uri = Uri.parse(deleteRecordUrl + '/' + recordId); var uri = Uri.parse(deleteRecordUrl + '/' + recordId);
@ -1426,7 +1625,6 @@ class AppSettings {
} }
} }
static Future<String> deleteFindings(fileName,findingsId) async { static Future<String> deleteFindings(fileName,findingsId) async {
var uri = Uri.parse(deleteFindingsUrl + '/' + customerId+'/'+findingsId+'/'+fileName); var uri = Uri.parse(deleteFindingsUrl + '/' + customerId+'/'+findingsId+'/'+fileName);
@ -1688,7 +1886,6 @@ class AppSettings {
} }
} }
static Future<bool> addReportMySelfProblem(payload) async { static Future<bool> addReportMySelfProblem(payload) async {
var uri = Uri.parse(addReportMySelfProblemUrl + '/' + customerId); var uri = Uri.parse(addReportMySelfProblemUrl + '/' + customerId);
var response = await http.post(uri, var response = await http.post(uri,
@ -1774,6 +1971,189 @@ class AppSettings {
} }
} }
static Future<String> getAllConnectedDoctors() 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<String> getAllQuotations() async {
var uri = Uri.parse(getAllQuotationsDataUrl + '/' + 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<String> getAllCartItems(bookingId,payload) async {
var uri = Uri.parse(getAllCartItemsUrl + '/' +bookingId );
//uri = uri.replace(query: 'customerId=$customerId');
var response = await http.put(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.put(uri,body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<String> getAllOffersUnderPharmacy(pharmacyId) async {
var uri = Uri.parse(getAllOffersUnderPharmacyDataUrl + '/' + pharmacyId);
//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> addDoctor(payload) async {
var uri = Uri.parse(addDoctorUrl + '/' + 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) {
// display error toast
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> getDynamicCode() async {
var uri = Uri.parse(getDynamicCodeDataUrl + '/' + 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> orderNow(payload,bookinId) async {
var uri = Uri.parse(orderNowUrl + '/' + bookinId+ '/' + customerId);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 201) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
// display error toast
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;
}
}
/*Apis ends here*/ /*Apis ends here*/
@ -1785,15 +2165,34 @@ class AppSettings {
await saveData( await saveData(
'access_token', input['simplydata']['access_token'], 'STRING'); 'access_token', input['simplydata']['access_token'], 'STRING');
await saveData('phone', input['simplydata']['phone'], 'STRING'); await saveData('phone', input['simplydata']['phone'], 'STRING');
await saveData('email', input['simplydata']['email'][0]['email'], 'STRING'); await saveData('email', input['simplydata']['email'][0]['email']??'', 'STRING');
await saveData('customerId', input['simplydata']['customerId'], 'STRING'); await saveData('customerId', input['simplydata']['customerId'], 'STRING');
await saveData('profile', input['simplydata']['picture'], 'STRING'); await saveData('profile', input['simplydata']['picture'], 'STRING');
await saveData('user_address', input['simplydata']['address1'], 'STRING'); await saveData('user_address', input['simplydata']['address1'], 'STRING');
await saveData('detailedAddress', input['simplydata']['address2'], 'STRING');
if(input['simplydata']['latitude']==0){
input['simplydata']['latitude']=0.0;
}
if(input['simplydata']['longitude']==0){
input['simplydata']['longitude']=0.0;
}
await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE'); await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE');
await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE'); await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE');
await saveData('fcmId', input['simplydata']['fcmId'], 'STRING'); await saveData('fcmId', input['simplydata']['fcmId'], 'STRING');
await saveData('age', input['simplydata']['age'], 'STRING'); await saveData('age', input['simplydata']['age'], 'STRING');
await saveData('gender', input['simplydata']['gender'], 'STRING'); await saveData('gender', input['simplydata']['gender'], 'STRING');
await saveData('qrCode', input['simplydata']['qrCode'], 'STRING');
if(input['simplydata']['emergencyContacts'].length!=0){
await saveData('emergencyContactNumber1', input['simplydata']['emergencyContacts'][0]['contactNumber'].toString(), 'STRING');
await saveData('emergencyContactNumber2',input['simplydata']['emergencyContacts'][1]['contactNumber'].toString(), 'STRING');
await saveData('emergencyRelation1', input['simplydata']['emergencyContacts'][0]['relationship'].toString(), 'STRING');
await saveData('emergencyRelation2', input['simplydata']['emergencyContacts'][1]['relationship'].toString(), 'STRING');
await saveData('emergencyRelationName1', input['simplydata']['emergencyContacts'][0]['name'].toString(), 'STRING');
await saveData('emergencyRelationName2', input['simplydata']['emergencyContacts'][1]['name'].toString(), 'STRING');
}
await saveData('bloodGroup', input['simplydata']['bloodGroup'].toString(), 'STRING');
await saveData('bloodGroupPicture', input['simplydata']['blood_Group_picture'].toString(), 'STRING');
//await saveData('age', input['simplydata']['age'], 'STRING'); //await saveData('age', input['simplydata']['age'], 'STRING');
//latitude,longitude //latitude,longitude
await loadDataFromMemory(); await loadDataFromMemory();
@ -1814,6 +2213,7 @@ class AppSettings {
accessToken = await getData('access_token', 'STRING'); accessToken = await getData('access_token', 'STRING');
email = await getData('email', 'STRING'); email = await getData('email', 'STRING');
userAddress = await getData('user_address', 'STRING'); userAddress = await getData('user_address', 'STRING');
detailedAddress= await getData('detailedAddress', 'STRING');
phoneNumber = await getData('phone', 'STRING'); phoneNumber = await getData('phone', 'STRING');
customerId = await getData('customerId', 'STRING'); customerId = await getData('customerId', 'STRING');
userLatitude = await getData('latitude', 'DOUBLE'); userLatitude = await getData('latitude', 'DOUBLE');
@ -1822,8 +2222,27 @@ class AppSettings {
fcmId = await getData('fcmId', 'STRING'); fcmId = await getData('fcmId', 'STRING');
age = await getData('age', 'STRING'); age = await getData('age', 'STRING');
gender = await getData('gender', 'STRING'); gender = await getData('gender', 'STRING');
} originalQrCode = await getData('qrCode', 'STRING');
emergencyContactNumber1 =await getData('emergencyContactNumber1', 'STRING');
emergencyContactNumber2 = await getData('emergencyContactNumber2', 'STRING');
emergencyRelation1 = await getData('emergencyRelation1', 'STRING');
emergencyRelation2 = await getData('emergencyRelation2', 'STRING');
emergencyRelationName1 = await getData('emergencyRelationName1', 'STRING');
emergencyRelationName2 =await getData('emergencyRelationName2', 'STRING');
bloodGroup = await getData('bloodGroup', 'STRING');
bloodGroupPictureUrl= await getData('bloodGroupPicture', 'STRING');
String dataUri = originalQrCode;
// Split the data URI at the comma to extract the Base64 part
List<String> parts = dataUri.split(",");
String? base64String = parts.length == 2 ? parts[1] : null;
if (base64String != null) {
qrCode=base64String;
} else {
print("Invalid data URI");
}
}
static void longSuccessToast(String message) { static void longSuccessToast(String message) {
Fluttertoast.showToast( Fluttertoast.showToast(
@ -1963,4 +2382,5 @@ class AppSettings {
});*/ });*/
}); });
} }
} }

@ -42,7 +42,7 @@ class _SignUpState extends State<SignUp> {
'Other', 'Other',
]; ];
var genderUnit = 'Male'; var genderUnit = 'Male';
String? gender;
String _currentAddress =''; String _currentAddress ='';
Position? _currentPosition; Position? _currentPosition;
@ -180,7 +180,8 @@ class _SignUpState extends State<SignUp> {
), ),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
controller: nameController, controller: nameController,
textCapitalization: TextCapitalization.words, textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(Icons.person,'Enter Name'), decoration: textFormFieldDecoration(Icons.person,'Enter Name'),
@ -188,28 +189,70 @@ class _SignUpState extends State<SignUp> {
), ),
), //name ), //name
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Text('Select Gender',style: radioHeadingTextStyle(),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: radioItemsTextStyle()),
value: "male",
groupValue: gender,
activeColor: Colors.white,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style:radioItemsTextStyle()),
value: "female",
groupValue: gender,
activeColor: Colors.white,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: radioItemsTextStyle()),
value: "other",
groupValue: gender,
activeColor: Colors.white,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),
/*Container(
child: DropdownButtonFormField( child: DropdownButtonFormField(
// Initial Value // Initial Value
value: genderUnit, value: genderUnit,
isExpanded: true, isExpanded: true,
decoration: const InputDecoration( decoration: const InputDecoration(
filled: true, filled: true,
fillColor: Colors.white, fillColor: primaryColor,
prefixIcon: Icon( prefixIcon: Icon(
Icons.female, Icons.female,
color: greyColor, color: Colors.white,
), ),
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: Colors.white)),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
labelText: 'Select Gender', labelText: 'Select Gender',
labelStyle: TextStyle(color: Colors.black) labelStyle: TextStyle(color: Colors.white),
), ),
hint: Text('Units'), hint: Text('Units'),
@ -223,7 +266,7 @@ class _SignUpState extends State<SignUp> {
child: Text( child: Text(
items, items,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,color: primaryColor
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
)); ));
@ -235,11 +278,12 @@ class _SignUpState extends State<SignUp> {
genderUnit = newValue!; genderUnit = newValue!;
}); });
}, },
),), ),),*/
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
controller: mobileNumberController, controller: mobileNumberController,
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
maxLength: 10, maxLength: 10,
@ -250,7 +294,9 @@ class _SignUpState extends State<SignUp> {
GestureDetector( GestureDetector(
child: Container( child: Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
textCapitalization: TextCapitalization.words,
controller: userAddressCapturingController, controller: userAddressCapturingController,
onTap:() onTap:()
{ {
@ -367,7 +413,9 @@ class _SignUpState extends State<SignUp> {
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
textCapitalization: TextCapitalization.words,
controller: userAddressDescriptionController, controller: userAddressDescriptionController,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'), decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'),
@ -377,32 +425,33 @@ class _SignUpState extends State<SignUp> {
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
obscureText: isPwdObscureText, obscureText: isPwdObscureText,
controller: passwordController, controller: passwordController,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: primaryColor,
filled: true, filled: true,
labelText: 'Create Password', labelText: 'Create Password',
prefixIcon: const Icon( prefixIcon: const Icon(
Icons.lock, Icons.lock,
color: greyColor, color: Colors.white,
), ),
labelStyle: const TextStyle( labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE color: Colors.white, //<-- SEE HERE
), ),
border: const OutlineInputBorder( border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: Colors.white)),
focusedBorder: const OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
enabledBorder: const OutlineInputBorder( enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: Colors.white),
), ),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
Icons.visibility_off_outlined, Icons.visibility_off_outlined,
color: isPwdObscureText?greyColor:primaryColor, color: isPwdObscureText?buttonColors:Colors.white,
), ),
onPressed: () { onPressed: () {
setState(() { setState(() {
@ -425,7 +474,7 @@ class _SignUpState extends State<SignUp> {
onPressed: () async { onPressed: () async {
if (nameController.text != '' && if (nameController.text != '' &&
passwordController.text != '' && passwordController.text != '' &&
mobileNumberController.text != '') { mobileNumberController.text != ''&&gender!='') {
AppSettings.preLoaderDialog(context); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
@ -441,7 +490,7 @@ class _SignUpState extends State<SignUp> {
]; ];
payload["lastName"] = ''; payload["lastName"] = '';
payload["address1"] = userAddressCapturingController.text; payload["address1"] = userAddressCapturingController.text;
payload["address2"] = ''; payload["address2"] = userAddressDescriptionController.text;
payload["city"] = ''; payload["city"] = '';
payload["state"] = ''; payload["state"] = '';
payload["zip"] = ''; payload["zip"] = '';
@ -451,7 +500,8 @@ class _SignUpState extends State<SignUp> {
payload["longitude"] = lng; payload["longitude"] = lng;
payload["fcmId"] = AppSettings.fcmId; payload["fcmId"] = AppSettings.fcmId;
payload["age"] = 0; payload["age"] = 0;
payload["gender"] = genderUnit.toString(); /* payload["gender"] = genderUnit.toString();*/
payload["gender"] = gender.toString();
bool signUpStatus = await AppSettings.signUp(payload); bool signUpStatus = await AppSettings.signUp(payload);

@ -19,7 +19,7 @@ void main() async{
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: 'Water Management', title: 'Health Care',
theme: new ThemeData( theme: new ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
@ -60,7 +60,7 @@ class _SplashScreenState extends State<SplashScreen> {
loginCheck(); loginCheck();
super.initState(); super.initState();
Future.delayed( Future.delayed(
const Duration(seconds: 3), const Duration(seconds: 5),
() => Navigator.push( () => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => _defaultHome), MaterialPageRoute(builder: (context) => _defaultHome),

@ -1,6 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -8,7 +6,14 @@ import 'package:healthcare_user/common/dashboard.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'dart:io'; import 'dart:io';
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
import 'package:location/location.dart' as locationmap;
import '../google_maps_place_picker_mb/src/models/pick_result.dart';
import '../google_maps_place_picker_mb/src/place_picker.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:healthcare_user/google_maps_place_picker_mb/google_maps_place_picker.dart';
import 'package:healthcare_user/keys.dart';
class UpdateProfile extends StatefulWidget { class UpdateProfile extends StatefulWidget {
const UpdateProfile({Key? key}) : super(key: key); const UpdateProfile({Key? key}) : super(key: key);
@ -17,29 +22,80 @@ class UpdateProfile extends StatefulWidget {
} }
class _UpdateprofileState extends State<UpdateProfile> { class _UpdateprofileState extends State<UpdateProfile> {
bool isPwdObscureText = true;
bool isPwdObscureText=true; bool isConfirmPwdObscureText = true;
bool isConfirmPwdObscureText=true;
TextEditingController nameController = TextEditingController(); TextEditingController nameController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController(); TextEditingController mobileNumberController = TextEditingController();
TextEditingController emailController = TextEditingController(); TextEditingController emailController = TextEditingController();
TextEditingController ageController = TextEditingController(); TextEditingController ageController = TextEditingController();
PickResult? selectedPlace;
bool _mapsInitialized = false;
final String _mapsRenderer = "latest";
var kInitialPosition = const LatLng(15.462477, 78.717401);
locationmap.Location location = locationmap.Location();
final GoogleMapsFlutterPlatform mapsImplementation =
GoogleMapsFlutterPlatform.instance;
double lat = 0;
double lng = 0;
String address = '';
TextEditingController userAddressDescriptionController =
TextEditingController();
TextEditingController emergencyContactName1Controller =
TextEditingController();
TextEditingController emergencyContactRelation1Controller =
TextEditingController();
TextEditingController emergencyContactNumber1Controller =
TextEditingController();
TextEditingController emergencyContactName2Controller =
TextEditingController();
TextEditingController emergencyContactRelation2Controller =
TextEditingController();
TextEditingController emergencyContactNumber2Controller =
TextEditingController();
TextEditingController bloodGroupController = TextEditingController();
List emergenyContacts = [];
void initRenderer() {
if (_mapsInitialized) return;
if (mapsImplementation is GoogleMapsFlutterAndroid) {
switch (_mapsRenderer) {
case "legacy":
(mapsImplementation as GoogleMapsFlutterAndroid)
.initializeWithRenderer(AndroidMapRenderer.legacy);
break;
case "latest":
(mapsImplementation as GoogleMapsFlutterAndroid)
.initializeWithRenderer(AndroidMapRenderer.latest);
break;
}
}
setState(() {
_mapsInitialized = true;
});
}
@override @override
void initState() { void initState() {
isPwdObscureText=true; isPwdObscureText = true;
isConfirmPwdObscureText=true; isConfirmPwdObscureText = true;
nameController.text=AppSettings.userName; nameController.text = AppSettings.userName;
mobileNumberController.text=AppSettings.phoneNumber; mobileNumberController.text = AppSettings.phoneNumber;
emailController.text=AppSettings.email; emailController.text = AppSettings.email;
ageController.text=AppSettings.age; ageController.text = AppSettings.age;
address = AppSettings.userAddress;
userAddressDescriptionController.text = AppSettings.detailedAddress;
lat = AppSettings.userLatitude;
lng = AppSettings.userLongitude;
emergencyContactName1Controller.text = AppSettings.emergencyRelationName1;
emergencyContactRelation1Controller.text = AppSettings.emergencyRelation1;
emergencyContactNumber1Controller.text =
AppSettings.emergencyContactNumber1;
emergencyContactName2Controller.text = AppSettings.emergencyRelationName2;
emergencyContactRelation2Controller.text = AppSettings.emergencyRelation2;
emergencyContactNumber2Controller.text =
AppSettings.emergencyContactNumber2;
bloodGroupController.text = AppSettings.bloodGroup;
super.initState(); super.initState();
} }
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
@ -80,12 +136,48 @@ class _UpdateprofileState extends State<UpdateProfile> {
} }
} }
Future pickBloodGroupImageFromGallery() 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.uploadBloodGroupImage(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.bloodGroupPictureUrl = jsonDecode(res)['blood_Group_picture'];
});
AppSettings.saveData(
'bloodGroupPicture', jsonDecode(res)['blood_Group_picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeBloodGroupImageFromCamera() 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.uploadBloodGroupImage(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.bloodGroupPictureUrl = jsonDecode(res)['blood_Group_picture'];
});
AppSettings.saveData(
'bloodGroupPicture', jsonDecode(res)['blood_Group_picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar:AppSettings.appBar('Edit Profile'), appBar: AppSettings.appBar('Edit Profile'),
body: Stack(children: <Widget>[ body: Stack(children: <Widget>[
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
@ -101,25 +193,32 @@ class _UpdateprofileState extends State<UpdateProfile> {
}, },
child: SafeArea( child: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(height: MediaQuery.of(context).size.height * .05),
height: 40,
),
/*Container( /*Container(
child: Image( child: Image(
image: AssetImage('images/logo.png'), image: AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .10, height: MediaQuery.of(context).size.height * .10,
)),*/ )),*/
Container(child: GestureDetector( Container(
child: GestureDetector(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * .30, width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .20, height: MediaQuery.of(context).size.height * .20,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
image: DecorationImage( image: DecorationImage(
image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ? image: (AppSettings.profilePictureUrl != '' &&
NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file AppSettings.profilePictureUrl !=
'null')
? NetworkImage(
AppSettings.profilePictureUrl)
as ImageProvider
: AssetImage(
"images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)), fit: BoxFit.fitWidth)),
), ),
onTap: () { onTap: () {
@ -130,7 +229,8 @@ class _UpdateprofileState extends State<UpdateProfile> {
height: 200, height: 200,
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
GestureDetector( GestureDetector(
child: Icon( child: Icon(
@ -144,8 +244,10 @@ class _UpdateprofileState extends State<UpdateProfile> {
}, },
), ),
SizedBox( SizedBox(
width: width: MediaQuery.of(context)
MediaQuery.of(context).size.width * .20, .size
.width *
.20,
), ),
GestureDetector( GestureDetector(
child: Icon( child: Icon(
@ -164,171 +266,568 @@ class _UpdateprofileState extends State<UpdateProfile> {
); );
}); });
}, },
),), ),
),
SizedBox( SizedBox(
height: 10, height: MediaQuery.of(context).size.height * .02,
), ),
Container( Container(
padding: const EdgeInsets.all(10),
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: nameController, controller: nameController,
decoration: const InputDecoration( decoration: textFormFieldDecorationGrey(
prefixIcon: Icon( Icons.person, 'Username'),
Icons.person,
color: greyColor,
), ),
border: OutlineInputBorder( ), //name
borderSide: BorderSide(color: greyColor)), SizedBox(
focusedBorder: OutlineInputBorder( height: MediaQuery.of(context).size.height * .02,
borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder( Container(
borderSide: BorderSide(color: greyColor), child: TextFormField(
cursorColor: greyColor,
controller: emailController,
decoration: textFormFieldDecorationGrey(
Icons.mail, 'Enter email ID'),
), ),
labelText: 'Username', ), //email
labelStyle: TextStyle( SizedBox(
color: greyColor, //<-- SEE HERE height: MediaQuery.of(context).size.height * .02,
), ),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
decoration: textFormFieldDecorationGrey(
Icons.phone_android, 'Mobile Number'),
), ),
), //mobile
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: ageController,
decoration: textFormFieldDecorationGrey(
Icons.person, 'Enter age'),
), ),
),//name ),
const SizedBox( SizedBox(
height: 15, height: MediaQuery.of(context).size.height * .02,
), ),
Container( Container(
padding: const EdgeInsets.all(10),
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: emailController, controller: bloodGroupController,
decoration: const InputDecoration( decoration: textFormFieldDecorationGrey(
prefixIcon: Icon( Icons.bloodtype, 'Enter Blood Group'),
Icons.email,
color: greyColor,
), ),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder( SizedBox(
borderSide: BorderSide(color: greyColor), height: MediaQuery.of(context).size.height * .02,
), ),
labelText: 'Enter email ID',
labelStyle: TextStyle( Align(
color: greyColor, //<-- SEE HERE alignment: Alignment.bottomLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: AppSettings.bloodGroupPictureUrl != '' &&
AppSettings.bloodGroupPictureUrl != 'null'
? Row(
children: [
Container(
width:
MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height *
.20,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(AppSettings
.bloodGroupPictureUrl)
as ImageProvider, // picked file
fit: BoxFit.fitWidth)),
), ),
IconButton(
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 takeBloodGroupImageFromCamera();
Navigator.pop(context);
},
), ),
), //email
SizedBox( SizedBox(
height: 10, width:
MediaQuery.of(context)
.size
.width *
.20,
), ),
Container( GestureDetector(
padding: const EdgeInsets.all(10), child: Icon(
child: TextFormField( Icons.photo,
cursorColor: greyColor, size: 100,
controller: mobileNumberController, color: primaryColor,
decoration: const InputDecoration( ),
prefixIcon: Icon( onTap: () async {
Icons.phone_android, await pickBloodGroupImageFromGallery();
color: greyColor, Navigator.pop(context);
},
), ),
border: OutlineInputBorder( ],
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
), ),
labelText: 'Enter Mobile Number', );
labelStyle: TextStyle( });
color: greyColor, //<-- SEE HERE },
icon: Icon(
Icons.edit,
color: Colors.red,
size: 40,
), ),
), ),
],
)
: Visibility(
visible: true,
child: 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 takeBloodGroupImageFromCamera();
Navigator.pop(context);
},
), ),
), //mobile
SizedBox( SizedBox(
height: 10, width:
MediaQuery.of(context)
.size
.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickBloodGroupImageFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
});
},
child: const Text('Upload Blood Group Image'),
),
),
),
), ),
SizedBox( SizedBox(
height: 10, height: MediaQuery.of(context).size.height * .02,
),
Text(
'Emergency Contact Details',
style: TextStyle(
color: primaryColor,
fontSize: 14,
fontWeight: FontWeight.bold),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
), ),
Container( Container(
padding: const EdgeInsets.all(10), width: double.infinity,
child: TextFormField( decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: ageController, controller: emergencyContactName1Controller,
decoration: const InputDecoration( decoration: textFormFieldDecorationGrey(
prefixIcon: Icon( Icons.person, 'Enter Name'),
Icons.person, ),
color: greyColor, SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
TextFormField(
cursorColor: greyColor,
controller: emergencyContactRelation1Controller,
decoration: textFormFieldDecorationGrey(
Icons.reduce_capacity, 'Relation'),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
TextFormField(
cursorColor: greyColor,
controller: emergencyContactNumber1Controller,
decoration: textFormFieldDecorationGrey(
Icons.phone_android, 'Contact Number'),
),
],
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: emergencyContactName2Controller,
decoration: textFormFieldDecorationGrey(
Icons.person, 'Enter Name'),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
TextFormField(
cursorColor: greyColor,
controller: emergencyContactRelation2Controller,
decoration: textFormFieldDecorationGrey(
Icons.reduce_capacity, 'Relation'),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
TextFormField(
cursorColor: greyColor,
controller: emergencyContactNumber2Controller,
decoration: textFormFieldDecorationGrey(
Icons.phone_android, 'Contact Number'),
),
],
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
Row(
children: [
Text(
'Current Location :',
style: labelTextStyle(),
),
SizedBox(
width: MediaQuery.of(context).size.width * .02,
),
Expanded(
child: Text(
address,
style: valuesTextStyle(),
))
],
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: TextButton(
onPressed: () {
location.serviceEnabled().then((value) {
if (value) {
initRenderer();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return PlacePicker(
resizeToAvoidBottomInset: false,
hintText: "Find a place ...",
searchingText: "Please wait ...",
selectText: "Select place",
outsideOfPickAreaText:
"Place not in area",
initialPosition: kInitialPosition,
useCurrentLocation: true,
selectInitialPosition: true,
usePinPointingSearch: true,
usePlaceDetailSearch: true,
zoomGesturesEnabled: true,
zoomControlsEnabled: true,
onMapCreated:
(GoogleMapController controller) {},
onPlacePicked:
(PickResult result) async {
setState(() {
selectedPlace = result;
lat = selectedPlace!
.geometry!.location.lat;
lng = selectedPlace!
.geometry!.location.lng;
if (selectedPlace!.types!.length ==
1) {
address = selectedPlace!
.formattedAddress!;
} else {
address = selectedPlace!.name! +
', ' +
selectedPlace!
.formattedAddress!;
}
Navigator.of(context).pop();
});
},
onMapTypeChanged: (MapType mapType) {},
apiKey: Platform.isAndroid
? APIKeys.androidApiKey
: APIKeys.iosApiKey,
forceAndroidLocationManager: true,
);
},
),
);
} else {
showGeneralDialog(
context: context,
pageBuilder: (context, x, y) {
return Scaffold(
backgroundColor:
Colors.grey.withOpacity(.5),
body: Center(
child: Container(
width: double.infinity,
height: 150,
padding: const EdgeInsets.symmetric(
horizontal: 20),
child: Card(
child: Padding(
padding:
const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const Text(
"Please enable the location",
style: TextStyle(
fontSize: 18,
fontWeight:
FontWeight.w500,
), ),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder( const SizedBox(
borderSide: BorderSide(color: greyColor), height: 20,
), ),
labelText: 'Enter age', ElevatedButton(
labelStyle: TextStyle( onPressed: () {
color: greyColor, //<-- SEE HERE Navigator.pop(context);
},
child: const Text("Cancel"),
), ),
],
), ),
), ),
), ),
),
),
);
},
);
}
});
},
child: const Text(
'Change',
style: TextStyle(
color: primaryColor,
decoration: TextDecoration.underline,
),
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .02,
),
Container( Container(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: TextFormField(
cursorColor: greyColor,
controller: userAddressDescriptionController,
keyboardType: TextInputType.emailAddress,
decoration: textFormFieldDecorationGrey(
Icons.plagiarism_outlined,
'Address Description (Ex: Flat No)'),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * .04,
),
/*Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .05,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: primaryColor, // background primary: buttonColors, // background
onPrimary: Colors.white, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () async{ onPressed: () async{
int age=0;
if(ageController.text.toString()!=''){ var payload = new Map<String, dynamic>();
age=int.parse(ageController.text.toString()); payload["latitude"] = lat;
payload["longitude"] = lng;
payload["address1"] = address;
payload["address2"] = userAddressDescriptionController.text;
bool updateStatus = await AppSettings.updateLocation(payload);
if(updateStatus){
AppSettings.longSuccessToast("Location Updated");
} }
else{ else{
age=0; AppSettings.longFailedToast("Failed to update location");
}
},
child: const Text('Update My Location'),
)),*/
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
emergenyContacts = [];
int age = 0;
emergenyContacts.add({
"name": emergencyContactName1Controller.text,
"relationship":
emergencyContactRelation1Controller.text,
"contactNumber":
emergencyContactNumber1Controller.text,
});
emergenyContacts.add({
"name": emergencyContactName2Controller.text,
"relationship":
emergencyContactRelation2Controller.text,
"contactNumber":
emergencyContactNumber2Controller.text,
});
if (ageController.text.toString() != '') {
age = int.parse(ageController.text.toString());
} else {
age = 0;
} }
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
payload["username"] = nameController.text.toString(); payload["username"] =
payload["phone"] = mobileNumberController.text.toString(); nameController.text.toString();
payload["phone"] =
mobileNumberController.text.toString();
payload["age"] = age; payload["age"] = age;
payload["emails"] = [{"email":emailController.text.toString()}]; payload["latitude"] = lat;
bool signUpStatus = await AppSettings.updateProfile(payload); payload["longitude"] = lng;
try{ payload["address1"] = address;
payload["address2"] =
userAddressDescriptionController.text;
payload["bloodGroup"] = bloodGroupController.text;
payload["emails"] = [
{"email": emailController.text.toString()}
];
payload["emergencyContacts"] = emergenyContacts;
payload["blood_Group_picture"] =
AppSettings.bloodGroupPictureUrl;
bool signUpStatus =
await AppSettings.updateProfile(payload);
try {
if (signUpStatus) { if (signUpStatus) {
Navigator.pop(context); Navigator.pop(context);
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => Dashboard()), MaterialPageRoute(
builder: (context) => Dashboard()),
); );
AppSettings.longSuccessToast("profile updated"); AppSettings.longSuccessToast(
"profile updated");
} else { } else {
AppSettings.longFailedToast(
AppSettings.longFailedToast("profile not updated"); "profile not updated");
}
} }
catch(exception){ } catch (exception) {
print(exception); print(exception);
AppSettings.longFailedToast("Please enter valid details"); AppSettings.longFailedToast(
"Please enter valid details");
} }
}, },
child: Text('Update'), child: Text('Update'),
) )),
),
], ],
), ),
),
)), )),
), ),
])); ]));

@ -284,34 +284,24 @@ class _EditMedicineTimingsState extends State<EditMedicineTimings> {
child: ListView.separated( child: ListView.separated(
separatorBuilder: (context, index) => const Divider( separatorBuilder: (context, index) => const Divider(
height: 4.0, height: 4.0,
color: primaryColor, color: Colors.transparent,
), ),
//padding: EdgeInsets.all(8), //padding: EdgeInsets.all(8),
itemCount: timings.length, itemCount: timings.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return GestureDetector(
padding: EdgeInsets.all(10),
child: Container(
padding: EdgeInsets.fromLTRB(8, 8, 0, 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width:
MediaQuery.of(context).size.width * .40,
child: Text(
timings[index]['name'],
style: wrapTextStyle(),
),
),
GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
showPicker( showPicker(
showSecondSelector: true, showSecondSelector: true,
accentColor: primaryColor,
okStyle: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),
cancelStyle: TextStyle(color: Colors.red,fontWeight: FontWeight.bold),
barrierDismissible: false,
blurredBackground: true,
borderRadius: 20,
disableAutoFocusToNextInput: true,
displayHeader: true,
context: context, context: context,
value: _time, value: _time,
//onChange: onTimeChanged, //onChange: onTimeChanged,
@ -331,17 +321,37 @@ class _EditMedicineTimingsState extends State<EditMedicineTimings> {
), ),
); );
}, },
child: Image( child: Card(
child: Padding(
padding: EdgeInsets.all(10),
child: Container(
padding: EdgeInsets.fromLTRB(8, 8, 0, 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width:
MediaQuery.of(context).size.width * .40,
child: Text(
timings[index]['name'],
style: wrapTextStyle(),
),
),
Image(
image: AssetImage('images/time.png'), image: AssetImage('images/time.png'),
width: 30, width: 30,
height: 30, height: 30,
), ),
),
textForSelectedTime(index) textForSelectedTime(index)
], ],
), ),
], ],
)), )),
),
),
); );
})), })),
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40), Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40),
@ -400,16 +410,54 @@ class _EditMedicineTimingsState extends State<EditMedicineTimings> {
); );
} }
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async => onWillPop(),
child:Scaffold(
appBar: AppSettings.appBar('Edit Medicine Timings'), appBar: AppSettings.appBar('Edit Medicine Timings'),
body: Container( body: Container(
child: //Text(widget.medicineTimings.toString()) child: //Text(widget.medicineTimings.toString())
renderTimings(), renderTimings(),
) )
//medicineTimings.length==0?renderUi():renderTimings(), //medicineTimings.length==0?renderUi():renderTimings(),
); ) ,);
} }
} }

@ -36,7 +36,7 @@ class _InvitationsState extends State<Invitations> {
cursorColor: greyColor, cursorColor: greyColor,
controller: nameController, controller: nameController,
decoration: textFormFieldDecoration( decoration: textFormFieldDecoration(
Icons.phone, 'Enter Name'), Icons.person, 'Enter Name'),
), ),
), ),
SizedBox( SizedBox(

@ -1,4 +1,8 @@
import 'dart:io';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/chat/chatpage.dart';
import 'package:healthcare_user/common/splash_screen.dart'; import 'package:healthcare_user/common/splash_screen.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -7,6 +11,14 @@ void main () async {
// Set default home. // Set default home.
Widget _defaultHome = Splash(); Widget _defaultHome = Splash();
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
FirebaseOptions firebaseOptions = FirebaseOptions(
apiKey: 'AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds',
appId: '1:60196905754:android:05ea9ecef5280e578a42a3',
messagingSenderId: '60196905754 ',
projectId: 'health-pharma-67443',
storageBucket: "health-pharma-67443.appspot.com"// Firebase Realtime Database URL
);
Platform.isAndroid? await Firebase.initializeApp(options: firebaseOptions):await Firebase.initializeApp();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) { .then((_) {
runApp(Sizer( runApp(Sizer(

@ -1,3 +1,5 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -11,7 +13,7 @@ class BmiHistoryModel {
DateTime dateForFilter=new DateTime.now(); DateTime dateForFilter=new DateTime.now();
String bmiInfoId = ''; String bmiInfoId = '';
String bmiText = ''; String bmiText = '';
Color bmiTextColor = Colors.black;
var number1; var number1;
var number2; var number2;
@ -19,17 +21,6 @@ class BmiHistoryModel {
factory BmiHistoryModel.fromJson(Map<String, dynamic> json){ factory BmiHistoryModel.fromJson(Map<String, dynamic> json){
BmiHistoryModel rtvm = new BmiHistoryModel(); BmiHistoryModel rtvm = new BmiHistoryModel();
/*"heightUnit": "feet",
"weightUnit": "kg",oh
"_id": "6493fe48eca67b71b8444e24",
"bmiinfoid": "BMI1687420488845468",
"customerId": "AHSUSNE2",
"height": "164.592",
"weight": "50",
"age": 27,
"bmivalue": 18.46,
"createdAt": "2023-06-22T07:54:48.847Z",
"updatedAt": "2023-06-22T07:54:48.847Z",*/
rtvm.bmiValue = json['bmivalue'].toString() ?? ''; rtvm.bmiValue = json['bmivalue'].toString() ?? '';
rtvm.bmiInfoId = json['bmiinfoid'].toString() ?? ''; rtvm.bmiInfoId = json['bmiinfoid'].toString() ?? '';
@ -42,15 +33,19 @@ class BmiHistoryModel {
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate); rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
if(double.parse(rtvm.bmiValue)<18.5){ if(double.parse(rtvm.bmiValue)<18.5){
rtvm.bmiText='Underweight'; rtvm.bmiText='Underweight';
rtvm.bmiTextColor=Colors.red;
} }
else if(double.parse(rtvm.bmiValue)>=18.5&&double.parse(rtvm.bmiValue)<=24.9){ else if(double.parse(rtvm.bmiValue)>=18.5&&double.parse(rtvm.bmiValue)<=24.9){
rtvm.bmiText='Normal weight'; rtvm.bmiText='Normal weight';
rtvm.bmiTextColor=buttonColors;
} }
else if(double.parse(rtvm.bmiValue)>=25&&double.parse(rtvm.bmiValue)<=29.9){ else if(double.parse(rtvm.bmiValue)>=25&&double.parse(rtvm.bmiValue)<=29.9){
rtvm.bmiText='Overweight'; rtvm.bmiText='Overweight';
rtvm.bmiTextColor=Colors.red;
} }
else if(double.parse(rtvm.bmiValue)>=30){ else if(double.parse(rtvm.bmiValue)>=30){
rtvm.bmiText='Obesity'; rtvm.bmiText='Obesity';
rtvm.bmiTextColor=Colors.red;
} }

@ -0,0 +1,35 @@
class CartItemsModel {
String medicine_name='';
String quantity='';
String price='';
List items=[];
CartItemsModel();
factory CartItemsModel.fromJson(Map<String, dynamic> json){
CartItemsModel rtvm = new CartItemsModel();
//rtvm.items=json['items']??[];
rtvm.medicine_name = json['medicinename']?? '';
rtvm.quantity =json['quantity'].toString()?? '';
rtvm.price = json['price'].toString()?? '';
return rtvm;
}
}

@ -0,0 +1,26 @@
class DynamicCodeModel {
String doctorId = '';
String dynamicCode = '';
String recordId = '';
String requestedDoctor = '';
String problemDoctorName = '';
String problem = '';
String problemCategory = '';
DynamicCodeModel();
factory DynamicCodeModel.fromJson(Map<String, dynamic> json){
DynamicCodeModel rtvm = new DynamicCodeModel();
rtvm.doctorId = json['doctorId'] ?? '';
rtvm.dynamicCode= json['dynamicCode']??'';
rtvm.requestedDoctor=json['doctorDetails']['doctorName']??'';
rtvm.problem=json['recordDetails']['problem']??'';
rtvm.problemDoctorName=json['recordDetails']['doctorName']??'';
rtvm.problemCategory=json['recordDetails']['problemCategory']??'';
rtvm.recordId= json['recordDetails']['recordId']??'';
return rtvm;
}
}

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
class GetAllOffersModel {
String description='';
String name='';
String code='';
String category='';
String startDate='';
String endDate='';
String picture='';
String pharmacy_id='';
bool isChecked=false;
GetAllOffersModel();
factory GetAllOffersModel.fromJson(Map<String, dynamic> json){
GetAllOffersModel rtvm = new GetAllOffersModel();
rtvm.description = json['description'] ?? '';
rtvm.name = json['offer_name'] ?? '';
rtvm.code = json['offer_code'] ?? '';
rtvm.category = json['category'] ?? '';
rtvm.startDate = json['starting_date'] ?? '';
rtvm.endDate = json['ending_date'] ?? '';
rtvm.picture = json['picture'][0]['url'] ?? '';
return rtvm;
}
}

@ -0,0 +1,38 @@
class GetAllQuotationsModel {
String bookingId='';
String pharmacyId='';
String pharmacyName='';
String pharmacyContactNumber='';
String pharmacy_address='';
List prescriptionImages=[];
GetAllQuotationsModel();
factory GetAllQuotationsModel.fromJson(Map<String, dynamic> json){
GetAllQuotationsModel rtvm = new GetAllQuotationsModel();
rtvm.bookingId = json['bookingId'] ?? '';
rtvm.pharmacyId = json['pharmacyId'] ?? '';
if(json['pharmacyInfo']!=null){
rtvm.pharmacyName = json['pharmacyInfo']['pharmacyname'] ?? '';
rtvm.pharmacyContactNumber = json['pharmacyInfo']['profile']['contactNumber'] ?? '';
rtvm.pharmacy_address = json['pharmacyInfo']['profile']['pharmacy_address'] ?? '';
}
else{
rtvm.pharmacyName = '';
rtvm.pharmacyContactNumber = '';
rtvm.pharmacy_address ='';
}
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,79 @@
import 'dart:convert';
List<GetOffersDetailsModel> listdadFromJson(String str) => List<GetOffersDetailsModel >.from(json.decode(str).map((x) => GetOffersDetailsModel .fromJson(x)));
String listdadToJson(List<GetOffersDetailsModel > data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class GetOffersDetailsModel {
String ? description;
String ? starting_date;
String ? ending_date;
String ? offer_code;
List<Picture> picture;
String ? offer_name;
String ? category;
String ? pharmacyId;
String request_status='';
GetOffersDetailsModel ({
required this.description,
required this.starting_date,
required this.ending_date,
required this.offer_code,
required this.picture,
required this.offer_name ,
required this.category ,
required this.pharmacyId ,
required this.request_status ,
});
factory GetOffersDetailsModel .fromJson(Map<String, dynamic> json) => GetOffersDetailsModel (
description: json["description"],
starting_date: json["starting_date"],
ending_date: json["ending_date"],
offer_code: json["offer_code"],
category: json["category"],
picture: List<Picture>.from(json["picture"].map((x) => Picture.fromJson(x))),
offer_name : json["offer_name"],
pharmacyId : json["pharmacyId"],
request_status : json["request_status"],
);
Map<String, dynamic> toJson() => {
"description": description,
"starting_date": starting_date,
"ending_date": ending_date,
"offer_code": offer_code,
"picture": List<dynamic>.from(picture.map((x) => x.toJson())),
"offer_name": offer_name,
"category": category,
"pharmacyId": pharmacyId,
"request_status": request_status,
};
}
class Picture {
String id;
String url;
Picture({
required this.id,
required this.url,
});
factory Picture.fromJson(Map<String, dynamic> json) => Picture(
id: json["_id"],
url: json["url"],
);
Map<String, dynamic> toJson() => {
"_id": id,
"url": url,
};
}

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:intl/intl.dart';
class ReportsModel { class ReportsModel {
String patient_name=''; String patient_name='';
@ -14,6 +15,7 @@ class ReportsModel {
List findingsImages = []; List findingsImages = [];
List reportImages = []; List reportImages = [];
List prescriptionImages = []; List prescriptionImages = [];
DateTime dateForFilter=new DateTime.now();
ReportsModel(); ReportsModel();
@ -29,6 +31,7 @@ class ReportsModel {
rtvm.findingsImages = json['findings'] ?? []; rtvm.findingsImages = json['findings'] ?? [];
rtvm.reportImages = json['reports'] ?? []; rtvm.reportImages = json['reports'] ?? [];
rtvm.prescriptionImages = json['prescription'] ?? []; rtvm.prescriptionImages = json['prescription'] ?? [];
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
if(rtvm.patient_type.toString().toLowerCase()=='self'){ if(rtvm.patient_type.toString().toLowerCase()=='self'){
rtvm.age=AppSettings.age; rtvm.age=AppSettings.age;

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -12,6 +13,7 @@ class SugarHistoryModel {
String actualDate=''; String actualDate='';
String sugarInfoId=''; String sugarInfoId='';
DateTime dateForFilter=new DateTime.now(); DateTime dateForFilter=new DateTime.now();
Color sugarValueColor=Colors.black;
SugarHistoryModel(); SugarHistoryModel();
@ -28,6 +30,28 @@ class SugarHistoryModel {
rtvm.actualDate = json['date'].toString() ?? ''; rtvm.actualDate = json['date'].toString() ?? '';
rtvm.sugarInfoId = json['sugarinfoid'].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); //DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate); rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);

@ -0,0 +1,616 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
class AddDoctor extends StatefulWidget {
const AddDoctor({Key? key}) : super(key: key);
@override
State<AddDoctor> createState() => _AddDoctorState();
}
class _AddDoctorState extends State<AddDoctor> {
bool isPwdObscureText=true;
TextEditingController doctorIdController = TextEditingController();
bool isFirstAddButtonShow=false;
bool isSecondAddButtonShow=false;
bool is2ndPlaceOfPracticeControllerVisible=false;
bool is3rdPlaceOfPracticeControllerVisible=false;
bool isConfirmPwdObscureText=true;
TextEditingController nameController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController emailController = TextEditingController();
/*TextEditingController ageController = TextEditingController();*/
TextEditingController specializationController = TextEditingController();
TextEditingController qualificationController = TextEditingController();
TextEditingController hospitalNameController1 = TextEditingController();
TextEditingController hospitalNameController2 = TextEditingController();
TextEditingController hospitalNameController3 = TextEditingController();
TextEditingController practiceAddressController1 = TextEditingController();
TextEditingController practiceAddressController2 = TextEditingController();
TextEditingController practiceAddressController3 = TextEditingController();
String? gender;
List placeOfPractices=[];
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
bool isQrScannerVisible=false;
String doctorId='';
@override
void initState() {
super.initState();
}
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(() {
doctorId=jsonDecode(barcodeScanRes)['doctorId'];
doctorIdController.text=doctorId;
});
} on PlatformException {
barcodeScanRes = 'Failed to get platform version.';
}}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppSettings.appBar('Add Doctor'),
body: Stack(children: <Widget>[
GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
height:MediaQuery.of(context).size.height * .02,
),
Container(
child: Column(
children: [
IconButton(
onPressed: (){
scanQR();
},
icon: Icon(
Icons.qr_code_scanner,
color: primaryColor,
),
),
Text('Scan Qr Code',style: TextStyle(fontSize: 12,color: secondaryColor),)
],
)
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: doctorIdController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Doctor Id',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'DoctorName',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),//name
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone_android,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter Mobile Number',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
), //mobile
/*SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: ageController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),*/
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Select Gender',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "male",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style:TextStyle(color: primaryColor,fontSize: 11)),
value: "female",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "other",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: qualificationController,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.quickreply,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter qualifications',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: specializationController,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.folder_special,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter specializations',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Place of practice',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController1,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController1,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice address',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2ndPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:hospitalNameController2.text!=''&&hospitalNameController2.text!='null'||is2ndPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController2,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController2,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rdPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: hospitalNameController3.text!=''&&hospitalNameController3.text!='null'||is3rdPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController3,
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController3,
textCapitalization: TextCapitalization.words,
onChanged:(val) {
},
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
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: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async{
if(doctorIdController.text!=''&&nameController.text!=''&&gender!=null){
if(hospitalNameController1!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController1.text,
'address': practiceAddressController1.text
});
}
if(hospitalNameController2!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController2.text,
'address': practiceAddressController2.text
});
}
if(hospitalNameController3!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController3.text,
'address': practiceAddressController3.text
});
}
int age=0;
/*if(ageController.text.toString()!=''||ageController.text.toString()!='null'){
age=int.parse(ageController.text.toString());
}
else{
age=0;
}*/
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["doctorId"] =doctorIdController.text.toString();
payload["doctorName"] = nameController.text.toString();
payload["phone"] = mobileNumberController.text.toString();
payload["age"] = age;
payload["gender"] = gender;
payload["specialization"] = specializationController.text;
payload["qualification"] =qualificationController.text ;
payload["placeOfPractice"] =placeOfPractices ;
bool status = await AppSettings.addDoctor(payload);
if(status){
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longSuccessToast('Doctor added successfully');
Navigator.pop(context);
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('There is a problem for adding doctor');
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: Text('Add Doctor'),
)
),
],
),
)
)),
),
]));
}
}

@ -0,0 +1,262 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
import 'package:healthcare_user/my_connections/add-doctor.dart';
class AllConnections extends StatefulWidget {
const AllConnections({Key? key}) : super(key: key);
@override
State<AllConnections> createState() => _AllConnectionsState();
}
class _AllConnectionsState extends State<AllConnections>
with TickerProviderStateMixin {
late TabController _controller;
bool isConnectedDoctorsDataLoading=false;
bool isSereverIssue=false;
final List<Tab> topTabs = <Tab>[
Tab(
child: Text(
'Doctors',
style: TextStyle(fontSize: 14),
)),
Tab(
child: Text(
'Pharmacies',
style: TextStyle(fontSize: 14),
)),
];
List<GetConnectedDoctorsModel> connectedDoctorsListOriginal = [];
@override
void initState() {
_controller = TabController(vsync: this, length: topTabs.length);
getAllConnectedDoctors();
super.initState();
}
Future<void> getAllConnectedDoctors() async {
isConnectedDoctorsDataLoading=true;
try {
var response = await AppSettings.getAllConnectedDoctors();
setState(() {
connectedDoctorsListOriginal = ((jsonDecode(response)['doctors']) as List)
.map((dynamic model) {
return GetConnectedDoctorsModel.fromJson(model);
}).toList();
connectedDoctorsListOriginal=connectedDoctorsListOriginal.reversed.toList();
isConnectedDoctorsDataLoading = false;
});
} catch (e) {
setState(() {
isConnectedDoctorsDataLoading = false;
isSereverIssue = true;
});
}
}
Widget _doctors(){
if(connectedDoctorsListOriginal.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: connectedDoctorsListOriginal.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: (){
},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding:EdgeInsets.all(10) ,
child: Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Doctor Name',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Specialization',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Qualification',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Hospital',
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,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(connectedDoctorsListOriginal[index].doctor_name.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedDoctorsListOriginal[index].specialization,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedDoctorsListOriginal[index].qualification,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedDoctorsListOriginal[index].hospital_name,
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('Click below icon to add new doctor'),
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) => AddDoctor())).then((value) {
getAllConnectedDoctors();
});
},
),
)
],
),
)
);
}
}
Widget _pharmacies(){
return Container();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My Connections'),
backgroundColor: primaryColor,
bottom: TabBar(
controller: _controller,
tabs: topTabs,
indicatorColor: buttonColors,
unselectedLabelColor: Colors.white60,
indicatorWeight: 2,
),
),
body: Container(
child: TabBarView(controller: _controller, children: [
Padding(padding: EdgeInsets.all(10),
child:isConnectedDoctorsDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _doctors(),
),
Padding(
padding: EdgeInsets.all(10),
)
]),
),
floatingActionButton: Visibility(
visible:connectedDoctorsListOriginal.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) => AddDoctor())).then((value) {
getAllConnectedDoctors();
});
},
),
],
),
),
),
);
}
}

@ -0,0 +1,350 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/dynamic_code_model.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class DynamicCode extends StatefulWidget {
const DynamicCode({Key? key}) : super(key: key);
@override
State<DynamicCode> createState() => _DynamicCodeState();
}
class _DynamicCodeState extends State<DynamicCode> {
bool isDataLoading=false;
bool isSereverIssue = false;
List<DynamicCodeModel> originalList = [];
RefreshController _refreshController =
RefreshController(initialRefresh: true);
@override
void initState() {
getAllDynamicCodes();
super.initState();
}
Future<void> getAllDynamicCodes() async {
isDataLoading=true;
try {
var response = await AppSettings.getDynamicCode();
setState(() {
originalList = ((jsonDecode(response)) as List)
.map((dynamic model) {
return DynamicCodeModel.fromJson(model);
}).toList();
//originalList=originalList.reversed.toList();
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
void _onRefresh() async{
// monitor network fetch
await Future.delayed(Duration(milliseconds: 1000));
// if failed,use refreshFailed()
/*items.remove((items.length-1).toString());
if(mounted)
setState(() {
});*/
await getAllDynamicCodes();
_refreshController.refreshCompleted(
resetFooterState: true,
);
}
void _onLoading() async{
// monitor network fetch
await Future.delayed(Duration(milliseconds: 1000));
// if failed,use loadFailed(),if no data return,use LoadNodata()
_refreshController.loadComplete();
}
Widget _renderUi(){
//12. originalList=originalList.reversed.toList();
if(originalList.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: originalList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: (){
},
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(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Requested Doctor',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Dynamic code',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Record Id',
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(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Dr. '+originalList[index].requestedDoctor.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
originalList[index].dynamicCode,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
originalList[index].recordId,
style: valuesTextStyle(),
),
],
),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text('Problem Details',style: problemTextStyle(),),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Problem',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Doctor Name',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Problem Category',
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(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(originalList[index].problem.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Dr. '+originalList[index].problemDoctorName.toUpperCase(),
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
originalList[index].problemCategory.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 Dynamic Codes available'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () async {
},
),
)
],
),
)
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Dynamic Code'),
body: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
/* header: WaterDropHeader(
waterDropColor: primaryColor,
),*/
header: CustomHeader(
builder: (BuildContext context, RefreshStatus? mode) {
return Container(
child: Center(
child: CircularProgressIndicator(
// Set the color of the circular progress indicator
valueColor: AlwaysStoppedAnimation<Color>(primaryColor),
),
),
);
},
),
footer: CustomFooter(
builder: (BuildContext context,LoadStatus? mode){
Widget body ;
if(mode==LoadStatus.idle){
body = Text("pull up load");
}
else if(mode==LoadStatus.loading){
body = Container();
}
else if(mode == LoadStatus.failed){
body = Text("Load Failed!Click retry!");
}
else if(mode == LoadStatus.canLoading){
body = Text("release to load more");
}
else{
body = Text("No more Data");
}
return Container(
height: 55.0,
child: Center(child:body),
);
},
),
controller: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child:_renderUi()
/*ListView.builder(
itemBuilder: (c, i) => Card(child: Center(child: Text(items[i]))),
itemExtent: 100.0,
itemCount: items.length,
),*/
),
);
}
}

@ -317,15 +317,18 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
child: ListView.separated( child: ListView.separated(
separatorBuilder: (context, index) => const Divider( separatorBuilder: (context, index) => const Divider(
height: 4.0, height: 4.0,
color: primaryColor, color: Colors.transparent,
), ),
//padding: EdgeInsets.all(8), //padding: EdgeInsets.all(8),
itemCount: timings.length, itemCount: timings.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: (){
AppSettings.longSuccessToast('Please click on edit button'); ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Please click on edit button'),));
//AppSettings.longSuccessToast('');
}, },
child: Card(
child: Padding( child: Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Container( child: Container(
@ -344,7 +347,7 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
style: wrapTextStyle(), style: wrapTextStyle(),
), ),
), ),
GestureDetector( /* GestureDetector(
onTap: () { onTap: () {
}, },
child: Image( child: Image(
@ -352,13 +355,14 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
width: 30, width: 30,
height: 30, height: 30,
), ),
), ),*/
textForSelectedTime(index) textForSelectedTime(index)
], ],
), ),
], ],
)), )),
), ),
),
); );
})), })),
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40), Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40),
@ -389,57 +393,31 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
); );
} }
editTimingsDialog(){ Widget renderUi() {
return Column(
return showDialog( children: [
context: context, Expanded(
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: const Text('Edit Timings'),
content: SingleChildScrollView(
child: Container(
width: double.maxFinite,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.4,
),
child: ListView.separated( child: ListView.separated(
separatorBuilder: (context, index) => const Divider( separatorBuilder: (context, index) => const Divider(
height: 4.0, height: 4.0,
color: primaryColor, color: Colors.transparent,
), ),
//padding: EdgeInsets.all(8), //padding: EdgeInsets.all(8),
itemCount: timings.length, itemCount: timings.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return GestureDetector(
padding: EdgeInsets.all(10),
child: Container(
padding: EdgeInsets.fromLTRB(8, 8, 0, 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width:
MediaQuery.of(context).size.width * .25,
child: Text(
timings[index]['name'],
style: wrapTextStyle(),
),
),
GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
showPicker( showPicker(
showSecondSelector: true, showSecondSelector: true,
accentColor: primaryColor,
okStyle: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),
cancelStyle: TextStyle(color: Colors.red,fontWeight: FontWeight.bold),
barrierDismissible: false,
blurredBackground: true,
borderRadius: 20,
disableAutoFocusToNextInput: true,
displayHeader: true,
context: context, context: context,
value: _time, value: _time,
//onChange: onTimeChanged, //onChange: onTimeChanged,
@ -459,55 +437,8 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
), ),
); );
}, },
child: Image( child: Card(
image: AssetImage('images/time.png'), child: Padding(
width: 30,
height: 30,
),
),
textForSelectedTime(index)
],
),
],
)),
);
})
),
]),
)),
actions: <Widget>[
TextButton(
child: Text('Cancel', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text('Save', style: textButtonStyle()),
onPressed: () async {
},
),
],
);
});
},
);
}
Widget renderUi() {
return Column(
children: [
Expanded(
child: ListView.separated(
separatorBuilder: (context, index) => const Divider(
height: 4.0,
color: primaryColor,
),
//padding: EdgeInsets.all(8),
itemCount: timings.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Container( child: Container(
padding: EdgeInsets.fromLTRB(8, 8, 0, 0), padding: EdgeInsets.fromLTRB(8, 8, 0, 0),
@ -525,41 +456,18 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
style: wrapTextStyle(), style: wrapTextStyle(),
), ),
), ),
GestureDetector( Image(
onTap: () {
Navigator.of(context).push(
showPicker(
showSecondSelector: true,
context: context,
value: _time,
//onChange: onTimeChanged,
onChange: (val) {
onTimeChanged(val, index);
},
is24HrFormat: false,
sunrise: TimeOfDay(
hour: 6, minute: 0), // optional
sunset: TimeOfDay(hour: 18, minute: 0),
minuteInterval: TimePickerInterval.FIVE,
// Optional onChange to receive value as DateTime
onChangeDateTime: (DateTime dateTime) {
_selectedDateWithTime(dateTime,index);
},
),
);
},
child: Image(
image: AssetImage('images/time.png'), image: AssetImage('images/time.png'),
width: 30, width: 30,
height: 30, height: 30,
), ),
),
textForSelectedTime(index) textForSelectedTime(index)
], ],
), ),
], ],
)), )),
),
),
); );
})), })),
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40), Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40),

@ -0,0 +1,345 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/zoom_image.dart';
import 'package:healthcare_user/models/cart_items_model.dart';
import 'package:healthcare_user/models/get_all_offers_model.dart';
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
import 'package:healthcare_user/models/get_offer_details_model.dart';
import 'package:healthcare_user/my_connections/add-doctor.dart';
import 'package:healthcare_user/orders/cart-items.dart';
import '../models/get_all_quotations.dart';
class CartItems extends StatefulWidget {
var myObject;
CartItems({this.myObject});
@override
State<CartItems> createState() => _CartItemsState();
}
class _CartItemsState extends State<CartItems>
with TickerProviderStateMixin {
late TabController _controller;
bool isDataLoading = false;
bool isOffersLoading = false;
bool isSereverIssue = false;
String bookingId='';
String totalCartPrice='';
String totalCartPriceAfterDiscount='';
final List<Tab> topTabs = <Tab>[
Tab(
child: Text(
'Pending',
style: TextStyle(fontSize: 14),
)),
Tab(
child: Text(
'Completed',
style: TextStyle(fontSize: 14),
)),
];
List<CartItemsModel> cartItemsList = [];
@override
void initState() {
_controller = TabController(vsync: this, length: topTabs.length);
getAllCartItems();
super.initState();
}
Future<void> getAllCartItems() async {
isDataLoading = true;
try {
var payload = new Map<String, dynamic>();
payload["pharmacyId"] = widget.myObject.pharmacyId;
payload["customerId"] =AppSettings.customerId;
var response = await AppSettings.getAllCartItems(widget.myObject.bookingId,payload);
setState(() {
cartItemsList =
((jsonDecode(response)['data'][0]['items']) as List).map((dynamic model) {
return CartItemsModel.fromJson(model);
}).toList();
cartItemsList = cartItemsList.reversed.toList();
bookingId=jsonDecode(response)['data'][0]['bookingId'];
totalCartPrice=jsonDecode(response)['data'][0]['totalCartPrice'].toString();
totalCartPriceAfterDiscount=jsonDecode(response)['data'][0]['totalCartPriceAfterDiscount'].toString();
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
Widget _cartItems() {
if (cartItemsList.length != 0) {
return Column(
children: [
Expanded(child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: cartItemsList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () async{
},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Medicine Name',
style: labelTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
'Quantity',
style: labelTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
'Price',
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(
width: MediaQuery.of(context).size.width * .01,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
cartItemsList[index]
.medicine_name
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
cartItemsList[index].quantity,
style: valuesTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
cartItemsList[index]
.price
,
style: valuesTextStyle(),
),
],
),
],
),
],
)),
),
);
})),
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 {
},
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Total cart price: $totalCartPrice'),
Text('Total cart price after discount: $totalCartPriceAfterDiscount'),
],
),
)),
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 {
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
var payload = new Map<String, dynamic>();
payload["user"] = {"profile": {"firstName": AppSettings.userName.toString(),
"lastName": '',
"contactNumber": AppSettings.phoneNumber.toString(),
"address1": AppSettings.userAddress.toString(),
"address2": AppSettings.detailedAddress.toString(),
"country": ''
},};
payload["pharmacies"] = [
{
"pharmacyId": widget.myObject.pharmacyId.toString(),
"pharmacyname": widget.myObject.pharmacyName.toString(),
"phone":widget.myObject.pharmacyContactNumber.toString(),
"profile": "?"
}
];
payload["prescriptionPicture"] =
{
"pictureUrl": [
"string"
]
};
payload["amount"] =
{
"biddingAmount": totalCartPriceAfterDiscount!='null'?int.parse(totalCartPriceAfterDiscount):0,
"totalAmount": totalCartPrice!='null'?int.parse(totalCartPrice):0,
"discountAmount":0,
};
bool orderStatus = await AppSettings.orderNow(payload,widget.myObject.bookingId);
try {
if(orderStatus){
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("order placed successfully");
}
else{
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("failed to order");
}
} catch (exception) {
print(exception);
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("failed to order");
}
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast(
"Please check your internet");
}
},
child: Text('Order now'),
)),
],
);
} 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 Cart items found'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () async {},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Cart Items'),
backgroundColor: primaryColor,
),
body: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: isDataLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: _cartItems(),
),
),
);
}
}

@ -0,0 +1,805 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/zoom_image.dart';
import 'package:healthcare_user/models/get_all_offers_model.dart';
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
import 'package:healthcare_user/models/get_offer_details_model.dart';
import 'package:healthcare_user/my_connections/add-doctor.dart';
import 'package:healthcare_user/orders/cart-items.dart';
import '../models/get_all_quotations.dart';
class AllQuotations extends StatefulWidget {
const AllQuotations({Key? key}) : super(key: key);
@override
State<AllQuotations> createState() => _AllQuotationsState();
}
class _AllQuotationsState extends State<AllQuotations>
with TickerProviderStateMixin {
late TabController _controller;
bool isDataLoading = false;
bool isOffersLoading = false;
bool isSereverIssue = false;
final List<Tab> topTabs = <Tab>[
Tab(
child: Text(
'Pending',
style: TextStyle(fontSize: 14),
)),
Tab(
child: Text(
'Completed',
style: TextStyle(fontSize: 14),
)),
];
List<GetAllQuotationsModel> quotationsListOriginal = [];
List<GetAllOffersModel> offersListOriginal = [];
List<GetOffersDetailsModel> offersList = [];
List pharmaciesCheckboxes = [];
List pharmaciesCheckboxesInDialog = [];
List selectedPharmacies = [];
@override
void initState() {
_controller = TabController(vsync: this, length: topTabs.length);
getAllQuotations();
super.initState();
}
Future<void> getAllQuotations() async {
isDataLoading = true;
try {
var response = await AppSettings.getAllQuotations();
setState(() {
quotationsListOriginal =
((jsonDecode(response)['data']) as List).map((dynamic model) {
return GetAllQuotationsModel.fromJson(model);
}).toList();
quotationsListOriginal = quotationsListOriginal.reversed.toList();
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getAllOffers(pharmacyId) async {
isOffersLoading = true;
try {
var response = await AppSettings.getAllOffersUnderPharmacy(pharmacyId);
setState(() {
offersListOriginal =
((jsonDecode(response)['data']) as List).map((dynamic model) {
return GetAllOffersModel.fromJson(model);
}).toList();
offersListOriginal = offersListOriginal.reversed.toList();
isOffersLoading = false;
});
} catch (e) {
setState(() {
isOffersLoading = false;
isSereverIssue = true;
});
}
}
Widget _pendingQuotations() {
if (quotationsListOriginal.length != 0) {
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: quotationsListOriginal.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () async{
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartItems(myObject: quotationsListOriginal[index],)),
);
},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Booking Id',
style: labelTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
'Pharmacy Name',
style: labelTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
'Pharmacy ContactNumber',
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(
width: MediaQuery.of(context).size.width * .01,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
quotationsListOriginal[index]
.bookingId
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
quotationsListOriginal[index].pharmacyName,
style: valuesTextStyle(),
),
SizedBox(
height:
MediaQuery.of(context).size.height * .01,
),
Text(
quotationsListOriginal[index]
.pharmacyContactNumber,
style: valuesTextStyle(),
),
],
),
],
),
/*ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
await getAllOffers(quotationsListOriginal[index]
.pharmacyId
.toString());
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
child: isOffersLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: _offersData(),
);
});
},
child: Text('Check Offers'),
),*/
],
)),
),
);
});
} 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 pending quotations'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () async {},
),
)
],
),
));
}
}
Widget _offers() {
if (offersListOriginal.length != 0) {
return ListView.builder(
padding: EdgeInsets.all(10),
itemCount: offersListOriginal.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Booking Id',
style: labelTextStyle(),
),
/*
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Specialization',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Qualification',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Hospital',
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,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
offersListOriginal[index]
.description
.toString()
.toUpperCase(),
style: valuesTextStyle()),
/* SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
quotationsListOriginal[index].specialization,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
quotationsListOriginal[index].qualification,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
quotationsListOriginal[index].hospital_name,
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 pending quotations'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () async {},
),
)
],
),
));
}
}
Widget _offersData() {
if (offersListOriginal.length != 0) {
return Container(
color: Colors.white60,
child: Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Expanded(
child: GridView.builder(
itemCount: offersListOriginal.length,
itemBuilder: (context, index) {
return Card(
color: Colors.white,
elevation: 3.0,
child: CheckboxListTile(
title: Padding(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [
Expanded(
child: GestureDetector(
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) =>
new ImageZoomPage(
imageName: 'Reports',
imageDetails:
offersListOriginal[
index]
.picture)));
},
child: Container(
width: MediaQuery.of(context).size.width *
.18,
height:
MediaQuery.of(context).size.height *
.10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: offersListOriginal[index]
.picture ==
''
? AssetImage(
"images/logo.png")
: NetworkImage(
offersListOriginal[
index]
.picture)
as ImageProvider, // picked file
fit: BoxFit.contain)),
),
),
),
],
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
//width: MediaQuery.of(context).size.width * .70,
child: Row(
children: [
Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'Name',
style: labelTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
'Code',
style: labelTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
'Description',
style: labelTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
'Category',
style: labelTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
'Start Date',
style: labelTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
'End 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(
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,
),
Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
offersListOriginal[index]
.name
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
offersListOriginal[index].code,
style: valuesTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
offersListOriginal[index].description,
style: valuesTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
offersListOriginal[index].category,
style: valuesTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
offersListOriginal[index].startDate,
style: valuesTextStyle(),
),
SizedBox(
height: MediaQuery.of(context)
.size
.height *
.01,
),
Text(
offersListOriginal[index].endDate,
style: valuesTextStyle(),
),
],
),
],
),
),
),
],
)),
checkColor: Colors.white,
activeColor: primaryColor,
value: offersListOriginal[index].isChecked,
onChanged: (val) {
setState(
() {
offersListOriginal[index].isChecked = val!;
},
);
/*if (offersListOriginal[index].isChecked) {
pharmaciesCheckboxes.add({
'pharmacyId': offersListOriginal[index].pharmacy_id,
});
selectedPharmacies.add(offersListOriginal[index]);
} else {
pharmaciesCheckboxes.removeWhere((e) =>
e['pharmacyId'].toString().toUpperCase() ==
offersListOriginal[index]
.pharmacy_id
.toString()
.toUpperCase());
selectedPharmacies.remove(offersListOriginal[index]);
}*/
},
),
);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1, //.size.width * .33,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 5)),
),
),
]),
);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: isSereverIssue
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage('images/serverissue.png'),
// height: MediaQuery.of(context).size.height * .10,
),
SizedBox(
height: 20,
),
Text(
'There is an issue at server please try after some time',
style: serverIssueTextStyle(),
),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/*Image(
image: AssetImage('images/resourceblue.pngs'),
// height: MediaQuery.of(context).size.height * .10,
),*/
Icon(
Icons.info,
color: primaryColor,
size: 40,
),
SizedBox(
height: 20,
),
Text(
'No offers available',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
),
),
],
)));
}
}
Widget _pharmacies() {
return Container();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('All Quotations'),
backgroundColor: primaryColor,
bottom: TabBar(
controller: _controller,
tabs: topTabs,
indicatorColor: buttonColors,
unselectedLabelColor: Colors.white60,
indicatorWeight: 2,
),
),
body: Container(
child: TabBarView(controller: _controller, children: [
Padding(
padding: EdgeInsets.all(10),
child: isDataLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: _pendingQuotations(),
),
Padding(
padding: EdgeInsets.all(10),
)
]),
),
);
}
}

@ -0,0 +1,271 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'dart:async';
import 'package:permission_handler/permission_handler.dart';
import 'package:agora_rtc_engine/rtc_engine.dart';
import 'package:agora_rtc_engine/rtc_engine.dart' as rtc_engine;
import 'package:agora_rtc_engine/rtc_local_view.dart' as rtc_local_view;
import 'package:agora_rtc_engine/rtc_remote_view.dart' as rtc_remote_view;
class CallPage extends StatefulWidget {
final String? channelName;
final ClientRole? role;
const CallPage({Key? key, this.channelName, this.role}) : super(key: key);
@override
State<CallPage> createState() => _CallPageState();
}
class _CallPageState extends State<CallPage> {
final _users = <int>[];
final _infoString = <String>[];
late RtcEngine _engine;
bool muted = false; // Define the muted variable
bool viewPanel = true;
@override
void initState() {
super.initState();
initialize();
}
@override
void dispose() {
_users.clear();
_engine.leaveChannel();
_engine.destroy();
super.dispose();
}
Future<void> initialize() async {
if (appId.isEmpty) {
setState(() {
_infoString.add('AppId is missing please provide AppId');
_infoString.add('Agora Engine is not starting');
});
return;
}
_engine = await rtc_engine.RtcEngine.create(appId);
await _engine.enableVideo();
await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
await _engine.setClientRole(widget.role!);
_addAgoraEventHandler();
VideoEncoderConfiguration configuration = VideoEncoderConfiguration(
dimensions: VideoDimensions(width: 1920, height: 1080),
);
await _engine.setVideoEncoderConfiguration(configuration);
await _engine.joinChannel(token, widget.channelName!, null, 0);
}
void _addAgoraEventHandler() {
_engine.setEventHandler(
rtc_engine.RtcEngineEventHandler(
error: (code) {
setState(() {
final info = 'Error: $code';
_infoString.add(info);
});
},
joinChannelSuccess: (channel, uid, elapsed) {
setState(() {
final info = 'Join Channel: $channel, uid:$uid';
_infoString.add(info);
});
},
leaveChannel: (stats) {
setState(() {
_infoString.add('Leave Channel');
_users.clear();
});
},
userJoined: (uid, elapsed) {
setState(() {
final info = 'User joined: $uid';
_infoString.add(info);
_users.add(uid);
});
},
userOffline: (uid, elapsed) {
setState(() {
final info = 'User Offline: $uid';
_infoString.add(info);
_users.remove(uid);
});
},
firstRemoteVideoFrame: (uid, width, height, elapsed) {
setState(() {
final info = 'First Remote Video: $uid $width*$height';
_infoString.add(info);
_users.remove(uid);
});
},
),
);
}
Widget _viewRows() {
final List<StatefulWidget> list = [];
if (widget.role == ClientRole.Broadcaster) {
list.add(const rtc_local_view.SurfaceView());
}
for (var uid in _users) {
list.add(rtc_remote_view.SurfaceView(
uid: uid,
channelId: widget.channelName!,
));
}
final views=list;
return Column(
children: List.generate(
views.length,
(index) => Expanded(
child: views[index],
),
),
);
}
Widget _toolbar() {
if (widget.role == ClientRole.Audience) return SizedBox();
return Container(
alignment: Alignment.bottomCenter,
padding: const EdgeInsets.symmetric(vertical: 48),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RawMaterialButton(
onPressed: () {
setState(() {
muted = !muted;
});
_engine.muteLocalAudioStream(muted);
},
child: Icon(
muted ? Icons.mic_off : Icons.mic,
color: muted ? Colors.white : Colors.blueAccent,
size: 20.0,
),
shape: CircleBorder(),
elevation: 2.0,
fillColor: muted ? Colors.blueAccent : Colors.white,
padding: EdgeInsets.all(12.0),
),
RawMaterialButton(
onPressed: () => Navigator.pop(context),
child: Icon(
Icons.call_end,
color: Colors.white,
size: 35.0,
),
shape: CircleBorder(),
elevation: 2.0,
fillColor: Colors.redAccent,
padding: EdgeInsets.all(15.0),
),
RawMaterialButton(
onPressed: () {
_engine.switchCamera();
},
child: Icon(
Icons.switch_camera,
color: Colors.blueAccent,
size: 20.0,
),
shape: CircleBorder(),
elevation: 2.0,
fillColor: Colors.white,
padding: EdgeInsets.all(12.0),
),
],
),
);
}
Widget _panel()
{
return Visibility(
visible: viewPanel,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 48),
alignment: Alignment.bottomCenter,
child: FractionallySizedBox(
heightFactor: 0.5,
child: Container(
padding: EdgeInsets.symmetric(vertical: 48),
child: ListView.builder(
reverse: true,
itemCount: _infoString.length,
itemBuilder:(BuildContext context,int index)
{
if(_infoString.isEmpty)
{
return const Text("null");
}
return Padding(
padding: const EdgeInsets.symmetric(vertical: 3,horizontal: 10),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5)
),
child: Text(
_infoString[index],
style: const TextStyle(color:Colors.blueGrey),
),
),
)
],
),
);
},
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("VideoCall"),
centerTitle: true,
actions: [
IconButton(onPressed:()
{
setState(() {
viewPanel=!viewPanel;
});
}, icon: const Icon(Icons.ice_skating))
],
),
backgroundColor: Colors.black,
body: Center(
child: Stack(
children: <Widget>[
_viewRows(),
_panel(),
_toolbar(),
]
),
),
);
}
}

@ -0,0 +1,120 @@
import 'package:agora_rtc_engine/rtc_engine.dart';
import 'package:flutter/material.dart';
import 'package:async/async.dart';
import 'dart:developer';
import 'package:permission_handler/permission_handler.dart';
import './call.dart';
import 'package:flutter/material.dart' hide Size;
import 'dart:ui' as ui;
class IndexPage extends StatefulWidget {
const IndexPage({Key? key}) : super(key: key);
@override
State<IndexPage> createState() => _IndexPageState();
}
class _IndexPageState extends State<IndexPage> {
TextEditingController _channelController = TextEditingController(text: 'call');
bool _validateError=false;
ClientRole? _role= ClientRole.Broadcaster;
@override
void dispose() {
_channelController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("VideoCall"),
centerTitle: true,
),
body: SingleChildScrollView(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
children:<Widget> [
const SizedBox(height: 20),
const SizedBox(height: 20),
TextField(
controller: _channelController,
decoration: InputDecoration(
errorText: _validateError ? 'Chanel Name is Mondatory' : null,
border: UnderlineInputBorder(borderSide: BorderSide(width: 1),),
hintText: 'channel name',
),
),
RadioListTile(
title: const Text('Broadcaster'),
onChanged: (ClientRole? value)
{
setState(() {
_role=value;
});
},
value: ClientRole.Broadcaster,
groupValue: _role,
),
RadioListTile(
title: const Text('Audience'),
onChanged: (ClientRole? value)
{
setState(() {
_role=value;
});
},
value: ClientRole.Audience,
groupValue: _role,
),
ElevatedButton(
onPressed: onjoin,
child: const Text('Join'),
style: ElevatedButton.styleFrom(
minimumSize: const ui.Size(double.infinity, 40),
),
)
],
),
),
),
);
}
Future<void> onjoin() async {
setState(() {
_channelController.text.isEmpty
? _validateError=true:
_validateError=false; // This line doesn't actually update any state
});
if(_channelController.text.isNotEmpty)
{
await _handlecameraAndMic(Permission.camera);
await _handlecameraAndMic(Permission.microphone);
await Navigator.push(
context,
MaterialPageRoute(
builder: (__) => CallPage(
channelName: _channelController.text, // Passes the text from _channelController as channelName
role: _role, // Passes the value of _role as role
),
),
);
}
}
Future <void> _handlecameraAndMic(Permission permission) async
{
final status=await permission.request();
log(status.toString());
}
}

@ -545,6 +545,7 @@ class _PrescriptionsState extends State<Prescriptions> {
)); ));
} }
} }
showPicDialog(var imageUrl){ showPicDialog(var imageUrl){
return showDialog( return showDialog(
context: context, context: context,

File diff suppressed because it is too large Load Diff

@ -42,6 +42,8 @@ class _ReportMySelfState extends State<ReportMySelf> {
String recordingTime = '0:0'; // to store value String recordingTime = '0:0'; // to store value
bool isRecording = false; bool isRecording = false;
String problemPictureUrl=''; String problemPictureUrl='';
DateTime now=DateTime.now();
String formattedDate = '';
void initializer() async { void initializer() async {
pathToAudio = '/sdcard/Download/temp.wav'; pathToAudio = '/sdcard/Download/temp.wav';
@ -58,9 +60,17 @@ class _ReportMySelfState extends State<ReportMySelf> {
await Permission.manageExternalStorage.request(); await Permission.manageExternalStorage.request();
} }
void initialDate(){
setState(() {
formattedDate=DateFormat('dd-MM-yyyy').format(now);
});
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
initialDate();
dateInput.text=formattedDate;
_controller = VideoPlayerController.networkUrl( _controller = VideoPlayerController.networkUrl(
Uri.parse(videoUrl,), Uri.parse(videoUrl,),
); );
@ -287,7 +297,7 @@ class _ReportMySelfState extends State<ReportMySelf> {
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: primaryColor),
), ),
labelText: 'Enter problem name', labelText: 'Enter problem (if any)',
labelStyle: TextStyle( labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
@ -769,7 +779,7 @@ class _ReportMySelfState extends State<ReportMySelf> {
}, },
child: const Text('Report a problem'), child: const Text('Save this in report my self'),
)), )),

@ -30,6 +30,8 @@ class _UpdateMyLocationState extends State<UpdateMyLocation> {
final GoogleMapsFlutterPlatform mapsImplementation = GoogleMapsFlutterPlatform.instance; final GoogleMapsFlutterPlatform mapsImplementation = GoogleMapsFlutterPlatform.instance;
double lat=0; double lat=0;
double lng=0; double lng=0;
String address='';
TextEditingController userAddressDescriptionController = TextEditingController();
void initRenderer() { void initRenderer() {
if (_mapsInitialized) return; if (_mapsInitialized) return;
@ -50,6 +52,14 @@ class _UpdateMyLocationState extends State<UpdateMyLocation> {
}); });
} }
@override
void initState() {
address=AppSettings.userAddress;
userAddressDescriptionController.text=AppSettings.detailedAddress;
lat=AppSettings.userLatitude;
lng=AppSettings.userLongitude;
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -58,28 +68,20 @@ class _UpdateMyLocationState extends State<UpdateMyLocation> {
body: Padding( body: Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Column( child: Column(
children: [ children: [
Row( Row(
children: [ children: [
Text('Current Location :',style: labelTextStyle(),), Text('Current Location :',style: labelTextStyle(),),
SizedBox(width:MediaQuery.of(context).size.width * .02,), SizedBox(width:MediaQuery.of(context).size.width * .02,),
Expanded(child: Text(AppSettings.userAddress,style:valuesTextStyle(),)) Expanded(child: Text(address,style:valuesTextStyle(),))
], ],
), ),
SizedBox(height:MediaQuery.of(context).size.height * .04,), Align(
Container( alignment: Alignment.bottomRight,
width:double.infinity, child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0),
height: MediaQuery.of(context).size.height * .05, child: TextButton(
child: ElevatedButton( onPressed: () {
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async{
//=============================================================================================
location.serviceEnabled().then((value) { location.serviceEnabled().then((value) {
if (value) { if (value) {
initRenderer(); initRenderer();
@ -110,36 +112,16 @@ class _UpdateMyLocationState extends State<UpdateMyLocation> {
lng=selectedPlace!.geometry!.location.lng; lng=selectedPlace!.geometry!.location.lng;
/*if(selectedPlace!.types!.length==1){
userAddressCapturingController.text =
selectedPlace!.formattedAddress!;
}
else{
userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!;
}*/
Navigator.of(context).pop();
});
var payload = new Map<String, dynamic>();
payload["latitude"] = lat;
payload["longitude"] = lng;
bool updateStatus = await AppSettings.updateLocation(payload);
if(updateStatus){
setState(() {
if(selectedPlace!.types!.length==1){ if(selectedPlace!.types!.length==1){
AppSettings.userAddress = address =
selectedPlace!.formattedAddress!; selectedPlace!.formattedAddress!;
} }
else{ else{
AppSettings.userAddress=selectedPlace!.name!+', '+selectedPlace!.formattedAddress!; address =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!;
} }
Navigator.of(context).pop();
}); });
}
else{
AppSettings.longFailedToast(
"Failed to update location");
}
}, },
onMapTypeChanged: (MapType mapType) {}, onMapTypeChanged: (MapType mapType) {},
@ -196,6 +178,54 @@ class _UpdateMyLocationState extends State<UpdateMyLocation> {
); );
} }
}); });
},
child: const Text(
'Change',
style: TextStyle(
color: primaryColor,
decoration: TextDecoration.underline,
),
),
),),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: userAddressDescriptionController,
keyboardType: TextInputType.emailAddress,
decoration: textFormFieldDecorationGrey(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .04,),
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{
var payload = new Map<String, dynamic>();
payload["latitude"] = lat;
payload["longitude"] = lng;
payload["address1"] = address;
payload["address2"] = userAddressDescriptionController.text;
bool updateStatus = await AppSettings.updateLocation(payload);
if(updateStatus){
AppSettings.longSuccessToast("Location Updated");
}
else{
AppSettings.longFailedToast("Failed to update location");
}
}, },
child: const Text('Update My Location'), child: const Text('Update My Location'),

@ -9,11 +9,195 @@ class UpdatePin extends StatefulWidget {
} }
class _UpdatePinState extends State<UpdatePin> { class _UpdatePinState extends State<UpdatePin> {
bool isOldPinObscureText=true;
bool isConfirmObscureText=true;
bool isNewPinObscureText=true;
TextEditingController oldPinController = TextEditingController();
TextEditingController newPinController = TextEditingController();
TextEditingController confirmPinController = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppSettings.appBar('Update Pin'), appBar: AppSettings.appBar('Update Pin'),
body: Container(), body: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: [
Container(
child: TextFormField(
cursorColor: greyColor,
obscureText: isOldPinObscureText,
controller: oldPinController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Enter old pin',
prefixIcon: const Icon(
Icons.lock,
color: greyColor,
),
labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isOldPinObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
isOldPinObscureText = !isOldPinObscureText;
});
},
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
child: TextFormField(
cursorColor: greyColor,
obscureText: isNewPinObscureText,
controller: newPinController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Enter new pin',
prefixIcon: const Icon(
Icons.lock,
color: greyColor,
),
labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isNewPinObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
isNewPinObscureText = !isNewPinObscureText;
});
},
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
child: TextFormField(
cursorColor: greyColor,
obscureText: isConfirmObscureText,
controller: confirmPinController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Confirm pin',
prefixIcon: const Icon(
Icons.lock,
color: greyColor,
),
labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isConfirmObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
isConfirmObscureText = !isConfirmObscureText;
});
},
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .04,),
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(oldPinController.text!=''&&newPinController.text!=''&&confirmPinController.text!=''){
if(newPinController.text==confirmPinController.text){
var payload = new Map<String, dynamic>();
payload["oldPassword"] = oldPinController.text.toString();
payload["newPassword"] = newPinController.text.toString();
payload["phone"] = AppSettings.phoneNumber;
payload["longitude"] = AppSettings.userLongitude;
payload["latitude"] = AppSettings.userLatitude;
bool updateStatus = await AppSettings.updatePin(payload);
try{
if (updateStatus) {
//Navigator.pop(context);
/*Navigator.push(
context,
MaterialPageRoute(builder: (context) => Dashboard()),
);*/
oldPinController.clear();
newPinController.clear();
confirmPinController.clear();
AppSettings.longSuccessToast("Password updated");
} else {
AppSettings.longFailedToast("Password not updated");
}
}
catch(exception){
print(exception);
AppSettings.longFailedToast("Password not updated");
}
}
else{
AppSettings.longFailedToast('Please check new pin and confirm pin');
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: const Text('Update Pin'),
)),
],
),
),
); );
} }

@ -5,6 +5,7 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
import agora_rtc_engine
import assets_audio_player import assets_audio_player
import assets_audio_player_web import assets_audio_player_web
import cloud_firestore import cloud_firestore
@ -12,6 +13,7 @@ import device_info_plus_macos
import file_selector_macos import file_selector_macos
import firebase_core import firebase_core
import firebase_messaging import firebase_messaging
import firebase_storage
import flutter_local_notifications import flutter_local_notifications
import geolocator_apple import geolocator_apple
import location import location
@ -22,6 +24,7 @@ import url_launcher_macos
import wakelock_macos import wakelock_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AgoraRtcEnginePlugin.register(with: registry.registrar(forPlugin: "AgoraRtcEnginePlugin"))
AssetsAudioPlayerPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerPlugin")) AssetsAudioPlayerPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerPlugin"))
AssetsAudioPlayerWebPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerWebPlugin")) AssetsAudioPlayerWebPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerWebPlugin"))
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
@ -29,6 +32,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin")) FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))

@ -7,7 +7,14 @@ packages:
name: _flutterfire_internals name: _flutterfire_internals
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.6" version: "1.3.16"
agora_rtc_engine:
dependency: "direct main"
description:
name: agora_rtc_engine
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.1"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -119,21 +126,21 @@ packages:
name: cloud_firestore name: cloud_firestore
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.9.2" version: "4.14.0"
cloud_firestore_platform_interface: cloud_firestore_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: cloud_firestore_platform_interface name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.16.1" version: "6.1.0"
cloud_firestore_web: cloud_firestore_web:
dependency: transitive dependency: transitive
description: description:
name: cloud_firestore_web name: cloud_firestore_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.7.1" version: "3.9.0"
cloudinary_public: cloudinary_public:
dependency: "direct main" dependency: "direct main"
description: description:
@ -317,47 +324,68 @@ packages:
source: hosted source: hosted
version: "0.9.3" version: "0.9.3"
firebase_core: firebase_core:
dependency: transitive dependency: "direct main"
description: description:
name: firebase_core name: firebase_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.16.0" version: "2.24.2"
firebase_core_platform_interface: firebase_core_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: firebase_core_platform_interface name: firebase_core_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.8.0" version: "5.0.0"
firebase_core_web: firebase_core_web:
dependency: transitive dependency: transitive
description: description:
name: firebase_core_web name: firebase_core_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.0" version: "2.10.0"
firebase_messaging: firebase_messaging:
dependency: "direct main" dependency: "direct main"
description: description:
name: firebase_messaging name: firebase_messaging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "14.6.8" version: "14.7.10"
firebase_messaging_platform_interface: firebase_messaging_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: firebase_messaging_platform_interface name: firebase_messaging_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.5.7" version: "4.5.18"
firebase_messaging_web: firebase_messaging_web:
dependency: transitive dependency: transitive
description: description:
name: firebase_messaging_web name: firebase_messaging_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.5.7" version: "3.5.18"
firebase_storage:
dependency: "direct main"
description:
name: firebase_storage
url: "https://pub.dartlang.org"
source: hosted
version: "11.6.0"
firebase_storage_platform_interface:
dependency: transitive
description:
name: firebase_storage_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.3"
firebase_storage_web:
dependency: transitive
description:
name: firebase_storage_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.17"
flick_video_player: flick_video_player:
dependency: "direct main" dependency: "direct main"
description: description:
@ -370,6 +398,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" 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: flutter_cupertino_datetime_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@ -447,6 +482,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
flutter_share:
dependency: "direct main"
description:
name: flutter_share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_slidable: flutter_slidable:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1045,6 +1087,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.5" version: "6.0.5"
pull_to_refresh:
dependency: "direct main"
description:
name: pull_to_refresh
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
qr:
dependency: transitive
description:
name: qr
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
qr_code_scanner:
dependency: "direct main"
description:
name: qr_code_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
qr_flutter:
dependency: "direct main"
description:
name: qr_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
recase: recase:
dependency: transitive dependency: transitive
description: description:
@ -1066,6 +1136,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:

@ -35,7 +35,6 @@ dependencies:
card_swiper: ^2.0.4 card_swiper: ^2.0.4
firebase_messaging: ^14.4.1 firebase_messaging: ^14.4.1
flutter_local_notifications: ^9.0.2 flutter_local_notifications: ^9.0.2
cloud_firestore: ^4.5.2
flutter_device_type: ^0.4.0 flutter_device_type: ^0.4.0
device_information: ^0.0.4 device_information: ^0.0.4
device_info_plus: ^3.2.4 device_info_plus: ^3.2.4
@ -61,6 +60,17 @@ dependencies:
assets_audio_player: ^3.0.3+3 assets_audio_player: ^3.0.3+3
path: ^1.8.0 path: ^1.8.0
visibility_detector: ^0.4.0+2 visibility_detector: ^0.4.0+2
flutter_share: ^2.0.0
share: ^2.0.4
qr_flutter: ^4.0.0
qr_code_scanner: ^1.0.1
flutter_barcode_scanner: ^2.0.0
pull_to_refresh: ^2.0.0
cloud_firestore:
firebase_storage:
firebase_core: ^2.24.2
agora_rtc_engine: ^5.3.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -6,17 +6,26 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <agora_rtc_engine/agora_rtc_engine_plugin.h>
#include <cloud_firestore/cloud_firestore_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h> #include <file_selector_windows/file_selector_windows.h>
#include <firebase_core/firebase_core_plugin_c_api.h> #include <firebase_core/firebase_core_plugin_c_api.h>
#include <firebase_storage/firebase_storage_plugin_c_api.h>
#include <geolocator_windows/geolocator_windows.h> #include <geolocator_windows/geolocator_windows.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
AgoraRtcEnginePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin"));
CloudFirestorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("CloudFirestorePluginCApi"));
FileSelectorWindowsRegisterWithRegistrar( FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows")); registry->GetRegistrarForPlugin("FileSelectorWindows"));
FirebaseCorePluginCApiRegisterWithRegistrar( FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
FirebaseStoragePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseStoragePluginCApi"));
GeolocatorWindowsRegisterWithRegistrar( GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows")); registry->GetRegistrarForPlugin("GeolocatorWindows"));
PermissionHandlerWindowsPluginRegisterWithRegistrar( PermissionHandlerWindowsPluginRegisterWithRegistrar(

@ -3,8 +3,11 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
agora_rtc_engine
cloud_firestore
file_selector_windows file_selector_windows
firebase_core firebase_core
firebase_storage
geolocator_windows geolocator_windows
permission_handler_windows permission_handler_windows
url_launcher_windows url_launcher_windows

Loading…
Cancel
Save