// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 9.1.0
// Project name: your_chat_bot_WeChat

#include "../ui.h"

// COMPONENT usermsgcontainer

lv_obj_t * ui_usermsgcontainer_create(lv_obj_t * comp_parent)
{

    lv_obj_t * cui_usermsgcontainer;
    cui_usermsgcontainer = lv_obj_create(comp_parent);
    lv_obj_remove_style_all(cui_usermsgcontainer);
    lv_obj_set_width(cui_usermsgcontainer, lv_pct(98));
    lv_obj_set_height(cui_usermsgcontainer, LV_SIZE_CONTENT);    /// 1
    lv_obj_set_align(cui_usermsgcontainer, LV_ALIGN_TOP_MID);
    lv_obj_set_flex_flow(cui_usermsgcontainer, LV_FLEX_FLOW_ROW);
    lv_obj_set_flex_align(cui_usermsgcontainer, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
    lv_obj_remove_flag(cui_usermsgcontainer, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);      /// Flags
    lv_obj_set_style_pad_left(cui_usermsgcontainer, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(cui_usermsgcontainer, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(cui_usermsgcontainer, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(cui_usermsgcontainer, 8, LV_PART_MAIN | LV_STATE_DEFAULT);

    lv_obj_t * cui_user_msg;
    cui_user_msg = lv_label_create(cui_usermsgcontainer);
    lv_obj_set_width(cui_user_msg, lv_pct(85));
    lv_obj_set_height(cui_user_msg, LV_SIZE_CONTENT);    /// 1
    lv_obj_set_align(cui_user_msg, LV_ALIGN_CENTER);
    // Set font BEFORE text to ensure proper glyph caching
    lv_obj_set_style_text_font(cui_user_msg, &ui_font_puhui_18_2, LV_PART_MAIN | LV_STATE_DEFAULT);
    ui_object_set_themeable_style_property(cui_user_msg, LV_PART_MAIN | LV_STATE_DEFAULT, LV_STYLE_TEXT_COLOR,
                                           _ui_theme_color_PrimaryText);
    ui_object_set_themeable_style_property(cui_user_msg, LV_PART_MAIN | LV_STATE_DEFAULT, LV_STYLE_TEXT_OPA,
                                           _ui_theme_alpha_PrimaryText);
    lv_label_set_text(cui_user_msg, "Hi, Tuya!");
    lv_obj_set_style_radius(cui_user_msg, 12, LV_PART_MAIN | LV_STATE_DEFAULT);
    ui_object_set_themeable_style_property(cui_user_msg, LV_PART_MAIN | LV_STATE_DEFAULT, LV_STYLE_BG_COLOR,
                                           _ui_theme_color_statusBarBG);
    ui_object_set_themeable_style_property(cui_user_msg, LV_PART_MAIN | LV_STATE_DEFAULT, LV_STYLE_BG_OPA,
                                           _ui_theme_alpha_statusBarBG);
    lv_obj_set_style_shadow_width(cui_user_msg, 12, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_spread(cui_user_msg, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(cui_user_msg, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(cui_user_msg, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(cui_user_msg, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(cui_user_msg, 8, LV_PART_MAIN | LV_STATE_DEFAULT);

    lv_obj_t * cui_user_head;
    cui_user_head = lv_image_create(cui_usermsgcontainer);
    lv_image_set_src(cui_user_head, &ui_img_image_heads_user_24_png);
    lv_obj_set_width(cui_user_head, LV_SIZE_CONTENT);   /// 1
    lv_obj_set_height(cui_user_head, LV_SIZE_CONTENT);    /// 1
    lv_obj_set_align(cui_user_head, LV_ALIGN_CENTER);
    lv_obj_add_flag(cui_user_head, LV_OBJ_FLAG_CLICKABLE);     /// Flags
    lv_obj_remove_flag(cui_user_head, LV_OBJ_FLAG_SCROLLABLE);      /// Flags
    lv_obj_set_style_radius(cui_user_head, 32767, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(cui_user_head, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(cui_user_head, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(cui_user_head, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(cui_user_head, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(cui_user_head, 3, LV_PART_MAIN | LV_STATE_DEFAULT);

    lv_obj_t ** children = lv_malloc(sizeof(lv_obj_t *) * _UI_COMP_USERMSGCONTAINER_NUM);
    children[UI_COMP_USERMSGCONTAINER_USERMSGCONTAINER] = cui_usermsgcontainer;
    children[UI_COMP_USERMSGCONTAINER_USER_MSG] = cui_user_msg;
    children[UI_COMP_USERMSGCONTAINER_USER_HEAD] = cui_user_head;
    lv_obj_add_event_cb(cui_usermsgcontainer, get_component_child_event_cb, LV_EVENT_GET_COMP_CHILD, children);
    lv_obj_add_event_cb(cui_usermsgcontainer, del_component_child_event_cb, LV_EVENT_DELETE, children);
    ui_comp_usermsgcontainer_create_hook(cui_usermsgcontainer);
    return cui_usermsgcontainer;
}

