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

chip_list 표지
패키지 상세v3.1.0

chip_list

ChoiceChip 목록을 만드는 것을 간편하게 만들어 줍니다. 또한 매우 사용자 정의가 가능합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
758
좋아요
54
Pub 점수
160

패키지 설치

flutter pub add chip_list

패키지 개요

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

chip_list 패키지는 Flutter에서 사용자 정의 가능한 ChoiceChip 위젯 목록을 만드는 것을 간소화합니다. 최소한의 보일러플레이트 코드로 인터랙티브하고 선택 가능한 칩 그룹을 구축할 수 있는 직관적인 API를 제공합니다. 개발자는 칩의 스타일과 동작을 쉽게 설정하고 관리할 수 있어 필터링, 태깅 또는 선택 인터페이스에 이상적입니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원하여 크로스플랫폼 경험을 일관되게 유지합니다. 유연성과 사용 편의성에 중점을 두어 커스터마이징 옵션을 희생하지 않고 UI 개발을 강화합니다.

사용 사례

  • 폼 내 필터링 옵션
  • 태그 시스템
  • 사용자 선호도 선택
  • 인터랙티브 카테고리 탐색
  • 동적 선택 입력
  • 다중 선택 인터페이스

주요 기능

  • ChoiceChip와의 간편한 통합
  • 높은 사용자 정의 가능한 외관
  • 크로스 플랫폼 지원
  • 최소한의 설정 필요
  • 내장된 선택 관리
  • 반응형 디자인 호환성

적합한 대상

  • 폼 인터페이스를 구축하는 플러터 개발자
  • 동적 칩 기반 선택을 필요로 하는 앱
  • 재사용 가능한 칩 컴포넌트를 찾는 디자이너
  • 다중 선택 기능이 필요한 프로젝트
  • 빠른 UI 개발을 우선시하는 팀

고려 사항

  • ChoiceChip 위젯에 대한 이해가 필요합니다
  • 복잡한 레이아웃을 위해 추가 스타일링이 필요할 수 있습니다
  • 칩 기반 상호작용에 제한됨
  • 비상호작용 콘텐츠에 적합하지 않습니다
  • 긴 목록에 대해 스크롤 가능한 컨테이너 내에서 사용하는 것이 가장 좋습니다

원본 README

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

Features

Creates a list of ChoiceChips. Also allows for selecting multiple chips at once and allows use in sync with other widgets. This package is intended to solve all your woes with regards to Chips.

Well, maybe not all, but if you would like to request a feature, fire away !

See /example/main.dart for an example on how to use the state of the list for updating the state of other widgets, and other fancy properties.

 

Getting started

Depend on it! Add this to your pubspec.yaml

chip_list: ^3.0.0

Import it!

import 'package:chip_list/chip_list.dart';

Profit. 😉


 

Demo

In brief, the most useful features:

ChipList(
            listOfChipNames: name-of-the-chips-in-order-of-being-built,
            activeBgColorList: [],
            inactiveBgColorList: [],
            activeTextColorList: [],
            inactiveTextColorList: [],
            activeBorderColorList: [],
            inactiveBorderColorList: [],
            listOfChipIndicesCurrentlySelected: [],
          ),

 

Features

Wrapping the contents of ChipList

If you want to wrap the ChipList, then set shouldWrap to true. You can then use all the properties of a typical Wrap widget to further customize appearance.

Setting individual colors for active/inactive background and border color and text color

If you want to have full control of the parameters specified above over each and every single chip, you can do so by setting the color within the activeBgColorList, inactiveBgColorList, activeTextColorList and inactiveTextColorList respectively, wherever appropriate.

Use a single color if you want it to be used for all chips. Otherwise, the length of the list must be equal to the length of listOfChipNames.

Note that if you don't, then the package has defaults as specified in the documentation. (You can hover over the property in your IDE to see more 🙂).

Spacing in between each Chip

Whether you choose to let the axis to Axis.vertical or Axis.horizontal, you can set the spacing by tweaking widgetSpacing.

 

New attributes added to improve customisation if you set useMaterial3 = true

  • showCheckmark lets you enable or disable checkmarks in chips
  • checkmarkColor lets you set the color of the checkmark if it's enabled

 

⚠ Warning !!!!!!!!!

The flutter_lints package might suggest that you make listOfChipIndicesCurrentlySeclected a constant.

PLEASE DO NOT DO SO.

The widget will not respond to user interaction, seemingly without any reason.

The whole point of the API being designed like this is so that you have direct access to the currently selected indices, without the need for any state management and such.

That list will be updated as the user interacts with the widget. It is intended to be used in case you would like to incorporate the contents for any logic.

For an example, look at the section title "using extraOnToggle" in the provided example. The index is used to display the currently selected indice's label elsewhere in the UI.

 

Example Usage

/example/main.dart:

class HomePage extends StatefulWidget {
  HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final List<String> _dogeNames = [
    'Beagle',
    'Labrador',
    'Retriever',
  ];

  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Chip List Demo'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          // Basic usage
          const Text('Basic usage'),
          const SizedBox(
            height: 10,
          ),
          ChipList(
            listOfChipNames: _dogeNames,
            activeBgColorList: [Theme.of(context).primaryColor],
            inactiveBgColorList: [Colors.white],
            activeTextColorList: [Colors.white],
            inactiveTextColorList: [Theme.of(context).primaryColor],
            listOfChipIndicesCurrentlySeclected: [0],
            borderColorList: [Theme.of(context).primaryColor],
          ),

          // Using [supportsMultiSelect]
          const SizedBox(
            height: 20,
          ),
          const Text('Using supportsMultiSelect'),
          const SizedBox(
            height: 10,
          ),
          ChipList(
            listOfChipNames: _dogeNames,
            supportsMultiSelect: true,
            activeBgColorList: [Colors.pink, Colors.yellow, Colors.green],
            inactiveBgColorList: [Colors.white],
            activeTextColorList: [Colors.white],
            inactiveTextColorList: [Theme.of(context).primaryColor],
            listOfChipIndicesCurrentlySeclected: [0],
            borderColorList: [Colors.pink, Colors.yellow, Colors.green],
          ),

          // Using [extraOnToggle]
          const SizedBox(
            height: 20,
          ),
          Text('Using extraOnToggle: ${_dogeNames[_currentIndex]}'),
          const SizedBox(
            height: 10,
          ),
          ChipList(
            listOfChipNames: _dogeNames,
            activeBgColorList: [Theme.of(context).primaryColor],
            inactiveBgColorList: [Colors.white],
            activeTextColorList: [Colors.white],
            inactiveTextColorList: [Theme.of(context).primaryColor],
            listOfChipIndicesCurrentlySeclected: [_currentIndex],
            extraOnToggle: (val) {
              _currentIndex = val;
              setState(() {});
            },
          ),

          // Using [shouldWrap]
          const SizedBox(
            height: 20,
          ),
          const Text('Using shouldWrap'),
          const SizedBox(
            height: 10,
          ),
          SizedBox(
            width: 150,
            child: ChipList(
              listOfChipNames: const [
                'a',
                'really',
                'long',
                'list',
                'of',
                'chips',
                'that',
                'can',
                'be',
                'wrapped',
              ],
              activeBgColorList: [Theme.of(context).primaryColor],
              inactiveBgColorList: const [
                Colors.white,
              ],
              activeTextColorList: [Colors.white],
              inactiveTextColorList: [Theme.of(context).primaryColor],
              listOfChipIndicesCurrentlySeclected: [0],
              shouldWrap: true,
              runSpacing: 10,
              spacing: 10,
            ),
          ),
        ],
      ),
    );
  }
}

 

Additional stuff

Found an issue ? Please let me know ! Feel like creating a PR? Yes please! All contributions are welcome :)

카테고리

소스 저장소

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

아직 데이터가 없습니다.