Health Calculator 3.0

merge-requests/490/head
devmirza121 3 years ago
parent d4eab13982
commit 6225f2468d

@ -1630,4 +1630,9 @@ const Map localizedValues = {
"RRTTitle": {"en": "RRT", "ar": "خدمة فريق"},
"RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"},
"transportation": {"en": "Transportation", "ar": "النقل"},
"neck": {"en": "Neck", "ar": "رقبه"},
"waist": {"en": "Waist", "ar": "وسط"},
"hip": {"en": "Hip", "ar": "ورك او نتوء"},
"carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"},
};

@ -1,4 +1,4 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'bmr_result_page.dart';
@ -30,9 +31,23 @@ class _BmrCalculatorState extends State<BmrCalculator> {
Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
int age = 0;
int height = 0;
int weight = 0;
final GlobalKey clinicDropdownKey = GlobalKey();
TextEditingController ageController = new TextEditingController();
TextEditingController _heightController = new TextEditingController();
TextEditingController _weightController = TextEditingController();
bool _isHeightCM = true;
bool _isWeightKG = true;
double _heightValue = 150;
double _weightValue = 40;
List<PopupMenuItem> _heightPopupList = List();
List<PopupMenuItem> _weightPopupList = List();
// int age = 0;
// int height = 0;
// int weight = 0;
double bmrResult = 0;
String dropdownValue = 'Lighty Active (1-3) days per week';
double calories = 0;
@ -99,10 +114,9 @@ class _BmrCalculatorState extends State<BmrCalculator> {
void calculateBmr() {
if (isMale == true) {
bmrResult = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age);
bmrResult = 66.5 + (13.75 * int.parse(_weightController.text)) + (5.003 * int.parse(_heightController.text)) - (6.755 * int.parse(ageController.text));
} else if (isMale == false) {
bmrResult =
655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age);
bmrResult = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text));
}
bmrResult = bmrResult.roundToDouble();
@ -124,6 +138,10 @@ class _BmrCalculatorState extends State<BmrCalculator> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -140,639 +158,303 @@ class _BmrCalculatorState extends State<BmrCalculator> {
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
child: SingleChildScrollView(
child: Container(
height: 850,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Calculates the amount of energy that the persons body expends in a day',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
Divider(
thickness: 2.0,
),
SizedBox(
height: 5.0,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 20,
),
Text(
TranslationBase.of(context).selectGender,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
body: Container(
height: double.infinity,
width: double.infinity,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(21.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Calculates the amount of energy that the persons body expends in a day',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
),
SizedBox(
height: 8.0,
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
updateColor(1);
isMale = false;
});
},
child: Row(
children: [
Container(
decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
width: 24,
height: 24,
padding: EdgeInsets.all(4),
child: Container(
width: double.infinity,
height: double.infinity,
decoration: containerRadius(!isMale?CustomColors.accentColor:Colors.white, 100),
),
),
mWidth(12),
Text(TranslationBase.of(context).female, style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),),
],
),
),
SizedBox(
height: 20,
),
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
updateColor(2);
isMale = true;
});
},
child: Row(
children: [
Container(
decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
width: 24,
height: 24,
padding: EdgeInsets.all(4),
child: Container(
width: double.infinity,
height: double.infinity,
decoration: containerRadius(isMale?CustomColors.accentColor:Colors.white, 100),
),
),
mWidth(12),
Text(TranslationBase.of(context).male, style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),),
],
),
Text(
TranslationBase.of(context).selectGender,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
],
),
),
SizedBox(
height: 5.0,
),
Texts(
'The Age ( 11 - 120 ) yrs',
),
SizedBox(
height: 10.0,
),
Row(
children: [
Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
SizedBox(
height: 8.0,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 60.0,
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
),
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
updateColor(1);
isMale = false;
});
},
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: Text(age.toString()),
children: [
Container(
decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
width: 24,
height: 24,
padding: EdgeInsets.all(4),
child: Container(
width: double.infinity,
height: double.infinity,
decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
if (age < 120) age++;
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (age > 0) age--;
});
},
),
],
mWidth(12),
Text(
TranslationBase.of(context).female,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: age.toDouble(),
min: 0,
max: 120,
onChanged: (double newValue) {
setState(() {
age = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
],
),
Texts(
'Height',
),
Row(
children: [
Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 60.0,
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
),
),
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
updateColor(2);
isMale = true;
});
},
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: Text(height.toString()),
children: [
Container(
decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
width: 24,
height: 24,
padding: EdgeInsets.all(4),
child: Container(
width: double.infinity,
height: double.infinity,
decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
if (height < 250)
height++;
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (height > 0) height--;
});
},
),
],
mWidth(12),
Text(
TranslationBase.of(context).male,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: height.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
height = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
],
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColorHeight(1);
isHeightCm = true;
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
color: cmCard,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts('CM')),
),
),
),
GestureDetector(
onTap: () {
setState(() {
updateColorHeight(2);
isHeightCm = false;
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: ftCard,
borderRadius: BorderRadius.circular(3.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts('Ft')),
),
SizedBox(
height: 12.0,
),
),
],
),
SizedBox(
height: 5.0,
),
Texts(
'Weight',
),
SizedBox(
height: 5.0,
),
Row(
children: [
Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController),
SizedBox(
height: 12.0,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 60.0,
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
),
),
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: Text(weight.toString()),
_commonInputAndUnitRow(
TranslationBase.of(context).height,
_heightController,
1,
270,
_heightValue,
(text) {
_heightController.text = text;
},
(value) {
_heightValue = value;
},
_isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
if (_isHeightCM != value) {
setState(() {
_isHeightCM = value;
});
}
},
_heightPopupList,
),
SizedBox(
height: 12.0,
),
_commonInputAndUnitRow(
TranslationBase.of(context).weight,
_weightController,
1,
270,
_weightValue,
(text) {
_weightController.text = text;
},
(value) {
_weightValue = value;
},
_isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
(value) {
if (_isWeightKG != value) {
setState(() {
_isWeightKG = value;
});
}
},
_weightPopupList,
),
SizedBox(
height: 12.0,
),
InkWell(
onTap: () {
// dropdownKey.currentState;
openDropdown(clinicDropdownKey);
},
child: Container(
// width: double.infinity,
// decoration: containerRadius(Colors.white, 12),
// padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).activityLevel,
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
if (weight < 250)
weight++;
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (weight > 0) weight--;
});
},
height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 0,
elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
],
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>[
'Almost Inactive(Little or no exercises)',
'Lighty Active (1-3) days per week',
'very Active(6-7) days per week',
'Super Active(very hard exercises)'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: weight.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
weight = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
Icon(Icons.keyboard_arrow_down),
],
),
],
),
),
],
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColorWeight(1);
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
color: kgCard,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts('KG')),
),
).withBorderedContainer,
),
),
GestureDetector(
onTap: () {
setState(() {
updateColorWeight(2);
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: lbCard,
borderRadius: BorderRadius.circular(3.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts('LB')),
),
SizedBox(
height: 25.0,
),
),
],
),
SizedBox(
height: 45.0,
),
Divider(
thickness: 2.0,
),
SizedBox(
height: 5.0,
),
Texts('Activity level'),
Container(
width: 300,
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>[
'Almost Inactive(Little or no exercises)',
'Lighty Active (1-3) days per week',
'very Active(6-7) days per week',
'Super Active(very hard exercises)'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
SizedBox(
height: 30.0,
),
Container(
height: 50.0,
width: 350.0,
child: SecondaryButton(
label: 'CALCULATE',
onTap: () {
setState(() {
calculateBmr();
calculateCalories();
{
Navigator.push(
context,
FadePage(
page: BmrResultPage(
bmrResult: bmrResult,
calories: calories,
)),
);
}
});
},
],
),
),
],
],
),
),
],
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () {
setState(() {
calculateBmr();
calculateCalories();
{
Navigator.push(
context,
FadePage(
page: BmrResultPage(
bmrResult: bmrResult,
calories: calories,
)),
);
}
});
},
),
),
],
),
),
);
}
void openDropdown(GlobalKey key) {
GestureDetector detector;
void searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget != null && element.widget is GestureDetector) {
detector = element.widget;
return false;
} else {
searchForGestureDetector(element);
}
return true;
});
}
searchForGestureDetector(key.currentContext);
assert(detector != null);
detector.onTap();
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
@ -830,15 +512,15 @@ class _BmrCalculatorState extends State<BmrCalculator> {
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@ -980,18 +662,4 @@ class CommonDropDownView extends StatelessWidget {
}
}
extension BorderedContainer on Widget {
Widget get withBorderedContainer => Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: this,
);
}

@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -27,50 +30,81 @@ class BmrResultPage extends StatelessWidget {
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Center(
child: CircularPercentIndicator(
radius: 220.0,
lineWidth: 20.0,
percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
bmrResult.toStringAsFixed(1),
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Calories",
style: TextStyle(
fontSize: 19,
letterSpacing: -1.34,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 5.0,
),
mHeight(20),
Center(
child: CircularPercentIndicator(
radius: 220.0,
lineWidth: 3.0,
percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
bmrResult.toStringAsFixed(1),
style: TextStyle(
fontSize: 17,
letterSpacing: -1.02,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 5.0,
),
Text(
'Calories',
style: TextStyle(
fontSize: 18,
letterSpacing: -1.08,
fontWeight: FontWeight.w600,
),
),
],
),
progressColor: CustomColors.accentColor,
backgroundColor: Colors.white,
),
Text(
'Calories/Day',
style: TextStyle(
fontSize: 16.0,
),
mHeight(20),
Text(
'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.',
style: TextStyle(
fontSize: 14,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
),
color: CustomColors.textColor
),
],
),
progressColor: Color(0xff3C3939),
),
),
Container(
height: 120,
width: 280.0,
child: Texts(
'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.'),
),
],
).withBorderedContainer,
),
mFlex(1),
Container(
width: 350,
child: Button(
label: TranslationBase.of(context).viewDocList,
onTap: () {
getDoctorsList(context);
}),
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
],
),
);
@ -129,3 +163,18 @@ class BmrResultPage extends StatelessWidget {
});
}
}
extension BorderedContainer on Widget {
Widget get withBorderedContainer => Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: this,
);
}

@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -41,49 +44,70 @@ class FatResult extends StatelessWidget {
showNewAppBar: true,
appBarTitle: TranslationBase.of(context).bodyFatTitle,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
// height: 40.0,
),
Center(
child: CircularPercentIndicator(
radius: 220.0,
lineWidth: 20.0,
percent: ((fat > 70) ? 100 : fat / 100),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
fat.toStringAsFixed(1) + '%',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).bodyFatTitle,
style: TextStyle(
fontSize: 19,
letterSpacing: -1.34,
fontWeight: FontWeight.bold,
),
),
mHeight(20),
Center(
child: CircularPercentIndicator(
radius: 220.0,
lineWidth: 3.0,
percent: ((fat > 70) ? 100 : fat / 100),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
fat.toStringAsFixed(1) + '%',
style: TextStyle(
fontSize: 17,
letterSpacing: -1.02,
fontWeight: FontWeight.w600,
),
),
],
),
progressColor: CustomColors.accentColor,
backgroundColor: Colors.white,
),
SizedBox(
height: 5.0,
),
mHeight(20),
Text(
textResult, style: TextStyle(
fontSize: 14,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: CustomColors.textColor
),
],
),
progressColor: inductorColor,
backgroundColor: Colors.white,
),
),
Container(
height: 120,
width: 280.0,
child: Texts(textResult),
),
],
).withBorderedContainer,
),
mFlex(1),
Container(
width: 350,
child: Button(
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
],
),
);
@ -142,3 +166,18 @@ class FatResult extends StatelessWidget {
});
}
}
extension BorderedContainer on Widget {
Widget get withBorderedContainer => Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: this,
);
}

@ -261,6 +261,7 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
SizedBox(
height: 12.0,
),
InkWell(
onTap: () {
// dropdownKey.currentState;

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@ -17,6 +18,7 @@ class Carbs extends StatefulWidget {
class _CarbsState extends State<Carbs> {
TextEditingController textController = new TextEditingController();
final GlobalKey clinicDropdownKey = GlobalKey();
int calories;
String dropdownValue;
bool _visible = false;
@ -67,9 +69,9 @@ class _CarbsState extends State<Carbs> {
void calculate() {
pCal = (protein / 100.0) * int.parse(textController.text).ceil();
cCal = (carbs / 100.0) * int.parse(textController.text);
;
fCal = (fat / 100) * int.parse(textController.text);
;
pCalGram = pCal / 4.0;
cCalGram = cCal / 4.0;
fCalGram = fCal / 9.0;
@ -95,286 +97,274 @@ class _CarbsState extends State<Carbs> {
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
child: SingleChildScrollView(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio',
),
SizedBox(
height: 15.0,
),
Column(
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(21),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 300.0,
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
),
),
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: TextFormField(
controller: textController,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter
.digitsOnly
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: " The Calories per day ",
labelStyle: TextStyle(
color: Colors.black87,
),
),
),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
int currentValue = int.parse(
textController.text);
currentValue++;
textController.text =
(currentValue).toString();
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
int currentValue = int.parse(
textController.text);
currentValue--;
textController.text =
(currentValue).toString();
});
},
),
],
),
),
],
),
),
),
),
],
Text(
'Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
SizedBox(
height: 20.0,
height: 15.0,
),
Button(
backgroundColor: Color(0xffC5272D),
label: 'NOT SURE? CLICK HERE',
onTap: () {
setState(() {
{
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
inputWidget("The Calories per day", "0", textController),
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(page: CalorieCalculator()),
);
}
});
},
},
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
'NOT SURE? CLICK HERE',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline),
),
),
)
],
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('Select Diet Type'),
Container(
width: 400,
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
calculateDietRatios();
dropdownValue == null
? _visible = false
: _visible = true;
});
},
items: <String>[
'Very Low Carb',
'Low Carb',
'Moderate Carb',
'USDA Gudilines',
'Zone Diet',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
SizedBox(
height: 12.0,
),
Visibility(
visible: _visible,
InkWell(
onTap: () {
// dropdownKey.currentState;
openDropdown(clinicDropdownKey);
},
child: Container(
height: 170.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// width: double.infinity,
// decoration: containerRadius(Colors.white, 12),
// padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Texts(
'Ratios are divided according to the selected diet'),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(text: 'Meals Per Day '),
TextSpan(
text: '$meals',
style: TextStyle(color: Color(0xffC5272D)),
),
],
),
),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextSpan(
text: 'Protein ',
),
TextSpan(
text: '$protein%',
style: TextStyle(color: Color(0xffC5272D)),
)
],
),
),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Carbohydrate ',
Text(
"Select Diet Type",
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
TextSpan(
text: '$carbs%',
style: TextStyle(color: Color(0xffC5272D)),
)
],
),
),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Fat ',
Container(
height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 0,
elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
calculateDietRatios();
});
},
items: <String>['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
),
TextSpan(
text: '$fat%',
style: TextStyle(color: Color(0xffC5272D)),
)
],
),
),
Icon(Icons.keyboard_arrow_down),
],
),
),
)
).withBorderedContainer,
),
SizedBox(
height: 25.0,
),
SizedBox(
height: 55.0,
),
],
),
SizedBox(
height: 55.0,
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () {
setState(() {
{
calculate();
Navigator.push(
context,
FadePage(
page: CarbsResult(
cCal: cCal,
pCal: pCal,
fCal: fCal,
pCalGram: pCalGram,
pCalMeal: pCalMeal,
fCalGram: fCalGram,
fCalMeal: fCalMeal,
cCalGram: cCalGram,
cCalMeal: cCalMeal,
)),
);
}
});
},
),
),
],
),
);
}
void openDropdown(GlobalKey key) {
GestureDetector detector;
void searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget != null && element.widget is GestureDetector) {
detector = element.widget;
return false;
} else {
searchForGestureDetector(element);
}
return true;
});
}
searchForGestureDetector(key.currentContext);
assert(detector != null);
detector.onTap();
}
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
Container(
height: 50.0,
width: 350.0,
child: SecondaryButton(
label: 'CALCULATE',
onTap: () {
setState(() {
{
calculate();
Navigator.push(
context,
FadePage(
page: CarbsResult(
cCal: cCal,
pCal: pCal,
fCal: fCal,
pCalGram: pCalGram,
pCalMeal: pCalMeal,
fCalGram: fCalGram,
fCalMeal: fCalMeal,
cCalGram: cCalGram,
cCalMeal: cCalMeal,
)),
);
}
});
},
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
),
);
}
),
);
}
extension BorderedContainer on Widget {
Widget get withBorderedContainer => Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: this,
);
}

@ -1,15 +1,20 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:provider/provider.dart';
class CarbsResult extends StatelessWidget {
double pCal;
@ -22,18 +27,11 @@ class CarbsResult extends StatelessWidget {
double cCalMeal;
double fCalMeal;
CarbsResult(
{this.pCal,
this.cCal,
this.fCal,
this.pCalGram,
this.cCalGram,
this.fCalGram,
this.fCalMeal,
this.cCalMeal,
this.pCalMeal});
CarbsResult({this.pCal, this.cCal, this.fCal, this.pCalGram, this.cCalGram, this.fCalGram, this.fCalMeal, this.cCalMeal, this.pCalMeal});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -43,135 +41,96 @@ class CarbsResult extends StatelessWidget {
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0),
child: Table(
border: TableBorder(
verticalInside: BorderSide(width: 1, color: Colors.black54),
bottom: BorderSide(width: 1, color: Colors.black54),
left: BorderSide(width: 1, color: Colors.black54),
right: BorderSide(width: 1, color: Colors.black54),
top: BorderSide(width: 1, color: Colors.black54),
),
Container(
decoration: containerRadius(Colors.white, 12),
padding: EdgeInsets.all(12),
margin: EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TableRow(
decoration: BoxDecoration(
color: Colors.white,
),
children: [
TableCell(
child: Center(
child: Texts('Description'),
),
),
TableCell(
child: Center(
child: Texts('Protein'),
),
),
TableCell(
child: Center(
child: Texts(
'Carbohydrate',
),
),
),
TableCell(
child: Center(
child: Texts('Fat'),
),
),
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(8.0),
child: TableCell(
child: Center(
child: Texts('Calories\n Per Day'),
),
),
),
TableCell(
child: Center(
child: Texts(pCal.ceil().toString() + ' Cals'),
),
),
TableCell(
child: Center(
child: Texts(cCal.ceil().toString() + ' Cals'),
),
),
TableCell(
child: Center(
child: Texts(fCal.ceil().toString() + ' Cals'),
),
),
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(8.0),
child: TableCell(
child: Center(
child: Texts('Grams Per\n Day'),
),
),
),
TableCell(
child: Center(
child: Texts(pCalGram.ceil().toString() + ' gr'),
),
),
TableCell(
child: Center(
child: Texts(cCalGram.ceil().toString() + ' gr'),
),
Text(
TranslationBase.of(context).carbsProtin,
style: TextStyle(
fontSize: 19,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
TableCell(
child: Center(
child: Texts(fCalGram.ceil().toString() + ' gr'),
),
),
]),
TableRow(children: [
Padding(
padding: EdgeInsets.all(8.0),
child: TableCell(
child: Center(
child: Texts('Grams Per\n Meal'),
),
),
),
TableCell(
child: Center(
child: Texts(pCalMeal.ceil().toString() + ' gr'),
),
),
TableCell(
child: Center(
child: Texts(cCalMeal.ceil().toString() + ' gr'),
),
),
TableCell(
child: Center(
child: Texts(fCalMeal.ceil().toString() + ' gr'),
),
),
]),
),
mHeight(12),
Table(
columnWidths: {
0: FlexColumnWidth(2.4),
1: FlexColumnWidth(1.8),
2: FlexColumnWidth(2),
3: FlexColumnWidth(1),
},
children: fullData(context, projectViewModel),
),
],
),
),
Container(
width: 350,
child: Button(
label: TranslationBase.of(context).viewDocList,
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).seeListOfDoctor,
color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
],
),
);
}
List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Utils.tableColumnTitle("Description"),
Utils.tableColumnTitle("Protein"),
Utils.tableColumnTitle("Carbohydrate"),
Utils.tableColumnTitle("Fat"),
],
),
);
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue("Calories Per Day", isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(pCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
],
),
);
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue("Grams Per Day", isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(pCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(cCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(fCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
],
),
);
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue('Grams Per Meal', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(pCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(cCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(fCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
],
),
);
return tableRow;
}
getDoctorsList(BuildContext context) {
@ -208,7 +167,7 @@ class CarbsResult extends StatelessWidget {
List<PatientDoctorAppointmentList> doctorByHospital = _patientDoctorAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
)
.toList();
if (doctorByHospital.length != 0) {
@ -226,5 +185,4 @@ class CarbsResult extends StatelessWidget {
print(err);
});
}
}

@ -1,10 +1,11 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'ideal_body_result_page.dart';
@ -24,8 +25,9 @@ class _IdealBodyState extends State<IdealBody> {
Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
int age = 0;
int height = 0;
// int age = 0;
// int height = 0;
double heightInches;
double minRange;
double maxRange;
@ -38,48 +40,22 @@ class _IdealBodyState extends State<IdealBody> {
double maxIdealWeight;
double heightFeet;
void updateColorHeight(int type) {
//MG/DLT card
if (type == 1) {
if (cmCard == inactiveCardColor) {
cmCard = activeCardColor;
ftCard = inactiveCardColor;
} else {
cmCard = inactiveCardColor;
}
}
if (type == 2) {
if (ftCard == inactiveCardColor) {
ftCard = activeCardColor;
cmCard = inactiveCardColor;
} else {
ftCard = inactiveCardColor;
}
}
}
final GlobalKey clinicDropdownKey = GlobalKey();
bool _isHeightCM = true;
bool _isWeightKG = true;
double _heightValue = 0;
double _weightValue = 0;
TextEditingController _heightController = new TextEditingController();
TextEditingController _weightController = TextEditingController();
List<PopupMenuItem> _heightPopupList = List();
List<PopupMenuItem> _weightPopupList = List();
void updateColorWeight(int type) {
//MG/DLT card
if (type == 1) {
if (kgCard == inactiveCardColor) {
kgCard = activeCardColor;
lbCard = inactiveCardColor;
} else {
kgCard = inactiveCardColor;
}
}
if (type == 2) {
if (lbCard == inactiveCardColor) {
lbCard = activeCardColor;
kgCard = inactiveCardColor;
} else {
lbCard = inactiveCardColor;
}
}
}
void calculateIdealWeight() {
heightInches = height * .39370078740157477;
heightInches = int.parse(_heightController.text) * .39370078740157477;
heightFeet = heightInches / 12;
idealWeight = (50 + 2.3 * (heightInches - 60));
if (dropdownValue == 'Small(fingers overlap)') {
@ -99,6 +75,9 @@ class _IdealBodyState extends State<IdealBody> {
@override
Widget build(BuildContext context) {
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -115,458 +94,418 @@ class _IdealBodyState extends State<IdealBody> {
),
)
],
body: Padding(
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0),
child: SingleChildScrollView(
child: Container(
height: 800.0,
child: Column(
children: [
Padding(
padding: EdgeInsets.all(10.0),
child: Texts(
'Calculates the ideal body weight based on height, Weight, and Body Size',
),
),
Divider(
thickness: 2.0,
),
SizedBox(
height: 5.0,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(21),
child: Column(
children: [
Texts(
'Height',
),
Row(
children: [
Expanded(
child: Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 60.0,
foregroundDecoration: BoxDecoration(
borderRadius:
BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
),
),
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: Text(height.toString()),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
if (height < 250)
height++;
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (height > 0) height--;
});
},
),
],
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: height.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
height = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
),
],
Text(
'Calculates the ideal body weight based on height, Weight, and Body Size',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColorHeight(1);
isHeightCm = true;
});
SizedBox(
height: 12.0,
),
_commonInputAndUnitRow(
TranslationBase.of(context).height,
_heightController,
1,
270,
_heightValue,
(text) {
_heightController.text = text;
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
color: cmCard,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts('CM')),
),
),
(value) {
_heightValue = value;
},
_isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
if (_isHeightCM != value) {
setState(() {
_isHeightCM = value;
});
}
},
_heightPopupList,
),
GestureDetector(
onTap: () {
setState(() {
updateColorHeight(2);
isHeightCm = false;
});
SizedBox(
height: 12.0,
),
_commonInputAndUnitRow(
TranslationBase.of(context).weight,
_weightController,
1,
270,
_weightValue,
(text) {
_weightController.text = text;
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: ftCard,
borderRadius: BorderRadius.circular(3.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts('Ft')),
),
),
(value) {
_weightValue = value;
},
_isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
(value) {
if (_isWeightKG != value) {
setState(() {
_isWeightKG = value;
});
}
},
_weightPopupList,
),
],
),
SizedBox(
height: 45.0,
),
Divider(
thickness: 2.0,
),
Texts(
'Weight',
),
SizedBox(
height: 5.0,
),
Row(
children: [
Expanded(
SizedBox(
height: 12.0,
),
InkWell(
onTap: () {
// dropdownKey.currentState;
openDropdown(clinicDropdownKey);
},
child: Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
),
// width: double.infinity,
// decoration: containerRadius(Colors.white, 12),
// padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 8.0),
child: Center(
child: Container(
width: 60.0,
foregroundDecoration: BoxDecoration(
borderRadius:
BorderRadius.circular(5.0),
border: Border.all(
color: Colors.blueGrey,
width: 2.0,
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Body Frame Size",
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
child: Row(
children: <Widget>[
Expanded(
child: Center(
child: Text(weight.toString()),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 0.5,
),
),
),
child: InkWell(
child: Icon(
Icons.arrow_drop_up,
size: 18.0,
),
onTap: () {
setState(() {
if (weight < 250)
weight++;
});
},
),
),
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (weight > 0) weight--;
});
},
),
],
Container(
height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 0,
elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>[
'Small(fingers overlap)',
'Medium(fingers touch)',
'Large(fingers don\'n touch)',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
],
),
),
),
),
),
Expanded(
child: Slider(
value: weight.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
weight = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
],
),
),
Icon(Icons.keyboard_arrow_down),
],
),
),
),
],
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColorWeight(1);
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
color: kgCard,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Center(child: Texts('KG')),
),
),
),
GestureDetector(
onTap: () {
setState(() {
updateColorWeight(2);
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: lbCard,
borderRadius: BorderRadius.circular(3.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(
0, 3), // changes position of shadow
),
],
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: Center(child: Texts('LB')),
),
),
).withBorderedContainer,
),
],
),
SizedBox(
height: 45.0,
),
Divider(
thickness: 2.0,
],
),
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () {
setState(() {
// calculateBmr();
// calculateCalories();
calculateIdealWeight();
print(idealWeight);
print(minRange);
print(maxRange);
print(overWeightBy);
print(textResult);
//print(overWeightBy);
{
Navigator.push(
context,
FadePage(
page: IdealBodyResult(
idealBodyWeight: idealWeight,
minRange: minRange,
mixRange: maxRange,
overWeightBy: overWeightBy,
textResult: textResult,
)),
);
}
});
},
),
),
],
),
);
}
void openDropdown(GlobalKey key) {
GestureDetector detector;
void searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget != null && element.widget is GestureDetector) {
detector = element.widget;
return false;
} else {
searchForGestureDetector(element);
}
return true;
});
}
searchForGestureDetector(key.currentContext);
assert(detector != null);
detector.onTap();
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
SizedBox(
height: 5.0,
),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
Texts('Body Frame Size'),
Container(
width: 300,
child: DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: TextStyle(color: Colors.black87),
underline: Container(
height: 2,
color: Colors.black54,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>[
'Small(fingers overlap)',
'Medium(fingers touch)',
'Large(fingers don\'n touch)',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
SizedBox(
height: 30.0,
),
Container(
height: 50.0,
width: 350.0,
child: SecondaryButton(
label: 'CALCULATE',
onTap: () {
setState(() {
// calculateBmr();
// calculateCalories();
calculateIdealWeight();
),
],
),
),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
),
),
);
}
print(idealWeight);
//print(overWeightBy);
{
Navigator.push(
context,
FadePage(
page: IdealBodyResult(
idealBodyWeight: idealWeight,
minRange: minRange,
mixRange: maxRange,
overWeightBy: overWeightBy,
textResult: textResult,
)),
);
}
});
},
),
),
],
Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
Function(bool) onUnitTap, _list) {
return Row(
children: [
Expanded(
flex: 3,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.44,
),
],
),
),
TextField(
controller: _controller,
keyboardType: TextInputType.number,
onChanged: (value) {
double _value = double.parse(value);
if (_value > _maxValue) {
onTextValueChange(_maxValue.toStringAsFixed(0));
onValueChange(_maxValue);
return;
} else if (_value < _minValue) {
onTextValueChange(_minValue.toStringAsFixed(0));
onValueChange(_minValue);
return;
} else if (_value >= _minValue && _value <= _maxValue) {
onValueChange(_value);
return;
}
},
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
],
style: TextStyle(
color: Color(0xff575757),
letterSpacing: -0.56,
),
decoration: InputDecoration(
isDense: true,
hintText: "0",
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
Expanded(
flex: 1,
child: PopupMenuButton(
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
onSelected: (value) {
onUnitTap(value);
},
itemBuilder: (context) => _list),
)
],
).withBorderedContainer;
}
}
// todo 'sikander' move these to separate file once usability known
class CommonDropDownView extends StatelessWidget {
final String title;
final String value;
final VoidCallback callback;
final IconData iconData;
CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: callback,
child: Row(
children: [
Expanded(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(
title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.44,
),
),
Text(
value,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
),
]),
),
Icon(
iconData ?? Icons.keyboard_arrow_down_sharp,
color: Color(0xff2E303A),
)
],
),
);
}
}

@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -28,139 +31,170 @@ class IdealBodyResult extends StatelessWidget {
appBarTitle: TranslationBase.of(context).idealBody,
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
'Ideal weight range is',
fontSize: 23.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
Texts(
minRange.toStringAsFixed(1),
fontSize: 30.0,
),
Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text(
'Kg',
style: TextStyle(color: Colors.red),
),
),
],
),
Icon(
Icons.arrow_forward,
color: Colors.red,
size: 55.0,
),
Row(
children: [
Texts(
mixRange.toStringAsFixed(1),
fontSize: 30.0,
),
Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text(
'Kg',
style: TextStyle(color: Colors.red),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Ideal weight range is',
style: TextStyle(
fontSize: 19,
letterSpacing: -1.34,
fontWeight: FontWeight.bold,
),
],
),
],
),
overWeightBy >= 0 && overWeightBy <= 10
? Column(
),
mHeight(12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Texts(
'Congratulations! The current weight is\n perfect and considered healthy',
fontSize: 20.0,
Row(
children: [
Texts(
minRange.toStringAsFixed(1),
fontSize: 30.0,
),
Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text(
'Kg',
style: TextStyle(color: Colors.red),
),
),
],
),
],
)
: overWeightBy > 10 && overWeightBy < 17
? Column(
Icon(
Icons.arrow_forward,
color: Colors.red,
size: 55.0,
),
Row(
children: [
Texts('This means that the weight is a little bit more than ideal weight by'),
Texts(overWeightBy.toStringAsFixed(1)),
Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
Texts(
mixRange.toStringAsFixed(1),
fontSize: 30.0,
),
Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text(
'Kg',
style: TextStyle(color: Colors.red),
),
),
],
)
: overWeightBy >= 18
? Container(
height: 250.0,
width: 350,
child: Column(
),
],
),
mHeight(12),
overWeightBy >= 0 && overWeightBy <= 10
? Column(
children: [
Texts(
'Congratulations! The current weight is perfect and considered healthy',
fontSize: 20.0,
),
],
)
: overWeightBy > 10 && overWeightBy < 17
? Column(
children: [
Texts(
'Means that you suffer from excessive\n obesity by',
),
SizedBox(
height: 55.0,
),
Texts(
overWeightBy.toStringAsFixed(1),
fontSize: 40.0,
),
SizedBox(
height: 25.0,
),
Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
Texts('This means that the weight is a little bit more than ideal weight by'),
Texts(overWeightBy.toStringAsFixed(1)),
Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
],
),
)
: overWeightBy < -18
? Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
'Under Weight',
fontSize: 18.0,
),
),
SizedBox(
height: 55.0,
),
Texts(
overWeightBy.toStringAsFixed(1),
fontSize: 20.0,
)
: overWeightBy >= 18
? Container(
child: Column(
children: [
Texts(
'Means that you suffer from excessive obesity by',
),
SizedBox(
height: 12.0,
),
Text(
overWeightBy.toStringAsFixed(1),
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
),
SizedBox(
height: 12.0,
),
Texts('May wish to consult with the doctor for medical help. Click to view our list of\n Doctors'),
],
),
],
)
: Container(
height: 250.0,
width: 350.0,
child: Column(
children: [
Texts(
'under wheight',
fontSize: 20.0,
),
SizedBox(
height: 55.0,
),
Texts(
overWeightBy.toStringAsFixed(1),
fontSize: 20.0,
),
SizedBox(
height: 25.0,
)
: overWeightBy < -18
? Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
'Under Weight',
fontSize: 18.0,
),
),
SizedBox(
height: 12.0,
),
Text(
overWeightBy.toStringAsFixed(1),
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
),
],
)
: Container(
child: Column(
children: [
Text(
'under wheight',
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
),
SizedBox(
height: 12.0,
),
Text(
overWeightBy.toStringAsFixed(1),
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
),
SizedBox(
height: 12.0,
),
Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
],
),
),
Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
],
),
),
],
).withBorderedContainer,
),
Container(
width: 350,
child: Button(
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
@ -224,3 +258,19 @@ class IdealBodyResult extends StatelessWidget {
});
}
}
extension BorderedContainer on Widget {
Widget get withBorderedContainer => Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: this,
);
}

@ -2618,6 +2618,10 @@ class TranslationBase {
String get RRTSubTitle => localizedValues["RRTSubTitle"][locale.languageCode];
String get transportation => localizedValues["transportation"][locale.languageCode];
String get neck => localizedValues["neck"][locale.languageCode];
String get waist => localizedValues["waist"][locale.languageCode];
String get hip => localizedValues["hip"][locale.languageCode];
String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -168,6 +168,7 @@ dependencies:
in_app_review: ^1.0.4
badges: ^1.1.4
syncfusion_flutter_sliders: ^18.4.49-beta
# Dep by Zohaib
shimmer: ^1.1.2

Loading…
Cancel
Save