Health Calculator 2.0

merge-update-with-lab-changes
devmirza121 4 years ago
parent e13d64dbf7
commit d4eab13982

@ -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": "فرز"},

@ -1,6 +1,8 @@
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';
@ -24,12 +26,6 @@ class _BMICalculatorState extends State<BMICalculator> {
String textResult;
String msg;
double bmiResult;
int height = 150;
int weight = 40;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
Color lbCard = inactiveCardColor;
Color kgCard = activeCardColor;
TextEditingController _heightController = TextEditingController();
TextEditingController _weightController = TextEditingController();
@ -37,53 +33,11 @@ class _BMICalculatorState extends State<BMICalculator> {
List<PopupMenuItem> _weightPopupList = List();
List<PopupMenuItem> _heightPopupList = List();
bool _isUnitML = true;
bool _isGenderMale = false;
bool _isHeightCM = false;
bool _isWeightKG = false;
bool _isHeightCM = true;
bool _isWeightKG = true;
double _heightValue = 150;
double _weightValue = 40;
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;
}
}
}
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;
}
}
}
double convertToCm(double number) {
return number * 30.48;
}
@ -93,10 +47,10 @@ class _BMICalculatorState extends State<BMICalculator> {
}
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;
}
@ -163,9 +117,11 @@ class _BMICalculatorState extends State<BMICalculator> {
)
],
appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
body: SingleChildScrollView(
body: Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(12.0),
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -177,7 +133,7 @@ class _BMICalculatorState extends State<BMICalculator> {
fontWeight: FontWeight.w600,
),
),
mHeight(24),
_commonInputAndUnitRow(
TranslationBase.of(context).height,
_heightController,
@ -198,353 +154,42 @@ class _BMICalculatorState extends State<BMICalculator> {
});
}
},
_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: <Widget>[
Expanded(
child: Center(
child: Text(height.toString()),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
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++;
});
},
_heightPopupList,
),
),
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();
});
mHeight(12),
_commonInputAndUnitRow(
TranslationBase.of(context).weight,
_weightController,
1,
270,
_weightValue,
(text) {
_weightController.text = text;
},
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);
});
(value) {
_weightValue = value;
},
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: () {
_isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound,
(value) {
if (_isWeightKG != value) {
setState(() {
updateColor(2);
_isWeightKG = value;
});
}
},
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)),
),
),
),
],
_weightPopupList,
),
],
),
),
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),
),
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: <Widget>[
Expanded(
child: Center(
child: Text(weight.toString()),
),
),
Container(
height: 38.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
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),
),
],
),
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)),
),
),
),
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),
padding: EdgeInsets.all(16),
child: SecondaryButton(
label: TranslationBase.of(context).calculate,
onTap: () => {
color: CustomColors.accentColor,
onTap: () {
setState(() {
calculateBMI();
showTextResult(context);
@ -557,17 +202,16 @@ class _BMICalculatorState extends State<BMICalculator> {
finalResult: bmiResult,
textResult: textResult,
msg: msg,
)),
),
),
);
}
})
});
},
),
),
],
),
),
),
);
}

@ -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(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: 50),
child: Center(
child: CircularPercentIndicator(
radius: 220.0,
lineWidth: 20.0,
percent: percentInductor(),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
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: [
Text(
finalResult.toStringAsFixed(1),
TranslationBase.of(context).bodyMassIndex + finalResult.toString(),
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 5.0,
mHeight(20),
Container(
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,
),
),
],
),
progressColor: colorInductor(),
backgroundColor: Colors.white,
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Texts(msg),
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,
),
)
],
),
),
);
}
}

@ -1,10 +1,13 @@
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 'bmr_result_page.dart';
@ -145,10 +148,14 @@ class _BmrCalculatorState extends State<BmrCalculator> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10.0),
child: Texts(
'Calculates the amount of energy that the persons body expends in a day'),
Text(
'Calculates the amount of energy that the persons body expends in a day',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
Divider(
thickness: 2.0,
@ -159,53 +166,85 @@ class _BmrCalculatorState extends State<BmrCalculator> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('Gender'),
SizedBox(
height: 5.0,
height: 20,
),
Text(
TranslationBase.of(context).selectGender,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
color: CustomColors.textColor,
),
),
SizedBox(
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(
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(
height: 55.0,
width: 170.0,
decoration: BoxDecoration(
color: maleCard,
borderRadius: BorderRadius.circular(35.0),
width: double.infinity,
height: double.infinity,
decoration: containerRadius(!isMale?CustomColors.accentColor:Colors.white, 100),
),
child: Center(child: Texts('FEMALE')),
),
mWidth(12),
Text(TranslationBase.of(context).female, style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),),
],
),
GestureDetector(
),
),
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(
height: 55.0,
width: 170.0,
decoration: BoxDecoration(
color: femaleCard,
borderRadius: BorderRadius.circular(35.0),
width: double.infinity,
height: double.infinity,
decoration: containerRadius(isMale?CustomColors.accentColor:Colors.white, 100),
),
),
mWidth(12),
Text(TranslationBase.of(context).male, style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.56,
),),
],
),
child: Center(child: Texts('MALE')),
),
),
],
@ -734,4 +773,225 @@ class _BmrCalculatorState extends State<BmrCalculator> {
),
);
}
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),
)
],
),
);
}
}
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,
);
}

@ -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,12 +27,28 @@ class CalorieResultPage extends StatelessWidget {
showNewAppBarTitle: true,
showNewAppBar: true,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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: 20.0,
lineWidth: 3.0,
percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500),
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -37,32 +56,54 @@ class CalorieResultPage extends StatelessWidget {
Text(
calorie.toStringAsFixed(1),
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
fontSize: 17,
letterSpacing: -1.02,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 5.0,
),
Texts('Calories'),
Text(
'Calories',
style: TextStyle(
fontSize: 18,
letterSpacing: -1.08,
fontWeight: FontWeight.w600,
),
),
],
),
progressColor: Color(0xff3C3939),
progressColor: CustomColors.accentColor,
backgroundColor: Colors.white,
),
),
Container(
child: Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'),
mHeight(20),
Text(
'Daily intake is ${calorie.toStringAsFixed(1)} calories',
style: TextStyle(
fontSize: 14,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: CustomColors.textColor
),
),
],
).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,
);
}

Loading…
Cancel
Save