0 purchases
dynamic paging listview widget
Features #
Flutter package for listview with pagination.
Warning
I build this package for my own usage. I not perform test outside my own needs and my flutter environment.
Feature
List Items can be grouped
List Items can be selected or unselected
List support pagination
Basic Usage #
Create Future function to fetch data
Future<List<DyItemData<String>>> _fetchApi(DyFetchParam param) async {
await Future.delayed(const Duration(seconds: 5));
return [
"A","B","C","D","E"
];
}
copied to clipboard
Setup list controller
DyListViewController<String> controller =
controller = DyListViewController<String>(
direction: Axis.vertical,
refreshStateParentWidget: () {
if(mounted){
setState(() {});
}
},
fetchData: _fetchApi,
);
copied to clipboard
Passing list controller to widget
DyListView<String>(
controller: controller,
itemBuilder: (context, index, item) {
return Ink(
child: InkWell(
onTap: () => controller.selectItem(
data: item, isSetToSelected: !item.isSelected),
child: _Item(
data: item.data,
currentPage: item.page,
isSelected: item.isSelected,
),
),
);
},
),
copied to clipboard
Add additional Widget #
DyListView<String>(
...
addonWidget: DyListViewAddonConfig(
start: DyAddonWidgetConfig(
stickWidgetBuilder: (
context,
state,
) {
return Container(
height: 20,
color: Colors.amber,
);
},
padding: 0,
builder: (
context,
state,
) {
return generateTopWidget(context);
},
),
end: DyAddonWidgetConfig(
stickWidgetBuilder: (context, state) => Container(
height: 20,
color: Colors.red,
),
padding: 20,
builder: (context, state) {
return const _EndPage();
},
)),
),
copied to clipboard
Migrate from prev version #
(Breaking Changed) Migrate from SelectPagingListView, PageableListView to DyListView
For more usage examples, please take check out the example project.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.