Flutter Expansion List

A Flutter package to provide Expandable List with customizable animation and List items.

Example Project

There is a good example project in the example folder.

Demo

expansion_list

Usage


       FlexibleExpansionList(
        itemCount: data!.length,
        headerBuilder: (BuildContext context, int index, bool isExpanded) {
          return ListTile(
            title: Text(isExpanded ? 'Collapse' : 'Expand'),
          );
        },
        fixedItemBuilder: (BuildContext context, int index) {
          return ListTile(
            title: Text(data![index].title),
            subtitle: Text(data![index].subtitle),
          );
        },
        expandedItemBuilder: (BuildContext context, int index) {
          return Padding(
            padding: const EdgeInsets.symmetric(horizontal: 8),
            child: ListTile(
              title: Text(data![index].fields.title),
              subtitle: Text(data![index].fields.value),
            ),
          );
        }
      ),

Properties

PropertyDescriptionDefault
required int itemCountTotal number of fixed items.required
required IndexedWidgetBuilder fixedItemBuilderCreates fixed list item widgets.required
required IndexedWidgetBuilder expandedItemBuilderCreate The widget(s) that should be displayed when each item is expanded.required
IndexedHeaderWidgetBuilder headerBuilderCreates The widget that should be shown as the header for the whole list.null
Animation animationExpansion and collapse animation with a value of type double.CurvedAnimation
AnimationController controllerExpansion and collapse animation controller.default controller with 300 milliseconds duration

Libraries

flexible_expansion_list