From 795f26873742eaad7ce53084052d988a0fd542f8 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 25 Aug 2023 15:13:25 +1000 Subject: Add placeholder settings UI --- src/ui/screen.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/ui/screen.cpp') diff --git a/src/ui/screen.cpp b/src/ui/screen.cpp index 039d2439..c9933042 100644 --- a/src/ui/screen.cpp +++ b/src/ui/screen.cpp @@ -57,4 +57,28 @@ auto Screen::CreateTopBar(lv_obj_t* parent, return top_bar_.get(); } +MenuScreen::MenuScreen(const std::string& title, bool show_back_button) + : Screen() { + lv_group_set_wrap(group_, false); + + lv_obj_set_layout(content_, LV_LAYOUT_FLEX); + lv_obj_set_flex_flow(content_, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_CENTER); + + widgets::TopBar::Configuration config{ + .show_back_button = show_back_button, + .title = title.c_str(), + }; + CreateTopBar(content_, config); + + content_ = lv_obj_create(content_); + lv_obj_set_flex_grow(content_, 1); + lv_obj_set_width(content_, lv_pct(100)); + lv_obj_set_layout(content_, LV_LAYOUT_FLEX); + lv_obj_set_flex_flow(content_, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, + LV_FLEX_ALIGN_START); +} + } // namespace ui -- cgit v1.2.3