Search packages, repositories and app categories

selectable_list cover
Package detailsv0.1.1

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.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
16
Likes
55
Pub points
150

Install package

flutter pub add selectable_list

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The selectable_list package provides a Flutter widget that displays a list of items, each of which can be selected. Upon selection, the other items in the list are animated out, leaving only the chosen item visible. This creates a clean, focused user experience ideal for single-choice selections. The animation is smooth and customizable, enhancing the visual feedback during interactions. It supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, making it versatile for cross-platform applications.

Use cases

  • Single-item selection interfaces
  • Form inputs with limited choices
  • Interactive list navigation
  • Onboarding screens
  • Dynamic content filtering
  • Minimalist UI design

Key features

  • Animated item collapse on selection
  • Single selection mode
  • Cross-platform compatibility
  • Customizable animations
  • Simple integration with Flutter
  • Responsive layout support

Suitable for

  • Developers building intuitive picker widgets
  • Designers seeking minimalistic interaction patterns
  • Apps requiring focused user input
  • Projects with dynamic list-based workflows
  • Teams prioritizing smooth UX transitions

Considerations

  • Best suited for lists with few items
  • May require additional styling for complex layouts
  • Animation behavior might not suit all use cases
  • Limited to single selection only
  • Not ideal for large datasets
  • Requires careful handling of state management

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Source repository

Projects using this package

No data available yet.