We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have DropdownButton2 and DropdownMenuItem with TextField. TextField have FocusNode.
DropdownButton2
DropdownMenuItem
TextField
FocusNode
I want to put requestFocus on the onMenuStateChange event so that when my window is opened, the field gets focus. But alas, this code doesn't work
onMenuStateChange
My Code:
return DropdownButtonHideUnderline( child: DropdownButton2<String>( isDense: true, isExpanded: true, customButton: Tooltip( message: "Filter by Balance", child: Container( color: _menuIsExpand ? const Color(0xFFE0E0E0) : const Color(0xFFF2F2F2), ), child: Row( children: [ Icon( Icons.filter_list_rounded, size: 16, ), ], ), ), ), onMenuStateChange: (val) { setState(() { _menuIsExpand = val; }); _minRangeValueFocus.requestFocus(); }, onChanged: (val) {}, buttonStyleData: ButtonStyleData( height: 60, padding: const EdgeInsets.only(top: 4, bottom: 4, right: 8), decoration: BoxDecoration( color: const Color(0xFFF2F2F2), borderRadius: BorderRadius.circular(4), ), ), dropdownStyleData: DropdownStyleData( width: 250, maxHeight: 150, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(4), ), ), menuItemStyleData: const MenuItemStyleData(height: 128), items: [ DropdownMenuItem( enabled: false, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ const Text("Filter by Balance"), const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: InputWidget( hintText: "min", textInputAction: TextInputAction.next, keyboardType: TextInputType.number, focusNode: _minRangeValueFocus, onSubmitted: (_) => _maxRangeValueFocus.requestFocus(), maxLength: 7, inputFormatters: [ FilteringTextInputFormatter.allow( RegExp(r"^(\d+)?\.?\d{0,2}"), ), ], controller: _minRangeValueController, ), ), const SizedBox(width: 8), Expanded( child: InputWidget( hintText: "max", textInputAction: TextInputAction.done, focusNode: _maxRangeValueFocus, keyboardType: TextInputType.number, onSubmitted: (_) => _submit(context), maxLength: 7, inputFormatters: [ FilteringTextInputFormatter.allow( RegExp(r"^(\d+)?\.?\d{0,2}"), ), ], controller: _maxRangeValueController, ), ), ], ), ], ), ), ], ), );
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have
DropdownButton2
andDropdownMenuItem
withTextField
. TextField haveFocusNode
.I want to put requestFocus on the
onMenuStateChange
event so that when my window is opened, the field gets focus. But alas, this code doesn't workMy Code:
The text was updated successfully, but these errors were encountered: