diff --git a/assets/images/new/services/bmi.svg b/assets/images/new/services/bmi.svg
new file mode 100644
index 00000000..ce3be188
--- /dev/null
+++ b/assets/images/new/services/bmi.svg
@@ -0,0 +1,8 @@
+
diff --git a/assets/images/new/services/bmr_calc.svg b/assets/images/new/services/bmr_calc.svg
new file mode 100644
index 00000000..991cdd08
--- /dev/null
+++ b/assets/images/new/services/bmr_calc.svg
@@ -0,0 +1,7 @@
+
diff --git a/assets/images/new/services/body_fat_calc.svg b/assets/images/new/services/body_fat_calc.svg
new file mode 100644
index 00000000..552715b9
--- /dev/null
+++ b/assets/images/new/services/body_fat_calc.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/new/services/calories_calc.svg b/assets/images/new/services/calories_calc.svg
new file mode 100644
index 00000000..2d4de2fa
--- /dev/null
+++ b/assets/images/new/services/calories_calc.svg
@@ -0,0 +1,15 @@
+
diff --git a/assets/images/new/services/carbs_proteitn_fat.svg b/assets/images/new/services/carbs_proteitn_fat.svg
new file mode 100644
index 00000000..ba1c7005
--- /dev/null
+++ b/assets/images/new/services/carbs_proteitn_fat.svg
@@ -0,0 +1,8 @@
+
diff --git a/assets/images/new/services/delivery.svg b/assets/images/new/services/delivery.svg
new file mode 100644
index 00000000..2b350b8b
--- /dev/null
+++ b/assets/images/new/services/delivery.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/images/new/services/ideal_weight_calc.svg b/assets/images/new/services/ideal_weight_calc.svg
new file mode 100644
index 00000000..60d7ecbe
--- /dev/null
+++ b/assets/images/new/services/ideal_weight_calc.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/new/services/ovulation.svg b/assets/images/new/services/ovulation.svg
new file mode 100644
index 00000000..29650a70
--- /dev/null
+++ b/assets/images/new/services/ovulation.svg
@@ -0,0 +1,8 @@
+
diff --git a/lib/config/config.dart b/lib/config/config.dart
index 694cb602..200e5776 100644
--- a/lib/config/config.dart
+++ b/lib/config/config.dart
@@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
-// const BASE_URL = 'https://uat.hmgwebservices.com/';
-const BASE_URL = 'https://hmgwebservices.com/';
+const BASE_URL = 'https://uat.hmgwebservices.com/';
+// const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart
index a61f86c4..3985f3fc 100644
--- a/lib/config/localized_values.dart
+++ b/lib/config/localized_values.dart
@@ -1149,7 +1149,7 @@ const Map localizedValues = {
"triglycerides": {"en": "Triglycerides", "ar": "الدهون الثلاثية"},
"fatInBlood": {"en": "Fat in Blood", "ar": ""},
"convertFrom": {"en": "Convert from", "ar": "تحويل من"},
- "calculate": {"en": "calculate", "ar": "احسب"},
+ "calculate": {"en": "Calculate", "ar": "احسب"},
"enterReadingValue": {"en": "Enter the reading value", "ar": "ادخل القيمة"},
"result": {"en": "Result", "ar": "النتيجة"},
"sort": {"en": "Sort", "ar": "فرز"},
@@ -1195,8 +1195,8 @@ const Map localizedValues = {
"ovulation": {"en": "Ovulation", "ar": "الإباضة"},
"delivery": {"en": "Delivery", "ar": "الولادة"},
"bmiCalcDesc": {
- "en": "'Calculate the BMI value and weight\n status to identify the healthy weight.\n Not appropriate for children and women\n who are pregnant or breastfeeding'",
- "ar": "حساب قيمة مؤشر كتلة الجسم وحالة الوزن لتحديد الوزن الصحي. \n وغير مناسب للأطفال والنساء الحوامل أو المرضعات"
+ "en": "Calculate the BMI value and weight status to identify the healthy weight. Not appropriate for children and women who are pregnant or breastfeeding",
+ "ar": "احسب قيمة مؤشر كتلة الجسم وحالة الوزن لتحديد الوزن الصحي. غير مناسب للأطفال والنساء الحوامل أو المرضعات"
},
"selectUnit": {"en": "Select Unit", "ar": "اختر الوحدة"},
"feet": {"en": "Feet", "ar": "قدم"},
@@ -1630,4 +1630,9 @@ const Map localizedValues = {
"RRTTitle": {"en": "RRT", "ar": "خدمة فريق"},
"RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"},
"transportation": {"en": "Transportation", "ar": "النقل"},
+
+ "neck": {"en": "Neck", "ar": "رقبه"},
+ "waist": {"en": "Waist", "ar": "وسط"},
+ "hip": {"en": "Hip", "ar": "ورك او نتوء"},
+ "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"},
};
diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart
index e90acc24..c06d77db 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart
@@ -1,11 +1,14 @@
import 'dart:math';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import '../health_calc_desc.dart';
import 'result_page.dart';
@@ -23,52 +26,17 @@ class _BMICalculatorState extends State {
String textResult;
String msg;
double bmiResult;
- int height = 150;
- int weight = 40;
- Color cmCard = activeCardColor;
- Color ftCard = inactiveCardColor;
- Color lbCard = inactiveCardColor;
- Color kgCard = activeCardColor;
- void updateColor(int type) {
- //MG/DLT card
- if (type == 1) {
- if (cmCard == inactiveCardColor) {
- cmCard = activeCardColor;
- ftCard = inactiveCardColor;
- } else {
- cmCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (ftCard == inactiveCardColor) {
- ftCard = activeCardColor;
- cmCard = inactiveCardColor;
- } else {
- ftCard = inactiveCardColor;
- }
- }
- }
+ TextEditingController _heightController = TextEditingController();
+ TextEditingController _weightController = TextEditingController();
- void updateColorWeight(int type) {
- //MG/DLT card
- if (type == 1) {
- if (kgCard == inactiveCardColor) {
- kgCard = activeCardColor;
- lbCard = inactiveCardColor;
- } else {
- kgCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (lbCard == inactiveCardColor) {
- lbCard = activeCardColor;
- kgCard = inactiveCardColor;
- } else {
- lbCard = inactiveCardColor;
- }
- }
- }
+ List _weightPopupList = List();
+ List _heightPopupList = List();
+
+ bool _isHeightCM = true;
+ bool _isWeightKG = true;
+ double _heightValue = 150;
+ double _weightValue = 40;
double convertToCm(double number) {
return number * 30.48;
@@ -79,10 +47,10 @@ class _BMICalculatorState extends State {
}
double calculateBMI() {
- if (ftCard == activeCardColor) {
- convertToCm(height.toDouble());
+ if (_isHeightCM) {
+ convertToCm(_heightValue.toDouble());
}
- bmiResult = weight / pow(height / 100, 2);
+ bmiResult = _weightValue / pow(_heightValue / 100, 2);
return bmiResult;
}
@@ -115,432 +83,275 @@ class _BMICalculatorState extends State {
void initState() {
super.initState();
textController.text = '0'; // Setting the initial value for the field.
+ _heightValue = 100;
+ _weightValue = 50;
+ _heightController.text = _heightValue.toStringAsFixed(0);
+ _weightController.text = _weightValue.toStringAsFixed(0);
+
+ _isWeightKG = true;
+ _isHeightCM = true;
}
Widget build(BuildContext 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)];
+
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
showHomeAppBarIcon: false,
+ showNewAppBar: true,
+ showNewAppBarTitle: true,
appBarIcons: [
IconButton(
icon: Icon(Icons.info_outline),
- color: Colors.white,
+ color: Colors.black,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
- builder: (context) => HealthDescPage(
- "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
- TranslationBase.of(context).bmiCalcDesc,
+ builder: (context) => HealthDescPage("${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}", TranslationBase.of(context).bmiCalcDesc,
"assets/images/AlHabibMedicalService/health_calculator/bmi.png")),
);
},
)
],
- appBarTitle:
- "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
- body: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Center(
- child: Container(
- margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- child: Padding(
- padding: EdgeInsets.symmetric(vertical: 15.0),
- child: Text(
- TranslationBase.of(context).bmiCalcDesc,
- style: TextStyle(fontSize: 18.0),
- ),
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- padding: EdgeInsets.only(bottom: 16),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(12.0),
- ),
- child: Column(
- children: [
- Row(
- children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: Texts(TranslationBase.of(context).height),
- ),
- ],
- ),
- 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(height.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 (height < 250) height++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (height > 120) height--;
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Slider(
- value: height.toDouble(),
- min: 120,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- height = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ],
- ),
- Row(
- children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: Texts(TranslationBase.of(context).selectUnit),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(1);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset:
- Offset(0, 3), // changes position of shadow
- ),
- ],
- color: cmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(
- child: Texts(TranslationBase.of(context).cm)),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(2);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: ftCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset:
- Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(
- child: Texts(TranslationBase.of(context).feet)),
- ),
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- SizedBox(
- height: 25.0,
- ),
- Container(
- margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- padding: EdgeInsets.only(bottom: 16),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(12.0),
- ),
+ appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
+ body: Column(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Row(
- children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: Texts(TranslationBase.of(context).weight),
- ),
- ],
- ),
- 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(weight.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 (weight < 250) weight++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight > 40) weight--;
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Slider(
- value: weight.toDouble(),
- min: 40,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- weight = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ],
+ Text(
+ TranslationBase.of(context).bmiCalcDesc,
+ style: TextStyle(
+ fontSize: 14.0,
+ letterSpacing: -0.56,
+ fontWeight: FontWeight.w600,
+ ),
),
- Row(
- children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: Texts(TranslationBase.of(context).selectUnit),
- ),
- ],
+ mHeight(24),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).height,
+ _heightController,
+ 1,
+ 270,
+ _heightValue,
+ (text) {
+ _heightController.text = text;
+ },
+ (value) {
+ _heightValue = value;
+ },
+ _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHeightCM != value) {
+ setState(() {
+ _isHeightCM = value;
+ });
+ }
+ },
+ _heightPopupList,
),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(1);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset:
- Offset(0, 3), // changes position of shadow
- ),
- ],
- color: kgCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(
- child: Texts(TranslationBase.of(context).kg)),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(2);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: lbCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset:
- Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(
- child:
- Texts(TranslationBase.of(context).pound)),
- ),
- ),
- ),
- ],
+ mHeight(12),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).weight,
+ _weightController,
+ 1,
+ 270,
+ _weightValue,
+ (text) {
+ _weightController.text = text;
+ },
+ (value) {
+ _weightValue = value;
+ },
+ _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
+ (value) {
+ if (_isWeightKG != value) {
+ setState(() {
+ _isWeightKG = value;
+ });
+ }
+ },
+ _weightPopupList,
),
],
),
),
- SizedBox(
- height: 25.0,
- ),
- Container(
- margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- padding: EdgeInsets.symmetric(vertical: 8),
- child: SecondaryButton(
- label: TranslationBase.of(context).calculate,
- onTap: () => {
- setState(() {
- calculateBMI();
- showTextResult(context);
- showMsg(context);
- {
- Navigator.push(
- context,
- FadePage(
- page: ResultPage(
+ ),
+ Container(
+ color: Colors.white,
+ padding: EdgeInsets.all(16),
+ child: SecondaryButton(
+ label: TranslationBase.of(context).calculate,
+ color: CustomColors.accentColor,
+ onTap: () {
+ setState(() {
+ calculateBMI();
+ showTextResult(context);
+ showMsg(context);
+ {
+ Navigator.push(
+ context,
+ FadePage(
+ page: ResultPage(
finalResult: bmiResult,
textResult: textResult,
msg: msg,
- )),
- );
- }
- })
+ ),
+ ),
+ );
+ }
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
+ Function(bool) onUnitTap, _list) {
+ return Row(
+ children: [
+ Expanded(
+ flex: 3,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ TextField(
+ controller: _controller,
+ keyboardType: TextInputType.number,
+ onChanged: (value) {
+ double _value = double.parse(value);
+ if (_value > _maxValue) {
+ onTextValueChange(_maxValue.toStringAsFixed(0));
+ onValueChange(_maxValue);
+ return;
+ } else if (_value < _minValue) {
+ onTextValueChange(_minValue.toStringAsFixed(0));
+ onValueChange(_minValue);
+ return;
+ } else if (_value >= _minValue && _value <= _maxValue) {
+ onValueChange(_value);
+ return;
+ }
},
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
+ ],
+ style: TextStyle(
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: "0",
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
),
- ),
- ],
+ ],
+ ),
),
+ Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
+ Expanded(
+ flex: 1,
+ child: PopupMenuButton(
+ child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
+ onSelected: (value) {
+ onUnitTap(value);
+ },
+ itemBuilder: (context) => _list),
+ )
+ ],
+ ).withBorderedContainer;
+ }
+}
+
+// todo 'sikander' move these to separate file once usability known
+class CommonDropDownView extends StatelessWidget {
+ final String title;
+ final String value;
+ final VoidCallback callback;
+ final IconData iconData;
+
+ CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: callback,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ ),
+ ]),
+ ),
+ Icon(
+ iconData ?? Icons.keyboard_arrow_down_sharp,
+ color: Color(0xff2E303A),
+ )
+ ],
),
);
}
}
+
+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/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart
index 91a430ca..68126b4d 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart
@@ -1,12 +1,16 @@
-
+import 'package:auto_size_text/auto_size_text.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart';
+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/borderedButton.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
import 'package:percent_indicator/percent_indicator.dart';
class ResultPage extends StatelessWidget {
@@ -50,67 +54,71 @@ class ResultPage extends StatelessWidget {
return AppScaffold(
isShowDecPage: false,
isShowAppBar: true,
+ showNewAppBarTitle: true,
+ showNewAppBar: true,
appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
body: Column(
children: [
- Expanded(
- child: SingleChildScrollView(
+ Container(
+ margin: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 6),
+ decoration: cardRadius(12),
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
children: [
- Container(
- margin: EdgeInsets.only(top: 50),
- child: Center(
- child: CircularPercentIndicator(
- radius: 220.0,
- lineWidth: 20.0,
- percent: percentInductor(),
- center: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- finalResult.toStringAsFixed(1),
- style: TextStyle(
- fontSize: 18.0,
- fontWeight: FontWeight.bold,
- ),
- ),
- SizedBox(
- height: 5.0,
- ),
- Text(
- textResult,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.w600,
- ),
- ),
- ],
- ),
- progressColor: colorInductor(),
- backgroundColor: Colors.white,
- ),
+ Text(
+ TranslationBase.of(context).bodyMassIndex + finalResult.toString(),
+ style: TextStyle(
+ fontSize: 16,
+ letterSpacing: -0.64,
+ fontWeight: FontWeight.w600,
),
),
+ mHeight(20),
Container(
- margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
- child: Texts(msg),
+ height: MediaQuery.of(context).size.width / 2.8,
+ child: Row(
+ children: [
+ showMass(context, TranslationBase.of(context).underWeight, "< 18.5", finalResult <= 18.5 ? Colors.red : Colors.black, 8),
+ mWidth(12),
+ showMass(context, TranslationBase.of(context).healthy, "18.5 - 24.9", (finalResult > 18.5 && finalResult < 25) ? Colors.red : Colors.black, 6),
+ mWidth(12),
+ showMass(context, TranslationBase.of(context).overWeight, "25 - 29.9", (finalResult >= 25 && finalResult < 30) ? Colors.red : Colors.black, 4),
+ mWidth(12),
+ showMass(context, TranslationBase.of(context).obese, "30 - 34.9", (finalResult >= 30 && finalResult < 35) ? Colors.red : Colors.black, 2),
+ mWidth(12),
+ showMass(context, TranslationBase.of(context).extremeObese, "> 35", (finalResult >= 35) ? Colors.red : Colors.black, 0),
+ ],
+ ),
+ ),
+ mHeight(20),
+ Text(
+ textResult,
+ style: TextStyle(
+ fontSize: 16.0,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ ),
+ ),
+ mHeight(4),
+ Text(
+ msg,
+ style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor),
),
],
),
),
),
+ mFlex(1),
Container(
- margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
- child: BorderedButton(
- TranslationBase.of(context).seeListOfDoctor,
- fontSize: SizeConfig.textMultiplier * 2.1,
- textColor: Colors.white,
- vPadding: 8,
- hPadding: 8,
- backgroundColor: Theme.of(context).primaryColor,
- radius: 8,
- fontWeight: FontWeight.bold,
- handler: () {
+ color: Colors.white,
+ padding: EdgeInsets.all(16),
+ child: SecondaryButton(
+ label: TranslationBase.of(context).seeListOfDoctor,
+ color: CustomColors.accentColor,
+ onTap: () {
Navigator.push(
context,
FadePage(page: BariatricsPage(1, 1, finalResult)),
@@ -122,4 +130,57 @@ class ResultPage extends StatelessWidget {
),
);
}
+
+ Widget showMass(BuildContext context, String title, String weight, Color color, int f) {
+ return Expanded(
+ flex: 1,
+ child: Container(
+ height: double.infinity,
+ width: double.infinity,
+ child: Column(
+ children: [
+ Flexible(
+ child: Row(
+ children: [
+ mFlex(f),
+ Flexible(
+ flex: 10,
+ child: SvgPicture.asset(
+ "assets/images/new/mass/health_BMI.svg",
+ height: double.infinity,
+ width: double.infinity,
+ fit: BoxFit.fill,
+ color: color,
+ ),
+ ),
+ mFlex(f),
+ ],
+ ),
+ ),
+ mHeight(20),
+ AutoSizeText(
+ title,
+ maxLines: 1,
+ minFontSize: 6,
+ style: TextStyle(
+ color: color,
+ fontSize: 10,
+ letterSpacing: -0.6,
+ ),
+ ),
+ AutoSizeText(
+ weight,
+ maxLines: 1,
+ minFontSize: 6,
+ style: TextStyle(
+ color: color,
+ fontSize: 10,
+ letterSpacing: -0.6,
+ ),
+ )
+ ],
+ ),
+ ),
+ );
+ }
}
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 ad35c61d..3512b4de 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart
@@ -1,10 +1,14 @@
-
+import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:provider/provider.dart';
import 'bmr_result_page.dart';
@@ -27,9 +31,23 @@ class _BmrCalculatorState extends State {
Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
- int age = 0;
- int height = 0;
- int weight = 0;
+
+ final GlobalKey clinicDropdownKey = GlobalKey();
+ TextEditingController ageController = new TextEditingController();
+ TextEditingController _heightController = new TextEditingController();
+ TextEditingController _weightController = TextEditingController();
+
+ bool _isHeightCM = true;
+ bool _isWeightKG = true;
+ double _heightValue = 150;
+ double _weightValue = 40;
+
+ List _heightPopupList = List();
+ List _weightPopupList = List();
+
+ // int age = 0;
+ // int height = 0;
+ // int weight = 0;
double bmrResult = 0;
String dropdownValue = 'Lighty Active (1-3) days per week';
double calories = 0;
@@ -96,10 +114,9 @@ class _BmrCalculatorState extends State {
void calculateBmr() {
if (isMale == true) {
- bmrResult = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age);
+ bmrResult = 66.5 + (13.75 * int.parse(_weightController.text)) + (5.003 * int.parse(_heightController.text)) - (6.755 * int.parse(ageController.text));
} else if (isMale == false) {
- bmrResult =
- 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age);
+ bmrResult = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text));
}
bmrResult = bmrResult.roundToDouble();
@@ -121,6 +138,10 @@ class _BmrCalculatorState extends State {
@override
Widget build(BuildContext context) {
+ ProjectViewModel projectViewModel = Provider.of(context);
+ _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
+ _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
+
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@@ -137,601 +158,508 @@ class _BmrCalculatorState extends State {
),
)
],
- body: Padding(
- padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
- child: SingleChildScrollView(
- child: Container(
- height: 850,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Texts(
- 'Calculates the amount of energy that the person’s body expends in a day'),
- ),
- Divider(
- thickness: 2.0,
- ),
- SizedBox(
- height: 5.0,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Texts('Gender'),
- SizedBox(
- height: 5.0,
- ),
- Container(
- width: 350,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(35.0),
- color: Colors.white,
- border: Border.all(
- color: Colors.black45,
- )),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ body: Container(
+ height: double.infinity,
+ width: double.infinity,
+ child: Column(
+ children: [
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(21.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Calculates the amount of energy that the person’s body expends in a day',
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(1);
- isMale = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 170.0,
- decoration: BoxDecoration(
- color: maleCard,
- borderRadius: BorderRadius.circular(35.0),
- ),
- child: Center(child: Texts('FEMALE')),
- ),
+ SizedBox(
+ height: 20,
),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(2);
- isMale = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 170.0,
- decoration: BoxDecoration(
- color: femaleCard,
- borderRadius: BorderRadius.circular(35.0),
- ),
- child: Center(child: Texts('MALE')),
+ Text(
+ TranslationBase.of(context).selectGender,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
),
),
- ],
- ),
- ),
- SizedBox(
- height: 5.0,
- ),
- Texts(
- 'The Age ( 11 - 120 ) yrs',
- ),
- SizedBox(
- height: 10.0,
- ),
- Row(
- children: [
- Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
+ SizedBox(
+ height: 8.0,
),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
+ Container(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ Expanded(
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ updateColor(1);
+ isMale = false;
+ });
+ },
child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(age.toString()),
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
+ child: Container(
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
- Container(
- height: 38.0,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5,
- ),
- ),
- ),
- child: InkWell(
- child: Icon(
- Icons.arrow_drop_up,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (age < 120) age++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (age > 0) age--;
- });
- },
- ),
- ],
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).female,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
),
),
],
),
),
),
- ),
- Expanded(
- child: Slider(
- value: age.toDouble(),
- min: 0,
- max: 120,
- onChanged: (double newValue) {
- setState(() {
- age = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- Texts(
- 'Height',
- ),
- Row(
- children: [
- Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
+ Expanded(
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ updateColor(2);
+ isMale = true;
+ });
+ },
child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(height.toString()),
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
+ child: Container(
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
- Container(
- height: 38.0,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5,
- ),
- ),
- ),
- child: InkWell(
- child: Icon(
- Icons.arrow_drop_up,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (height < 250)
- height++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (height > 0) height--;
- });
- },
- ),
- ],
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).male,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
),
),
],
),
),
),
- ),
- Expanded(
- child: Slider(
- value: height.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- height = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- Texts('Select Unit'),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(1);
- isHeightCm = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
],
- color: cmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
),
),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(2);
- isHeightCm = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: ftCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
- ),
+ SizedBox(
+ height: 12.0,
),
- ),
- ],
- ),
- SizedBox(
- height: 5.0,
- ),
- Texts(
- 'Weight',
- ),
- SizedBox(
- height: 5.0,
- ),
- Row(
- children: [
- Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
+ inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController),
+ SizedBox(
+ height: 12.0,
),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(weight.toString()),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).height,
+ _heightController,
+ 1,
+ 270,
+ _heightValue,
+ (text) {
+ _heightController.text = text;
+ },
+ (value) {
+ _heightValue = value;
+ },
+ _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHeightCM != value) {
+ setState(() {
+ _isHeightCM = value;
+ });
+ }
+ },
+ _heightPopupList,
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).weight,
+ _weightController,
+ 1,
+ 270,
+ _weightValue,
+ (text) {
+ _weightController.text = text;
+ },
+ (value) {
+ _weightValue = value;
+ },
+ _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
+ (value) {
+ if (_isWeightKG != value) {
+ setState(() {
+ _isWeightKG = value;
+ });
+ }
+ },
+ _weightPopupList,
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ InkWell(
+ onTap: () {
+ // dropdownKey.currentState;
+ openDropdown(clinicDropdownKey);
+ },
+ child: Container(
+ // width: double.infinity,
+ // decoration: containerRadius(Colors.white, 12),
+ // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
+ child: Row(
+ children: [
+ Flexible(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).activityLevel,
+ style: TextStyle(
+ fontSize: 11,
+ letterSpacing: -0.44,
+ fontWeight: FontWeight.w600,
),
),
Container(
- height: 38.0,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5,
- ),
- ),
- ),
- child: InkWell(
- child: Icon(
- Icons.arrow_drop_up,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight < 250)
- weight++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight > 0) weight--;
- });
- },
+ height: 18,
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton(
+ value: dropdownValue,
+ icon: Icon(Icons.arrow_downward),
+ iconSize: 0,
+ elevation: 16,
+ isExpanded: true,
+ style: TextStyle(color: Colors.black87),
+ underline: Container(
+ height: 2,
+ color: Colors.black54,
),
- ],
+ onChanged: (String newValue) {
+ setState(() {
+ dropdownValue = newValue;
+ });
+ },
+ items: [
+ 'Almost Inactive(Little or no exercises)',
+ 'Lighty Active (1-3) days per week',
+ 'very Active(6-7) days per week',
+ 'Super Active(very hard exercises)'
+ ].map>((String value) {
+ return DropdownMenuItem(
+ value: value,
+ child: Text(value),
+ );
+ }).toList(),
+ ),
),
),
],
),
),
- ),
- ),
- Expanded(
- child: Slider(
- value: weight.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- weight = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
+ Icon(Icons.keyboard_arrow_down),
+ ],
),
- ],
+ ).withBorderedContainer,
),
- ),
- ],
- ),
- Texts('Select Unit'),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(1);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- color: kgCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('KG')),
- ),
+ SizedBox(
+ height: 25.0,
),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(2);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: lbCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('LB')),
- ),
- ),
- ),
- ],
- ),
- SizedBox(
- height: 45.0,
- ),
- Divider(
- thickness: 2.0,
- ),
- SizedBox(
- height: 5.0,
- ),
- Texts('Activity level'),
- Container(
- width: 300,
- child: DropdownButton(
- value: dropdownValue,
- icon: Icon(Icons.arrow_downward),
- iconSize: 24,
- elevation: 16,
- style: TextStyle(color: Colors.black87),
- underline: Container(
- height: 2,
- color: Colors.black54,
- ),
- onChanged: (String newValue) {
- setState(() {
- dropdownValue = newValue;
- });
- },
- items: [
- 'Almost Inactive(Little or no exercises)',
- 'Lighty Active (1-3) days per week',
- 'very Active(6-7) days per week',
- 'Super Active(very hard exercises)'
- ].map>((String value) {
- return DropdownMenuItem(
- value: value,
- child: Text(value),
- );
- }).toList(),
+ ],
),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
+ label: TranslationBase.of(context).calculate,
+ color: CustomColors.accentColor,
+ onTap: () {
+ setState(() {
+ calculateBmr();
+ calculateCalories();
+
+ {
+ Navigator.push(
+ context,
+ FadePage(
+ page: BmrResultPage(
+ bmrResult: bmrResult,
+ calories: calories,
+ )),
+ );
+ }
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ void openDropdown(GlobalKey key) {
+ GestureDetector detector;
+ void searchForGestureDetector(BuildContext element) {
+ element.visitChildElements((element) {
+ if (element.widget != null && element.widget is GestureDetector) {
+ detector = element.widget;
+ return false;
+ } else {
+ searchForGestureDetector(element);
+ }
+
+ return true;
+ });
+ }
+
+ searchForGestureDetector(key.currentContext);
+ assert(detector != null);
+
+ detector.onTap();
+ }
+
+ Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
+ return Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: InkWell(
+ onTap: hasSelection ? () {} : null,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _labelText,
+ style: TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
),
- SizedBox(
- height: 30.0,
+ ),
+ TextField(
+ enabled: isEnable,
+ scrollPadding: EdgeInsets.zero,
+ keyboardType: TextInputType.number,
+ controller: _controller,
+ onChanged: (value) => {},
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
),
- Container(
- height: 50.0,
- width: 350.0,
- child: SecondaryButton(
- label: 'CALCULATE',
- onTap: () {
- setState(() {
- calculateBmr();
- calculateCalories();
-
- {
- Navigator.push(
- context,
- FadePage(
- page: BmrResultPage(
- bmrResult: bmrResult,
- calories: calories,
- )),
- );
- }
- });
- },
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: _hintText,
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
),
+ prefixIconConstraints: BoxConstraints(minWidth: 50),
+ prefixIcon: prefix == null
+ ? null
+ : Text(
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
),
- ],
- ),
- ],
+ ),
+ ],
+ ),
),
+ if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
+ Function(bool) onUnitTap, _list) {
+ return Row(
+ children: [
+ Expanded(
+ flex: 3,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ TextField(
+ controller: _controller,
+ keyboardType: TextInputType.number,
+ onChanged: (value) {
+ double _value = double.parse(value);
+ if (_value > _maxValue) {
+ onTextValueChange(_maxValue.toStringAsFixed(0));
+ onValueChange(_maxValue);
+ return;
+ } else if (_value < _minValue) {
+ onTextValueChange(_minValue.toStringAsFixed(0));
+ onValueChange(_minValue);
+ return;
+ } else if (_value >= _minValue && _value <= _maxValue) {
+ onValueChange(_value);
+ return;
+ }
+ },
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
+ ],
+ style: TextStyle(
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: "0",
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
),
),
+ Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
+ Expanded(
+ flex: 1,
+ child: PopupMenuButton(
+ child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
+ onSelected: (value) {
+ onUnitTap(value);
+ },
+ itemBuilder: (context) => _list),
+ )
+ ],
+ ).withBorderedContainer;
+ }
+}
+
+// todo 'sikander' move these to separate file once usability known
+class CommonDropDownView extends StatelessWidget {
+ final String title;
+ final String value;
+ final VoidCallback callback;
+ final IconData iconData;
+
+ CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: callback,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ ),
+ ]),
+ ),
+ Icon(
+ iconData ?? Icons.keyboard_arrow_down_sharp,
+ color: Color(0xff2E303A),
+ )
+ ],
),
);
}
}
+
+
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 e1409ee5..53426f94 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
@@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@@ -27,50 +30,81 @@ class BmrResultPage extends StatelessWidget {
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
- Center(
- child: CircularPercentIndicator(
- radius: 220.0,
- lineWidth: 20.0,
- percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
- center: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- bmrResult.toStringAsFixed(1),
- style: TextStyle(
- fontSize: 18.0,
- fontWeight: FontWeight.bold,
- ),
+ Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "Calories",
+ style: TextStyle(
+ fontSize: 19,
+ letterSpacing: -1.34,
+ fontWeight: FontWeight.bold,
),
- SizedBox(
- height: 5.0,
+ ),
+ mHeight(20),
+ Center(
+ child: CircularPercentIndicator(
+ radius: 220.0,
+ lineWidth: 3.0,
+ percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
+ center: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ bmrResult.toStringAsFixed(1),
+ style: TextStyle(
+ fontSize: 17,
+ letterSpacing: -1.02,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ SizedBox(
+ height: 5.0,
+ ),
+ Text(
+ 'Calories',
+ style: TextStyle(
+ fontSize: 18,
+ letterSpacing: -1.08,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
+ ),
+ progressColor: CustomColors.accentColor,
+ backgroundColor: Colors.white,
),
- Text(
- 'Calories/Day',
- style: TextStyle(
- fontSize: 16.0,
+ ),
+ mHeight(20),
+ Text(
+ 'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.',
+ style: TextStyle(
+ fontSize: 14,
+ letterSpacing: -0.56,
fontWeight: FontWeight.w600,
- ),
+ color: CustomColors.textColor
),
- ],
- ),
- progressColor: Color(0xff3C3939),
- ),
- ),
- Container(
- height: 120,
- width: 280.0,
- child: Texts(
- 'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.'),
+ ),
+ ],
+ ).withBorderedContainer,
),
+ mFlex(1),
+
Container(
- width: 350,
- child: Button(
- label: TranslationBase.of(context).viewDocList,
- onTap: () {
- getDoctorsList(context);
- }),
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
+ label: TranslationBase.of(context).viewDocList,
+ color: CustomColors.accentColor,
+ onTap: () {
+ getDoctorsList(context);
+ },
+ ),
),
+
],
),
);
@@ -129,3 +163,18 @@ class BmrResultPage extends StatelessWidget {
});
}
}
+extension BorderedContainer on Widget {
+ Widget get withBorderedContainer => Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: this,
+ );
+}
\ No newline at end of file
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 7b32c840..1442afbd 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart
@@ -1,11 +1,14 @@
import 'dart:math';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'body_fat_result_page.dart';
@@ -20,43 +23,65 @@ class BodyFat extends StatefulWidget {
}
class _BodyFatState extends State {
+
+ final GlobalKey clinicDropdownKey = GlobalKey();
+ bool _isHeightCM = true;
+ bool _isNeckKG = true;
+ bool _isWaistKG = true;
+ bool _isHipKG = true;
+ double _heightValue = 0;
+ double _neckValue = 0;
+ double _waistValue = 0;
+ double _hipValue = 0;
+
+
+ TextEditingController _heightController = new TextEditingController();
+ TextEditingController _neckController = TextEditingController();
+ TextEditingController _waistController = TextEditingController();
+ TextEditingController _hipController = TextEditingController();
+
+ List _heightPopupList = List();
+ List _neckPopupList = List();
+ List _waistPopupList = List();
+ List _hipPopupList = List();
+
+
+
bool isMale = false;
- bool isHeightCm = true;
+ // bool isHeightCm = true;
Color maleCard = activeCardColorGender;
Color femaleCard = inactiveCardColorGender;
- Color neckCmCard = activeCardColor;
- Color neckFtCard = inactiveCardColor;
+ // Color neckCmCard = activeCardColor;
+ // Color neckFtCard = inactiveCardColor;
Color waistCmCard = activeCardColor;
Color waistFtCard = inactiveCardColor;
Color hipCmCard = activeCardColor;
Color hipFtCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
- int neck = 10;
- int heightCm = 0;
- int heightFt = 0;
- int hip = 5;
+ // int neck = 10;
+ // int heightCm = 0;
+ // int heightFt = 0;
+ // int hip = 5;
double heightInches;
double minRange;
double maxRange;
double overWeightBy;
- int waist = 5;
+ // int waist = 5;
double bodyFat = 0;
double fat = 0;
String dropdownValue;
double calories = 0;
String textResult = '';
- TextEditingController heightController = TextEditingController();
- TextEditingController neckController = TextEditingController();
- TextEditingController waistController = TextEditingController();
- TextEditingController hipController = TextEditingController();
+
+
@override
void initState() {
- neckController.text = neck.toString();
- hipController.text = hip.toString();
- waistController.text = waist.toString();
- heightController.text = heightCm.toString();
+ _neckController.text = _neckValue.toString();
+ _hipController.text = _hipValue.toString();
+ _waistController.text = _waistValue.toString();
+ _heightController.text = _heightValue.toString();
super.initState();
}
@@ -80,25 +105,7 @@ class _BodyFatState extends State {
}
}
- void updateColorNeck(int type) {
- //MG/DLT card
- if (type == 1) {
- if (neckCmCard == inactiveCardColor) {
- neckCmCard = activeCardColor;
- neckFtCard = inactiveCardColor;
- } else {
- neckCmCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (neckFtCard == inactiveCardColor) {
- neckFtCard = activeCardColor;
- neckCmCard = inactiveCardColor;
- } else {
- neckFtCard = inactiveCardColor;
- }
- }
- }
+
void updateColorWaist(int type) {
//MG/DLT card
@@ -162,10 +169,10 @@ class _BodyFatState extends State {
void calculateBodyFat() {
if (isMale == true) {
- bodyFat = 495 / (1.0324 - 0.19077 * (log(waist - neck) / ln10) + 0.15456 * (log(heightCm) / ln10)) - 450;
+ bodyFat = 495 / (1.0324 - 0.19077 * (log(_waistValue - _neckValue) / ln10) + 0.15456 * (log(int.parse(_heightController.text)) / ln10)) - 450;
fat = (bodyFat * 10) / 10.round();
} else if (isMale == false) {
- bodyFat = 495 / (1.29579 - 0.35004 * (log(waist + hip - neck) / ln10) + 0.22100 * (log(heightCm) / ln10)) - 450;
+ bodyFat = 495 / (1.29579 - 0.35004 * (log(_waistValue + _hipValue - _neckValue) / ln10) + 0.22100 * (log(int.parse(_heightController.text)) / ln10)) - 450;
fat = (bodyFat * 10) / 10.round();
}
if (fat <= 0) {
@@ -209,6 +216,12 @@ class _BodyFatState extends State {
@override
Widget build(BuildContext context) {
+ _neckPopupList = [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)];
+
+ _waistPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
+ _hipPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
+
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@@ -224,815 +237,459 @@ class _BodyFatState extends State {
),
)
],
- body: Padding(
- padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
- child: SingleChildScrollView(
- child: Container(
- height: 1000.0,
- child: Column(
- children: [
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Texts('Estimates the total body fat based on\n the size'),
- ),
- Divider(
- thickness: 2.0,
- ),
- SizedBox(
- height: 5.0,
- ),
- Column(
+ body: Column(
+ children: [
+ Expanded(
+ child: SingleChildScrollView(
+ child: Container(
+ padding: EdgeInsets.all(20),
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Texts('Gender'),
+ Text(
+ 'Estimates the total body fat based on\nthe size',
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
+ ),
+ SizedBox(
+ height: 20,
+ ),
+ Text(
+ TranslationBase.of(context).selectGender,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
+ ),
SizedBox(
- height: 5.0,
+ height: 8.0,
),
Container(
- width: 350,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(35.0),
- color: Colors.white,
- border: Border.all(
- color: Colors.black45,
- )),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(1);
- isMale = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 170.0,
- decoration: BoxDecoration(
- color: maleCard,
- borderRadius: BorderRadius.circular(35.0),
- ),
- child: Center(child: Texts('FEMALE')),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColor(2);
- isMale = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 170.0,
- decoration: BoxDecoration(
- color: femaleCard,
- borderRadius: BorderRadius.circular(35.0),
- ),
- child: Center(child: Texts('MALE')),
- ),
- ),
- ],
- ),
- ),
- Texts(
- 'Height',
- ),
- Row(
- children: [
- Expanded(
- child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
- child: Center(
+ Expanded(
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ updateColor(1);
+ isMale = false;
+ });
+ },
+ child: Row(
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
child: Container(
- width: 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: Padding(
- padding: const EdgeInsets.only(left: 10.0),
- child: TextFormField(
- keyboardType: TextInputType.number,
- controller: heightController,
- ),
- ),
- ),
- ),
- 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 (heightCm < 250) heightCm++;
- heightController.text = heightCm.toString();
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (heightCm > 0) heightCm--;
- heightController.text = heightCm.toString();
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
- ),
- Expanded(
- child: Slider(
- value: heightCm.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- heightCm = newValue.round();
- heightController.text = heightCm.toString();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).female,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ ),
),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- Texts('Select Unit'),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(1);
- isHeightCm = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- color: cmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(2);
- isHeightCm = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: ftCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
+ ],
+ ),
),
),
- ),
- ],
- ),
- SizedBox(
- height: 10.0,
- ),
- Texts(
- 'Neck',
- ),
- Row(
- children: [
- Expanded(
- child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
- child: Center(
+ Expanded(
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ updateColor(2);
+ isMale = true;
+ });
+ },
+ child: Row(
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
child: Container(
- width: 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: Padding(
- padding: const EdgeInsets.only(left: 15.0, bottom: 0),
- child: TextFormField(
- keyboardType: TextInputType.number,
- controller: neckController,
- ),
- ),
- ),
- ),
- 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 (neck < 60) neck++;
- neckController.text = neck.toString();
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (neck > 5) neck--;
- neckController.text = neck.toString();
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100),
),
),
- ),
- Expanded(
- child: Slider(
- value: neck.toDouble(),
- min: 5,
- max: 60,
- onChanged: (double newValue) {
- setState(() {
- neck = newValue.round();
- neckController.text = neck.toString();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).male,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ ),
),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- Texts('Select Unit'),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorNeck(1);
- isHeightCm = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- color: neckCmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorNeck(2);
- isHeightCm = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: neckFtCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
+ ],
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
SizedBox(
- height: 10.0,
- ),
- Texts(
- 'Waist',
+ height: 12.0,
),
- Row(
- children: [
- Expanded(
- child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0),
- child: TextFormField(
- keyboardType: TextInputType.number,
- controller: waistController,
- ),
- ),
- ),
- ),
- 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 (waist < 200) waist++;
- waistController.text = waist.toString();
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (waist > 5) waist--;
- waistController.text = waist.toString();
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: waist.toDouble(),
- min: 5,
- max: 200,
- onChanged: (double newValue) {
- setState(() {
- waist = newValue.round();
- waistController.text = waist.toString();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).height,
+ _heightController,
+ 1,
+ 270,
+ _heightValue,
+ (text) {
+ _heightController.text = text;
+ },
+ (value) {
+ _heightValue = value;
+ },
+ _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHeightCM != value) {
+ setState(() {
+ _isHeightCM = value;
+ });
+ }
+ },
+ _heightPopupList,
),
- Texts('Select Unit'),
SizedBox(
- height: 5.0,
+ height: 12.0,
),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWaist(1);
- isHeightCm = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- color: waistCmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWaist(2);
- isHeightCm = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: waistFtCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
- ),
- ),
- ),
- ],
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).neck,
+ _neckController,
+ 1,
+ 270,
+ _neckValue,
+ (text) {
+ _neckController.text = text;
+ },
+ (value) {
+ _neckValue = value;
+ },
+ _isNeckKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isNeckKG != value) {
+ setState(() {
+ _isNeckKG = value;
+ });
+ }
+ },
+ _neckPopupList,
),
+
SizedBox(
- height: 10.0,
- ),
- Texts(
- 'Hip',
+ height: 12.0,
),
- Row(
- children: [
- Expanded(
- child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0),
- child: TextFormField(
- keyboardType: TextInputType.number,
- controller: hipController,
- ),
- ),
- ),
- ),
- 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 (hip < 140) hip++;
- hipController.text = hip.toString();
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (hip > 5) hip--;
- hipController.text = hip.toString();
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: hip.toDouble(),
- min: 5,
- max: 140,
- onChanged: (double newValue) {
- setState(() {
- hip = newValue.round();
- hipController.text = hip.toString();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).waist,
+ _waistController,
+ 1,
+ 270,
+ _waistValue,
+ (text) {
+ _waistController.text = text;
+ },
+ (value) {
+ _waistValue = value;
+ },
+ _isWaistKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isWaistKG != value) {
+ setState(() {
+ _isWaistKG = value;
+ });
+ }
+ },
+ _waistPopupList,
),
- Texts('Select Unit'),
SizedBox(
- height: 5.0,
+ height: 12.0,
),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHip(1);
- isHeightCm = true;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- color: hipCmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHip(2);
- isHeightCm = false;
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: hipFtCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
- ),
- ),
- ),
- ],
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).hip,
+ _hipController,
+ 1,
+ 270,
+ _hipValue,
+ (text) {
+ _hipController.text = text;
+ },
+ (value) {
+ _hipValue = value;
+ },
+ _isHipKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHipKG != value) {
+ setState(() {
+ _isHipKG = value;
+ });
+ }
+ },
+ _hipPopupList,
),
+
SizedBox(
- height: 35.0,
+ height: 12.0,
),
],
),
- Container(
- height: MediaQuery.of(context).size.height * 0.084,
- width: 350.0,
- child: SecondaryButton(
- label: 'CALCULATE',
- // onTap: () => {
- // setState(() {
- // print('hiii');
- // })
- // }
- onTap: () {
- setState(() {
- calculateBodyFat();
- showTextResult();
+ ),
+ ),
+ ),
+ 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(() {
+ calculateBodyFat();
+ showTextResult();
- {
- Navigator.push(
- context,
- FadePage(
- page: FatResult(
- bodyFat: bodyFat,
- fat: fat,
- textResult: textResult,
- )),
- );
- }
- });
- },
+ {
+ Navigator.push(
+ context,
+ FadePage(
+ page: FatResult(
+ bodyFat: bodyFat,
+ fat: fat,
+ textResult: textResult,
+ )),
+ );
+ }
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+ Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
+ return Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: InkWell(
+ onTap: hasSelection ? () {} : null,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _labelText,
+ style: TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
),
- ),
- ],
+ TextField(
+ enabled: isEnable,
+ scrollPadding: EdgeInsets.zero,
+ keyboardType: TextInputType.number,
+ controller: _controller,
+ onChanged: (value) => {},
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: _hintText,
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ prefixIconConstraints: BoxConstraints(minWidth: 50),
+ prefixIcon: prefix == null
+ ? null
+ : Text(
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
+ ),
),
+ if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
+ Function(bool) onUnitTap, _list) {
+ return Row(
+ children: [
+ Expanded(
+ flex: 3,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ TextField(
+ controller: _controller,
+ keyboardType: TextInputType.number,
+ onChanged: (value) {
+ double _value = double.parse(value);
+ if (_value > _maxValue) {
+ onTextValueChange(_maxValue.toStringAsFixed(0));
+ onValueChange(_maxValue);
+ return;
+ } else if (_value < _minValue) {
+ onTextValueChange(_minValue.toStringAsFixed(0));
+ onValueChange(_minValue);
+ return;
+ } else if (_value >= _minValue && _value <= _maxValue) {
+ onValueChange(_value);
+ return;
+ }
+ },
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
+ ],
+ style: TextStyle(
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: "0",
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
),
),
+ Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
+ Expanded(
+ flex: 1,
+ child: PopupMenuButton(
+ child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
+ onSelected: (value) {
+ onUnitTap(value);
+ },
+ itemBuilder: (context) => _list),
+ )
+ ],
+ ).withBorderedContainer;
+ }
+}
+
+// todo 'sikander' move these to separate file once usability known
+class CommonDropDownView extends StatelessWidget {
+ final String title;
+ final String value;
+ final VoidCallback callback;
+ final IconData iconData;
+
+ CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: callback,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ ),
+ ]),
+ ),
+ Icon(
+ iconData ?? Icons.keyboard_arrow_down_sharp,
+ color: Color(0xff2E303A),
+ )
+ ],
),
);
}
}
+
+
diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart
index 9ba23a1e..b8285083 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_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/button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@@ -41,49 +44,70 @@ class FatResult extends StatelessWidget {
showNewAppBar: true,
appBarTitle: TranslationBase.of(context).bodyFatTitle,
body: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
- SizedBox(
- // height: 40.0,
- ),
- Center(
- child: CircularPercentIndicator(
- radius: 220.0,
- lineWidth: 20.0,
- percent: ((fat > 70) ? 100 : fat / 100),
- center: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- fat.toStringAsFixed(1) + '%',
- style: TextStyle(
- fontSize: 18.0,
- fontWeight: FontWeight.bold,
+ Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).bodyFatTitle,
+ style: TextStyle(
+ fontSize: 19,
+ letterSpacing: -1.34,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ mHeight(20),
+ Center(
+ child: CircularPercentIndicator(
+ radius: 220.0,
+ lineWidth: 3.0,
+ percent: ((fat > 70) ? 100 : fat / 100),
+ center: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ fat.toStringAsFixed(1) + '%',
+ style: TextStyle(
+ fontSize: 17,
+ letterSpacing: -1.02,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
),
+ progressColor: CustomColors.accentColor,
+ backgroundColor: Colors.white,
),
- SizedBox(
- height: 5.0,
+ ),
+ mHeight(20),
+ Text(
+ textResult, style: TextStyle(
+ fontSize: 14,
+ letterSpacing: -0.56,
+ fontWeight: FontWeight.w600,
+ color: CustomColors.textColor
),
- ],
- ),
- progressColor: inductorColor,
- backgroundColor: Colors.white,
- ),
- ),
- Container(
- height: 120,
- width: 280.0,
- child: Texts(textResult),
+ ),
+ ],
+ ).withBorderedContainer,
),
+ mFlex(1),
+
Container(
- width: 350,
- child: Button(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
+ color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
+
],
),
);
@@ -142,3 +166,18 @@ class FatResult extends StatelessWidget {
});
}
}
+extension BorderedContainer on Widget {
+ Widget get withBorderedContainer => Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: this,
+ );
+}
\ No newline at end of file
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 4e24f64a..74db1a30 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart
@@ -1,9 +1,14 @@
+import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:provider/provider.dart';
import 'calorie_result_page.dart';
@@ -21,13 +26,23 @@ class _CalorieCalculatorState extends State {
bool isMale = false;
Color maleCard = activeCardColorGender;
Color femaleCard = inactiveCardColorGender;
- Color kgCard = activeCardColor;
- Color lbCard = inactiveCardColor;
- Color cmCard = activeCardColor;
- Color ftCard = inactiveCardColor;
- int age = 0;
- int height = 0;
- int weight = 0;
+
+ final GlobalKey clinicDropdownKey = GlobalKey();
+ bool _isHeightCM = true;
+ bool _isWeightKG = true;
+ double _heightValue = 150;
+ double _weightValue = 40;
+
+ TextEditingController ageController = new TextEditingController();
+ TextEditingController _heightController = new TextEditingController();
+ TextEditingController _weightController = TextEditingController();
+
+ List _heightPopupList = List();
+ List _weightPopupList = List();
+
+ // int age = 0;
+ // int height = 0;
+ // int weight = 0;
double calories;
String dropdownValue;
@@ -51,69 +66,32 @@ class _CalorieCalculatorState extends State {
}
}
- void updateColorWeight(int type) {
- //MG/DLT card
- if (type == 1) {
- if (kgCard == inactiveCardColor) {
- kgCard = activeCardColor;
- lbCard = inactiveCardColor;
- } else {
- kgCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (lbCard == inactiveCardColor) {
- lbCard = activeCardColor;
- kgCard = inactiveCardColor;
- } else {
- lbCard = inactiveCardColor;
- }
- }
- }
-
- void updateColorHeight(int type) {
- //MG/DLT card
- if (type == 1) {
- if (cmCard == inactiveCardColor) {
- cmCard = activeCardColor;
- ftCard = inactiveCardColor;
- } else {
- cmCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (ftCard == inactiveCardColor) {
- ftCard = activeCardColor;
- cmCard = inactiveCardColor;
- } else {
- ftCard = inactiveCardColor;
- }
- }
- }
-
void calculateCalories() {
if (isMale == true) {
- calories = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age);
+ calories = 66.5 + (13.75 * int.parse(_weightController.text)) + (5.003 * int.parse(_heightController.text)) - (6.755 * int.parse(ageController.text));
} else if (isMale == false) {
- calories =
- 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age);
+ calories = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text));
}
}
@override
Widget build(BuildContext context) {
+ ProjectViewModel projectViewModel = Provider.of(context);
+ _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
+ _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
+
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
- appBarTitle:
- "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}",
- showHomeAppBarIcon: false,
+ showNewAppBar: true,
+ showNewAppBarTitle: true,
+ appBarTitle: "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}",
appBarIcons: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
child: Icon(
Icons.info_outline,
- color: Colors.white,
+ color: Colors.black,
),
)
],
@@ -127,23 +105,31 @@ class _CalorieCalculatorState extends State {
//mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Texts(
+ Text(
TranslationBase.of(context).calorieCalcDesc,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
),
SizedBox(
- height: 8.0,
+ height: 20,
+ ),
+ Text(
+ TranslationBase.of(context).selectGender,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
),
- Texts(TranslationBase.of(context).gender),
SizedBox(
height: 8.0,
),
Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(30.0),
- color: Colors.white,
- border: Border.all(
- color: Colors.black45,
- )),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -155,15 +141,29 @@ class _CalorieCalculatorState extends State {
isMale = false;
});
},
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 16),
- decoration: BoxDecoration(
- color: maleCard,
- borderRadius: BorderRadius.circular(30.0),
- ),
- child: Center(
- child: Texts(
- TranslationBase.of(context).female)),
+ child: Row(
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
+ child: Container(
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100),
+ ),
+ ),
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).female,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ ),
+ ),
+ ],
),
),
),
@@ -175,506 +175,156 @@ class _CalorieCalculatorState extends State {
isMale = true;
});
},
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 16),
- decoration: BoxDecoration(
- color: femaleCard,
- borderRadius: BorderRadius.circular(30.0),
- ),
- child: Center(
- child: Texts(
- TranslationBase.of(context).male)),
- ),
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 12.0,
- ),
- Texts(
- TranslationBase.of(context).age11_120Years,
- ),
- Container(
- margin:
- EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0),
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.all(4.0),
- child: Center(
- child: Text(age.toString()),
- ),
- ),
+ child: Row(
+ children: [
+ Container(
+ decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1),
+ width: 24,
+ height: 24,
+ padding: EdgeInsets.all(4),
+ child: Container(
+ width: double.infinity,
+ height: double.infinity,
+ decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100),
),
- Container(
- padding:
- EdgeInsets.symmetric(horizontal: 4),
- 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 (age < 120) age++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (age > 0) age--;
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: age.toDouble(),
- min: 0,
- max: 120,
- onChanged: (double newValue) {
- setState(() {
- age = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- Texts(
- TranslationBase.of(context).height,
- ),
- Container(
- margin:
- EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0),
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
),
- ),
- child: Row(
- children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.all(4.0),
- child: Center(
- child: Text(height.toString()),
- ),
- ),
+ mWidth(12),
+ Text(
+ TranslationBase.of(context).male,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
),
- Container(
- padding:
- EdgeInsets.symmetric(horizontal: 4.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 (height < 250) height++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (height > 0) height--;
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
+ ),
+ ],
),
),
),
- Expanded(
- child: Slider(
- value: height.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- height = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
],
),
),
- Texts(
- TranslationBase.of(context).selectUnit,
+ SizedBox(
+ height: 12.0,
),
+ inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController),
SizedBox(
- height: 8.0,
+ height: 12.0,
),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(1);
- });
- },
- child: Container(
- padding: EdgeInsets.all(12),
- margin: EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- color: cmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(
- child:
- Texts(TranslationBase.of(context).cm)),
- ),
- ),
- ),
- ),
- Expanded(
- child: GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(2);
- });
- },
- child: Container(
- padding: EdgeInsets.all(12),
- margin: EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- color: ftCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 16.0),
- child: Center(
- child: Texts(
- TranslationBase.of(context).feet))),
- ),
- ),
- ),
- ],
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).height,
+ _heightController,
+ 1,
+ 270,
+ _heightValue,
+ (text) {
+ _heightController.text = text;
+ },
+ (value) {
+ _heightValue = value;
+ },
+ _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHeightCM != value) {
+ setState(() {
+ _isHeightCM = value;
+ });
+ }
+ },
+ _heightPopupList,
),
SizedBox(
- height: 8.0,
+ height: 12.0,
),
- Texts(
+ _commonInputAndUnitRow(
TranslationBase.of(context).weight,
+ _weightController,
+ 1,
+ 270,
+ _weightValue,
+ (text) {
+ _weightController.text = text;
+ },
+ (value) {
+ _weightValue = value;
+ },
+ _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
+ (value) {
+ if (_isWeightKG != value) {
+ setState(() {
+ _isWeightKG = value;
+ });
+ }
+ },
+ _weightPopupList,
),
SizedBox(
- height: 5.0,
+ height: 12.0,
),
- Container(
- margin:
- EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0),
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(weight.toString()),
- ),
+
+ InkWell(
+ onTap: () {
+ // dropdownKey.currentState;
+ openDropdown(clinicDropdownKey);
+ },
+ child: Container(
+ // width: double.infinity,
+ // decoration: containerRadius(Colors.white, 12),
+ // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
+ child: Row(
+ children: [
+ Flexible(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).activityLevel,
+ style: TextStyle(
+ fontSize: 11,
+ letterSpacing: -0.44,
+ fontWeight: FontWeight.w600,
),
- Container(
- height: 38.0,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5,
- ),
- ),
- ),
- child: InkWell(
- child: Icon(
- Icons.arrow_drop_up,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight < 250) weight++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight > 0) weight--;
- });
- },
- ),
- ],
+ ),
+ Container(
+ height: 18,
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton(
+ value: dropdownValue,
+ icon: Icon(Icons.arrow_downward),
+ iconSize: 0,
+ elevation: 16,
+ isExpanded: true,
+ style: TextStyle(color: Colors.black87),
+ underline: Container(
+ height: 2,
+ color: Colors.black54,
+ ),
+ onChanged: (String newValue) {
+ setState(() {
+ dropdownValue = newValue;
+ });
+ },
+ items: [
+ 'Almost Inactive(Little or no exercises)',
+ 'Lighty Active (1-3) days per week',
+ 'very Active(6-7) days per week',
+ 'Super Active(very hard exercises)'
+ ].map>((String value) {
+ return DropdownMenuItem(
+ value: value,
+ child: Text(value),
+ );
+ }).toList(),
),
),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: weight.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- weight = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- Texts(TranslationBase.of(context).selectUnit),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(1);
- });
- },
- child: Container(
- padding: EdgeInsets.all(12),
- margin: EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
),
],
- color: kgCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(
- child:
- Texts(TranslationBase.of(context).kg)),
),
),
- ),
+ Icon(Icons.keyboard_arrow_down),
+ ],
),
- Expanded(
- child: GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(2);
- });
- },
- child: Container(
- padding: EdgeInsets.all(12),
- margin: EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- color: lbCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 16.0),
- child: Center(
- child: Texts(
- TranslationBase.of(context).pound)),
- ),
- ),
- ),
- ),
- ],
- ),
- SizedBox(
- height: 8.0,
- ),
- Texts(TranslationBase.of(context).activityLevel),
- Container(
- child: DropdownButton(
- value: dropdownValue,
- icon: Icon(Icons.arrow_downward),
- iconSize: 24,
- elevation: 16,
- style: TextStyle(color: Colors.black87),
- underline: Container(
- height: 2,
- color: Colors.black54,
- ),
- onChanged: (String newValue) {
- setState(() {
- dropdownValue = newValue;
- });
- },
- items: [
- 'Almost Inactive(Little or no exercises)',
- 'Lighty Active (1-3) days per week',
- 'very Active(6-7) days per week',
- 'Super Active(very hard exercises)'
- ].map>((String value) {
- return DropdownMenuItem(
- value: value,
- child: Text(value),
- );
- }).toList(),
- ),
+ ).withBorderedContainer,
),
SizedBox(
height: 25.0,
@@ -686,8 +336,10 @@ class _CalorieCalculatorState extends State {
),
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(() {
calculateCalories();
@@ -709,4 +361,231 @@ class _CalorieCalculatorState extends State {
),
);
}
+
+ void openDropdown(GlobalKey key) {
+ GestureDetector detector;
+ void searchForGestureDetector(BuildContext element) {
+ element.visitChildElements((element) {
+ if (element.widget != null && element.widget is GestureDetector) {
+ detector = element.widget;
+ return false;
+ } else {
+ searchForGestureDetector(element);
+ }
+
+ return true;
+ });
+ }
+
+ searchForGestureDetector(key.currentContext);
+ assert(detector != null);
+
+ detector.onTap();
+ }
+
+ Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
+ return Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: InkWell(
+ onTap: hasSelection ? () {} : null,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _labelText,
+ style: TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
+ ),
+ TextField(
+ enabled: isEnable,
+ scrollPadding: EdgeInsets.zero,
+ keyboardType: TextInputType.number,
+ controller: _controller,
+ onChanged: (value) => {},
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: _hintText,
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ prefixIconConstraints: BoxConstraints(minWidth: 50),
+ prefixIcon: prefix == null
+ ? null
+ : Text(
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
+ Function(bool) onUnitTap, _list) {
+ return Row(
+ children: [
+ Expanded(
+ flex: 3,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ TextField(
+ controller: _controller,
+ keyboardType: TextInputType.number,
+ onChanged: (value) {
+ double _value = double.parse(value);
+ if (_value > _maxValue) {
+ onTextValueChange(_maxValue.toStringAsFixed(0));
+ onValueChange(_maxValue);
+ return;
+ } else if (_value < _minValue) {
+ onTextValueChange(_minValue.toStringAsFixed(0));
+ onValueChange(_minValue);
+ return;
+ } else if (_value >= _minValue && _value <= _maxValue) {
+ onValueChange(_value);
+ return;
+ }
+ },
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
+ ],
+ style: TextStyle(
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: "0",
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
+ Expanded(
+ flex: 1,
+ child: PopupMenuButton(
+ child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
+ onSelected: (value) {
+ onUnitTap(value);
+ },
+ itemBuilder: (context) => _list),
+ )
+ ],
+ ).withBorderedContainer;
+ }
+}
+
+// todo 'sikander' move these to separate file once usability known
+class CommonDropDownView extends StatelessWidget {
+ final String title;
+ final String value;
+ final VoidCallback callback;
+ final IconData iconData;
+
+ CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: callback,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ ),
+ ]),
+ ),
+ Icon(
+ iconData ?? Icons.keyboard_arrow_down_sharp,
+ color: Color(0xff2E303A),
+ )
+ ],
+ ),
+ );
+ }
}
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 749bf241..dc27e051 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
@@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@@ -24,45 +27,83 @@ class CalorieResultPage extends StatelessWidget {
showNewAppBarTitle: true,
showNewAppBar: true,
body: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Center(
- child: CircularPercentIndicator(
- radius: 220.0,
- lineWidth: 20.0,
- percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500),
- center: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- calorie.toStringAsFixed(1),
- style: TextStyle(
- fontSize: 18.0,
- fontWeight: FontWeight.bold,
+ Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "Calories",
+ style: TextStyle(
+ fontSize: 19,
+ letterSpacing: -1.34,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ mHeight(20),
+ Center(
+ child: CircularPercentIndicator(
+ radius: 220.0,
+ lineWidth: 3.0,
+ percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500),
+ center: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ calorie.toStringAsFixed(1),
+ style: TextStyle(
+ fontSize: 17,
+ letterSpacing: -1.02,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ SizedBox(
+ height: 5.0,
+ ),
+ Text(
+ 'Calories',
+ style: TextStyle(
+ fontSize: 18,
+ letterSpacing: -1.08,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
),
+ progressColor: CustomColors.accentColor,
+ backgroundColor: Colors.white,
),
- SizedBox(
- height: 5.0,
+ ),
+ mHeight(20),
+ Text(
+ 'Daily intake is ${calorie.toStringAsFixed(1)} calories',
+ style: TextStyle(
+ fontSize: 14,
+ letterSpacing: -0.56,
+ fontWeight: FontWeight.w600,
+ color: CustomColors.textColor
),
- Texts('Calories'),
- ],
- ),
- progressColor: Color(0xff3C3939),
- backgroundColor: Colors.white,
- ),
- ),
- Container(
- child: Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'),
+ ),
+ ],
+ ).withBorderedContainer,
),
+ mFlex(1),
Container(
- width: 350,
- child: Button(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
+ color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
+
],
),
);
@@ -121,3 +162,19 @@ class CalorieResultPage 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/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart
index 4b68687a..fa8e2bc5 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart
@@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@@ -17,6 +18,7 @@ class Carbs extends StatefulWidget {
class _CarbsState extends State {
TextEditingController textController = new TextEditingController();
+ final GlobalKey clinicDropdownKey = GlobalKey();
int calories;
String dropdownValue;
bool _visible = false;
@@ -67,9 +69,9 @@ class _CarbsState extends State {
void calculate() {
pCal = (protein / 100.0) * int.parse(textController.text).ceil();
cCal = (carbs / 100.0) * int.parse(textController.text);
- ;
+
fCal = (fat / 100) * int.parse(textController.text);
- ;
+
pCalGram = pCal / 4.0;
cCalGram = cCal / 4.0;
fCalGram = fCal / 9.0;
@@ -95,286 +97,274 @@ class _CarbsState extends State {
),
)
],
- body: Padding(
- padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0),
- child: SingleChildScrollView(
- child: Container(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Texts(
- 'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio',
- ),
- SizedBox(
- height: 15.0,
- ),
- Column(
+ body: Column(
+ children: [
+ Expanded(
+ child: SingleChildScrollView(
+ child: Container(
+ padding: EdgeInsets.all(21),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 300.0,
- foregroundDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: TextFormField(
- controller: textController,
- inputFormatters: [
- FilteringTextInputFormatter
- .digitsOnly
- ],
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- hintText: " The Calories per day ",
- labelStyle: TextStyle(
- color: Colors.black87,
- ),
- ),
- ),
- ),
- ),
- Container(
- height: 38.0,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5,
- ),
- ),
- ),
- child: InkWell(
- child: Icon(
- Icons.arrow_drop_up,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- int currentValue = int.parse(
- textController.text);
- currentValue++;
- textController.text =
- (currentValue).toString();
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- int currentValue = int.parse(
- textController.text);
- currentValue--;
- textController.text =
- (currentValue).toString();
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ],
+ Text(
+ 'Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio',
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
),
),
SizedBox(
- height: 20.0,
+ height: 15.0,
),
- Button(
- backgroundColor: Color(0xffC5272D),
- label: 'NOT SURE? CLICK HERE',
- onTap: () {
- setState(() {
- {
+ Column(
+ mainAxisAlignment: MainAxisAlignment.end,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ inputWidget("The Calories per day", "0", textController),
+ InkWell(
+ onTap: () {
Navigator.push(
context,
FadePage(page: CalorieCalculator()),
);
- }
- });
- },
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: Text(
+ 'NOT SURE? CLICK HERE',
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline),
+ ),
+ ),
+ )
+ ],
),
- ],
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Texts('Select Diet Type'),
- Container(
- width: 400,
- child: DropdownButton(
- value: dropdownValue,
- icon: Icon(Icons.arrow_downward),
- iconSize: 24,
- elevation: 16,
- style: TextStyle(color: Colors.black87),
- underline: Container(
- height: 2,
- color: Colors.black54,
- ),
- onChanged: (String newValue) {
- setState(() {
- dropdownValue = newValue;
- calculateDietRatios();
-
- dropdownValue == null
- ? _visible = false
- : _visible = true;
- });
- },
- items: [
- 'Very Low Carb',
- 'Low Carb',
- 'Moderate Carb',
- 'USDA Gudilines',
- 'Zone Diet',
- ].map>((String value) {
- return DropdownMenuItem(
- value: value,
- child: Text(value),
- );
- }).toList(),
- ),
+ SizedBox(
+ height: 12.0,
),
- Visibility(
- visible: _visible,
+ InkWell(
+ onTap: () {
+ // dropdownKey.currentState;
+ openDropdown(clinicDropdownKey);
+ },
child: Container(
- height: 170.0,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ // width: double.infinity,
+ // decoration: containerRadius(Colors.white, 12),
+ // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
+ child: Row(
children: [
- Texts(
- 'Ratios are divided according to the selected diet'),
- RichText(
- text: TextSpan(
- style: TextStyle(color: Colors.black),
- children: [
- TextSpan(text: 'Meals Per Day '),
- TextSpan(
- text: '$meals',
- style: TextStyle(color: Color(0xffC5272D)),
- ),
- ],
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(color: Colors.black),
+ Flexible(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- TextSpan(
- text: 'Protein ',
- ),
- TextSpan(
- text: '$protein%',
- style: TextStyle(color: Color(0xffC5272D)),
- )
- ],
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(color: Colors.black),
- children: [
- TextSpan(
- text: 'Carbohydrate ',
+ Text(
+ "Select Diet Type",
+ style: TextStyle(
+ fontSize: 11,
+ letterSpacing: -0.44,
+ fontWeight: FontWeight.w600,
+ ),
),
- TextSpan(
- text: '$carbs%',
- style: TextStyle(color: Color(0xffC5272D)),
- )
- ],
- ),
- ),
- RichText(
- text: TextSpan(
- style: TextStyle(color: Colors.black),
- children: [
- TextSpan(
- text: 'Fat ',
+ Container(
+ height: 18,
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton(
+ value: dropdownValue,
+ icon: Icon(Icons.arrow_downward),
+ iconSize: 0,
+ elevation: 16,
+ isExpanded: true,
+ style: TextStyle(color: Colors.black87),
+ underline: Container(
+ height: 2,
+ color: Colors.black54,
+ ),
+ onChanged: (String newValue) {
+ setState(() {
+ dropdownValue = newValue;
+ calculateDietRatios();
+ });
+ },
+ items: ['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map>((String value) {
+ return DropdownMenuItem(
+ value: value,
+ child: Text(value),
+ );
+ }).toList(),
+ ),
+ ),
),
- TextSpan(
- text: '$fat%',
- style: TextStyle(color: Color(0xffC5272D)),
- )
],
),
),
+ Icon(Icons.keyboard_arrow_down),
],
),
- ),
- )
+ ).withBorderedContainer,
+ ),
+ SizedBox(
+ height: 25.0,
+ ),
+ SizedBox(
+ height: 55.0,
+ ),
],
),
- SizedBox(
- height: 55.0,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
+ label: TranslationBase.of(context).calculate,
+ color: CustomColors.accentColor,
+ onTap: () {
+ setState(() {
+ {
+ calculate();
+ Navigator.push(
+ context,
+ FadePage(
+ page: CarbsResult(
+ cCal: cCal,
+ pCal: pCal,
+ fCal: fCal,
+ pCalGram: pCalGram,
+ pCalMeal: pCalMeal,
+ fCalGram: fCalGram,
+ fCalMeal: fCalMeal,
+ cCalGram: cCalGram,
+ cCalMeal: cCalMeal,
+ )),
+ );
+ }
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ void openDropdown(GlobalKey key) {
+ GestureDetector detector;
+ void searchForGestureDetector(BuildContext element) {
+ element.visitChildElements((element) {
+ if (element.widget != null && element.widget is GestureDetector) {
+ detector = element.widget;
+ return false;
+ } else {
+ searchForGestureDetector(element);
+ }
+
+ return true;
+ });
+ }
+
+ searchForGestureDetector(key.currentContext);
+ assert(detector != null);
+
+ detector.onTap();
+ }
+}
+
+Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
+ return Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: InkWell(
+ onTap: hasSelection ? () {} : null,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _labelText,
+ style: TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
),
- Container(
- height: 50.0,
- width: 350.0,
- child: SecondaryButton(
- label: 'CALCULATE',
- onTap: () {
- setState(() {
- {
- calculate();
- Navigator.push(
- context,
- FadePage(
- page: CarbsResult(
- cCal: cCal,
- pCal: pCal,
- fCal: fCal,
- pCalGram: pCalGram,
- pCalMeal: pCalMeal,
- fCalGram: fCalGram,
- fCalMeal: fCalMeal,
- cCalGram: cCalGram,
- cCalMeal: cCalMeal,
- )),
- );
- }
- });
- },
+ TextField(
+ enabled: isEnable,
+ scrollPadding: EdgeInsets.zero,
+ keyboardType: TextInputType.number,
+ controller: _controller,
+ onChanged: (value) => {},
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: _hintText,
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ prefixIconConstraints: BoxConstraints(minWidth: 50),
+ prefixIcon: prefix == null
+ ? null
+ : Text(
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
),
),
],
),
),
- ),
+ if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
+ ],
),
- );
- }
+ ),
+ );
+}
+
+extension BorderedContainer on Widget {
+ Widget get withBorderedContainer => Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: this,
+ );
}
diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart
index 46c14ee0..43019deb 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart
@@ -1,15 +1,20 @@
-
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
+import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
+import 'package:provider/provider.dart';
class CarbsResult extends StatelessWidget {
double pCal;
@@ -22,18 +27,11 @@ class CarbsResult extends StatelessWidget {
double cCalMeal;
double fCalMeal;
- CarbsResult(
- {this.pCal,
- this.cCal,
- this.fCal,
- this.pCalGram,
- this.cCalGram,
- this.fCalGram,
- this.fCalMeal,
- this.cCalMeal,
- this.pCalMeal});
+ CarbsResult({this.pCal, this.cCal, this.fCal, this.pCalGram, this.cCalGram, this.fCalGram, this.fCalMeal, this.cCalMeal, this.pCalMeal});
+
@override
Widget build(BuildContext context) {
+ ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@@ -43,135 +41,96 @@ class CarbsResult extends StatelessWidget {
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0),
- child: Table(
- border: TableBorder(
- verticalInside: BorderSide(width: 1, color: Colors.black54),
- bottom: BorderSide(width: 1, color: Colors.black54),
- left: BorderSide(width: 1, color: Colors.black54),
- right: BorderSide(width: 1, color: Colors.black54),
- top: BorderSide(width: 1, color: Colors.black54),
- ),
+ Container(
+ decoration: containerRadius(Colors.white, 12),
+ padding: EdgeInsets.all(12),
+ margin: EdgeInsets.all(20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- TableRow(
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- children: [
- TableCell(
- child: Center(
- child: Texts('Description'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts('Protein'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(
- 'Carbohydrate',
- ),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts('Fat'),
- ),
- ),
- ]),
- TableRow(children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: TableCell(
- child: Center(
- child: Texts('Calories\n Per Day'),
- ),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(pCal.ceil().toString() + ' Cals'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(cCal.ceil().toString() + ' Cals'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(fCal.ceil().toString() + ' Cals'),
- ),
- ),
- ]),
- TableRow(children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: TableCell(
- child: Center(
- child: Texts('Grams Per\n Day'),
- ),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(pCalGram.ceil().toString() + ' gr'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(cCalGram.ceil().toString() + ' gr'),
- ),
+ Text(
+ TranslationBase.of(context).carbsProtin,
+ style: TextStyle(
+ fontSize: 19,
+ fontWeight: FontWeight.bold,
+ letterSpacing: -1.34,
),
- TableCell(
- child: Center(
- child: Texts(fCalGram.ceil().toString() + ' gr'),
- ),
- ),
- ]),
- TableRow(children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: TableCell(
- child: Center(
- child: Texts('Grams Per\n Meal'),
- ),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(pCalMeal.ceil().toString() + ' gr'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(cCalMeal.ceil().toString() + ' gr'),
- ),
- ),
- TableCell(
- child: Center(
- child: Texts(fCalMeal.ceil().toString() + ' gr'),
- ),
- ),
- ]),
+ ),
+ mHeight(12),
+ Table(
+ columnWidths: {
+ 0: FlexColumnWidth(2.4),
+ 1: FlexColumnWidth(1.8),
+ 2: FlexColumnWidth(2),
+ 3: FlexColumnWidth(1),
+ },
+ children: fullData(context, projectViewModel),
+ ),
],
),
),
Container(
- width: 350,
- child: Button(
- label: TranslationBase.of(context).viewDocList,
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
+ label: TranslationBase.of(context).seeListOfDoctor,
+ color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
),
),
+
+ ],
+ ),
+ );
+ }
+
+ List fullData(BuildContext context, ProjectViewModel projectViewModel) {
+ List tableRow = [];
+ tableRow.add(
+ TableRow(
+ children: [
+ Utils.tableColumnTitle("Description"),
+ Utils.tableColumnTitle("Protein"),
+ Utils.tableColumnTitle("Carbohydrate"),
+ Utils.tableColumnTitle("Fat"),
+ ],
+ ),
+ );
+
+ tableRow.add(
+ TableRow(
+ children: [
+ Utils.tableColumnValue("Calories Per Day", isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(pCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel),
+ ],
+ ),
+ );
+
+ tableRow.add(
+ TableRow(
+ children: [
+ Utils.tableColumnValue("Grams Per Day", isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(pCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(cCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(fCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
],
),
);
+ tableRow.add(
+ TableRow(
+ children: [
+ Utils.tableColumnValue('Grams Per Meal', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(pCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(cCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
+ Utils.tableColumnValue(fCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel),
+ ],
+ ),
+ );
+ return tableRow;
}
getDoctorsList(BuildContext context) {
@@ -208,7 +167,7 @@ class CarbsResult extends StatelessWidget {
List doctorByHospital = _patientDoctorAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
- )
+ )
.toList();
if (doctorByHospital.length != 0) {
@@ -226,5 +185,4 @@ class CarbsResult extends StatelessWidget {
print(err);
});
}
-
}
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 e8d89b13..e414f028 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart
@@ -1,10 +1,11 @@
-
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'ideal_body_result_page.dart';
@@ -24,8 +25,9 @@ class _IdealBodyState extends State {
Color lbCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
- int age = 0;
- int height = 0;
+
+ // int age = 0;
+ // int height = 0;
double heightInches;
double minRange;
double maxRange;
@@ -38,48 +40,22 @@ class _IdealBodyState extends State {
double maxIdealWeight;
double heightFeet;
- void updateColorHeight(int type) {
- //MG/DLT card
- if (type == 1) {
- if (cmCard == inactiveCardColor) {
- cmCard = activeCardColor;
- ftCard = inactiveCardColor;
- } else {
- cmCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (ftCard == inactiveCardColor) {
- ftCard = activeCardColor;
- cmCard = inactiveCardColor;
- } else {
- ftCard = inactiveCardColor;
- }
- }
- }
+ final GlobalKey clinicDropdownKey = GlobalKey();
+ bool _isHeightCM = true;
+ bool _isWeightKG = true;
+ double _heightValue = 0;
+ double _weightValue = 0;
+
+ TextEditingController _heightController = new TextEditingController();
+ TextEditingController _weightController = TextEditingController();
+
+ List _heightPopupList = List();
+ List _weightPopupList = List();
+
- void updateColorWeight(int type) {
- //MG/DLT card
- if (type == 1) {
- if (kgCard == inactiveCardColor) {
- kgCard = activeCardColor;
- lbCard = inactiveCardColor;
- } else {
- kgCard = inactiveCardColor;
- }
- }
- if (type == 2) {
- if (lbCard == inactiveCardColor) {
- lbCard = activeCardColor;
- kgCard = inactiveCardColor;
- } else {
- lbCard = inactiveCardColor;
- }
- }
- }
void calculateIdealWeight() {
- heightInches = height * .39370078740157477;
+ heightInches = int.parse(_heightController.text) * .39370078740157477;
heightFeet = heightInches / 12;
idealWeight = (50 + 2.3 * (heightInches - 60));
if (dropdownValue == 'Small(fingers overlap)') {
@@ -99,6 +75,9 @@ class _IdealBodyState extends State {
@override
Widget build(BuildContext 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)];
+
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@@ -115,458 +94,418 @@ class _IdealBodyState extends State {
),
)
],
- body: Padding(
- padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0),
- child: SingleChildScrollView(
- child: Container(
- height: 800.0,
- child: Column(
- children: [
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Texts(
- 'Calculates the ideal body weight based on height, Weight, and Body Size',
- ),
- ),
- Divider(
- thickness: 2.0,
- ),
- SizedBox(
- height: 5.0,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ body: Column(
+ children: [
+ Expanded(
+ child: SingleChildScrollView(
+ child: Container(
+ padding: EdgeInsets.all(21),
+ child: Column(
children: [
- Texts(
- 'Height',
- ),
- Row(
- children: [
- Expanded(
- child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Row(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius:
- BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
- ),
- ),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(height.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 (height < 250)
- height++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (height > 0) height--;
- });
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: height.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- height = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
+ Text(
+ 'Calculates the ideal body weight based on height, Weight, and Body Size',
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -0.56,
+ color: CustomColors.textColor,
+ ),
),
- Texts('Select Unit'),
SizedBox(
height: 5.0,
),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(1);
- isHeightCm = true;
- });
+ SizedBox(
+ height: 12.0,
+ ),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).height,
+ _heightController,
+ 1,
+ 270,
+ _heightValue,
+ (text) {
+ _heightController.text = text;
},
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- color: cmCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('CM')),
- ),
- ),
+ (value) {
+ _heightValue = value;
+ },
+ _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
+ (value) {
+ if (_isHeightCM != value) {
+ setState(() {
+ _isHeightCM = value;
+ });
+ }
+ },
+ _heightPopupList,
),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorHeight(2);
- isHeightCm = false;
- });
+ SizedBox(
+ height: 12.0,
+ ),
+ _commonInputAndUnitRow(
+ TranslationBase.of(context).weight,
+ _weightController,
+ 1,
+ 270,
+ _weightValue,
+ (text) {
+ _weightController.text = text;
},
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: ftCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('Ft')),
- ),
- ),
+ (value) {
+ _weightValue = value;
+ },
+ _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
+ (value) {
+ if (_isWeightKG != value) {
+ setState(() {
+ _isWeightKG = value;
+ });
+ }
+ },
+ _weightPopupList,
),
- ],
- ),
- SizedBox(
- height: 45.0,
- ),
- Divider(
- thickness: 2.0,
- ),
- Texts(
- 'Weight',
- ),
- SizedBox(
- height: 5.0,
- ),
- Row(
- children: [
- Expanded(
+ SizedBox(
+ height: 12.0,
+ ),
+ InkWell(
+ onTap: () {
+ // dropdownKey.currentState;
+ openDropdown(clinicDropdownKey);
+ },
child: Container(
- width: 340.0,
- height: 60.0,
- decoration: BoxDecoration(
- color: Colors.white,
- ),
+ // width: double.infinity,
+ // decoration: containerRadius(Colors.white, 12),
+ // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
- Padding(
- padding: EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 8.0),
- child: Center(
- child: Container(
- width: 60.0,
- foregroundDecoration: BoxDecoration(
- borderRadius:
- BorderRadius.circular(5.0),
- border: Border.all(
- color: Colors.blueGrey,
- width: 2.0,
+ Flexible(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "Body Frame Size",
+ style: TextStyle(
+ fontSize: 11,
+ letterSpacing: -0.44,
+ fontWeight: FontWeight.w600,
),
),
- child: Row(
- children: [
- Expanded(
- child: Center(
- child: Text(weight.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 (weight < 250)
- weight++;
- });
- },
- ),
- ),
- InkWell(
- child: Icon(
- Icons.arrow_drop_down,
- size: 18.0,
- ),
- onTap: () {
- setState(() {
- if (weight > 0) weight--;
- });
- },
- ),
- ],
+ Container(
+ height: 18,
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton(
+ value: dropdownValue,
+ icon: Icon(Icons.arrow_downward),
+ iconSize: 0,
+ elevation: 16,
+ isExpanded: true,
+ style: TextStyle(color: Colors.black87),
+ underline: Container(
+ height: 2,
+ color: Colors.black54,
),
+ onChanged: (String newValue) {
+ setState(() {
+ dropdownValue = newValue;
+ });
+ },
+ items: [
+ 'Small(fingers overlap)',
+ 'Medium(fingers touch)',
+ 'Large(fingers don\'n touch)',
+ ].map>((String value) {
+ return DropdownMenuItem(
+ value: value,
+ child: Text(value),
+ );
+ }).toList(),
),
- ],
+ ),
),
- ),
- ),
- ),
- Expanded(
- child: Slider(
- value: weight.toDouble(),
- min: 0,
- max: 250,
- onChanged: (double newValue) {
- setState(() {
- weight = newValue.round();
- });
- },
- activeColor: Color(0xffC5272D),
- inactiveColor: Color(0xffF3C5C6),
+ ],
),
),
+ Icon(Icons.keyboard_arrow_down),
],
),
- ),
- ),
- ],
- ),
- Texts('Select Unit'),
- SizedBox(
- height: 5.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(1);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- color: kgCard,
- borderRadius: BorderRadius.circular(3.0),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 0.0, horizontal: 18.0),
- child: Center(child: Texts('KG')),
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- updateColorWeight(2);
- });
- },
- child: Container(
- height: 55.0,
- width: 150.0,
- decoration: BoxDecoration(
- color: lbCard,
- borderRadius: BorderRadius.circular(3.0),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.5),
- spreadRadius: 3,
- blurRadius: 7,
- offset: Offset(
- 0, 3), // changes position of shadow
- ),
- ],
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(child: Texts('LB')),
- ),
- ),
+ ).withBorderedContainer,
),
],
),
- SizedBox(
- height: 45.0,
- ),
- Divider(
- thickness: 2.0,
+ ],
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
+ label: TranslationBase.of(context).calculate,
+ color: CustomColors.accentColor,
+ onTap: () {
+ setState(() {
+ // calculateBmr();
+ // calculateCalories();
+ calculateIdealWeight();
+
+ print(idealWeight);
+ print(minRange);
+ print(maxRange);
+ print(overWeightBy);
+ print(textResult);
+ //print(overWeightBy);
+ {
+ Navigator.push(
+ context,
+ FadePage(
+ page: IdealBodyResult(
+ idealBodyWeight: idealWeight,
+ minRange: minRange,
+ mixRange: maxRange,
+ overWeightBy: overWeightBy,
+ textResult: textResult,
+ )),
+ );
+ }
+ });
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ void openDropdown(GlobalKey key) {
+ GestureDetector detector;
+ void searchForGestureDetector(BuildContext element) {
+ element.visitChildElements((element) {
+ if (element.widget != null && element.widget is GestureDetector) {
+ detector = element.widget;
+ return false;
+ } else {
+ searchForGestureDetector(element);
+ }
+
+ return true;
+ });
+ }
+
+ searchForGestureDetector(key.currentContext);
+ assert(detector != null);
+
+ detector.onTap();
+ }
+
+ Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
+ return Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: InkWell(
+ onTap: hasSelection ? () {} : null,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _labelText,
+ style: TextStyle(
+ fontSize: 11,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
),
- SizedBox(
- height: 5.0,
+ ),
+ TextField(
+ enabled: isEnable,
+ scrollPadding: EdgeInsets.zero,
+ keyboardType: TextInputType.number,
+ controller: _controller,
+ onChanged: (value) => {},
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff2B353E),
+ letterSpacing: -0.44,
),
- Texts('Body Frame Size'),
- Container(
- width: 300,
- child: DropdownButton(
- value: dropdownValue,
- icon: Icon(Icons.arrow_downward),
- iconSize: 24,
- elevation: 16,
- style: TextStyle(color: Colors.black87),
- underline: Container(
- height: 2,
- color: Colors.black54,
- ),
- onChanged: (String newValue) {
- setState(() {
- dropdownValue = newValue;
- });
- },
- items: [
- 'Small(fingers overlap)',
- 'Medium(fingers touch)',
- 'Large(fingers don\'n touch)',
- ].map>((String value) {
- return DropdownMenuItem(
- value: value,
- child: Text(value),
- );
- }).toList(),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: _hintText,
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
),
+ prefixIconConstraints: BoxConstraints(minWidth: 50),
+ prefixIcon: prefix == null
+ ? null
+ : Text(
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
),
- SizedBox(
- height: 30.0,
- ),
- Container(
- height: 50.0,
- width: 350.0,
- child: SecondaryButton(
- label: 'CALCULATE',
- onTap: () {
- setState(() {
- // calculateBmr();
- // calculateCalories();
- calculateIdealWeight();
+ ),
+ ],
+ ),
+ ),
+ if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
+ ],
+ ),
+ ),
+ );
+ }
- print(idealWeight);
- //print(overWeightBy);
- {
- Navigator.push(
- context,
- FadePage(
- page: IdealBodyResult(
- idealBodyWeight: idealWeight,
- minRange: minRange,
- mixRange: maxRange,
- overWeightBy: overWeightBy,
- textResult: textResult,
- )),
- );
- }
- });
- },
- ),
- ),
- ],
+ Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
+ Function(bool) onUnitTap, _list) {
+ return Row(
+ children: [
+ Expanded(
+ flex: 3,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
),
- ],
- ),
+ ),
+ TextField(
+ controller: _controller,
+ keyboardType: TextInputType.number,
+ onChanged: (value) {
+ double _value = double.parse(value);
+ if (_value > _maxValue) {
+ onTextValueChange(_maxValue.toStringAsFixed(0));
+ onValueChange(_maxValue);
+ return;
+ } else if (_value < _minValue) {
+ onTextValueChange(_minValue.toStringAsFixed(0));
+ onValueChange(_minValue);
+ return;
+ } else if (_value >= _minValue && _value <= _maxValue) {
+ onValueChange(_value);
+ return;
+ }
+ },
+ inputFormatters: [
+ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
+ ],
+ style: TextStyle(
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ decoration: InputDecoration(
+ isDense: true,
+ hintText: "0",
+ hintStyle: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ ),
+ ),
+ ],
),
),
+ Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
+ Expanded(
+ flex: 1,
+ child: PopupMenuButton(
+ child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
+ onSelected: (value) {
+ onUnitTap(value);
+ },
+ itemBuilder: (context) => _list),
+ )
+ ],
+ ).withBorderedContainer;
+ }
+}
+
+// todo 'sikander' move these to separate file once usability known
+class CommonDropDownView extends StatelessWidget {
+ final String title;
+ final String value;
+ final VoidCallback callback;
+ final IconData iconData;
+
+ CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: callback,
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.44,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ color: Color(0xff575757),
+ letterSpacing: -0.56,
+ ),
+ ),
+ ]),
+ ),
+ Icon(
+ iconData ?? Icons.keyboard_arrow_down_sharp,
+ color: Color(0xff2E303A),
+ )
+ ],
),
);
}
}
+
+
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 6a40bee7..6eec6dd8 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
@@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
+import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
+import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@@ -28,139 +31,170 @@ class IdealBodyResult extends StatelessWidget {
appBarTitle: TranslationBase.of(context).idealBody,
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Texts(
- 'Ideal weight range is',
- fontSize: 23.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Row(
- children: [
- Texts(
- minRange.toStringAsFixed(1),
- fontSize: 30.0,
- ),
- Padding(
- padding: EdgeInsets.only(top: 8.0, left: 4.0),
- child: Text(
- 'Kg',
- style: TextStyle(color: Colors.red),
- ),
- ),
- ],
- ),
- Icon(
- Icons.arrow_forward,
- color: Colors.red,
- size: 55.0,
- ),
- Row(
- children: [
- Texts(
- mixRange.toStringAsFixed(1),
- fontSize: 30.0,
- ),
- Padding(
- padding: EdgeInsets.only(top: 8.0, left: 4.0),
- child: Text(
- 'Kg',
- style: TextStyle(color: Colors.red),
- ),
+
+ Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Ideal weight range is',
+ style: TextStyle(
+ fontSize: 19,
+ letterSpacing: -1.34,
+ fontWeight: FontWeight.bold,
),
- ],
- ),
- ],
- ),
- overWeightBy >= 0 && overWeightBy <= 10
- ? Column(
+ ),
+ mHeight(12),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
- Texts(
- 'Congratulations! The current weight is\n perfect and considered healthy',
- fontSize: 20.0,
+ Row(
+ children: [
+ Texts(
+ minRange.toStringAsFixed(1),
+ fontSize: 30.0,
+ ),
+ Padding(
+ padding: EdgeInsets.only(top: 8.0, left: 4.0),
+ child: Text(
+ 'Kg',
+ style: TextStyle(color: Colors.red),
+ ),
+ ),
+ ],
),
- ],
- )
- : overWeightBy > 10 && overWeightBy < 17
- ? Column(
+ Icon(
+ Icons.arrow_forward,
+ color: Colors.red,
+ size: 55.0,
+ ),
+ Row(
children: [
- Texts('This means that the weight is a little bit more than ideal weight by'),
- Texts(overWeightBy.toStringAsFixed(1)),
- Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
+ Texts(
+ mixRange.toStringAsFixed(1),
+ fontSize: 30.0,
+ ),
+ Padding(
+ padding: EdgeInsets.only(top: 8.0, left: 4.0),
+ child: Text(
+ 'Kg',
+ style: TextStyle(color: Colors.red),
+ ),
+ ),
],
- )
- : overWeightBy >= 18
- ? Container(
- height: 250.0,
- width: 350,
- child: Column(
+ ),
+ ],
+ ),
+ mHeight(12),
+ overWeightBy >= 0 && overWeightBy <= 10
+ ? Column(
+ children: [
+ Texts(
+ 'Congratulations! The current weight is perfect and considered healthy',
+ fontSize: 20.0,
+ ),
+ ],
+ )
+ : overWeightBy > 10 && overWeightBy < 17
+ ? Column(
children: [
- Texts(
- 'Means that you suffer from excessive\n obesity by',
- ),
- SizedBox(
- height: 55.0,
- ),
- Texts(
- overWeightBy.toStringAsFixed(1),
- fontSize: 40.0,
- ),
- SizedBox(
- height: 25.0,
- ),
- Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
+ Texts('This means that the weight is a little bit more than ideal weight by'),
+ Texts(overWeightBy.toStringAsFixed(1)),
+ Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
],
- ),
- )
- : overWeightBy < -18
- ? Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Texts(
- 'Under Weight',
- fontSize: 18.0,
- ),
- ),
- SizedBox(
- height: 55.0,
- ),
- Texts(
- overWeightBy.toStringAsFixed(1),
- fontSize: 20.0,
+ )
+ : overWeightBy >= 18
+ ? Container(
+
+ child: Column(
+ children: [
+ Texts(
+ 'Means that you suffer from excessive obesity by',
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ Text(
+ overWeightBy.toStringAsFixed(1),
+ style: TextStyle(
+ fontSize: 17,
+ fontWeight: FontWeight.bold,
+ letterSpacing: -1.34,
+ ),
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ Texts('May wish to consult with the doctor for medical help. Click to view our list of\n Doctors'),
+ ],
),
- ],
- )
- : Container(
- height: 250.0,
- width: 350.0,
- child: Column(
- children: [
- Texts(
- 'under wheight',
- fontSize: 20.0,
- ),
- SizedBox(
- height: 55.0,
- ),
- Texts(
- overWeightBy.toStringAsFixed(1),
- fontSize: 20.0,
- ),
- SizedBox(
- height: 25.0,
+ )
+ : overWeightBy < -18
+ ? Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Texts(
+ 'Under Weight',
+ fontSize: 18.0,
+ ),
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ Text(
+ overWeightBy.toStringAsFixed(1),
+ style: TextStyle(
+ fontSize: 17,
+ fontWeight: FontWeight.bold,
+ letterSpacing: -1.34,
+ ),
+ ),
+ ],
+ )
+ : Container(
+
+ child: Column(
+ children: [
+ Text(
+ 'under wheight',
+ style: TextStyle(
+ fontSize: 17,
+ fontWeight: FontWeight.bold,
+ letterSpacing: -1.34,
+ ),
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ Text(
+ overWeightBy.toStringAsFixed(1),
+ style: TextStyle(
+ fontSize: 17,
+ fontWeight: FontWeight.bold,
+ letterSpacing: -1.34,
+ ),
+ ),
+ SizedBox(
+ height: 12.0,
+ ),
+ Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'),
+ ],
+ ),
),
- Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'),
- ],
- ),
- ),
+ ],
+ ).withBorderedContainer,
+ ),
Container(
- width: 350,
- child: Button(
+ margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
+ color: Colors.white,
+ child: SecondaryButton(
label: TranslationBase.of(context).viewDocList,
+ color: CustomColors.accentColor,
onTap: () {
getDoctorsList(context);
},
@@ -224,3 +258,19 @@ class IdealBodyResult extends StatelessWidget {
});
}
}
+
+extension BorderedContainer on Widget {
+ Widget get withBorderedContainer => Container(
+ padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(15),
+ color: Colors.white,
+ border: Border.all(
+ color: Color(0xffefefef),
+ width: 1,
+ ),
+ ),
+ child: this,
+ );
+}
diff --git a/lib/pages/AlHabibMedicalService/ health_calculators.dart b/lib/pages/AlHabibMedicalService/ health_calculators.dart
index 341a298d..67f27337 100644
--- a/lib/pages/AlHabibMedicalService/ health_calculators.dart
+++ b/lib/pages/AlHabibMedicalService/ health_calculators.dart
@@ -109,11 +109,11 @@ class _HealthCalculatorsState extends State with SingleTicker
),
),
Container(
- margin: EdgeInsets.all(20.0),
+ // margin: EdgeInsets.all(20.0),
child: Column(
children: [
Padding(
- padding: EdgeInsets.only(left: 12, right: 12),
+ padding: EdgeInsets.only(left: 12, right: 12, top: 20.0),
child: GridView.builder(
shrinkWrap: true,
primary: false,
@@ -147,9 +147,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).bmi,
- imagePath: 'assets/images/new-design/bmi_health_calculator.png',
+ imagePath: 'bmi.svg',
subTitle: TranslationBase.of(context).calcHealth,
- isPngImage: true,
+
),
));
@@ -160,9 +160,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).calories,
- imagePath: 'assets/images/new-design/calories-calculator.png',
+ imagePath: 'calories_calc.svg',
subTitle: TranslationBase.of(context).calcHealth,
- isPngImage: true,
+
),
));
@@ -173,9 +173,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).bmr,
- imagePath: 'assets/images/new-design/BMR_calculator.png',
+ imagePath: 'bmr_calc.svg',
subTitle: TranslationBase.of(context).calcHealth,
- isPngImage: true,
+
),
));
@@ -186,9 +186,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).idealBody,
- imagePath: 'assets/images/new-design/body_weight.png',
+ imagePath: 'ideal_weight_calc.svg',
subTitle: TranslationBase.of(context).weight,
- isPngImage: true,
+
),
));
@@ -199,9 +199,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).bodyWord,
- imagePath: 'assets/images/new-design/body_fat.png',
+ imagePath: 'bmr_calc.svg',
subTitle: TranslationBase.of(context).fat,
- isPngImage: true,
+
),
));
@@ -212,9 +212,9 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).carbohydrate,
- imagePath: 'assets/images/new-design/carb_protein.png',
+ imagePath: 'carbs_proteitn_fat.svg',
subTitle: TranslationBase.of(context).proteinFat,
- isPngImage: true,
+
),
));
@@ -231,9 +231,8 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).ovulation,
- imagePath: 'assets/images/new-design/ovulation_period_icon.png',
+ imagePath: 'ovulation.svg',
subTitle: TranslationBase.of(context).period,
- isPngImage: true,
),
));
@@ -244,9 +243,8 @@ class _HealthCalculatorsState extends State with SingleTicker
),
child: MedicalProfileItem(
title: TranslationBase.of(context).delivery,
- imagePath: 'assets/images/new-design/delivery_date_icon.png',
+ imagePath: 'delivery.svg',
subTitle: TranslationBase.of(context).dueDate,
- isPngImage: true,
),
));
diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart
index b15f7adb..6d454d05 100644
--- a/lib/uitl/translations_delegate_base.dart
+++ b/lib/uitl/translations_delegate_base.dart
@@ -2618,6 +2618,10 @@ class TranslationBase {
String get RRTSubTitle => localizedValues["RRTSubTitle"][locale.languageCode];
String get transportation => localizedValues["transportation"][locale.languageCode];
+ String get neck => localizedValues["neck"][locale.languageCode];
+ String get waist => localizedValues["waist"][locale.languageCode];
+ String get hip => localizedValues["hip"][locale.languageCode];
+ String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate {
diff --git a/pubspec.yaml b/pubspec.yaml
index 3bdadc73..da332f80 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -168,6 +168,7 @@ dependencies:
in_app_review: ^1.0.4
badges: ^1.1.4
+ syncfusion_flutter_sliders: ^18.4.49-beta
# Dep by Zohaib
shimmer: ^1.1.2