New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Bloc with searchAnchor Widget #4164
Comments
Hi @abdulbosit209 👋 |
@abdulbosit209 The I think you might want to use Here is how I did it SearchAnchor(
viewLeading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
context.read<AutocompleteBloc>().add(AutocompleteViewClosed());
Navigator.of(context).pop();
},
),
viewOnChanged: (text) {
context.read<AutocompleteBloc>().add(AutocompleteTextChanged(text));
},
viewBuilder: (suggestions) {
return BlocBuilder<AutocompleteBloc, AutocompleteState>(
builder: (context, state) {
return MediaQuery.removePadding(
removeTop: true,
context: context,
child: ListView.builder(
itemCount: state.results.length,
itemBuilder: (context, index) {
return Text(state.results[index]);
},
),
);
},
);
},
suggestionsBuilder: (context, controller) => [],
builder: (context, controller) => IconButton(
icon: Icon(Icons.search),
onPressed: () async {
controller.openView();
},
),
); |
Thank you both, @felangel and @alexboulay, for your responses |
Description
How to use bloc with searchAnchor widget
suggestionsBuilder isnot update
here is the code
The text was updated successfully, but these errors were encountered: