1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { Theme } from "theme.slint";
5import { Navigation, MenuButton, MobileMenu, Value, IconButton } from "widgets/widgets.slint";
6import { Balance, Overview, Usage, UsageAdapter, Weather, MenuPage, MenuOverviewAdapter, About } from "pages/pages.slint";
7import { Images } from "images.slint";
8
9import { TabWidget, TabItem } from "widgets/widgets.slint";
10import { DashboardMobile, Weather, About } from "pages/pages.slint";
11import { MobileHeader } from "blocks/blocks.slint";
12import { MenuBackground } from "components/menu_background.slint";
13
14
15export component MobileMain {
16 tab-widget := TabWidget {
17 y: header.height + 16px;
18 width: 100%;
19 height: parent.height - header.height - 16px;
20 tabs: [
21 { text: "Dashboard", icon: Images.dashboard },
22 { text: "Weather", icon: Images.sunny },
23 { text: "About", icon: Images.information },
24 ];
25
26 DashboardMobile {
27 index: 0;
28 current-index: tab-widget.selected-tab;
29 }
30
31 Weather {
32 index: 1;
33 current-index: tab-widget.selected-tab;
34 }
35
36 About {
37 index: 2;
38 current-index: tab-widget.selected-tab;
39 }
40 }
41
42 menu := MobileMenu {
43 end-y: settings-button.y + settings-button.height;
44 menu-x: settings-button.x + settings-button.width - self.menu-width;
45 width: 100%;
46 height: 100%;
47
48 MenuPage {
49 width: 100%;
50 height: 100%;
51 }
52 }
53
54 header := MobileHeader {
55 width: 100%;
56 y: 0px;
57
58 HorizontalLayout {
59 alignment: start;
60 }
61
62 HorizontalLayout {
63 alignment: center;
64
65 Image {
66 horizontal-stretch: 1;
67 y: (parent.height - self.height) / 2;
68 height: 24px;
69 source: Images.slint-logo;
70 }
71 }
72
73 settings-button := IconButton {
74 y: (parent.height - self.height) / 2;
75 icon: Images.settings;
76
77 clicked => {
78 if (!menu.open) {
79 menu.open-menu();
80 return;
81 }
82 menu.hide();
83 }
84 }
85 }
86}
87