Stop keyboard opening on click.
This commit is contained in:
@@ -8,6 +8,7 @@ class MIHDropdownField extends StatefulWidget {
|
|||||||
final List<String> dropdownOptions;
|
final List<String> dropdownOptions;
|
||||||
// final void Function(String?)? onSelect;
|
// final void Function(String?)? onSelect;
|
||||||
final bool editable;
|
final bool editable;
|
||||||
|
final bool enableSearch;
|
||||||
|
|
||||||
const MIHDropdownField({
|
const MIHDropdownField({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -16,6 +17,7 @@ class MIHDropdownField extends StatefulWidget {
|
|||||||
required this.dropdownOptions,
|
required this.dropdownOptions,
|
||||||
required this.required,
|
required this.required,
|
||||||
required this.editable,
|
required this.editable,
|
||||||
|
required this.enableSearch,
|
||||||
// this.onSelect,
|
// this.onSelect,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,6 +101,7 @@ class _MIHDropdownFieldState extends State<MIHDropdownField> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
menu = buidMenueOptions(widget.dropdownOptions);
|
menu = buidMenueOptions(widget.dropdownOptions);
|
||||||
_focus.addListener(_onFocusChange);
|
_focus.addListener(_onFocusChange);
|
||||||
|
_focus.canRequestFocus = widget.enableSearch;
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +109,9 @@ class _MIHDropdownFieldState extends State<MIHDropdownField> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DropdownMenu(
|
return DropdownMenu(
|
||||||
|
enableSearch: widget.enableSearch,
|
||||||
|
enableFilter: widget.enableSearch,
|
||||||
|
// requestFocusOnTap: true,
|
||||||
initialSelection: widget.controller.text,
|
initialSelection: widget.controller.text,
|
||||||
enabled: widget.editable,
|
enabled: widget.editable,
|
||||||
trailingIcon: Icon(
|
trailingIcon: Icon(
|
||||||
|
|||||||
Reference in New Issue
Block a user