parent
903f044073
commit
a35d50972f
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 805 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,267 @@
|
||||
import 'dart:convert';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/models/bmi_history_model.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class BMIHistory extends StatefulWidget {
|
||||
const BMIHistory({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BMIHistory> createState() => _BMIHistoryState();
|
||||
}
|
||||
|
||||
class _BMIHistoryState extends State<BMIHistory> {
|
||||
|
||||
bool isLoading=false;
|
||||
List<BmiHistoryModel> bmiHistoryList = [];
|
||||
List<BmiHistoryModel> FilteredList = [];
|
||||
var dateItems = [
|
||||
'last 7 days',
|
||||
'last one month',
|
||||
'last one year',
|
||||
];
|
||||
var dateItemsVariable = 'last 7 days';
|
||||
|
||||
Future<void> getBmiHistoryDetails(var selectedRange) async {
|
||||
isLoading=true;
|
||||
var response1= await AppSettings.getBmiHistory();
|
||||
print(response1);
|
||||
setState(() {
|
||||
bmiHistoryList =
|
||||
((jsonDecode(response1)) as List).map((dynamic model) {
|
||||
return BmiHistoryModel.fromJson(model);
|
||||
}).toList();
|
||||
|
||||
var now = new DateTime.now();
|
||||
var now_1w = now.subtract(Duration(days: 7));
|
||||
var now_1m = new DateTime(now.year, now.month-1, now.day);
|
||||
var now_1y = new DateTime(now.year-1, now.month, now.day);
|
||||
|
||||
if(selectedRange.toString().toUpperCase()=='LAST 7 DAYS'){
|
||||
FilteredList=bmiHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1w.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE MONTH'){
|
||||
FilteredList=bmiHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1m.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE YEAR'){
|
||||
FilteredList=bmiHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1y.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else{
|
||||
FilteredList=bmiHistoryList;
|
||||
}
|
||||
|
||||
|
||||
isLoading=false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getBmiHistoryDetails(dateItemsVariable);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget renderzUi(){
|
||||
if(bmiHistoryList.length!=0){
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||
child: DropdownButtonFormField(
|
||||
// Initial Value
|
||||
value: dateItemsVariable,
|
||||
isExpanded: true,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.calendar_month,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Units',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
|
||||
hint: Text('Units'),
|
||||
// Down Arrow Icon
|
||||
//icon: const Icon(Icons.keyboard_arrow_down),
|
||||
|
||||
// Array list of items
|
||||
items: dateItems.map((String items) {
|
||||
return DropdownMenuItem(
|
||||
value: items,
|
||||
child: Text(
|
||||
items,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
));
|
||||
}).toList(),
|
||||
// After selecting the desired option,it will
|
||||
// change button value to selected value
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
dateItemsVariable = newValue!;
|
||||
});
|
||||
getBmiHistoryDetails(dateItemsVariable);
|
||||
},
|
||||
),),
|
||||
|
||||
Expanded(child:ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: FilteredList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Card(
|
||||
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding:EdgeInsets.all(8) ,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * .55,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/height.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].height.toString().toUpperCase()+' ft',style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/weight.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].weight.toString().toUpperCase()+' Kgs',style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/date.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].displayDate.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/weight.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].bmiValue.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}) ),
|
||||
]);
|
||||
}
|
||||
else{
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
||||
Text('No Data'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Body Mass Index'),
|
||||
body: isLoading?Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
):renderzUi(),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/BMI/bmi_history.dart';
|
||||
import 'package:healthcare_user/BP/bp_history.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class BPCalculator extends StatefulWidget {
|
||||
const BPCalculator({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BPCalculator> createState() => _BPCalculatorState();
|
||||
}
|
||||
|
||||
class _BPCalculatorState extends State<BPCalculator> {
|
||||
|
||||
TextEditingController systoloicController = TextEditingController();
|
||||
TextEditingController diastolicController = TextEditingController();
|
||||
String bpValue = '';
|
||||
String bpText = '';
|
||||
var heightUnitItems = [
|
||||
'feet',
|
||||
'cm',
|
||||
'inches',
|
||||
];
|
||||
var heightUnits = 'feet';
|
||||
var weightUnitItems = [
|
||||
'kg',
|
||||
'gr',
|
||||
];
|
||||
var weightUnits = 'kg';
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Blood Pressure'),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: systoloicController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Enter systolic value',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: diastolicController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Enter diastolic value',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextButton(
|
||||
child: Text('Check BP', style: textButtonStyle()),
|
||||
onPressed: () async {
|
||||
if (systoloicController.text != '' &&
|
||||
diastolicController.text != '') {
|
||||
AppSettings.preLoaderDialog(context);
|
||||
var payload = new Map<String, dynamic>();
|
||||
|
||||
payload["Systolic"] = double.parse(systoloicController.text.toString());
|
||||
payload["Diastolic"] = double.parse(diastolicController.text.toString());
|
||||
|
||||
var value = await AppSettings.calculateBP(payload);
|
||||
var valueResponse = jsonDecode(value);
|
||||
print(valueResponse);
|
||||
setState(() {
|
||||
bpValue = valueResponse['userDetails']['bpCategory'].toString();
|
||||
/*bpValue = valueResponse['userDetails']['bmivalue'].toString();
|
||||
if(double.parse(bpValue)<18.5){
|
||||
bpText='Underweight';
|
||||
}
|
||||
else if(double.parse(bpValue)>=18.5&&double.parse(bpValue)<=24.9){
|
||||
bpText='Normal weight';
|
||||
}
|
||||
else if(double.parse(bpValue)>=25&&double.parse(bpValue)<=29.9){
|
||||
bpText='Overweight';
|
||||
}
|
||||
else if(double.parse(bpValue)>=30){
|
||||
bpText='Obesity';
|
||||
}*/
|
||||
});
|
||||
systoloicController.clear();
|
||||
diastolicController.clear();
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(bpValue,style: TextStyle(color: Colors.red),),
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BPHistory()),
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.history,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
|
||||
child: Container(
|
||||
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
|
||||
),)
|
||||
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/models/bmi_history_model.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/models/bp_history_model.dart';
|
||||
|
||||
class BPHistory extends StatefulWidget {
|
||||
const BPHistory({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BPHistory> createState() => _BPHistoryState();
|
||||
}
|
||||
|
||||
class _BPHistoryState extends State<BPHistory> {
|
||||
|
||||
bool isLoading=false;
|
||||
List<BPHistoryModel> BpHistoryList = [];
|
||||
List<BPHistoryModel> FilteredList = [];
|
||||
var dateItems = [
|
||||
'last 7 days',
|
||||
'last one month',
|
||||
'last one year',
|
||||
];
|
||||
var dateItemsVariable = 'last 7 days';
|
||||
|
||||
Future<void> getBmiHistoryDetails(var selectedRange) async {
|
||||
isLoading=true;
|
||||
var response1= await AppSettings.getBPHistory();
|
||||
print(response1);
|
||||
setState(() {
|
||||
BpHistoryList =
|
||||
((jsonDecode(response1)) as List).map((dynamic model) {
|
||||
return BPHistoryModel.fromJson(model);
|
||||
}).toList();
|
||||
|
||||
var now = new DateTime.now();
|
||||
var now_1w = now.subtract(Duration(days: 7));
|
||||
var now_1m = new DateTime(now.year, now.month-1, now.day);
|
||||
var now_1y = new DateTime(now.year-1, now.month, now.day);
|
||||
|
||||
if(selectedRange.toString().toUpperCase()=='LAST 7 DAYS'){
|
||||
FilteredList=BpHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1w.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE MONTH'){
|
||||
FilteredList=BpHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1m.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE YEAR'){
|
||||
FilteredList=BpHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1y.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else{
|
||||
FilteredList=BpHistoryList;
|
||||
}
|
||||
|
||||
|
||||
isLoading=false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getBmiHistoryDetails(dateItemsVariable);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget renderzUi(){
|
||||
if(BpHistoryList.length!=0){
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||
child: DropdownButtonFormField(
|
||||
// Initial Value
|
||||
value: dateItemsVariable,
|
||||
isExpanded: true,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.calendar_month,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Units',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
|
||||
hint: Text('Units'),
|
||||
// Down Arrow Icon
|
||||
//icon: const Icon(Icons.keyboard_arrow_down),
|
||||
|
||||
// Array list of items
|
||||
items: dateItems.map((String items) {
|
||||
return DropdownMenuItem(
|
||||
value: items,
|
||||
child: Text(
|
||||
items,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
));
|
||||
}).toList(),
|
||||
// After selecting the desired option,it will
|
||||
// change button value to selected value
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
dateItemsVariable = newValue!;
|
||||
});
|
||||
getBmiHistoryDetails(dateItemsVariable);
|
||||
},
|
||||
),),
|
||||
|
||||
Expanded(child:ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: FilteredList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Card(
|
||||
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding:EdgeInsets.all(8) ,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * .55,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/* Image(
|
||||
image: const AssetImage('images/height.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),*/
|
||||
Text('Systolic',style: TextStyle(color: primaryColor),),
|
||||
SizedBox(width: 5,),
|
||||
Padding(padding: EdgeInsets.all(1),
|
||||
child: Text(FilteredList[index].systolic.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Diastolic',style: TextStyle(color: primaryColor),),
|
||||
Padding(padding: EdgeInsets.all(1),
|
||||
child: Text(FilteredList[index].diastolic.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/height.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].bpText.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/date.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].displayDate.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}) ),
|
||||
]);
|
||||
}
|
||||
else{
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
||||
Text('No data'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Blood Pressure'),
|
||||
body: isLoading?Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
):renderzUi(),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/BMI/bmi_history.dart';
|
||||
import 'package:healthcare_user/BP/bp_history.dart';
|
||||
import 'package:healthcare_user/Sugar/sugar_history.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class SugarCalculator extends StatefulWidget {
|
||||
const SugarCalculator({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SugarCalculator> createState() => _SugarCalculatorState();
|
||||
}
|
||||
|
||||
class _SugarCalculatorState extends State<SugarCalculator> {
|
||||
|
||||
TextEditingController fastingValueController = TextEditingController();
|
||||
TextEditingController postParandialValueController = TextEditingController();
|
||||
String sugarValue = '';
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Diabetes'),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: fastingValueController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Enter fasting sugar value',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: postParandialValueController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Enter PostPrandial value',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextButton(
|
||||
child: Text('Check Sugar', style: textButtonStyle()),
|
||||
onPressed: () async {
|
||||
if (fastingValueController.text != '' &&
|
||||
postParandialValueController.text != '') {
|
||||
AppSettings.preLoaderDialog(context);
|
||||
var payload = new Map<String, dynamic>();
|
||||
|
||||
payload["fasting"] = double.parse(fastingValueController.text.toString());
|
||||
payload["postPrandial"] = double.parse(postParandialValueController.text.toString());
|
||||
|
||||
var value = await AppSettings.calculateSugar(payload);
|
||||
var valueResponse = jsonDecode(value);
|
||||
print(valueResponse);
|
||||
setState(() {
|
||||
sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
|
||||
|
||||
});
|
||||
fastingValueController.clear();
|
||||
postParandialValueController.clear();
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(sugarValue,style: TextStyle(color: Colors.red),),
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SugarHistory()),
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.history,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
|
||||
child: Container(
|
||||
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
|
||||
),)
|
||||
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,281 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/models/bmi_history_model.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/models/bp_history_model.dart';
|
||||
import 'package:healthcare_user/models/sugar_history_model.dart';
|
||||
|
||||
class SugarHistory extends StatefulWidget {
|
||||
const SugarHistory({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SugarHistory> createState() => _SugarHistoryState();
|
||||
}
|
||||
|
||||
class _SugarHistoryState extends State<SugarHistory> {
|
||||
|
||||
bool isLoading=false;
|
||||
List<SugarHistoryModel> sugarHistoryList = [];
|
||||
List<SugarHistoryModel> FilteredList = [];
|
||||
var dateItems = [
|
||||
'last 7 days',
|
||||
'last one month',
|
||||
'last one year',
|
||||
];
|
||||
var dateItemsVariable = 'last 7 days';
|
||||
|
||||
Future<void> getSugarHistoryDetails(var selectedRange) async {
|
||||
isLoading=true;
|
||||
var response1= await AppSettings.getSugarHistory();
|
||||
print(response1);
|
||||
setState(() {
|
||||
sugarHistoryList =
|
||||
((jsonDecode(response1)) as List).map((dynamic model) {
|
||||
return SugarHistoryModel.fromJson(model);
|
||||
}).toList();
|
||||
|
||||
var now = new DateTime.now();
|
||||
var now_1w = now.subtract(Duration(days: 7));
|
||||
var now_1m = new DateTime(now.year, now.month-1, now.day);
|
||||
var now_1y = new DateTime(now.year-1, now.month, now.day);
|
||||
|
||||
if(selectedRange.toString().toUpperCase()=='LAST 7 DAYS'){
|
||||
FilteredList=sugarHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1w.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE MONTH'){
|
||||
FilteredList=sugarHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1m.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else if(selectedRange.toString().toUpperCase()=='LAST ONE YEAR'){
|
||||
FilteredList=sugarHistoryList.where((product) {
|
||||
final date = product.dateForFilter;
|
||||
return now_1y.isBefore(date);
|
||||
}).toList();
|
||||
}
|
||||
else{
|
||||
FilteredList=sugarHistoryList;
|
||||
}
|
||||
|
||||
|
||||
isLoading=false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getSugarHistoryDetails(dateItemsVariable);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget renderzUi(){
|
||||
if(sugarHistoryList.length!=0){
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||
child: DropdownButtonFormField(
|
||||
// Initial Value
|
||||
value: dateItemsVariable,
|
||||
isExpanded: true,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.calendar_month,
|
||||
color: primaryColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
labelText: 'Units',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
|
||||
hint: Text('Units'),
|
||||
// Down Arrow Icon
|
||||
//icon: const Icon(Icons.keyboard_arrow_down),
|
||||
|
||||
// Array list of items
|
||||
items: dateItems.map((String items) {
|
||||
return DropdownMenuItem(
|
||||
value: items,
|
||||
child: Text(
|
||||
items,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
));
|
||||
}).toList(),
|
||||
// After selecting the desired option,it will
|
||||
// change button value to selected value
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
dateItemsVariable = newValue!;
|
||||
});
|
||||
getSugarHistoryDetails(dateItemsVariable);
|
||||
},
|
||||
),),
|
||||
|
||||
Expanded(child:ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: FilteredList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Card(
|
||||
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding:EdgeInsets.all(8) ,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * .55,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image(
|
||||
image: const AssetImage('images/height.png'),
|
||||
height: 25,
|
||||
width: 25,
|
||||
fit: BoxFit.fill),
|
||||
Padding(padding: EdgeInsets.all(5),
|
||||
child: Text(FilteredList[index].fasting.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].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].displayDate.toString().toUpperCase(),style: valuesTextStyle()),)
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}) ),
|
||||
]);
|
||||
}
|
||||
else{
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
||||
Text('No data'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Diabetes'),
|
||||
body: isLoading?Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
):renderzUi(),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/settings.dart';
|
||||
|
||||
class BMIHistory extends StatefulWidget {
|
||||
const BMIHistory({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BMIHistory> createState() => _BMIHistoryState();
|
||||
}
|
||||
|
||||
class _BMIHistoryState extends State<BMIHistory> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Body Mass Index'),
|
||||
body: Container(
|
||||
|
||||
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:healthcare_user/dashboard.dart';
|
||||
import 'package:healthcare_user/settings.dart';
|
||||
import 'package:healthcare_user/signup.dart';
|
||||
import 'package:healthcare_user/common/dashboard.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/signup.dart';
|
||||
import 'package:path/path.dart' as Path;
|
||||
|
||||
class Login extends StatefulWidget {
|
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/dashboard.dart';
|
||||
import 'package:healthcare_user/login.dart';
|
||||
import 'package:healthcare_user/settings.dart';
|
||||
import 'package:healthcare_user/common/login.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
class OtpScreen extends StatefulWidget {
|
||||
var myObject;
|
||||
OtpScreen({this.myObject});
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/settings.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class Dialogs {
|
||||
static Future<void> showLoadingDialog(BuildContext context, GlobalKey key) async {
|
@ -1,11 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:healthcare_user/settings.dart';
|
||||
import 'package:healthcare_user/signup.dart';
|
||||
|
||||
import 'dashboard.dart';
|
||||
import 'package:healthcare_user/common/dashboard.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/signup.dart';
|
||||
|
||||
void main() async{
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
||||
class BmiHistoryModel {
|
||||
String bmiValue = '';
|
||||
String height= '';
|
||||
String weight= '';
|
||||
String date= '';
|
||||
String displayDate='';
|
||||
DateTime dateForFilter=new DateTime.now();
|
||||
|
||||
|
||||
BmiHistoryModel();
|
||||
|
||||
factory BmiHistoryModel.fromJson(Map<String, dynamic> json){
|
||||
BmiHistoryModel rtvm = new BmiHistoryModel();
|
||||
/*"heightUnit": "feet",
|
||||
"weightUnit": "kg",
|
||||
"_id": "6493fe48eca67b71b8444e24",
|
||||
"bmiinfoid": "BMI1687420488845468",
|
||||
"customerId": "AHSUSNE2",
|
||||
"height": "164.592",
|
||||
"weight": "50",
|
||||
"age": 27,
|
||||
"bmivalue": 18.46,
|
||||
"createdAt": "2023-06-22T07:54:48.847Z",
|
||||
"updatedAt": "2023-06-22T07:54:48.847Z",*/
|
||||
|
||||
rtvm.bmiValue = json['bmivalue'].toString() ?? '';
|
||||
rtvm.height = json['height'].toString() ?? '';
|
||||
rtvm.weight = json['weight'].toString() ?? '';
|
||||
rtvm.date = json['createdAt'].toString() ?? '';
|
||||
|
||||
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
|
||||
DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
|
||||
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
|
||||
rtvm.dateForFilter=parseDate;
|
||||
var outputDate = outputFormat.format(parseDate);
|
||||
rtvm.displayDate=outputDate;
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
||||
class BPHistoryModel {
|
||||
String bpText = '';
|
||||
String systolic= '';
|
||||
String diastolic= '';
|
||||
String date= '';
|
||||
String displayDate='';
|
||||
DateTime dateForFilter=new DateTime.now();
|
||||
|
||||
|
||||
BPHistoryModel();
|
||||
|
||||
factory BPHistoryModel.fromJson(Map<String, dynamic> json){
|
||||
BPHistoryModel rtvm = new BPHistoryModel();
|
||||
/*"heightUnit": "feet",
|
||||
"weightUnit": "kg",
|
||||
"_id": "6493fe48eca67b71b8444e24",
|
||||
"bmiinfoid": "BMI1687420488845468",
|
||||
"customerId": "AHSUSNE2",
|
||||
"height": "164.592",
|
||||
"weight": "50",
|
||||
"age": 27,
|
||||
"bmivalue": 18.46,
|
||||
"createdAt": "2023-06-22T07:54:48.847Z",
|
||||
"updatedAt": "2023-06-22T07:54:48.847Z",*/
|
||||
|
||||
rtvm.bpText = json['bpCategory'].toString() ?? '';
|
||||
rtvm.systolic = json['Systolic'].toString() ?? '';
|
||||
rtvm.diastolic = json['Diastolic'].toString() ?? '';
|
||||
rtvm.date = json['createdAt'].toString() ?? '';
|
||||
|
||||
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
|
||||
DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
|
||||
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
|
||||
rtvm.dateForFilter=parseDate;
|
||||
var outputDate = outputFormat.format(parseDate);
|
||||
rtvm.displayDate=outputDate;
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class PharmaciesModel {
|
||||
String pharmacy_name = '';
|
||||
String status='';
|
||||
String picture='';
|
||||
Color text_color=Colors.black;
|
||||
double lat=0;
|
||||
double lng=0;
|
||||
|
||||
PharmaciesModel();
|
||||
|
||||
factory PharmaciesModel.fromJson(Map<String, dynamic> json){
|
||||
PharmaciesModel rtvm = new PharmaciesModel();
|
||||
|
||||
rtvm.pharmacy_name = json['pharmacyname'] ?? '';
|
||||
rtvm.picture = json['pharmacyname'] ?? '';
|
||||
rtvm.status = json['status'] ?? '';
|
||||
rtvm.lat = json['latitude'] ?? 0;
|
||||
rtvm.lng = json['longitude'] ??0;
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
||||
class SugarHistoryModel {
|
||||
String sugartText = '';
|
||||
String sugarValue = '';
|
||||
String fasting= '';
|
||||
String postPrandial= '';
|
||||
String date= '';
|
||||
String displayDate='';
|
||||
DateTime dateForFilter=new DateTime.now();
|
||||
|
||||
|
||||
SugarHistoryModel();
|
||||
|
||||
factory SugarHistoryModel.fromJson(Map<String, dynamic> json){
|
||||
SugarHistoryModel rtvm = new SugarHistoryModel();
|
||||
/*"heightUnit": "feet",
|
||||
"weightUnit": "kg",
|
||||
"_id": "6493fe48eca67b71b8444e24",
|
||||
"bmiinfoid": "BMI1687420488845468",
|
||||
"customerId": "AHSUSNE2",
|
||||
"height": "164.592",
|
||||
"weight": "50",
|
||||
"age": 27,
|
||||
"bmivalue": 18.46,
|
||||
"createdAt": "2023-06-22T07:54:48.847Z",
|
||||
"updatedAt": "2023-06-22T07:54:48.847Z",*/
|
||||
|
||||
rtvm.sugartText = json['sugarCategory'].toString() ?? '';
|
||||
rtvm.sugarValue = json['sugarValue'].toString() ?? '';
|
||||
rtvm.fasting = json['fasting'].toString() ?? '';
|
||||
rtvm.postPrandial = json['postPrandial'].toString() ?? '';
|
||||
rtvm.date = json['createdAt'].toString() ?? '';
|
||||
|
||||
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
|
||||
DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
|
||||
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
|
||||
rtvm.dateForFilter=parseDate;
|
||||
var outputDate = outputFormat.format(parseDate);
|
||||
rtvm.displayDate=outputDate;
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue