requestFocusOnTap property

bool? requestFocusOnTap
final

Determine if the dropdown button requests focus and the on-screen virtual keyboard is shown in response to a touch event.

Ignored if a focusNode is explicitly provided (in which case, FocusNode.canRequestFocus controls the behavior).

Defaults to null, which enables platform-specific behavior:

  • On mobile platforms, acts as if set to false; tapping on the text field and opening the menu will not cause a focus request and the virtual keyboard will not appear.

  • On desktop platforms, acts as if set to true; the dropdown takes the focus when activated.

Set this to true or false explicitly to override the default behavior.

This sample demonstrates how the enabled and requestFocusOnTap properties affect the textfield's hover cursor.
link

To create a local project with this code sample, run:
flutter create --sample=material.DropdownMenu.requestFocusOnTap.1 mysample

Implementation

final bool? requestFocusOnTap;