chips_choice는 단일 또는 다중 선택 칩을 생성하는 것을 간편하게 해주는 가벼우면서 종속성이 없는 Flutter 패키지입니다. smart_select의 최소한의 대안으로 설계되어, 사용자가 칩 목록에서 옵션을 선택할 수 있도록 깔끔하고 효율적인 방법을 제공합니다. 양식, 필터 또는 선호도 선택기와 같은 용도에 적합하며, 사용자 정의 가능한 스타일과 콜백을 지원합니다. 이 패키지는 Android, iOS, Web, macOS, Windows 및 Linux를 포함한 모든 주요 플랫폼과 호환됩니다.
사용 사례
선택 가능한 옵션을 가진 폼 입력
칩 선택을 사용한 데이터 필터링
사용자 선호도 선택
간단한 드롭다운 대안
동적 태그 선택
주요 기능
외부 종속성 없음
단일 및 다중 선택을 지원합니다
경량이고 빠름
사용자 지정 가능한 칩 모양
크로스 플랫폼 호환성
콜백 지원이 있는 간단한 API
적합한 대상
최소한의 UI 컴포넌트를 찾는 개발자
경량 폼 컨트롤이 필요한 프로젝트
플랫폼에 관계없이 사용 가능한 칩 위젯이 필요한 앱
선택 인터페이스의 빠른 프로토타이핑
고려 사항
기본 칩 기능에 한정
내장된 검색 또는 필터링 없음
복잡한 선택 로직에 적합하지 않음
기본 스타일링 외의 최소한의 사용자 지정
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
[!IMPORTANT]
Hi everyone,
I'm sorry to announce that I'm no longer maintaining the chips_choice package. It's been a great project, but it's become too difficult to maintain.
In its place, I've released a new package called choice. The combination to smart_select and chips_choice with cleaner, more flexible, and composable API for creating inline or prompted choice widgets with single or multiple selection.
I hope you'll check out choice. I think you'll find it to be a great replacement for chips_choice.
Thanks for your understanding.
Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.
To read more about classes and other references used by chips_choice, see the API Reference.
Single Choice
// available configuration for single choiceChipsChoice<T>.single({
// The current value of the single choice widget.@required T value,
// Called when single choice value changed@requiredC2Changed<T> onChanged,
// choice item list@requiredList<C2Choice<T>> choiceItems,
// Async loader of choice itemsC2ChoiceLoader<T> choiceLoader,
// other available configuration// explained below
...,
...,
})
// available configuration for multiple choiceChipsChoice<T>.multiple({
// The current value of the multiple choice widget.@requiredList<T> value,
// Called when multiple choice value changed@requiredC2Changed<List<T>> onChanged,
// choice item list@requiredList<C2Choice<T>> choiceItems,
// Async loader of choice itemsC2ChoiceLoader<T> choiceLoader,
// other available configuration// explained below
...,
...,
})
See the API References, to find out all of the parameters.
// available configuration for single and multiple choiceChipsChoice<T>.[single|multiple]({
// other available configuration// explained below
...,
...,
// Choice item styleC2ChipStyle choiceStyle,
// other available configuration// explained below
...,
...,
})
Custom Builder
// available configuration for single and multiple choiceChipsChoice<T>.[single|multiple]({
// other available configuration// explained below
...,
...,
// Builder for custom choice item labelC2Builder<T> choiceLabelBuilder,
// Builder for custom widget to display prior to the chip's [label].C2Builder<T>? choiceLeadingBuilder;
// Builder for custom widget to display next to the chip's [label].C2Builder<T>? choiceTrailingBuilder;
// Builder for custom choice itemC2Builder<T> choiceBuilder,
// Builder for spinner widgetWidgetBuilder spinnerBuilder,
// Builder for placeholder widgetWidgetBuilder placeholderBuilder,
// Builder for error widgetWidgetBuilder errorBuilder,
// other available configuration// explained below
...,
...,
})
Container Configuration
// available configuration for single and multiple choiceChipsChoice<T>.[single|multiple]({
// other available configuration// explained below
...,
...,
// Whether the chips is wrapped or scrollablebool wrapped,
// Container paddingEdgeInsetsGeometry padding,
// The direction to use as the main axis.Axis direction,
// Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.VerticalDirection verticalDirection,
// Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.TextDirection textDirection,
// if [wrapped] is [false], How the scroll view should respond to user input.ScrollPhysics scrollPhysics,
// if [wrapped] is [false], How much space should be occupied in the main axis.MainAxisSize mainAxisSize,
// if [wrapped] is [false], How the children should be placed along the main axis.MainAxisAlignment mainAxisAlignment,
// if [wrapped] is [false], How the children should be placed along the cross axis.CrossAxisAlignment crossAxisAlignment,
// if [wrapped] is [true], how the children within a run should be aligned relative to each other in the cross axis.WrapCrossAlignment wrapCrossAlignment,
// if [wrapped] is [true], determines how wrap will align the objectsWrapAlignment alignment,
// if [wrapped] is [true], how the runs themselves should be placed in the cross axis.WrapAlignment runAlignment,
// if [wrapped] is [true], how much space to place between children in a run in the main axis.double spacing,
// if [wrapped] is [true], how much space to place between the runs themselves in the cross axis.double runSpacing,
// Clip behaviorClip clipBehavior,
// String to display when choice items is emptyString placeholder,
// placeholder text styleTextStyle placeholderStyle,
// placeholder text alignTextAlign placeholderAlign,
// error text styleTextStyle errorStyle,
// error text alignTextAlign errorAlign,
// spinner sizedouble spinnerSize,
// spinner colorColor spinnerColor,
// spinner thicknessdouble spinnerThickness,
// other available configuration// explained below
...,
...,
})
Build Choice List
choiceItems property is List<C2Choice<T>>, it can be input directly as in the example below, more info about C2Choice can be found on the API Reference