Skip to content

How to pin keyboard when Popupmenu appears #24843

@zywj

Description

@zywj

How can I hold the keyboard when click PopupMenuButton.
I have noticed that why the keyboard will disappear is PopupMenu using Navigation.push
So, is there a workaournd to implement my require?

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              width: 150.0,
              child: TextField(
                autofocus: false,
                decoration: new InputDecoration(
                  hintStyle:
                      TextStyle(color: const Color(0xFFAAAAAA), fontSize: 15.0),
                  border: OutlineInputBorder(),
                ),
              ),
            ),
            PopupMenuButton<String>(
              onSelected: (String r) {},
              itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
                    const PopupMenuItem<String>(
                      value: "text",
                      child: const Text('Popup'),
                    ),
                  ],
            ),
          ],
        ),
      ),
    );
  }

Here is the flutter doctor -v

[✓] Flutter (Channel beta, v0.10.2, on Mac OS X 10.14.1 18B75, locale en-HK)
    • Flutter version 0.10.2 at /usr/local/flutter
    • Framework revision d8cbb80206 (5 weeks ago), 2018-10-26 01:30:21 -0400
    • Engine revision 6c2ade9fa2
    • Dart version 2.1.0-dev.8.0.flutter-bf26f760b1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.io/setup/#android-setup for detailed
      instructions).
      If Android SDK has been installed to a custom location, set $ANDROID_HOME
      to that location.
      You may also want to add it to your PATH environment variable.


[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed
      instructions).

[✓] IntelliJ IDEA Community Edition (version 2018.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 30.0.2
    • Dart plugin version 182.5124

[✓] VS Code (version 1.29.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.20.0

[✓] Connected device (1 available)
    • iPhone 7 • 463B2CA4-5966-4EC8-B0BE-6A174EA45B7B • ios • iOS 12.1
      (simulator)

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilitycustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: material designflutter/packages/flutter/material repository.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions