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,124 +51,125 @@ 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(
height: MediaQuery.of(context).size.height * 0.7,
child: Column( child: Column(
//crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(child: Text(TranslationBase.of(context).cholesTitle, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))),
Container( Container(
width: 350.0, margin: EdgeInsets.only(top: 10.0),
child: Text( child: Text(TranslationBase.of(context).convertCholesterolStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
TranslationBase.of(context).convertCholesterolStatement,
style: TextStyle(fontSize: 20.0),
),
), ),
SizedBox( SizedBox(
height: 15.0, height: 13.0,
), ),
Container( Container(
color: Colors.white,
height: 120.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0), padding: const EdgeInsets.only(top: 12.0),
child: Row( child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
children: [
Texts(
TranslationBase.of(context).convertFrom,
),
],
),
), ),
SizedBox( SizedBox(
height: 9.0, height: 9.0,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
GestureDetector( Expanded(
child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
updateColor(1); updateColor(1);
inputValue = inputValue = double.parse(textController.text);
double.parse(textController.text);
inputValue = inputValue / conversionConst; inputValue = inputValue / conversionConst;
unit = 'mmol/l'; unit = 'mmol/l';
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
width: 150.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMGColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 3, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(
0, 3), // changes position of shadow
), ),
], ],
color: cardMGColor, color: Colors.white,
borderRadius: BorderRadius.circular(3.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.all(8.0),
vertical: 0.0, horizontal: 18.0), child: Text('MG/DLt to MMOL/L',
child: Texts('MG/DLt TO \nMMOL/L'), textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
), ),
), ),
), ),
GestureDetector( ),
SizedBox(
width: 12.0,
),
Expanded(
child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
updateColor(2); updateColor(2);
inputValue = inputValue = double.parse(textController.text);
double.parse(textController.text);
inputValue = inputValue * conversionConst; inputValue = inputValue * conversionConst;
unit = 'mg/dlt'; unit = 'mg/dlt';
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
width: 150.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: cardMMOLColor, borderRadius: BorderRadius.all(
borderRadius: BorderRadius.circular(3.0), Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMMOLColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 3, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(
0, 3), // changes position of shadow
), ),
], ],
color: Colors.white,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.all(8.0),
horizontal: 16.0), child: Text('MMOL/L to MG/DLt',
child: Texts('MG/DLt TO\n MMOL/L'), textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
),
), ),
), ),
), ),
@ -177,99 +178,119 @@ class _BloodCholesterolState extends State<BloodCholesterol> {
], ],
), ),
), ),
SizedBox(
height: 12.0,
), ),
inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController),
SizedBox( SizedBox(
height: 25.0, height: 12.0,
), ),
Container( Visibility(
height: 65.0, visible: _visible,
decoration: BoxDecoration( child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
borderRadius: BorderRadius.circular(6.0), ),
color: Colors.white, SizedBox(
height: 15.0,
), ),
child: TextFormField(
controller: textController,
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.digitsOnly
], ],
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black45)),
labelText: TranslationBase.of(context).enterReadingValue,
labelStyle: TextStyle(
color: Colors.black87,
), ),
), ),
), ),
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,
), ),
SizedBox(
height: 25.0,
), ),
Visibility( );
visible: _visible, }
child: Container(
height: 115.0, Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
width: 350.0, return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black), color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
borderRadius: BorderRadius.circular(15.0), border: Border.all(
color: Color(0xffefefef),
width: 1,
), ),
child: Padding( ),
padding: const EdgeInsets.all(8.0), child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts(TranslationBase.of(context).result + ":"),
Row(
children: [ children: [
Text( Text(
inputValue.toStringAsFixed(3).toString(), _labelText,
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle( style: TextStyle(
color: Color(0xffC5273A), fontSize: 11,
fontSize: 15.0, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w500, 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,
), ),
SizedBox( decoration: InputDecoration(
height: 15.0, 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,
), ),
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();
});
},
), ),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
), ),
), ),
], ],
), ),
), ),
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,32 +91,24 @@ 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: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: const EdgeInsets.only(top: 12.0),
child: Row( child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
children: [
Texts(
TranslationBase.of(context).convertFrom,
)
],
),
), ),
SizedBox( SizedBox(
height: 8.0, height: 8.0,
@ -124,9 +117,6 @@ class _BloodSugarState extends State<BloodSugar> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox(
width: 16.0,
),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
@ -136,24 +126,27 @@ class _BloodSugarState extends State<BloodSugar> {
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMGColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 1, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(0, 3), // changes position of shadow
), ),
], ],
color: cardMGColor, color: Colors.white,
borderRadius: BorderRadius.circular(3.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Text(
'MG/DLt TO \nMMOL/L', 'MG/DLt to MMOL/L',
color: textMGColor, textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
), ),
), ),
), ),
@ -171,129 +164,149 @@ class _BloodSugarState extends State<BloodSugar> {
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
decoration: BoxDecoration( decoration: BoxDecoration(
color: cardMMOLColor, borderRadius: BorderRadius.all(
borderRadius: BorderRadius.circular(3.0), Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMMOLColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 3, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(0, 3), // changes position of shadow
), ),
], ],
color: Colors.white,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Text(
'MMOL/L TO MG/DLt ', 'MMOL/L to MG/DLt',
color: textMMOLColor, textAlign: TextAlign.center,
), style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
), ),
), ),
), ),
), ),
SizedBox(
width: 16.0,
), ),
], ],
), ),
], ],
), ),
), ),
SizedBox(
height: 12.0,
), ),
inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController),
SizedBox( SizedBox(
height: 24.0, height: 12.0,
), ),
Container( Visibility(
height: 65.0, visible: _visible,
padding: EdgeInsets.symmetric(horizontal: 8), child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
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,
), ),
],
), ),
), ),
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;
calculateBloodSugar();
});
},
color: CustomColors.green,
), ),
SizedBox(
height: 24.0,
), ),
Visibility( );
visible: _visible, }
child: Container(
height: 115.0, Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
width: 350.0, return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black), color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
borderRadius: BorderRadius.circular(15.0), border: Border.all(
color: Color(0xffefefef),
width: 1,
), ),
child: Padding( ),
padding: const EdgeInsets.all(8.0), child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts(TranslationBase.of(context).result + ": "),
Row(
children: [ children: [
Text( Text(
inputValue.toStringAsFixed(2), _labelText,
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle( style: TextStyle(
color: Color(0xffC5273A), fontSize: 11,
fontSize: 15.0, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w500, 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),
Container(
margin: EdgeInsets.symmetric(horizontal: 16),
child: DefaultButton(TranslationBase.of(context).calculate, () {
setState(() {
_visible == false ? _visible = !_visible : _visible = _visible;
calculateBloodSugar();
});
}),
),
], ],
), ),
), ),

@ -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,108 +77,108 @@ 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(
height: MediaQuery.of(context).size.height * 0.7,
child: Column( child: Column(
//crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(child: Text(TranslationBase.of(context).triglycerides, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))),
Container( Container(
width: 350.0, margin: EdgeInsets.only(top: 10.0),
child: Text( child:
TranslationBase.of(context).triglyceridesConvertStatement, Text(TranslationBase.of(context).triglyceridesConvertStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
//textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
), ),
SizedBox( SizedBox(
height: 15.0, height: 12.0,
), ),
Container( Container(
color: Colors.white,
height: 120.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
//crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0), padding: const EdgeInsets.only(top: 12.0),
child: Row( child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)),
children: [
Texts(TranslationBase.of(context).convertFrom)
],
),
), ),
SizedBox( SizedBox(
height: 9.0, height: 9.0,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
GestureDetector( Expanded(
child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
updateColor(1); updateColor(1);
inputValue = inputValue = double.parse(textController.text);
double.parse(textController.text);
inputValue = inputValue / conversionConst; inputValue = inputValue / conversionConst;
unit = 'mmol/l'; unit = 'mmol/l';
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
width: 150.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMGColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 3, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(
0, 3), // changes position of shadow
), ),
], ],
color: cardMGColor, color: Colors.white,
borderRadius: BorderRadius.circular(3.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.all(8.0),
vertical: 0.0, horizontal: 18.0), child: Text(
child: Texts('MG/DLt TO \nMMOL/L'), 'MG/DLt to MMOL/L',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
), ),
), ),
), ),
GestureDetector( ),
),
SizedBox(
width: 12.0,
),
Expanded(
child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
updateColor(2); updateColor(2);
inputValue = inputValue = double.parse(textController.text);
double.parse(textController.text);
inputValue = inputValue * conversionConst; inputValue = inputValue * conversionConst;
unit = 'mg/dlt'; unit = 'mg/dlt';
}); });
}, },
child: Container( child: Container(
height: 65.0, clipBehavior: Clip.antiAlias,
width: 150.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: cardMMOLColor, borderRadius: BorderRadius.all(
borderRadius: BorderRadius.circular(3.0), Radius.circular(6.0),
),
border: Border.all(width: 2, color: cardMMOLColor),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.5), color: Color(0xff000000).withOpacity(.05),
spreadRadius: 3, blurRadius: 27,
blurRadius: 7, offset: Offset(0, -3),
offset: Offset(
0, 3), // changes position of shadow
), ),
], ],
color: Colors.white,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.all(8.0),
horizontal: 16.0), child: Text(
child: Texts('MG/DLt TO\n MMOL/L'), 'MMOL/L to MG/DLt',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey),
),
),
), ),
), ),
), ),
@ -178,100 +187,116 @@ class _TriglyceridesState extends State<Triglycerides> {
], ],
), ),
), ),
SizedBox(
height: 12.0,
), ),
inputWidget(TranslationBase.of(context).enterReadingValue, "0.0", textController),
SizedBox( SizedBox(
height: 25.0, height: 12.0,
), ),
Container( Visibility(
height: 65.0, visible: _visible,
decoration: BoxDecoration( child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false),
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: TranslationBase.of(context).enterReadingValue,
labelStyle: TextStyle(
color: Colors.black87,
), ),
), ),
), ),
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,
), ),
SizedBox(
height: 25.0,
), ),
Visibility( );
visible: _visible, }
child: Container(
height: 115.0, Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
width: 350.0, return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black), color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4),
borderRadius: BorderRadius.circular(15.0), border: Border.all(
color: Color(0xffefefef),
width: 1,
), ),
child: Padding( ),
padding: const EdgeInsets.all(8.0), child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Texts(TranslationBase.of(context).result + ":"),
Row(
children: [ children: [
Text( Text(
inputValue.toStringAsFixed(2), _labelText,
style: TextStyle(fontSize: 35.0),
),
Padding(
padding: EdgeInsets.only(left: 4.0, top: 10.0),
child: Text(
unit.toString(),
style: TextStyle( style: TextStyle(
color: Color(0xffC5273A), fontSize: 11,
fontSize: 15.0, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w500, 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,
), ),
SizedBox( decoration: InputDecoration(
height: 10.0, 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,
), ),
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();
});
},
), ),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
), ),
), ),
], ],
), ),
), ),
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