get<T> static method
Widget
get<T>({
- Key? key,
- ViewType viewType = ViewType.list,
- required AutoListCubit<
T> cubit, - bool autoManage = true,
- ScrollController? scrollController,
- Widget itemBuilder(
- BuildContext context,
- T item
- Widget separatorBuilder(
- BuildContext context,
- int index
- Widget wrapper(
- BuildContext context,
- Widget child
- Widget customBuilder(
- BuildContext context,
- List<
T> items
- SliverGridDelegate? gridDelegate,
- double loadRatio = 0.8,
- WidgetBuilder? loadingBuilder,
- WidgetBuilder? loadingMoreBuilder,
- WidgetBuilder? emptyBuilder,
- Widget errorBuilder(
- BuildContext context,
- VoidCallback retry
- Widget defaultBuilder(
- BuildContext context,
- AutoListState<
T> state
- dynamic onLoadingMoreError(
- BuildContext context,
- AutoListErrorState errorState
- EdgeInsets? padding,
- ScrollPhysics? physics,
- bool reverse = false,
- Axis scrollDirection = Axis.vertical,
- bool shrinkWrap = false,
Shows a ListView or a GridView displaying the current state of the
data list. When scrolled at more than loadRatio, AutoListCubit.loadMore
is called to fetch the next page of data
Implementation
static Widget get<T>({
Key? key,
ViewType viewType = ViewType.list,
required AutoListCubit<T> cubit,
/// whether or not the [AutoListCubit] should be disposed with this widget
bool autoManage = true,
ScrollController? scrollController,
Widget Function(BuildContext context, T item)? itemBuilder,
Widget Function(BuildContext context, int index)? separatorBuilder,
Widget Function(BuildContext context, Widget child)? wrapper,
Widget Function(BuildContext context, List<T> items)? customBuilder,
/// grid delegate to display the list as a grid
SliverGridDelegate? gridDelegate,
/// the threshold percentage of the list (of the [ScrollView]'s max extent)
/// at which the next page of data is loaded
double loadRatio = 0.8,
WidgetBuilder? loadingBuilder,
WidgetBuilder? loadingMoreBuilder,
WidgetBuilder? emptyBuilder,
Widget Function(BuildContext context, VoidCallback retry)? errorBuilder,
Widget Function(BuildContext context, AutoListState<T> state)? defaultBuilder,
Function(BuildContext context, AutoListErrorState errorState)? onLoadingMoreError,
EdgeInsets? padding,
ScrollPhysics? physics,
bool reverse = false,
Axis scrollDirection = Axis.vertical,
bool shrinkWrap = false,
}) {
final listView = AutoListView._(
viewType: viewType,
scrollController: scrollController,
itemBuilder: itemBuilder,
separatorBuilder: separatorBuilder,
wrapper: wrapper,
customBuilder: customBuilder,
displayMode: DisplayMode.auto,
loadRatio: loadRatio,
loadingBuilder: loadingBuilder,
loadingMoreBuilder: loadingMoreBuilder,
emptyBuilder: emptyBuilder,
errorBuilder: errorBuilder,
defaultBuilder: defaultBuilder,
onLoadingMoreError: onLoadingMoreError,
padding: padding,
physics: physics,
reverse: reverse,
scrollDirection: scrollDirection,
shrinkWrap: shrinkWrap,
gridDelegate: gridDelegate,
);
return _init(key, autoManage, cubit, listView);
}