|
|
|
|
@ -42,6 +42,7 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void calculateBloodSugar() {
|
|
|
|
|
if (textController.text.isEmpty) return;
|
|
|
|
|
if (cardMGColor == activeCardColor) {
|
|
|
|
|
inputValue = double.parse(textController.text);
|
|
|
|
|
inputValue = inputValue / 15;
|
|
|
|
|
@ -60,10 +61,18 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
double inputValue = 0;
|
|
|
|
|
String unit;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
updateColor(1);
|
|
|
|
|
unit = 'mmol/l';
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).bloodSugarConversion,
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
|
@ -112,8 +121,11 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
updateColor(1);
|
|
|
|
|
inputValue = double.parse(textController.text);
|
|
|
|
|
inputValue = inputValue / 15;
|
|
|
|
|
if (textController.text.isNotEmpty) {
|
|
|
|
|
inputValue =
|
|
|
|
|
double.parse(textController.text);
|
|
|
|
|
inputValue = inputValue / 15;
|
|
|
|
|
}
|
|
|
|
|
unit = 'mmol/l';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
@ -126,14 +138,16 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
color: Colors.grey.withOpacity(0.5),
|
|
|
|
|
spreadRadius: 3,
|
|
|
|
|
blurRadius: 7,
|
|
|
|
|
offset: Offset(0, 3), // changes position of shadow
|
|
|
|
|
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),
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 0.0, horizontal: 18.0),
|
|
|
|
|
child: Texts('MG/DLt TO \nMMOL/L'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -142,8 +156,11 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
updateColor(2);
|
|
|
|
|
inputValue = double.parse(textController.text);
|
|
|
|
|
inputValue = inputValue * 18;
|
|
|
|
|
if (textController.text.isNotEmpty) {
|
|
|
|
|
inputValue =
|
|
|
|
|
double.parse(textController.text);
|
|
|
|
|
inputValue = inputValue / 18;
|
|
|
|
|
}
|
|
|
|
|
unit = 'mg/dlt';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
@ -158,12 +175,14 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
color: Colors.grey.withOpacity(0.5),
|
|
|
|
|
spreadRadius: 3,
|
|
|
|
|
blurRadius: 7,
|
|
|
|
|
offset: Offset(0, 3), // changes position of shadow
|
|
|
|
|
offset: Offset(
|
|
|
|
|
0, 3), // changes position of shadow
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 16.0),
|
|
|
|
|
child: Texts('\nMMOL/L TO MG/DLt '),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -191,7 +210,8 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
labelText: TranslationBase.of(context).enterReadingValue,
|
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.black45)),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: Colors.black45)),
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
color: Colors.black87,
|
|
|
|
|
),
|
|
|
|
|
@ -253,7 +273,9 @@ class _BloodSugarState extends State<BloodSugar> {
|
|
|
|
|
label: TranslationBase.of(context).calculate,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_visible == false ? _visible = !_visible : _visible = _visible;
|
|
|
|
|
_visible == false
|
|
|
|
|
? _visible = !_visible
|
|
|
|
|
: _visible = _visible;
|
|
|
|
|
calculateBloodSugar();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|