listWrapperBuilder method

Widget listWrapperBuilder(
  1. BuildContext context,
  2. ListState<T> state
)

Implementation

Widget listWrapperBuilder(BuildContext context, ListState<T> state) {
  final top = topWidget(context, state);
  final bottom = bottomWidget(context, state);
  bool hasTopOrBottomWidget = top != null || bottom != null;
  final listOrLoading = isLoading || isSearching
      ? loadingWidget(context, state)
      : state.list.isEmpty
      ? emptyWidget(context, state)
      : collectionWidget(context, state);

  if (!hasTopOrBottomWidget) return listOrLoading;

  return Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    spacing: topBottomAndListSpacing,
    children: [
      ?top,
      Expanded(child: listOrLoading),
      ?bottom,
    ],
  );
}