body fat texfield fix

merge-update-with-lab-changes
hussam al-habibeh 5 years ago
parent 864f849425
commit fe83b91602

@ -50,6 +50,15 @@ class _BodyFatState extends State<BodyFat> {
TextEditingController waistController = TextEditingController(); TextEditingController waistController = TextEditingController();
TextEditingController hipController = TextEditingController(); TextEditingController hipController = TextEditingController();
@override
void initState() {
neckController.text = neck.toString();
hipController.text = hip.toString();
waistController.text = waist.toString();
heightController.text = heightCm.toString();
super.initState();
}
void updateColorHeight(int type) { void updateColorHeight(int type) {
//MG/DLT card //MG/DLT card
if (type == 1) { if (type == 1) {
@ -319,11 +328,6 @@ class _BodyFatState extends State<BodyFat> {
child: TextFormField( child: TextFormField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: heightController, controller: heightController,
decoration: InputDecoration(
labelText: heightCm.toString(),
labelStyle: TextStyle(
color: Colors.black,
)),
), ),
), ),
), ),
@ -350,6 +354,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (heightCm < 250) heightCm++; if (heightCm < 250) heightCm++;
heightController.text = heightCm.toString();
}); });
}, },
), ),
@ -362,6 +367,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (heightCm > 0) heightCm--; if (heightCm > 0) heightCm--;
heightController.text = heightCm.toString();
}); });
}, },
), ),
@ -381,6 +387,7 @@ class _BodyFatState extends State<BodyFat> {
onChanged: (double newValue) { onChanged: (double newValue) {
setState(() { setState(() {
heightCm = newValue.round(); heightCm = newValue.round();
heightController.text = heightCm.toString();
}); });
}, },
activeColor: Color(0xffC5272D), activeColor: Color(0xffC5272D),
@ -492,15 +499,10 @@ class _BodyFatState extends State<BodyFat> {
Expanded( Expanded(
child: Center( child: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 10.0), padding: const EdgeInsets.only(left: 15.0, bottom: 0),
child: TextFormField( child: TextFormField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: neckController, controller: neckController,
decoration: InputDecoration(
labelText: neck.toString(),
labelStyle: TextStyle(
color: Colors.black,
)),
), ),
), ),
), ),
@ -527,6 +529,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (neck < 60) neck++; if (neck < 60) neck++;
neckController.text = neck.toString();
}); });
}, },
), ),
@ -539,6 +542,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (neck > 5) neck--; if (neck > 5) neck--;
neckController.text = neck.toString();
}); });
}, },
), ),
@ -558,6 +562,7 @@ class _BodyFatState extends State<BodyFat> {
onChanged: (double newValue) { onChanged: (double newValue) {
setState(() { setState(() {
neck = newValue.round(); neck = newValue.round();
neckController.text = neck.toString();
}); });
}, },
activeColor: Color(0xffC5272D), activeColor: Color(0xffC5272D),
@ -673,11 +678,6 @@ class _BodyFatState extends State<BodyFat> {
child: TextFormField( child: TextFormField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: waistController, controller: waistController,
decoration: InputDecoration(
labelText: waist.toString(),
labelStyle: TextStyle(
color: Colors.black,
)),
), ),
), ),
), ),
@ -704,6 +704,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (waist < 200) waist++; if (waist < 200) waist++;
waistController.text = waist.toString();
}); });
}, },
), ),
@ -716,6 +717,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (waist > 5) waist--; if (waist > 5) waist--;
waistController.text = waist.toString();
}); });
}, },
), ),
@ -735,6 +737,7 @@ class _BodyFatState extends State<BodyFat> {
onChanged: (double newValue) { onChanged: (double newValue) {
setState(() { setState(() {
waist = newValue.round(); waist = newValue.round();
waistController.text = waist.toString();
}); });
}, },
activeColor: Color(0xffC5272D), activeColor: Color(0xffC5272D),
@ -850,11 +853,6 @@ class _BodyFatState extends State<BodyFat> {
child: TextFormField( child: TextFormField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: hipController, controller: hipController,
decoration: InputDecoration(
labelText: hip.toString(),
labelStyle: TextStyle(
color: Colors.black,
)),
), ),
), ),
), ),
@ -881,6 +879,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (hip < 140) hip++; if (hip < 140) hip++;
hipController.text = hip.toString();
}); });
}, },
), ),
@ -893,6 +892,7 @@ class _BodyFatState extends State<BodyFat> {
onTap: () { onTap: () {
setState(() { setState(() {
if (hip > 5) hip--; if (hip > 5) hip--;
hipController.text = hip.toString();
}); });
}, },
), ),
@ -912,6 +912,7 @@ class _BodyFatState extends State<BodyFat> {
onChanged: (double newValue) { onChanged: (double newValue) {
setState(() { setState(() {
hip = newValue.round(); hip = newValue.round();
hipController.text = hip.toString();
}); });
}, },
activeColor: Color(0xffC5272D), activeColor: Color(0xffC5272D),

Loading…
Cancel
Save