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

GitHub 儲存庫theiskaa/field_suggestion

欄位建議

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

欄位建議 專案封面
星標
31
分支
15
最近推送(UTC)
2024年11月26日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。


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.
Ismael GitHub avatar
GitHub 作者

Ismael ↗

Libertas aut mors

@tnet-organizationGeorgia
語言Dart

分類

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

  • flutter{"sdk":"flutter"}
  • highlightable^1.0.5
  • flutter_test開發依賴{"sdk":"flutter"}
  • mockito開發依賴^5.0.16

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗