diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ff719027..46f010bd 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1631,11 +1631,40 @@ const Map localizedValues = { "RRTTitle": {"en": "RRT", "ar": "خدمة فريق"}, "RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"}, "transportation": {"en": "Transportation", "ar": "النقل"}, - "neck": {"en": "Neck", "ar": "رقبه"}, "waist": {"en": "Waist", "ar": "وسط"}, "hip": {"en": "Hip", "ar": "ورك او نتوء"}, "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"}, "myCart": {"en": "Cart", "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 person’s 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":"حمية زون"}, }; diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart index 86382fe7..08b756ee 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -4,13 +4,11 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import '../health_calc_desc.dart'; import 'result_page.dart'; const activeCardColor = Color(0xff70777A); @@ -47,9 +45,10 @@ class _BMICalculatorState extends State { } double calculateBMI() { - if (_isHeightCM) { - convertToCm(_heightValue.toDouble()); - } + if (!_isHeightCM) _heightValue = convertToCm(_heightValue.toDouble()); + + if (!_isWeightKG) _weightValue = convertToKg(_weightValue); + bmiResult = _weightValue / pow(_heightValue / 100, 2); return bmiResult; diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart index 81fba296..fa12a9fe 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -78,7 +78,7 @@ class _ResultPageState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - TranslationBase.of(context).bodyMassIndex + widget.finalResult.toString(), + TranslationBase.of(context).bodyMassIndex + widget.finalResult.toStringAsFixed(2), style: TextStyle( fontSize: 16, letterSpacing: -0.64, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index a2d96d89..974cd748 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -48,7 +48,7 @@ class _BmrCalculatorState extends State { // int height = 0; // int weight = 0; double bmrResult = 0; - String dropdownValue = 'Lighty Active (1-3) days per week'; + String dropdownValue = ''; double calories = 0; void updateColor(int type) { @@ -122,13 +122,13 @@ class _BmrCalculatorState extends State { } void calculateCalories() { - if (dropdownValue == "Almost Inactive(Little or no exercises)") { + if (dropdownValue == TranslationBase.of(context).inactiveAct) { 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; - } else if (dropdownValue == "very Active(6-7) days per week") { + } else if (dropdownValue == TranslationBase.of(context).very) { calories = bmrResult * 1.55; - } else if (dropdownValue == "Super Active(very hard exercises)") { + } else if (dropdownValue == TranslationBase.of(context).superAct) { calories = bmrResult * 1.725; } else if (dropdownValue == "") { calories = bmrResult * 10.725; @@ -137,6 +137,7 @@ class _BmrCalculatorState extends State { @override Widget build(BuildContext context) { + dropdownValue = TranslationBase.of(context).light; ProjectViewModel projectViewModel = Provider.of(context); _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _heightPopupList = [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 { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Calculates the amount of energy that the person’s body expends in a day', + TranslationBase.of(context).bmrDesc, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -362,14 +363,14 @@ class _BmrCalculatorState extends State { }); }, items: [ - 'Almost Inactive(Little or no exercises)', - 'Lighty Active (1-3) days per week', - 'very Active(6-7) days per week', - 'Super Active(very hard exercises)' + TranslationBase.of(context).inactiveAct, + TranslationBase.of(context).light, + TranslationBase.of(context).very, + TranslationBase.of(context).superAct, ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value), + child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), ); }).toList(), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 22f915b0..a7bdbe0e 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -23,7 +22,6 @@ class BodyFat extends StatefulWidget { } class _BodyFatState extends State { - final GlobalKey clinicDropdownKey = GlobalKey(); bool _isHeightCM = true; bool _isNeckKG = true; @@ -34,7 +32,6 @@ class _BodyFatState extends State { double _waistValue = 0; double _hipValue = 0; - TextEditingController _heightController = new TextEditingController(); TextEditingController _neckController = TextEditingController(); TextEditingController _waistController = TextEditingController(); @@ -45,12 +42,12 @@ class _BodyFatState extends State { List _waistPopupList = List(); List _hipPopupList = List(); - - bool isMale = false; + // bool isHeightCm = true; Color maleCard = activeCardColorGender; Color femaleCard = inactiveCardColorGender; + // Color neckCmCard = activeCardColor; // Color neckFtCard = inactiveCardColor; Color waistCmCard = activeCardColor; @@ -59,6 +56,7 @@ class _BodyFatState extends State { Color hipFtCard = inactiveCardColor; Color cmCard = activeCardColor; Color ftCard = inactiveCardColor; + // int neck = 10; // int heightCm = 0; // int heightFt = 0; @@ -67,6 +65,7 @@ class _BodyFatState extends State { double minRange; double maxRange; double overWeightBy; + // int waist = 5; double bodyFat = 0; double fat = 0; @@ -74,8 +73,6 @@ class _BodyFatState extends State { double calories = 0; String textResult = ''; - - @override void initState() { _neckController.text = _neckValue.toString(); @@ -105,8 +102,6 @@ class _BodyFatState extends State { } } - - void updateColorWaist(int type) { //MG/DLT card if (type == 1) { @@ -183,33 +178,33 @@ class _BodyFatState extends State { void showTextResult() { if (isMale == false) { if (bodyFat > 9 && bodyFat <= 13) { - textResult = 'The category falls under essential'; + textResult = TranslationBase.of(context).essential; } else if (bodyFat > 13 && bodyFat <= 20) { - textResult = 'The category falls under athlete'; + textResult = TranslationBase.of(context).athlete; } else if (bodyFat > 20 && bodyFat <= 24) { - textResult = 'The category falls under fitness'; + textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 31) { - textResult = 'The category falls under acceptable'; + textResult = TranslationBase.of(context).acceptable; } else if (bodyFat > 31 && bodyFat <= 60) { - textResult = 'The category falls under obese'; + textResult = TranslationBase.of(context).obeseBodyFat; } 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) { - textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + textResult = TranslationBase.of(context).less; } } else { if (bodyFat > 5 && fat <= 13) { - textResult = 'The category falls under essential'; + textResult = TranslationBase.of(context).essential; } else if (bodyFat > 13 && bodyFat <= 17) { - textResult = 'The category falls under athlete'; + textResult = TranslationBase.of(context).athlete; } else if (bodyFat > 17 && bodyFat <= 24) { - textResult = 'The category falls under fitness'; + textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 45) { - textResult = 'The category falls under obese'; + textResult = TranslationBase.of(context).obeseBodyFat; } 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) { - textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + textResult = TranslationBase.of(context).less; } } } @@ -234,12 +229,12 @@ class _BodyFatState extends State { Expanded( child: SingleChildScrollView( child: Container( - padding: EdgeInsets.all(20), + padding: EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Estimates the total body fat based on\nthe size', + TranslationBase.of(context).bodyFatDesc, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -346,14 +341,14 @@ class _BodyFatState extends State { 1, 270, _heightValue, - (text) { + (text) { _heightController.text = text; }, - (value) { + (value) { _heightValue = value; }, _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, - (value) { + (value) { if (_isHeightCM != value) { setState(() { _isHeightCM = value; @@ -371,14 +366,14 @@ class _BodyFatState extends State { 1, 270, _neckValue, - (text) { - _neckController.text = text; + (text) { + _neckController.text = text; }, - (value) { - _neckValue = value; + (value) { + _neckValue = value; }, _isNeckKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, - (value) { + (value) { if (_isNeckKG != value) { setState(() { _isNeckKG = value; @@ -387,7 +382,6 @@ class _BodyFatState extends State { }, _neckPopupList, ), - SizedBox( height: 12.0, ), @@ -397,14 +391,14 @@ class _BodyFatState extends State { 1, 270, _waistValue, - (text) { - _waistController.text = text; + (text) { + _waistController.text = text; }, - (value) { + (value) { _waistValue = value; }, _isWaistKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, - (value) { + (value) { if (_isWaistKG != value) { setState(() { _isWaistKG = value; @@ -422,14 +416,14 @@ class _BodyFatState extends State { 1, 270, _hipValue, - (text) { + (text) { _hipController.text = text; }, - (value) { + (value) { _hipValue = value; }, _isHipKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, - (value) { + (value) { if (_isHipKG != value) { setState(() { _isHipKG = value; @@ -438,7 +432,6 @@ class _BodyFatState extends State { }, _hipPopupList, ), - SizedBox( height: 12.0, ), @@ -463,10 +456,10 @@ class _BodyFatState extends State { context, FadePage( page: FatResult( - bodyFat: bodyFat, - fat: fat, - textResult: textResult, - )), + bodyFat: bodyFat, + fat: fat, + textResult: textResult, + )), ); } }); @@ -477,6 +470,7 @@ class _BodyFatState extends State { ), ); } + 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), @@ -534,15 +528,15 @@ class _BodyFatState extends State { prefixIcon: prefix == null ? null : Text( - "+" + prefix, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, @@ -683,5 +677,3 @@ class CommonDropDownView extends StatelessWidget { ); } } - - diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index 2052e58f..b47ca233 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.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/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -296,14 +295,15 @@ class _CalorieCalculatorState extends State { }); }, items: [ - 'Almost Inactive(Little or no exercises)', - 'Lighty Active (1-3) days per week', - 'very Active(6-7) days per week', - 'Super Active(very hard exercises)' + TranslationBase.of(context).inactiveAct, + TranslationBase.of(context).light, + TranslationBase.of(context).very, + TranslationBase.of(context).superAct, ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value), + child: Text(value, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), ); }).toList(), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart index ec19a91e..9202fdc2 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -35,7 +35,7 @@ class CalorieResultPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Calories", + TranslationBase.of(context).calories, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -63,7 +63,7 @@ class CalorieResultPage extends StatelessWidget { height: 5.0, ), Text( - 'Calories', + TranslationBase.of(context).calories, style: TextStyle( fontSize: 18, letterSpacing: -1.08, @@ -78,7 +78,8 @@ class CalorieResultPage extends StatelessWidget { ), mHeight(20), 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), ), ], diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index fa8e2bc5..31990a6b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -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/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'carbs_result_page.dart'; @@ -38,27 +38,27 @@ class _CarbsState extends State { double fCalMeal; void calculateDietRatios() { - if (dropdownValue == 'Very Low Carb') { + if (dropdownValue == TranslationBase.of(context).dietVeryLow) { meals = 3; protein = 45; carbs = 10; fat = 45; - } else if (dropdownValue == 'Low Carb') { + } else if (dropdownValue == TranslationBase.of(context).dietLow) { meals = 3; protein = 40; carbs = 30; fat = 30; - } else if (dropdownValue == 'Moderate Carb') { + } else if (dropdownValue == TranslationBase.of(context).dietModerate) { meals = 3; protein = 25; carbs = 50; fat = 25; - } else if (dropdownValue == 'USDA Gudilines') { + } else if (dropdownValue == TranslationBase.of(context).dietUSDA) { meals = 3; protein = 15; carbs = 55; fat = 30; - } else if (dropdownValue == 'Zone Diet') { + } else if (dropdownValue == TranslationBase.of(context).dietZone) { meals = 3; protein = 30; carbs = 40; @@ -82,6 +82,7 @@ class _CarbsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, isShowDecPage: false, @@ -107,7 +108,7 @@ class _CarbsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio', + TranslationBase.of(context).carbProteinDesc, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -122,7 +123,7 @@ class _CarbsState extends State { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ - inputWidget("The Calories per day", "0", textController), + inputWidget(TranslationBase.of(context).calDay, "0", textController), InkWell( onTap: () { Navigator.push( @@ -133,7 +134,7 @@ class _CarbsState extends State { child: Padding( padding: const EdgeInsets.all(12.0), 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), ), ), @@ -159,7 +160,7 @@ class _CarbsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Select Diet Type", + TranslationBase.of(context).selectDiet, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -186,10 +187,16 @@ class _CarbsState extends State { calculateDietRatios(); }); }, - items: ['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map>((String value) { + items: [ + TranslationBase.of(context).dietVeryLow, + TranslationBase.of(context).dietLow, + TranslationBase.of(context).dietModerate, + TranslationBase.of(context).dietUSDA, + TranslationBase.of(context).dietZone + ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value), + child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), ); }).toList(), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 7e4e3b4f..24ca617b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -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/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'ideal_body_result_page.dart'; @@ -34,7 +36,7 @@ class _IdealBodyState extends State { double overWeightBy; int weight = 0; double idealWeight = 0; - String dropdownValue = 'Medium(fingers touch)'; + String dropdownValue = TranslationBase.of(AppGlobal.context).bodyFrameMedium; double calories = 0; String textResult = ''; double maxIdealWeight; @@ -52,17 +54,15 @@ class _IdealBodyState extends State { List _heightPopupList = List(); List _weightPopupList = List(); - - void calculateIdealWeight() { heightInches = int.parse(_heightController.text) * .39370078740157477; heightFeet = heightInches / 12; idealWeight = (50 + 2.3 * (heightInches - 60)); - if (dropdownValue == 'Small(fingers overlap)') { + if (dropdownValue == TranslationBase.of(context).bodyFrameSmall) { idealWeight = idealWeight - 10; - } else if (dropdownValue == 'Medium(fingers touch)') { + } else if (dropdownValue == TranslationBase.of(context).bodyFrameMedium) { idealWeight = idealWeight; - } else if (dropdownValue == 'Large(fingers don\'n touch)') { + } else if (dropdownValue == TranslationBase.of(context).bodyFrameLarge) { idealWeight = idealWeight + 10; } @@ -75,6 +75,7 @@ class _IdealBodyState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _heightPopupList = [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 { child: Column( children: [ Text( - 'Calculates the ideal body weight based on height, Weight, and Body Size', + TranslationBase.of(context).idealWeightDesc, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -177,7 +178,7 @@ class _IdealBodyState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Body Frame Size", + TranslationBase.of(context).bodyFrame, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -204,13 +205,14 @@ class _IdealBodyState extends State { }); }, items: [ - 'Small(fingers overlap)', - 'Medium(fingers touch)', - 'Large(fingers don\'n touch)', + TranslationBase.of(context).bodyFrameSmall, + TranslationBase.of(context).bodyFrameMedium, + TranslationBase.of(context).bodyFrameLarge, ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value), + child: Text(value, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), ); }).toList(), ), @@ -498,5 +500,3 @@ class CommonDropDownView extends StatelessWidget { ); } } - - diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index e9f830e1..a406d420 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2624,10 +2624,74 @@ class TranslationBase { String get browseOffers => localizedValues["browseOffers"][locale.languageCode]; String get myCart => localizedValues["myCart"][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]; + + 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 {