fl_paging 1.0.10 copy "fl_paging: ^1.0.10" to clipboard
fl_paging: ^1.0.10 copied to clipboard

outdated

A new Flutter package support paginating for Listview, Gridview and NestedScrollView

Paging #

Pub Package
Star on GitHub style: effective dart MIT License


A new Flutter package for paging

Demo #

DataSource #

PageKeyedDataSource

Example for load with page index

1, Define Source

class ListViewDataSource extends paging.PageKeyedDataSource<int, Note> {
  NoteRepository noteRepository;
  ListViewDataSource(this.noteRepository) {
    isEndList = false;
  }

  @override
  Future<Tuple2<List<Note>, int>> loadInitial() async {
    final result = await noteRepository.getNotes(0);
    return Tuple2(result, 0);
  }

  @override
  Future<Tuple2<List<Note>, int>> loadPageAfter(int params) async {
    if (params == 6) isEndList = true;
    final result = await noteRepository.getNotes(params + 1);
    return Tuple2(result, params + 1);
  }
}

2, ListView

      ListView<Note>(
        key: key,
        padding: EdgeInsets.all(16),
        itemBuilder: (context, data, child) {
          return NoteWidget(data);
        },
        pageDataSource: dataSource,
      ),

3, GridView

      paging.GridView<Note>(
        key: key,
        padding: EdgeInsets.all(16),
        itemBuilder: (context, data, child) {
          return NoteGridWidget(data);
        },
        delegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
          mainAxisSpacing: 16,
          crossAxisSpacing: 16
        ),
        pageDataSource: dataSource,
      ),

ItemKeyedDataSource

Coming Soon :))

OffsetDataSource

Coming Soon :))

IndexDataSource

Coming Soon :))

Documentation #

BaseWidget Class #

Dart attribute Description Default Value
emptyBuilder builder for empty widget
loadingBuilder builder for loading widget
errorBuilder builder for error widget
itemBuilder builder for item widget
pageDataSource DataSource for this widget
24
likes
0
points
312
downloads

Publisher

verified publisherdangngocduc.dev

Weekly Downloads

A new Flutter package support paginating for Listview, Gridview and NestedScrollView

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, freezed_annotation, tuple

More

Packages that depend on fl_paging