Health converters UI done

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 73822300f9
commit 2a212149ed

@ -1144,7 +1144,7 @@ const Map localizedValues = {
"ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" "ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس"
}, },
"convertCholesterolStatement": { "convertCholesterolStatement": {
"en": "Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.", "en": "Convert blood cholesterol from mmol/l to mg/dlt and vice versa.",
"ar": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" "ar": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس"
}, },
"triglyceridesConvertStatement": { "triglyceridesConvertStatement": {
@ -1607,4 +1607,5 @@ const Map localizedValues = {
"offlineTag": {"en": "Offline", "ar": "غير متصل"}, "offlineTag": {"en": "Offline", "ar": "غير متصل"},
"viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"}, "viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"},
"bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"},
"cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"},
}; };

@ -26,12 +26,8 @@ class _HealthConverterState extends State<HealthConverter> {
appBarTitle: TranslationBase.of(context).converters, appBarTitle: TranslationBase.of(context).converters,
body: Column( body: Column(
children: [ children: [
Container(
width: double.infinity,
height: 30,
),
Padding( Padding(
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12, top: 20.0),
child: GridView.builder( child: GridView.builder(
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
@ -59,9 +55,9 @@ class _HealthConverterState extends State<HealthConverter> {
), ),
child: MedicalProfileItem( child: MedicalProfileItem(
title: TranslationBase.of(context).bloodSugar, title: TranslationBase.of(context).bloodSugar,
imagePath: 'assets/images/new-design/blood_sugar_icon.png', imagePath: 'sugar-blood-level.svg',
subTitle: TranslationBase.of(context).sugar, subTitle: TranslationBase.of(context).sugar,
isPngImage: true, isPngImage: false,
), ),
)); ));
@ -72,9 +68,9 @@ class _HealthConverterState extends State<HealthConverter> {
), ),
child: MedicalProfileItem( child: MedicalProfileItem(
title: TranslationBase.of(context).bloodCholesterol, title: TranslationBase.of(context).bloodCholesterol,
imagePath: 'assets/images/new-design/blood_cholesterol_icon.png', imagePath: 'cholesterol.svg',
subTitle: TranslationBase.of(context).cholesterol, subTitle: TranslationBase.of(context).cholesterol,
isPngImage: true, isPngImage: false,
), ),
)); ));
@ -85,9 +81,9 @@ class _HealthConverterState extends State<HealthConverter> {
), ),
child: MedicalProfileItem( child: MedicalProfileItem(
title: TranslationBase.of(context).triglycerides, title: TranslationBase.of(context).triglycerides,
imagePath: 'assets/images/new-design/triglycerides_blood_icon.png', imagePath: 'fat.svg',
subTitle: TranslationBase.of(context).fatInBlood, subTitle: TranslationBase.of(context).fatInBlood,
isPngImage: true, isPngImage: false,
), ),
)); ));
return medical; return medical;

@ -1,12 +1,13 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const activeCardColor = Color(0xffD02127); const activeCardColor = CustomColors.green;
const inactiveCardColor = Color(0xffFAFAFd); const inactiveCardColor = CustomColors.white;
class BloodCholesterol extends StatefulWidget { class BloodCholesterol extends StatefulWidget {
@override @override
@ -18,7 +19,6 @@ class _BloodCholesterolState extends State<BloodCholesterol> {
Color cardMMOLColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor;
void updateColor(int type) { void updateColor(int type) {
//MG/DLT card
if (type == 1) { if (type == 1) {
if (cardMGColor == inactiveCardColor) { if (cardMGColor == inactiveCardColor) {
cardMGColor = activeCardColor; cardMGColor = activeCardColor;
@ -51,225 +51,246 @@ class _BloodCholesterolState extends State<BloodCholesterol> {
bool _visible = false; bool _visible = false;
TextEditingController textController = new TextEditingController(); TextEditingController textController = new TextEditingController();
TextEditingController resultTextController = new TextEditingController();
String finalValue; String finalValue;
double inputValue = 0.0; double inputValue = 0.0;
String unit; String unit;
double conversionConst = 38.67; double conversionConst = 38.67;
@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,
appBarTitle: TranslationBase.of(context).bloodCholesterol, appBarTitle: TranslationBase.of(context).cholesTitle,
isShowDecPage: false, isShowDecPage: false,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: Padding( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView( child: Container(
child: Container( child: Column(
height: MediaQuery.of(context).size.height * 0.7, crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
//crossAxisAlignment: CrossAxisAlignment.start, Container(child: Text(TranslationBase.of(context).cholesTitle, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))),
children: [ Container(
Container( margin: EdgeInsets.only(top: 10.0),
width: 350.0, child: Text(TranslationBase.of(context).convertCholesterolStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
child: Text( ),
TranslationBase.of(context).convertCholesterolStatement, SizedBox(
style: TextStyle(fontSize: 20.0), height: 13.0,
), ),
), Container(
SizedBox( child: Column(
height: 15.0, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
Container( Padding(
color: Colors.white, padding: const EdgeInsets.only(top: 12.0),
height: 120.0, child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
child: Padding( ),
padding: const EdgeInsets.all(8.0), SizedBox(
child: Column( height: 9.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Padding( Expanded(
padding: const EdgeInsets.symmetric(horizontal: 15.0), child: GestureDetector(
child: Row( onTap: () {
children: [ setState(() {
Texts( updateColor(1);
TranslationBase.of(context).convertFrom, inputValue = double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
});
},
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMGColor),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white,
), ),
], child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('MG/DLt to MMOL/L',
textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
),
),
), ),
), ),
SizedBox( SizedBox(
height: 9.0, width: 12.0,
), ),
Row( Expanded(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: GestureDetector(
children: [ onTap: () {
GestureDetector( setState(() {
onTap: () { updateColor(2);
setState(() { inputValue = double.parse(textController.text);
updateColor(1); inputValue = inputValue * conversionConst;
inputValue = unit = 'mg/dlt';
double.parse(textController.text); });
inputValue = inputValue / conversionConst; },
unit = 'mmol/l'; child: Container(
}); clipBehavior: Clip.antiAlias,
}, decoration: BoxDecoration(
child: Container( borderRadius: BorderRadius.all(
height: 65.0, Radius.circular(6.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'),
), ),
border: Border.all(width: 2, color: cardMMOLColor),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white,
), ),
), child: Padding(
GestureDetector( padding: const EdgeInsets.all(8.0),
onTap: () { child: Text('MMOL/L to MG/DLt',
setState(() { textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
updateColor(2);
inputValue =
double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
});
},
child: Container(
height: 65.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, SizedBox(
), height: 12.0,
Container( ),
height: 65.0, inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController),
decoration: BoxDecoration( SizedBox(
borderRadius: BorderRadius.circular(6.0), height: 12.0,
color: Colors.white, ),
Visibility(
visible: _visible,
child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
),
SizedBox(
height: 15.0,
),
],
),
),
),
bottomSheet: Container(
color: CustomColors.white,
padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0),
child: DefaultButton(
TranslationBase.of(context).calculate,
() {
setState(() {
_visible == false ? _visible = !_visible : _visible = _visible;
calculateBloodCholesterol();
});
},
color: CustomColors.green,
),
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
), ),
child: TextFormField( TextField(
controller: textController, enabled: isEnable,
inputFormatters: <TextInputFormatter>[ scrollPadding: EdgeInsets.zero,
// FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder( isDense: true,
borderSide: BorderSide(color: Colors.black45)), hintText: _hintText,
labelText: TranslationBase.of(context).enterReadingValue, fillColor: CustomColors.accentColor,
labelStyle: TextStyle( hintStyle: TextStyle(
color: Colors.black87, fontSize: isEnable ? 14 : 24,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: isEnable ? Color(0xff575757) : CustomColors.black,
letterSpacing: -0.56,
), ),
), prefixIconConstraints: BoxConstraints(minWidth: 50),
), prefixIcon: prefix == null
), ? null
SizedBox( : Text(
height: 25.0, "+" + prefix,
), style: TextStyle(
Visibility( fontSize: 14,
visible: _visible, height: 21 / 14,
child: Container( fontWeight: FontWeight.w500,
height: 115.0, color: Color(0xff2E303A),
width: 350.0, letterSpacing: -0.56,
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(TranslationBase.of(context).result + ":"),
Row(
children: [
Text(
inputValue.toStringAsFixed(3).toString(),
style: TextStyle(fontSize: 35.0),
), ),
Padding( ),
padding: EdgeInsets.only(left: 4.0, top: 10.0), contentPadding: EdgeInsets.zero,
child: Text( border: InputBorder.none,
unit.toString(), focusedBorder: InputBorder.none,
style: TextStyle( enabledBorder: InputBorder.none,
color: Color(0xffC5273A),
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
),
),
SizedBox(
height: 15.0,
),
Flexible(
child: Container(
height: 60.0,
width: 150.0,
child: SecondaryButton(
label: TranslationBase.of(context).calculate,
onTap: () {
setState(() {
_visible == false
? _visible = !_visible
: _visible = _visible;
calculateBloodCholesterol();
});
},
), ),
), ),
), ],
], ),
), ),
), if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
), ),
), ),
); );

@ -1,15 +1,15 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const activeCardColor = Color(0xffD02127); const activeCardColor = CustomColors.green;
const activeTextColor = Color(0xffFAFAFA); const activeTextColor = CustomColors.black;
const inactiveCardColor = Color(0xffFAFAFA); const inactiveCardColor = CustomColors.white;
const inactiveTextColor = Color(0xff60686B); const inactiveTextColor = CustomColors.black;
class BloodSugar extends StatefulWidget { class BloodSugar extends StatefulWidget {
@override @override
@ -25,7 +25,6 @@ class _BloodSugarState extends State<BloodSugar> {
Color textMMOLColor = inactiveTextColor; Color textMMOLColor = inactiveTextColor;
void updateColor(int type) { void updateColor(int type) {
//MG/DLT card
if (type == 1) { if (type == 1) {
if (cardMGColor == inactiveCardColor) { if (cardMGColor == inactiveCardColor) {
cardMGColor = activeCardColor; cardMGColor = activeCardColor;
@ -59,10 +58,12 @@ class _BloodSugarState extends State<BloodSugar> {
inputValue = inputValue * 18; inputValue = inputValue * 18;
unit = 'mg/dlt'; unit = 'mg/dlt';
} }
setState(() {});
} }
bool _visible = false; bool _visible = false;
TextEditingController textController = new TextEditingController(); TextEditingController textController = new TextEditingController();
TextEditingController resultTextController = new TextEditingController();
String finalValue; String finalValue;
double inputValue = 0; double inputValue = 0;
@ -90,210 +91,222 @@ class _BloodSugarState extends State<BloodSugar> {
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(child: Text(TranslationBase.of(context).bloodSugar, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 8), margin: EdgeInsets.only(top: 10.0),
child: Text( child: Text(TranslationBase.of(context).convertBloodSugarStatement,
TranslationBase.of(context).convertBloodSugarStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
style: TextStyle(fontSize: 20.0),
),
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
Container( Container(
color: Colors.white, child: Column(
child: Padding( crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8), children: [
child: Column( Padding(
children: [ padding: const EdgeInsets.only(top: 12.0),
Padding( child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
padding: const EdgeInsets.symmetric(horizontal: 16.0), ),
child: Row( SizedBox(
children: [ height: 8.0,
Texts( ),
TranslationBase.of(context).convertFrom, Row(
) mainAxisAlignment: MainAxisAlignment.spaceEvenly,
], crossAxisAlignment: CrossAxisAlignment.center,
), children: [
), Expanded(
SizedBox( child: GestureDetector(
height: 8.0, onTap: () {
), setState(() {
Row( updateColor(1);
mainAxisAlignment: MainAxisAlignment.spaceEvenly, calculateBloodSugar();
crossAxisAlignment: CrossAxisAlignment.center, });
children: [ },
SizedBox( child: Container(
width: 16.0, clipBehavior: Clip.antiAlias,
), decoration: BoxDecoration(
Expanded( borderRadius: BorderRadius.all(
child: GestureDetector( Radius.circular(6.0),
onTap: () {
setState(() {
updateColor(1);
calculateBloodSugar();
});
},
child: Container(
height: 65.0,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 1,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
color: cardMGColor,
borderRadius: BorderRadius.circular(3.0),
), ),
child: Padding( border: Border.all(width: 2, color: cardMGColor),
padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), boxShadow: [
child: Texts( BoxShadow(
'MG/DLt TO \nMMOL/L', color: Color(0xff000000).withOpacity(.05),
color: textMGColor, blurRadius: 27,
offset: Offset(0, -3),
), ),
],
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'MG/DLt to MMOL/L',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
), ),
), ),
), ),
), ),
SizedBox( ),
width: 12.0, SizedBox(
), width: 12.0,
Expanded( ),
child: GestureDetector( Expanded(
onTap: () { child: GestureDetector(
setState(() { onTap: () {
updateColor(2); setState(() {
calculateBloodSugar(); updateColor(2);
}); calculateBloodSugar();
}, });
child: Container( },
height: 65.0, child: Container(
decoration: BoxDecoration( clipBehavior: Clip.antiAlias,
color: cardMMOLColor, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3.0), borderRadius: BorderRadius.all(
boxShadow: [ Radius.circular(6.0),
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
), ),
child: Padding( border: Border.all(width: 2, color: cardMMOLColor),
padding: const EdgeInsets.symmetric(horizontal: 16.0), boxShadow: [
child: Texts( BoxShadow(
'MMOL/L TO MG/DLt ', color: Color(0xff000000).withOpacity(.05),
color: textMMOLColor, blurRadius: 27,
offset: Offset(0, -3),
), ),
],
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'MMOL/L to MG/DLt',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
), ),
), ),
), ),
), ),
SizedBox( ),
width: 16.0, ],
), ),
], ],
),
],
),
), ),
), ),
SizedBox( SizedBox(
height: 24.0, height: 12.0,
),
Container(
height: 65.0,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
),
child: TextFormField(
controller: textController,
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: TranslationBase.of(context).enterReadingValue,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)),
labelStyle: TextStyle(
color: Colors.black87,
),
),
),
), ),
inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController),
SizedBox( SizedBox(
height: 24.0, height: 12.0,
), ),
Visibility( Visibility(
visible: _visible, visible: _visible,
child: Container( child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
height: 115.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(TranslationBase.of(context).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,
),
),
),
],
),
],
),
),
),
), ),
], ],
), ),
), ),
), ),
Container( ],
margin: EdgeInsets.symmetric(horizontal: 16), ),
child: DefaultButton(TranslationBase.of(context).calculate, () { ),
setState(() { bottomSheet: Container(
_visible == false ? _visible = !_visible : _visible = _visible; color: CustomColors.white,
calculateBloodSugar(); padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0),
}); child: DefaultButton(
}), TranslationBase.of(context).calculate,
() {
setState(() {
_visible == false ? _visible = !_visible : _visible = _visible;
calculateBloodSugar();
});
},
color: CustomColors.green,
),
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
fillColor: CustomColors.accentColor,
hintStyle: TextStyle(
fontSize: isEnable ? 14 : 24,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: isEnable ? Color(0xff575757) : CustomColors.black,
letterSpacing: -0.56,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
), ),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
], ],
), ),
), ),

@ -1,13 +1,13 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const activeCardColor = Color(0xff70777A); const activeCardColor = CustomColors.green;
const inactiveCardColor = Color(0xffFAFAFd); const inactiveCardColor = CustomColors.white;
class Triglycerides extends StatefulWidget { class Triglycerides extends StatefulWidget {
@override @override
@ -18,6 +18,7 @@ class _TriglyceridesState extends State<Triglycerides> {
Color cardMGColor = inactiveCardColor; Color cardMGColor = inactiveCardColor;
Color cardMMOLColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor;
int type; int type;
void updateColor(type) { void updateColor(type) {
//MG/DLT card //MG/DLT card
if (type == 1) { if (type == 1) {
@ -52,12 +53,20 @@ class _TriglyceridesState extends State<Triglycerides> {
bool _visible = false; bool _visible = false;
TextEditingController textController = new TextEditingController(); TextEditingController textController = new TextEditingController();
TextEditingController resultTextController = new TextEditingController();
String finalValue; String finalValue;
double inputValue = 0.0; double inputValue = 0.0;
String unit; String unit;
double conversionConst = 88.57; double conversionConst = 88.57;
@override
void initState() {
updateColor(1);
unit = 'mmol/l';
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -68,210 +77,226 @@ class _TriglyceridesState extends State<Triglycerides> {
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: Padding( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView( child: Container(
child: Container( child: Column(
height: MediaQuery.of(context).size.height * 0.7, crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
//crossAxisAlignment: CrossAxisAlignment.start, Container(child: Text(TranslationBase.of(context).triglycerides, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))),
children: [ Container(
Container( margin: EdgeInsets.only(top: 10.0),
width: 350.0, child:
child: Text( Text(TranslationBase.of(context).triglyceridesConvertStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
TranslationBase.of(context).triglyceridesConvertStatement, ),
//textAlign: TextAlign.center, SizedBox(
style: TextStyle(fontSize: 20.0), height: 12.0,
), ),
), Container(
SizedBox( child: Column(
height: 15.0, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
Container( Padding(
color: Colors.white, padding: const EdgeInsets.only(top: 12.0),
height: 120.0, child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
child: Padding( ),
padding: const EdgeInsets.all(8.0), SizedBox(
child: Column( height: 9.0,
//crossAxisAlignment: CrossAxisAlignment.end, ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Padding( Expanded(
padding: const EdgeInsets.symmetric(horizontal: 15.0), child: GestureDetector(
child: Row( onTap: () {
children: [ setState(() {
Texts(TranslationBase.of(context).convertFrom) updateColor(1);
], inputValue = double.parse(textController.text);
inputValue = inputValue / conversionConst;
unit = 'mmol/l';
});
},
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMGColor),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'MG/DLt to MMOL/L',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
),
),
),
), ),
), ),
SizedBox( SizedBox(
height: 9.0, width: 12.0,
), ),
Row( Expanded(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: GestureDetector(
children: [ onTap: () {
GestureDetector( setState(() {
onTap: () { updateColor(2);
setState(() { inputValue = double.parse(textController.text);
updateColor(1); inputValue = inputValue * conversionConst;
inputValue = unit = 'mg/dlt';
double.parse(textController.text); });
inputValue = inputValue / conversionConst; },
unit = 'mmol/l'; child: Container(
}); clipBehavior: Clip.antiAlias,
}, decoration: BoxDecoration(
child: Container( borderRadius: BorderRadius.all(
height: 65.0, Radius.circular(6.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'),
), ),
border: Border.all(width: 2, color: cardMMOLColor),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white,
), ),
), child: Padding(
GestureDetector( padding: const EdgeInsets.all(8.0),
onTap: () { child: Text(
setState(() { 'MMOL/L to MG/DLt',
updateColor(2); textAlign: TextAlign.center,
inputValue = style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
double.parse(textController.text);
inputValue = inputValue * conversionConst;
unit = 'mg/dlt';
});
},
child: Container(
height: 65.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, SizedBox(
decoration: BoxDecoration( height: 12.0,
borderRadius: BorderRadius.circular(6.0), ),
color: Colors.white, inputWidget(TranslationBase.of(context).enterReadingValue, "0.0", textController),
SizedBox(
height: 12.0,
),
Visibility(
visible: _visible,
child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
),
],
),
),
),
bottomSheet: Container(
color: CustomColors.white,
padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0),
child: DefaultButton(
TranslationBase.of(context).calculate.toUpperCase(),
() {
setState(() {
_visible == false ? _visible = !_visible : _visible = _visible;
calculateTriglycerides();
});
},
color: CustomColors.green,
),
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
), ),
child: TextFormField( TextField(
controller: textController, enabled: isEnable,
inputFormatters: <TextInputFormatter>[ scrollPadding: EdgeInsets.zero,
// FilteringTextInputFormatter.digitsOnly
],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: _controller,
onChanged: (value) => {},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder( isDense: true,
borderSide: BorderSide(color: Colors.black45)), hintText: _hintText,
labelText: TranslationBase.of(context).enterReadingValue, fillColor: CustomColors.accentColor,
labelStyle: TextStyle( hintStyle: TextStyle(
color: Colors.black87, fontSize: isEnable ? 14 : 24,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: isEnable ? Color(0xff575757) : CustomColors.black,
letterSpacing: -0.56,
), ),
), prefixIconConstraints: BoxConstraints(minWidth: 50),
), prefixIcon: prefix == null
), ? null
SizedBox( : Text(
height: 25.0, "+" + prefix,
), style: TextStyle(
Visibility( fontSize: 14,
visible: _visible, height: 21 / 14,
child: Container( fontWeight: FontWeight.w500,
height: 115.0, color: Color(0xff2E303A),
width: 350.0, letterSpacing: -0.56,
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(TranslationBase.of(context).result + ":"),
Row(
children: [
Text(
inputValue.toStringAsFixed(2),
style: TextStyle(fontSize: 35.0),
), ),
Padding( ),
padding: EdgeInsets.only(left: 4.0, top: 10.0), contentPadding: EdgeInsets.zero,
child: Text( border: InputBorder.none,
unit.toString(), focusedBorder: InputBorder.none,
style: TextStyle( enabledBorder: InputBorder.none,
color: Color(0xffC5273A),
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
),
),
SizedBox(
height: 10.0,
),
Flexible(
child: Container(
height: 60.0,
width: 250.0,
child: SecondaryButton(
label:
TranslationBase.of(context).calculate.toUpperCase(),
onTap: () {
setState(() {
_visible == false
? _visible = !_visible
: _visible = _visible;
calculateTriglycerides();
});
},
), ),
), ),
), ],
], ),
), ),
), if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
), ),
), ),
); );

@ -88,11 +88,11 @@ class _HealthCalculatorsState extends State<HealthCalculators> with SingleTicker
controller: _tabController, controller: _tabController,
children: [ children: [
Container( Container(
margin: EdgeInsets.all(20.0), // margin: EdgeInsets.all(20.0),
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12, top: 20.0),
child: GridView.builder( child: GridView.builder(
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,

@ -46,17 +46,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
), ),
), ),
), ),
// Container(
// decoration: BoxDecoration(color: Colors.white),
// child: TextField(
// controller: doctorNameController,
// onChanged: (content) {
// _onDocTextChanged(content);
// },
// decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())),
// ),
inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController), inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController),
], ],
), ),
), ),

@ -2571,6 +2571,9 @@ class TranslationBase {
String get viewDocList => localizedValues["viewDocList"][locale.languageCode]; String get viewDocList => localizedValues["viewDocList"][locale.languageCode];
String get bodyFatTitle => localizedValues["bodyFatTitle"][locale.languageCode]; String get bodyFatTitle => localizedValues["bodyFatTitle"][locale.languageCode];
String get cholesTitle => localizedValues["cholesTitle"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save