FLUTTER ECOSYSTEM

theiskaa/field_suggestion

높은 사용자 정의 가능성이 있으며 간단하고 제어 가능한 자동 완성 필드를 생성합니다.

필드 제안 프로젝트 이미지
Stars
31
Forks
15
최근 푸시(UTC)
2024. 11. 26.
프로젝트 상태
활성
Ismael GitHub avatar
GITHUB User

Ismael ↗

Libertas aut mors

@tnet-organizationGeorgia
언어Dart

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개
  • flutter{"sdk":"flutter"}
  • highlightable^1.0.5
  • flutter_test개발 의존성{"sdk":"flutter"}
  • mockito개발 의존성^5.0.16

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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.

https://user-images.githubusercontent.com/59066341/220667553-d4d83c93-6e15-424c-b2d5-7a221f30069c.gif
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.