FLUTTER ECOSYSTEM

SylvainLosey/selectable_list

선택 가능한 항목 목록을 표시하는 Flutter 위젯입니다.

선택 가능한 목록 프로젝트 이미지
Stars
5
Forks
3
최근 푸시(UTC)
2022. 6. 21.
프로젝트 상태
활성
Sylvain Losey GitHub avatar
GITHUB User

Sylvain Losey ↗

Switzerland
언어C++CMakeDartHTMLCSwiftKotlinObjective-C

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^2.0.0

원본 README

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

README 펼치기 / 접기

Selectable List

A widget displaying a list of selectable items

When one of the items is selected, the other elements of the list are animated out, leaving the selected value. When tapping on the value again, the other values are animated back into the list.

Example app

Features

  • Use this package when you want to allow the user to choose one element in a list, and only show this element when selected.

  • Based on the Flutter AnimatedList widget

Usage

Import the package

import 'package:selectable_list/selectable_list.dart';

Use the widget

class _ScrollableListExampleState extends State<_ScrollableListExample> {
  final persons = [
    Person("Ella", 3),
    Person("James", 25),
    Person("Gertrude", 99)
  ];

  String? selectedName;

  @override
  Widget build(BuildContext context) {
    return SelectableList<Person, String?>(
        items: persons,
        itemBuilder: (context, person, selected, onTap) => ListTile(
            title: Text(person.name),
            subtitle: Text('${person.age.toString()} years old'),
            selected: selected,
            onTap: onTap),
        valueSelector: (person) => person.name,
        selectedValue: selectedName,
        onItemSelected: (person) =>
            setState(() => selectedName = person.name),
        onItemDeselected: (person) => setState(() => selectedName = null),
    ),
  }
}

Examples of use

Forms

Useful to make forms cleaner and more compact on mobile

Example in a form