Optimize View creation

This commit is contained in:
estevez 2018-09-28 11:23:48 +03:00
parent 49444ab3df
commit b935a0e372

View File

@ -19,22 +19,15 @@ class UIBuilder {
void build(EntityCollection entitiesCollection) {
_entities = entitiesCollection;
_views.clear();
_createViewsContainers(entitiesCollection.viewList);
_createViews(entitiesCollection.viewList);
}
void _createViewsContainers(List<String> viewsList) {
void _createViews(List<String> viewsList) {
int counter = 0;
viewsList.forEach((viewId) {
counter += 1;
_views[viewId] = View(viewId, counter);
});
//TODO merge this two func into one
_createViews();
}
View view = View(viewId, counter);
void _createViews() {
TheLogger.log("Debug","Gethering views");
_views.forEach((viewId, view) { //Each view
try {
Entity viewGroupEntity = _entities.get(viewId);
viewGroupEntity.childEntities.forEach((
@ -48,6 +41,8 @@ class UIBuilder {
} catch (error) {
TheLogger.log("Error","Error parsing view: $viewId");
}
_views[viewId] = view;
});
}