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 49b33063..16beb792 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 207a65d7..0b059d96 100644
--- a/lib/config/localized_values.dart
+++ b/lib/config/localized_values.dart
@@ -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": "قدم"},
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..a6f8131b 100644
--- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart
+++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart
@@ -6,6 +6,7 @@ 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';
@@ -30,6 +31,19 @@ class _BMICalculatorState extends State {
Color lbCard = inactiveCardColor;
Color kgCard = activeCardColor;
+ TextEditingController _heightController = TextEditingController();
+ TextEditingController _weightController = TextEditingController();
+
+ List _weightPopupList = List();
+ List _heightPopupList = List();
+
+ bool _isUnitML = true;
+ bool _isGenderMale = false;
+ bool _isHeightCM = false;
+ bool _isWeightKG = false;
+ double _heightValue = 150;
+ double _weightValue = 40;
+
void updateColor(int type) {
//MG/DLT card
if (type == 1) {
@@ -115,432 +129,585 @@ 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}",
+ 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),
- ),
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).bmiCalcDesc,
+ style: TextStyle(
+ fontSize: 14.0,
+ letterSpacing: -0.56,
+ fontWeight: FontWeight.w600,
),
),
- ),
- 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,
+
+ _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),
+ 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()),
+ 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,
+ 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++;
+ });
+ },
+ ),
),
- child: InkWell(
+ InkWell(
child: Icon(
- Icons.arrow_drop_up,
+ Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
- if (height < 250) height++;
+ if (height > 120) 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)),
- ),
+ Slider(
+ value: height.toDouble(),
+ min: 120,
+ max: 250,
+ onChanged: (double newValue) {
+ setState(() {
+ height = newValue.round();
+ });
+ },
+ activeColor: Color(0xffC5272D),
+ inactiveColor: Color(0xffF3C5C6),
),
- ),
- 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
- ),
- ],
+ ],
+ ),
+ 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)),
+ ),
),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(
- child: Texts(TranslationBase.of(context).feet)),
+ ),
+ 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),
+ SizedBox(
+ height: 25.0,
),
- child: Column(
- 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,
+ 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).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()),
+ 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,
+ 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++;
+ });
+ },
+ ),
),
- child: InkWell(
+ InkWell(
child: Icon(
- Icons.arrow_drop_up,
+ Icons.arrow_drop_down,
size: 18.0,
),
onTap: () {
setState(() {
- if (weight < 250) weight++;
+ if (weight > 40) 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),
- ),
- ],
- ),
- Row(
- children: [
- Padding(
- padding: EdgeInsets.all(8.0),
- child: Texts(TranslationBase.of(context).selectUnit),
- ),
- ],
- ),
- 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)),
- ),
+ Slider(
+ value: weight.toDouble(),
+ min: 40,
+ max: 250,
+ onChanged: (double newValue) {
+ setState(() {
+ weight = newValue.round();
+ });
+ },
+ activeColor: Color(0xffC5272D),
+ inactiveColor: Color(0xffF3C5C6),
),
- ),
- 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
- ),
- ],
+ ],
+ ),
+ Row(
+ children: [
+ Padding(
+ padding: EdgeInsets.all(8.0),
+ child: Texts(TranslationBase.of(context).selectUnit),
+ ),
+ ],
+ ),
+ 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)),
+ ),
),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0),
- child: Center(
- child:
- Texts(TranslationBase.of(context).pound)),
+ ),
+ 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)),
+ ),
),
),
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
- ),
- 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(
- finalResult: bmiResult,
- textResult: textResult,
- msg: msg,
- )),
- );
- }
- })
+ 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(
+ 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_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,
),
));