패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.0.0

flutter_chips_input

입력 옵션으로 InputChips를 사용하여 입력 필드를 구축하는 Flutter 라이브러리입니다.

30일 다운로드
1.8천
좋아요
106
Pub 점수
70

패키지 설치

flutter pub add flutter_chips_input

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

사용자가 입력 옵션으로 칩을 추가하고 관리할 수 있는 입력 필드를 생성할 수 있도록 해주는 플러터 라이브러리입니다. 동적 칩 추가, 제거 및 사용자 정의를 지원하여 태그 또는 선택 기반 양식에 이상적입니다. 패키지는 플러터의 머티리얼 디자인 구성 요소와 원활하게 통합되며 개발자가 사용자 정의 칩 스타일, 검증 규칙 및 입력 동작을 정의할 수 있습니다. 사용자 중심 콘텐츠 태깅 또는 다중 선택 입력이 필요한 시나리오에서 특히 유용합니다.

사용 사례

  • 태그 시스템
  • 다중 선택 폼 입력
  • 동적 콘텐츠 필터링
  • 사용자 생성 키워드 입력
  • 인터랙티브 칩이 있는 폼 필드
  • 제안된 태그로 검색

주요 기능

  • 인터랙티브 칩 입력
  • 사용자 정의 가능한 칩 스타일
  • 실시간 칩 관리
  • 검증 지원
  • 확장 가능한 입력 처리
  • 기존 양식과의 간편한 통합

적합한 대상

  • 태그 기반 UI를 구축하는 개발자
  • 다중 선택이 필요한 양식
  • 동적 사용자 입력을 가진 애플리케이션
  • 입력에 시각적 피드백이 필요한 UI
  • 모바일 앱을 위해 플러터를 사용하는 팀

고려 사항

  • 제한된 플랫폼별 동작 문서
  • 내장된 자동 완성 기능 없음
  • 칩 데이터 지속성에 대한 수동 처리가 필요합니다
  • 복잡한 레이아웃을 위해 추가 스타일링이 필요할 수 있습니다
  • 매우 큰 데이터 세트에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_chips_input

Flutter library for building input fields with InputChips as input options.

Pub Version GitHub Workflow Status Codecov CodeFactor Grade

GitHub OSS Lifecycle Gitter

Usage

Installation

Follow installation instructions here

Import
import 'package:flutter_chips_input/flutter_chips_input.dart';
Example
ChipsInput
ChipsInput(
    initialValue: [
        AppProfile('John Doe', 'jdoe@flutter.io', 'https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX4057996.jpg')
    ],
    decoration: InputDecoration(
        labelText: "Select People",
    ),
    maxChips: 3,
    findSuggestions: (String query) {
        if (query.length != 0) {
            var lowercaseQuery = query.toLowerCase();
            return mockResults.where((profile) {
                return profile.name.toLowerCase().contains(query.toLowerCase()) || profile.email.toLowerCase().contains(query.toLowerCase());
            }).toList(growable: false)
                ..sort((a, b) => a.name
                    .toLowerCase()
                    .indexOf(lowercaseQuery)
                    .compareTo(b.name.toLowerCase().indexOf(lowercaseQuery)));
        } else {
            return const <AppProfile>[];
        }
    },
    onChanged: (data) {
        print(data);
    },
    chipBuilder: (context, state, profile) {
        return InputChip(
            key: ObjectKey(profile),
            label: Text(profile.name),
            avatar: CircleAvatar(
                backgroundImage: NetworkImage(profile.imageUrl),
            ),
            onDeleted: () => state.deleteChip(profile),
            materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
        );
    },
    suggestionBuilder: (context, state, profile) {
        return ListTile(
            key: ObjectKey(profile),
            leading: CircleAvatar(
                backgroundImage: NetworkImage(profile.imageUrl),
            ),
            title: Text(profile.name),
            subtitle: Text(profile.email),
            onTap: () => state.selectSuggestion(profile),
        );
    },
)

To-do list

  • [x] Ability to limit the number of chips
  • [x] Overlay doesn't move when input height changes i.e. when chips wrap
  • [ ] Create a FormField implementation (ChipsInputField) to be used within Flutter Form Widget

Known Issues

  • Deleting chips with keyboard on IOS makes app to crush (Flutter Issue with special characters used as replacement characters). Already reported #1
  • For some reason Overlay floats above AppBar when scrolling

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.