-
Notifications
You must be signed in to change notification settings - Fork 15
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
May I use a single big model object instead of many models? #9
Comments
Hi @suexcxine If by If you have much different screen sizes (e.g. mobile-web) then UI probably would be very different and you don't want to share much UI code between them. You can still share yore domain models and services instead, and also try to split your UI models into smaller parts which can be shared. Well, if I understood you correctly, then I don't see benefits from having ability to connect one |
Thank you for your reply. I want to reuse not only domain models and services, but the whole thing under UI layer.
And, I think UI should only show data from model with styles to users, dispatch user events to model, and reflecting data changes in the model if needed, and nothing else. so the whole thing under UI layer could be reused. This also means that some state in the view, such as which tab is now active, should not be included in the single model, because this tab may not exist in other platform, such as web platform. And, you said:
Could you write a simple example to show that one view could access two or more models' fields? Thank you! |
Could a ProgramWidget bind two or more models?
My view may corresponds to many models, for example, teacher's model, student's model,
If only one model could be bound to a ProgramWidget, although we can send msg(by msgsToBus) to each other, but how can we access other model's fields?
I saw in the examples models and views are one-to-one, if we want to share business code with web code(for example AngularDart), and web client's view is different from mobile client's view(for example search view and detail view are merged into one page), reuse model code will be somehow cumbersome(although possible).
So, IMHO, another way to go would be using only one big model, and bind that model to a root widget(MaterialApp ? ), so that we could access model's fields and dispatch messages from everywhere.
The text was updated successfully, but these errors were encountered: