Health Calculator 3.0

merge-update-with-lab-changes
devmirza121 4 years ago
parent d4eab13982
commit 6225f2468d

@ -1630,4 +1630,9 @@ const Map localizedValues = {
"RRTTitle": {"en": "RRT", "ar": "خدمة فريق"}, "RRTTitle": {"en": "RRT", "ar": "خدمة فريق"},
"RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"}, "RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"},
"transportation": {"en": "Transportation", "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/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.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:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'bmr_result_page.dart'; import 'bmr_result_page.dart';
@ -30,9 +31,23 @@ class _BmrCalculatorState extends State<BmrCalculator> {
Color lbCard = inactiveCardColor; Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor; Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor; Color ftCard = inactiveCardColor;
int age = 0;
int height = 0; final GlobalKey clinicDropdownKey = GlobalKey();
int weight = 0; 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; double bmrResult = 0;
String dropdownValue = 'Lighty Active (1-3) days per week'; String dropdownValue = 'Lighty Active (1-3) days per week';
double calories = 0; double calories = 0;
@ -99,10 +114,9 @@ class _BmrCalculatorState extends State<BmrCalculator> {
void calculateBmr() { void calculateBmr() {
if (isMale == true) { 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) { } else if (isMale == false) {
bmrResult = bmrResult = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text));
655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age);
} }
bmrResult = bmrResult.roundToDouble(); bmrResult = bmrResult.roundToDouble();
@ -124,6 +138,10 @@ class _BmrCalculatorState extends State<BmrCalculator> {
@override @override
Widget build(BuildContext context) { 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( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
@ -140,11 +158,15 @@ class _BmrCalculatorState extends State<BmrCalculator> {
), ),
) )
], ],
body: Padding( body: Container(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), height: double.infinity,
width: double.infinity,
child: Column(
children: [
Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Padding(
height: 850, padding: const EdgeInsets.all(21.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -157,12 +179,6 @@ class _BmrCalculatorState extends State<BmrCalculator> {
color: CustomColors.textColor, color: CustomColors.textColor,
), ),
), ),
Divider(
thickness: 2.0,
),
SizedBox(
height: 5.0,
),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -203,15 +219,18 @@ class _BmrCalculatorState extends State<BmrCalculator> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration: containerRadius(!isMale?CustomColors.accentColor:Colors.white, 100), decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100),
), ),
), ),
mWidth(12), mWidth(12),
Text(TranslationBase.of(context).female, style: TextStyle( Text(
TranslationBase.of(context).female,
style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.56, letterSpacing: -0.56,
),), ),
),
], ],
), ),
), ),
@ -234,15 +253,18 @@ class _BmrCalculatorState extends State<BmrCalculator> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration: containerRadius(isMale?CustomColors.accentColor:Colors.white, 100), decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100),
), ),
), ),
mWidth(12), mWidth(12),
Text(TranslationBase.of(context).male, style: TextStyle( Text(
TranslationBase.of(context).male,
style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.56, letterSpacing: -0.56,
),), ),
),
], ],
), ),
), ),
@ -251,469 +273,94 @@ class _BmrCalculatorState extends State<BmrCalculator> {
), ),
), ),
SizedBox( SizedBox(
height: 5.0, height: 12.0,
),
Texts(
'The Age ( 11 - 120 ) yrs',
), ),
inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController),
SizedBox( SizedBox(
height: 10.0, height: 12.0,
), ),
Row( _commonInputAndUnitRow(
children: [ TranslationBase.of(context).height,
Container( _heightController,
width: 340.0, 1,
height: 60.0, 270,
decoration: BoxDecoration( _heightValue,
color: Colors.white, (text) {
), _heightController.text = text;
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(age.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 (age < 120) age++;
});
}, },
), (value) {
), _heightValue = value;
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (age > 0) age--;
});
}, },
), _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
], (value) {
), if (_isHeightCM != value) {
),
],
),
),
),
),
Expanded(
child: Slider(
value: age.toDouble(),
min: 0,
max: 120,
onChanged: (double newValue) {
setState(() { setState(() {
age = newValue.round(); _isHeightCM = value;
}); });
}
}, },
activeColor: Color(0xffC5272D), _heightPopupList,
inactiveColor: Color(0xffF3C5C6),
),
),
],
), ),
), SizedBox(
], height: 12.0,
), ),
Texts( _commonInputAndUnitRow(
'Height', TranslationBase.of(context).weight,
), _weightController,
Row( 1,
children: [ 270,
Container( _weightValue,
width: 340.0, (text) {
height: 60.0, _weightController.text = text;
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++;
});
}, },
), (value) {
), _weightValue = value;
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (height > 0) height--;
});
}, },
), _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
], (value) {
), if (_isWeightKG != value) {
),
],
),
),
),
),
Expanded(
child: Slider(
value: height.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() { setState(() {
height = newValue.round(); _isWeightKG = value;
}); });
}
}, },
activeColor: Color(0xffC5272D), _weightPopupList,
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
],
), ),
Texts('Select Unit'),
SizedBox( SizedBox(
height: 5.0, height: 12.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
), ),
], InkWell(
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: () { onTap: () {
setState(() { // dropdownKey.currentState;
updateColorHeight(2); openDropdown(clinicDropdownKey);
isHeightCm = false;
});
}, },
child: Container( child: Container(
height: 55.0, // width: double.infinity,
width: 150.0, // decoration: containerRadius(Colors.white, 12),
decoration: BoxDecoration( // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
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: 5.0,
),
Texts(
'Weight',
),
SizedBox(
height: 5.0,
),
Row(
children: [
Container(
width: 340.0,
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row( child: Row(
children: [ children: [
Padding( Flexible(
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()),
),
),
Container(
height: 38.0,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
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--;
});
},
),
],
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: weight.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
weight = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
],
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
GestureDetector( Text(
onTap: () { TranslationBase.of(context).activityLevel,
setState(() { style: TextStyle(
updateColorWeight(1); fontSize: 11,
}); letterSpacing: -0.44,
}, fontWeight: FontWeight.w600,
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')),
),
),
),
],
),
SizedBox(
height: 45.0,
),
Divider(
thickness: 2.0,
), ),
SizedBox(
height: 5.0,
), ),
Texts('Activity level'),
Container( Container(
width: 300, height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>( child: DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
icon: Icon(Icons.arrow_downward), icon: Icon(Icons.arrow_downward),
iconSize: 24, iconSize: 0,
elevation: 16, elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87), style: TextStyle(color: Colors.black87),
underline: Container( underline: Container(
height: 2, height: 2,
@ -737,14 +384,31 @@ class _BmrCalculatorState extends State<BmrCalculator> {
}).toList(), }).toList(),
), ),
), ),
),
],
),
),
Icon(Icons.keyboard_arrow_down),
],
),
).withBorderedContainer,
),
SizedBox( SizedBox(
height: 30.0, height: 25.0,
),
],
),
],
),
),
),
), ),
Container( Container(
height: 50.0, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
width: 350.0, color: Colors.white,
child: SecondaryButton( child: SecondaryButton(
label: 'CALCULATE', label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () { onTap: () {
setState(() { setState(() {
calculateBmr(); calculateBmr();
@ -766,13 +430,31 @@ class _BmrCalculatorState extends State<BmrCalculator> {
), ),
], ],
), ),
],
),
),
),
), ),
); );
} }
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}) { Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container( return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
@ -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/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -27,10 +30,25 @@ class BmrResultPage extends StatelessWidget {
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
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,
),
),
mHeight(20),
Center( Center(
child: CircularPercentIndicator( child: CircularPercentIndicator(
radius: 220.0, radius: 220.0,
lineWidth: 20.0, lineWidth: 3.0,
percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500), percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
center: Column( center: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -38,39 +56,55 @@ class BmrResultPage extends StatelessWidget {
Text( Text(
bmrResult.toStringAsFixed(1), bmrResult.toStringAsFixed(1),
style: TextStyle( style: TextStyle(
fontSize: 18.0, fontSize: 17,
fontWeight: FontWeight.bold, letterSpacing: -1.02,
fontWeight: FontWeight.w600,
), ),
), ),
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
Text( Text(
'Calories/Day', 'Calories',
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 18,
letterSpacing: -1.08,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
], ],
), ),
progressColor: Color(0xff3C3939), progressColor: CustomColors.accentColor,
backgroundColor: Colors.white,
), ),
), ),
Container( mHeight(20),
height: 120, Text(
width: 280.0, '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.',
child: Texts( style: TextStyle(
'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.'), fontSize: 14,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: CustomColors.textColor
),
),
],
).withBorderedContainer,
), ),
mFlex(1),
Container( Container(
width: 350, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Button( color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList, label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () { onTap: () {
getDoctorsList(context); 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/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -41,15 +44,26 @@ class FatResult extends StatelessWidget {
showNewAppBar: true, showNewAppBar: true,
appBarTitle: TranslationBase.of(context).bodyFatTitle, appBarTitle: TranslationBase.of(context).bodyFatTitle,
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
SizedBox( Padding(
// height: 40.0, 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( Center(
child: CircularPercentIndicator( child: CircularPercentIndicator(
radius: 220.0, radius: 220.0,
lineWidth: 20.0, lineWidth: 3.0,
percent: ((fat > 70) ? 100 : fat / 100), percent: ((fat > 70) ? 100 : fat / 100),
center: Column( center: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -57,33 +71,43 @@ class FatResult extends StatelessWidget {
Text( Text(
fat.toStringAsFixed(1) + '%', fat.toStringAsFixed(1) + '%',
style: TextStyle( style: TextStyle(
fontSize: 18.0, fontSize: 17,
fontWeight: FontWeight.bold, letterSpacing: -1.02,
), fontWeight: FontWeight.w600,
), ),
SizedBox(
height: 5.0,
), ),
], ],
), ),
progressColor: inductorColor, progressColor: CustomColors.accentColor,
backgroundColor: Colors.white, backgroundColor: Colors.white,
), ),
), ),
Container( mHeight(20),
height: 120, Text(
width: 280.0, textResult, style: TextStyle(
child: Texts(textResult), fontSize: 14,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: CustomColors.textColor
), ),
),
],
).withBorderedContainer,
),
mFlex(1),
Container( Container(
width: 350, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Button( color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList, label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () { onTap: () {
getDoctorsList(context); 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( SizedBox(
height: 12.0, height: 12.0,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
// dropdownKey.currentState; // dropdownKey.currentState;

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; 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/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@ -17,6 +18,7 @@ class Carbs extends StatefulWidget {
class _CarbsState extends State<Carbs> { class _CarbsState extends State<Carbs> {
TextEditingController textController = new TextEditingController(); TextEditingController textController = new TextEditingController();
final GlobalKey clinicDropdownKey = GlobalKey();
int calories; int calories;
String dropdownValue; String dropdownValue;
bool _visible = false; bool _visible = false;
@ -67,9 +69,9 @@ class _CarbsState extends State<Carbs> {
void calculate() { void calculate() {
pCal = (protein / 100.0) * int.parse(textController.text).ceil(); pCal = (protein / 100.0) * int.parse(textController.text).ceil();
cCal = (carbs / 100.0) * int.parse(textController.text); cCal = (carbs / 100.0) * int.parse(textController.text);
;
fCal = (fat / 100) * int.parse(textController.text); fCal = (fat / 100) * int.parse(textController.text);
;
pCalGram = pCal / 4.0; pCalGram = pCal / 4.0;
cCalGram = cCal / 4.0; cCalGram = cCal / 4.0;
fCalGram = fCal / 9.0; fCalGram = fCal / 9.0;
@ -95,150 +97,84 @@ class _CarbsState extends State<Carbs> {
), ),
) )
], ],
body: Padding( body: Column(
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), children: [
Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
padding: EdgeInsets.all(21),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Text(
'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio', '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( SizedBox(
height: 15.0, height: 15.0,
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Container( inputWidget("The Calories per day", "0", textController),
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( InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () { onTap: () {
setState(() { Navigator.push(
int currentValue = int.parse( context,
textController.text); FadePage(page: CalorieCalculator()),
currentValue--; );
textController.text =
(currentValue).toString();
});
}, },
), 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),
),
),
), ),
), ),
)
], ],
), ),
),
SizedBox( SizedBox(
height: 20.0, height: 12.0,
), ),
Button( InkWell(
backgroundColor: Color(0xffC5272D),
label: 'NOT SURE? CLICK HERE',
onTap: () { onTap: () {
setState(() { // dropdownKey.currentState;
{ openDropdown(clinicDropdownKey);
Navigator.push(
context,
FadePage(page: CalorieCalculator()),
);
}
});
}, },
), child: Container(
], // width: double.infinity,
), // decoration: containerRadius(Colors.white, 12),
Column( // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts('Select Diet Type'), Text(
"Select Diet Type",
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container( Container(
width: 400, height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>( child: DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
icon: Icon(Icons.arrow_downward), icon: Icon(Icons.arrow_downward),
iconSize: 24, iconSize: 0,
elevation: 16, elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87), style: TextStyle(color: Colors.black87),
underline: Container( underline: Container(
height: 2, height: 2,
@ -248,19 +184,9 @@ class _CarbsState extends State<Carbs> {
setState(() { setState(() {
dropdownValue = newValue; dropdownValue = newValue;
calculateDietRatios(); calculateDietRatios();
dropdownValue == null
? _visible = false
: _visible = true;
}); });
}, },
items: <String>[ items: <String>['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map<DropdownMenuItem<String>>((String value) {
'Very Low Carb',
'Low Carb',
'Moderate Carb',
'USDA Gudilines',
'Zone Diet',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value),
@ -268,84 +194,32 @@ class _CarbsState extends State<Carbs> {
}).toList(), }).toList(),
), ),
), ),
Visibility(
visible: _visible,
child: Container(
height: 170.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
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( Icon(Icons.keyboard_arrow_down),
text: TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Protein ',
),
TextSpan(
text: '$protein%',
style: TextStyle(color: Color(0xffC5272D)),
)
], ],
), ),
).withBorderedContainer,
), ),
RichText( SizedBox(
text: TextSpan( height: 25.0,
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Carbohydrate ',
),
TextSpan(
text: '$carbs%',
style: TextStyle(color: Color(0xffC5272D)),
)
],
),
),
RichText(
text: TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Fat ',
),
TextSpan(
text: '$fat%',
style: TextStyle(color: Color(0xffC5272D)),
)
],
), ),
SizedBox(
height: 55.0,
), ),
], ],
), ),
), ),
)
],
), ),
SizedBox(
height: 55.0,
), ),
Container( Container(
height: 50.0, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
width: 350.0, color: Colors.white,
child: SecondaryButton( child: SecondaryButton(
label: 'CALCULATE', label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () { onTap: () {
setState(() { setState(() {
{ {
@ -372,9 +246,125 @@ class _CarbsState extends State<Carbs> {
), ),
], ],
), ),
);
}
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,
),
),
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/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/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:provider/provider.dart';
class CarbsResult extends StatelessWidget { class CarbsResult extends StatelessWidget {
double pCal; double pCal;
@ -22,18 +27,11 @@ class CarbsResult extends StatelessWidget {
double cCalMeal; double cCalMeal;
double fCalMeal; double fCalMeal;
CarbsResult( CarbsResult({this.pCal, this.cCal, this.fCal, this.pCalGram, this.cCalGram, this.fCalGram, this.fCalMeal, this.cCalMeal, this.pCalMeal});
{this.pCal,
this.cCal,
this.fCal,
this.pCalGram,
this.cCalGram,
this.fCalGram,
this.fCalMeal,
this.cCalMeal,
this.pCalMeal});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
@ -43,137 +41,98 @@ class CarbsResult extends StatelessWidget {
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Container(
padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0), decoration: containerRadius(Colors.white, 12),
child: Table( padding: EdgeInsets.all(12),
border: TableBorder( margin: EdgeInsets.all(20),
verticalInside: BorderSide(width: 1, color: Colors.black54), child: Column(
bottom: BorderSide(width: 1, color: Colors.black54), crossAxisAlignment: CrossAxisAlignment.start,
left: BorderSide(width: 1, color: Colors.black54),
right: BorderSide(width: 1, color: Colors.black54),
top: BorderSide(width: 1, color: Colors.black54),
),
children: [
TableRow(
decoration: BoxDecoration(
color: Colors.white,
),
children: [ children: [
TableCell( Text(
child: Center( TranslationBase.of(context).carbsProtin,
child: Texts('Description'), style: TextStyle(
), fontSize: 19,
), fontWeight: FontWeight.bold,
TableCell( letterSpacing: -1.34,
child: Center( ),
child: Texts('Protein'), ),
), mHeight(12),
), Table(
TableCell( columnWidths: {
child: Center( 0: FlexColumnWidth(2.4),
child: Texts( 1: FlexColumnWidth(1.8),
'Carbohydrate', 2: FlexColumnWidth(2),
), 3: FlexColumnWidth(1),
), },
), children: fullData(context, projectViewModel),
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'),
),
),
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'),
),
), ),
]),
], ],
), ),
), ),
Container( Container(
width: 350, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Button( color: Colors.white,
label: TranslationBase.of(context).viewDocList, child: SecondaryButton(
label: TranslationBase.of(context).seeListOfDoctor,
color: CustomColors.accentColor,
onTap: () { onTap: () {
getDoctorsList(context); 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) { getDoctorsList(BuildContext context) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
BariatricsService service = new BariatricsService(); BariatricsService service = new BariatricsService();
@ -226,5 +185,4 @@ class CarbsResult extends StatelessWidget {
print(err); print(err);
}); });
} }
} }

@ -1,10 +1,11 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'ideal_body_result_page.dart'; import 'ideal_body_result_page.dart';
@ -24,8 +25,9 @@ class _IdealBodyState extends State<IdealBody> {
Color lbCard = inactiveCardColor; Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor; Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor; Color ftCard = inactiveCardColor;
int age = 0;
int height = 0; // int age = 0;
// int height = 0;
double heightInches; double heightInches;
double minRange; double minRange;
double maxRange; double maxRange;
@ -38,48 +40,22 @@ class _IdealBodyState extends State<IdealBody> {
double maxIdealWeight; double maxIdealWeight;
double heightFeet; double heightFeet;
void updateColorHeight(int type) { final GlobalKey clinicDropdownKey = GlobalKey();
//MG/DLT card bool _isHeightCM = true;
if (type == 1) { bool _isWeightKG = true;
if (cmCard == inactiveCardColor) { double _heightValue = 0;
cmCard = activeCardColor; double _weightValue = 0;
ftCard = inactiveCardColor;
} else { TextEditingController _heightController = new TextEditingController();
cmCard = inactiveCardColor; TextEditingController _weightController = TextEditingController();
}
} List<PopupMenuItem> _heightPopupList = List();
if (type == 2) { List<PopupMenuItem> _weightPopupList = List();
if (ftCard == inactiveCardColor) {
ftCard = activeCardColor;
cmCard = inactiveCardColor;
} else {
ftCard = inactiveCardColor;
}
}
}
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() { void calculateIdealWeight() {
heightInches = height * .39370078740157477; heightInches = int.parse(_heightController.text) * .39370078740157477;
heightFeet = heightInches / 12; heightFeet = heightInches / 12;
idealWeight = (50 + 2.3 * (heightInches - 60)); idealWeight = (50 + 2.3 * (heightInches - 60));
if (dropdownValue == 'Small(fingers overlap)') { if (dropdownValue == 'Small(fingers overlap)') {
@ -99,6 +75,9 @@ class _IdealBodyState extends State<IdealBody> {
@override @override
Widget build(BuildContext context) { 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( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
@ -115,396 +94,114 @@ class _IdealBodyState extends State<IdealBody> {
), ),
) )
], ],
body: Padding( body: Column(
padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0), children: [
Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
height: 800.0, padding: EdgeInsets.all(21),
child: Column( child: Column(
children: [ children: [
Padding( Text(
padding: EdgeInsets.all(10.0),
child: Texts(
'Calculates the ideal body weight based on height, Weight, and Body Size', '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,
), ),
), ),
Divider(
thickness: 2.0,
),
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( SizedBox(
'Height', height: 12.0,
), ),
Row( _commonInputAndUnitRow(
children: [ TranslationBase.of(context).height,
Expanded( _heightController,
child: Container( 1,
width: 340.0, 270,
height: 60.0, _heightValue,
decoration: BoxDecoration( (text) {
color: Colors.white, _heightController.text = text;
),
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++;
});
}, },
), (value) {
), _heightValue = value;
InkWell(
child: Icon(
Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
if (height > 0) height--;
});
}, },
), _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
], (value) {
), if (_isHeightCM != value) {
),
],
),
),
),
),
Expanded(
child: Slider(
value: height.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() { setState(() {
height = newValue.round(); _isHeightCM = value;
}); });
}
}, },
activeColor: Color(0xffC5272D), _heightPopupList,
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
), ),
],
),
Texts('Select Unit'),
SizedBox( SizedBox(
height: 5.0, height: 12.0,
), ),
Row( _commonInputAndUnitRow(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, TranslationBase.of(context).weight,
children: [ _weightController,
GestureDetector( 1,
onTap: () { 270,
setState(() { _weightValue,
updateColorHeight(1); (text) {
isHeightCm = true; _weightController.text = text;
});
}, },
child: Container( (value) {
height: 55.0, _weightValue = value;
width: 150.0, },
decoration: BoxDecoration( _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
boxShadow: [ (value) {
BoxShadow( if (_isWeightKG != value) {
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(() { setState(() {
updateColorHeight(2); _isWeightKG = value;
isHeightCm = false;
}); });
}
}, },
child: Container( _weightPopupList,
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( SizedBox(
height: 45.0, height: 12.0,
),
Divider(
thickness: 2.0,
),
Texts(
'Weight',
), ),
SizedBox( InkWell(
height: 5.0, onTap: () {
), // dropdownKey.currentState;
Row( openDropdown(clinicDropdownKey);
children: [ },
Expanded(
child: Container( child: Container(
width: 340.0, // width: double.infinity,
height: 60.0, // decoration: containerRadius(Colors.white, 12),
decoration: BoxDecoration( // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
color: Colors.white,
),
child: Row( child: Row(
children: [ children: [
Padding( Flexible(
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()),
),
),
Container(
height: 38.0,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
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--;
});
},
),
],
),
),
],
),
),
),
),
Expanded(
child: Slider(
value: weight.toDouble(),
min: 0,
max: 250,
onChanged: (double newValue) {
setState(() {
weight = newValue.round();
});
},
activeColor: Color(0xffC5272D),
inactiveColor: Color(0xffF3C5C6),
),
),
],
),
),
),
],
),
Texts('Select Unit'),
SizedBox(
height: 5.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
GestureDetector( Text(
onTap: () { "Body Frame Size",
setState(() { style: TextStyle(
updateColorWeight(1); fontSize: 11,
}); letterSpacing: -0.44,
}, fontWeight: FontWeight.w600,
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')),
),
),
),
],
),
SizedBox(
height: 45.0,
),
Divider(
thickness: 2.0,
),
SizedBox(
height: 5.0,
),
Texts('Body Frame Size'),
Container( Container(
width: 300, height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>( child: DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
icon: Icon(Icons.arrow_downward), icon: Icon(Icons.arrow_downward),
iconSize: 24, iconSize: 0,
elevation: 16, elevation: 16,
isExpanded: true,
style: TextStyle(color: Colors.black87), style: TextStyle(color: Colors.black87),
underline: Container( underline: Container(
height: 2, height: 2,
@ -527,14 +224,28 @@ class _IdealBodyState extends State<IdealBody> {
}).toList(), }).toList(),
), ),
), ),
SizedBox( ),
height: 30.0, ],
),
),
Icon(Icons.keyboard_arrow_down),
],
),
).withBorderedContainer,
),
],
),
],
),
),
),
), ),
Container( Container(
height: 50.0, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
width: 350.0, color: Colors.white,
child: SecondaryButton( child: SecondaryButton(
label: 'CALCULATE', label: TranslationBase.of(context).calculate,
color: CustomColors.accentColor,
onTap: () { onTap: () {
setState(() { setState(() {
// calculateBmr(); // calculateBmr();
@ -542,6 +253,10 @@ class _IdealBodyState extends State<IdealBody> {
calculateIdealWeight(); calculateIdealWeight();
print(idealWeight); print(idealWeight);
print(minRange);
print(maxRange);
print(overWeightBy);
print(textResult);
//print(overWeightBy); //print(overWeightBy);
{ {
Navigator.push( Navigator.push(
@ -562,11 +277,235 @@ class _IdealBodyState extends State<IdealBody> {
), ),
], ],
), ),
);
}
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,
),
),
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),
],
), ),
), ),
); );
} }
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/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -28,12 +31,23 @@ class IdealBodyResult extends StatelessWidget {
appBarTitle: TranslationBase.of(context).idealBody, appBarTitle: TranslationBase.of(context).idealBody,
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Ideal weight range is', 'Ideal weight range is',
fontSize: 23.0, style: TextStyle(
fontSize: 19,
letterSpacing: -1.34,
fontWeight: FontWeight.bold,
),
), ),
mHeight(12),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
@ -74,11 +88,12 @@ class IdealBodyResult extends StatelessWidget {
), ),
], ],
), ),
mHeight(12),
overWeightBy >= 0 && overWeightBy <= 10 overWeightBy >= 0 && overWeightBy <= 10
? Column( ? Column(
children: [ children: [
Texts( Texts(
'Congratulations! The current weight is\n perfect and considered healthy', 'Congratulations! The current weight is perfect and considered healthy',
fontSize: 20.0, fontSize: 20.0,
), ),
], ],
@ -93,24 +108,27 @@ class IdealBodyResult extends StatelessWidget {
) )
: overWeightBy >= 18 : overWeightBy >= 18
? Container( ? Container(
height: 250.0,
width: 350,
child: Column( child: Column(
children: [ children: [
Texts( Texts(
'Means that you suffer from excessive\n obesity by', 'Means that you suffer from excessive obesity by',
), ),
SizedBox( SizedBox(
height: 55.0, height: 12.0,
), ),
Texts( Text(
overWeightBy.toStringAsFixed(1), overWeightBy.toStringAsFixed(1),
fontSize: 40.0, style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
), ),
SizedBox( SizedBox(
height: 25.0, height: 12.0,
), ),
Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), Texts('May wish to consult with the doctor for medical help. Click to view our list of\n Doctors'),
], ],
), ),
) )
@ -126,41 +144,57 @@ class IdealBodyResult extends StatelessWidget {
), ),
), ),
SizedBox( SizedBox(
height: 55.0, height: 12.0,
), ),
Texts( Text(
overWeightBy.toStringAsFixed(1), overWeightBy.toStringAsFixed(1),
fontSize: 20.0, style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
), ),
], ],
) )
: Container( : Container(
height: 250.0,
width: 350.0,
child: Column( child: Column(
children: [ children: [
Texts( Text(
'under wheight', 'under wheight',
fontSize: 20.0, style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
), ),
SizedBox( SizedBox(
height: 55.0, height: 12.0,
), ),
Texts( Text(
overWeightBy.toStringAsFixed(1), overWeightBy.toStringAsFixed(1),
fontSize: 20.0, style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.bold,
letterSpacing: -1.34,
),
), ),
SizedBox( SizedBox(
height: 25.0, height: 12.0,
), ),
Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
], ],
), ),
), ),
],
).withBorderedContainer,
),
Container( Container(
width: 350, margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Button( color: Colors.white,
child: SecondaryButton(
label: TranslationBase.of(context).viewDocList, label: TranslationBase.of(context).viewDocList,
color: CustomColors.accentColor,
onTap: () { onTap: () {
getDoctorsList(context); 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 RRTSubTitle => localizedValues["RRTSubTitle"][locale.languageCode];
String get transportation => localizedValues["transportation"][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> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

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

Loading…
Cancel
Save