From d0ebb5989e6e1bfec3d31521261b767309e56eaa Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 2 Jun 2025 11:02:30 +0200 Subject: [PATCH] remove double enter trigger --- .../components/Claim_Statement_Window.dart | 44 +++++++------------ .../pat_profile/components/prescip_input.dart | 34 +++++--------- 2 files changed, 27 insertions(+), 51 deletions(-) diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart index a13a7de1..6efd0697 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/Claim_Statement_Window.dart @@ -66,7 +66,6 @@ class _ClaimStatementWindowState extends State { final ValueNotifier medAid = ValueNotifier(""); List icd10codeList = []; final FocusNode _searchFocusNode = FocusNode(); - final FocusNode _focusNode = FocusNode(); void icd10SearchWindow(List codeList) { showDialog( @@ -189,35 +188,22 @@ class _ClaimStatementWindowState extends State { }, ), //const SizedBox(height: 10), - KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context) - .then((result) { - icd10SearchWindow(result); - }); - } + MihSearchBar( + controller: _icd10CodeController, + hintText: "ICD-10 Code & Description", + prefixIcon: Icons.search, + fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), + onPrefixIconTap: () { + MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context) + .then((result) { + icd10SearchWindow(result); + }); }, - child: MihSearchBar( - controller: _icd10CodeController, - hintText: "ICD-10 Code & Description", - prefixIcon: Icons.search, - fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onPrefixIconTap: () { - MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context) - .then((result) { - icd10SearchWindow(result); - }); - }, - onClearIconTap: () { - _icd10CodeController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), + onClearIconTap: () { + _icd10CodeController.clear(); + }, + searchFocusNode: _searchFocusNode, ), const SizedBox(height: 10), MIHTextField( diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/prescip_input.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/prescip_input.dart index 5f55396d..acbb6da4 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/components/prescip_input.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/components/prescip_input.dart @@ -353,29 +353,19 @@ class _PrescripInputState extends State { children: [ //const SizedBox(height: 25.0), - KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - getMedsPopUp(widget.medicineController); - } + MihSearchBar( + controller: widget.medicineController, + hintText: "Search Medicine", + prefixIcon: Icons.search, + fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), + onPrefixIconTap: () { + getMedsPopUp(widget.medicineController); }, - child: MihSearchBar( - controller: widget.medicineController, - hintText: "Search Medicine", - prefixIcon: Icons.search, - fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), - onPrefixIconTap: () { - getMedsPopUp(widget.medicineController); - }, - onClearIconTap: () { - widget.medicineController.clear(); - }, - searchFocusNode: _searchFocusNode, - ), + onClearIconTap: () { + widget.medicineController.clear(); + }, + searchFocusNode: _searchFocusNode, ), const SizedBox(height: 10.0),