PartsRS/ui/main.slint
2025-11-07 14:04:55 +01:00

61 lines
No EOL
1.7 KiB
Text

import { HorizontalBox, VerticalBox } from "std-widgets.slint";
import { NavigationRail } from "@material";
import { Icons } from "../material-1.0/ui/icons/icons.slint";
import { MaterialWindow } from "../material-1.0/material.slint";
import { ViewHome } from "home.slint";
export { MaterialWindowAdapter } from "@material";
export component MainWindow inherits MaterialWindow {
in-out property <int> current_view: 0;
callback navigate(int);
preferred-width: 1000px;
preferred-height: 700px;
title: "PartsRS";
HorizontalBox {
NavigationRail {
width: 80px;
index_changed(index) => {
root.current_view = index;
root.navigate(index)
}
items: [
{
icon: Icons.home,
text: "Home"
},
{
icon: Icons.list_box,
text: "Parts"
},
{
icon: Icons.shape,
text: "Categories"
},
{
icon: Icons.package_variant,
text: "Locations"
},
{
icon: Icons.cog,
text: "Settings"
}
];
}
VerticalBox {
if root.current_view == 0: ViewHome {}
if root.current_view == 1: Text { text: "parts"; }
if root.current_view == 2: Text { text: "categories"; }
if root.current_view == 3: Text { text: "locations"; }
if root.current_view == 4: Text { text: "settings"; }
}
}
}
export global NavigationLogic {
callback navigate(int);
}