whenData method

  1. @override
Widget whenData(
  1. BuildContext context,
  2. List<T> items
)
override

This is the callback used to build the list/grid when data is available

Implementation

@override
Widget whenData(BuildContext context, List<T> items) {
  if (items.isEmpty && emptyBuilder != null) {
    return emptyBuilder?.call(context) ?? const SizedBox();
  }
  return ListView.builder(
    scrollDirection: scrollDirection,
    reverse: reverse,
    controller: controller,
    primary: primary,
    physics: physics,
    shrinkWrap: shrinkWrap,
    cacheExtent: cacheExtent,
    semanticChildCount: semanticChildCount,
    dragStartBehavior: dragStartBehavior,
    keyboardDismissBehavior: keyboardDismissBehavior,
    restorationId: restorationId,
    clipBehavior: clipBehavior,
    itemCount: items.length,
    itemBuilder: (BuildContext context, int index) {
      return itemBuilder(items[index]);
    },
  );
}