collectionWrapperBuilder method
Implementation
Widget collectionWrapperBuilder(BuildContext context, BlocxCollectionState<T> state) {
final top = topWidget(context, state);
final bottom = bottomWidget(context, state);
final bool isLoadingOrSearching = isLoading || isSearching;
final bool isEmpty = !isLoading && state.list.isEmpty;
final Widget coreBox = (isLoadingOrSearching || isEmpty)
? (isLoadingOrSearching ? loadingWidget(context, state) : emptyWidget(context, state))
: collectionWidget(context, state); // must return a regular Widget*
final children = <Widget>[
if (top != null) top,
if (top != null) SizedBox(height: topBottomAndListSpacing),
_collectionOptions.shrinkWrap ? coreBox : Expanded(child: coreBox),
if (bottom != null) SizedBox(height: topBottomAndListSpacing),
if (bottom != null) bottom,
];
return Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: children);
}