update asserts
This commit is contained in:
37
examples/layouts/flex/lv_example_flex.h
Normal file
37
examples/layouts/flex/lv_example_flex.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file lv_example_flex.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EX_FLEX_H
|
||||
#define LV_EX_FLEX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_FLEX_H*/
|
||||
43
examples/layouts/flex/lv_example_flex_1.c
Normal file
43
examples/layouts/flex/lv_example_flex_1.c
Normal file
@@ -0,0 +1,43 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * A simple row and a column layout with flexbox
|
||||
// */
|
||||
//void lv_example_flex_1(void)
|
||||
//{
|
||||
// /*Create a container with ROW flex direction*/
|
||||
// lv_obj_t * cont_row = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont_row, 300, 75);
|
||||
// lv_obj_align(cont_row, NULL, LV_ALIGN_IN_TOP_MID, 0, 5);
|
||||
// lv_obj_set_flex_dir(cont_row, LV_FLEX_DIR_ROW);
|
||||
// lv_obj_set_flex_gap(cont_row, 10);
|
||||
//
|
||||
// /*Create a container with COLUMN flex direction*/
|
||||
// lv_obj_t * cont_col = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont_col, 200, 150);
|
||||
// lv_obj_align(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
// lv_obj_set_flex_dir(cont_col, LV_FLEX_DIR_COLUMN);
|
||||
// lv_obj_set_flex_gap(cont_col, 10);
|
||||
//
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < 10; i++) {
|
||||
// /*Add items to the row*/
|
||||
// lv_obj_t * obj1 = lv_obj_create(cont_row, NULL);
|
||||
// lv_obj_set_size(obj1, 100, LV_COORD_PCT(100));
|
||||
// lv_obj_set_flex_item(obj1, true);
|
||||
//
|
||||
// lv_obj_t * label1 = lv_label_create(obj1, NULL);
|
||||
// lv_label_set_text_fmt(label1, "Item: %d", i);
|
||||
// lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
//
|
||||
// /*Add items to the column*/
|
||||
// lv_obj_t * obj2 = lv_obj_create(cont_col, NULL);
|
||||
// lv_obj_set_size(obj2, LV_COORD_PCT(100), LV_SIZE_AUTO);
|
||||
// lv_obj_set_flex_item(obj2, true);
|
||||
//
|
||||
// lv_obj_t * label3 = lv_label_create(obj2, NULL);
|
||||
// lv_label_set_text_fmt(label3, "Item: %d", i);
|
||||
// lv_obj_align(label3, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
24
examples/layouts/flex/lv_example_flex_2.c
Normal file
24
examples/layouts/flex/lv_example_flex_2.c
Normal file
@@ -0,0 +1,24 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Arrange items in column with wrap and place the row to get even space around them.
|
||||
// */
|
||||
//void lv_example_flex_2(void)
|
||||
//{
|
||||
// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont, 300, 220);
|
||||
// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP);
|
||||
// lv_obj_set_flex_place(cont, LV_FLEX_PLACE_START, LV_FLEX_PLACE_START);
|
||||
//
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < 3; i++) {
|
||||
// lv_obj_t * obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_flex_item_place(obj, LV_FLEX_PLACE_STRETCH);
|
||||
// lv_obj_set_size(obj, 70, LV_SIZE_AUTO);
|
||||
//
|
||||
// lv_obj_t * label = lv_label_create(obj, NULL);
|
||||
// lv_label_set_text_fmt(label, "%d", i);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
30
examples/layouts/flex/lv_example_flex_3.c
Normal file
30
examples/layouts/flex/lv_example_flex_3.c
Normal file
@@ -0,0 +1,30 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Arrange items in a row and demonstrate flex grow.
|
||||
// */
|
||||
//void lv_example_flex_3(void)
|
||||
//{
|
||||
// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont, 300, 220);
|
||||
// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_ROW);
|
||||
//
|
||||
// lv_obj_t * obj;
|
||||
// obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, 20, 20); /*Fix size*/
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, LV_FLEX_GROW(1), 30); /*1 portion from the free space*/
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, LV_FLEX_GROW(2), 40); /*2 portion from the free space*/
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, 20, 20); /*Fix size. It is flushed to the right by the "grow" items*/
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//}
|
||||
//
|
||||
24
examples/layouts/flex/lv_example_flex_4.c
Normal file
24
examples/layouts/flex/lv_example_flex_4.c
Normal file
@@ -0,0 +1,24 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Reverse the order of flex items
|
||||
// */
|
||||
//void lv_example_flex_4(void)
|
||||
//{
|
||||
// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont, 300, 220);
|
||||
// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP_REVERSE);
|
||||
// lv_obj_set_flex_gap(cont, 10);
|
||||
//
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < 20; i++) {
|
||||
// lv_obj_t * obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, 100, LV_SIZE_AUTO);
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// lv_obj_t * label = lv_label_create(obj, NULL);
|
||||
// lv_label_set_text_fmt(label, "Item: %d", i);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
28
examples/layouts/flex/lv_example_flex_5.c
Normal file
28
examples/layouts/flex/lv_example_flex_5.c
Normal file
@@ -0,0 +1,28 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * Demonstrate the effect of margin on flex item
|
||||
// */
|
||||
//void lv_example_flex_5(void)
|
||||
//{
|
||||
// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_size(cont, 300, 220);
|
||||
// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_ROW_WRAP);
|
||||
//
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < 20; i++) {
|
||||
// lv_obj_t * obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, 100, LV_SIZE_AUTO);
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// /*Set margin on every side*/
|
||||
// if(i == 4) {
|
||||
// lv_obj_set_style_local_margin_all(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 20);
|
||||
// }
|
||||
//
|
||||
// lv_obj_t * label = lv_label_create(obj, NULL);
|
||||
// lv_label_set_text_fmt(label, "Item:%d", i);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
25
examples/layouts/flex/lv_example_flex_6.c
Normal file
25
examples/layouts/flex/lv_example_flex_6.c
Normal file
@@ -0,0 +1,25 @@
|
||||
//#include "../../lv_examples.h"
|
||||
//
|
||||
///**
|
||||
// * RTL base direction changes order of the items.
|
||||
// */
|
||||
//void lv_example_flex_6(void)
|
||||
//{
|
||||
// lv_obj_t * cont = lv_obj_create(lv_scr_act(), NULL);
|
||||
// lv_obj_set_base_dir(cont, LV_BIDI_DIR_RTL);
|
||||
// lv_obj_set_size(cont, 300, 220);
|
||||
// lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// lv_obj_set_flex_dir(cont, LV_FLEX_DIR_COLUMN_WRAP);
|
||||
//
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < 20; i++) {
|
||||
// lv_obj_t * obj = lv_obj_create(cont, NULL);
|
||||
// lv_obj_set_size(obj, 80, LV_SIZE_AUTO);
|
||||
// lv_obj_set_flex_item(obj, true);
|
||||
//
|
||||
// lv_obj_t * label = lv_label_create(obj, NULL);
|
||||
// lv_label_set_text_fmt(label, "%d", i);
|
||||
// lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
Reference in New Issue
Block a user