Last updated:
0 purchases
search bar bloc
SearchBar with Bloc
This package a SearchBar with Bloc state management.
The purpose of this package is to give an easy way to implement a search bar in a stateless widget.
Features #
The composition of the search bar is customizable and more parameters will be handled in the future.
Getting started #
If you're not familiar with bloc state management and the flutter_bloc package here are the resources you need :
flutter_bloc
bloc
equatable
Usage #
Here is a quick example of how to implement the search bar with a BlocProvider.
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (_) => SearchBarCubit(),
child: Column(
children: [
const SearchBar(hintText: "Search something..."),
BlocBuilder<SearchBarCubit, SearchBarState>(
buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) {
return Text("You are searching : ${state.content}");
}),
],
),
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.