dynamic code functionality completed

master
Sneha 11 months ago
parent def23ffdc0
commit 08bf881f28

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

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

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

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

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/common/zoom_image.dart'; import 'package:healthcare_user/common/zoom_image.dart';
import 'package:healthcare_user/models/get_connected_doctors_model.dart'; import 'package:healthcare_user/models/get_connected_doctors_model.dart';
import 'package:healthcare_user/my_connections/add-doctor.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:multi_image_picker/multi_image_picker.dart'; import 'package:multi_image_picker/multi_image_picker.dart';
@ -350,7 +351,7 @@ class _AddReportsState extends State<AddReports> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(child: DropdownButtonFormField( Container(child: connectedDoctorsListOriginal.length!=0?DropdownButtonFormField(
// Initial Value // Initial Value
value: doctorNameVariable, value: doctorNameVariable,
isExpanded: true, isExpanded: true,
@ -396,7 +397,69 @@ class _AddReportsState extends State<AddReports> {
doctorNameVariable = newValue; doctorNameVariable = newValue;
}); });
}, },
):IconButton(
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddDoctor())).then((value) {
getAllConnectedDoctors();
});
},
icon: Icon(
Icons.add,
color: primaryColor,
size: 40,
),
),), ),),
Visibility(
visible: connectedDoctorsListOriginal.length!=0,
child: Container(child: DropdownButtonFormField(
// Initial Value
value: doctorNameVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Doctor',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Please Select Doctor'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: connectedDoctorsListOriginal.map((items) {
return DropdownMenuItem(
value: items,
child: Text(
items.doctor_name,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: ( newValue) {
setState(() {
doctorNameVariable = newValue;
});
},
),),
),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * .02, height: MediaQuery.of(context).size.height * .02,
), ),

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/Reports/add_reports.dart'; import 'package:healthcare_user/Reports/add_reports.dart';
import 'package:healthcare_user/Reports/all_records_tab.dart'; import 'package:healthcare_user/Reports/all_records_tab.dart';
@ -40,6 +41,12 @@ class _AllReportsState extends State<AllReports> {
'Doctor', 'Doctor',
'Date', 'Date',
]; ];
final List<String> imgList = [
'images/mobilebg.png',
'images/mobilebg2.png',
'images/mobilebg3.png'
];
List images = ['img1', 'img2', 'img3'];
Future<void> getAllRecords() async { Future<void> getAllRecords() async {
isReportsDataLoading=true; isReportsDataLoading=true;
@ -62,7 +69,6 @@ class _AllReportsState extends State<AllReports> {
} }
} }
Future<void> getRecordsByProblemName(var problem) async { Future<void> getRecordsByProblemName(var problem) async {
isReportsDataLoading=true; isReportsDataLoading=true;
@ -138,7 +144,6 @@ class _AllReportsState extends State<AllReports> {
} }
} }
Future<void> getRecordsByDateRange(var fromDate,var toDate) async { Future<void> getRecordsByDateRange(var fromDate,var toDate) async {
isReportsDataLoading = true; isReportsDataLoading = true;
@ -192,49 +197,6 @@ class _AllReportsState extends State<AllReports> {
super.initState(); 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: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .10,
height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
)
],
),
),
actions: <Widget>[
TextButton(
child: Text('Close', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
},
);
}
Widget findings(var obj){ Widget findings(var obj){
return Container( return Container(
width: double.infinity, width: double.infinity,
@ -387,9 +349,51 @@ class _AllReportsState extends State<AllReports> {
Widget _filtereddata(){ Widget _filtereddata(){
if(reportsList.length!=0){ if(reportsList.length!=0){
reportsList.sort((a, b) => b.date.compareTo(a.date)); reportsList.sort((a, b) => b.date.compareTo(a.date));
return ListView.builder( return ListView.separated(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
itemCount: reportsList.length, itemCount: reportsList.length,
separatorBuilder: (context, index) {
if ((index + 1) % 2 == 0) {
return CarouselSlider(
options: CarouselOptions(
height: MediaQuery.of(context).size.height * .200,
aspectRatio: 16 / 9,
viewportFraction: 0.8,
initialPage: 0,
enableInfiniteScroll: true,
reverse: false,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.ease,
enlargeCenterPage: true,
enlargeFactor: 0.2,
scrollDirection: Axis.horizontal,
),
items: imgList.map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .250,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
//color: Colors.red,
child: FittedBox(
child: Image(
image: AssetImage(i),
),
fit: BoxFit.fill,
));
},
);
}).toList(),
);
} else {
return Container();
}
},
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: (){

@ -18,6 +18,7 @@ class _SugarCalculatorState extends State<SugarCalculator> {
TextEditingController postParandialValueController = TextEditingController(); TextEditingController postParandialValueController = TextEditingController();
TextEditingController dateInput = TextEditingController(); TextEditingController dateInput = TextEditingController();
String sugarValue = ''; String sugarValue = '';
Color sugarValueColor = Colors.black;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -48,7 +49,7 @@ class _SugarCalculatorState extends State<SugarCalculator> {
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: primaryColor),
), ),
labelText: 'Enter fasting sugar value', labelText: 'Enter fasting blood sugar value',
labelStyle: TextStyle( labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
@ -138,6 +139,11 @@ class _SugarCalculatorState extends State<SugarCalculator> {
onPressed: () async { onPressed: () async {
if (fastingValueController.text != '' && if (fastingValueController.text != '' &&
postParandialValueController.text != ''&& dateInput.text!='') { postParandialValueController.text != ''&& dateInput.text!='') {
if(int.parse(fastingValueController.text)>int.parse(postParandialValueController.text)){
AppSettings.longFailedToast('Please enter post parandial value is higher than fasting blood sugar value details');
}
else{
AppSettings.preLoaderDialog(context); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
@ -150,6 +156,24 @@ class _SugarCalculatorState extends State<SugarCalculator> {
print(valueResponse); print(valueResponse);
setState(() { setState(() {
sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString(); sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
if(sugarValue.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
sugarValueColor=buttonColors;
}
}); });
fastingValueController.clear(); fastingValueController.clear();
@ -157,6 +181,9 @@ class _SugarCalculatorState extends State<SugarCalculator> {
dateInput.clear(); dateInput.clear();
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
} }
}
else{ else{
AppSettings.longFailedToast('Please enter valid details'); AppSettings.longFailedToast('Please enter valid details');
} }
@ -167,11 +194,23 @@ class _SugarCalculatorState extends State<SugarCalculator> {
Container( Container(
child: Row( child: Row(
children: [ children: [
Text(sugarValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),), Text(sugarValue,style: TextStyle(color: sugarValueColor,fontWeight: FontWeight.bold,fontSize: 20),),
Visibility(
visible:sugarValue!='' ,
child: Icon(
Icons.emoji_emotions_outlined,
color: buttonColors,
size: 40,
),)
], ],
) )
), ),
SizedBox(height: 20), SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton( IconButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -191,6 +230,21 @@ class _SugarCalculatorState extends State<SugarCalculator> {
child: Container( child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)), child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
),) ),)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
], ],
), ),

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

@ -19,6 +19,7 @@ import 'package:healthcare_user/report_problem/all_problems.dart';
import 'package:healthcare_user/seekopinion.dart'; import 'package:healthcare_user/seekopinion.dart';
import 'package:healthcare_user/common/settings.dart'; import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/updates/update_location.dart'; import 'package:healthcare_user/updates/update_location.dart';
import 'package:healthcare_user/updates/update_pin.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
import 'dart:ui' as ui; import 'dart:ui' as ui;
@ -773,7 +774,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('My Health', style: drawerListItemsTextStyle()), Text('My Health (Sugar/BP/BMI)', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () { onTap: () {
@ -917,7 +918,13 @@ class _DashboardState extends State<Dashboard> {
Text('Update Pin', style: drawerListItemsTextStyle()), Text('Update Pin', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UpdatePin()),
);
},
), ),
Divider( Divider(
color: Colors.grey, color: Colors.grey,

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

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

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

@ -171,29 +171,59 @@ TextStyle drawerHeaderTextStyle() {
TextStyle drawerHeaderTextStyleNew() { TextStyle drawerHeaderTextStyleNew() {
return TextStyle(color: Colors.black, fontSize: 15); return TextStyle(color: Colors.black, fontSize: 15);
} }
TextStyle radioHeadingTextStyle() {
return TextStyle(color: Colors.white);
}
TextStyle radioItemsTextStyle() {
return TextStyle(color: Colors.white,fontSize: 11);
}
InputDecoration textFormFieldDecoration(IconData icon, var text) { InputDecoration textFormFieldDecoration(IconData icon, var text) {
return InputDecoration( return InputDecoration(
filled: true, filled: true,
fillColor: Colors.white, fillColor: primaryColor,
prefixIcon: Icon(
icon,
color: Colors.white,
),
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelText: text,
labelStyle: TextStyle(
color: Colors.white, //<-- SEE HERE
),
);
}
InputDecoration textFormFieldDecorationGrey(IconData icon, var text) {
return InputDecoration(
prefixIcon: Icon( prefixIcon: Icon(
icon, icon,
color: greyColor, color: greyColor,
), ),
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)), border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: greyColor),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: greyColor),
), ),
labelText: text, labelText: text,
labelStyle: TextStyle( labelStyle: TextStyle(
color: Colors.black, //<-- SEE HERE color: greyColor, //<-- SEE HERE
), ),
); );
} }
InputDecoration textFormFieldDecorationBMI(IconData icon, var text) { InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
return InputDecoration( return InputDecoration(
//filled: true, //filled: true,
@ -211,7 +241,7 @@ InputDecoration textFormFieldDecorationBMI(IconData icon, var text) {
), ),
labelText: text, labelText: text,
labelStyle: TextStyle( labelStyle: TextStyle(
//color: Colors.black, //<-- SEE HERE color: Colors.grey, //<-- SEE HERE
), ),
); );
} }
@ -229,6 +259,13 @@ class AppSettings {
static String userName = ''; static String userName = '';
static String userAddress = ''; static String userAddress = '';
static String detailedAddress = ''; static String detailedAddress = '';
static String emergencyContactNumber1 = '';
static String emergencyContactNumber2 = '';
static String emergencyRelation1 = '';
static String emergencyRelation2 = '';
static String emergencyRelationName1 = '';
static String emergencyRelationName2 = '';
static String bloodGroup = '';
static String email = ''; static String email = '';
static String age = ''; static String age = '';
static String gender = ''; static String gender = '';
@ -256,12 +293,15 @@ class AppSettings {
'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO'; 'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO';
//api urls //api urls
static String host = 'http://35.200.129.165:4000/api/'; //static String host = 'http://35.200.129.165:4000/api/';
static String host = 'http://cloudh.in:4000/api/';
static String loginUrl = host + 'login'; static String loginUrl = host + 'login';
static String signUpUrl = host + 'users'; static String signUpUrl = host + 'users';
static String generateQRCodeUrl = host + 'generate-qrcode'; static String generateQRCodeUrl = host + 'generate-qrcode';
static String sendSmsUrl = host + 'sendSms'; static String sendSmsUrl = host + 'sendSms';
static String phoneVerificationUrl = host + 'phone'; static String phoneVerificationUrl = host + 'phone';
static String forgotPasswordUrl = host + 'forgotpassword';
static String resetPasswordUrl = host + 'resetpassword';
static String verifyPhnUrl = host + 'phone'; static String verifyPhnUrl = host + 'phone';
static String resetTokenUrl = host + 'reset_token'; static String resetTokenUrl = host + 'reset_token';
static String bmiCaluculateUrl = host + 'insertBMI'; static String bmiCaluculateUrl = host + 'insertBMI';
@ -271,7 +311,9 @@ class AppSettings {
static String inviteFriendUrl = host + 'sendInviteLink'; static String inviteFriendUrl = host + 'sendInviteLink';
static String updateProfileUrl = host + 'update/currentUser'; static String updateProfileUrl = host + 'update/currentUser';
static String updateLocationUrl = host + 'updateLocation'; static String updateLocationUrl = host + 'updateLocation';
static String updatePinUrl = host + 'updateUserProfile';
static String uploadPicUrl = host + 'uploads'; static String uploadPicUrl = host + 'uploads';
static String uploadBloodGroupPicUrl = host + 'uploads-bloodGroup';
static String getBmiHistoryUrl = host + 'usersbmi'; static String getBmiHistoryUrl = host + 'usersbmi';
static String getBpHistoryUrl = host + 'usersbp'; static String getBpHistoryUrl = host + 'usersbp';
static String getSugarHistoryUrl = host + 'userssugar'; static String getSugarHistoryUrl = host + 'userssugar';
@ -316,16 +358,10 @@ class AppSettings {
static String getDynamicCodeDataUrl = host + 'getDoctorInfo'; static String getDynamicCodeDataUrl = host + 'getDoctorInfo';
static File? updatedImage; static File? updatedImage;
static String image = ''; static String image = '';
static String profilePictureUrl = ''; static String profilePictureUrl = '';
static String bloodGroupPictureUrl = '';
static var api = { static var api = {
'signIn': host + '/login', 'signIn': host + '/login',
}; };
@ -502,7 +538,6 @@ class AppSettings {
} }
} }
static Future<bool> sendSms(payload) async { static Future<bool> sendSms(payload) async {
var response = await http.post(Uri.parse(sendSmsUrl), var response = await http.post(Uri.parse(sendSmsUrl),
body: json.encode(payload), body: json.encode(payload),
@ -513,6 +548,7 @@ class AppSettings {
return false; return false;
} }
} }
static Future<bool> phoneVerification(payload) async { static Future<bool> phoneVerification(payload) async {
var response = await http.post(Uri.parse(phoneVerificationUrl), var response = await http.post(Uri.parse(phoneVerificationUrl),
body: json.encode(payload), body: json.encode(payload),
@ -524,6 +560,70 @@ class AppSettings {
} }
} }
static Future<bool> forgotPassword(payload) async {
var uri = Uri.parse(forgotPasswordUrl);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
// display error toast
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<bool> resetPassword(payload) async {
var uri = Uri.parse(resetPasswordUrl);
var response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
// display error toast
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> calculateBmi(payload) async { static Future<String> calculateBmi(payload) async {
var uri = Uri.parse(bmiCaluculateUrl + '/' + customerId); var uri = Uri.parse(bmiCaluculateUrl + '/' + customerId);
@ -723,11 +823,28 @@ class AppSettings {
userName = _response['username']; userName = _response['username'];
phoneNumber = _response['phone']; phoneNumber = _response['phone'];
email = _response['emails'][0]['email']; email = _response['emails'][0]['email'];
emergencyContactNumber1 = _response['emergencyContacts'][0]['contactNumber'];
emergencyContactNumber2 = _response['emergencyContacts'][1]['contactNumber'];
emergencyRelation1 = _response['emergencyContacts'][0]['relationship'];
emergencyRelation2 = _response['emergencyContacts'][1]['relationship'];
emergencyRelationName1 = _response['emergencyContacts'][0]['name'];
emergencyRelationName2 = _response['emergencyContacts'][1]['name'];
bloodGroup = _response['bloodGroup'];
age = _response['age'].toString(); age = _response['age'].toString();
await saveData('phone', _response['phone'], 'STRING'); await saveData('phone', _response['phone'], 'STRING');
await saveData('email', _response['emails'][0]['email'], 'STRING'); await saveData('email', _response['emails'][0]['email'], 'STRING');
await saveData('username', _response['username'], 'STRING'); await saveData('username', _response['username'], 'STRING');
await saveData('age', _response['age'].toString(), 'STRING'); await saveData('age', _response['age'].toString(), 'STRING');
await saveData('emergencyContactNumber1', _response['emergencyContacts'][0]['contactNumber'].toString(), 'STRING');
await saveData('emergencyContactNumber2',_response['emergencyContacts'][1]['contactNumber'].toString(), 'STRING');
await saveData('emergencyRelation1', _response['emergencyContacts'][0]['relationship'].toString(), 'STRING');
await saveData('emergencyRelation2', _response['emergencyContacts'][1]['relationship'].toString(), 'STRING');
await saveData('emergencyRelationName1', _response['emergencyContacts'][0]['name'].toString(), 'STRING');
await saveData('emergencyRelationName2', _response['emergencyContacts'][1]['name'].toString(), 'STRING');
await saveData('bloodGroup', _response['bloodGroup'].toString(), 'STRING');
await saveData('bloodGroupPicture', _response['blood_Group_picture'].toString(), 'STRING');
await loadDataFromMemory(); await loadDataFromMemory();
return true; return true;
} else { } else {
@ -741,6 +858,42 @@ class AppSettings {
static Future<bool> updateLocation(payload) async { static Future<bool> updateLocation(payload) async {
var uri = Uri.parse(updateLocationUrl + '/' + customerId); var uri = Uri.parse(updateLocationUrl + '/' + customerId);
try {
var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
var _response = json.decode(response.body);
print(_response);
userAddress = _response['user']['profile']['address1'];
detailedAddress = _response['user']['profile']['address2'];
userLatitude = _response['user']['latitude'];
userLongitude =_response['user']['longitude'];
await saveData('user_address', _response['user']['profile']['address1'], 'STRING');
await saveData('detailedAddress', _response['user']['profile']['address2'], 'STRING');
if(_response['user']['latitude']==0){
_response['user']['latitude']=0.0;
}
if(_response['user']['longitude']==0){
_response['user']['longitude']=0.0;
}
await saveData('latitude', _response['user']['latitude'], 'DOUBLE');
await saveData('longitude', _response['user']['longitude'], 'DOUBLE');
await loadDataFromMemory();
return true;
} else {
return false;
}
} catch (e) {
print(e);
return false;
}
}
static Future<bool> updatePin(payload) async {
var uri = Uri.parse(updatePinUrl + '/' + customerId);
try { try {
var response = await http.put(uri, var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders()); body: json.encode(payload), headers: await buildRequestHeaders());
@ -852,6 +1005,14 @@ class AppSettings {
var response = await http.Response.fromStream(res); var response = await http.Response.fromStream(res);
return response.body; return response.body;
} }
static Future<String> uploadBloodGroupImage(file) async {
var request = http.MultipartRequest(
'POST', Uri.parse(uploadBloodGroupPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> uploadImageHTTPForPrescriptions(file) async { static Future<String> uploadImageHTTPForPrescriptions(file) async {
var request = http.MultipartRequest( var request = http.MultipartRequest(
@ -1899,12 +2060,29 @@ class AppSettings {
await saveData('profile', input['simplydata']['picture'], 'STRING'); await saveData('profile', input['simplydata']['picture'], 'STRING');
await saveData('user_address', input['simplydata']['address1'], 'STRING'); await saveData('user_address', input['simplydata']['address1'], 'STRING');
await saveData('detailedAddress', input['simplydata']['address2'], 'STRING'); await saveData('detailedAddress', input['simplydata']['address2'], 'STRING');
if(input['simplydata']['latitude']==0){
input['simplydata']['latitude']=0.0;
}
if(input['simplydata']['longitude']==0){
input['simplydata']['longitude']=0.0;
}
await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE'); await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE');
await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE'); await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE');
await saveData('fcmId', input['simplydata']['fcmId'], 'STRING'); await saveData('fcmId', input['simplydata']['fcmId'], 'STRING');
await saveData('age', input['simplydata']['age'], 'STRING'); await saveData('age', input['simplydata']['age'], 'STRING');
await saveData('gender', input['simplydata']['gender'], 'STRING'); await saveData('gender', input['simplydata']['gender'], 'STRING');
await saveData('qrCode', input['simplydata']['qrCode'], 'STRING'); await saveData('qrCode', input['simplydata']['qrCode'], 'STRING');
if(input['simplydata']['emergencyContacts'].length!=0){
await saveData('emergencyContactNumber1', input['simplydata']['emergencyContacts'][0]['contactNumber'].toString(), 'STRING');
await saveData('emergencyContactNumber2',input['simplydata']['emergencyContacts'][1]['contactNumber'].toString(), 'STRING');
await saveData('emergencyRelation1', input['simplydata']['emergencyContacts'][0]['relationship'].toString(), 'STRING');
await saveData('emergencyRelation2', input['simplydata']['emergencyContacts'][1]['relationship'].toString(), 'STRING');
await saveData('emergencyRelationName1', input['simplydata']['emergencyContacts'][0]['name'].toString(), 'STRING');
await saveData('emergencyRelationName2', input['simplydata']['emergencyContacts'][1]['name'].toString(), 'STRING');
}
await saveData('bloodGroup', input['simplydata']['bloodGroup'].toString(), 'STRING');
await saveData('bloodGroupPicture', input['simplydata']['blood_Group_picture'].toString(), 'STRING');
//await saveData('age', input['simplydata']['age'], 'STRING'); //await saveData('age', input['simplydata']['age'], 'STRING');
//latitude,longitude //latitude,longitude
await loadDataFromMemory(); await loadDataFromMemory();
@ -1935,6 +2113,14 @@ class AppSettings {
age = await getData('age', 'STRING'); age = await getData('age', 'STRING');
gender = await getData('gender', 'STRING'); gender = await getData('gender', 'STRING');
originalQrCode = await getData('qrCode', 'STRING'); originalQrCode = await getData('qrCode', 'STRING');
emergencyContactNumber1 =await getData('emergencyContactNumber1', 'STRING');
emergencyContactNumber2 = await getData('emergencyContactNumber2', 'STRING');
emergencyRelation1 = await getData('emergencyRelation1', 'STRING');
emergencyRelation2 = await getData('emergencyRelation2', 'STRING');
emergencyRelationName1 = await getData('emergencyRelationName1', 'STRING');
emergencyRelationName2 =await getData('emergencyRelationName2', 'STRING');
bloodGroup = await getData('bloodGroup', 'STRING');
bloodGroupPictureUrl= await getData('bloodGroupPicture', 'STRING');
String dataUri = originalQrCode; String dataUri = originalQrCode;
// Split the data URI at the comma to extract the Base64 part // Split the data URI at the comma to extract the Base64 part

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

@ -73,7 +73,7 @@ class _SplashScreenState extends State<SplashScreen> {
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/splash_screen_new.gif"), fit: BoxFit.fill,), image: DecorationImage(image: AssetImage("images/splashscreen.png"), fit: BoxFit.fill,),
), ),
), ),

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

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

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -12,6 +13,7 @@ class SugarHistoryModel {
String actualDate=''; String actualDate='';
String sugarInfoId=''; String sugarInfoId='';
DateTime dateForFilter=new DateTime.now(); DateTime dateForFilter=new DateTime.now();
Color sugarValueColor=Colors.black;
SugarHistoryModel(); SugarHistoryModel();
@ -28,6 +30,28 @@ class SugarHistoryModel {
rtvm.actualDate = json['date'].toString() ?? ''; rtvm.actualDate = json['date'].toString() ?? '';
rtvm.sugarInfoId = json['sugarinfoid'].toString() ?? ''; rtvm.sugarInfoId = json['sugarinfoid'].toString() ?? '';
if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
rtvm.sugarValueColor=buttonColors;
}
else{
rtvm.sugarValueColor=Colors.black;
}
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date); //DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate); rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);

@ -13,12 +13,24 @@ class AddDoctor extends StatefulWidget {
class _AddDoctorState extends State<AddDoctor> { class _AddDoctorState extends State<AddDoctor> {
bool isPwdObscureText=true; bool isPwdObscureText=true;
TextEditingController doctorIdController = TextEditingController();
bool isFirstAddButtonShow=false; bool isFirstAddButtonShow=false;
bool isSecondAddButtonShow=false; bool isSecondAddButtonShow=false;
bool is2ndPlaceOfPracticeControllerVisible=false; bool is2ndPlaceOfPracticeControllerVisible=false;
bool is3rdPlaceOfPracticeControllerVisible=false; bool is3rdPlaceOfPracticeControllerVisible=false;
bool isConfirmPwdObscureText=true; bool isConfirmPwdObscureText=true;
TextEditingController doctorIdController = TextEditingController(); TextEditingController nameController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController emailController = TextEditingController();
/*TextEditingController ageController = TextEditingController();*/
TextEditingController specializationController = TextEditingController();
TextEditingController qualificationController = TextEditingController();
TextEditingController hospitalNameController1 = TextEditingController();
TextEditingController hospitalNameController2 = TextEditingController();
TextEditingController hospitalNameController3 = TextEditingController();
TextEditingController practiceAddressController1 = TextEditingController();
TextEditingController practiceAddressController2 = TextEditingController();
TextEditingController practiceAddressController3 = TextEditingController();
String? gender; String? gender;
List placeOfPractices=[]; List placeOfPractices=[];
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
@ -94,6 +106,7 @@ class _AddDoctorState extends State<AddDoctor> {
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: doctorIdController, controller: doctorIdController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration( decoration: const InputDecoration(
prefixIcon: Icon( prefixIcon: Icon(
Icons.person, Icons.person,
@ -113,8 +126,406 @@ class _AddDoctorState extends State<AddDoctor> {
), ),
), ),
), ),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'DoctorName',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),//name ),//name
SizedBox(height:MediaQuery.of(context).size.height * .02,), SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone_android,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter Mobile Number',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
), //mobile
/*SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: ageController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),*/
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Select Gender',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "male",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style:TextStyle(color: primaryColor,fontSize: 11)),
value: "female",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "other",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: qualificationController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.quickreply,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter qualifications',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: specializationController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.folder_special,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter specializations',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Place of practice',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice address',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2ndPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:hospitalNameController2.text!=''&&hospitalNameController2.text!='null'||is2ndPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rdPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: hospitalNameController3.text!=''&&hospitalNameController3.text!='null'||is3rdPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController3,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController3,
onChanged:(val) {
},
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
width:double.infinity, width:double.infinity,
height: MediaQuery.of(context).size.height * .06, height: MediaQuery.of(context).size.height * .06,
@ -124,11 +535,46 @@ class _AddDoctorState extends State<AddDoctor> {
onPrimary: Colors.white, // foreground onPrimary: Colors.white, // foreground
), ),
onPressed: () async{ onPressed: () async{
if(doctorIdController.text!=''){ if(doctorIdController.text!=''&&nameController.text!=''&&gender!=null){
if(hospitalNameController1!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController1.text,
'address': practiceAddressController1.text
});
}
if(hospitalNameController2!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController2.text,
'address': practiceAddressController2.text
});
}
if(hospitalNameController3!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController3.text,
'address': practiceAddressController3.text
});
}
int age=0;
/*if(ageController.text.toString()!=''||ageController.text.toString()!='null'){
age=int.parse(ageController.text.toString());
}
else{
age=0;
}*/
AppSettings.preLoaderDialog(context); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
payload["doctorId"] =doctorIdController.text.toString(); payload["doctorId"] =doctorIdController.text.toString();
payload["doctorName"] = nameController.text.toString();
payload["phone"] = mobileNumberController.text.toString();
payload["age"] = age;
payload["gender"] = gender;
payload["specialization"] = specializationController.text;
payload["qualification"] =qualificationController.text ;
payload["placeOfPractice"] =placeOfPractices ;
bool status = await AppSettings.addDoctor(payload); bool status = await AppSettings.addDoctor(payload);
if(status){ if(status){

@ -44,7 +44,7 @@ class _AllConnectionsState extends State<AllConnections>
var response = await AppSettings.getAllConnectedDoctors(); var response = await AppSettings.getAllConnectedDoctors();
setState(() { setState(() {
connectedDoctorsListOriginal = ((jsonDecode(response)) as List) connectedDoctorsListOriginal = ((jsonDecode(response)['doctors']) as List)
.map((dynamic model) { .map((dynamic model) {
return GetConnectedDoctorsModel.fromJson(model); return GetConnectedDoctorsModel.fromJson(model);
}).toList(); }).toList();

@ -17,7 +17,6 @@ class _DynamicCodeState extends State<DynamicCode> {
bool isDataLoading=false; bool isDataLoading=false;
bool isSereverIssue = false; bool isSereverIssue = false;
List<DynamicCodeModel> originalList = []; List<DynamicCodeModel> originalList = [];
List<String> items = ["1", "2", "3", "4", "5", "6", "7", "8"];
RefreshController _refreshController = RefreshController _refreshController =
RefreshController(initialRefresh: true); RefreshController(initialRefresh: true);
@ -37,7 +36,7 @@ class _DynamicCodeState extends State<DynamicCode> {
.map((dynamic model) { .map((dynamic model) {
return DynamicCodeModel.fromJson(model); return DynamicCodeModel.fromJson(model);
}).toList(); }).toList();
originalList=originalList.reversed.toList(); //originalList=originalList.reversed.toList();
isDataLoading = false; isDataLoading = false;
}); });
} catch (e) { } catch (e) {
@ -67,15 +66,11 @@ class _DynamicCodeState extends State<DynamicCode> {
// monitor network fetch // monitor network fetch
await Future.delayed(Duration(milliseconds: 1000)); await Future.delayed(Duration(milliseconds: 1000));
// if failed,use loadFailed(),if no data return,use LoadNodata() // if failed,use loadFailed(),if no data return,use LoadNodata()
items.add((items.length+1).toString());
if(mounted)
setState(() {
});
_refreshController.loadComplete(); _refreshController.loadComplete();
} }
Widget _renderUi(){ Widget _renderUi(){
//12. originalList=originalList.reversed.toList();
if(originalList.length!=0){ if(originalList.length!=0){
return ListView.builder( return ListView.builder(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),

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

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

Loading…
Cancel
Save