acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_flex_2.c (928B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_FLEX && LV_BUILD_EXAMPLES
      3 
      4 /**
      5  * Arrange items in rows with wrap and place the items to get even space around them.
      6  */
      7 void lv_example_flex_2(void)
      8 {
      9     static lv_style_t style;
     10     lv_style_init(&style);
     11     lv_style_set_flex_flow(&style, LV_FLEX_FLOW_ROW_WRAP);
     12     lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY);
     13     lv_style_set_layout(&style, LV_LAYOUT_FLEX);
     14 
     15     lv_obj_t * cont = lv_obj_create(lv_scr_act());
     16     lv_obj_set_size(cont, 300, 220);
     17     lv_obj_center(cont);
     18     lv_obj_add_style(cont, &style, 0);
     19 
     20     uint32_t i;
     21     for(i = 0; i < 8; i++) {
     22         lv_obj_t * obj = lv_obj_create(cont);
     23         lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
     24         lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE);
     25 
     26         lv_obj_t * label = lv_label_create(obj);
     27         lv_label_set_text_fmt(label, "%"LV_PRIu32, i);
     28         lv_obj_center(label);
     29     }
     30 }
     31 
     32 #endif