FLUTTER ECOSYSTEM

PegasisForever/keep_keyboard_popup_menu

Um menu suspenso do Flutter que manterá o teclado aberto.

Capa do projeto manter o menu suspenso do teclado
Stars
8
Forks
15
Último push (UTC)
26 de jun. de 2024
Status do projeto
Arquivado
Jianqing Liu GitHub avatar
GITHUB User

Jianqing Liu ↗

Figured out SWE before LLMs \\  Co-authoring a better future

Ontario, CanadaSite oficial ↗
LinguagensDartSwiftKotlinObjective-C

Pacotes publicados por este repositório

Dependências usadas

Lista de dependências 2 itens

README original

Texto original em inglês. Visite o GitHub para a versão atual.

Expandir / recolher 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.

https://raw.githubusercontent.com/PegasisForever/keep_keyboard_popup_menu/master/example/screenshots/1.gif

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.