Update the screen as needed

Description

Hello, I did not find something that helps me with my problem, I need to update the screen when I need it, for example

if(flag1){
    static lv_style_t style;
    lv_style_copy(&style, &lv_style_plain);
    style.line.color = LV_COLOR_MAKE(0xca, 0xca, 0x12);
    style.line.width = 9;
    lv_obj_t * arc = lv_arc_create(cont, NULL);
    lv_arc_set_style(arc, LV_ARC_STYLE_MAIN, &style);
    lv_arc_set_angles(arc, 90, 60);
    lv_obj_set_size(arc, 200, 200);
    lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);
}
else{
    static lv_style_t style;
    lv_style_copy(&style, &lv_style_plain);
    style.line.color = LV_COLOR_MAKE(0xca, 0xca, 0x12);
    style.line.width = 9;
    lv_obj_t * arc = lv_arc_create(cont, NULL);
    lv_arc_set_style(arc, LV_ARC_STYLE_MAIN, &style);
    lv_arc_set_angles(arc, 90, 60);
    lv_obj_set_size(arc, 200, 200);
    lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);

    lv_obj_t  *icon = lv_img_create(cont, NULL);
    lv_img_set_src(icon,var_icon);
    lv_obj_set_pos(icon, 0, 0);
    lv_obj_set_click(icon, false);
}

and when the flag1 ! = true
it does not switch to another condition, but if you delete the screen and re-enter it then everything is ok

What MCU/Processor/Board and compiler are you using?

ESP32

What LVGL version are you using?

V6.1.2

What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

 lv_refr_now(NULL);

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

All refreshing should be managed by LVGL in lv_task_handler.

Is lv_task_handler called when you expect refreshing? Alternatively, you can perform a refresh with lv_refr_now(NULL).