-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tabs widget #578
Comments
Yes! 🔥 😀 🎆 :DD
The actual 'evaluation' of widgets (the costly/slow/expensive bits) are in two function calls to the widget:
If your |
Could you elaborate? I like the idea of the In other words, I don't think a
I am sure many would find this widget useful (me included!). Feel free to open-source it! Not every widget needs to make it into the main library right from the start. |
This is wonderful! |
Thank you very much for your feedback! :) And I apologise for not responding until now.
Now that I've thought about it for a while, I think it's not that bad of an idea. Therefore I have decided to support both options. A TabBar Widget for a standalone TabBar and a Tabs Widget as a wrapper around the TabBar, which also handles the content (This makes the Tabs widget feel more familiar when coming from other UI frameworks).
I definately will! :) And I have more good news. I have received permission from my professor to implement further widgets as part of my study project. Accordingly, more widgets will follow and will be published as well. I will talk about it in the upcomming week.
Currently the close button will be on the right side (I've never seen the close icon on the left side before). As there are some users having problems with the SIL licence of the font/icon (#524) the user is able to set their own icon font.
This is currently not implemented. I'm trying to keep it simple first.
I like to have vertical tabs on my browser too, but this is currently not supported as well.
There is always a first time. I also learned a lot about Rust when I ventured into the TabBar. :) |
Closing since this is available in |
I've experimented with a Tabs widget recently for structuring the UI using tabs. This widget was inspired by the tabs of the ionic and flutter framework.
It is also possible to define a message for handling the closing of a tab. In this case there will be a small close icon rendered on the right of each tab.
Anyone interested in such kind of widget? :)
However, there is still one problem I wasn't able to solve. This problem is about the lazy evaluation of the content of a tab. For me, the content of the tab should only be created when the tab is visible. I tried two approaches of handling this:
A closure: This works fine unless you are trying to take a reference to the application data. (The reference may not live long enough)
A trait: This could work, but hiding the specific rendering backend from the user would lead to massive code duplication.
For now it is only a TabBar wigdet and the user would need to implement the logic of the content.
A small working example currently looks like this:
This isn't ideal and I don't like this much.
Maybe someone else with a better knowledge about Rust has an idea of how to solve this problem. What would be the drawback of just creating the content even if the tab is not selected?
The text was updated successfully, but these errors were encountered: