import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; AssessmentPage({Key key, this.changePageViewIndex}); @override _AssessmentPageState createState() => _AssessmentPageState(); } class _AssessmentPageState extends State { bool isAssessmentExpand = false; List assessmentList; dynamic _referTo; TextEditingController remarksController = TextEditingController(); @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( child: FractionallySizedBox( widthFactor: 0.9, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 30, ), HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Texts('ASSESSMENT', variant: isAssessmentExpand ? "bodyText" : '', bold: isAssessmentExpand ? true : false, color: Colors.black), Icon( FontAwesomeIcons.asterisk, color: AppGlobal.appPrimaryColor, size: 12, ) ], ), InkWell( onTap: () { setState(() { isAssessmentExpand = !isAssessmentExpand; }); }, child: Icon(isAssessmentExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), bodyWidget: Column(children: [ SizedBox( height: 20, ), Column( children: [ Container( margin: EdgeInsets.only(left: 5, right: 5, top: 15), child: TextFields( hintText: "Add ASSESSMENT", fontSize: 13.5, onTapTextFields: () { openAssessmentDialog(context); }, readOnly: true, // hintColor: Colors.black, suffixIcon: EvaIcons.plusCircleOutline, suffixIconColor: AppGlobal.appPrimaryColor, fontWeight: FontWeight.w600, // controller: messageController, validator: (value) { if (value == null) return TranslationBase.of(context) .emptyMessage; else return null; }), ), SizedBox( height: 20, ), Container( margin: EdgeInsets.only(left: 5, right: 5, top: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "12".toUpperCase(), fontWeight: FontWeight.bold, fontSize: 16, ), AppText( "DEC".toUpperCase(), fontSize: 10, color: Colors.grey, ), ], ) ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( "Appointment #: ", fontWeight: FontWeight.bold, fontSize: 16, ), AppText( "2019054946", fontSize: 10, color: Colors.grey, ), ], ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( "Typhoid Fever", fontWeight: FontWeight.bold, fontSize: 16, ), ], ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( "Type : ", fontWeight: FontWeight.bold, fontSize: 16, ), AppText( "Possible Diagnosis", fontSize: 10, color: Colors.grey, ), ], ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( "Doc : ", fontWeight: FontWeight.bold, fontSize: 16, ), AppText( "Anas Abdullah", fontSize: 10, color: Colors.grey, ), ], ), SizedBox( height: 6, ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( "Some short remark about the allergy", fontSize: 10, color: Colors.grey, ), ], ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ AppText( "ICD: ".toUpperCase(), fontWeight: FontWeight.bold, fontSize: 16, ), AppText( "R07.1".toUpperCase(), fontSize: 10, color: Colors.grey, ), ], ) ], ), Column( children: [ InkWell( onTap: () {}, child: Icon(EvaIcons.edit2Outline), ) ], ), ], ), ) ], ) ]), isExpand: isAssessmentExpand, ), DividerWithSpacesAround( height: 30, ), AppButton( title: TranslationBase.of(context).next, onPressed: () { widget.changePageViewIndex(3); }, ), SizedBox( height: 30, ), ], ), ), ), )); } openAssessmentDialog(BuildContext context) { final screenSize = MediaQuery.of(context).size; InputDecoration textFieldSelectorDecoration( String hintText, String selectedText, bool isDropDown) { //TODO: make one Input InputDecoration for all return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, hintStyle: TextStyle( fontSize: 14, color: Colors.grey.shade600, ), ); } showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { return FractionallySizedBox( heightFactor: 0.75, widthFactor: 0.9, child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 16, ), AppText( "Add Assessment Details".toUpperCase(), fontWeight: FontWeight.bold, fontSize: 16, ), SizedBox( height: 16, ), Container( height: screenSize.height * 0.070, child: InkWell( onTap: assessmentList != null ? () { ListSelectDialog dialog = ListSelectDialog( list: assessmentList, attributeName: 'name', attributeValueId: 'id', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { // model.getDoctorBranch().then((value) { // _selectedBranch = value; // if (_referTo['id'] == 1) { // model.getClinics( // _selectedBranch['ID']); // } // }); }); }, ); showDialog( barrierDismissible: false, context: context, builder: (BuildContext context) { return dialog; }, ); } : null, child: TextField( decoration: textFieldSelectorDecoration( "Appointment Number", _referTo != null ? _referTo['name'] : null, true), enabled: false, ), ), ), SizedBox( height: 10, ), Container( height: screenSize.height * 0.070, child: InkWell( onTap: assessmentList != null ? () { ListSelectDialog dialog = ListSelectDialog( list: assessmentList, attributeName: 'name', attributeValueId: 'id', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() {}); }, ); showDialog( barrierDismissible: false, context: context, builder: (BuildContext context) { return dialog; }, ); } : null, child: TextField( decoration: textFieldSelectorDecoration("Name or ICD", _referTo != null ? _referTo['name'] : null, true), enabled: false, ), ), ), SizedBox( height: 10, ), Container( height: screenSize.height * 0.070, child: InkWell( onTap: assessmentList != null ? () { ListSelectDialog dialog = ListSelectDialog( list: assessmentList, attributeName: 'name', attributeValueId: 'id', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() {}); }, ); showDialog( barrierDismissible: false, context: context, builder: (BuildContext context) { return dialog; }, ); } : null, child: TextField( decoration: textFieldSelectorDecoration("Condition", _referTo != null ? _referTo['name'] : null, true), enabled: false, ), ), ), SizedBox( height: 10, ), Container( height: screenSize.height * 0.070, child: InkWell( onTap: assessmentList != null ? () { ListSelectDialog dialog = ListSelectDialog( list: assessmentList, attributeName: 'name', attributeValueId: 'id', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() {}); }, ); showDialog( barrierDismissible: false, context: context, builder: (BuildContext context) { return dialog; }, ); } : null, child: TextField( decoration: textFieldSelectorDecoration("Type", _referTo != null ? _referTo['name'] : null, true), enabled: false, ), ), ), SizedBox( height: 10, ), Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: TextFields( hintText: "Remarks", fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 18, minLines: 8, controller: remarksController, validator: (value) { if (value == null) return TranslationBase.of(context).emptyMessage; else return null; }), ), SizedBox( height: 10, ), AppButton( title: "Add".toUpperCase(), onPressed: () {}, ), ])), ); }); } }