Health Converter

merge-update-with-lab-changes
hussam al-habibeh 6 years ago
parent 82226e62e1
commit 3e184f43db

@ -226,8 +226,8 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
//page: HealthConverter(), page: HealthConverter(),
), ),
), ),
imageLocation: imageLocation:
'assets/images/new-design/health_convertor_icon.png', 'assets/images/new-design/health_convertor_icon.png',

@ -1,94 +1,96 @@
// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
// import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
// import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
//
// import 'health_converter/blood_sugar.dart'; import 'health_converter/blood_cholesterol.dart';
// import 'health_converter/blood_sugar.dart';
// class HealthConverter extends StatefulWidget { import 'health_converter/triglycerides.dart';
// @override
// _HealthConverterState createState() => _HealthConverterState(); class HealthConverter extends StatefulWidget {
// } @override
// _HealthConverterState createState() => _HealthConverterState();
// class _HealthConverterState extends State<HealthConverter> { }
// @override
// Widget build(BuildContext context) { class _HealthConverterState extends State<HealthConverter> {
// return AppScaffold( @override
// isShowAppBar: true, Widget build(BuildContext context) {
// appBarTitle: 'Health Converter', return AppScaffold(
// body: Column( isShowAppBar: true,
// children: [ appBarTitle: 'Health Converter',
// Container( body: Column(
// width: double.infinity, children: [
// height: 30, Container(
// ), width: double.infinity,
// Row( height: 30,
// children: [ ),
// Expanded( Row(
// flex: 1, children: [
// child: InkWell( Expanded(
// onTap: () { flex: 1,
// Navigator.push( child: InkWell(
// context, onTap: () {
// FadePage(page: BloodSugar()), Navigator.push(
// ); context,
// }, FadePage(page: BloodSugar()),
// child: MedicalProfileItem( );
// title: 'Blood', },
// imagePath: 'blood_sugar_icon.png', child: MedicalProfileItem(
// subTitle: 'Sugar', title: 'Blood',
// ), imagePath: 'blood_sugar_icon.png',
// ), subTitle: 'Sugar',
// ), ),
// Expanded( ),
// flex: 1, ),
// child: InkWell( Expanded(
// onTap: () { flex: 1,
// Navigator.push( child: InkWell(
// context, onTap: () {
// FadePage( Navigator.push(
// // page: [](), context,
// ), FadePage(
// ); page: BloodCholesterol(),
// }, ),
// child: MedicalProfileItem( );
// title: 'Blood', },
// imagePath: 'blood_cholesterol_icon.png', child: MedicalProfileItem(
// subTitle: 'Cholesterol', title: 'Blood',
// ), imagePath: 'blood_cholesterol_icon.png',
// ), subTitle: 'Cholesterol',
// ), ),
// ], ),
// ), ),
// Row( ],
// children: [ ),
// Expanded( Row(
// flex: 1, children: [
// child: InkWell( Expanded(
// onTap: () { flex: 1,
// Navigator.push( child: InkWell(
// context, onTap: () {
// FadePage( Navigator.push(
// // page: [](), context,
// ), FadePage(
// ); page: Triglycerides(),
// }, ),
// child: MedicalProfileItem( );
// title: 'Triglycerides', },
// imagePath: 'triglycerides_blood_icon.png', child: MedicalProfileItem(
// subTitle: 'Fat in blood', title: 'Triglycerides',
// ), imagePath: 'triglycerides_blood_icon.png',
// ), subTitle: 'Fat in blood',
// ), ),
// Expanded( ),
// flex: 1, ),
// child: Container(), Expanded(
// ), flex: 1,
// ], child: Container(),
// ) ),
// ], ],
// ), )
// ); ],
// } ),
// } );
}
}

@ -0,0 +1,277 @@
import 'package:flutter/material.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:flutter/services.dart';
const activeCardColor = Color(0xff70777A);
const inactiveCardColor = Color(0xffFAFAFd);
class BloodCholesterol extends StatefulWidget {
@override
_BloodCholesterolState createState() => _BloodCholesterolState();
}
class _BloodCholesterolState extends State<BloodCholesterol> {
Color cardMGColor = inactiveCardColor;
Color cardMMOLColor = inactiveCardColor;
void updateColor(int type) {
//MG/DLT card
if (type == 1) {
if (cardMGColor == inactiveCardColor) {
cardMGColor = activeCardColor;
cardMMOLColor = inactiveCardColor;
} else {
cardMGColor = inactiveCardColor;
}
}
if (type == 2) {
if (cardMMOLColor == inactiveCardColor) {
cardMMOLColor = activeCardColor;
cardMGColor = inactiveCardColor;
} else {
cardMMOLColor = inactiveCardColor;
}
}
}
void calculateBloodCholesterol() {
if (cardMGColor == activeCardColor) {
inputValue = double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
} else if (cardMMOLColor == activeCardColor) {
inputValue = double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
}
}
bool _visible = false;
TextEditingController textController = new TextEditingController();
String finalValue;
double inputValue = 0.0;
String unit;
double conversionConst = 38.67;
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Blood Cholesterol ',
body: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
//crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 350.0,
child: Text(
'Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.',
//textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
),
SizedBox(
height: 15.0,
),
Container(
color: Colors.white,
height: 120.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
//crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
children: [
Texts(
'Convert from',
)
],
),
),
SizedBox(
height: 9.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColor(1);
inputValue =
double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
});
},
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: cardMGColor,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Texts('MG/DLt TO \nMMOL/L'),
),
),
),
GestureDetector(
onTap: () {
setState(() {
updateColor(2);
inputValue =
double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: cardMMOLColor,
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: Texts('MG/DLt TO\n MMOL/L'),
),
),
),
],
),
],
),
),
),
SizedBox(
height: 25.0,
),
Container(
height: 65.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
),
child: TextFormField(
controller: textController,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black45)),
labelText: " Enter the reading value",
labelStyle: TextStyle(
color: Colors.black87,
),
),
),
),
SizedBox(
height: 25.0,
),
Visibility(
visible: _visible,
child: Container(
height: 95.0,
width: 350.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts('Result:'),
Row(
children: [
Text(
inputValue.toStringAsFixed(3).toString(),
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle(
color: Color(0xffC5273A),
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
),
),
SizedBox(
height: 15.0,
),
Flexible(
child: Container(
height: 100.0,
width: 150.0,
child: Button(
label: 'CALCULATE',
onTap: () {
setState(() {
_visible == false
? _visible = !_visible
: _visible = _visible;
calculateBloodCholesterol();
});
},
),
),
),
],
),
),
),
),
);
}
}

@ -1,208 +1,279 @@
// import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
// import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
// import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
// import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
// import 'package:flutter/services.dart'; import 'package:flutter/cupertino.dart';
// import 'package:flutter/material.dart';
// const activeCardColor = Color(0xff70777A); import 'package:flutter/services.dart';
// const inactiveCardColor = Color(0xffFAFAFd);
// const activeCardColor = Color(0xff70777A);
// class BloodSugar extends StatefulWidget { const inactiveCardColor = Color(0xffFAFAFd);
// @override
// _BloodSugarState createState() => _BloodSugarState(); class BloodSugar extends StatefulWidget {
// } @override
// _BloodSugarState createState() => _BloodSugarState();
// Color color; }
//
// class _BloodSugarState extends State<BloodSugar> { Color color;
// Color cardMGColor = inactiveCardColor;
// Color cardMMOLColor = inactiveCardColor; class _BloodSugarState extends State<BloodSugar> {
// Color cardMGColor = inactiveCardColor;
// void updateColor(int type) { Color cardMMOLColor = inactiveCardColor;
// //MG/DLT card
// if (type == 1) { void updateColor(int type) {
// if (cardMGColor == inactiveCardColor) { //MG/DLT card
// cardMGColor = activeCardColor; if (type == 1) {
// cardMMOLColor = inactiveCardColor; if (cardMGColor == inactiveCardColor) {
// } else { cardMGColor = activeCardColor;
// cardMGColor = inactiveCardColor; cardMMOLColor = inactiveCardColor;
// } } else {
// } cardMGColor = inactiveCardColor;
// if (type == 2) { }
// if (cardMMOLColor == inactiveCardColor) { }
// cardMMOLColor = activeCardColor; if (type == 2) {
// cardMGColor = inactiveCardColor; if (cardMMOLColor == inactiveCardColor) {
// } else { cardMMOLColor = activeCardColor;
// cardMMOLColor = inactiveCardColor; cardMGColor = inactiveCardColor;
// } } else {
// } cardMMOLColor = inactiveCardColor;
// } }
// }
// bool _visible = false; }
//
// TextEditingController textController = new TextEditingController(); void calculateBloodSugar() {
// String finalValue; if (cardMGColor == activeCardColor) {
// inputValue = double.parse(textController.text);
// @override inputValue = inputValue / 15;
// Widget build(BuildContext context) { unit = 'mmol/l';
// return AppScaffold( } else if (cardMMOLColor == activeCardColor) {
// isShowAppBar: true, inputValue = double.parse(textController.text);
// appBarTitle: 'Blood Sugar Conversion', inputValue = inputValue * 18;
// body: Padding( unit = 'mg/dlt';
// padding: const EdgeInsets.all(16.0), }
// child: Column( }
// //crossAxisAlignment: CrossAxisAlignment.start,
// children: [ bool _visible = false;
// Container( TextEditingController textController = new TextEditingController();
// width: 350.0, String finalValue;
// child: Text(
// 'Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.', double inputValue = 0;
// //textAlign: TextAlign.center, String unit;
// style: TextStyle(fontSize: 20.0),
// ), @override
// ), Widget build(BuildContext context) {
// SizedBox( return AppScaffold(
// height: 15.0, isShowAppBar: true,
// ), appBarTitle: 'Blood Sugar Conversion',
// Container( body: Padding(
// color: Colors.white, padding: const EdgeInsets.all(16.0),
// height: 120.0, child: SingleChildScrollView(
// child: Padding( child: Container(
// padding: const EdgeInsets.all(8.0), height: MediaQuery.of(context).size.height * 0.7,
// child: Column( child: Column(
// //crossAxisAlignment: CrossAxisAlignment.end, //crossAxisAlignment: CrossAxisAlignment.start,
// children: [ children: [
// Padding( Container(
// padding: const EdgeInsets.symmetric(horizontal: 15.0), width: 350.0,
// child: Row( child: Text(
// children: [ 'Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.',
// Texts( //textAlign: TextAlign.center,
// 'Convert from', style: TextStyle(fontSize: 20.0),
// ) ),
// ], ),
// ), SizedBox(
// ), height: 15.0,
// SizedBox( ),
// height: 9.0, Container(
// ), color: Colors.white,
// Row( height: 120.0,
// mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: Padding(
// children: [ padding: const EdgeInsets.all(8.0),
// GestureDetector( child: Column(
// onTap: () { //crossAxisAlignment: CrossAxisAlignment.end,
// setState(() { children: [
// updateColor(1); Padding(
// finalValue = textController.text * 3; padding: const EdgeInsets.symmetric(horizontal: 15.0),
// }); child: Row(
// }, children: [
// child: Container( Texts(
// height: 55.0, 'Convert from',
// width: 150.0, )
// decoration: BoxDecoration( ],
// color: cardMGColor, ),
// borderRadius: BorderRadius.circular(10.0), ),
// ), SizedBox(
// child: Padding( height: 9.0,
// padding: const EdgeInsets.symmetric( ),
// vertical: 0.0, horizontal: 18.0), Row(
// child: Texts('MG/DLt TO \nMMOL/L'), mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// ), children: [
// ), GestureDetector(
// ), onTap: () {
// GestureDetector( setState(() {
// onTap: () { updateColor(1);
// setState(() { inputValue =
// updateColor(2); double.parse(textController.text);
// finalValue = textController.text * 6; inputValue = inputValue / 15;
// }); unit = 'mmol/l';
// }, });
// child: Container( },
// height: 55.0, child: Container(
// width: 150.0, height: 55.0,
// decoration: BoxDecoration( width: 150.0,
// color: cardMMOLColor, decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.0), boxShadow: [
// ), BoxShadow(
// child: Padding( color: Colors.grey.withOpacity(0.5),
// padding: spreadRadius: 3,
// const EdgeInsets.symmetric(horizontal: 16.0), blurRadius: 7,
// child: Texts('MG/DLt TO\n MMOL/L'), offset: Offset(
// ), 0, 3), // changes position of shadow
// ), ),
// ), ],
// ], color: cardMGColor,
// ), borderRadius: BorderRadius.circular(3.0),
// ], ),
// ), child: Padding(
// ), padding: const EdgeInsets.symmetric(
// ), vertical: 0.0, horizontal: 18.0),
// SizedBox( child: Texts('MG/DLt TO \nMMOL/L'),
// height: 25.0, ),
// ), ),
// Container( ),
// height: 55.0, GestureDetector(
// color: Colors.white, onTap: () {
// child: TextFormField( setState(() {
// controller: textController, updateColor(2);
// inputFormatters: <TextInputFormatter>[ inputValue =
// FilteringTextInputFormatter.digitsOnly double.parse(textController.text);
// ], inputValue = inputValue * 18;
// keyboardType: TextInputType.number, unit = 'mg/dlt';
// decoration: InputDecoration( });
// labelText: " Enter the reading value", },
// ), child: Container(
// ), height: 55.0,
// ), width: 150.0,
// SizedBox( decoration: BoxDecoration(
// height: 5.0, color: cardMMOLColor,
// ), borderRadius: BorderRadius.circular(3.0),
// Visibility( boxShadow: [
// visible: _visible, BoxShadow(
// child: Container( color: Colors.grey.withOpacity(0.5),
// height: 95.0, spreadRadius: 3,
// width: 350.0, blurRadius: 7,
// decoration: BoxDecoration( offset: Offset(
// color: Colors.white, 0, 3), // changes position of shadow
// border: Border.all(color: Colors.black), ),
// borderRadius: BorderRadius.circular(15.0), ],
// ), ),
// child: Padding( child: Padding(
// padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.symmetric(
// child: Column( horizontal: 16.0),
// crossAxisAlignment: CrossAxisAlignment.start, child: Texts('MG/DLt TO\n MMOL/L'),
// mainAxisAlignment: MainAxisAlignment.center, ),
// children: [ ),
// Texts('Result:'), ),
// Text( ],
// finalValue.toString(), ),
// style: TextStyle(fontSize: 35.0), ],
// ), ),
// ], ),
// ), ),
// ), SizedBox(
// ), height: 25.0,
// ), ),
// SizedBox( Container(
// height: 15.0, height: 65.0,
// ), decoration: BoxDecoration(
// Flexible( borderRadius: BorderRadius.circular(6.0),
// child: Container( color: Colors.white,
// height: 100.0, ),
// width: 150.0, child: TextFormField(
// child: Button( controller: textController,
// label: 'CALCULATE', inputFormatters: <TextInputFormatter>[
// onTap: () { FilteringTextInputFormatter.digitsOnly
// setState(() { ],
// _visible = !_visible; keyboardType: TextInputType.number,
// }); decoration: InputDecoration(
// }, labelText: " Enter the reading value",
// ), border: OutlineInputBorder(
// ), borderSide: BorderSide(color: Colors.black45)),
// ), labelStyle: TextStyle(
// ], color: Colors.black87,
// ), ),
// ), ),
// ); ),
// } ),
// } SizedBox(
height: 25.0,
),
Visibility(
visible: _visible,
child: Container(
height: 95.0,
width: 350.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts('Result:'),
Row(
children: [
Text(
inputValue.toStringAsFixed(3),
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle(
color: Color(0xffC5273A),
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
),
),
SizedBox(
height: 30.0,
),
Flexible(
child: Container(
height: 100.0,
width: 150.0,
child: Button(
label: 'CALCULATE',
onTap: () {
setState(() {
_visible == false
? _visible = !_visible
: _visible = _visible;
calculateBloodSugar();
});
},
),
),
),
],
),
),
),
),
);
}
}

@ -0,0 +1,275 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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:flutter/services.dart';
const activeCardColor = Color(0xff70777A);
const inactiveCardColor = Color(0xffFAFAFd);
class Triglycerides extends StatefulWidget {
@override
_TriglyceridesState createState() => _TriglyceridesState();
}
class _TriglyceridesState extends State<Triglycerides> {
Color cardMGColor = inactiveCardColor;
Color cardMMOLColor = inactiveCardColor;
int type;
void updateColor(type) {
//MG/DLT card
if (type == 1) {
if (cardMGColor == inactiveCardColor) {
cardMGColor = activeCardColor;
cardMMOLColor = inactiveCardColor;
} else {
cardMGColor = inactiveCardColor;
}
}
if (type == 2) {
if (cardMMOLColor == inactiveCardColor) {
cardMMOLColor = activeCardColor;
cardMGColor = inactiveCardColor;
} else {
cardMMOLColor = inactiveCardColor;
}
}
}
void calculateTriglycerides() {
if (cardMGColor == activeCardColor) {
inputValue = double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
} else if (cardMMOLColor == activeCardColor) {
inputValue = double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
}
}
bool _visible = false;
TextEditingController textController = new TextEditingController();
String finalValue;
double inputValue = 0.0;
String unit;
double conversionConst = 88.57;
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: 'Triglycerides',
body: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
//crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 350.0,
child: Text(
'Convert Triglycerides from mmol/l to\n mg/dlt and vice versa.',
//textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
),
SizedBox(
height: 15.0,
),
Container(
color: Colors.white,
height: 120.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
//crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
children: [Texts('Convert from')],
),
),
SizedBox(
height: 9.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
setState(() {
updateColor(1);
inputValue =
double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
});
},
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: cardMGColor,
borderRadius: BorderRadius.circular(3.0),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 0.0, horizontal: 18.0),
child: Texts('MG/DLt TO \nMMOL/L'),
),
),
),
GestureDetector(
onTap: () {
setState(() {
updateColor(2);
inputValue =
double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
});
},
child: Container(
height: 55.0,
width: 150.0,
decoration: BoxDecoration(
color: cardMMOLColor,
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: Texts('MG/DLt TO\n MMOL/L'),
),
),
),
],
),
],
),
),
),
SizedBox(
height: 25.0,
),
Container(
height: 65.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
),
child: TextFormField(
controller: textController,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black45)),
labelText: " Enter the reading value",
labelStyle: TextStyle(
color: Colors.black87,
),
),
),
),
SizedBox(
height: 25.0,
),
Visibility(
visible: _visible,
child: Container(
height: 95.0,
width: 350.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts('Result:'),
Row(
children: [
Text(
inputValue.toStringAsFixed(2),
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle(
color: Color(0xffC5273A),
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
),
),
SizedBox(
height: 10.0,
),
Flexible(
child: Container(
height: 100.0,
width: 250.0,
child: Button(
label: 'CALCULATE',
onTap: () {
setState(() {
_visible == false
? _visible = !_visible
: _visible = _visible;
calculateTriglycerides();
});
},
),
),
),
],
),
),
),
),
);
}
}
Loading…
Cancel
Save