diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index ef0c8cd7..af217257 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -124,8 +124,8 @@ class _AddAssessmentDetailsState extends State { SizedBox( height: 10, ), - Container( - child: InkWell( + Column( + children:[ InkWell( onTap: model.listOfICD10 != null ? () { setState(() { @@ -134,87 +134,113 @@ class _AddAssessmentDetailsState extends State { }); } : null, - child: widget.mySelectedAssessment.selectedICD == null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && widget.mySelectedAssessment.selectedICD == null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - flex: 4, - child: AutoCompleteTextField( - decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, null, true, suffixIcon: null), - controller: icdNameController, - itemSubmitted: (item) => setState(() { - widget.mySelectedAssessment.selectedICD = item; - // icdNameController.text = '${item.code.trim()}/${item.description}'; - icdNameController.text = '${item.description}'; - }), - key: key, - suggestions: model.listOfICD10, - suggestionsAmount: 10, - itemBuilder: (context, suggestion) => - new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString(), fontSize: 12.0), padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || - // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || - // suggestion.code.toLowerCase().startsWith(input.toLowerCase()), - suggestion.description.toLowerCase().contains(input.toLowerCase()) || - // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || - suggestion.code.toLowerCase().contains(input.toLowerCase()), - ), - ), - Expanded( - child: IconButton( - onPressed: () { - print(icdNameController.text); - if (icdNameController.text.length <= 3) { - DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); - } else { - model.listOfICD10.clear(); - model.callAddAssessmentLookupsServices(searchKey: icdNameController.text); - } - }, - icon: Icon(Icons.search), - ), - ), - ], - ), - ) - : AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - onClick: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment.selectedICD = null; - icdNameController.text = null; - }); - } - : null, - hintText: TranslationBase.of(context).nameOrICD, - maxLines: 1, - minLines: 1, - controller: icdNameController, - enabled: true, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - onPressed: () { - print(icdNameController.text); - if (icdNameController.text.length <= 3) { - DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); - } else { - model.listOfICD10.clear(); - model.callAddAssessmentLookupsServices(searchKey: icdNameController.text); - } - }, - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - )), + child: AppTextFieldCustom( + onChanged: (text){ + setState(() { + icdNameController.text; + }); + }, + height: Utils.getTextFieldHeight(), + onClick: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment.selectedICD = null; + icdNameController.text = null; + }); + } + : null, + hintText: TranslationBase.of(context).nameOrICD, + maxLines: 1, + minLines: 1, + controller: icdNameController, + enabled: true, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + onPressed: () { + print(icdNameController.text); + if (icdNameController.text.length <= 3) { + DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); + } else { + model.listOfICD10.clear(); + model.callAddAssessmentLookupsServices(searchKey: icdNameController.text); + } + }, + icon: Icon( + Icons.search, + color: Colors.grey.shade600, )), - ), + )), + + model.listOfICD10.length >0 && icdNameController.text.isNotEmpty ? Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.4, //height to 9% of screen height, + child:ListView.builder( + shrinkWrap: true, + itemCount: model.listOfICD10.length, + itemBuilder: (context, index) { + return InkWell(child:ListTile( + title: AppText( model.listOfICD10[index].description + " / " + model.listOfICD10[index].code.toString(), fontSize: 12.0)), + onTap: (){ + + widget.mySelectedAssessment.selectedICD = model.listOfICD10[index]; + icdNameController.text = model.listOfICD10[index].description; + model.listOfICD10.clear(); + setState(() { + + }); + } + ); + + }, + )) :SizedBox() + // CustomAutoCompleteTextField( + // isShowError: isFormSubmitted && widget.mySelectedAssessment.selectedICD == null, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisSize: MainAxisSize.min, + // children: [ + // AutoCompleteTextField( + // decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, null, true, suffixIcon: null), + // controller: icdNameController, + // itemSubmitted: (item) => setState(() { + // widget.mySelectedAssessment.selectedICD = item; + // // icdNameController.text = '${item.code.trim()}/${item.description}'; + // icdNameController.text = '${item.description}'; + // }), + // key: key, + // suggestions: model.listOfICD10, + // suggestionsAmount: model.listOfICD10.length, + // itemBuilder: (context, suggestion) => + // new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString(), fontSize: 12.0), padding: EdgeInsets.all(8.0)), + // itemSorter: (a, b) => 1, + // itemFilter: (suggestion, input) => + // // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || + // // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || + // // suggestion.code.toLowerCase().startsWith(input.toLowerCase()), + // suggestion.description.toLowerCase().contains(input.toLowerCase()) || + // // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || + // suggestion.code.toLowerCase().contains(input.toLowerCase()), + // + // ), + // Expanded( + // child: IconButton( + // onPressed: () { + // print(icdNameController.text); + // if (icdNameController.text.length <= 3) { + // DrAppToastMsg.showErrorToast("Please enter 4 or more characters"); + // } else { + // model.listOfICD10.clear(); + // model.callAddAssessmentLookupsServices(searchKey: icdNameController.text); + // } + // }, + // icon: Icon(Icons.search), + // ), + // ), + // ], + // ), + // ) + + ]), if (widget.mySelectedAssessment.selectedICD != null) Column( children: [