|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
@ -129,13 +83,13 @@ class _BMICalculatorState extends State<BMICalculator> {
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
textController.text = '0'; // Setting the initial value for the field.
|
|
|
|
|
_heightValue = 100;
|
|
|
|
|
_weightValue = 50;
|
|
|
|
|
_heightValue = 100;
|
|
|
|
|
_weightValue = 50;
|
|
|
|
|
_heightController.text = _heightValue.toStringAsFixed(0);
|
|
|
|
|
_weightController.text = _weightValue.toStringAsFixed(0);
|
|
|
|
|
|
|
|
|
|
_isWeightKG = true;
|
|
|
|
|
_isHeightCM = true;
|
|
|
|
|
_isHeightCM = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -163,410 +117,100 @@ class _BMICalculatorState extends State<BMICalculator> {
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}",
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
_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: <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++;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).bmiCalcDesc,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|