搜索插件、代码仓与 APP 分类

keep_keyboard_popup_menu 封面
插件详情v2.0.5

keep_keyboard_popup_menu

一个会保持键盘打开的弹出菜单。

近 30 天下载
27
喜欢数
29
Pub 分数
45

安装插件

flutter pub add keep_keyboard_popup_menu

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,可使弹出菜单在保持键盘激活的同时保持打开状态,确保在输入密集型交互中实现无缝用户体验。它特别适用于表单或文本输入场景,用户需要从菜单中选择选项而不会失去对文本字段的焦点。该包通过防止触发弹出菜单时关闭键盘,从而保持用户工作流的连续性。设计简洁可靠,可与现有 Flutter 应用程序无缝集成。

适合场景

  • 表单输入框带下拉选择
  • 需要频繁访问菜单的文本字段
  • 需要持续键盘焦点的用户流程
  • 带有输入元素的交互式对话框
  • 输入时动态选项选择

主要特点

  • 菜单出现后保持键盘打开
  • 最小设置和集成
  • 与标准 TextField 小部件兼容
  • 在交互过程中保持输入焦点
  • 轻便高效

适合对象

  • 开发表单密集型应用的开发者
  • 频繁菜单交互的应用
  • 以用户体验为中心的界面,需要流畅的输入流程
  • 移动应用中的复杂数据输入
  • Flutter 项目优先考虑用户留存

使用建议

  • 仅限移动平台(不支持网页/桌面端)
  • 可能与其他焦点管理包冲突
  • 在嵌套滚动上下文中需要谨慎处理
  • 不适用于需要全屏过渡的模态对话框
  • 取决于底层平台特定的键盘行为

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

This Library was meant for an old version of flutter (v1) and doesn't work on the new version!

keep_keyboard_popup_menu

A popup menu that will keep the soft keyboard open. This package is created to solve issue #24843 and #50567.

How Does It Work?

Unlike the popup menu created by PopupMenuButton, which works by pushing a new route to the navigator and causes the soft keyboard to hide, the popup menu created by this package works by adding an entry to Overlay and will keep the soft keyboard open.

Quick Start

(I'm sorry for the long names, please pr if there are shorter alternatives.)

KeepKeyboardPopupMenuItem

Intended to replace PopupMenuItem. Works similarly to a ListTile. PopupMenuItem won't work with this package because it will pop the current route when tapped. (This package shows popup menu using overlay, not route.)

KeepKeyboardPopupMenuItem(
    child: Text('awa'),
    onTap: () {},
)

KeepKeyboardPopupMenuButton

Intended to replace PopupMenuButton. Despite the similar name, the usage is quite different. The closePopup passed to the menuItemBuilder is used to programmatically close the popup.

KeepKeyboardPopupMenuButton(
    menuItemBuilder: (context, closePopup) => [
        KeepKeyboardPopupMenuItem(
            child: Text('awa'),
            onTap: closePopup,
        ),
    ]
)

You can also use the menuBuilder property to show any widget you want in the popup menu. For details, see the documentation and example.

WithKeepKeyboardPopupMenu

WithKeepKeyboardPopupMenu allows opening a popup menu on any widget.

WithKeepKeyboardPopupMenu(
    menuItemBuilder: (context, closePopup) => [
        KeepKeyboardPopupMenuItem(
            child: Text('awa'),
            onTap: closePopup,
        ),
    ],
    childBuilder: (context, openPopup) => ElevatedButton(
        onPressed: openPopup,
        child: Text('Custom Trigger'),
    ),
    
)

You can also use the menuBuilder property to show any widget you want in the popup menu, use backgroundBuilder property to customize background of the popup menu, and calculatePopupPosition property to customize the position of the popup menu. For details, see the documentation and example.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。