Health Calculators translations

merge-update-with-lab-changes
haroon amjad 4 years ago
parent db7bc11893
commit 75989bdc01

@ -1631,11 +1631,40 @@ 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": "رقبه"}, "neck": {"en": "Neck", "ar": "رقبه"},
"waist": {"en": "Waist", "ar": "وسط"}, "waist": {"en": "Waist", "ar": "وسط"},
"hip": {"en": "Hip", "ar": "ورك او نتوء"}, "hip": {"en": "Hip", "ar": "ورك او نتوء"},
"carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"}, "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"},
"myCart": {"en": "Cart", "ar": "عربة التسوق"}, "myCart": {"en": "Cart", "ar": "عربة التسوق"},
"browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"}, "browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"},
"inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"},
"light":{"en":"Lightly active (1-3) days per week","ar":"خفيف النشاط (1-3 أيام في الأسبوع)"},
"moderate":{"en":"Moderately active (3-5) days per week)","ar":"معتدل النشاط (3-5 أيام في الأسبوع)"},
"very":{"en":"Very active (6-7) days per week)","ar":"نشط جداُ (6-7 أيام في الأسبوع)"},
"super":{"en":"Super active (very hard exercise)","ar":"عالي النشاط (ممارسة الرياضة الصعبة)"},
"resultCalories": {"en": "Daily intake is (#) calories", "ar": "الإحتياج اليومي (#) سعرة حرارية"},
"bmrDesc": {"en": "Calculates the amount of energy that the persons body expends in a day", "ar": "معدل الأيض القاعدي: هو حساب كمية الطاقة التي يحتاجها الجسم في اليوم الواحد"},
"idealWeightDesc": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "حساب الوزن المثالي والوزن الصحي للجسم على أساس الطول، والوزن ،والجسم"},
"bodyFrame": {"en": "Body Frame Size", "ar": "مقاس هيكل الجسم"},
"bodyFrameSmall": {"en": "Small (fingers overlap)", "ar": "رفيع (الأصابع تتداخل)"},
"bodyFrameMedium": {"en": "Medium (fingers touch)", "ar": "متوسط (الأصابع تتلامس)"},
"bodyFrameLarge": {"en": "Large (fingers don't touch)", "ar": "عريض (الأصابع لا تتلامس)"},
"bodyFatDesc": {"en": "Estimates the total body fat based on the size", "ar": "حساب الدهون في الجسم بناءاً على الحجم"},
"essential":{"en":"The category falls under Essential Fat.","ar":"تندرج تحت فئة دهون أساسية"},
"athlete":{"en":" The category falls under Athlete.","ar":"تندرج تحت فئة دهون جسم رياضي"},
"fitness":{"en":" The category falls under Fitness.","ar":"تندرج تحت فئة دهون جسم صحي"},
"acceptable":{"en":"The category falls under Acceptable","ar":"تندرج تحت فئة دهون مقبولة"},
"obeseBodyFat":{"en":"The category falls under Obese.","ar":"تندرج تحت فئة دهون جسم سمين"},
"invalid":{"en":"Invalid input for calculation.","ar":"البيانات المدخلة غير صالحة للحساب"},
"more":{"en":"Please check the value you have entered, since the body fat percentage has crossed the limits.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم قد تجاوزت الحدود"},
"less":{"en":"Please check the value you have entered, since the body fat percentage cannot be this low.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم لا يمكن أن تكون منخفضة"},
"carbProteinDesc": {"en": "Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio", "ar": "حساب نسب الكربوهيدرات و البروتينات و الدهون بالسعرات الحرارية والغرامات وفقا لنسب محددة مسبقا"},
"calDay": {"en": "Calories Per Day", "ar": "السعرات الحرارية في اليوم الواحد"},
"notSure": {"en": "Not sure? click here", "ar": "غير متأكد؟ اضغط هنا"},
"selectDiet": {"en": "Select Diet Type", "ar": "حدد نوع النظام الغذائي"},
"dietVeryLow":{"en":"Very Low Carb","ar":"حمية منخفضة جدا في الكربوهيدرات"},
"dietLow":{"en":"Low Carb","ar":"حمية منخفضة الكربوهيدرات"},
"dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"},
"dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"},
"dietZone":{"en":"Zone Diet","ar":"حمية زون"},
}; };

@ -4,13 +4,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/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.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/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 'package:flutter/services.dart';
import '../health_calc_desc.dart';
import 'result_page.dart'; import 'result_page.dart';
const activeCardColor = Color(0xff70777A); const activeCardColor = Color(0xff70777A);
@ -47,9 +45,10 @@ class _BMICalculatorState extends State<BMICalculator> {
} }
double calculateBMI() { double calculateBMI() {
if (_isHeightCM) { if (!_isHeightCM) _heightValue = convertToCm(_heightValue.toDouble());
convertToCm(_heightValue.toDouble());
} if (!_isWeightKG) _weightValue = convertToKg(_weightValue);
bmiResult = _weightValue / pow(_heightValue / 100, 2); bmiResult = _weightValue / pow(_heightValue / 100, 2);
return bmiResult; return bmiResult;

@ -78,7 +78,7 @@ class _ResultPageState extends State<ResultPage> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
TranslationBase.of(context).bodyMassIndex + widget.finalResult.toString(), TranslationBase.of(context).bodyMassIndex + widget.finalResult.toStringAsFixed(2),
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
letterSpacing: -0.64, letterSpacing: -0.64,

@ -48,7 +48,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
// int height = 0; // int height = 0;
// int weight = 0; // int weight = 0;
double bmrResult = 0; double bmrResult = 0;
String dropdownValue = 'Lighty Active (1-3) days per week'; String dropdownValue = '';
double calories = 0; double calories = 0;
void updateColor(int type) { void updateColor(int type) {
@ -122,13 +122,13 @@ class _BmrCalculatorState extends State<BmrCalculator> {
} }
void calculateCalories() { void calculateCalories() {
if (dropdownValue == "Almost Inactive(Little or no exercises)") { if (dropdownValue == TranslationBase.of(context).inactiveAct) {
calories = bmrResult * 1.2; calories = bmrResult * 1.2;
} else if (dropdownValue == "Lighty Active (1-3) days per week") { } else if (dropdownValue == TranslationBase.of(context).light) {
calories = bmrResult * 1.375; calories = bmrResult * 1.375;
} else if (dropdownValue == "very Active(6-7) days per week") { } else if (dropdownValue == TranslationBase.of(context).very) {
calories = bmrResult * 1.55; calories = bmrResult * 1.55;
} else if (dropdownValue == "Super Active(very hard exercises)") { } else if (dropdownValue == TranslationBase.of(context).superAct) {
calories = bmrResult * 1.725; calories = bmrResult * 1.725;
} else if (dropdownValue == "") { } else if (dropdownValue == "") {
calories = bmrResult * 10.725; calories = bmrResult * 10.725;
@ -137,6 +137,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dropdownValue = TranslationBase.of(context).light;
ProjectViewModel projectViewModel = Provider.of(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)]; _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)]; _heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
@ -161,7 +162,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Calculates the amount of energy that the persons body expends in a day', TranslationBase.of(context).bmrDesc,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -362,14 +363,14 @@ class _BmrCalculatorState extends State<BmrCalculator> {
}); });
}, },
items: <String>[ items: <String>[
'Almost Inactive(Little or no exercises)', TranslationBase.of(context).inactiveAct,
'Lighty Active (1-3) days per week', TranslationBase.of(context).light,
'very Active(6-7) days per week', TranslationBase.of(context).very,
'Super Active(very hard exercises)' TranslationBase.of(context).superAct,
].map<DropdownMenuItem<String>>((String value) { ].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
); );
}).toList(), }).toList(),
), ),

@ -4,7 +4,6 @@ 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';
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/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';
@ -23,7 +22,6 @@ class BodyFat extends StatefulWidget {
} }
class _BodyFatState extends State<BodyFat> { class _BodyFatState extends State<BodyFat> {
final GlobalKey clinicDropdownKey = GlobalKey(); final GlobalKey clinicDropdownKey = GlobalKey();
bool _isHeightCM = true; bool _isHeightCM = true;
bool _isNeckKG = true; bool _isNeckKG = true;
@ -34,7 +32,6 @@ class _BodyFatState extends State<BodyFat> {
double _waistValue = 0; double _waistValue = 0;
double _hipValue = 0; double _hipValue = 0;
TextEditingController _heightController = new TextEditingController(); TextEditingController _heightController = new TextEditingController();
TextEditingController _neckController = TextEditingController(); TextEditingController _neckController = TextEditingController();
TextEditingController _waistController = TextEditingController(); TextEditingController _waistController = TextEditingController();
@ -45,12 +42,12 @@ class _BodyFatState extends State<BodyFat> {
List<PopupMenuItem> _waistPopupList = List(); List<PopupMenuItem> _waistPopupList = List();
List<PopupMenuItem> _hipPopupList = List(); List<PopupMenuItem> _hipPopupList = List();
bool isMale = false; bool isMale = false;
// bool isHeightCm = true; // bool isHeightCm = true;
Color maleCard = activeCardColorGender; Color maleCard = activeCardColorGender;
Color femaleCard = inactiveCardColorGender; Color femaleCard = inactiveCardColorGender;
// Color neckCmCard = activeCardColor; // Color neckCmCard = activeCardColor;
// Color neckFtCard = inactiveCardColor; // Color neckFtCard = inactiveCardColor;
Color waistCmCard = activeCardColor; Color waistCmCard = activeCardColor;
@ -59,6 +56,7 @@ class _BodyFatState extends State<BodyFat> {
Color hipFtCard = inactiveCardColor; Color hipFtCard = inactiveCardColor;
Color cmCard = activeCardColor; Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor; Color ftCard = inactiveCardColor;
// int neck = 10; // int neck = 10;
// int heightCm = 0; // int heightCm = 0;
// int heightFt = 0; // int heightFt = 0;
@ -67,6 +65,7 @@ class _BodyFatState extends State<BodyFat> {
double minRange; double minRange;
double maxRange; double maxRange;
double overWeightBy; double overWeightBy;
// int waist = 5; // int waist = 5;
double bodyFat = 0; double bodyFat = 0;
double fat = 0; double fat = 0;
@ -74,8 +73,6 @@ class _BodyFatState extends State<BodyFat> {
double calories = 0; double calories = 0;
String textResult = ''; String textResult = '';
@override @override
void initState() { void initState() {
_neckController.text = _neckValue.toString(); _neckController.text = _neckValue.toString();
@ -105,8 +102,6 @@ class _BodyFatState extends State<BodyFat> {
} }
} }
void updateColorWaist(int type) { void updateColorWaist(int type) {
//MG/DLT card //MG/DLT card
if (type == 1) { if (type == 1) {
@ -183,33 +178,33 @@ class _BodyFatState extends State<BodyFat> {
void showTextResult() { void showTextResult() {
if (isMale == false) { if (isMale == false) {
if (bodyFat > 9 && bodyFat <= 13) { if (bodyFat > 9 && bodyFat <= 13) {
textResult = 'The category falls under essential'; textResult = TranslationBase.of(context).essential;
} else if (bodyFat > 13 && bodyFat <= 20) { } else if (bodyFat > 13 && bodyFat <= 20) {
textResult = 'The category falls under athlete'; textResult = TranslationBase.of(context).athlete;
} else if (bodyFat > 20 && bodyFat <= 24) { } else if (bodyFat > 20 && bodyFat <= 24) {
textResult = 'The category falls under fitness'; textResult = TranslationBase.of(context).fitness;
} else if (bodyFat > 24 && bodyFat <= 31) { } else if (bodyFat > 24 && bodyFat <= 31) {
textResult = 'The category falls under acceptable'; textResult = TranslationBase.of(context).acceptable;
} else if (bodyFat > 31 && bodyFat <= 60) { } else if (bodyFat > 31 && bodyFat <= 60) {
textResult = 'The category falls under obese'; textResult = TranslationBase.of(context).obeseBodyFat;
} else if (bodyFat > 60) { } else if (bodyFat > 60) {
textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; textResult = TranslationBase.of(context).more;
} else if (bodyFat <= 9) { } else if (bodyFat <= 9) {
textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; textResult = TranslationBase.of(context).less;
} }
} else { } else {
if (bodyFat > 5 && fat <= 13) { if (bodyFat > 5 && fat <= 13) {
textResult = 'The category falls under essential'; textResult = TranslationBase.of(context).essential;
} else if (bodyFat > 13 && bodyFat <= 17) { } else if (bodyFat > 13 && bodyFat <= 17) {
textResult = 'The category falls under athlete'; textResult = TranslationBase.of(context).athlete;
} else if (bodyFat > 17 && bodyFat <= 24) { } else if (bodyFat > 17 && bodyFat <= 24) {
textResult = 'The category falls under fitness'; textResult = TranslationBase.of(context).fitness;
} else if (bodyFat > 24 && bodyFat <= 45) { } else if (bodyFat > 24 && bodyFat <= 45) {
textResult = 'The category falls under obese'; textResult = TranslationBase.of(context).obeseBodyFat;
} else if (bodyFat > 45) { } else if (bodyFat > 45) {
textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; textResult = TranslationBase.of(context).more;
} else if (bodyFat <= 5) { } else if (bodyFat <= 5) {
textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; textResult = TranslationBase.of(context).less;
} }
} }
} }
@ -239,7 +234,7 @@ class _BodyFatState extends State<BodyFat> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Estimates the total body fat based on\nthe size', TranslationBase.of(context).bodyFatDesc,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -387,7 +382,6 @@ class _BodyFatState extends State<BodyFat> {
}, },
_neckPopupList, _neckPopupList,
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
@ -438,7 +432,6 @@ class _BodyFatState extends State<BodyFat> {
}, },
_hipPopupList, _hipPopupList,
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
@ -477,6 +470,7 @@ class _BodyFatState extends State<BodyFat> {
), ),
); );
} }
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),
@ -683,5 +677,3 @@ class CommonDropDownView extends StatelessWidget {
); );
} }
} }

@ -3,7 +3,6 @@ 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';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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';
@ -296,14 +295,15 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
}); });
}, },
items: <String>[ items: <String>[
'Almost Inactive(Little or no exercises)', TranslationBase.of(context).inactiveAct,
'Lighty Active (1-3) days per week', TranslationBase.of(context).light,
'very Active(6-7) days per week', TranslationBase.of(context).very,
'Super Active(very hard exercises)' TranslationBase.of(context).superAct,
].map<DropdownMenuItem<String>>((String value) { ].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value,
style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
); );
}).toList(), }).toList(),
), ),

@ -35,7 +35,7 @@ class CalorieResultPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Calories", TranslationBase.of(context).calories,
style: TextStyle( style: TextStyle(
fontSize: 19, fontSize: 19,
letterSpacing: -1.34, letterSpacing: -1.34,
@ -63,7 +63,7 @@ class CalorieResultPage extends StatelessWidget {
height: 5.0, height: 5.0,
), ),
Text( Text(
'Calories', TranslationBase.of(context).calories,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
letterSpacing: -1.08, letterSpacing: -1.08,
@ -78,7 +78,8 @@ class CalorieResultPage extends StatelessWidget {
), ),
mHeight(20), mHeight(20),
Text( Text(
'Daily intake is ${calorie.toStringAsFixed(1)} calories', TranslationBase.of(context).resultCalories.replaceAll("(#)", calorie.toStringAsFixed(1)),
// 'Daily intake is ${calorie.toStringAsFixed(1)} calories',
style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor), style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor),
), ),
], ],

@ -1,13 +1,13 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
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/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/secondary_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/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 'carbs_result_page.dart'; import 'carbs_result_page.dart';
@ -38,27 +38,27 @@ class _CarbsState extends State<Carbs> {
double fCalMeal; double fCalMeal;
void calculateDietRatios() { void calculateDietRatios() {
if (dropdownValue == 'Very Low Carb') { if (dropdownValue == TranslationBase.of(context).dietVeryLow) {
meals = 3; meals = 3;
protein = 45; protein = 45;
carbs = 10; carbs = 10;
fat = 45; fat = 45;
} else if (dropdownValue == 'Low Carb') { } else if (dropdownValue == TranslationBase.of(context).dietLow) {
meals = 3; meals = 3;
protein = 40; protein = 40;
carbs = 30; carbs = 30;
fat = 30; fat = 30;
} else if (dropdownValue == 'Moderate Carb') { } else if (dropdownValue == TranslationBase.of(context).dietModerate) {
meals = 3; meals = 3;
protein = 25; protein = 25;
carbs = 50; carbs = 50;
fat = 25; fat = 25;
} else if (dropdownValue == 'USDA Gudilines') { } else if (dropdownValue == TranslationBase.of(context).dietUSDA) {
meals = 3; meals = 3;
protein = 15; protein = 15;
carbs = 55; carbs = 55;
fat = 30; fat = 30;
} else if (dropdownValue == 'Zone Diet') { } else if (dropdownValue == TranslationBase.of(context).dietZone) {
meals = 3; meals = 3;
protein = 30; protein = 30;
carbs = 40; carbs = 40;
@ -82,6 +82,7 @@ class _CarbsState extends State<Carbs> {
@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,
@ -107,7 +108,7 @@ class _CarbsState extends State<Carbs> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio', TranslationBase.of(context).carbProteinDesc,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -122,7 +123,7 @@ class _CarbsState extends State<Carbs> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
inputWidget("The Calories per day", "0", textController), inputWidget(TranslationBase.of(context).calDay, "0", textController),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -133,7 +134,7 @@ class _CarbsState extends State<Carbs> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text( child: Text(
'NOT SURE? CLICK HERE', TranslationBase.of(context).notSure,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline),
), ),
), ),
@ -159,7 +160,7 @@ class _CarbsState extends State<Carbs> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Select Diet Type", TranslationBase.of(context).selectDiet,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
letterSpacing: -0.44, letterSpacing: -0.44,
@ -186,10 +187,16 @@ class _CarbsState extends State<Carbs> {
calculateDietRatios(); calculateDietRatios();
}); });
}, },
items: <String>['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map<DropdownMenuItem<String>>((String value) { items: <String>[
TranslationBase.of(context).dietVeryLow,
TranslationBase.of(context).dietLow,
TranslationBase.of(context).dietModerate,
TranslationBase.of(context).dietUSDA,
TranslationBase.of(context).dietZone
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
); );
}).toList(), }).toList(),
), ),

@ -1,11 +1,13 @@
import 'package:diplomaticquarterapp/config/config.dart';
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/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/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 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'ideal_body_result_page.dart'; import 'ideal_body_result_page.dart';
@ -34,7 +36,7 @@ class _IdealBodyState extends State<IdealBody> {
double overWeightBy; double overWeightBy;
int weight = 0; int weight = 0;
double idealWeight = 0; double idealWeight = 0;
String dropdownValue = 'Medium(fingers touch)'; String dropdownValue = TranslationBase.of(AppGlobal.context).bodyFrameMedium;
double calories = 0; double calories = 0;
String textResult = ''; String textResult = '';
double maxIdealWeight; double maxIdealWeight;
@ -52,17 +54,15 @@ class _IdealBodyState extends State<IdealBody> {
List<PopupMenuItem> _heightPopupList = List(); List<PopupMenuItem> _heightPopupList = List();
List<PopupMenuItem> _weightPopupList = List(); List<PopupMenuItem> _weightPopupList = List();
void calculateIdealWeight() { void calculateIdealWeight() {
heightInches = int.parse(_heightController.text) * .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 == TranslationBase.of(context).bodyFrameSmall) {
idealWeight = idealWeight - 10; idealWeight = idealWeight - 10;
} else if (dropdownValue == 'Medium(fingers touch)') { } else if (dropdownValue == TranslationBase.of(context).bodyFrameMedium) {
idealWeight = idealWeight; idealWeight = idealWeight;
} else if (dropdownValue == 'Large(fingers don\'n touch)') { } else if (dropdownValue == TranslationBase.of(context).bodyFrameLarge) {
idealWeight = idealWeight + 10; idealWeight = idealWeight + 10;
} }
@ -75,6 +75,7 @@ class _IdealBodyState extends State<IdealBody> {
@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)]; _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)]; _heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
@ -94,7 +95,7 @@ class _IdealBodyState extends State<IdealBody> {
child: Column( child: Column(
children: [ children: [
Text( Text(
'Calculates the ideal body weight based on height, Weight, and Body Size', TranslationBase.of(context).idealWeightDesc,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -177,7 +178,7 @@ class _IdealBodyState extends State<IdealBody> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Body Frame Size", TranslationBase.of(context).bodyFrame,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
letterSpacing: -0.44, letterSpacing: -0.44,
@ -204,13 +205,14 @@ class _IdealBodyState extends State<IdealBody> {
}); });
}, },
items: <String>[ items: <String>[
'Small(fingers overlap)', TranslationBase.of(context).bodyFrameSmall,
'Medium(fingers touch)', TranslationBase.of(context).bodyFrameMedium,
'Large(fingers don\'n touch)', TranslationBase.of(context).bodyFrameLarge,
].map<DropdownMenuItem<String>>((String value) { ].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value,
style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
); );
}).toList(), }).toList(),
), ),
@ -498,5 +500,3 @@ class CommonDropDownView extends StatelessWidget {
); );
} }
} }

@ -2624,10 +2624,74 @@ class TranslationBase {
String get browseOffers => localizedValues["browseOffers"][locale.languageCode]; String get browseOffers => localizedValues["browseOffers"][locale.languageCode];
String get myCart => localizedValues["myCart"][locale.languageCode]; String get myCart => localizedValues["myCart"][locale.languageCode];
String get neck => localizedValues["neck"][locale.languageCode]; String get neck => localizedValues["neck"][locale.languageCode];
String get waist => localizedValues["waist"][locale.languageCode]; String get waist => localizedValues["waist"][locale.languageCode];
String get hip => localizedValues["hip"][locale.languageCode]; String get hip => localizedValues["hip"][locale.languageCode];
String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode]; String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode];
String get inactiveAct => localizedValues["inactiveAct"][locale.languageCode];
String get light => localizedValues["light"][locale.languageCode];
String get moderate => localizedValues["moderate"][locale.languageCode];
String get very => localizedValues["very"][locale.languageCode];
String get superAct => localizedValues["super"][locale.languageCode];
String get resultCalories => localizedValues["resultCalories"][locale.languageCode];
String get bmrDesc => localizedValues["bmrDesc"][locale.languageCode];
String get idealWeightDesc => localizedValues["idealWeightDesc"][locale.languageCode];
String get bodyFrame => localizedValues["bodyFrame"][locale.languageCode];
String get bodyFrameSmall => localizedValues["bodyFrameSmall"][locale.languageCode];
String get bodyFrameMedium => localizedValues["bodyFrameMedium"][locale.languageCode];
String get bodyFrameLarge => localizedValues["bodyFrameLarge"][locale.languageCode];
String get bodyFatDesc => localizedValues["bodyFatDesc"][locale.languageCode];
String get essential => localizedValues["essential"][locale.languageCode];
String get athlete => localizedValues["athlete"][locale.languageCode];
String get fitness => localizedValues["fitness"][locale.languageCode];
String get acceptable => localizedValues["acceptable"][locale.languageCode];
String get obeseBodyFat => localizedValues["obeseBodyFat"][locale.languageCode];
String get invalid => localizedValues["invalid"][locale.languageCode];
String get more => localizedValues["more"][locale.languageCode];
String get less => localizedValues["less"][locale.languageCode];
String get carbProteinDesc => localizedValues["carbProteinDesc"][locale.languageCode];
String get calDay => localizedValues["calDay"][locale.languageCode];
String get notSure => localizedValues["notSure"][locale.languageCode];
String get selectDiet => localizedValues["selectDiet"][locale.languageCode];
String get dietVeryLow => localizedValues["dietVeryLow"][locale.languageCode];
String get dietLow => localizedValues["dietLow"][locale.languageCode];
String get dietModerate => localizedValues["dietModerate"][locale.languageCode];
String get dietUSDA => localizedValues["dietUSDA"][locale.languageCode];
String get dietZone => localizedValues["dietZone"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save