搜尋套件、儲存庫與 APP 分類

avoid_keyboard 封面
套件詳情v0.3.0

avoid_keyboard

此套件可實現方便的鍵盤避讓。可用於為特定檢視區域啟用鍵盤避讓,而不需壓縮整個檢視。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
957
喜歡數
26
Pub 分數
150

安裝套件

flutter pub add avoid_keyboard

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

avoid_keyboard 套件為 Flutter 應用程式提供了一種簡單的方式來管理鍵盤避讓,允許特定的檢視區域在鍵盤出現時進行調整。與全螢幕調整不同,它避免壓縮整個 UI,從而保留佈局完整性。該套件可在 Android、iOS、Web、macOS、Windows 和 Linux 等多個平台使用。對於表單或輸入密集型介面,此套件非常理想,因為在使用者互動過程中保持視覺上下文至關重要。

適用情境

  • 表單輸入項具有動態佈局調整
  • 帶有訊息輸入欄位的聊天介面
  • 自訂可捲動區域,避免鍵盤重疊
  • 需要精確鍵盤處理的行動優先使用者介面
  • 具有響應式輸入區域的網頁和桌面應用程式

主要特色

  • 區域特定的鍵盤避讓
  • 無完整視圖壓縮
  • 跨平台支援
  • 使用 widget 包裝器的最小設定
  • 支援可捲動容器
  • 與現有的滾動視圖相容

適合對象

  • 開發輸入密集型應用的開發者
  • 針對多個平台的團隊
  • 需要細粒度控制的UI設計師
  • 具有複雜表單佈局的應用程式
  • 需要順暢鍵盤互動的專案

使用建議

  • 複雜版面可能需要手動定位邏輯
  • 不適用於全螢幕鍵盤避讓
  • 對高頻率更新的效能影響
  • 超出基本偏移之外的自訂功能有限
  • 需要在所有目標平台進行仔細測試

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

avoid_keyboard

pub version pub points likes popularity

The avoid_keyboard package includes a widget (AvoidKeyboard) in which you can wrap your text fields and other input controls, such that they will scroll out of the way when the keyboard pops up. Using this widget has an advantage over using the default Scaffold behavior, in that you can specify exactly which areas of your app will scroll in response to the keyboard, rather than having your entire viewport compressed (which won't work anyway for fixed height columns).

Another advantage, is that AvoidKeyboard will only shift its contents in the case that the keyboard is actually overlapping the focused input control.

demonstration gif

Getting Started

To get started, simply wrap the input controls (along with any surrounding portion of the widget tree which should move out of the way):

class AvoidKeyboardExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return AvoidKeyboard(
      child: Column(
        children: [
          TextField(),
          TextField(),
        ],
      ),
    );
  }
}

Having done this, the view will now scroll out of the way when the keyboard overlaps an active control.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。