sergeyCodenameOne / UberEatsClone

Grub is an UberEats clone. A full-featured cross-platform food delivery app template in Java/Kotlin for Android, iOS, Desktop & Web.
Apache License 2.0
459 stars 225 forks source link

OrderModel #4

Open shannah opened 3 years ago

shannah commented 3 years ago

Conceptually there needs to be an OrderModel with the details of the order. This would include which dishes are being ordered, quantities, and add-on choices for the dish.

This will affect some aspect of the views. For example, the DishAddOnView has a boolean property isSelected that you track internally in the view and update when the button is selected/deselected. This state should be stored inside a model. Depending on how you want to design the model, you might have a "selected" property in the DishAddOn model and just bind on that.

If you find yourself adding state variables inside a View class (other than just to help with determining if it is in-sync with the model), then it is an indication that the model needs to be adjusted to store that state instead.