YRefreshListView<T> function
Widget
YRefreshListView<T>({
- required List<
T> models, - dynamic onRefresh()?,
- required dynamic itemBuilder(
- BuildContext context,
- int index,
- T model
- ScrollController? scrollController,
- Header? header,
- dynamic onLoadMore()?,
- dynamic bottomBouncing = true,
- dynamic scrollbar = true,
- EdgeInsets padding = EdgeInsets.zero,
- bool reverse = false,
Implementation
Widget YRefreshListView<T>({
required List<T> models,
Function()? onRefresh,
required Function(BuildContext context, int index, T model) itemBuilder,
ScrollController? scrollController,
Header? header,
Footer? footer,
Function()? onLoadMore,
bottomBouncing = true,
scrollbar = true,
EdgeInsets padding = EdgeInsets.zero,
bool reverse = false,
}) {
var easyRefresh = EasyRefresh(
onRefresh: onRefresh != null ? () => onRefresh() : null,
onLoad: onLoadMore != null ? () => onLoadMore() : null,
bottomBouncing: bottomBouncing,
scrollController: scrollController,
header: header ?? (onRefresh != null ? BezierCircleHeader(backgroundColor: YConfig.themeColor.withOpacity(0.1), color: YConfig.themeColor) : null),
footer: footer ?? (onLoadMore != null ? BallPulseFooter(backgroundColor: YConfig.themeColor.withOpacity(0.1), color: YConfig.themeColor, enableInfiniteLoad: false) : null),
child: Container(
constraints: const BoxConstraints(minHeight: 300),
child: ListView.builder(
padding: padding,
primary: false,
shrinkWrap: true,
reverse: reverse,
itemCount: models.length,
itemBuilder: (context, index) => itemBuilder(context, index, models[index]),
),
),
);
return scrollbar ? Scrollbar(child: easyRefresh) : easyRefresh;
}