Phase 3: reusable UI widgets (tile_button, back_button) + screen_base lifecycle

- tile_button: large touch tile with accent bg + title + icon + value,
  fires LV_EVENT_CLICKED (for home screen tiles)
- back_button: fixed bottom-left Zurueck button (LV_SYMBOL_LEFT),
  large touch target, reused on all detail screens
- screen_base.h: Screen struct with create/show/hide/refresh/tick
  lifecycle around an lv_obj_t root (replaces old ScreenId-only header)
- lv_conf.h: enable Montserrat 16/20/24 fonts used by the widgets
This commit is contained in:
2026-08-02 10:32:29 +02:00
parent 4a9b462cea
commit 14e1b4f7af
6 changed files with 163 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
#include "back_button.h"
#include <theme.h>
lv_obj_t *back_button_create(lv_obj_t *parent, lv_event_cb_t on_click,
void *user_data) {
lv_obj_t *btn = lv_button_create(parent);
// Fixed at bottom-left, large enough to be a reliable touch target.
lv_obj_set_pos(btn, 12, 480 - 12 - 60);
lv_obj_set_size(btn, 100, 60);
lv_obj_set_style_bg_color(btn, Theme::bgCard(), 0);
lv_obj_set_style_bg_opa(btn, LV_OPA_COVER, 0);
lv_obj_set_style_border_width(btn, 0, 0);
lv_obj_set_style_radius(btn, 14, 0);
lv_obj_t *label = lv_label_create(btn);
lv_label_set_text(label, LV_SYMBOL_LEFT " Zurueck");
lv_obj_set_style_text_color(label, Theme::text(), 0);
lv_obj_center(label);
if (on_click) {
lv_obj_add_event_cb(btn, on_click, LV_EVENT_CLICKED, user_data);
}
return btn;
}