caduandrade / tabbed_view

Widget inspired by the classic Desktop-style tab component.
MIT License
51 stars 16 forks source link

Feature Request: Allow tab title to be a widget #25

Open ykrasik opened 1 year ago

ykrasik commented 1 year ago

Hi @caduandrade !

Just started using this package as well, thanks for the hard work and great job at making these libraries!

I'd like to request the ability to make the text title of the tab header a widget. The use case - I'd like to change the tab title based on some of the tab's content. It can be done easily if the title is a MobX Observer widget which renders a Text.

caduandrade commented 1 year ago

Hi @ykrasik! I know you from another package. :wink:

Maybe it could have a builder. I'm not sure if the layout would be redone correctly to fit the new text.

I'll take a look and make some tests. For now, if you need it, TabData is a ChangeNotifier that rebuilds TabbedView if you change the text of the tab.

ykrasik commented 1 year ago

On that note - it would also be helpful if TabbedViewController exposed a setTabs or replaceTabs method. Currently, it only offers addTab & removeTab, but I'd like to be able to make this component managed and store its state outside, and have a callback that would sync that state to the controller. Its a bit of work to achieve this with the only available operations being addTab, removeTab & set tabData.text. This would also cover the "tab title" usecase as I would just replace all tabs on any change to either of the tabs. As an optimization, it'd be nice if the controller could detect that and only update tabData that had changed.

caduandrade commented 1 year ago

Issue created: "Add setTabs method to TabbedViewController." #28