Skip to content
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

Hide suggestions box completely #29

Closed
fsobanski opened this issue Jan 23, 2019 · 16 comments
Closed

Hide suggestions box completely #29

fsobanski opened this issue Jan 23, 2019 · 16 comments

Comments

@fsobanski
Copy link

Is there a way to hide the suggestions box completely if no suggestions have been found? When I use noItemsFoundBuilder: (context) => Container(), I still get the empty box.

@AbdulRahmanAlHamali
Copy link
Owner

Hello @fsobanski, thank you for reporting the issue!

@sjmcdowall @KaYBlitZ we can maybe provide a parameter hideOnEmpty? What do you guys think?

@fsobanski
Copy link
Author

fsobanski commented Jan 24, 2019 via email

@sjmcdowall
Copy link
Collaborator

sjmcdowall commented Jan 24, 2019 via email

@KaYBlitZ
Copy link
Contributor

I believe he means the circle progress indicator that is shown in the suggestions list. It is used when fetching the suggestions take a while.

@fsobanski
Copy link
Author

Exactly. The widget that can be controlled via loadingBuilder.

@AbdulRahmanAlHamali
Copy link
Owner

OK so we can add three parameters: hideOnLoading, hideOnEmpty and hideOnError. We look at each of these parameters in their respective "if" branch in the build function, and we return Container() if the corresponding parameter is set to true.

@fsobanski interested in submitting a pull request? It should be fairly straight forward :)

@sjmcdowall
Copy link
Collaborator

@AbdulRahmanAlHamali -- Ok, those use case requirements seem clear enough now. If @fsobanski isn't/can't do it -- I can attack it this weekend.

@sjmcdowall sjmcdowall mentioned this issue Jan 25, 2019
@sjmcdowall
Copy link
Collaborator

So -- I am gathering @fsobanski isn't interested in doing a PR? :) I am busy tonight but unless I hear otherwise I'll give this a shot tomorrow

@AbdulRahmanAlHamali
Copy link
Owner

@sjmcdowall Go for it! 💪

@KaYBlitZ
Copy link
Contributor

KaYBlitZ commented Feb 4, 2019

So I took a look at this and I believe everything is working as intended. @fsobanski You used an empty Container() to try to create an empty widget, but looking at the doc: https://docs.flutter.io/flutter/widgets/Container-class.html , it says "Containers with no children try to be as big as possible" which is why we get the empty box displayed since the Container is expanding and taking up space. If you use Container(height: 0) everything works as you intended. There will be no loading box or no items found box.

What do you guys think? I don't think we need to introduce any new code.

@fsobanski
Copy link
Author

Sorry, my mistake. Thank you for taking the time. I didn't think enough about the problem.

@AbdulRahmanAlHamali
Copy link
Owner

Oh I see, well noted @KaYBlitZ! but I think it would be easier and more convenient for the users of the package to just set a parameter to true or false, instead of having to override the builders. What do you think?

@KaYBlitZ
Copy link
Contributor

KaYBlitZ commented Feb 5, 2019

It would definitely be easier. I can see this being an issue again in the future. I will work on the PR.

@KaYBlitZ
Copy link
Contributor

KaYBlitZ commented Feb 7, 2019

Added and published! We are officially version 1.0.1!

@KaYBlitZ KaYBlitZ closed this as completed Feb 7, 2019
@sjmcdowall
Copy link
Collaborator

Nice!! WOOHOO!

@AbdulRahmanAlHamali
Copy link
Owner

👏 👏 👏 👏 👏 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants