dynamic_paging_listview_widget 0.1.3+1
dynamic_paging_listview_widget: ^0.1.3+1 copied to clipboard
A dynamic scrollable flutter ListView with pagination feature and flexible customization on UI Flutter 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"
];
}
Setup list controller
DyListViewController<String> controller =
controller = DyListViewController<String>(
direction: Axis.vertical,
refreshStateParentWidget: () {
if(mounted){
setState(() {});
}
},
fetchData: _fetchApi,
);
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,
),
),
);
},
),
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();
},
)),
),
Migrate from prev version #
- (Breaking Changed) Migrate from SelectPagingListView, PageableListView to DyListView
For more usage examples, please take check out the example project.