2

I am using flutter for web. When I click on the dropdown but do not select any options, then when I click outside the dropdown menu, the focus is still there. But I have used Gesture Detector to change the focus by this-

onTap: () {
    FocusManager.instance.primaryFocus?.unfocus();
},

So whenever I click outside the dropdown, the focus needs to be changed. But it is not functioning.

enter image description here

Flutter doctor output:

    [✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale en-US)
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2021.2)
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
    [✓] VS Code (version 1.67.2)
    [✓] Connected device (3 available)
    [✓] HTTP Host Availability

    • No issues found!
Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Asif Syeed
  • 81
  • 7
  • Have you tried adding a `FocusNode` to your dropdown and calling `myFocusNode.unfocus();`. I found that dealing with focus and remaining cursors in inputs in flutter to be tricky. – void void Jun 26 '22 at 12:00

0 Answers0