diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 810c4156..05bc4b52 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1144,7 +1144,7 @@ const Map localizedValues = { "ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "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": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "triglyceridesConvertStatement": { @@ -1607,4 +1607,5 @@ const Map localizedValues = { "offlineTag": {"en": "Offline", "ar": "غير متصل"}, "viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"}, "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, + "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, }; diff --git a/lib/pages/AlHabibMedicalService/health_converter.dart b/lib/pages/AlHabibMedicalService/health_converter.dart index 27c2a05c..c4ad7760 100644 --- a/lib/pages/AlHabibMedicalService/health_converter.dart +++ b/lib/pages/AlHabibMedicalService/health_converter.dart @@ -26,12 +26,8 @@ class _HealthConverterState extends State { appBarTitle: TranslationBase.of(context).converters, body: Column( children: [ - Container( - width: double.infinity, - height: 30, - ), Padding( - padding: EdgeInsets.only(left: 12, right: 12), + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), child: GridView.builder( shrinkWrap: true, primary: false, @@ -59,9 +55,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).bloodSugar, - imagePath: 'assets/images/new-design/blood_sugar_icon.png', + imagePath: 'sugar-blood-level.svg', subTitle: TranslationBase.of(context).sugar, - isPngImage: true, + isPngImage: false, ), )); @@ -72,9 +68,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).bloodCholesterol, - imagePath: 'assets/images/new-design/blood_cholesterol_icon.png', + imagePath: 'cholesterol.svg', subTitle: TranslationBase.of(context).cholesterol, - isPngImage: true, + isPngImage: false, ), )); @@ -85,9 +81,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).triglycerides, - imagePath: 'assets/images/new-design/triglycerides_blood_icon.png', + imagePath: 'fat.svg', subTitle: TranslationBase.of(context).fatInBlood, - isPngImage: true, + isPngImage: false, ), )); return medical; diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index 5e584602..af93afa4 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -1,12 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xffD02127); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class BloodCholesterol extends StatefulWidget { @override @@ -18,7 +19,6 @@ class _BloodCholesterolState extends State { Color cardMMOLColor = inactiveCardColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -51,225 +51,246 @@ class _BloodCholesterolState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 38.67; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodCholesterol, + appBarTitle: TranslationBase.of(context).cholesTitle, isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, 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( - TranslationBase.of(context).convertCholesterolStatement, - 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( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).cholesTitle, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertCholesterolStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 13.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + 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( - height: 9.0, + width: 12.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: 65.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'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - 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'), - ), + 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( - height: 25.0, - ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + 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), + ), + 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( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + 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( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + 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, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - 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(3).toString(), - style: TextStyle(fontSize: 35.0), + 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, ), - 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: 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), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index ebc41150..4604c3df 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xffD02127); -const activeTextColor = Color(0xffFAFAFA); -const inactiveCardColor = Color(0xffFAFAFA); -const inactiveTextColor = Color(0xff60686B); +const activeCardColor = CustomColors.green; +const activeTextColor = CustomColors.black; +const inactiveCardColor = CustomColors.white; +const inactiveTextColor = CustomColors.black; class BloodSugar extends StatefulWidget { @override @@ -25,7 +25,6 @@ class _BloodSugarState extends State { Color textMMOLColor = inactiveTextColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -59,10 +58,12 @@ class _BloodSugarState extends State { inputValue = inputValue * 18; unit = 'mg/dlt'; } + setState(() {}); } bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0; @@ -90,210 +91,222 @@ class _BloodSugarState extends State { Expanded( child: SingleChildScrollView( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).bloodSugar, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.symmetric(horizontal: 8), - child: Text( - TranslationBase.of(context).convertBloodSugarStatement, - style: TextStyle(fontSize: 20.0), - ), + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertBloodSugarStatement, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), ), SizedBox( height: 12.0, ), Container( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, - ) - ], - ), - ), - SizedBox( - height: 8.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 16.0, - ), - Expanded( - child: GestureDetector( - 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: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 8.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Texts( - 'MG/DLt TO \nMMOL/L', - color: textMGColor, + 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( - width: 12.0, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColor(2); - calculateBloodSugar(); - }); - }, - child: Container( - height: 65.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 - ), - ], + ), + SizedBox( + width: 12.0, + ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Texts( - 'MMOL/L TO MG/DLt ', - color: textMMOLColor, + 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( + 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( - height: 24.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: [ -// 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, - ), - ), - ), + height: 12.0, ), + inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController), SizedBox( - height: 24.0, + height: 12.0, ), Visibility( visible: _visible, - child: Container( - 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, - ), - ), - ), - ], - ), - ], - ), - ), - ), + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), ), ], ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16), - child: DefaultButton(TranslationBase.of(context).calculate, () { - setState(() { - _visible == false ? _visible = !_visible : _visible = _visible; - calculateBloodSugar(); - }); - }), + ], + ), + ), + 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, + ), + ), + ); + } + + 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), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index b9571d2b..e441d935 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -1,13 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xff70777A); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class Triglycerides extends StatefulWidget { @override @@ -18,6 +18,7 @@ class _TriglyceridesState extends State { Color cardMGColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor; int type; + void updateColor(type) { //MG/DLT card if (type == 1) { @@ -52,12 +53,20 @@ class _TriglyceridesState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 88.57; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -68,210 +77,226 @@ class _TriglyceridesState extends State { showNewAppBarTitle: true, 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( - TranslationBase.of(context).triglyceridesConvertStatement, - //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, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).triglycerides, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: + Text(TranslationBase.of(context).triglyceridesConvertStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 12.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts(TranslationBase.of(context).convertFrom) - ], + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + 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( - height: 9.0, + width: 12.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: 65.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'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - 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'), + 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( - height: 25.0, + ], ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + 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( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + 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( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + 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, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - 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), + 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, ), - 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: 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), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index de4e3a48..341a298d 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -88,11 +88,11 @@ class _HealthCalculatorsState extends State with SingleTicker controller: _tabController, children: [ Container( - margin: EdgeInsets.all(20.0), + // margin: EdgeInsets.all(20.0), child: Column( children: [ Padding( - padding: EdgeInsets.only(left: 12, right: 12), + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), child: GridView.builder( shrinkWrap: true, primary: false, diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 829ac0e2..6bfac9a7 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -46,17 +46,7 @@ class _SearchByDoctorState extends State { ), ), ), - // 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), - ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 50a90f39..eb1c1961 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2571,6 +2571,9 @@ class TranslationBase { String get viewDocList => localizedValues["viewDocList"][locale.languageCode]; String get bodyFatTitle => localizedValues["bodyFatTitle"][locale.languageCode]; + + String get cholesTitle => localizedValues["cholesTitle"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate {