Skip to content

SearchBar fails to call onSubmitted Function #137210

@MuhammedOzdogan

Description

@MuhammedOzdogan

Is there an existing issue for this?

Steps to reproduce

  • Copy the example usage of SearchBar from official Flutter documentation.
  • Add onSubmitted property to SearchBar object it can be as simple as onSubmitted: (v) => print("Search value: $v"),
  • Run the application
  • Click the Search Bar
  • Type something and hit enter
  • onSubmitted callback doesn't' get called.

onSubmitted never getting called, if SearchBar suggestions are visible, contoller.openView()

Expected results

I expect to onSubmitted callback being called whenever user press ENTER or DONE button in software keyboard.

Actual results

onSubmitted doesn't get called.

Code sample

https://dartpad.dev/?id=9474848a10119912f0efd690546c8c8d

Screenshots or Video

Screenshots / Video demonstration

Watch closely when I hit ENTER, cursor disappears but onSubmitted callback doesn't being called.

Only way to make it work is closing the SuggestionsWidget and then hitting ENTER.

Screen.Recording.2023-10-25.at.11.54.08.mov

Logs

No response

Flutter Doctor output

Doctor output
bug flutter doctor -v
[✓] Flutter (Channel stable, 3.13.8, on macOS 14.0 23A344 darwin-arm64, locale en-TR)
    • Flutter version 3.13.8 on channel stable at /Users/muhammed/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c4930c4ac (7 days ago), 2023-10-18 10:57:55 -0500
    • Engine revision 767d8c75e8
    • Dart version 3.1.4
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/muhammed/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.83.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.74.0```

</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: duplicateIssue is closed as a duplicate of an existing issueteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions