choiceList property

Widget choiceList

Returns the choice items widget

Implementation

Widget get choiceList {
  return choices!.isInitializing && choices!.isAsync
      ? choiceProgress
      : choices!.isNotEmpty
          ? ListTileTheme(
              contentPadding: choiceConfig.style?.padding,
              child: Builder(
                builder: (_) {
                  // return grouped choices if the configuration meet the requirement
                  if (groupConfig.enabled) {
                    final List<S2Group<T>>? groups =
                        choices!.groupItems(groupConfig);
                    if (groups != null) {
                      // appendable and reloadable choices are incompatible with grouped choices
                      return groupedChoices(groups);
                    }
                  }

                  return S2Pagination(
                    reloadable: choices!.isAsync,
                    appendable: choiceConfig.pageLimit != null,
                    onReload: () => choices!.reload(query: filter?.value),
                    onAppend: () => choices!.append(query: filter?.value),
                    child: ungroupedChoices(choices!.items),
                  );
                },
              ),
            )
          : choiceEmpty;
}