Flex grow in rotate


Hello, everyone
I set one of my parent objects to flex layout, and I set flex-grow to one of its children, other children have a fixed size.
when the display is not rotated the object that has a flex-grow layout has the correct size but when the display is rotated the size of the object is wrong.
I think the problem is from the line that is pointed out in the picture. In this line, the size of the cross size is equal to the last grow size of the object.

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

stm32h7b3/GCC compiler

What LVGL version are you using?


What have you tried so far?

when I want the rotate the display, I set the flex-grow value obj to zero and I started the timer that after a while set the grow value to one

Code to reproduce

static void refresh_object_size(void)
         lv_obj_set_flex_grow(object, 0);
	if(VER_ORIENTATION == rotate) {
		lv_obj_set_size(object, 370, 310);
	} else if(HOR_ORIENTATION == rotate) {
		lv_obj_set_size(object, 348, 290);

static void lvgl_timer_grow_object_callback(struct _lv_timer_t *timer)
	lv_obj_set_flex_grow(object, 1);

I think this is happening when the display is rotated:

Does anyone have any ideas?

Hello, everyone
I think, I found the problem.
When I set the grow layout to the object, the object.w_layout or object.h_layout properties of the object are set

First, the parent has a flex column and the child has the grow-layout so obj.h_layout = 1
When I rotate the display, the flex column is changed to row flex and we’ll have obj.w_layot =1.
Therefore both the obj.h_layout and the obj.w_layout are set to 1, On the other hand, when both the h_layout and w_layout are set, we can’t resize the obj. for example when the flex is flex row, I want to set the height of the object

for solving this problem when I want to rotate the display, I reset the obj.h_layout and obj.w_layout in my code. But I think this should be fixed in the LVGL code.
Maybe by changing to this:

if(f->row) {
   item->w_layout = 1;
   item->h_layout = 0;
} else {
    item->h_layout = 1;
    item->w_layout = 0;

@kisvegabor, what do you think? If you agree I can send a PR.

Nice catch and investigation, thank you!

I’ve fixed it as you suggested on both master and release/v8.3