diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 47f45eeeb..3f76bacc2 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -601,6 +601,10 @@ static void checkbox_init(void) lv_style_set_pattern_image(&cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK); lv_style_set_pattern_recolor(&cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); lv_style_set_text_font(&cb_bullet, LV_STATE_CHECKED, theme.font_small); + lv_style_set_pad_left(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3)); + lv_style_set_pad_right(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3)); + lv_style_set_pad_top(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3)); + lv_style_set_pad_bottom(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3)); #endif } diff --git a/src/lv_widgets/lv_checkbox.c b/src/lv_widgets/lv_checkbox.c index aa2256a40..c8e81038a 100644 --- a/src/lv_widgets/lv_checkbox.c +++ b/src/lv_widgets/lv_checkbox.c @@ -180,7 +180,12 @@ static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param if(sign == LV_SIGNAL_STYLE_CHG) { const lv_font_t * font = lv_obj_get_style_text_font(ext->label, LV_LABEL_PART_MAIN); lv_coord_t line_height = lv_font_get_line_height(font); - lv_obj_set_size(ext->bullet, line_height, line_height); + lv_coord_t leftp = lv_obj_get_style_pad_left(cb, LV_CHECKBOX_PART_BULLET); + lv_coord_t rightp = lv_obj_get_style_pad_right(cb, LV_CHECKBOX_PART_BULLET); + lv_coord_t topp = lv_obj_get_style_pad_top(cb, LV_CHECKBOX_PART_BULLET); + lv_coord_t bottomp = lv_obj_get_style_pad_bottom(cb, LV_CHECKBOX_PART_BULLET); + + lv_obj_set_size(ext->bullet, line_height + leftp + rightp, line_height + topp + bottomp); lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG)); } else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST ||