remove double enter trigger

This commit is contained in:
2025-06-02 11:02:30 +02:00
parent d53e45d2e9
commit d0ebb5989e
2 changed files with 27 additions and 51 deletions

View File

@@ -66,7 +66,6 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
final ValueNotifier<String> medAid = ValueNotifier(""); final ValueNotifier<String> medAid = ValueNotifier("");
List<ICD10Code> icd10codeList = []; List<ICD10Code> icd10codeList = [];
final FocusNode _searchFocusNode = FocusNode(); final FocusNode _searchFocusNode = FocusNode();
final FocusNode _focusNode = FocusNode();
void icd10SearchWindow(List<ICD10Code> codeList) { void icd10SearchWindow(List<ICD10Code> codeList) {
showDialog( showDialog(
@@ -189,35 +188,22 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
}, },
), ),
//const SizedBox(height: 10), //const SizedBox(height: 10),
KeyboardListener( MihSearchBar(
focusNode: _focusNode, controller: _icd10CodeController,
autofocus: true, hintText: "ICD-10 Code & Description",
onKeyEvent: (event) async { prefixIcon: Icons.search,
if (event is KeyDownEvent && fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
event.logicalKey == LogicalKeyboardKey.enter) { hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context) onPrefixIconTap: () {
.then((result) { MIHIcd10CodeApis.getIcd10Codes(_icd10CodeController.text, context)
icd10SearchWindow(result); .then((result) {
}); icd10SearchWindow(result);
} });
}, },
child: MihSearchBar( onClearIconTap: () {
controller: _icd10CodeController, _icd10CodeController.clear();
hintText: "ICD-10 Code & Description", },
prefixIcon: Icons.search, searchFocusNode: _searchFocusNode,
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,
),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
MIHTextField( MIHTextField(

View File

@@ -353,29 +353,19 @@ class _PrescripInputState extends State<PrescripInput> {
children: [ children: [
//const SizedBox(height: 25.0), //const SizedBox(height: 25.0),
KeyboardListener( MihSearchBar(
focusNode: _focusNode, controller: widget.medicineController,
autofocus: true, hintText: "Search Medicine",
onKeyEvent: (event) async { prefixIcon: Icons.search,
if (event is KeyDownEvent && fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
event.logicalKey == LogicalKeyboardKey.enter) { hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
getMedsPopUp(widget.medicineController); onPrefixIconTap: () {
} getMedsPopUp(widget.medicineController);
}, },
child: MihSearchBar( onClearIconTap: () {
controller: widget.medicineController, widget.medicineController.clear();
hintText: "Search Medicine", },
prefixIcon: Icons.search, searchFocusNode: _searchFocusNode,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
onPrefixIconTap: () {
getMedsPopUp(widget.medicineController);
},
onClearIconTap: () {
widget.medicineController.clear();
},
searchFocusNode: _searchFocusNode,
),
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),