selectable_list 0.0.1 copy "selectable_list: ^0.0.1" to clipboard
selectable_list: ^0.0.1 copied to clipboard

A widget displaying a selectable list of items.

A widget displaying a selectable [List] of 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 plugin when you want to allow the user to choose one element in a list, and only show this element when selected. This is useful in forms for example.

  • Based on the AnimatedList widget

Usage #

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),
    ),
  }
}

Check the example folder for more details

52
likes
0
pub points
78%
popularity

Publisher

verified publishersylvainlosey.com

A widget displaying a selectable list of items.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on selectable_list