Merge branch 'fix-bugs' into 'development'

fix bugs

See merge request Cloud_Solution/diplomatic-quarter!336
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 9b3a679948

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

Loading…
Cancel
Save