搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。