diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 18d328f..dfc92aa 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -12,7 +12,9 @@
+
diff --git a/images/bmi.png b/images/bmi.png
new file mode 100644
index 0000000..5de861a
Binary files /dev/null and b/images/bmi.png differ
diff --git a/images/happy.png b/images/happy.png
new file mode 100644
index 0000000..124f898
Binary files /dev/null and b/images/happy.png differ
diff --git a/images/invitations.png b/images/invitations.png
index 5194f24..a548288 100644
Binary files a/images/invitations.png and b/images/invitations.png differ
diff --git a/images/myconnections.png b/images/myconnections.png
index 51fa9eb..00d4f80 100644
Binary files a/images/myconnections.png and b/images/myconnections.png differ
diff --git a/images/ok.png b/images/ok.png
new file mode 100644
index 0000000..57c4819
Binary files /dev/null and b/images/ok.png differ
diff --git a/images/sad.png b/images/sad.png
new file mode 100644
index 0000000..2f97b0f
Binary files /dev/null and b/images/sad.png differ
diff --git a/lib/BMI/bmi_caluculator.dart b/lib/BMI/bmi_caluculator.dart
index bf81b8d..cc1d7e4 100644
--- a/lib/BMI/bmi_caluculator.dart
+++ b/lib/BMI/bmi_caluculator.dart
@@ -1,5 +1,5 @@
import 'dart:convert';
-
+import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:healthcare_user/BMI/bmi_history.dart';
import 'package:healthcare_user/common/settings.dart';
@@ -14,21 +14,30 @@ class BMICalculator extends StatefulWidget {
class _BMICalculatorState extends State {
TextEditingController heightController = TextEditingController();
+ TextEditingController inchesController = TextEditingController();
+ TextEditingController cmsController = TextEditingController();
TextEditingController weightController = TextEditingController();
TextEditingController ageController = TextEditingController();
+ TextEditingController dateInput = TextEditingController();
+
String bmiValue = '';
String bmiText = '';
var heightUnitItems = [
'feet',
'cm',
- 'inches',
];
var heightUnits = 'feet';
var weightUnitItems = [
'kg',
- 'gr',
];
var weightUnits = 'kg';
+
+
+ @override
+ void initState() {
+ ageController.text=AppSettings.age;
+ super.initState();
+ }
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -45,11 +54,13 @@ class _BMICalculatorState extends State {
cursorColor: greyColor,
controller: ageController,
textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
+ suffixText: "Yrs",
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
@@ -65,7 +76,57 @@ class _BMICalculatorState extends State {
),
),
SizedBox(height: 10),
- Container(
+ DropdownButtonFormField(
+ // Initial Value
+ value: heightUnits,
+ isExpanded: true,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.ac_unit_outlined,
+ color: primaryColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Select Height units',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+
+ hint: Text('Units'),
+ // Down Arrow Icon
+ //icon: const Icon(Icons.keyboard_arrow_down),
+
+ // Array list of items
+ items: heightUnitItems.map((String items) {
+ return DropdownMenuItem(
+ value: items,
+ child: Text(
+ items,
+ style: TextStyle(
+ fontSize: 16,
+ ),
+ textAlign: TextAlign.center,
+ ));
+ }).toList(),
+ // After selecting the desired option,it will
+ // change button value to selected value
+ onChanged: (String? newValue) {
+ setState(() {
+ heightUnits = newValue!;
+ });
+ },
+ ),
+ SizedBox(height: 10),
+ Visibility(
+ visible:heightUnits=='feet',
+ child: Container(
//height: 60,
child: Row(
children: [
@@ -74,6 +135,7 @@ class _BMICalculatorState extends State {
cursorColor: greyColor,
controller: heightController,
textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
@@ -87,7 +149,7 @@ class _BMICalculatorState extends State {
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
- labelText: 'Height',
+ labelText: 'Feets',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
@@ -96,13 +158,14 @@ class _BMICalculatorState extends State {
),
SizedBox(width: 5),
Expanded(
- child: DropdownButtonFormField(
- // Initial Value
- value: heightUnits,
- isExpanded: true,
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: inchesController,
+ textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
- Icons.ac_unit_outlined,
+ Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
@@ -113,40 +176,54 @@ class _BMICalculatorState extends State {
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
- labelText: 'Units',
+ labelText: 'Inches',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
-
- hint: Text('Units'),
- // Down Arrow Icon
- //icon: const Icon(Icons.keyboard_arrow_down),
-
- // Array list of items
- items: heightUnitItems.map((String items) {
- return DropdownMenuItem(
- value: items,
- child: Text(
- items,
- style: TextStyle(
- fontSize: 16,
- ),
- textAlign: TextAlign.center,
- ));
- }).toList(),
- // After selecting the desired option,it will
- // change button value to selected value
- onChanged: (String? newValue) {
- setState(() {
- heightUnits = newValue!;
- });
- },
),
- )
+ ),
+ SizedBox(width: 5),
+
],
),
- ),
+ ),),
+ Visibility(
+ visible:heightUnits=='cm',
+ child: Container(
+ //height: 60,
+ child: Row(
+ children: [
+ Expanded(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: cmsController,
+ textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.height,
+ color: primaryColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Enter height in cms',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+ ),
+ ),
+
+ ],
+ ),
+ ),),
SizedBox(height: 10),
Container(
//height: 40,
@@ -158,6 +235,7 @@ class _BMICalculatorState extends State {
cursorColor: greyColor,
controller: weightController,
textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.line_weight_outlined,
@@ -232,48 +310,136 @@ class _BMICalculatorState extends State {
),
),
SizedBox(height: 10),
- TextButton(
- child: Text('Calculate BMI', style: textButtonStyle()),
- onPressed: () async {
- if (ageController.text != '' &&
- heightController.text != '' &&
- weightController.text != '') {
- var payload = new Map();
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: dateInput,
+ decoration: textFormFieldDecorationBMI(
+ Icons.calendar_today, 'Enter Date'),
+ readOnly: true,
+ onTap: () async {
+ DateTime? pickedDate = await showDatePicker(
+ context: context,
+ initialDate: DateTime.now(),
+ firstDate: DateTime(1950),
+ lastDate: DateTime.now(),
+ builder: (BuildContext context, Widget? child) {
+ return Theme(
+ data: ThemeData.dark().copyWith(
+ colorScheme: ColorScheme.dark(
+ primary: buttonColors,
+ onPrimary: Colors.white,
+ surface: buttonColors,
+ onSurface: Colors.white,
+ ),
+ dialogBackgroundColor: primaryColor,
+ ),
+ child: child!,
+ );
+ },
+ );
+
+ if (pickedDate != null) {
+ print(
+ pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
+ String formattedDate =
+ DateFormat('dd-MM-yyyy').format(pickedDate);
+ print(
+ formattedDate); //formatted date output using intl package => 2021-03-16
+ setState(() {
+ dateInput.text =
+ formattedDate; //set output date to TextField value.
+ });
+ } else {}
+ },
+ ),
+ ),
+ SizedBox(height: 10),
+ Container(
+ width: double.infinity,
+ height:
+ MediaQuery.of(context).size.height * .05,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: buttonColors, // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () async {
+ if (ageController.text != '' &&
+ heightController.text != '' ||cmsController.text!=''&&
+ weightController.text != ''&&dateInput.text!='') {
+
+ AppSettings.preLoaderDialog(context);
+ var payload = new Map();
+
+ if(heightUnits.toString().toLowerCase()=='feet'){
+ cmsController.text='';
+ }
+ else{
+ heightController.text='';
+ inchesController.text='';
+ }
+
+ payload["age"] = int.parse(ageController.text.toString());
+ payload["feet"] = heightController.text.toString();
+ payload["inches"] = inchesController.text.toString();
+ payload["height"] = cmsController.text.toString();
+ payload["weight"] = weightController.text.toString();
+ payload["heightUnit"] = heightUnits.toString();
+ payload["weightUnit"] = weightUnits.toString();
+ payload["date"] = dateInput.text.toString();
+
+ try{
+ var value = await AppSettings.calculateBmi(payload);
+ var valueResponse = jsonDecode(value);
+ Navigator.of(context, rootNavigator: true).pop();
+ heightController.clear();
+ cmsController.clear();
+ inchesController.clear();
+ weightController.clear();
+ dateInput.clear();
+ setState(() {
+ bmiValue = valueResponse['userDetails']['bmivalue'].toString();
+ if(double.parse(bmiValue)<18.5){
+ bmiText='Underweight';
+ }
+ else if(double.parse(bmiValue)>=18.5&&double.parse(bmiValue)<=24.9){
+ bmiText='Normal weight';
+ }
+ else if(double.parse(bmiValue)>=25&&double.parse(bmiValue)<=29.9){
+ bmiText='Overweight';
+ }
+ else if(double.parse(bmiValue)>=30){
+ bmiText='Obesity';
+ }
+
+
+ });
+
+
+
+ }
+ catch(e){
+ Navigator.of(context, rootNavigator: true).pop();
+ AppSettings.longFailedToast('Calculating BMI failed');
+ }
+
+
- payload["age"] =
- int.parse(ageController.text.toString());
- payload["height"] = heightController.text.toString();
- payload["weight"] = weightController.text.toString();
- payload["heightUnit"] = heightUnits.toString();
- payload["weightUnit"] = weightUnits.toString();
- var value = await AppSettings.calculateBmi(payload);
- var valueResponse = jsonDecode(value);
- print(valueResponse);
- setState(() {
- bmiValue = valueResponse['userDetails']['bmivalue'].toString();
- if(double.parse(bmiValue)<18.5){
- bmiText='Underweight';
- }
- else if(double.parse(bmiValue)>=18.5&&double.parse(bmiValue)<=24.9){
- bmiText='Normal weight';
- }
- else if(double.parse(bmiValue)>=25&&double.parse(bmiValue)<=29.9){
- bmiText='Overweight';
}
- else if(double.parse(bmiValue)>=30){
- bmiText='Obesity';
+ else{
+ AppSettings.longFailedToast('Please enter valid details');
}
- });
- }
- },
- ),
- SizedBox(height: 10),
+ },
+ child: const Text('Calculate BMI'),
+ )),
+ SizedBox(height: 20),
Container(
child: Row(
children: [
- Text('Your Bmi value: $bmiValue'),
+ Text('Your BMI value: $bmiValue',style: TextStyle(fontSize:15,fontWeight: FontWeight.bold),),
SizedBox(width: 10,),
- Text(bmiText,style: TextStyle(color: Colors.red)),
+ Text(bmiText,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold)),
],
)
),
diff --git a/lib/BMI/bmi_history.dart b/lib/BMI/bmi_history.dart
index a07f870..52a99b6 100644
--- a/lib/BMI/bmi_history.dart
+++ b/lib/BMI/bmi_history.dart
@@ -1,11 +1,9 @@
import 'dart:convert';
import 'package:healthcare_user/chart/bmi_chart.dart';
-import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:healthcare_user/models/bmi_history_model.dart';
import 'package:healthcare_user/common/settings.dart';
-
-import '../chart/bpchart.dart';
+import 'package:flutter_slidable/flutter_slidable.dart';
class BMIHistory extends StatefulWidget {
const BMIHistory({Key? key}) : super(key: key);
@@ -19,11 +17,12 @@ class _BMIHistoryState extends State {
List bmiHistoryList = [];
List FilteredList = [];
var dateItems = [
+ 'All',
'last 7 days',
'last one month',
'last one year',
];
- var dateItemsVariable = 'last 7 days';
+ var dateItemsVariable = 'All';
Future getBmiHistoryDetails(var selectedRange) async {
isLoading = true;
@@ -43,6 +42,7 @@ class _BMIHistoryState extends State {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
+ //reportsList=reportsListOriginal.reversed.toList();
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = bmiHistoryList.where((product) {
@@ -68,6 +68,27 @@ class _BMIHistoryState extends State {
super.initState();
}
+ deleteBmiHistory(bmiId) async{
+
+ AppSettings.preLoaderDialog(context);
+ bool status = await AppSettings.deleteBMIDetails(bmiId);
+
+ if(status){
+ Navigator.of(context, rootNavigator: true).pop();
+
+ AppSettings.longSuccessToast("BMI record deleted successfully");
+ await getBmiHistoryDetails(dateItemsVariable);
+ }
+ else{
+ Navigator.of(context, rootNavigator: true).pop();
+
+ AppSettings.longFailedToast("BMI record deletion failed");
+ }
+
+
+
+ }
+
Widget renderzUi() {
if (bmiHistoryList.length != 0) {
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
@@ -90,7 +111,7 @@ class _BMIHistoryState extends State {
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
- labelText: 'Units',
+ labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
@@ -145,113 +166,168 @@ class _BMIHistoryState extends State {
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
- return Card(
- color: Colors.white,
- child: Padding(
- padding: EdgeInsets.all(8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Container(
- width: MediaQuery.of(context).size.width * .55,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image: const AssetImage(
- 'images/height.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(
- padding: EdgeInsets.all(5),
- child: Text(
- FilteredList[index]
- .height
- .toString()
- .toUpperCase() +
- ' ft',
- style: valuesTextStyle()),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image: const AssetImage(
- 'images/weight.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(
- padding: EdgeInsets.all(5),
- child: Text(
- FilteredList[index]
- .weight
- .toString()
- .toUpperCase() +
- ' Kgs',
- style: valuesTextStyle()),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image:
- const AssetImage('images/date.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(
- padding: EdgeInsets.all(5),
- child: Text(
- FilteredList[index]
- .displayDate
- .toString()
- .toUpperCase(),
- style: valuesTextStyle()),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image: const AssetImage(
- 'images/weight.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(
- padding: EdgeInsets.all(5),
- child: Text(
- FilteredList[index]
- .bmiValue
- .toString()
- .toUpperCase(),
- style: valuesTextStyle()),
- )
- ],
- ),
- ],
+ return Slidable(
+ key: const ValueKey(0),
+ endActionPane: ActionPane(
+ // A motion is a widget used to control how the pane animates.
+ motion: ScrollMotion(),
+
+ dragDismissible: false,
+ // A pane can dismiss the Slidable.
+ dismissible: DismissiblePane(onDismissed: () {
+ deleteBmiHistory(FilteredList[index].bmiInfoId);
+ }),
+
+ // All actions are defined in the children parameter.
+ children: [
+ // A SlidableAction can have an icon and/or a label.
+ SlidableAction(
+ backgroundColor: Color(0xFFFE4A49),
+ foregroundColor: Colors.white,
+ icon: Icons.delete,
+ label: 'Delete',
+ onPressed: (BuildContext context) {
+ deleteBmiHistory(FilteredList[index].bmiInfoId);
+ },
+ ),
+ /*SlidableAction(
+ onPressed: doNothing,
+ backgroundColor: Color(0xFF21B7CA),
+ foregroundColor: Colors.white,
+ icon: Icons.share,
+ label: 'Share',
+ ),*/
+ ],
+ ),
+ child: Card(
+ color: Colors.white,
+ child: Padding(
+ padding: EdgeInsets.all(8),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width * .55,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image: const AssetImage(
+ 'images/height.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .height
+ .toString()
+ .toUpperCase() +
+ ' cms',
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image: const AssetImage(
+ 'images/weight.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .weight
+ .toString()
+ .toUpperCase() +
+ ' Kgs',
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image:
+ const AssetImage('images/date.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .actualDate
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image: const AssetImage(
+ 'images/bmi.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .bmiValue
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image: const AssetImage(
+ 'images/bmi.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index].bmiText
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ ],
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
- );
+ );
+
})),
]);
} else {
diff --git a/lib/BP/bp_calculator.dart b/lib/BP/bp_calculator.dart
index aa0e86e..4a2a512 100644
--- a/lib/BP/bp_calculator.dart
+++ b/lib/BP/bp_calculator.dart
@@ -1,9 +1,8 @@
import 'dart:convert';
-
import 'package:flutter/material.dart';
-import 'package:healthcare_user/BMI/bmi_history.dart';
import 'package:healthcare_user/BP/bp_history.dart';
import 'package:healthcare_user/common/settings.dart';
+import 'package:intl/intl.dart';
class BPCalculator extends StatefulWidget {
const BPCalculator({Key? key}) : super(key: key);
@@ -16,19 +15,10 @@ class _BPCalculatorState extends State {
TextEditingController systoloicController = TextEditingController();
TextEditingController diastolicController = TextEditingController();
+ TextEditingController dateInput = TextEditingController();
String bpValue = '';
String bpText = '';
- var heightUnitItems = [
- 'feet',
- 'cm',
- 'inches',
- ];
- var heightUnits = 'feet';
- var weightUnitItems = [
- 'kg',
- 'gr',
- ];
- var weightUnits = 'kg';
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -45,9 +35,10 @@ class _BPCalculatorState extends State {
cursorColor: greyColor,
controller: systoloicController,
textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
- Icons.person,
+ Icons.upload,
color: primaryColor,
),
border: OutlineInputBorder(
@@ -69,9 +60,10 @@ class _BPCalculatorState extends State {
cursorColor: greyColor,
controller: diastolicController,
textCapitalization: TextCapitalization.characters,
+ keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
- Icons.person,
+ Icons.download,
color: primaryColor,
),
border: OutlineInputBorder(
@@ -89,47 +81,92 @@ class _BPCalculatorState extends State {
),
),
SizedBox(height: 10),
- TextButton(
- child: Text('Check BP', style: textButtonStyle()),
- onPressed: () async {
- if (systoloicController.text != '' &&
- diastolicController.text != '') {
- AppSettings.preLoaderDialog(context);
- var payload = new Map();
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: dateInput,
+ decoration: textFormFieldDecorationBMI(
+ Icons.calendar_today, 'Enter Date'),
+ readOnly: true,
+ onTap: () async {
+ DateTime? pickedDate = await showDatePicker(
+ context: context,
+ initialDate: DateTime.now(),
+ firstDate: DateTime(1950),
+ lastDate: DateTime.now(),
+ builder: (BuildContext context, Widget? child) {
+ return Theme(
+ data: ThemeData.dark().copyWith(
+ colorScheme: ColorScheme.dark(
+ primary: buttonColors,
+ onPrimary: Colors.white,
+ surface: buttonColors,
+ onSurface: Colors.white,
+ ),
+ dialogBackgroundColor: primaryColor,
+ ),
+ child: child!,
+ );
+ },
+ );
- payload["Systolic"] = double.parse(systoloicController.text.toString());
- payload["Diastolic"] = double.parse(diastolicController.text.toString());
+ if (pickedDate != null) {
+ print(
+ pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
+ String formattedDate =
+ DateFormat('dd-MM-yyyy').format(pickedDate);
+ print(
+ formattedDate); //formatted date output using intl package => 2021-03-16
+ setState(() {
+ dateInput.text =
+ formattedDate; //set output date to TextField value.
+ });
+ } else {}
+ },
+ ),
+ ),
+ SizedBox(height: 10),
+ Container(
+ width: double.infinity,
+ height:
+ MediaQuery.of(context).size.height * .05,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: buttonColors, // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () async {
+ if (systoloicController.text != '' &&
+ diastolicController.text != ''&&dateInput.text!='') {
+ AppSettings.preLoaderDialog(context);
+ var payload = new Map();
- var value = await AppSettings.calculateBP(payload);
- var valueResponse = jsonDecode(value);
- print(valueResponse);
- setState(() {
- bpValue = valueResponse['userDetails']['bpCategory'].toString();
- /*bpValue = valueResponse['userDetails']['bmivalue'].toString();
- if(double.parse(bpValue)<18.5){
- bpText='Underweight';
- }
- else if(double.parse(bpValue)>=18.5&&double.parse(bpValue)<=24.9){
- bpText='Normal weight';
+ payload["Systolic"] = double.parse(systoloicController.text.toString());
+ payload["Diastolic"] = double.parse(diastolicController.text.toString());
+ payload["date"] =dateInput.text.toString();
+
+ var value = await AppSettings.calculateBP(payload);
+ var valueResponse = jsonDecode(value);
+ print(valueResponse);
+ setState(() {
+ bpValue = valueResponse['userDetails']['bpCategory'].toString();
+ });
+ systoloicController.clear();
+ diastolicController.clear();
+ dateInput.clear();
+ Navigator.of(context,rootNavigator: true).pop();
}
- else if(double.parse(bpValue)>=25&&double.parse(bpValue)<=29.9){
- bpText='Overweight';
+ else{
+ AppSettings.longFailedToast('Please enter valid details');
}
- else if(double.parse(bpValue)>=30){
- bpText='Obesity';
- }*/
- });
- systoloicController.clear();
- diastolicController.clear();
- Navigator.of(context,rootNavigator: true).pop();
- }
- },
- ),
- SizedBox(height: 10),
+ },
+ child: const Text('Check BP'),
+ )),
+ SizedBox(height: 20),
Container(
child: Row(
children: [
- Text(bpValue,style: TextStyle(color: Colors.red),),
+ Text(bpValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),),
],
)
),
diff --git a/lib/BP/bp_history.dart b/lib/BP/bp_history.dart
index ece8c03..9bc2293 100644
--- a/lib/BP/bp_history.dart
+++ b/lib/BP/bp_history.dart
@@ -1,9 +1,9 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:healthcare_user/chart/bpchart.dart';
-import 'package:healthcare_user/models/bmi_history_model.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/bp_history_model.dart';
+import 'package:flutter_slidable/flutter_slidable.dart';
class BPHistory extends StatefulWidget {
const BPHistory({Key? key}) : super(key: key);
@@ -13,247 +13,308 @@ class BPHistory extends StatefulWidget {
}
class _BPHistoryState extends State {
-
- bool isLoading=false;
+ bool isLoading = false;
List BpHistoryList = [];
List FilteredList = [];
var dateItems = [
+ 'All',
'last 7 days',
'last one month',
'last one year',
];
- var dateItemsVariable = 'last 7 days';
+ var dateItemsVariable = 'All';
- Future getBmiHistoryDetails(var selectedRange) async {
- isLoading=true;
- var response1= await AppSettings.getBPHistory();
+ Future getBPHistoryDetails(var selectedRange) async {
+ isLoading = true;
+ var response1 = await AppSettings.getBPHistory();
print(response1);
setState(() {
- BpHistoryList =
- ((jsonDecode(response1)) as List).map((dynamic model) {
- return BPHistoryModel.fromJson(model);
- }).toList();
+ BpHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
+ return BPHistoryModel.fromJson(model);
+ }).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
- var now_1m = new DateTime(now.year, now.month-1, now.day);
- var now_1y = new DateTime(now.year-1, now.month, now.day);
+ var now_1m = new DateTime(now.year, now.month - 1, now.day);
+ var now_1y = new DateTime(now.year - 1, now.month, now.day);
- if(selectedRange.toString().toUpperCase()=='LAST 7 DAYS'){
- FilteredList=BpHistoryList.where((product) {
+ if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
+ FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
- }
- else if(selectedRange.toString().toUpperCase()=='LAST ONE MONTH'){
- FilteredList=BpHistoryList.where((product) {
+ } else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
+ FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
- }
- else if(selectedRange.toString().toUpperCase()=='LAST ONE YEAR'){
- FilteredList=BpHistoryList.where((product) {
+ } else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
+ FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
- }
- else{
- FilteredList=BpHistoryList;
+ } else {
+ FilteredList = BpHistoryList;
}
-
- isLoading=false;
+ isLoading = false;
});
}
@override
void initState() {
- getBmiHistoryDetails(dateItemsVariable);
+ getBPHistoryDetails(dateItemsVariable);
super.initState();
}
- Widget renderzUi(){
- if(BpHistoryList.length!=0){
+ deleteBpRecord(bpId) async {
+ AppSettings.preLoaderDialog(context);
+ bool status = await AppSettings.deleteBPDetails(bpId);
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
- child: DropdownButtonFormField(
- // Initial Value
- value: dateItemsVariable,
- isExpanded: true,
- decoration: const InputDecoration(
- prefixIcon: Icon(
- Icons.calendar_month,
- color: primaryColor,
- ),
- border: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor)),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- labelText: 'Units',
- labelStyle: TextStyle(
- color: greyColor, //<-- SEE HERE
- ),
- ),
+ if (status) {
+ Navigator.of(context, rootNavigator: true).pop();
- hint: Text('Units'),
- // Down Arrow Icon
- //icon: const Icon(Icons.keyboard_arrow_down),
+ AppSettings.longSuccessToast("BP record deleted successfully");
+ await getBPHistoryDetails(dateItemsVariable);
+ } else {
+ Navigator.of(context, rootNavigator: true).pop();
- // Array list of items
- items: dateItems.map((String items) {
- return DropdownMenuItem(
- value: items,
- child: Text(
- items,
- style: TextStyle(
- fontSize: 16,
- ),
- textAlign: TextAlign.center,
- ));
- }).toList(),
- // After selecting the desired option,it will
- // change button value to selected value
- onChanged: (String? newValue) {
- setState(() {
- dateItemsVariable = newValue!;
- });
- getBmiHistoryDetails(dateItemsVariable);
- },
- ),),
+ AppSettings.longFailedToast("BP record deletion failed");
+ }
+ }
- IconButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => Bpchart()),
- );
- // showBMIAdddialog();
- },
- icon: Icon(
- Icons.auto_graph,
+ Widget renderzUi() {
+ if (BpHistoryList.length != 0) {
+ return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Padding(
+ padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
+ child: DropdownButtonFormField(
+ // Initial Value
+ value: dateItemsVariable,
+ isExpanded: true,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.calendar_month,
color: primaryColor,
),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Select Date Range',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
),
- Expanded(child:ListView.builder(
- padding: EdgeInsets.all(0),
+ hint: Text('Units'),
+ // Down Arrow Icon
+ //icon: const Icon(Icons.keyboard_arrow_down),
+
+ // Array list of items
+ items: dateItems.map((String items) {
+ return DropdownMenuItem(
+ value: items,
+ child: Text(
+ items,
+ style: TextStyle(
+ fontSize: 16,
+ ),
+ textAlign: TextAlign.center,
+ ));
+ }).toList(),
+ // After selecting the desired option,it will
+ // change button value to selected value
+ onChanged: (String? newValue) {
+ setState(() {
+ dateItemsVariable = newValue!;
+ });
+ getBPHistoryDetails(dateItemsVariable);
+ },
+ ),
+ ),
+ IconButton(
+ onPressed: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) => Bpchart()),
+ );
+ // showBMIAdddialog();
+ },
+ icon: Icon(
+ Icons.auto_graph,
+ color: primaryColor,
+ ),
+ ),
+ Expanded(
+ child: ListView.builder(
+ padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
- return Card(
+ return Slidable(
+ key: const ValueKey(0),
+ endActionPane: ActionPane(
+ // A motion is a widget used to control how the pane animates.
+ motion: ScrollMotion(),
- color: Colors.white,
- child: Padding(
- padding:EdgeInsets.all(8) ,
- child: Container(
- width: MediaQuery.of(context).size.width * .55,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
+ dragDismissible: false,
+ // A pane can dismiss the Slidable.
+ dismissible: DismissiblePane(onDismissed: () {
+ deleteBpRecord(FilteredList[index].bpId);
+ }),
+
+ // All actions are defined in the children parameter.
+ children: [
+ // A SlidableAction can have an icon and/or a label.
+ SlidableAction(
+ backgroundColor: Color(0xFFFE4A49),
+ foregroundColor: Colors.white,
+ icon: Icons.delete,
+ label: 'Delete',
+ onPressed: (BuildContext context) {
+ deleteBpRecord(FilteredList[index].bpId);
+ },
+ ),
+ ],
+ ),
+ child: Card(
+ color: Colors.white,
+ child: Padding(
+ padding: EdgeInsets.all(8),
+ child: Container(
+ //width: MediaQuery.of(context).size.width * .55,
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- /* Image(
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ /* Image(
image: const AssetImage('images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),*/
- Text('Systolic',style: TextStyle(color: primaryColor),),
- SizedBox(width: 5,),
- Padding(padding: EdgeInsets.all(1),
- child: Text(FilteredList[index].systolic.toString().toUpperCase(),style: valuesTextStyle()),)
-
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('Diastolic',style: TextStyle(color: primaryColor),),
- Padding(padding: EdgeInsets.all(1),
- child: Text(FilteredList[index].diastolic.toString().toUpperCase(),style: valuesTextStyle()),)
-
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image: const AssetImage('images/height.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(padding: EdgeInsets.all(5),
- child: Text(FilteredList[index].bpText.toString().toUpperCase(),style: valuesTextStyle()),)
-
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image(
- image: const AssetImage('images/date.png'),
- height: 25,
- width: 25,
- fit: BoxFit.fill),
- Padding(padding: EdgeInsets.all(5),
- child: Text(FilteredList[index].displayDate.toString().toUpperCase(),style: valuesTextStyle()),)
-
+ Text(
+ 'Systolic',
+ style: TextStyle(color: primaryColor),
+ ),
+ SizedBox(
+ width: 5,
+ ),
+ Padding(
+ padding: EdgeInsets.all(1),
+ child: Text(
+ FilteredList[index]
+ .systolic
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Diastolic',
+ style: TextStyle(color: primaryColor),
+ ),
+ Padding(
+ padding: EdgeInsets.all(1),
+ child: Text(
+ FilteredList[index]
+ .diastolic
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image: const AssetImage(
+ 'images/height.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .bpText
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image(
+ image:
+ const AssetImage('images/date.png'),
+ height: 25,
+ width: 25,
+ fit: BoxFit.fill),
+ Padding(
+ padding: EdgeInsets.all(5),
+ child: Text(
+ FilteredList[index]
+ .actualDate
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ )
+ ],
+ ),
],
),
-
-
- ],
+ ),
),
-
-
- ),
- ),
- );
- }) ),
- ]);
- }
- else{
- return Center(
+ ));
+ })),
+ ]);
+ } else {
+ return Center(
child: Padding(
- padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(height: MediaQuery.of(context).size.height * .25,),
- Text('No data'),
- SizedBox(
- height: 20,
- ),
- CircleAvatar(
- backgroundColor: primaryColor,
- radius: 40,
- child: IconButton(
- iconSize: 40,
- icon: const Icon(
- Icons.info,
- color: Colors.white,
- ),
- onPressed: () async {
-
- },
- ),
- )
- ],
+ padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(
+ height: MediaQuery.of(context).size.height * .25,
),
- )
- );
+ Text('No data'),
+ SizedBox(
+ height: 20,
+ ),
+ CircleAvatar(
+ backgroundColor: primaryColor,
+ radius: 40,
+ child: IconButton(
+ iconSize: 40,
+ icon: const Icon(
+ Icons.info,
+ color: Colors.white,
+ ),
+ onPressed: () async {},
+ ),
+ )
+ ],
+ ),
+ ));
}
}
@@ -261,12 +322,14 @@ class _BPHistoryState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Blood Pressure'),
- body: isLoading?Center(
- child: CircularProgressIndicator(
- color: primaryColor,
- strokeWidth: 5.0,
- ),
- ):renderzUi(),
+ body: isLoading
+ ? Center(
+ child: CircularProgressIndicator(
+ color: primaryColor,
+ strokeWidth: 5.0,
+ ),
+ )
+ : renderzUi(),
);
}
}
diff --git a/lib/Reports/add_reports.dart b/lib/Reports/add_reports.dart
index 0d94aaf..29c585e 100644
--- a/lib/Reports/add_reports.dart
+++ b/lib/Reports/add_reports.dart
@@ -1158,8 +1158,7 @@ class _AddReportsState extends State {
payload["reports"] = uiReportsImages;
payload["prescription"] = uiPrescriptionImages;
- bool uploadStatus =
- await AppSettings.addRecords(payload);
+ bool uploadStatus = await AppSettings.addRecords(payload);
try {
if (uploadStatus) {
diff --git a/lib/Reports/all_records_tab.dart b/lib/Reports/all_records_tab.dart
index 1bcbfa7..be36764 100644
--- a/lib/Reports/all_records_tab.dart
+++ b/lib/Reports/all_records_tab.dart
@@ -1000,6 +1000,7 @@ class _AllReportsTabState extends State
title: Text('Reports'),
backgroundColor: primaryColor,
bottom: TabBar(
+ isScrollable: true,
controller: _controller,
tabs: topTabs,
indicatorColor: buttonColors,
diff --git a/lib/Sugar/sugar_calculator.dart b/lib/Sugar/sugar_calculator.dart
index d81da1a..a031be0 100644
--- a/lib/Sugar/sugar_calculator.dart
+++ b/lib/Sugar/sugar_calculator.dart
@@ -1,10 +1,9 @@
import 'dart:convert';
-
import 'package:flutter/material.dart';
-import 'package:healthcare_user/BMI/bmi_history.dart';
-import 'package:healthcare_user/BP/bp_history.dart';
import 'package:healthcare_user/Sugar/sugar_history.dart';
import 'package:healthcare_user/common/settings.dart';
+import 'package:intl/intl.dart';
+
class SugarCalculator extends StatefulWidget {
const SugarCalculator({Key? key}) : super(key: key);
@@ -17,6 +16,7 @@ class _SugarCalculatorState extends State {
TextEditingController fastingValueController = TextEditingController();
TextEditingController postParandialValueController = TextEditingController();
+ TextEditingController dateInput = TextEditingController();
String sugarValue = '';
@override
Widget build(BuildContext context) {
@@ -80,35 +80,94 @@ class _SugarCalculatorState extends State {
),
),
SizedBox(height: 10),
- TextButton(
- child: Text('Check Sugar', style: textButtonStyle()),
- onPressed: () async {
- if (fastingValueController.text != '' &&
- postParandialValueController.text != '') {
- AppSettings.preLoaderDialog(context);
- var payload = new Map();
+ SizedBox(height: 10),
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: dateInput,
+ decoration: textFormFieldDecorationBMI(
+ Icons.calendar_today, 'Enter Date'),
+ readOnly: true,
+ onTap: () async {
+ DateTime? pickedDate = await showDatePicker(
+ context: context,
+ initialDate: DateTime.now(),
+ firstDate: DateTime(1950),
+ lastDate: DateTime.now(),
+ builder: (BuildContext context, Widget? child) {
+ return Theme(
+ data: ThemeData.dark().copyWith(
+ colorScheme: ColorScheme.dark(
+ primary: buttonColors,
+ onPrimary: Colors.white,
+ surface: buttonColors,
+ onSurface: Colors.white,
+ ),
+ dialogBackgroundColor: primaryColor,
+ ),
+ child: child!,
+ );
+ },
+ );
- payload["fasting"] = double.parse(fastingValueController.text.toString());
- payload["postPrandial"] = double.parse(postParandialValueController.text.toString());
+ if (pickedDate != null) {
+ print(
+ pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
+ String formattedDate =
+ DateFormat('dd-MM-yyyy').format(pickedDate);
+ print(
+ formattedDate); //formatted date output using intl package => 2021-03-16
+ setState(() {
+ dateInput.text =
+ formattedDate; //set output date to TextField value.
+ });
+ } else {}
+ },
+ ),
+ ),
+ SizedBox(height: 10),
+ Container(
+ width: double.infinity,
+ height:
+ MediaQuery.of(context).size.height * .05,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: buttonColors, // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () async {
+ if (fastingValueController.text != '' &&
+ postParandialValueController.text != ''&& dateInput.text!='') {
+ AppSettings.preLoaderDialog(context);
+ var payload = new Map();
- var value = await AppSettings.calculateSugar(payload);
- var valueResponse = jsonDecode(value);
- print(valueResponse);
- setState(() {
- sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
+ payload["fasting"] = double.parse(fastingValueController.text.toString());
+ payload["postPrandial"] = double.parse(postParandialValueController.text.toString());
+ payload["date"] = dateInput.text.toString();
- });
- fastingValueController.clear();
- postParandialValueController.clear();
- Navigator.of(context,rootNavigator: true).pop();
- }
- },
- ),
+ var value = await AppSettings.calculateSugar(payload);
+ var valueResponse = jsonDecode(value);
+ print(valueResponse);
+ setState(() {
+ sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
+
+ });
+ fastingValueController.clear();
+ postParandialValueController.clear();
+ dateInput.clear();
+ Navigator.of(context,rootNavigator: true).pop();
+ }
+ else{
+ AppSettings.longFailedToast('Please enter valid details');
+ }
+ },
+ child: const Text('Check Diabetes'),
+ )),
SizedBox(height: 10),
Container(
child: Row(
children: [
- Text(sugarValue,style: TextStyle(color: Colors.red),),
+ Text(sugarValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),),
],
)
),
diff --git a/lib/Sugar/sugar_history.dart b/lib/Sugar/sugar_history.dart
index 9f73425..48c8410 100644
--- a/lib/Sugar/sugar_history.dart
+++ b/lib/Sugar/sugar_history.dart
@@ -1,9 +1,8 @@
import 'dart:convert';
import 'package:flutter/material.dart';
-import 'package:healthcare_user/models/bmi_history_model.dart';
import 'package:healthcare_user/common/settings.dart';
-import 'package:healthcare_user/models/bp_history_model.dart';
import 'package:healthcare_user/models/sugar_history_model.dart';
+import 'package:flutter_slidable/flutter_slidable.dart';
class SugarHistory extends StatefulWidget {
const SugarHistory({Key? key}) : super(key: key);
@@ -13,56 +12,51 @@ class SugarHistory extends StatefulWidget {
}
class _SugarHistoryState extends State {
-
- bool isLoading=false;
+ bool isLoading = false;
List sugarHistoryList = [];
List FilteredList = [];
var dateItems = [
+ 'All',
'last 7 days',
'last one month',
'last one year',
];
- var dateItemsVariable = 'last 7 days';
+ var dateItemsVariable = 'All';
Future getSugarHistoryDetails(var selectedRange) async {
- isLoading=true;
- var response1= await AppSettings.getSugarHistory();
+ isLoading = true;
+ var response1 = await AppSettings.getSugarHistory();
print(response1);
setState(() {
- sugarHistoryList =
- ((jsonDecode(response1)) as List).map((dynamic model) {
- return SugarHistoryModel.fromJson(model);
- }).toList();
+ sugarHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
+ return SugarHistoryModel.fromJson(model);
+ }).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
- var now_1m = new DateTime(now.year, now.month-1, now.day);
- var now_1y = new DateTime(now.year-1, now.month, now.day);
+ var now_1m = new DateTime(now.year, now.month - 1, now.day);
+ var now_1y = new DateTime(now.year - 1, now.month, now.day);
- if(selectedRange.toString().toUpperCase()=='LAST 7 DAYS'){
- FilteredList=sugarHistoryList.where((product) {
+ if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
+ FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
- }
- else if(selectedRange.toString().toUpperCase()=='LAST ONE MONTH'){
- FilteredList=sugarHistoryList.where((product) {
+ } else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
+ FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
- }
- else if(selectedRange.toString().toUpperCase()=='LAST ONE YEAR'){
- FilteredList=sugarHistoryList.where((product) {
+ } else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
+ FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
- }
- else{
- FilteredList=sugarHistoryList;
+ } else {
+ FilteredList = sugarHistoryList;
}
-
- isLoading=false;
+ isLoading = false;
});
}
@@ -72,192 +66,374 @@ class _SugarHistoryState extends State {
super.initState();
}
- Widget renderzUi(){
- if(sugarHistoryList.length!=0){
+ deleteSugarRecord(sugarInfoId) async {
+ AppSettings.preLoaderDialog(context);
+ bool status = await AppSettings.deleteSugarDetails(sugarInfoId);
- return Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
- child: DropdownButtonFormField(
- // Initial Value
- value: dateItemsVariable,
- isExpanded: true,
- decoration: const InputDecoration(
- prefixIcon: Icon(
- Icons.calendar_month,
- color: primaryColor,
- ),
- border: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor)),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- labelText: 'Units',
- labelStyle: TextStyle(
- color: greyColor, //<-- SEE HERE
- ),
- ),
+ if (status) {
+ Navigator.of(context, rootNavigator: true).pop();
- hint: Text('Units'),
- // Down Arrow Icon
- //icon: const Icon(Icons.keyboard_arrow_down),
+ AppSettings.longSuccessToast("BP record deleted successfully");
+ await getSugarHistoryDetails(dateItemsVariable);
+ } else {
+ Navigator.of(context, rootNavigator: true).pop();
- // Array list of items
- items: dateItems.map((String items) {
- return DropdownMenuItem(
- value: items,
- child: Text(
- items,
- style: TextStyle(
- fontSize: 16,
- ),
- textAlign: TextAlign.center,
- ));
- }).toList(),
- // After selecting the desired option,it will
- // change button value to selected value
- onChanged: (String? newValue) {
- setState(() {
- dateItemsVariable = newValue!;
- });
- getSugarHistoryDetails(dateItemsVariable);
- },
- ),),
+ AppSettings.longFailedToast("BP record deletion failed");
+ }
+ }
+
+ Widget renderzUi() {
+ if (sugarHistoryList.length != 0) {
+ return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
+ Padding(
+ padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
+ child: DropdownButtonFormField(
+ // Initial Value
+ value: dateItemsVariable,
+ isExpanded: true,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.calendar_month,
+ color: primaryColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Select Date Range',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
- Expanded(child:ListView.builder(
- padding: EdgeInsets.all(0),
+ hint: Text('Units'),
+ // Down Arrow Icon
+ //icon: const Icon(Icons.keyboard_arrow_down),
+
+ // Array list of items
+ items: dateItems.map((String items) {
+ return DropdownMenuItem(
+ value: items,
+ child: Text(
+ items,
+ style: TextStyle(
+ fontSize: 16,
+ ),
+ textAlign: TextAlign.center,
+ ));
+ }).toList(),
+ // After selecting the desired option,it will
+ // change button value to selected value
+ onChanged: (String? newValue) {
+ setState(() {
+ dateItemsVariable = newValue!;
+ });
+ getSugarHistoryDetails(dateItemsVariable);
+ },
+ ),
+ ),
+ Expanded(
+ child: ListView.builder(
+ padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
- return Card(
+ return Slidable(
+ key: const ValueKey(0),
+ endActionPane: ActionPane(
+ // A motion is a widget used to control how the pane animates.
+ motion: ScrollMotion(),
- color: Colors.white,
- child: Padding(
- padding:EdgeInsets.all(8) ,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
+ dragDismissible: false,
+ // A pane can dismiss the Slidable.
+ dismissible: DismissiblePane(onDismissed: () {
+ deleteSugarRecord(FilteredList[index].sugarInfoId);
+ }),
- Column(
+ // All actions are defined in the children parameter.
+ children: [
+ // A SlidableAction can have an icon and/or a label.
+ SlidableAction(
+ backgroundColor: Color(0xFFFE4A49),
+ foregroundColor: Colors.white,
+ icon: Icons.delete,
+ label: 'Delete',
+ onPressed: (BuildContext context) {
+ deleteSugarRecord(FilteredList[index].sugarInfoId);
+ },
+ ),
+ ],
+ ),
+ child: Card(
+ color: Colors.white,
+ child: Padding(
+ padding: EdgeInsets.all(8),
+ child:
+ Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- 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].fasting.toString().toUpperCase(),style: valuesTextStyle()),)
- ],
- ),
- Row(
+ Column(
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].postPrandial.toString().toUpperCase(),style: valuesTextStyle()),)
-
+ Text(
+ 'Fasting Sugar Value',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'PostPrandial Sugar Value',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'Actual Sugar Value',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'Sugar Status',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'Date',
+ style: labelTextStyle(),
+ ),
],
),
- Row(
+ SizedBox(width:MediaQuery.of(context).size.width * .01,),
+ Column(
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()),)
-
+ 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(),
+ ),
],
),
- Row(
+ SizedBox(width:MediaQuery.of(context).size.width * .01,),
+ Expanded(child: Column(
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()),)
-
+ Text(
+ FilteredList[index]
+ .fasting
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ FilteredList[index]
+ .postPrandial
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ FilteredList[index]
+ .sugarValue
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ FilteredList[index]
+ .sugartText
+ .toString()
+ .toUpperCase(),
+ style: wrapTextStyleBlack()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ FilteredList[index]
+ .actualDate
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
],
- ),
- Row(
+ ),)
+
+
+ /*Column(
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].displayDate.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),*//*
+ 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()),
+ )
+ ],
+ ),
],
- ),
-
+ ),*/
],
),
-
- ],
-
- ),
- ),
- );
- }) ),
- ]);
- }
- else{
- return Center(
+ ),
+ ));
+ })),
+ ]);
+ } else {
+ return Center(
child: Padding(
- padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(height: MediaQuery.of(context).size.height * .25,),
- Text('No data'),
- SizedBox(
- height: 20,
- ),
- CircleAvatar(
- backgroundColor: primaryColor,
- radius: 40,
- child: IconButton(
- iconSize: 40,
- icon: const Icon(
- Icons.info,
- color: Colors.white,
- ),
- onPressed: () async {
-
- },
- ),
- )
- ],
+ padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(
+ height: MediaQuery.of(context).size.height * .25,
+ ),
+ Text('No data'),
+ SizedBox(
+ height: 20,
),
- )
- );
+ CircleAvatar(
+ backgroundColor: primaryColor,
+ radius: 40,
+ child: IconButton(
+ iconSize: 40,
+ icon: const Icon(
+ Icons.info,
+ color: Colors.white,
+ ),
+ onPressed: () async {},
+ ),
+ )
+ ],
+ ),
+ ));
}
}
@@ -265,12 +441,14 @@ class _SugarHistoryState extends State {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Diabetes'),
- body: isLoading?Center(
- child: CircularProgressIndicator(
- color: primaryColor,
- strokeWidth: 5.0,
- ),
- ):renderzUi(),
+ body: isLoading
+ ? Center(
+ child: CircularProgressIndicator(
+ color: primaryColor,
+ strokeWidth: 5.0,
+ ),
+ )
+ : renderzUi(),
);
}
}
diff --git a/lib/chart/bmi_chart.dart b/lib/chart/bmi_chart.dart
index 18b162b..0f40fe0 100644
--- a/lib/chart/bmi_chart.dart
+++ b/lib/chart/bmi_chart.dart
@@ -20,7 +20,7 @@ class _BmiChartState extends State {
_getSeriesData() {
List> series = [
charts.Series(
- id: "Sales",
+ id: "Bmi",
data: widget.myObject,
domainFn: (BmiHistoryModel series, _) => series.dateForFilter,
measureFn: (BmiHistoryModel series, _) => series.number2,
diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart
index 8118f18..78dde5f 100644
--- a/lib/common/dashboard.dart
+++ b/lib/common/dashboard.dart
@@ -10,8 +10,9 @@ import 'package:healthcare_user/medicines.dart';
import 'package:healthcare_user/my_health.dart';
import 'package:healthcare_user/my_medicine_timings.dart';
import 'package:healthcare_user/prescriptions/prescriptions.dart';
-import 'package:healthcare_user/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/report_problem/all_problems.dart';
import 'package:healthcare_user/seekopinion.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/updates/update_location.dart';
@@ -371,19 +372,15 @@ class _DashboardState extends State {
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
- "images/invitations.png"), // picked file
+ "images/myconnections.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const Invitations()),
- );
+
},
),
Text(
- 'Invitations',
+ 'My Connections',
style: dashboardTextStyle(),
),
],
@@ -774,7 +771,7 @@ class _DashboardState extends State {
Navigator.push(
context,
MaterialPageRoute(
- builder: (context) => const ReportMySelf()),
+ builder: (context) => AllProblemsReportMyself()),
);
},
),
@@ -785,7 +782,7 @@ class _DashboardState extends State {
title: Row(
children: [
Image(
- image: const AssetImage('images/myconnections.png'),
+ image: const AssetImage('images/invitations.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
@@ -795,10 +792,16 @@ class _DashboardState extends State {
const SizedBox(
width: 10,
),
- Text('My Connections', style: drawerListItemsTextStyle()),
+ Text('Invitations', style: drawerListItemsTextStyle()),
],
),
- onTap: () {},
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const Invitations()),
+ );
+ },
),
Divider(
color: Colors.grey,
diff --git a/lib/common/settings.dart b/lib/common/settings.dart
index 24fdcc6..c07e997 100644
--- a/lib/common/settings.dart
+++ b/lib/common/settings.dart
@@ -194,6 +194,28 @@ InputDecoration textFormFieldDecoration(IconData icon, var text) {
);
}
+InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
+ return InputDecoration(
+ //filled: true,
+ //fillColor: Colors.white,
+ prefixIcon: Icon(
+ icon,
+ color: primaryColor,
+ ),
+ border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: text,
+ labelStyle: TextStyle(
+ //color: Colors.black, //<-- SEE HERE
+ ),
+ );
+}
+
final GlobalKey preloaderWindowKey = new GlobalKey();
Future preloaderWindow(BuildContext context) async {
try {
@@ -250,6 +272,7 @@ class AppSettings {
static String getBpHistoryUrl = host + 'usersbp';
static String getSugarHistoryUrl = host + 'userssugar';
static String addMedicineTimingsUrl = host + 'medicine-timing';
+ static String updateMedicineTimingsUrl = host + 'update-medicine-timing';
static String getMedicineTimingsUrl = host + 'getmedicineztiming';
static String findingsUploadPicUrl = host + 'uploads-findings-prescription';
static String addFindingsUrl = host + 'update-uploads-findingsPictureId-prescription';
@@ -268,6 +291,8 @@ class AppSettings {
static String addRecordsUrl = host + 'add-record';
static String updateRecordsUrl = host + 'records';
static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo';
+ static String uploadReportMyselfPictureUrl = host + 'reportProblemPicture';
+
//static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription';
static String getAllPrescriptionsDataUrl = host + 'getAllPrescriptionDetails';
static String getRecordsDataUrl = host + 'getAllRecords';
@@ -276,6 +301,16 @@ class AppSettings {
static String deletePrescriptionsUrl = host + 'delete-prescription';
static String deleteReportsUrl = host + 'delete-report';
static String deleteRecordsUrl = host + 'delete-url';
+ static String deleteBMIDetailsUrl = host + 'deleteBMI';
+ static String deleteBPDetailsUrl = host + 'deleteBP';
+ static String deleteSugarDetailsUrl = host + 'deleteSugar';
+ static String addReportMySelfProblemUrl = host + 'insertReport';
+ static String getAllReportProblemDetalisUrl = host + 'userreport';
+ static String deleteReportMySelfProblemUrl = host + 'deleteReportProblem';
+
+
+
+
@@ -1052,6 +1087,16 @@ class AppSettings {
return response.body;
}
+
+ static Future uploadReportMyselfPicture(file) async {
+
+ var request = http.MultipartRequest('POST', Uri.parse(uploadReportMyselfPictureUrl + '/' + 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 getAllpharmacies() async {
var uri = Uri.parse(getAllpharmaciesDataUrl);
//uri = uri.replace(query: 'customerId=$customerId');
@@ -1125,6 +1170,31 @@ class AppSettings {
}
}
+ static Future updateMedicineTimings(payload) async {
+ var uri = Uri.parse(updateMedicineTimingsUrl + '/' + customerId);
+
+ var response = await http.post(uri,
+ body: json.encode(payload), headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return response.body;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.post(uri,
+ body: json.encode(payload), headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return response.body;
+ } else {
+ return '';
+ }
+ } else {
+ return '';
+ }
+ } else {
+ return '';
+ }
+ }
+
static Future getMedicineTimings() async {
var uri = Uri.parse(getMedicineTimingsUrl + '/' + customerId);
@@ -1473,7 +1543,6 @@ class AppSettings {
}
}*/
-
static Future deleteRecords(payload, recordId) async {
var uri = Uri.parse(deleteRecordsUrl + '/' + customerId+'/'+recordId);
@@ -1503,8 +1572,6 @@ class AppSettings {
}
}
-
-
static Future deleteRecordsNew(payload, recordId) async {
var uri = Uri.parse(deleteRecordsUrl + '/' + customerId+'/'+recordId);
@@ -1534,9 +1601,178 @@ class AppSettings {
}
}
+ static Future deleteBMIDetails(bmiId) async {
+ var uri = Uri.parse(deleteBMIDetailsUrl + '/' + customerId+'/'+ bmiId);
+ try {
+ var response = await http.delete(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.delete(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } catch (e) {
+ print(e);
+ return false;
+ }
+ }
+ static Future deleteBPDetails(bmiId) async {
+ var uri = Uri.parse(deleteBPDetailsUrl + '/' + customerId+'/'+ bmiId);
+
+ try {
+ var response = await http.delete(uri, headers: await buildRequestHeaders());
+
+ if (response.statusCode == 200) {
+ return true;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.delete(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } catch (e) {
+ print(e);
+ return false;
+ }
+ }
+
+ static Future deleteSugarDetails(bmiId) async {
+ var uri = Uri.parse(deleteSugarDetailsUrl + '/' + customerId+'/'+ bmiId);
+
+ try {
+ var response = await http.delete(uri, headers: await buildRequestHeaders());
+
+ if (response.statusCode == 200) {
+ return true;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.delete(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } catch (e) {
+ print(e);
+ return false;
+ }
+ }
+
+
+ static Future addReportMySelfProblem(payload) async {
+ var uri = Uri.parse(addReportMySelfProblemUrl + '/' + customerId);
+ var response = await http.post(uri,
+ body: json.encode(payload), headers: await buildRequestHeaders());
+
+ if (response.statusCode == 200) {
+ try {
+ var _response = json.decode(response.body);
+ print(_response);
+ return true;
+ } catch (e) {
+ print(e);
+ return false;
+ }
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.post(uri,
+ body: json.encode(payload), headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ static Future getAllReportProblemDetalis() async {
+ var uri = Uri.parse(getAllReportProblemDetalisUrl+'/'+customerId);
+ //uri = uri.replace(query: 'customerId=$customerId');
+
+ var response = await http.get(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return response.body;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.get(uri, headers: await buildRequestHeaders());
+ if (response.statusCode == 200) {
+ return response.body;
+ } else {
+ return '';
+ }
+ } else {
+ return '';
+ }
+ } else {
+ return '';
+ }
+ }
+
+ static Future deleteReportMySelfProblem(problemId) async {
+ var uri = Uri.parse(deleteReportMySelfProblemUrl + '/' +problemId);
+
+ try {
+ var response = await http.put (uri, headers: await buildPutRequestHeaders());
+
+ if (response.statusCode == 200) {
+ return true;
+ } else if (response.statusCode == 401) {
+ bool status = await AppSettings.resetToken();
+ if (status) {
+ response = await http.put(uri, headers: await buildPutRequestHeaders());
+ if (response.statusCode == 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } catch (e) {
+ print(e);
+ return false;
+ }
+ }
/*Apis ends here*/
diff --git a/lib/common/zoom_image.dart b/lib/common/zoom_image.dart
index 5cc137a..a08a0d0 100644
--- a/lib/common/zoom_image.dart
+++ b/lib/common/zoom_image.dart
@@ -15,17 +15,43 @@ class _ImageZoomPageState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
- appBar: AppSettings.appBar(widget.imageName),
+ appBar:AppBar(
+ backgroundColor: primaryColor,
+ title: Text(widget.imageName),
+ actions: [
+ IconButton(
+ onPressed: () {
+
+ Navigator.pop(context);
+ },
+ icon: Icon(
+ Icons.cancel,
+ color: Colors.red,
+ size: 30,
+ ),
+ ),
+ ],
+ ),
body: Container(
//width: MediaQuery.of(context).size.width * .10,
//height: MediaQuery.of(context).size.height * .50,
- child: PhotoView(
- imageProvider: NetworkImage(widget.imageDetails) as ImageProvider,
- maxScale: PhotoViewComputedScale.contained * 4.0,
- minScale: PhotoViewComputedScale.contained,
- initialScale: PhotoViewComputedScale.contained,
- basePosition: Alignment.center,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(padding:EdgeInsets.fromLTRB(10,10,10,0),
+ child: Text('Use two fingers to zoom/double tap',style: TextStyle(color: Colors.black,fontSize: 12),),),
+ SizedBox(height:MediaQuery.of(context).size.height * .02,),
+ Expanded(
+ child: PhotoView(
+ imageProvider: NetworkImage(widget.imageDetails) as ImageProvider,
+ maxScale: PhotoViewComputedScale.contained * 4.0,
+ minScale: PhotoViewComputedScale.contained,
+ initialScale: PhotoViewComputedScale.contained,
+ basePosition: Alignment.center,
+ ),
+ )
+ ],
)
),
diff --git a/lib/edit_medicine_timings.dart b/lib/edit_medicine_timings.dart
index a33bdfc..d158974 100644
--- a/lib/edit_medicine_timings.dart
+++ b/lib/edit_medicine_timings.dart
@@ -1,15 +1,415 @@
+import 'dart:convert';
+
import 'package:flutter/material.dart';
+import 'package:healthcare_user/common/settings.dart';
+import 'package:day_night_time_picker/day_night_time_picker.dart';
+import 'package:intl/intl.dart';
class EditMedicineTimings extends StatefulWidget {
- const EditMedicineTimings({Key? key}) : super(key: key);
+
+ var medicineTimings;
+ EditMedicineTimings({this.medicineTimings});
@override
State createState() => _EditMedicineTimingsState();
}
class _EditMedicineTimingsState extends State {
+ Time _time = Time(hour: 0, minute: 0, second: 0);
+ Time _wakeupTime = Time(hour: 0, minute: 0, second: 0);
+ Time _beforeBreakfastTime = Time(hour: 0, minute: 0, second: 0);
+ Time _afterBreakfastTime = Time(hour: 0, minute: 0, second: 0);
+ Time _beforeLunchTime = Time(hour: 0, minute: 0, second: 0);
+ Time _afterLunchTime = Time(hour: 0, minute: 0, second: 0);
+ Time _eveningTeaTime = Time(hour: 0, minute: 0, second: 0);
+ Time _beforeDinnerTime = Time(hour: 0, minute: 0, second: 0);
+ Time _afterDinnerTime = Time(hour: 0, minute: 0, second: 0);
+ Time _sleepTime = Time(hour: 0, minute: 0, second: 0);
+ DateTime wakeUp = DateTime.now();
+
+ String wakeUpfForApi='';
+ String _beforeBreakfastTimeForApi='';
+ String _afterBreakfastTimeForApi='';
+ String _beforeLunchTimeForApi='';
+ String _afterLunchTimeForApi='';
+ String _eveningTeaTimeForApi='';
+ String _beforeDinnerTimeForApi='';
+ String _afterDinnerTimeForApi='';
+ String _sleepTimeForApi='';
+
+ List timings = [
+ {'name': 'Wakeup'},
+ {'name': 'Before breakfast'},
+ {'name': 'After- breakfast'},
+ {'name': 'Before lunch'},
+ {'name': 'After lunch'},
+ {'name': 'Evening tea'},
+ {'name': 'Before dinner'},
+ {'name': 'After dinner'},
+ {'name': 'Sleep'}
+ ];
+
+ @override
+ void initState() {
+
+ wakeUpfForApi=widget.medicineTimings['wakeUp'];
+ _beforeBreakfastTimeForApi=widget.medicineTimings['beforeBreakfast'];
+ _afterBreakfastTimeForApi=widget.medicineTimings['afterBreakfast'];
+ _beforeLunchTimeForApi=widget.medicineTimings['beforeLunch'];
+ _afterLunchTimeForApi=widget.medicineTimings['afterLunch'];
+ _eveningTeaTimeForApi=widget.medicineTimings['eveningTea'];
+ _beforeDinnerTimeForApi=widget.medicineTimings['beforeDinner'];
+ _afterDinnerTimeForApi=widget.medicineTimings['afterDinner'];
+ _sleepTimeForApi=widget.medicineTimings['sleep'];
+
+
+ super.initState();
+ }
+
+
+ Widget textForSelectedTime(int index) {
+ if (index == 0) {
+ return
+ Text(
+ wakeUpfForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 1) {
+ return Text(
+ _beforeBreakfastTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 2) {
+ return Text(
+ _afterBreakfastTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 3) {
+ return Text(
+ _beforeLunchTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 4) {
+ return Text(
+ _afterLunchTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 5) {
+ return Text(
+ _eveningTeaTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 6) {
+ return Text(
+ _beforeDinnerTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 7) {
+ return Text(
+ _afterDinnerTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else if (index == 8) {
+ return Text(
+ _sleepTimeForApi,
+ style: TextStyle(color: Colors.black),
+ );
+ } else {
+ return Container();
+ }
+ }
+
+ void onTimeChanged(Time newTime, int index) {
+ setState(() {
+ _time=newTime;
+ });
+ if (index == 0) {
+ setState(() {
+ _wakeupTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _wakeupTime.hour, _wakeupTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ wakeUpfForApi=format.format(dt);
+ });
+ }
+ else if (index == 1) {
+ setState(() {
+ _beforeBreakfastTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _beforeBreakfastTime.hour, _beforeBreakfastTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _beforeBreakfastTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 2) {
+ setState(() {
+ _afterBreakfastTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _afterBreakfastTime.hour, _afterBreakfastTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _afterBreakfastTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 3) {
+ setState(() {
+ _beforeLunchTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _beforeLunchTime.hour, _beforeLunchTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _beforeLunchTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 4) {
+ setState(() {
+ _afterLunchTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _afterLunchTime.hour, _afterLunchTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _afterLunchTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 5) {
+ setState(() {
+ _eveningTeaTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _eveningTeaTime.hour, _eveningTeaTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _eveningTeaTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 6) {
+ setState(() {
+ _beforeDinnerTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _beforeDinnerTime.hour, _beforeDinnerTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _beforeDinnerTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 7) {
+ setState(() {
+ _afterDinnerTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _afterDinnerTime.hour, _afterDinnerTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _afterDinnerTimeForApi=format.format(dt);
+ });
+ }
+ else if (index == 8) {
+ setState(() {
+ _sleepTime = newTime;
+ });
+ final now = new DateTime.now();
+ final dt = DateTime(now.year, now.month, now.day, _sleepTime.hour, _sleepTime.minute);
+ final format = DateFormat.jm();
+ setState(() {
+ _sleepTimeForApi=format.format(dt);
+ });
+ }
+ }
+
+ void _selectedDateWithTime(DateTime newTime,int ind){
+ if (ind == 0) {
+ setState(() {
+ wakeUp = newTime;
+ String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(wakeUp);
+ // DateTime parseDate = new DateFormat("dd-MM-yyyy HH:mm:ss").parse(wakeUp);
+ print(formattedDate);
+ });
+ }
+ /* else if (ind == 1) {
+ setState(() {
+ _beforeBreakfastTime = newTime as Time ;
+ });
+ }
+ else if (ind == 2) {
+ setState(() {
+ _afterBreakfastTime = newTime as Time;
+ });
+ }
+ else if (ind == 3) {
+ setState(() {
+ _beforeLunchTime = newTime as Time;
+ });
+ }
+ else if (ind == 4) {
+ setState(() {
+ _afterLunchTime = newTime as Time;
+ });
+ }
+ else if (ind == 5) {
+ setState(() {
+ _eveningTeaTime = newTime as Time;
+ });
+ }
+ else if (ind == 6) {
+ setState(() {
+ _beforeDinnerTime = newTime as Time;
+ });
+ }
+ else if (ind == 7) {
+ setState(() {
+ _afterDinnerTime = newTime as Time;
+ });
+ }
+ else if (ind == 8) {
+ setState(() {
+ _sleepTime = newTime as Time;
+ });
+ }*/
+
+ }
+
+
+ Widget renderTimings(){
+ 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),
+ 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: () {
+ 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'),
+ width: 30,
+ height: 30,
+ ),
+ ),
+ textForSelectedTime(index)
+ ],
+ ),
+ ],
+ )),
+ );
+ })),
+ Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40),
+ child: Row(
+ children: [
+ ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: primaryColor, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () async {
+
+ AppSettings.preLoaderDialog(context);
+
+ bool isOnline = await AppSettings.internetConnectivity();
+ if(isOnline){
+ if(_time!=TimeOfDay(hour: 0,minute: 0)){
+
+
+ var payload = new Map();
+ payload["wakeUp"] = wakeUpfForApi;//_wakeupTime.hour.toString()+':'+_wakeupTime.minute.toString();
+ payload["beforeBreakfast"] = _beforeBreakfastTimeForApi;
+ payload["afterBreakfast"] = _afterBreakfastTimeForApi;
+ payload["beforeLunch"] = _beforeLunchTimeForApi;
+ payload["afterLunch"] = _afterLunchTimeForApi;
+ payload["eveningTea"] = _eveningTeaTimeForApi;
+ payload["beforeDinner"] = _beforeDinnerTimeForApi;
+ payload["afterDinner"] = _afterDinnerTimeForApi;
+ payload["sleep"] = _sleepTimeForApi;
+
+ var value = await AppSettings.updateMedicineTimings(payload);
+ var valueResponse = jsonDecode(value);
+
+ Navigator.of(context,rootNavigator: true).pop();
+ Navigator.pop(context);
+ //getMedicineTimingsList();
+ }
+ else{
+ Navigator.of(context,rootNavigator: true).pop();
+ AppSettings.longFailedToast('Please select timing' );
+ }
+
+ }
+ else{
+ Navigator.of(context,rootNavigator: true).pop();
+ AppSettings.longFailedToast('Please check internet' );
+ }
+
+ },
+ child: const Text('Update'),
+ ),
+ ],
+ )
+ )
+ ],
+ );
+ }
+
+
@override
Widget build(BuildContext context) {
- return const Placeholder();
+ return Scaffold(
+ appBar: AppSettings.appBar('Edit Medicine Timings'),
+ body: Container(
+ child: //Text(widget.medicineTimings.toString())
+ renderTimings(),
+ )
+ //medicineTimings.length==0?renderUi():renderTimings(),
+ );
}
}
diff --git a/lib/howareufeeling_today.dart b/lib/howareufeeling_today.dart
index 0a84392..44a1417 100644
--- a/lib/howareufeeling_today.dart
+++ b/lib/howareufeeling_today.dart
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
-import 'package:healthcare_user/report_my_self.dart';
+import 'package:healthcare_user/report_problem/report_my_self.dart';
class HowAreYouFellingToday extends StatefulWidget {
@@ -18,21 +18,179 @@ class _HowAreYouFellingTodayState extends State {
body: Container(
child: Padding(
padding: EdgeInsets.all(10),
- child: TextButton(
- child: const Text(
- 'Report a problem!',
- style: TextStyle(fontSize: 15,
- decoration: TextDecoration.underline,color: greyColor),
- ),
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const ReportMySelf()),
- );
- //signup screen
- },
- ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ /*TextButton(
+ child: const Text(
+ 'Report a problem!',
+ style: TextStyle(fontSize: 15,
+ decoration: TextDecoration.underline,color: greyColor),
+ ),
+ onPressed: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const ReportMySelf()),
+ );
+ //signup screen
+ },
+ ),*/
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Column(
+ children: [
+ GestureDetector(
+ child: Container(
+ width: MediaQuery.of(context).size.width * .20,
+ height: MediaQuery.of(context).size.height * .15,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ shape: BoxShape.circle,
+ image: DecorationImage(
+ image: AssetImage(
+ "images/happy.png"), // picked file
+ fit: BoxFit.fitWidth)),
+ ),
+ onTap: () {
+
+ },
+ ),
+ Text('Happy', style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),)
+ ],
+ ),
+ Column(
+ children: [
+ GestureDetector(
+ child: Container(
+ width: MediaQuery.of(context).size.width * .20,
+ height: MediaQuery.of(context).size.height * .15,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ shape: BoxShape.circle,
+ image: DecorationImage(
+ image: AssetImage(
+ "images/ok.png"), // picked file
+ fit: BoxFit.fitWidth)),
+ ),
+ onTap: () async {
+ showDialog(
+ //barrierDismissible: false,
+ context: context,
+ builder: (BuildContext context) => AlertDialog(
+ title: const Text('Would you like to leave a message?',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ actionsAlignment: MainAxisAlignment.spaceBetween,
+ actions: [
+ TextButton(
+ onPressed: ()async {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const ReportMySelf()),
+ );
+
+
+ },
+ child: const Text('Yes',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ TextButton(
+ onPressed: () {
+ Navigator.of(context).pop(true);
+ },
+ child: const Text('No',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ ],
+ ),
+ );
+ },
+ ),
+
+ Text('Ok', style: TextStyle(color: buttonColors,fontSize: 14,fontWeight: FontWeight.bold),)
+ ],
+ ),
+ Column(
+ children: [
+
+ GestureDetector(
+ child:
+ Container(
+ width: MediaQuery.of(context).size.width * .20,
+ height: MediaQuery.of(context).size.height * .15,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ shape: BoxShape.circle,
+ image: DecorationImage(
+ image: AssetImage(
+ "images/sad.png"), // picked file
+ fit: BoxFit.fitWidth)),
+ ),
+ onTap: () async {
+ showDialog(
+ //barrierDismissible: false,
+ context: context,
+ builder: (BuildContext context) => AlertDialog(
+ title: const Text('Would you like to leave a message?',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ actionsAlignment: MainAxisAlignment.spaceBetween,
+ actions: [
+ TextButton(
+ onPressed: ()async {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const ReportMySelf()),
+ );
+
+
+ },
+ child: const Text('Yes',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ TextButton(
+ onPressed: () {
+ Navigator.of(context).pop(true);
+ },
+ child: const Text('No',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ ],
+ ),
+ );
+ },
+ ),
+ Text('Sick', style: TextStyle(color: Colors.red,fontSize: 14,fontWeight: FontWeight.bold),)
+ ],
+ ),
+ ],
+ )
+ ],
+ )
),
),
);
diff --git a/lib/invitations/invitations.dart b/lib/invitations/invitations.dart
index 0f00666..3339308 100644
--- a/lib/invitations/invitations.dart
+++ b/lib/invitations/invitations.dart
@@ -75,7 +75,7 @@ class _InvitationsState extends State {
- payload["name"] = nameController.text;
+ payload["name"] = AppSettings.userName;
payload["phone"] = mobileNumberController.text;
payload["dateAndTime"] = formattedDate;
bool invitationStatus = await AppSettings.inviteFriend(payload);
@@ -148,7 +148,7 @@ class _InvitationsState extends State {
}
}
- payload["name"] =_contact!.fullName;
+ payload["name"] =AppSettings.userName;
payload["phone"] = stringAfterRemovingWhiteSpace;
payload["dateAndTime"] = formattedDate;
bool invitationStatus = await AppSettings.inviteFriend(payload);
diff --git a/lib/models/all_problems_model.dart b/lib/models/all_problems_model.dart
new file mode 100644
index 0000000..0904ca3
--- /dev/null
+++ b/lib/models/all_problems_model.dart
@@ -0,0 +1,33 @@
+import 'package:intl/intl.dart';
+
+class AllProblemsModel {
+ String problem='';
+ String audio='';
+ String description='';
+ String video='';
+ String date='';
+ String problemId='';
+ List picture = [];
+ String image='';
+ bool isAudioButtonEnabled=false;
+ DateTime dateForFilter=new DateTime.now();
+ String dateNew='';
+
+ AllProblemsModel();
+
+ factory AllProblemsModel.fromJson(Map json){
+ AllProblemsModel rtvm = new AllProblemsModel();
+
+ rtvm.problem = json['name'] ?? '';
+ rtvm.audio = json['audio'] ?? '';
+ rtvm.description = json['description'] ?? '';
+ rtvm.video = json['video'] ?? '';
+ rtvm.date = json['date'] ?? '';
+ rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
+ rtvm.problemId = json['reportId'] ?? '';
+ rtvm.picture = json['picture'] ?? [];
+ rtvm.image=json['picture'][0]['url']??'';
+ return rtvm;
+ }
+
+}
\ No newline at end of file
diff --git a/lib/models/bmi_history_model.dart b/lib/models/bmi_history_model.dart
index a2c10c2..efe27fc 100644
--- a/lib/models/bmi_history_model.dart
+++ b/lib/models/bmi_history_model.dart
@@ -1,4 +1,3 @@
-import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@@ -7,8 +6,11 @@ class BmiHistoryModel {
String height= '';
String weight= '';
String date= '';
+ String actualDate= '';
String displayDate='';
DateTime dateForFilter=new DateTime.now();
+ String bmiInfoId = '';
+ String bmiText = '';
var number1;
var number2;
@@ -18,7 +20,7 @@ class BmiHistoryModel {
factory BmiHistoryModel.fromJson(Map json){
BmiHistoryModel rtvm = new BmiHistoryModel();
/*"heightUnit": "feet",
- "weightUnit": "kg",
+ "weightUnit": "kg",oh
"_id": "6493fe48eca67b71b8444e24",
"bmiinfoid": "BMI1687420488845468",
"customerId": "AHSUSNE2",
@@ -30,18 +32,26 @@ class BmiHistoryModel {
"updatedAt": "2023-06-22T07:54:48.847Z",*/
rtvm.bmiValue = json['bmivalue'].toString() ?? '';
+ rtvm.bmiInfoId = json['bmiinfoid'].toString() ?? '';
rtvm.height = json['height'].toString() ?? '';
rtvm.weight = json['weight'].toString() ?? '';
rtvm.number1 = double.parse( rtvm.bmiValue);
rtvm.number2 = double.parse( rtvm.bmiValue);
rtvm.date = json['createdAt'].toString() ?? '';
-
- //DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
- DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
- var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
- rtvm.dateForFilter=parseDate;
- var outputDate = outputFormat.format(parseDate);
- rtvm.displayDate=outputDate;
+ rtvm.actualDate = json['date'].toString() ?? '';
+ rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
+ if(double.parse(rtvm.bmiValue)<18.5){
+ rtvm.bmiText='Underweight';
+ }
+ else if(double.parse(rtvm.bmiValue)>=18.5&&double.parse(rtvm.bmiValue)<=24.9){
+ rtvm.bmiText='Normal weight';
+ }
+ else if(double.parse(rtvm.bmiValue)>=25&&double.parse(rtvm.bmiValue)<=29.9){
+ rtvm.bmiText='Overweight';
+ }
+ else if(double.parse(rtvm.bmiValue)>=30){
+ rtvm.bmiText='Obesity';
+ }
return rtvm;
diff --git a/lib/models/bp_history_model.dart b/lib/models/bp_history_model.dart
index 716e39d..49ab801 100644
--- a/lib/models/bp_history_model.dart
+++ b/lib/models/bp_history_model.dart
@@ -7,7 +7,9 @@ class BPHistoryModel {
String systolic= '';
String diastolic= '';
String date= '';
+ String bpId= '';
String displayDate='';
+ String actualDate='';
DateTime dateForFilter=new DateTime.now();
@@ -15,29 +17,15 @@ class BPHistoryModel {
factory BPHistoryModel.fromJson(Map json){
BPHistoryModel rtvm = new BPHistoryModel();
- /*"heightUnit": "feet",
- "weightUnit": "kg",
- "_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.bpText = json['bpCategory'].toString() ?? '';
rtvm.systolic = json['Systolic'].toString() ?? '';
rtvm.diastolic = json['Diastolic'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
+ rtvm.actualDate = json['date'].toString() ?? '';
+ rtvm.bpId= json['bpinfoid'].toString() ?? '';
- //DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
- DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
- var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
- rtvm.dateForFilter=parseDate;
- var outputDate = outputFormat.format(parseDate);
- rtvm.displayDate=outputDate;
+ rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
diff --git a/lib/models/sugar_history_model.dart b/lib/models/sugar_history_model.dart
index e3dfe6c..d977bab 100644
--- a/lib/models/sugar_history_model.dart
+++ b/lib/models/sugar_history_model.dart
@@ -9,6 +9,8 @@ class SugarHistoryModel {
String postPrandial= '';
String date= '';
String displayDate='';
+ String actualDate='';
+ String sugarInfoId='';
DateTime dateForFilter=new DateTime.now();
@@ -16,30 +18,18 @@ class SugarHistoryModel {
factory SugarHistoryModel.fromJson(Map json){
SugarHistoryModel rtvm = new SugarHistoryModel();
- /*"heightUnit": "feet",
- "weightUnit": "kg",
- "_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.sugartText = json['sugarCategory'].toString() ?? '';
rtvm.sugarValue = json['sugarValue'].toString() ?? '';
rtvm.fasting = json['fasting'].toString() ?? '';
rtvm.postPrandial = json['postPrandial'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
+ rtvm.actualDate = json['date'].toString() ?? '';
+ rtvm.sugarInfoId = json['sugarinfoid'].toString() ?? '';
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
- DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
- var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
- rtvm.dateForFilter=parseDate;
- var outputDate = outputFormat.format(parseDate);
- rtvm.displayDate=outputDate;
+ rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
diff --git a/lib/my_health.dart b/lib/my_health.dart
index 991a372..90913ad 100644
--- a/lib/my_health.dart
+++ b/lib/my_health.dart
@@ -422,68 +422,74 @@ class _MyHealthState extends State {
],
),
)),
- Card(
+ Visibility(
+ visible: false,
+ child: Card(
child: Padding(
- padding: EdgeInsets.all(3),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width * .30,
- child: Text('Cholesterol'), ),
+ padding: EdgeInsets.all(3),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width * .30,
+ child: Text('Cholesterol'), ),
- IconButton(
- onPressed: () {},
- icon: Icon(
- Icons.add,
- color: greyColor,
- ),
- )
- ],
- ),
- )),
- Card(
- child: Padding(
- padding: EdgeInsets.all(3),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width * .30,
- child: Text('Habbits'),
+ IconButton(
+ onPressed: () {},
+ icon: Icon(
+ Icons.add,
+ color: greyColor,
+ ),
+ )
+ ],
),
-
- IconButton(
- onPressed: () {},
- icon: Icon(
- Icons.add,
- color: greyColor,
- ),
- )
- ],
- ),
- )),
- Card(
+ )),),
+ Visibility(
+ visible: false,
+ child: Card(
child: Padding(
- padding: EdgeInsets.all(3),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width * .30,
- child: Text('Allergies'),
+ padding: EdgeInsets.all(3),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width * .30,
+ child: Text('Habbits'),
+ ),
+
+ IconButton(
+ onPressed: () {},
+ icon: Icon(
+ Icons.add,
+ color: greyColor,
+ ),
+ )
+ ],
),
+ ))),
+ Visibility(
+ visible: false,
+ child: Card(
+ child: Padding(
+ padding: EdgeInsets.all(3),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width * .30,
+ child: Text('Allergies'),
+ ),
- IconButton(
- onPressed: () {},
- icon: Icon(
- Icons.add,
- color: greyColor,
- ),
- )
- ],
- ),
- ))
+ IconButton(
+ onPressed: () {},
+ icon: Icon(
+ Icons.add,
+ color: greyColor,
+ ),
+ )
+ ],
+ ),
+ )))
],
),
),
diff --git a/lib/my_medicine_timings.dart b/lib/my_medicine_timings.dart
index 30c06c0..b76c879 100644
--- a/lib/my_medicine_timings.dart
+++ b/lib/my_medicine_timings.dart
@@ -1,4 +1,5 @@
import 'dart:convert';
+import 'package:healthcare_user/edit_medicine_timings.dart';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
@@ -321,38 +322,43 @@ class _MyMedicineTimingsState extends State {
//padding: EdgeInsets.all(8),
itemCount: timings.length,
itemBuilder: (BuildContext context, int index) {
- return 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(),
+ return GestureDetector(
+ onTap: (){
+ AppSettings.longSuccessToast('Please click on edit button');
+ },
+ 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(),
+ ),
),
- ),
- GestureDetector(
- onTap: () {
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
+ GestureDetector(
+ onTap: () {
+ },
+ child: Image(
+ image: AssetImage('images/time.png'),
+ width: 30,
+ height: 30,
+ ),
),
- ),
- textForSelectedTime(index)
- ],
- ),
- ],
- )),
+ textForSelectedTime(index)
+ ],
+ ),
+ ],
+ )),
+ ),
);
})),
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 40),
@@ -365,10 +371,14 @@ class _MyMedicineTimingsState extends State {
),
onPressed: () async {
- editTimingsDialog();
- /*Navigator.push(context, MaterialPageRoute(builder: (context) => EditMedicineTimings())).then((value) {
+ //editTimingsDialog();
+
+ Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new EditMedicineTimings(medicineTimings:medicineTimings,))).then((value) {
getMedicineTimingsList();
- });*/
+ });
},
child: const Text('Edit'),
),
@@ -616,265 +626,6 @@ class _MyMedicineTimingsState extends State {
return Scaffold(
appBar: AppSettings.appBar('My medicine timings'),
body: medicineTimings.length==0?renderUi():renderTimings(),
- /*Container(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
-
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(height: 10,),
- Text('Wakeup'),
- SizedBox(height: 10,),
- Text('Before breakfast'),
- SizedBox(height: 15,),
- Text('After breakfast'),
- SizedBox(height: 15,),
- Text('Before lunch'),
- SizedBox(height: 15,),
- Text('After lunch'),
- SizedBox(height: 15,),
- Text('Evening Tea'),
- SizedBox(height: 15,),
- Text('Before dinner'),
- SizedBox(height: 15,),
- Text('After dinner'),
- SizedBox(height: 15,),
- Text('Sleep'),
- ],
- ),
- Column(
- children: [
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
-
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- SizedBox(height: 5,),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
-
- SizedBox(height: 5,),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- showPicker(
- showSecondSelector: true,
- context: context,
- value: _time,
- onChange: onTimeChanged,
- minuteInterval: TimePickerInterval.FIVE,
- // Optional onChange to receive value as DateTime
- onChangeDateTime: (DateTime dateTime) {
- // print(dateTime);
- debugPrint("[debug datetime]: $dateTime");
- },
- ),
- );
- },
- child: Image(
- image: AssetImage('images/time.png'),
- width: 30,
- height: 30,
- ),
- ),
- ],
- ),
-
-
- ],
- ),
- ],
- ),
- )
- )*/
);
}
}
diff --git a/lib/prescriptions/oreder_medicines.dart b/lib/prescriptions/oreder_medicines.dart
index 7e98174..5ea4ad2 100644
--- a/lib/prescriptions/oreder_medicines.dart
+++ b/lib/prescriptions/oreder_medicines.dart
@@ -1036,6 +1036,55 @@ class _OrderMedicinesState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
+ Padding(
+ padding: EdgeInsets.all(10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Problem: ' +
+ widget.prescriptionDetails.problem
+ .toString()
+ .toUpperCase(),
+ style: problemTextStyle()),
+ Text(
+ widget.prescriptionDetails.doctorName
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ Text(
+ widget.prescriptionDetails.hospitalName
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ Text(widget.prescriptionDetails.date.toString().toUpperCase(),
+ style: valuesTextStyle()),
+ Text(
+ widget.prescriptionDetails.patient_name
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ Row(
+ children: [
+ Text(
+ widget.prescriptionDetails.gender
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(
+ width: MediaQuery.of(context).size.width * .05,
+ ),
+ Text(
+ widget.prescriptionDetails.age
+ .toString()
+ .toUpperCase() +
+ " Yrs",
+ style: valuesTextStyle()),
+ ],
+ )
+ ],
+ ),
+ ),
Padding(
padding: EdgeInsets.all(10),
child: prescriptions(widget.prescriptionDetails),
@@ -1260,7 +1309,10 @@ class _OrderMedicinesState extends State {
items: AreaItems.map((String items) {
return DropdownMenuItem(
value: items,
- child: Text(items,style: TextStyle(fontSize: 12),),
+ child: Text(
+ items,
+ style: TextStyle(fontSize: 12),
+ ),
);
}).toList(),
// After selecting the desired option,it will
diff --git a/lib/prescriptions/prescriptions.dart b/lib/prescriptions/prescriptions.dart
index 36e1661..d4f687f 100644
--- a/lib/prescriptions/prescriptions.dart
+++ b/lib/prescriptions/prescriptions.dart
@@ -656,17 +656,11 @@ class _PrescriptionsState extends State {
payload["url"] = obj.prescriptionImages[index]['url'];
try {
- var res = await AppSettings
- .deleteRecordsNew(
- payload,
- obj.recordId);
+ var res = await AppSettings.deleteRecordsNew(payload, obj.recordId);
print(jsonDecode(res));
- Navigator.of(context,
- rootNavigator: true)
- .pop();
+ Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).pop(true);
- AppSettings.longSuccessToast(
- "Image deleted Successfully");
+ AppSettings.longSuccessToast("Image deleted Successfully");
setState(() {
obj.prescriptionImages =
jsonDecode(
diff --git a/lib/report_my_self.dart b/lib/report_my_self.dart
deleted file mode 100644
index 1a1abae..0000000
--- a/lib/report_my_self.dart
+++ /dev/null
@@ -1,219 +0,0 @@
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:healthcare_user/common/settings.dart';
-import 'package:image_picker/image_picker.dart';
-
-class ReportMySelf extends StatefulWidget {
- const ReportMySelf({Key? key}) : super(key: key);
-
- @override
- State createState() => _ReportMySelfState();
-}
-
-class _ReportMySelfState extends State {
-
- TextEditingController problemNameController = TextEditingController();
- TextEditingController descriptionController = TextEditingController();
- final ImagePicker _picker = ImagePicker();
- String videoUrl='';
-
- Future takeVideoFromCamera() async {
- try {
- final image = await _picker.pickVideo(source: ImageSource.camera);
- if (image == null) return;
- final imageTemp = File(image.path);
- AppSettings.preLoaderDialog(context);
- var res = await AppSettings.uploadVideoInReportMySelf(image);
- print(jsonDecode(res));
- Navigator.of(context, rootNavigator: true).pop();
- setState(() {
- videoUrl = jsonDecode(res)['picture'];
- });
- } on PlatformException catch (e) {
- print('Failed to pick video: $e');
- }
- }
-
- Future pickVideoFromGallery() async {
- try {
- final image = await _picker.pickVideo(source: ImageSource.gallery);
- if (image == null) return;
- final imageTemp = File(image.path);
-
- AppSettings.preLoaderDialog(context);
- var res = await AppSettings.uploadVideoInReportMySelf(image);
- print(jsonDecode(res));
- Navigator.of(context, rootNavigator: true).pop();
- setState(() {
- videoUrl = jsonDecode(res)['picture'];
- });
- } on PlatformException catch (e) {
- print('Failed to pick video: $e');
- }
- }
-
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppSettings.appBar('Report MySelf'),
- body: Container(
- child: Padding(
- padding: EdgeInsets.all(10),
- child:Column(
- children: [
- Container(
- padding: const EdgeInsets.all(10),
- child: TextFormField(
- cursorColor: greyColor,
- controller: problemNameController,
- keyboardType: TextInputType.number,
- decoration: const InputDecoration(
- prefixIcon: Icon(
- Icons.phone,
- color: greyColor,
- ),
- border: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor)),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(color:primaryColor),
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- labelText: 'Enter problem name',
- labelStyle: TextStyle(
- color: greyColor, //<-- SEE HERE
- ),
- ),
- ),
- ),
- const SizedBox(
- height: 15,
- ),
- Container(
- padding: const EdgeInsets.all(10),
- child: TextFormField(
- cursorColor: greyColor,
- controller: descriptionController,
- keyboardType: TextInputType.number,
- decoration: const InputDecoration(
- prefixIcon: Icon(
- Icons.description,
- color: greyColor,
- ),
- border: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor)),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(color:primaryColor),
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(color: primaryColor),
- ),
- labelText: 'Description',
- labelStyle: TextStyle(
- color: greyColor, //<-- SEE HERE
- ),
- ),
- ),
- ),
- Row(
- children: [
-
- IconButton(
- icon: Icon(
- Icons.audio_file,
- color: primaryColor,
- ),
- onPressed: () {
-
- },
- ),
- SizedBox(width: 10,),
- IconButton(
- icon: Icon(
- Icons.video_camera_back_rounded,
- color: primaryColor,
- ),
- onPressed: () {
- showModalBottomSheet(
- context: context,
- builder: (BuildContext context) {
- return SizedBox(
- height: 200,
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- GestureDetector(
- child: Icon(
- Icons.camera_alt_outlined,
- size: 100,
- color: greyColor,
- ),
- onTap: () async {
- await takeVideoFromCamera();
- Navigator.pop(context);
- },
- ),
- SizedBox(
- width: MediaQuery.of(context).size.width * .20,
- ),
- GestureDetector(
- child: Icon(
- Icons.photo,
- size: 100,
- color: greyColor,
- ),
- onTap: () async {
- await pickVideoFromGallery();
- Navigator.pop(context);
- },
- ),
- ],
- ),
- ),
- );
- });
- },
- ),
- SizedBox(width: 10,),
- IconButton(
- icon: Icon(
- Icons.image,
- color: primaryColor,
- ),
- onPressed: () {
-
- },
- ),
- ],
- ),
- Visibility(
- visible: videoUrl != '',
- child: Padding(
- padding: EdgeInsets.fromLTRB(10,0,0,0),
- child: Container(
- width: MediaQuery.of(context).size.width * .18,
- height: MediaQuery.of(context).size.height * .10,
- decoration: BoxDecoration(
- shape: BoxShape.rectangle,
- image: DecorationImage(
- image: NetworkImage(videoUrl) as ImageProvider, // picked file
- fit: BoxFit.contain)),
- ),
-
- ),
- ),
-
-
- ],
- ),
- ),
- ),
- );
- }
-}
diff --git a/lib/report_problem/all_problems.dart b/lib/report_problem/all_problems.dart
new file mode 100644
index 0000000..1813cce
--- /dev/null
+++ b/lib/report_problem/all_problems.dart
@@ -0,0 +1,1079 @@
+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/all_problems_model.dart';
+import 'package:healthcare_user/report_problem/report_my_self.dart';
+import 'package:healthcare_user/report_problem/video_file.dart';
+import 'package:photo_view/photo_view.dart';
+import 'package:intl/intl.dart';
+import 'package:flutter_sound/flutter_sound.dart';
+import 'package:assets_audio_player/assets_audio_player.dart';
+
+class AllProblemsReportMyself extends StatefulWidget {
+ const AllProblemsReportMyself({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _AllProblemsReportMyselfState();
+}
+
+class _AllProblemsReportMyselfState extends State {
+
+
+ List allProblemsList = [];
+ List allProblemsListOriginal = [];
+ bool isProblemDataLoading = false;
+ bool isSereverIssue = false;
+ TextEditingController searchController = TextEditingController();
+ TextEditingController dateInput = TextEditingController();
+ TextEditingController fromdateController = TextEditingController();
+ TextEditingController todateController = TextEditingController();
+ String dropdownSearchType = 'All';
+ bool isAudioButtonPressed=false;
+ bool _playAudio=false;
+ final recordingPlayer = AssetsAudioPlayer();
+ var typeOfSearchItems = [
+ 'All',
+ 'Problem',
+ 'Date',
+ ];
+
+ Future getAllProblemsReportMyself() async {
+ isProblemDataLoading=true;
+ try {
+ var response = await AppSettings.getAllReportProblemDetalis();
+
+ setState(() {
+ allProblemsListOriginal = ((jsonDecode(response)) as List)
+ .map((dynamic model) {
+ return AllProblemsModel.fromJson(model);
+ }).toList();
+ allProblemsList=allProblemsListOriginal.reversed.toList();
+ isProblemDataLoading = false;
+ });
+ } catch (e) {
+ setState(() {
+ isProblemDataLoading = false;
+ isSereverIssue = true;
+ });
+ }
+ }
+
+ Future getAllProblemsReportMyselfByProblem(var problem) async {
+
+ isProblemDataLoading=true;
+ try {
+ var response = await AppSettings.getAllReportProblemDetalis();
+
+ setState(() {
+ allProblemsListOriginal = ((jsonDecode(response)) as List)
+ .map((dynamic model) {
+ return AllProblemsModel.fromJson(model);
+ }).toList();
+ allProblemsList=allProblemsListOriginal.reversed.toList();
+ allProblemsList= allProblemsListOriginal.where(
+ (x) => x.problem.toString().toLowerCase().contains(problem.toString().toLowerCase())
+ ).toList();
+ isProblemDataLoading = false;
+ });
+ } catch (e) {
+ setState(() {
+ isProblemDataLoading = false;
+ isSereverIssue = true;
+ });
+ }
+ }
+
+
+ Future getAllProblemsReportMyselfByDateRange(var fromDate,var toDate) async {
+ isProblemDataLoading = true;
+
+ try {
+ var response = await AppSettings.getAllReportProblemDetalis();
+
+ setState(() {
+ allProblemsListOriginal = ((jsonDecode(response)) as List)
+ .map((dynamic model) {
+ return AllProblemsModel.fromJson(model);
+ }).toList();
+ allProblemsList=allProblemsListOriginal.reversed.toList();
+ var dateToCheck = DateTime.now().add(Duration(days: -1));
+
+ allProblemsList = allProblemsListOriginal.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);
+ //reportsList=reportsListOriginal.reversed.toList();
+ }).toList();
+
+ /*if( dateToCheck.isAfter(startDate) && dateToCheck.isBefore(endDate))
+ {
+ print("dateToCheck is between now and lastYear");
+ }
+ else
+ {
+ print("dateToCheck is not between now and lastYear");
+ }*/
+
+
+ isProblemDataLoading = false;
+ });
+ } catch (e) {
+ setState(() {
+ isProblemDataLoading = false;
+ isSereverIssue = true;
+ });
+ }
+ }
+
+
+ @override
+ void initState() {
+ getAllProblemsReportMyself();
+ var now = new DateTime.now();
+ String formattedDate = DateFormat('dd-MM-yyyy').format(now);
+ fromdateController.text=formattedDate;
+ todateController.text=formattedDate;
+ super.initState();
+ }
+
+
+ showPicDialog(var imageUrl){
+ return showDialog(
+ context: context,
+ barrierDismissible: false,
+ builder: (BuildContext context) {
+ return StatefulBuilder(
+ builder: (BuildContext context, StateSetter setState) {
+ return AlertDialog(
+ title: const Text(''),
+ content: SingleChildScrollView(
+ child: ListBody(
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width * .10,
+ height: MediaQuery.of(context).size.height * .50,
+ child: PhotoView(
+ imageProvider: NetworkImage(imageUrl) as ImageProvider,
+ maxScale: PhotoViewComputedScale.contained * 4.0,
+ minScale: PhotoViewComputedScale.contained,
+ initialScale: PhotoViewComputedScale.contained,
+ basePosition: Alignment.center,
+
+ )
+ )
+ ],
+ ),
+ ),
+ actions: [
+ TextButton(
+ child: Text('Close', style: textButtonStyle()),
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
+ ],
+ );
+ });
+ },
+ );
+ }
+
+
+ Widget findings(var obj){
+ return Container(
+ width: double.infinity,
+ height: MediaQuery.of(context).size.height * .20,
+ child: ListView.builder(
+ scrollDirection: Axis.horizontal,
+ itemCount: obj.findingsImages.length,
+ itemBuilder: (context, index) {
+ return Column(
+ children: [
+ Card(
+ child: GestureDetector(
+ onTap: (){
+ /*showPicDialog(obj.findingsImages[index]['url']);*/
+ Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new ImageZoomPage(imageName:'Findings',imageDetails:obj.findingsImages[index]['url'])));
+ },
+ child: Container(
+ width: MediaQuery.of(context).size.width *
+ .30,
+ height:
+ MediaQuery.of(context).size.height *
+ .15,
+ decoration: BoxDecoration(
+ shape: BoxShape.rectangle,
+ image: DecorationImage(
+ image: NetworkImage(
+ obj.findingsImages[index]['url'])
+ as ImageProvider, // picked file
+ fit: BoxFit.fill)),
+ ),
+ ),
+ ),
+ /*Expanded(child:IconButton(
+ icon: const Icon(Icons.remove,color: Colors.red,),
+
+ onPressed: () async{
+
+ },
+ ),)*/
+ ],
+ );
+ }),
+ );
+ }
+
+ Widget reports(var obj){
+
+ return Container(
+ width: double.infinity,
+ height: MediaQuery.of(context).size.height * .20,
+ child: ListView.builder(
+ scrollDirection: Axis.horizontal,
+ itemCount: obj.reportImages.length,
+ itemBuilder: (context, index) {
+ return Column(
+ children: [
+ Card(
+ child: GestureDetector(
+ onTap: (){
+ //showPicDialog(obj.reportImages[index]['url']);
+
+ Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new ImageZoomPage(imageName:'Reports',imageDetails:obj.reportImages[index]['url'])));
+
+ },
+ child: Container(
+ width: MediaQuery.of(context).size.width * .30,
+ height: MediaQuery.of(context).size.height * .15,
+ decoration: BoxDecoration(
+ shape: BoxShape.rectangle,
+ image: DecorationImage(
+ image: NetworkImage(
+ obj.reportImages[index]
+ ['url'])
+ as ImageProvider, // picked file
+ fit: BoxFit.fill)),
+ ),
+ ),
+ ),
+ /*Expanded(child:IconButton(
+ icon: const Icon(Icons.remove,color: Colors.red,),
+
+ onPressed: () async{
+
+ },
+ ),)*/
+ ],
+ );
+ }),
+ );
+
+ }
+
+
+
+ Future playFunc(var audio) async {
+ recordingPlayer.open(
+ Audio.file(audio),
+ autoStart: true,
+ showNotification: true,
+ );
+ }
+
+ Future stopPlayFunc() async {
+ recordingPlayer.stop();
+ }
+
+ Widget _filtereddata(){
+ if(allProblemsList.length!=0){
+ return ListView.builder(
+ itemCount: allProblemsList.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,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+
+ Container(
+ width: MediaQuery.of(context).size.width * .60,
+ child:
+ Column(
+ children: [
+ Row(
+ children: [
+ Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Problem',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'Description',
+ style: labelTextStyle(),
+ ),
+
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ 'Date',
+ style: labelTextStyle(),
+ ),
+ ],
+ ),
+ SizedBox(width:MediaQuery.of(context).size.width * .01,),
+ Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ ':',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ ':',
+ style: labelTextStyle(),
+ ),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ ':',
+ style: labelTextStyle(),
+ ),
+ ],
+ ),
+ SizedBox(width:MediaQuery.of(context).size.width * .01,),
+ Expanded(child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ allProblemsList[index]
+ .problem
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ allProblemsList[index].description
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ SizedBox(height:MediaQuery.of(context).size.height * .01,),
+ Text(
+ allProblemsList[index]
+ .date
+ .toString()
+ .toUpperCase(),
+ style: valuesTextStyle()),
+ ],
+ ),)
+ ],
+ ),
+ Row(
+ children: [
+ Visibility(
+ visible: allProblemsList[index].audio!='',
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: primaryColor, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () async {
+ setState(() {
+
+
+ if(!allProblemsList[index].isAudioButtonEnabled){
+ setState(() {
+ allProblemsList[index].isAudioButtonEnabled=true;
+ });
+ }
+ else{
+ setState(() {
+ allProblemsList[index].isAudioButtonEnabled=false;
+ });
+ }
+ });
+ },
+ child: const Text('Audio'),
+ ),),
+ Visibility(
+ visible: allProblemsList[index].audio!='',
+ child: SizedBox(
+ width:MediaQuery.of(context).size.width * .01,
+ ) ,),
+ Visibility(
+ visible: allProblemsList[index].video!='',
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: primaryColor, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () async {
+ Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new ProblemVideo(videoUrl:allProblemsList[index].video)));
+
+ },
+ child: const Text('Video'),
+ ),),
+
+ Visibility(
+ visible: allProblemsList[index].video!='',
+ child: SizedBox(
+ width:MediaQuery.of(context).size.width * .01,
+ ) ,),
+ Visibility(
+ visible: allProblemsList[index].image!='',
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: primaryColor, // background
+ onPrimary: Colors.white, // foreground
+ ),
+ onPressed: () async {
+ Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new ImageZoomPage(imageName:'Problem Picture',imageDetails:allProblemsList[index].image)));
+
+ },
+ child: const Text('Image'),
+ ),),
+
+ ],
+ ),
+ Visibility(
+ visible: allProblemsList[index].isAudioButtonEnabled,
+ child:Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ ElevatedButton.icon(
+ style:
+ ElevatedButton.styleFrom(elevation: 9.0, primary: Colors.red),
+ onPressed: () {
+ setState(() {
+ _playAudio = !_playAudio;
+ });
+ if (_playAudio) playFunc(allProblemsList[index].audio);
+ if (!_playAudio) stopPlayFunc();
+ },
+ icon: _playAudio
+ ? Icon(
+ Icons.stop,
+ )
+ : Icon(Icons.play_arrow),
+ label: _playAudio
+ ? Text(
+ "Stop",
+ style: TextStyle(
+ fontSize: 28,
+ ),
+ )
+ : Text(
+ "Play",
+ style: TextStyle(
+ fontSize: 28,
+ ),
+ ),
+ ),
+ ],
+ )
+ )
+
+ ],
+ )
+ ),
+
+
+ Visibility(
+ visible:false,
+ child: Expanded(child:IconButton(
+ icon: const Icon(Icons.edit,color: primaryColor,),
+ onPressed: () {
+
+ /*Navigator.push(
+ context,
+ new MaterialPageRoute(
+ builder: (__) => new UpdateReport(reportDetails:allProblemsList[index]))).then((value) {
+ getAllProblemsReportMyself();
+ });*/
+ },
+ ),),
+ ),
+ Expanded(child:IconButton(
+ icon: const Icon(Icons.delete,color: primaryColor,),
+
+ onPressed: () async{
+ showDialog(
+ //if set to true allow to close popup by tapping out of the popup
+ //barrierDismissible: false,
+ context: context,
+ builder: (BuildContext context) => AlertDialog(
+ title: const Text('Do you want to delete Record?',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ actionsAlignment: MainAxisAlignment.spaceBetween,
+ actions: [
+ TextButton(
+ onPressed: ()async {
+
+ bool deleteTankStatus = await AppSettings.deleteReportMySelfProblem(allProblemsList[index].problemId);
+
+
+ if(deleteTankStatus){
+ getAllProblemsReportMyself();
+ AppSettings.longSuccessToast('Problem deleted successfully');
+ Navigator.of(context).pop(true);
+
+ }
+ else{
+ AppSettings.longFailedToast('Problem deletion failed');
+ Navigator.of(context).pop(true);
+ }
+ },
+ child: const Text('Yes',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ TextButton(
+ onPressed: () {
+ Navigator.of(context).pop(true);
+ },
+ child: const Text('No',
+ style: TextStyle(
+ color: primaryColor,
+ fontSize: 20,
+ )),
+ ),
+ ],
+ ),
+ );
+
+
+
+ },
+ ),)
+
+ ],
+
+ ),
+
+ ],
+ ),
+ ),
+ ),
+ );
+ });
+ }
+ else{
+ return Padding(padding: EdgeInsets.fromLTRB(60,10,60,10),
+ child: Column(
+ children: [
+ Text('No problems found related to your search'),
+ SizedBox(
+ height: 20,
+ ),
+ CircleAvatar(
+ backgroundColor: Colors.red,
+ radius: 30,
+ child: const Icon(
+ Icons.info,
+ color: Colors.white,
+ ),
+ )
+ ],
+ ),);
+
+ }
+ }
+
+
+ Widget _allreports(){
+
+ if(allProblemsListOriginal.length!=0){
+
+ return Padding(padding:EdgeInsets.all(10),
+ child:Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Container(
+ child: DropdownButtonFormField(
+ // Initial Value
+ value: dropdownSearchType,
+ isExpanded: true,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.search,
+ color: greyColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: greyColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: greyColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: greyColor),
+ ),
+ labelText: 'Search By',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+
+ hint: Text('Select Search Type'),
+ // Down Arrow Icon
+ icon: const Icon(Icons.keyboard_arrow_down),
+
+ // Array list of items
+ items: typeOfSearchItems.map((String items) {
+ return DropdownMenuItem(
+ value: items,
+ child: Text(items),
+ );
+ }).toList(),
+ // After selecting the desired option,it will
+ // change button value to selected value
+ onChanged: (String? newValue) {
+ setState(() {
+ dropdownSearchType = newValue!;
+ });
+ },
+ ),
+ ),
+ SizedBox(height: MediaQuery.of(context).size.height * .01,),
+ Visibility(
+ visible:dropdownSearchType.toString().toLowerCase()=='problem' ,
+ child: Container(
+ height: MediaQuery.of(context).size.height * .07,
+ child: Center(child: TextField(
+
+ cursorColor: primaryColor,
+ controller: searchController,
+ onChanged: (string) {
+ if(string.length>=1){
+ getAllProblemsReportMyselfByProblem(string);
+ }
+ else{
+ getAllProblemsReportMyself();
+ }
+ },
+ decoration: InputDecoration(
+ prefixIcon: Icon(
+ Icons.search,
+ color: primaryColor,
+ ),
+ /*suffixIcon: Icon(
+ Icons.clear,
+ color: greyColor,
+ ),*/
+ suffixIcon: searchController.text!=''?IconButton(
+ icon: Icon(
+ Icons.clear,
+ color: Colors.red,
+ ),
+ onPressed: () {
+ setState(() {
+ searchController.text='';
+ });
+ getAllProblemsReportMyself();
+ },
+ ):IconButton(
+ icon: Icon(
+ Icons.clear,
+ color: Colors.transparent,
+ ),
+ onPressed: () {
+ },
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ //labelText: 'Search by phone number',
+ hintText: 'Search by problem',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+ ),)
+ ),),
+ Visibility(
+ visible:dropdownSearchType.toString().toLowerCase()=='doctor' ,
+ child: Container(
+ height: MediaQuery.of(context).size.height * .07,
+ child: Center(child: TextField(
+
+ cursorColor: primaryColor,
+ controller: searchController,
+ onChanged: (string) {
+ if(string.length>=1){
+ //getRecordsByDoctorName(string);
+ }
+ else{
+ getAllProblemsReportMyself();
+ }
+ },
+ decoration: InputDecoration(
+ prefixIcon: Icon(
+ Icons.search,
+ color: primaryColor,
+ ),
+ /*suffixIcon: Icon(
+ Icons.clear,
+ color: greyColor,
+ ),*/
+ suffixIcon: searchController.text!=''?IconButton(
+ icon: Icon(
+ Icons.clear,
+ color: Colors.red,
+ ),
+ onPressed: () {
+ setState(() {
+ searchController.text='';
+ });
+ getAllProblemsReportMyself();
+ },
+ ):IconButton(
+ icon: Icon(
+ Icons.clear,
+ color: Colors.transparent,
+ ),
+ onPressed: () {
+ },
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ borderRadius: BorderRadius.circular(30),
+ ),
+ //labelText: 'Search by phone number',
+ hintText: 'Search by doctor',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+ ),)
+ ),),
+ Visibility(
+ visible:dropdownSearchType.toString().toLowerCase()=='date',
+ child: Container(
+ //height: 60,
+ child: Row(
+ children: [
+ Expanded(
+ child: TextField(
+
+ cursorColor: primaryColor,
+ controller: fromdateController,
+ onChanged: (string) {
+ if(string.length>=1){
+ //getRecordsByDate(string);
+ }
+ else{
+ getAllProblemsReportMyself();
+ }
+ },
+ 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(() {
+ fromdateController.text = formattedDate; //set output date to TextField value.
+ });
+ getAllProblemsReportMyselfByDateRange(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='';
+ });
+ getAllProblemsReportMyself();
+ },
+ ):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{
+ getAllProblemsReportMyself();
+ }
+ },
+ 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(() {
+ todateController.text = formattedDate; //set output date to TextField value.
+ });
+ getAllProblemsReportMyselfByDateRange(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='';
+ });
+ getAllProblemsReportMyself();
+ },
+ ):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),
+
+ ],
+ ),
+ ),),
+ Expanded(child: _filtereddata()),
+ Padding(
+ padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
+ child: CircleAvatar(
+ backgroundColor: primaryColor,
+ radius: 40,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ IconButton(
+ iconSize: 40,
+ icon: const Icon(
+ Icons.add,
+ color: Colors.white,
+ ),
+ onPressed: () async{
+ Navigator.push(context, MaterialPageRoute(builder: (context) => ReportMySelf())).then((value) {
+ getAllProblemsReportMyself();
+ });
+ },
+ ),
+ ],
+ ),
+ ),
+ ),
+ ]));
+
+
+ }
+ 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 problem'),
+ 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) => ReportMySelf())).then((value) {
+ getAllProblemsReportMyself();
+ });
+ },
+ ),
+ )
+ ],
+ ),
+ )
+ );
+ }
+
+
+ }
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppSettings.appBar('Report My Self'),
+ body: isProblemDataLoading?Center(
+ child: CircularProgressIndicator(
+ color: primaryColor,
+ strokeWidth: 5.0,
+ ),
+ ): _allreports(),
+ );
+ }
+}
+
diff --git a/lib/report_problem/audio_file.dart b/lib/report_problem/audio_file.dart
new file mode 100644
index 0000000..16b327d
--- /dev/null
+++ b/lib/report_problem/audio_file.dart
@@ -0,0 +1,59 @@
+import 'package:flutter/material.dart';
+import 'package:video_player/video_player.dart';
+import 'package:flick_video_player/flick_video_player.dart';
+
+class ProblemAudio extends StatefulWidget {
+ var videoUrl;
+ ProblemAudio({this.videoUrl});
+
+ @override
+ State createState() => _ProblemAudioState();
+}
+
+class _ProblemAudioState extends State {
+
+ late VideoPlayerController _controller;
+ late Future _initializeVideoPlayerFuture;
+ late FlickManager flickManager;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = VideoPlayerController.networkUrl(
+ Uri.parse(widget.videoUrl,),
+ );
+ flickManager = FlickManager(
+ videoPlayerController:
+ VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl,),)
+ );
+ _initializeVideoPlayerFuture = _controller.initialize();
+ _controller.setLooping(false);
+ }
+ @override
+ void dispose() {
+ // Ensure disposing of the VideoPlayerController to free up resources.
+ _controller.dispose();
+ flickManager.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ height: MediaQuery.of(context).size.height * .30,
+ width: double.infinity,
+ child:FlickVideoPlayer(
+ flickManager: flickManager,
+ flickVideoWithControls: FlickVideoWithControls(
+ videoFit: BoxFit.fill,
+ controls: FlickPortraitControls(
+ progressBarSettings:
+ FlickProgressBarSettings(playedColor: Colors.green),
+ ),
+ ),
+
+ ),
+
+ );
+ }
+}
diff --git a/lib/report_problem/report_my_self.dart b/lib/report_problem/report_my_self.dart
new file mode 100644
index 0000000..645174a
--- /dev/null
+++ b/lib/report_problem/report_my_self.dart
@@ -0,0 +1,783 @@
+import 'dart:convert';
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:healthcare_user/common/settings.dart';
+import 'package:image_picker/image_picker.dart';
+import 'package:video_player/video_player.dart';
+import 'package:flick_video_player/flick_video_player.dart';
+import 'package:flutter_sound/flutter_sound.dart';
+import 'package:assets_audio_player/assets_audio_player.dart';
+import 'package:permission_handler/permission_handler.dart';
+import 'package:intl/date_symbol_data_local.dart';
+import 'dart:async';
+import 'package:flutter/cupertino.dart';
+import 'package:path/path.dart' as path;
+import 'package:intl/intl.dart' show DateFormat;
+import 'package:path_provider/path_provider.dart';
+
+class ReportMySelf extends StatefulWidget {
+ const ReportMySelf({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _ReportMySelfState();
+}
+
+class _ReportMySelfState extends State {
+
+ TextEditingController problemNameController = TextEditingController();
+ TextEditingController descriptionController = TextEditingController();
+ TextEditingController dateInput = TextEditingController();
+ final ImagePicker _picker = ImagePicker();
+ String videoUrl='';
+ late VideoPlayerController _controller;
+ late Future _initializeVideoPlayerFuture;
+ late FlickManager flickManager;
+ late FlutterSoundRecorder _recordingSession;
+ final recordingPlayer = AssetsAudioPlayer();
+ String pathToAudio='';
+ bool _playAudio = false;
+ String _timerText = '00:00:00';
+ bool isAudioButtonPressed=false;
+ String recordingTime = '0:0'; // to store value
+ bool isRecording = false;
+ String problemPictureUrl='';
+
+ void initializer() async {
+ pathToAudio = '/sdcard/Download/temp.wav';
+ _recordingSession = FlutterSoundRecorder();
+ await _recordingSession.openAudioSession(
+ focus: AudioFocus.requestFocusAndStopOthers,
+ category: SessionCategory.playAndRecord,
+ mode: SessionMode.modeDefault,
+ device: AudioDevice.speaker);
+ await _recordingSession.setSubscriptionDuration(Duration(milliseconds: 10));
+ await initializeDateFormatting();
+ await Permission.microphone.request();
+ await Permission.storage.request();
+ await Permission.manageExternalStorage.request();
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = VideoPlayerController.networkUrl(
+ Uri.parse(videoUrl,),
+ );
+ flickManager = FlickManager(
+ videoPlayerController:
+ VideoPlayerController.networkUrl(Uri.parse(videoUrl,),)
+ );
+ _initializeVideoPlayerFuture = _controller.initialize();
+ _controller.setLooping(false);
+
+ /*initializer();*/
+ }
+
+ @override
+ void dispose() {
+ // Ensure disposing of the VideoPlayerController to free up resources.
+ _controller.dispose();
+ flickManager.dispose();
+ _recordingSession.dispositionStream();
+ pathToAudio='';
+ super.dispose();
+ recordingPlayer.stop();
+ _deleteCacheDir();
+ _deleteAppDir();
+ }
+
+ Future _deleteCacheDir() async {
+ Directory tempDir = await getTemporaryDirectory();
+
+ if (tempDir.existsSync()) {
+ tempDir.deleteSync(recursive: true);
+ }
+ }
+
+ Future _deleteAppDir() async {
+ Directory appDocDir = await getApplicationDocumentsDirectory();
+
+ if (appDocDir.existsSync()) {
+ appDocDir.deleteSync(recursive: true);
+ }
+ }
+
+ Future startRecording() async {
+ initializer();
+
+ setState(() {
+ isRecording=true;
+ });
+ Directory directory = Directory(path.dirname(pathToAudio));
+ if (!directory.existsSync()) {
+ directory.createSync();
+ }
+ _recordingSession=(await FlutterSoundRecorder().openAudioSession())!;
+
+ await _recordingSession.startRecorder(
+ toFile: pathToAudio,
+ codec: Codec.pcm16WAV,
+ );
+ recordTime();
+ StreamSubscription _recorderSubscription = _recordingSession.onProgress!.listen((e) {
+
+ /*var date = DateTime.fromMillisecondsSinceEpoch(e.duration.inMilliseconds,
+ isUtc: true);
+ var timeText = DateFormat('mm:ss:SS', 'en_GB').format(date);
+ setState(() {
+ _timerText = timeText.substring(0, 8);
+ });*/
+ });
+ _recorderSubscription.cancel();
+ }
+
+
+
+ void recordTime() {
+
+ var startTime = DateTime.now();
+ Timer.periodic(const Duration(seconds: 1), (Timer t) {
+ var diff = DateTime.now().difference(startTime);
+
+
+
+ if (!isRecording) {
+ t.cancel(); //cancel function calling
+ }
+
+ setState(() {
+ recordingTime =
+ '${diff.inHours < 60 ? diff.inHours : 0}:${diff.inMinutes < 60 ? diff.inMinutes : 0}:${diff.inSeconds < 60 ? diff.inSeconds : 0}';
+
+ print(recordingTime);
+ });
+ });
+ }
+
+ Future stopRecording() async {
+
+ setState(() {
+ isRecording=false;
+ });
+ _recordingSession.closeAudioSession();
+ return await _recordingSession.stopRecorder();
+ }
+
+ Future playFunc() async {
+ recordingPlayer.open(
+ Audio.file(pathToAudio),
+ autoStart: true,
+ showNotification: true,
+ );
+ }
+
+ Future stopPlayFunc() async {
+ recordingPlayer.stop();
+ }
+
+ Future takeVideoFromCamera() async {
+ try {
+ final image = await _picker.pickVideo(source: ImageSource.camera);
+ if (image == null) return;
+ final imageTemp = File(image.path);
+ AppSettings.preLoaderDialog(context);
+ var res = await AppSettings.uploadVideoInReportMySelf(image);
+ print(jsonDecode(res));
+ Navigator.of(context, rootNavigator: true).pop();
+ setState(() {
+ videoUrl = jsonDecode(res)['picture'];
+ _controller = VideoPlayerController.networkUrl(Uri.parse(videoUrl,),);
+ flickManager = FlickManager(
+ videoPlayerController:
+ VideoPlayerController.networkUrl(Uri.parse(videoUrl,),)
+ );
+ });
+
+ _initializeVideoPlayerFuture = _controller.initialize();
+ _controller.setLooping(true);
+ } on PlatformException catch (e) {
+ print('Failed to pick video: $e');
+ }
+ }
+
+ Future pickVideoFromGallery() async {
+ try {
+ final image = await _picker.pickVideo(source: ImageSource.gallery);
+ if (image == null) return;
+ final imageTemp = File(image.path);
+
+ AppSettings.preLoaderDialog(context);
+ var res = await AppSettings.uploadVideoInReportMySelf(image);
+ print(jsonDecode(res));
+ Navigator.of(context, rootNavigator: true).pop();
+ setState(() {
+ videoUrl = jsonDecode(res)['picture'];
+ _controller = VideoPlayerController.networkUrl(Uri.parse(videoUrl,),);
+ });
+
+ _initializeVideoPlayerFuture = _controller.initialize();
+ _controller.setLooping(true);
+ } on PlatformException catch (e) {
+ print('Failed to pick video: $e');
+ }
+ }
+
+
+ Future pickImageFromGallery() async {
+ try {
+ final image = await _picker.pickImage(source: ImageSource.gallery);
+ if (image == null) return;
+ final imageTemp = File(image.path);
+ AppSettings.preLoaderDialog(context);
+ var res = await AppSettings.uploadReportMyselfPicture(image);
+ print(jsonDecode(res));
+ Navigator.of(context, rootNavigator: true).pop();
+ setState(() {
+ problemPictureUrl = jsonDecode(res)['pictures'][0];
+ });
+ } on PlatformException catch (e) {
+ print('Failed to pick image: $e');
+ }
+ }
+
+ Future takeImageFromCamera() async {
+ try {
+ final image = await _picker.pickImage(source: ImageSource.camera);
+ if (image == null) return;
+ final imageTemp = File(image.path);
+ AppSettings.preLoaderDialog(context);
+ var res = await AppSettings.uploadReportMyselfPicture(image);
+ print(jsonDecode(res));
+ Navigator.of(context, rootNavigator: true).pop();
+ setState(() {
+ problemPictureUrl = jsonDecode(res)['pictures'][0];
+ });
+ } on PlatformException catch (e) {
+ print('Failed to pick image: $e');
+ }
+ }
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppSettings.appBar('Report MySelf'),
+ body: SingleChildScrollView(
+ child: Container(
+ child: Padding(
+ padding: EdgeInsets.all(10),
+ child:Column(
+ children: [
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: problemNameController,
+ textCapitalization: TextCapitalization.words,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.report_problem,
+ color: greyColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color:primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Enter problem name',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(
+ height: 10,
+ ),
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: descriptionController,
+ textCapitalization: TextCapitalization.words,
+ decoration: const InputDecoration(
+ prefixIcon: Icon(
+ Icons.description,
+ color: greyColor,
+ ),
+ border: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor)),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(color:primaryColor),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: primaryColor),
+ ),
+ labelText: 'Description',
+ labelStyle: TextStyle(
+ color: greyColor, //<-- SEE HERE
+ ),
+ ),
+ ),
+ ),
+ SizedBox(height: 10),
+ Container(
+ child: TextFormField(
+ cursorColor: greyColor,
+ controller: dateInput,
+ decoration: textFormFieldDecorationBMI(
+ Icons.calendar_today, 'Enter Date'),
+ readOnly: true,
+ onTap: () async {
+ DateTime? pickedDate = await showDatePicker(
+ context: context,
+ initialDate: DateTime.now(),
+ firstDate: DateTime(1950),
+ lastDate: DateTime.now(),
+ builder: (BuildContext context, Widget? child) {
+ return Theme(
+ data: ThemeData.dark().copyWith(
+ colorScheme: ColorScheme.dark(
+ primary: buttonColors,
+ onPrimary: Colors.white,
+ surface: buttonColors,
+ onSurface: Colors.white,
+ ),
+ dialogBackgroundColor: primaryColor,
+ ),
+ child: child!,
+ );
+ },
+ );
+
+ if (pickedDate != null) {
+ print(
+ pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
+ String formattedDate =
+ DateFormat('dd-MM-yyyy').format(pickedDate);
+ print(
+ formattedDate); //formatted date output using intl package => 2021-03-16
+ setState(() {
+ dateInput.text =
+ formattedDate; //set output date to TextField value.
+ });
+ } else {}
+ },
+ ),
+ ),
+ SizedBox(height: 10),
+ Row(
+ children: [
+
+ IconButton(
+ icon: Icon(
+ Icons.audio_file,
+ color: primaryColor,
+ size: 40,
+ ),
+ onPressed: () {
+
+ if(!isAudioButtonPressed){
+ setState(() {
+ isAudioButtonPressed=true;
+ });
+ }
+ else{
+ setState(() {
+ isAudioButtonPressed=false;
+ pathToAudio='';
+ recordingTime = '0:0';
+ });
+ }
+
+
+ },
+ ),
+ SizedBox(width: 10,),
+ IconButton(
+ icon: Icon(
+ Icons.video_camera_back_rounded,
+ color: primaryColor,
+ size: 40,
+ ),
+ onPressed: () {
+ showModalBottomSheet(
+ context: context,
+ builder: (BuildContext context) {
+ return SizedBox(
+ height: 200,
+ child: Center(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ GestureDetector(
+ child: Icon(
+ Icons.camera_alt_outlined,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ await takeVideoFromCamera();
+ Navigator.pop(context);
+ },
+ ),
+ SizedBox(
+ width: MediaQuery.of(context).size.width * .20,
+ ),
+ GestureDetector(
+ child: Icon(
+ Icons.photo,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ await pickVideoFromGallery();
+ Navigator.pop(context);
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ });
+ },
+ ),
+ SizedBox(width: 10,),
+ IconButton(
+ icon: Icon(
+ Icons.image,
+ color: primaryColor,
+ size: 40,
+ ),
+ onPressed: () async {
+ showModalBottomSheet(
+ context: context,
+ builder: (BuildContext context) {
+ return SizedBox(
+ height: 200,
+ child: Center(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ GestureDetector(
+ child: Icon(
+ Icons.camera_alt_outlined,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ await takeImageFromCamera();
+ Navigator.pop(context);
+ },
+ ),
+ SizedBox(
+ width:
+ MediaQuery.of(context).size.width *
+ .20,
+ ),
+ GestureDetector(
+ child: Icon(
+ Icons.photo,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ await pickImageFromGallery();
+ Navigator.pop(context);
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ });
+ },
+
+ ),
+ /*SizedBox(width: 10,),
+ IconButton(
+ icon: Icon(
+ Icons.description,
+ color: primaryColor,
+ size: 40,
+ ),
+ onPressed: () {
+
+ },
+ ),*/
+ ],
+ ),
+ Visibility(
+ visible: isAudioButtonPressed,
+ child: Column(
+ children: [
+ Container(
+ child: Center(
+ child: Text(
+ recordingTime,
+ style: TextStyle(fontSize: 70, color: Colors.red),
+ ),
+ ),
+ ),
+ SizedBox(
+ height: 20,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+
+ IconButton(
+ icon: Icon(
+ Icons.mic,
+ color: !isRecording?Colors.red:greyColor,
+ ),
+ onPressed: () {
+
+ if(!isRecording){
+ startRecording();
+ }
+ else{
+ AppSettings.longSuccessToast('please stop recording');
+ }
+
+ },
+ ),
+ SizedBox(
+ width: 30,
+ ),
+ IconButton(
+ icon: Icon(
+ Icons.stop,
+ color: isRecording?Colors.red:greyColor,
+ ),
+ onPressed: () {
+ if(isRecording){
+ stopRecording();
+ }
+ else{
+ AppSettings.longSuccessToast('please start recording');
+ }
+
+ },
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 20,
+ ),
+
+ Visibility(
+ visible: pathToAudio!=''&&!isRecording,
+ child:Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ ElevatedButton.icon(
+ style:
+ ElevatedButton.styleFrom(elevation: 9.0, primary: Colors.red),
+ onPressed: () {
+ setState(() {
+ _playAudio = !_playAudio;
+ });
+ if (_playAudio) playFunc();
+ if (!_playAudio) stopPlayFunc();
+ },
+ icon: _playAudio
+ ? Icon(
+ Icons.stop,
+ )
+ : Icon(Icons.play_arrow),
+ label: _playAudio
+ ? Text(
+ "Stop",
+ style: TextStyle(
+ fontSize: 28,
+ ),
+ )
+ : Text(
+ "Play",
+ style: TextStyle(
+ fontSize: 28,
+ ),
+ ),
+ ),
+ IconButton(
+ icon: Icon(
+ Icons.delete,
+ color: Colors.red,
+ size: 30,
+ ),
+ onPressed: () {
+
+ setState(() {
+ pathToAudio='';
+ recordingTime = '0:0';
+ });
+ },
+ ),
+ ],
+ )
+ )
+
+
+ ],
+ )),
+ Visibility(
+ visible: videoUrl != '',
+ child: Padding(
+ padding: EdgeInsets.all(10),
+ child: Container(
+ height: MediaQuery.of(context).size.height * .30,
+ width: double.infinity,
+ child:FlickVideoPlayer(
+ flickManager: flickManager,
+ flickVideoWithControls: FlickVideoWithControls(
+ videoFit: BoxFit.fill,
+ controls: FlickPortraitControls(
+ progressBarSettings:
+ FlickProgressBarSettings(playedColor: Colors.green),
+ ),
+ ),
+
+ ),
+
+
+
+ /*FutureBuilder(
+ future: _initializeVideoPlayerFuture,
+ builder: (context, snapshot) {
+ if (snapshot.connectionState == ConnectionState.done) {
+ return AspectRatio(
+ aspectRatio: _controller.value.aspectRatio,
+ child: VideoPlayer(_controller),
+ );
+ } else {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ }
+ },
+ ),*/
+ ),
+
+
+
+ ),
+ ),
+ Visibility(
+ visible: problemPictureUrl!='',
+ child: Container(
+ width: double.infinity,
+ height:
+ MediaQuery.of(context).size.height *
+ .30,
+ decoration: BoxDecoration(
+ shape: BoxShape.rectangle,
+ image: DecorationImage(
+ image: NetworkImage(problemPictureUrl) as ImageProvider, // picked file
+ fit: BoxFit.fill)),
+ child: Stack(children: [
+ Positioned(
+ right: 0,
+ child: Container(
+ child: IconButton(
+ iconSize: 30,
+ icon: const Icon(
+ Icons.cancel,
+ color: Colors.red,
+ ),
+ onPressed: () async {
+
+ setState(() {
+ problemPictureUrl='';
+ });
+ },
+ ),
+ ),
+ )
+ ]),
+ ),),
+
+ SizedBox(height: 10),
+ Container(
+ width: double.infinity,
+ height:
+ MediaQuery.of(context).size.height * .05,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ primary: buttonColors, // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () async {
+
+ if(problemNameController.text!=''&&(pathToAudio!=''||problemPictureUrl!=''||videoUrl!='')&&dateInput.text!=''){
+
+ AppSettings.preLoaderDialog(context);
+ bool isOnline =
+ await AppSettings.internetConnectivity();
+
+ if (isOnline) {
+ var payload = new Map();
+
+ List picture=[];
+ picture.add({'url':problemPictureUrl});
+
+
+ payload["name"] = problemNameController.text.toString();
+ payload["description"] = descriptionController.text.toString();
+ payload["date"] = dateInput.text.toString();
+ payload["audio"] =pathToAudio.toString();
+ payload["video"] = videoUrl.toString();
+ payload["picture"] = picture;
+
+ bool uploadStatus = await AppSettings.addReportMySelfProblem(payload);
+
+ try {
+ if (uploadStatus) {
+ Navigator.of(context, rootNavigator: true)
+ .pop();
+ AppSettings.longSuccessToast(
+ 'Report problem added successfully');
+ Navigator.pop(context);
+ } else {
+ Navigator.of(context, rootNavigator: true)
+ .pop();
+ AppSettings.longFailedToast(
+ 'Fail to add report problem details');
+ }
+ } catch (e) {
+ print(e);
+ Navigator.of(context, rootNavigator: true)
+ .pop();
+ AppSettings.longFailedToast(
+ 'Fail to add report problem details');
+ }
+
+ }
+
+ else{
+ AppSettings.longFailedToast('please check internet connection');
+ }
+ }
+ else{
+ AppSettings.longFailedToast('please enter valid details');
+ }
+
+
+
+
+ },
+ child: const Text('Report a problem'),
+ )),
+
+
+ ],
+ ),
+ ),
+ ),
+ )
+ );
+ }
+}
diff --git a/lib/report_problem/video_file.dart b/lib/report_problem/video_file.dart
new file mode 100644
index 0000000..88d7269
--- /dev/null
+++ b/lib/report_problem/video_file.dart
@@ -0,0 +1,59 @@
+import 'package:flutter/material.dart';
+import 'package:video_player/video_player.dart';
+import 'package:flick_video_player/flick_video_player.dart';
+
+class ProblemVideo extends StatefulWidget {
+ var videoUrl;
+ ProblemVideo({this.videoUrl});
+
+ @override
+ State createState() => _ProblemVideoState();
+}
+
+class _ProblemVideoState extends State {
+
+ late VideoPlayerController _controller;
+ late Future _initializeVideoPlayerFuture;
+ late FlickManager flickManager;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = VideoPlayerController.networkUrl(
+ Uri.parse(widget.videoUrl,),
+ );
+ flickManager = FlickManager(
+ videoPlayerController:
+ VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl,),)
+ );
+ _initializeVideoPlayerFuture = _controller.initialize();
+ _controller.setLooping(false);
+ }
+ @override
+ void dispose() {
+ // Ensure disposing of the VideoPlayerController to free up resources.
+ _controller.dispose();
+ flickManager.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ height: MediaQuery.of(context).size.height * .30,
+ width: double.infinity,
+ child:FlickVideoPlayer(
+ flickManager: flickManager,
+ flickVideoWithControls: FlickVideoWithControls(
+ videoFit: BoxFit.fill,
+ controls: FlickPortraitControls(
+ progressBarSettings:
+ FlickProgressBarSettings(playedColor: Colors.green),
+ ),
+ ),
+
+ ),
+
+ );
+ }
+}
diff --git a/lib/report_problem/video_recorder.dart b/lib/report_problem/video_recorder.dart
new file mode 100644
index 0000000..cc9286c
--- /dev/null
+++ b/lib/report_problem/video_recorder.dart
@@ -0,0 +1,89 @@
+import 'dart:convert';
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:healthcare_user/common/settings.dart';
+import 'package:image_picker/image_picker.dart';
+import 'package:visibility_detector/visibility_detector.dart';
+
+class VideoRecorderPage extends StatefulWidget {
+ const VideoRecorderPage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _VideoRecorderPageState();
+}
+
+class _VideoRecorderPageState extends State {
+
+ final ImagePicker _picker = ImagePicker();
+
+
+ Future takeVideoFromCamera() async {
+ try {
+ final image = await _picker.pickVideo(source: ImageSource.camera);
+ if (image == null) return;
+ final imageTemp = File(image.path);
+ } on PlatformException catch (e) {
+ print('Failed to pick video: $e');
+ }
+ }
+
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppSettings.appBar('Video recorder'),
+ body: Container(
+ child: IconButton(
+ icon: Icon(
+ Icons.video_camera_back_rounded,
+ color: primaryColor,
+ size: 40,
+ ),
+ onPressed: () {
+ showModalBottomSheet(
+ context: context,
+ builder: (BuildContext context) {
+ return SizedBox(
+ height: 200,
+ child: Center(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ GestureDetector(
+ child: Icon(
+ Icons.camera_alt_outlined,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ await takeVideoFromCamera();
+ Navigator.pop(context);
+ },
+ ),
+ SizedBox(
+ width: MediaQuery.of(context).size.width * .20,
+ ),
+ GestureDetector(
+ child: Icon(
+ Icons.photo,
+ size: 100,
+ color: primaryColor,
+ ),
+ onTap: () async {
+ // await pickVideoFromGallery();
+ Navigator.pop(context);
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ });
+ },
+ ),
+ ),
+ );
+ }
+}
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index 0a6c0bb..a038202 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation
+import assets_audio_player
+import assets_audio_player_web
import cloud_firestore
import device_info_plus_macos
import file_selector_macos
@@ -14,10 +16,14 @@ import flutter_local_notifications
import geolocator_apple
import location
import package_info_plus_macos
+import path_provider_foundation
import shared_preferences_foundation
import url_launcher_macos
+import wakelock_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ AssetsAudioPlayerPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerPlugin"))
+ AssetsAudioPlayerWebPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerWebPlugin"))
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
@@ -27,6 +33,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
+ PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
+ WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
}
diff --git a/pubspec.lock b/pubspec.lock
index 16425da..906f81d 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -22,6 +22,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
+ assets_audio_player:
+ dependency: "direct main"
+ description:
+ name: assets_audio_player
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.6"
+ assets_audio_player_web:
+ dependency: transitive
+ description:
+ name: assets_audio_player_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.1"
async:
dependency: transitive
description:
@@ -37,14 +51,14 @@ packages:
source: hosted
version: "2.1.0"
card_swiper:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: card_swiper
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
carousel_slider:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: carousel_slider
url: "https://pub.dartlang.org"
@@ -57,6 +71,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
+ charcode:
+ dependency: transitive
+ description:
+ name: charcode
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.3.1"
charts_common:
dependency: transitive
description:
@@ -65,7 +86,7 @@ packages:
source: hosted
version: "0.12.0"
charts_flutter:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: charts_flutter
url: "https://pub.dartlang.org"
@@ -93,7 +114,7 @@ packages:
source: hosted
version: "1.1.1"
cloud_firestore:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: cloud_firestore
url: "https://pub.dartlang.org"
@@ -114,7 +135,7 @@ packages:
source: hosted
version: "3.7.1"
cloudinary_public:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: cloudinary_public
url: "https://pub.dartlang.org"
@@ -163,14 +184,14 @@ packages:
source: hosted
version: "1.0.5"
date_time_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: date_time_picker
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
day_night_time_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: day_night_time_picker
url: "https://pub.dartlang.org"
@@ -184,7 +205,7 @@ packages:
source: hosted
version: "0.7.4"
device_info_plus:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: device_info_plus
url: "https://pub.dartlang.org"
@@ -226,21 +247,21 @@ packages:
source: hosted
version: "2.1.1"
device_information:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: device_information
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
dio:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.3"
dots_indicator:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: dots_indicator
url: "https://pub.dartlang.org"
@@ -317,7 +338,7 @@ packages:
source: hosted
version: "2.8.0"
firebase_messaging:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: firebase_messaging
url: "https://pub.dartlang.org"
@@ -337,27 +358,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.7"
+ flick_video_player:
+ dependency: "direct main"
+ description:
+ name: flick_video_player
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.5.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_cupertino_datetime_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_cupertino_datetime_picker
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
flutter_datetime_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_datetime_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
flutter_device_type:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_device_type
url: "https://pub.dartlang.org"
@@ -378,7 +406,7 @@ packages:
source: hosted
version: "2.0.2"
flutter_local_notifications:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
@@ -399,7 +427,7 @@ packages:
source: hosted
version: "5.0.0"
flutter_native_contact_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_native_contact_picker
url: "https://pub.dartlang.org"
@@ -413,12 +441,40 @@ packages:
source: hosted
version: "2.0.15"
flutter_polyline_points:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: flutter_polyline_points
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
+ flutter_slidable:
+ dependency: "direct main"
+ description:
+ name: flutter_slidable
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.0"
+ flutter_sound:
+ dependency: "direct main"
+ description:
+ name: flutter_sound
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "8.5.0"
+ flutter_sound_platform_interface:
+ dependency: transitive
+ description:
+ name: flutter_sound_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "8.5.0"
+ flutter_sound_web:
+ dependency: transitive
+ description:
+ name: flutter_sound_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "8.5.0"
flutter_svg:
dependency: "direct main"
description:
@@ -444,14 +500,14 @@ packages:
source: sdk
version: "0.0.0"
fluttertoast:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
geocoding:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: geocoding
url: "https://pub.dartlang.org"
@@ -521,7 +577,7 @@ packages:
source: hosted
version: "0.1.3"
get:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: get
url: "https://pub.dartlang.org"
@@ -577,7 +633,7 @@ packages:
source: hosted
version: "0.5.3"
google_maps_place_picker_mb:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: google_maps_place_picker_mb
url: "https://pub.dartlang.org"
@@ -619,7 +675,7 @@ packages:
source: hosted
version: "3.3.0"
image_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
@@ -675,7 +731,7 @@ packages:
source: hosted
version: "0.2.1"
intl:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
@@ -730,6 +786,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
+ logger:
+ dependency: transitive
+ description:
+ name: logger
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.4.0"
logging:
dependency: transitive
description:
@@ -766,7 +829,7 @@ packages:
source: hosted
version: "1.0.4"
multi_image_picker:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: multi_image_picker
url: "https://pub.dartlang.org"
@@ -780,7 +843,7 @@ packages:
source: hosted
version: "1.0.0"
overlay_support:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: overlay_support
url: "https://pub.dartlang.org"
@@ -829,7 +892,7 @@ packages:
source: hosted
version: "1.0.5"
path:
- dependency: transitive
+ dependency: "direct main"
description:
name: path
url: "https://pub.dartlang.org"
@@ -849,6 +912,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
+ path_provider:
+ dependency: transitive
+ description:
+ name: path_provider
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.15"
+ path_provider_android:
+ dependency: transitive
+ description:
+ name: path_provider_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.0"
+ path_provider_foundation:
+ dependency: transitive
+ description:
+ name: path_provider_foundation
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.3.0"
path_provider_linux:
dependency: transitive
description:
@@ -871,7 +955,7 @@ packages:
source: hosted
version: "2.0.7"
permission_handler:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
@@ -913,14 +997,14 @@ packages:
source: hosted
version: "5.1.0"
photo_view:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: photo_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0"
pinch_zoom:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: pinch_zoom
url: "https://pub.dartlang.org"
@@ -961,6 +1045,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.5"
+ recase:
+ dependency: transitive
+ description:
+ name: recase
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "4.1.0"
+ rxdart:
+ dependency: transitive
+ description:
+ name: rxdart
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.27.7"
sanitize_html:
dependency: transitive
description:
@@ -969,7 +1067,7 @@ packages:
source: hosted
version: "2.1.0"
shared_preferences:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
@@ -1018,7 +1116,7 @@ packages:
source: hosted
version: "2.3.0"
sizer:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: sizer
url: "https://pub.dartlang.org"
@@ -1064,6 +1162,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
+ synchronized:
+ dependency: transitive
+ description:
+ name: synchronized
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.0"
term_glyph:
dependency: transitive
description:
@@ -1099,6 +1204,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2"
+ universal_html:
+ dependency: transitive
+ description:
+ name: universal_html
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.2.2"
universal_io:
dependency: transitive
description:
@@ -1107,7 +1219,7 @@ packages:
source: hosted
version: "2.2.0"
url_launcher:
- dependency: "direct dev"
+ dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
@@ -1176,6 +1288,83 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
+ video_player:
+ dependency: "direct main"
+ description:
+ name: video_player
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.7.0"
+ video_player_android:
+ dependency: transitive
+ description:
+ name: video_player_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.4.9"
+ video_player_avfoundation:
+ dependency: transitive
+ description:
+ name: video_player_avfoundation
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.4.9"
+ video_player_platform_interface:
+ dependency: transitive
+ description:
+ name: video_player_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.2.0"
+ video_player_web:
+ dependency: transitive
+ description:
+ name: video_player_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.16"
+ visibility_detector:
+ dependency: "direct main"
+ description:
+ name: visibility_detector
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.0+2"
+ wakelock:
+ dependency: transitive
+ description:
+ name: wakelock
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.6.2"
+ wakelock_macos:
+ dependency: transitive
+ description:
+ name: wakelock_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.0"
+ wakelock_platform_interface:
+ dependency: transitive
+ description:
+ name: wakelock_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.0"
+ wakelock_web:
+ dependency: transitive
+ description:
+ name: wakelock_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.0"
+ wakelock_windows:
+ dependency: transitive
+ description:
+ name: wakelock_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.2.0"
win32:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index abcb80b..66c1b62 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,30 +11,20 @@ dependencies:
sdk: flutter
cupertino_icons: ^1.0.2
-
location: ^4.4.0
geolocator: ^9.0.2
google_api_headers: ^1.2.0
google_maps_flutter: ^2.2.3
google_maps_webservice: ^0.0.20-nullsafety.5
- http: ^0.13.5
provider: ^6.0.5
tuple: ^2.0.1
uuid: ^3.0.7
flutter_svg_provider: ^1.0.3
- flutter_svg: ^1.0.1
-dev_dependencies:
- flutter_test:
- sdk: flutter
-
- flutter_lints: ^2.0.0
http: ^0.13.5
shared_preferences: ^2.0.15
sizer: ^2.0.11
- geolocator: ^9.0.2
geocoding: ^2.0.4
image_picker: ^0.8.6+1
- flutter_launcher_icons: ^0.11.0
url_launcher: ^6.1.9
intl: ^0.17.0
flutter_svg: ^1.0.1
@@ -51,10 +41,8 @@ dev_dependencies:
device_info_plus: ^3.2.4
overlay_support: ^2.1.0
dio: ^5.1.1
- google_maps_flutter: ^2.2.5
flutter_polyline_points: ^1.0.0
get: ^4.6.5
- location: ^4.4.0
permission_handler: ^10.2.0
cloudinary_public: ^0.21.0
carousel_slider: ^4.2.1
@@ -66,6 +54,21 @@ dev_dependencies:
multi_image_picker: ^4.8.1
charts_flutter: ^0.12.0
flutter_native_contact_picker: ^0.0.4
+ flutter_slidable: ^2.0.0
+ video_player: ^2.5.2
+ flick_video_player: ^0.5.0
+ flutter_sound: ^8.1.9
+ assets_audio_player: ^3.0.3+3
+ path: ^1.8.0
+ visibility_detector: ^0.4.0+2
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+
+ flutter_lints: ^2.0.0
+ flutter_launcher_icons: ^0.11.0
+
flutter_icons:
image_path_ios: 'images/appicon.png'