Elementary-team / flutter-elementary

This is a home to a family of Elementary library packages.
MIT License
127 stars 43 forks source link

Passing arguments in widgets #63

Closed meg4cyberc4t closed 2 years ago

meg4cyberc4t commented 2 years ago

Hello everyone.

I have a question, is it possible to implement a function to pass arguments to screens?

Now I can pass at the Widget stage, but not with the MWWM or Model constructor. I need to interact with the data in initState, but it's only in MWWM.

Thanks!

MbIXjkee commented 2 years ago

Hi! One thing to take into attention, this is Elementary package, not an mwwm.

Do I right understand, that you need to use some outer argument, which passed from another place? For this case, you can pass the argument to the Widget, because WidgetModel has access to relative Widget, you can use it inside WidgetModel by the widget property. If the relative widget will change, you can handle it inside the method didUpdateWidget. And of course, in all these methods you can proxy all you need to the Model.

If I misunderstand something, please give more details.

meg4cyberc4t commented 2 years ago

Everything is cool, thank you!