eric-taix / fluid-nav-bar

A flutter fluid bottom navigation bar
MIT License
27 stars 34 forks source link

Controlled Widget #17

Open cstsortan opened 4 years ago

cstsortan commented 4 years ago

it would be much better if it could be refactored into a controlled widget with a property like currentIndex, where setState() would trigger the animation etc. and not internally through tap

eric-taix commented 4 years ago

I agree, many users would like to have a controller. I will try to take some time to add it in a future version.

cstsortan commented 4 years ago

I don't mean a controller, I mean a property that will react to changes reactively

eric-taix commented 4 years ago

But doesn't a controller would do this job? In Flutter controllers aim to control behaviour of the widget no?

cstsortan commented 4 years ago

Yes if that's easier to implement. But controlling the widget with a property through setState(), is the right way for a reactive framework, cause maybe the developer is using a global state container like redux, and doesn't want to expose the entire controller object, which is tightly coupled with the widget itself. Actually TextField should be working like that. No matter how convenient a Controller is, it's a pain in big apps

neffex97 commented 3 years ago

controller still not added? i need when user change page from drawer,bottombar also changed,so i think adding controller to this package would be good option