feat(layout): add deferred layout recalculation

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-03 20:15:21 +01:00
parent 3ecf550bcd
commit 0d38d100c2
9 changed files with 93 additions and 55 deletions

View File

@@ -11,8 +11,13 @@ static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e)
lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt);
lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf, NULL);
btn_cnt++;
lv_obj_scroll_to_view(list_btn, LV_ANIM_ON);
lv_obj_move_foreground(float_btn);
/* Layouts are only recalculated later but we need to know the updated position of the new button
* to scroll to it. */
lv_obj_update_layout(list);
lv_obj_scroll_to_view(list_btn, LV_ANIM_ON);
}
}