bloc_pagination

Creator: coderz1093

Last updated:

0 purchases

bloc_pagination Image
bloc_pagination Images

Languages

Categories

Add to Cart

Description:

bloc pagination

BlocPagination #



Installing #
In your pubspec.yaml
dependencies:
bloc_pagination: //add latest version
copied to clipboard
import 'package:bloc_pagination/bloc_pagination.dart';
copied to clipboard
Basic Usage #
class MyBloc extends PaginationBloc {
@override
Future<ListResponse<PaginationModel>> findAll(int page,
{AbstractQueryParameters? queryParameters}) async {
/// your data source
return readRepository.findAll(page, params: queryParameters);
}
}

class MyWidget extends StatelessWidget {
final MyBloc _bloc = MyBloc();

@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocPagination<TempModel, ErrorWrapper>(
bloc: _bloc,
blocListener: (context, state) {},
firstPageErrorBuilder: (context, error) {
return Center(
child: Text(error.message.toString()),
);
},
bannerPinned: true,
banner: SliverAppBarDelegate(
maxHeight: 100,
minHeight: 100,
child: Container(
color: Colors.green,
padding: const EdgeInsets.symmetric(vertical: 10),
child: Text('header widget'),
),
),
footerPinned: true,
footer: Container(
color: Colors.green,
height: 100,
width: double.infinity,
child: Text('footer widget'),
),
itemsBuilder: (context, item, index) => InkWell(
onTap: () => _bloc.add(EditListTypePaginationEvent(
listType: _bloc.state.listType.isListed
? ListType.gridView
: ListType.listView)),
child: Container(
color: Colors.green,
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
height: 200,
child: Text('index ${item.id}'),
),
),
),
);
}
}
copied to clipboard
Additional information #
For more information on how to use the package, please refer to the official documentation.
I hope this helps! Let me know if you have any other questions.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.