From 1d1708bdcc6f40ed9ae80a7ca04a6d7462f445de Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Tue, 9 Nov 2021 16:32:55 +0300 Subject: [PATCH 1/4] Health Calculator 4.0 --- lib/config/localized_values.dart | 40 ++ .../bmr_calculator/bmr_calculator.dart | 33 +- .../bmr_calculator/bmr_result_page.dart | 6 +- .../health_calculator/body_fat/body_fat.dart | 18 +- .../calorie_calculator.dart | 8 +- .../calorie_result_page.dart | 6 +- .../delivery_due/delivery_due.dart | 181 ++++---- .../delivery_due_result_page.dart | 196 ++++---- .../ideal_body/ideal_body.dart | 20 +- .../ideal_body/ideal_body_result_page.dart | 22 +- .../ovulation_period/ovulation_period.dart | 436 +++++++----------- .../ovulation_result_page.dart | 204 ++++---- lib/uitl/translations_delegate_base.dart | 43 ++ 13 files changed, 637 insertions(+), 576 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3985f3fc..392d143a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1635,4 +1635,44 @@ const Map localizedValues = { "waist": {"en": "Waist", "ar": "وسط"}, "hip": {"en": "Hip", "ar": "ورك او نتوء"}, "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"}, + "usefulInfo": {"en": "Useful Information", "ar": "Useful Information"}, + "babyAge": {"en": "Baby Age", "ar": "عمر الطفل الآن:"}, + "babyAgeAvail": {"en": "baby age is not available", "ar": "عمر الطفل غير متوفر"}, + "deliveryDue": {"en": "The delivery due date is estimated to be on the", "ar": "من المقدر أن يكون تاريخ استحقاق التسليم في"}, + + "almostInactive": {"en": "Almost Inactive(Little or no exercises)", "ar": "شبه غير نشط (تمارين قليلة أو معدومة)"}, + "lightActive1": {"en": "Lighty Active (1-3) days per week", "ar": "Lighty Active (1-3) أيام في الأسبوع"}, + "veryActive": {"en": "very Active(6-7) days per week", "ar": "نشط جدا (6-7) أيام في الأسبوع"}, + "superActive": {"en": "Super Active(very hard exercises)", "ar": "سوبر نشط (تمارين صعبة للغاية)"}, + + "dailyIntake": {"en": "Daily intake is", "ar": "المدخول اليومي"}, + "calculateAmount": {"en": "Calculates the amount of energy that the person’s body expends in a day", "ar": "تحسب كمية الطاقة التي يبذلها جسم الشخص في اليوم"}, + "bodyWillBurn": {"en": "This means the body will burn", "ar": "هذا يعني أن الجسم سوف يحترق"}, + "caloriesEachDay": {"en": "calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is", "ar": "السعرات الحرارية في كل يوم ، إذا لم تمارس أي نشاط طوال اليوم .. ملاحظة: متطلبات السعرات الحرارية اليومية هي"}, + "maintainWeight": {"en": "calories, to maintain the current weight.", "ar": "السعرات الحرارية للحفاظ على الوزن الحالي."}, + + "mediumFinger": {"en": "Medium(fingers touch)", "ar": "متوسطة (لمسة الأصابع)"}, + "smallFinger": {"en": "Small(fingers overlap)", "ar": "صغير (أصابع متداخلة)"}, + "largeFinger": {"en": "Large(fingers don\'n touch)", "ar": "كبير (لا تلمس الأصابع)"}, + "idealBodyWeight": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "يحسب وزن الجسم المثالي بناءً على الطول والوزن وحجم الجسم"}, + "bodyFrameSize": {"en": "Body Frame Size", "ar": "حجم إطار الجسم"}, + + "idealWeightRange": {"en": "Ideal weight range is", "ar": "نطاق الوزن المثالي هو"}, + "currentWeightPerfect": {"en": "Congratulations! The current weight is perfect and considered healthy", "ar": "تهانينا! الوزن الحالي مثالي ويعتبر صحي"}, + "littleBitWeightMore": {"en": "This means that the weight is a little bit more than ideal weight by", "ar": "هذا يعني أن الوزن أكثر قليلاً من الوزن المثالي به"}, + "consultWithDoctor": {"en": "May wish to consult with the doctor for medical help. Click to view our list of Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء لدينا"}, + "excessiveObesity": {"en": "Means that you suffer from excessive obesity by", "ar": "يعني أنك تعاني من السمنة المفرطة بها"}, + "mayWish": {"en": "May wish to consult with the doctor for medical help. Click to view our list of\n Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء \ n الخاصة بنا"}, + + "essential": {"en": "The category falls under essential", "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": "الفئة تندرج تحت مقبول"}, + "underObese": {"en": "The category falls under obese", "ar": "تندرج الفئة تحت السمنة"}, + "crossedLimits": {"en": "Please check the value you have entered, since the body fat percentage has crosed the limits.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، لأن نسبة الدهون في الجسم تجاوزت الحدود."}, + "lowLimits": {"en": "Please check the value you have entered, since the body fat percentage cannot be this low.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، حيث لا يمكن أن تكون نسبة الدهون في الجسم منخفضة."}, + "estimates": {"en": "Estimates the total body fat based on\nthe size", "ar": "تقدير إجمالي الدهون في الجسم بناءً على \ n الحجم"}, + + }; + 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 3512b4de..e2010445 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -49,7 +49,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 = null; double calories = 0; void updateColor(int type) { @@ -122,14 +122,14 @@ class _BmrCalculatorState extends State { bmrResult = bmrResult.roundToDouble(); } - void calculateCalories() { - if (dropdownValue == "Almost Inactive(Little or no exercises)") { + void calculateCalories(BuildContext context) { + if (dropdownValue == TranslationBase.of(context).almostInactive) { calories = bmrResult * 1.2; - } else if (dropdownValue == "Lighty Active (1-3) days per week") { + } else if (dropdownValue == TranslationBase.of(context).lightActive1) { calories = bmrResult * 1.375; - } else if (dropdownValue == "very Active(6-7) days per week") { + } else if (dropdownValue == TranslationBase.of(context).veryActive) { calories = bmrResult * 1.55; - } else if (dropdownValue == "Super Active(very hard exercises)") { + } else if (dropdownValue == TranslationBase.of(context).superActive) { calories = bmrResult * 1.725; } else if (dropdownValue == "") { calories = bmrResult * 10.725; @@ -138,6 +138,7 @@ class _BmrCalculatorState extends State { @override Widget build(BuildContext context) { + if (dropdownValue == null) dropdownValue = TranslationBase.of(context).lightActive1; 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)]; @@ -171,7 +172,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).calculateAmount, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -372,10 +373,10 @@ 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).almostInactive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).veryActive, + TranslationBase.of(context).superActive ].map>((String value) { return DropdownMenuItem( value: value, @@ -412,16 +413,16 @@ class _BmrCalculatorState extends State { onTap: () { setState(() { calculateBmr(); - calculateCalories(); + calculateCalories(context); { Navigator.push( context, FadePage( page: BmrResultPage( - bmrResult: bmrResult, - calories: calories, - )), + bmrResult: bmrResult, + calories: calories, + )), ); } }); @@ -661,5 +662,3 @@ class CommonDropDownView extends StatelessWidget { ); } } - - diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart index 53426f94..4ef6ad08 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -37,7 +37,7 @@ class BmrResultPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Calories", + TranslationBase.of(context).calories, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -65,7 +65,7 @@ class BmrResultPage extends StatelessWidget { height: 5.0, ), Text( - 'Calories', + TranslationBase.of(context).calories, style: TextStyle( fontSize: 18, letterSpacing: -1.08, @@ -80,7 +80,7 @@ class BmrResultPage extends StatelessWidget { ), mHeight(20), Text( - 'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.', + TranslationBase.of(context).bodyWillBurn+' ( ${bmrResult.toStringAsFixed(1)} )'+TranslationBase.of(context).caloriesEachDay+'( ${calories.toStringAsFixed(1)} ) '+TranslationBase.of(context).maintainWeight, style: TextStyle( fontSize: 14, letterSpacing: -0.56, 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 1442afbd..5cdd8e3b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -180,22 +180,22 @@ class _BodyFatState extends State { } } - void showTextResult() { + void showTextResult(BuildContext context) { 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).underObese; } 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).crossedLimits; } 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).lowLimits; } } else { if (bodyFat > 5 && fat <= 13) { @@ -464,7 +464,7 @@ class _BodyFatState extends State { onTap: () { setState(() { calculateBodyFat(); - showTextResult(); + showTextResult(context); { Navigator.push( 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 74db1a30..f1db7e82 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -305,10 +305,10 @@ 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).almostInactive, + TranslationBase.of(context).lightActive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).superActive, ].map>((String value) { return DropdownMenuItem( value: value, 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 dc27e051..68bd2d2c 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 @@ -37,7 +37,7 @@ class CalorieResultPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Calories", + TranslationBase.of(context).calories, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -65,7 +65,7 @@ class CalorieResultPage extends StatelessWidget { height: 5.0, ), Text( - 'Calories', + TranslationBase.of(context).calories, style: TextStyle( fontSize: 18, letterSpacing: -1.08, @@ -80,7 +80,7 @@ class CalorieResultPage extends StatelessWidget { ), mHeight(20), Text( - 'Daily intake is ${calorie.toStringAsFixed(1)} calories', + TranslationBase.of(context).dailyIntake+' ${calorie.toStringAsFixed(1)} '+TranslationBase.of(context).calories, style: TextStyle( fontSize: 14, letterSpacing: -0.56, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index 1ada0ca1..b8528ea6 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; @@ -44,103 +46,114 @@ class _DeliveryDueState extends State { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).pregnancyTitle, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 20.0), - child: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Texts( - TranslationBase.of(context).pregnancyDesc, - ), - Divider( - //height: 2, - thickness: 2, - ), - Column( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( children: [ - Texts( - TranslationBase.of(context).pregnancyDateLabel, + Text( + TranslationBase.of(context).pregnancyDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - bloodSugarDate = date; - dateFrom = date.add(Duration(days: 10)); + Divider( + //height: 2, + thickness: 1, + ), + Column( + children: [ + Text( + TranslationBase.of(context).pregnancyDateLabel, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + bloodSugarDate = date; + dateFrom = date.add(Duration(days: 10)); - dateTo = date.add(Duration(days: 20)); - conceivedDate = date.add(Duration(days: 14)); - deliveryDue = date.add(Duration(days: 280)); - firstTrimester = date.add(Duration(days: 85)); - secondTrimester = date.add(Duration(days: 190)); - thirdTrimester = date.add(Duration(days: 280)); - }); + dateTo = date.add(Duration(days: 20)); + conceivedDate = date.add(Duration(days: 14)); + deliveryDue = date.add(Duration(days: 280)); + firstTrimester = date.add(Duration(days: 85)); + secondTrimester = date.add(Duration(days: 190)); + thirdTrimester = date.add(Duration(days: 280)); + }); + }, + currentTime: DateTime.now(), + ); }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.only(top: 15.0), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( + child: Container( + padding: EdgeInsets.all(12), + margin: EdgeInsets.only(top: 15.0), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Icon(Icons.date_range), - Texts(TranslationBase.of(context).date), + Row( + children: [ + Icon(Icons.date_range), + Texts(TranslationBase.of(context).date), + ], + ), + Texts(getDate()), ], ), - Texts(getDate()), - ], + ), ), - ), + ], ), + ], ), - SizedBox( - height: 280.0, - ), - Container( - height: 50.0, - width: 350.0, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { - setState(() { - { - Navigator.push( - context, - FadePage( - page: DeliveryDueResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - firstTrimester: firstTrimester, - secondTrimester: secondTrimester, - thirdTrimester: thirdTrimester, - )), - ); - } - }); - }, - ), - ), - ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + { + Navigator.push( + context, + FadePage( + page: DeliveryDueResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + firstTrimester: firstTrimester, + secondTrimester: secondTrimester, + thirdTrimester: thirdTrimester, + )), + ); + } + }); + }, ), ), - ), + ], ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart index b546426b..f7431d1a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; @@ -29,78 +32,102 @@ class DeliveryDueResult extends StatelessWidget { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).pregnancyTitle, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 12.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - TranslationBase.of(context).ovulationPeriod, - fontWeight: FontWeight.w400, - ), - Texts( - TranslationBase.of(context).from, - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateFrom), fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - TranslationBase.of(context).to, - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateTo), fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - TranslationBase.of(context).conceive, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).firstTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(firstTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).secondTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(secondTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).thirdTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(thirdTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: DefaultButton( - TranslationBase.of(context).seeDoctorsList, - () { - getDoctorsList(context); - }, - ), - ), - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text( + TranslationBase.of(context).pregnancyTitle, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).firstTri, DateFormat.yMMMEd().format(firstTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).secondTri, DateFormat.yMMMEd().format(secondTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).thirdTri, DateFormat.yMMMEd().format(thirdTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).seeDoctorsList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } @@ -145,20 +172,11 @@ class DeliveryDueResult extends StatelessWidget { if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); } }); - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: doctorsList, - patientDoctorAppointmentListHospital: - _patientDoctorAppointmentListHospital))); - + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); } } }).catchError((err) { @@ -167,3 +185,19 @@ class DeliveryDueResult 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, + ); +} 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 e414f028..265bb412 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -34,7 +34,7 @@ class _IdealBodyState extends State { double overWeightBy; int weight = 0; double idealWeight = 0; - String dropdownValue = 'Medium(fingers touch)'; + String dropdownValue = null; double calories = 0; String textResult = ''; double maxIdealWeight; @@ -58,11 +58,11 @@ class _IdealBodyState extends State { 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).smallFinger) { idealWeight = idealWeight - 10; - } else if (dropdownValue == 'Medium(fingers touch)') { + } else if (dropdownValue == TranslationBase.of(context).mediumFinger) { idealWeight = idealWeight; - } else if (dropdownValue == 'Large(fingers don\'n touch)') { + } else if (dropdownValue == TranslationBase.of(context).largeFinger) { idealWeight = idealWeight + 10; } @@ -75,6 +75,8 @@ class _IdealBodyState extends State { @override Widget build(BuildContext context) { + if(dropdownValue==null) + dropdownValue=TranslationBase.of(context).mediumFinger; _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)]; @@ -103,7 +105,7 @@ class _IdealBodyState extends State { child: Column( children: [ Text( - 'Calculates the ideal body weight based on height, Weight, and Body Size', + TranslationBase.of(context).idealBodyWeight, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -186,7 +188,7 @@ class _IdealBodyState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Body Frame Size", + TranslationBase.of(context).bodyFrameSize, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -213,9 +215,9 @@ class _IdealBodyState extends State { }); }, items: [ - 'Small(fingers overlap)', - 'Medium(fingers touch)', - 'Large(fingers don\'n touch)', + TranslationBase.of(context).smallFinger, + TranslationBase.of(context).mediumFinger, + TranslationBase.of(context).largeFinger, ].map>((String value) { return DropdownMenuItem( value: value, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index 6eec6dd8..a29d4bf0 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -40,7 +40,7 @@ class IdealBodyResult extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Ideal weight range is', + TranslationBase.of(context).idealWeightRange, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -60,7 +60,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - 'Kg', + " "+TranslationBase.of(context).kg+" ", style: TextStyle(color: Colors.red), ), ), @@ -80,7 +80,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - 'Kg', + " "+TranslationBase.of(context).kg+" ", style: TextStyle(color: Colors.red), ), ), @@ -93,7 +93,7 @@ class IdealBodyResult extends StatelessWidget { ? Column( children: [ Texts( - 'Congratulations! The current weight is perfect and considered healthy', + TranslationBase.of(context).currentWeightPerfect, fontSize: 20.0, ), ], @@ -101,9 +101,9 @@ class IdealBodyResult extends StatelessWidget { : overWeightBy > 10 && overWeightBy < 17 ? Column( children: [ - Texts('This means that the weight is a little bit more than ideal weight by'), + Texts(TranslationBase.of(context).littleBitWeightMore), Texts(overWeightBy.toStringAsFixed(1)), - Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + Texts(TranslationBase.of(context).consultWithDoctor), ], ) : overWeightBy >= 18 @@ -112,7 +112,7 @@ class IdealBodyResult extends StatelessWidget { child: Column( children: [ Texts( - 'Means that you suffer from excessive obesity by', + TranslationBase.of(context).excessiveObesity, ), SizedBox( height: 12.0, @@ -128,7 +128,7 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 12.0, ), - Texts('May wish to consult with the doctor for medical help. Click to view our list of\n Doctors'), + Texts(TranslationBase.of(context).mayWish), ], ), ) @@ -139,7 +139,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - 'Under Weight', + TranslationBase.of(context).underWeight, fontSize: 18.0, ), ), @@ -161,7 +161,7 @@ class IdealBodyResult extends StatelessWidget { child: Column( children: [ Text( - 'under wheight', + TranslationBase.of(context).underWeight, style: TextStyle( fontSize: 17, fontWeight: FontWeight.bold, @@ -182,7 +182,7 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 12.0, ), - Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + Texts(TranslationBase.of(context).mayWish), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index 86699ed4..69894df3 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; @@ -20,8 +22,9 @@ class _OvulationPeriodState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); DateTime selectedDateTime = DateTime.now(); - int cycleLength = 0; - int lutealPhaseLength = 0; + + // int cycleLength = 0; + // int lutealPhaseLength = 0; String selectedDate; var dateFrom = DateTime.now(); var babyAgeWeeks; @@ -33,6 +36,9 @@ class _OvulationPeriodState extends State { var newFormat = DateFormat("yy-MM-dd"); String updatedDt; + TextEditingController cycleLengthController = new TextEditingController(); + TextEditingController lutelLengthController = new TextEditingController(); + String getTime() { return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; } @@ -64,286 +70,176 @@ class _OvulationPeriodState extends State { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).ovulation, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 700.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).ovulationDesc), - SizedBox( - height: 12.0, - ), - Divider( - //height: 2, - thickness: 2, - ), - SizedBox( - height: 12.0, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - selectedDateTime = date; - }); - }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], - ), - ), - ), - SizedBox( - height: 5.0, - ), - Texts( - TranslationBase.of(context).cycleLabel, - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + Text( + TranslationBase.of(context).ovulationDesc, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.54, + color: Colors.black, + fontWeight: FontWeight.w600, ), - 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: [ - Expanded( - child: Center( - child: Text(cycleLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength < 45) cycleLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength > 0) cycleLength--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: cycleLength.toDouble(), - min: 0, - max: 45, - onChanged: (double newValue) { - setState(() { - cycleLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], + ), + SizedBox( + height: 12.0, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + selectedDateTime = date; + }); + }, + currentTime: DateTime.now(), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).cycleLabel, "0", cycleLengthController), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).lutealLabel, "0", lutelLengthController), ], ), - Texts( - TranslationBase.of(context).lutealLabel, - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + calculateBabyInformation(); + Navigator.push( + context, + FadePage( + page: OvulationResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + babyAge: babyAgeWeeks, + babyAgeDays: babyAgeDays, + ), + ), + ); + }, + ), + ), + ], + ), + ); + } + + 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, ), - 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: [ - Expanded( - child: Center( - child: Text(lutealPhaseLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength < 15) lutealPhaseLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength > 0) lutealPhaseLength--; - }); - }, - ), - ], - ), - ), - ], - ), + 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, ), ), - ), - Expanded( - child: Slider( - value: lutealPhaseLength.toDouble(), - min: 0, - max: 15, - onChanged: (double newValue) { - setState(() { - lutealPhaseLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), - SizedBox( - height: 220.0, - ), - Container( - height: 50.0, - width: 350.0, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { - calculateBabyInformation(); - Navigator.push( - context, - FadePage( - page: OvulationResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - babyAge: babyAgeWeeks, - babyAgeDays: babyAgeDays, - )), - ); - }, ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart index bc345711..67ec7dea 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; @@ -26,6 +29,7 @@ class OvulationResult extends StatelessWidget { this.babyAge, this.babyAgeDays, }); + //var newFormat = DateFormat("yy-MM-dd"); @override @@ -35,81 +39,105 @@ class OvulationResult extends StatelessWidget { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).ovulation, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - 'The next ovulation period is estimated to be:', - fontWeight: FontWeight.w400, - ), - Texts( - 'From:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateFrom), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'To:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateTo), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'Useful Information:', - color: Color(0xffC5272D), - ), - Texts( - 'You have conceived on:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The baby\'s age right now:', - fontWeight: FontWeight.w400, - ), - Texts( - babyAge <= 0 ? "baby age is not available" : babyAge.toString() + " Weeks", - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The delivery due date is estimated to be on the: ', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(deliveryDue), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: DefaultButton( - TranslationBase.of(context).seeDoctorsList, - () { - getDoctorsList(context); - }, - ), - ), - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).ovulation, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + mHeight(20), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + Text( + TranslationBase.of(context).useFullInfo, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: CustomColors.accentColor, + fontWeight: FontWeight.w500, + ), + ), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).babyAge, babyAge <= 0 ? TranslationBase.of(context).babyAgeAvail : babyAge.toString() + TranslationBase.of(context).week), + + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), showItem(TranslationBase.of(context).deliveryDue, DateFormat.yMMMEd().format(deliveryDue)), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } @@ -148,26 +176,17 @@ class OvulationResult extends StatelessWidget { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); } }); - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: doctorsList, - patientDoctorAppointmentListHospital: - _patientDoctorAppointmentListHospital))); - + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); } } }).catchError((err) { @@ -175,5 +194,20 @@ class OvulationResult extends StatelessWidget { print(err); }); } +} +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, + ); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6d454d05..0491cfd4 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2622,6 +2622,49 @@ class TranslationBase { String get waist => localizedValues["waist"][locale.languageCode]; String get hip => localizedValues["hip"][locale.languageCode]; String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode]; + + String get useFullInfo => localizedValues["usefulInfo"][locale.languageCode]; + String get babyAge => localizedValues["babyAge"][locale.languageCode]; + String get babyAgeAvail => localizedValues["babyAgeAvail"][locale.languageCode]; + String get deliveryDue => localizedValues["deliveryDue"][locale.languageCode]; + + String get almostInactive => localizedValues["almostInactive"][locale.languageCode]; + String get lightActive1 => localizedValues["lightActive1"][locale.languageCode]; + String get veryActive => localizedValues["veryActive"][locale.languageCode]; + String get superActive => localizedValues["superActive"][locale.languageCode]; + + + String get dailyIntake => localizedValues["dailyIntake"][locale.languageCode]; + String get calculateAmount => localizedValues["calculateAmount"][locale.languageCode]; + String get bodyWillBurn => localizedValues["bodyWillBurn"][locale.languageCode]; + String get caloriesEachDay => localizedValues["caloriesEachDay"][locale.languageCode]; + String get maintainWeight => localizedValues["maintainWeight"][locale.languageCode]; + + String get mediumFinger => localizedValues["mediumFinger"][locale.languageCode]; + String get smallFinger => localizedValues["smallFinger"][locale.languageCode]; + String get largeFinger => localizedValues["largeFinger"][locale.languageCode]; + String get idealBodyWeight => localizedValues["idealBodyWeight"][locale.languageCode]; + String get bodyFrameSize => localizedValues["bodyFrameSize"][locale.languageCode]; + + String get idealWeightRange => localizedValues["idealWeightRange"][locale.languageCode]; + String get currentWeightPerfect => localizedValues["currentWeightPerfect"][locale.languageCode]; + String get littleBitWeightMore => localizedValues["littleBitWeightMore"][locale.languageCode]; + String get consultWithDoctor => localizedValues["consultWithDoctor"][locale.languageCode]; + String get excessiveObesity => localizedValues["excessiveObesity"][locale.languageCode]; + String get mayWish => localizedValues["mayWish"][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 underObese => localizedValues["underObese"][locale.languageCode]; + String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; + String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; + String get estimates => localizedValues["estimates"][locale.languageCode]; + + + + } class TranslationBaseDelegate extends LocalizationsDelegate { From 590b7953566af1c08bbc1ad79f0ded341104e823 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Tue, 9 Nov 2021 16:38:14 +0300 Subject: [PATCH 2/4] Health Calculator 4.0 marge --- lib/config/localized_values.dart | 6 ++---- lib/uitl/translations_delegate_base.dart | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 84ed8f54..4a8ee340 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1690,10 +1690,7 @@ const Map localizedValues = { "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":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم قد تجاوزت الحدود"}, @@ -1707,4 +1704,5 @@ const Map localizedValues = { "dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"}, "dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"}, "dietZone":{"en":"Zone Diet","ar":"حمية زون"}, + }; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 7b1a3071..80425967 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2721,14 +2721,11 @@ class TranslationBase { String get excessiveObesity => localizedValues["excessiveObesity"][locale.languageCode]; String get mayWish => localizedValues["mayWish"][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 underObese => localizedValues["underObese"][locale.languageCode]; String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; String get estimates => localizedValues["estimates"][locale.languageCode]; + String get submitReview => localizedValues["submitReview"][locale.languageCode]; From 14b85cc407081bda4bb91cca14dc1590983c9190 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 9 Nov 2021 17:21:58 +0300 Subject: [PATCH 3/4] Family files API changes --- .../send_activation_request.dart | 11 +- .../DrawerPages/family/add-family-member.dart | 170 +++--- .../DrawerPages/family/add-family_type.dart | 6 +- lib/pages/DrawerPages/family/my-family.dart | 498 ++++++++---------- .../family_files/family_files_provider.dart | 10 +- 5 files changed, 319 insertions(+), 376 deletions(-) diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index e9512102..867d2d95 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -25,6 +25,9 @@ class SendActivationRequest { String dob; int isHijri; String healthId; + int responseID; + int status; + SendActivationRequest( {this.patientMobileNumber, this.mobileNo, @@ -51,7 +54,9 @@ class SendActivationRequest { this.sMSSignature, this.dob, this.isHijri, - this.healthId}); + this.healthId, + this.responseID, + this.status}); SendActivationRequest.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -80,6 +85,8 @@ class SendActivationRequest { dob = json['DOB']; isHijri = json['IsHijri']; healthId = json['HealthId']; + responseID = json['ReponseID']; + status = json['Status']; } Map toJson() { @@ -110,6 +117,8 @@ class SendActivationRequest { data['DOB'] = dob; data['IsHijri'] = isHijri; data['HealthId'] = healthId; + data['ResponseID'] = responseID; + data['Status'] = status; return data; } } diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 9fb20630..6d9064d7 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart'; -import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -17,7 +16,6 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -41,6 +39,7 @@ class _AddMember extends State { var familyFileProvider = FamilyFilesProvider(); var patientShareRequestID; + var patientShareResponseID; @override void initState() { @@ -50,67 +49,71 @@ class _AddMember extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).myFamilyFiles, - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + body: isLoading == true + ? AppCircularProgressIndicator() + : SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21.0), height: SizeConfig.realScreenHeight * .9, width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 2, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - )), - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - //MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - // Container( - // child: TextFields( - // controller: nationalIDorFile, - // onChanged: (value) => {validateForm()}, - // prefixIcon: Icon(loginType == 1 ? Icons.chrome_reader_mode : Icons.receipt, color: Colors.red), - // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), - // hintText: loginType == 1 ? TranslationBase.of(context).nationalID : TranslationBase.of(context).fileNo, - // )) - SizedBox( - height: 12, - ), - inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile), - ], - ), - ), - Expanded( - flex: 3, + child: Column( + children: [ + Expanded( + flex: 1, + child: Text( + loginType == 1 ? TranslationBase.of(context).enterNationalId : TranslationBase.of(context).enterFile, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + )), + Expanded( + flex: 4, child: Column( - mainAxisAlignment: MainAxisAlignment.end, children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).add, - () => {this.addMember()}, - color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, - textColor: Colors.white, - )) - ], + PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + SizedBox( + height: 12, ), + inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile), ], - )) - ]), - ))); + ), + ), + // Expanded( + // flex: 3, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Row( + // children: [ + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).add, + // () => {this.addMember()}, + // color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + // textColor: Colors.white, + // ), + // ) + // ], + // ), + // ], + // ), + // ) + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.all(21.0), + child: DefaultButton( + TranslationBase.of(context).add, + () => {this.addMember()}, + color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + textColor: Colors.white, + )), + ); } void validateForm() { @@ -158,31 +161,30 @@ class _AddMember extends State { } insertFamilyData(addMemberResult) { - var request = InsertSharePatientFileReq(); - request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; - request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; - request.status = 2; - if (request.patientOutSA == 1) { - request.regionID = 2; - } else { - request.regionID = 1; - } - loading(true); - familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err){ - loading(false); - AppToast.showErrorToast(message: err); - }); + sendActivationCode(addMemberResult); + // var request = InsertSharePatientFileReq(); + // request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; + // request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; + // request.status = 2; + // if (request.patientOutSA == 1) { + // request.regionID = 2; + // } else { + // request.regionID = 1; + // } + // loading(true); + // familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err) { + // loading(false); + // AppToast.showErrorToast(message: err); + // }); } sendActivationCode(result) { // var request = this.getCommonRequest(); loading(true); - patientShareRequestID = result['PatientShareRequestID']; - familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text).then((result) => { - if (result != null && result['isSMSSent'] == true) {this.startSMSService(1, result)} - // {loading(false), this.startSMSService(type)} - // else - // {loading(false)} + patientShareResponseID = result['ShareFamilyFileObj']['ReponseID']; + familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID).then((res) => { + patientShareRequestID = res['PatientShareRequestID'], + if (res != null && res['isSMSSent'] == true) {this.startSMSService(1, res)} }); } @@ -207,7 +209,7 @@ class _AddMember extends State { checkActivationCode(value, result) { Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context); - familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo).then((result) { + familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) { SMSOTP.hideSMSBox(context); handleFamilyRequests(this.patientShareRequestID, 3); }).catchError((err) { @@ -219,12 +221,12 @@ class _AddMember extends State { } handleFamilyRequests(id, stauts) { - familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { - sharedPref.remove(FAMILY_FILE), - Navigator.of(context).pushNamed( - MY_FAMILIY, - ) - }); + // familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { + sharedPref.remove(FAMILY_FILE); + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + // }); } loading(flag) { diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index 533669c7..60e396c6 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -26,11 +26,11 @@ class AddFamilyMemberType extends StatelessWidget { padding: EdgeInsets.zero, physics: BouncingScrollPhysics(), children: [ - SizedBox(height: 12), + SizedBox(height: 21), HabibLogoWidget(), - SizedBox(height: 50), + SizedBox(height: 21), Text( - TranslationBase.of(context).logintypeRadio, + TranslationBase.of(context).registerInfoFamily, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), GridView( diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 1d2b470b..f3658fae 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -27,7 +27,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -159,113 +158,115 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); else - return ListView.separated( - itemBuilder: (context, index) { - if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) - return Container( - margin: EdgeInsets.all(5), - decoration: cardRadius( - 15, - elevation: 0, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), - ), - child: Container( - // height: 130,0xffFDA4B0 - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, - fontSize: 18, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), - fontSize: 12, color: Colors.white), - Texts( - snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + - ' ' + - TranslationBase.of(context).years + - ', ' + - snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, - fontSize: 12, - color: Colors.white), - ], - ), - Column( + return checkActive(snapshot.data.getAllSharedRecordsByStatusList) > 0 + ? ListView.separated( + itemBuilder: (context, index) { + if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) + return Container( + margin: EdgeInsets.all(5), + decoration: cardRadius( + 15, + elevation: 0, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), + ), + child: Container( + // height: 130,0xffFDA4B0 + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SizedBox(height: 10), - InkWell( - onTap: () { - switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); - }, - child: Container( - decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), - padding: EdgeInsets.fromLTRB(15, 10, 15, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/new-design/switch.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), - SizedBox( - width: 5, - ), - // CupertinoSwitch( - // value: isSwitchUser, - // onChanged: (value) { - // setState(() { - // isSwitchUser = value; - // }); - // if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); - // }, - // ), - Texts(TranslationBase.of(context).switchUser, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, - fontSize: 12, - fontWeight: FontWeight.w600) - ], - ))), - SizedBox( - height: 10, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), + fontSize: 12, color: Colors.white), + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + + ' ' + + TranslationBase.of(context).years + + ', ' + + snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, + fontSize: 12, + color: Colors.white), + ], + ), + Column( + children: [ + SizedBox(height: 10), + InkWell( + onTap: () { + switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/switch.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + // CupertinoSwitch( + // value: isSwitchUser, + // onChanged: (value) { + // setState(() { + // isSwitchUser = value; + // }); + // if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + // }, + // ), + Texts(TranslationBase.of(context).switchUser, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600) + ], + ))), + SizedBox( + height: 10, + ), + InkWell( + onTap: () { + deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/delete.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).delete, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600), + ], + ))), + SizedBox(height: 10), + ], ), - InkWell( - onTap: () { - deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); - }, - child: Container( - decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), - padding: EdgeInsets.fromLTRB(15, 10, 15, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/new-design/delete.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), - SizedBox( - width: 5, - ), - Texts(TranslationBase.of(context).delete, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, - fontSize: 12, - fontWeight: FontWeight.w600), - ], - ))), - SizedBox(height: 10), ], - ), - ], - ))); - else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0) - return getNoDataWidget(context); - else - return SizedBox(height: 0); - }, - separatorBuilder: (context, index) => SizedBox(height: 0), - itemCount: snapshot.data.getAllSharedRecordsByStatusList.length); + ))); + // else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0) + // return getNoDataWidget(context); + else + return SizedBox(height: 0); + }, + separatorBuilder: (context, index) => SizedBox(height: 0), + itemCount: snapshot.data.getAllSharedRecordsByStatusList.length) + : getNoDataWidget(context); } }, ), @@ -290,176 +291,98 @@ class _MyFamily extends State with TickerProviderStateMixin { child: Column( children: [ FractionallySizedBox( - widthFactor: 1.0, - child: AppExpandableNotifier( - title: TranslationBase.of(context).userViewRequest, - bodyWidget: FutureBuilder( - future: getUserViewRequest(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return SizedBox(); + widthFactor: 1.0, + child: AppExpandableNotifier( + title: TranslationBase.of(context).userViewRequest, + bodyWidget: FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return SizedBox(); - default: - if (snapshot.hasError) - return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); - else - return ListView.separated( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), - itemBuilder: (context, _index) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(width: 1, color: Color(0xffEFEFEF)), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Column( - children: [ - Column(children: [ - Padding( - padding: EdgeInsets.all(10), - child: Row(children: [ - Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), - Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), - Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), - ])), - Padding( - padding: const EdgeInsets.only(left: 10.0, right: 10.0), - child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), - ), - Column( - children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { - return Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Texts( - result.patientName, - fontWeight: FontWeight.w600, - fontSize: 12, - )), - Expanded( - flex: 1, - child: IconButton( - icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), - onPressed: () { - acceptRemoveRequest(result.iD, 3, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), - color: Colors.white, - onPressed: () { - acceptRemoveRequest(result.iD, 4, context); - }, - )) - ], - )); - }).toList()) - ]) - ], - )); - }, - separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: 1); - } - }, - ))), - - // RoundedContainer( - // child: ExpansionTile( - // title: Text( - // TranslationBase.of(context).userViewRequest, - // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black), - // ), - // children: [ - // FutureBuilder( - // future: getUserViewRequest(), // async work - // builder: (BuildContext context, AsyncSnapshot snapshot) { - // switch (snapshot.connectionState) { - // case ConnectionState.waiting: - // return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); - // default: - // if (snapshot.hasError) - // return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); - // else - // return Container( - // padding: EdgeInsets.all(15), - // child: Card( - // elevation: 3, - // shape: cardRadius(8), - // child: Column( - // children: [ - // Column(children: [ - // Padding( - // padding: EdgeInsets.all(10), - // child: Row(children: [ - // Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), - // Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), - // Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), - // ])), - // Divider(color: Colors.black, height: 1.5, thickness: 1.5), - // Column( - // children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { - // return Container( - // padding: EdgeInsets.all(10), - // child: Row( - // children: [ - // Expanded( - // flex: 3, - // child: Texts( - // result.patientName, - // fontWeight: FontWeight.w600, - // fontSize: 12, - // )), - // Expanded( - // flex: 1, - // child: IconButton( - // icon: Icon( - // Icons.check_circle, - // color: Color(0xff349745), - // ), - // onPressed: () { - // acceptRemoveRequest(result.iD, 3, context); - // }, - // )), - // Expanded( - // flex: 1, - // child: IconButton( - // icon: Icon( - // Icons.close, - // color: Colors.red[900], - // ), - // onPressed: () { - // acceptRemoveRequest(result.iD, 4, context); - // }, - // )) - // ], - // )); - // }).toList()) - // ]) - // ], - // ))); - // } - // }) - // ], - // ), - // ), + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); + else + return ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Column( + children: [ + Column(children: [ + Padding( + padding: EdgeInsets.all(10), + child: Row(children: [ + Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), + ])), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), + Column( + children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { + return Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Texts( + result.patientName, + fontWeight: FontWeight.w600, + fontSize: 12, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), + onPressed: () { + acceptRemoveRequest(result.iD, 3, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), + color: Colors.white, + onPressed: () { + acceptRemoveRequest(result.iD, 4, context); + }, + )) + ], + )); + }).toList()) + ]) + ], + )); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: 1); + } + }, + ), + ), + ), SizedBox(height: 15), FractionallySizedBox( widthFactor: 1.0, @@ -521,18 +444,21 @@ class _MyFamily extends State with TickerProviderStateMixin { fontSize: 12, )), Expanded( - flex: 1, - child: Card( - // shape: cardRadius(10), - color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), - child: Padding( - padding: EdgeInsets.all(5), - child: AppText( - result.statusDescription, - color: Colors.white, - textAlign: TextAlign.center, - fontSize: 12, - )))), + flex: 1, + child: Card( + // shape: cardRadius(10), + color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), + child: Padding( + padding: EdgeInsets.all(5), + child: AppText( + result.statusDescription != null ? result.statusDescription : "", + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ), + ), + ), + ), ], )); }).toList(), diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index ef7ad14d..cc151c7b 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -140,7 +140,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future sendActivationCode(cellNumber, zipCode, patientIdentificationID) async { + Future sendActivationCode(cellNumber, zipCode, patientIdentificationID, responseID) async { try { dynamic localRes; var request = SendActivationRequest(); @@ -151,6 +151,8 @@ class FamilyFilesProvider with ChangeNotifier { request.loginType = request.searchType = 1; request.oTPSendType = 1; request.isRegister = false; + request.responseID = responseID; + request.status = 2; await new BaseAppClient().post(SEND_FAMILY_FILE_ACTIVATION, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { @@ -166,7 +168,7 @@ class FamilyFilesProvider with ChangeNotifier { } //TODO - Future checkActivationCode(loginTokenID, activationCode, indentification, mobileNo) async { + Future checkActivationCode(loginTokenID, activationCode, indentification, mobileNo, requestID, responseID) async { try { dynamic localRes; Map request = {}; @@ -175,6 +177,10 @@ class FamilyFilesProvider with ChangeNotifier { request['PatientIdentificationID'] = indentification; request['LogInTokenID'] = loginTokenID; request['activationCode'] = activationCode; + request['PatientShareRequestID'] = requestID; + request['ResponseID'] = responseID; + request['Status'] = 3; + // this.authService.authenticateRequest(request); await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) { localRes = response; From 338c646a438424a850ab1783807c88e1ab6a4217 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 9 Nov 2021 17:32:30 +0300 Subject: [PATCH 4/4] updates --- .../health_calculator/body_fat/body_fat.dart | 100 ++++++++---------- lib/uitl/translations_delegate_base.dart | 28 ++++- 2 files changed, 69 insertions(+), 59 deletions(-) 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 5cdd8e3b..6aab447a 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) { @@ -187,29 +182,29 @@ class _BodyFatState extends State { } else if (bodyFat > 13 && bodyFat <= 20) { textResult = TranslationBase.of(context).athlete; } else if (bodyFat > 20 && bodyFat <= 24) { - textResult =TranslationBase.of(context).fitness; + textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 31) { - textResult =TranslationBase.of(context).acceptable; + textResult = TranslationBase.of(context).acceptable; } else if (bodyFat > 31 && bodyFat <= 60) { - textResult =TranslationBase.of(context).underObese; + textResult = TranslationBase.of(context).underObese; } else if (bodyFat > 60) { - textResult =TranslationBase.of(context).crossedLimits; + textResult = TranslationBase.of(context).crossedLimits; } else if (bodyFat <= 9) { - textResult =TranslationBase.of(context).lowLimits; + textResult = TranslationBase.of(context).lowLimits; } } 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).underObese; } 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).crossedLimits; } 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).lowLimits; } } } @@ -242,12 +237,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, @@ -354,14 +349,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; @@ -379,14 +374,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; @@ -395,7 +390,6 @@ class _BodyFatState extends State { }, _neckPopupList, ), - SizedBox( height: 12.0, ), @@ -405,14 +399,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; @@ -430,14 +424,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; @@ -446,7 +440,6 @@ class _BodyFatState extends State { }, _hipPopupList, ), - SizedBox( height: 12.0, ), @@ -471,10 +464,10 @@ class _BodyFatState extends State { context, FadePage( page: FatResult( - bodyFat: bodyFat, - fat: fat, - textResult: textResult, - )), + bodyFat: bodyFat, + fat: fat, + textResult: textResult, + )), ); } }); @@ -485,6 +478,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), @@ -542,15 +536,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, @@ -691,5 +685,3 @@ class CommonDropDownView extends StatelessWidget { ); } } - - diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 80425967..d1bc500d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2692,44 +2692,62 @@ class TranslationBase { String get dietZone => localizedValues["dietZone"][locale.languageCode]; String get useFullInfo => localizedValues["usefulInfo"][locale.languageCode]; + String get babyAge => localizedValues["babyAge"][locale.languageCode]; + String get babyAgeAvail => localizedValues["babyAgeAvail"][locale.languageCode]; + String get deliveryDue => localizedValues["deliveryDue"][locale.languageCode]; String get almostInactive => localizedValues["almostInactive"][locale.languageCode]; + String get lightActive1 => localizedValues["lightActive1"][locale.languageCode]; + String get veryActive => localizedValues["veryActive"][locale.languageCode]; - String get superActive => localizedValues["superActive"][locale.languageCode]; + String get superActive => localizedValues["superActive"][locale.languageCode]; String get dailyIntake => localizedValues["dailyIntake"][locale.languageCode]; + String get calculateAmount => localizedValues["calculateAmount"][locale.languageCode]; + String get bodyWillBurn => localizedValues["bodyWillBurn"][locale.languageCode]; + String get caloriesEachDay => localizedValues["caloriesEachDay"][locale.languageCode]; + String get maintainWeight => localizedValues["maintainWeight"][locale.languageCode]; String get mediumFinger => localizedValues["mediumFinger"][locale.languageCode]; + String get smallFinger => localizedValues["smallFinger"][locale.languageCode]; + String get largeFinger => localizedValues["largeFinger"][locale.languageCode]; + String get idealBodyWeight => localizedValues["idealBodyWeight"][locale.languageCode]; + String get bodyFrameSize => localizedValues["bodyFrameSize"][locale.languageCode]; String get idealWeightRange => localizedValues["idealWeightRange"][locale.languageCode]; + String get currentWeightPerfect => localizedValues["currentWeightPerfect"][locale.languageCode]; + String get littleBitWeightMore => localizedValues["littleBitWeightMore"][locale.languageCode]; + String get consultWithDoctor => localizedValues["consultWithDoctor"][locale.languageCode]; + String get excessiveObesity => localizedValues["excessiveObesity"][locale.languageCode]; + String get mayWish => localizedValues["mayWish"][locale.languageCode]; String get underObese => localizedValues["underObese"][locale.languageCode]; - String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; - String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; - String get estimates => localizedValues["estimates"][locale.languageCode]; - String get submitReview => localizedValues["submitReview"][locale.languageCode]; + String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; + String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; + String get estimates => localizedValues["estimates"][locale.languageCode]; + String get submitReview => localizedValues["submitReview"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {