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

field_suggestion 封面
套件詳情v0.2.6

field_suggestion

建立高度可自訂、簡單且可控制的自動補全欄位。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
643
喜歡數
45
Pub 分數
160

安裝套件

flutter pub add field_suggestion

套件介紹

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

FieldSuggestion 是一個 Flutter 套件,讓開發者能夠建立高度可自訂、簡單且可控的自動補全欄位。它提供了一個乾淨的 API,用於建構具有即時建議的輸入欄位,支援文字與自訂元件渲染。此套件可在 Android、iOS、Web、macOS、Windows 與 Linux 等所有主要平台運作,非常適合需要智慧輸入處理的跨平台應用。透過內建的建議顯示控制、過濾邏輯與樣式設定,FieldSuggestion 提供彈性而不複雜的使用體驗。

適用情境

  • 帶有動態建議的表單輸入
  • 帶預測文字的搜尋欄
  • 表單中的自定義下拉選單
  • 使用者友善的資料輸入介面
  • 即時過濾大型資料集

主要特色

  • 高度可自訂的建議UI
  • 跨平台相容性
  • 簡單直覺的 API
  • 支援在建議中使用自定組件
  • 內建的過濾與控制邏輯
  • 輕量且高效

適合對象

  • 開發表單密集型應用的開發者
  • 需要一致自動補全行為的團隊
  • 需要跨平台輸入元件的應用程式
  • 需要複雜使用者輸入的專案

使用建議

  • 需要手動實現資料來源邏輯
  • 有限的內建主題或樣式預設
  • 最適合靜態或可預測的建議來源

原始 README

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


Field Suggesion's Logo

Field Suggesion's Title Logo


Installing

Usage

In this example, we're using the FieldSuggestion.network widget to display suggestions for a username input field. We've provided an inputDecoration with a hint text, a future function that fetches the suggestions based on the user input, a textController that controls the text in the input field, a boxController that controls the visibility of the suggestion box, and a builder function that defines how the suggestions are displayed in the suggestion box.

Note that FieldSuggestion uses generics to allow for suggestions of different types. In the example above, we're using String as the type parameter for FieldSuggestion.network However, any other type can be used, depending on the type of suggestions being displayed.

FieldSuggestion<String>.network(
  inputDecoration: InputDecoration(
    hintText: 'Username', // optional
  ),
  future: (input) => future.call(input),
  textController: controller,
  boxController: boxController, // optional
  builder: (context, snapshot) {
    if (snapshot.connectionState != ConnectionState.done) {
      return Center(child: CircularProgressIndicator());
    }

    final result = snapshot.data ?? [];
    return ListView.builder(
      itemCount: result.length,
      itemBuilder: (context, index) {
        return GestureDetector(
          onTap: () {
            setState(() => controller.text = result[index]);
            boxControllerNetwork.close?.call();
          },
          child: Card(child: ListTile(title: Text(result[index]))),
        );
      },
    );
  },
)

Contributing

  • For information regarding contributions, please refer to CONTRIBUTING.md file.

所屬分類

依賴

依賴清單 1 項

  • highlightable^1.0.5

原始碼儲存庫

使用此套件的專案

暫無相關資料。