Compare commits

...
5 Commits
Author SHA1 Message Date
hulthe f11cb56c12 Replace grid hack with FlexBox for GoodButtons 2026-10-03 11:14:53 +02:00
hulthe e6024a06f6 Merge branch 'fix-ui-bug' 2026-10-03 10:53:11 +02:00
ide 05a7158ca1 removed swipe gesture handler 2026-10-03 10:51:11 +02:00
ide 3278169897 feature: possible to swipe between tabs and fix: ui bug 2026-10-03 10:51:04 +02:00
Ida Dahl ac4aaeaa9d Merge pull request #4 from hulthe/axum
Replace rocket with axum
2026-10-01 11:40:00 +02:00
3 changed files with 590 additions and 913 deletions

No files matched your search

Generated
+545 -876
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -39,7 +39,7 @@ serde_json = "1.0.148"
anyhow = "1.0.100"
[dependencies.slint]
version = "1.17.1"
version = "1.18.0"
default-features = false
features = [
"live-preview",
@@ -63,4 +63,4 @@ wasm-bindgen-futures = "0.4.56"
web-sys = "0.3.83"
[build-dependencies]
slint-build = "1.17.1"
slint-build = "1.18.0"
+43 -35
View File
@@ -9,12 +9,13 @@ import {
GridBox,
HorizontalBox,
ComboBox,
Palette, Spinner, SpinBox,
Palette,
Spinner,
SpinBox,
} from "std-widgets.slint";
import { SettingsView } from "settings.slint";
import { ConnectionStatus, State, SItem, SButtonItem } from "state.slint";
export { ConnectionStatus, State, SItem }
component GoodListItem inherits Rectangle {
in-out property <SItem> item;
background: Palette.alternate-background;
@@ -185,19 +186,21 @@ component GoodButtons inherits ScrollView {
property <int> count-x: floor(root.width / (button-min-width + button-spacing));
property <int> count-y: ceil(State.favorites.length / count-x);
property <length> button-width: ((self.width + button-spacing ) / count-x) - button-spacing;
property <length> button-width: ((root.width + button-spacing) / count-x) - button-spacing;
viewport-height: (count-y * (button-height + button-spacing));
content-height: (count-y * (button-height + button-spacing));
mouse-drag-pan-enabled: true;
vertical-scrollbar-policy: always-off;
for item[idx] in State.favorites: Button {
x: floor(mod(idx, count-x)) * (root.button-width + root.button-spacing);
y: floor(idx / count-x) * (root.button-height + root.button-spacing);
width: root.button-width;
height: root.button-height;
text: item.name;
clicked => {
State.add-to-list(item.name);
FlexboxLayout {
spacing: button-spacing;
for item in State.favorites: Button {
width: root.button-width;
height: root.button-height;
text: item.name;
clicked => {
State.add-to-list(item.name);
}
}
}
}
@@ -225,7 +228,7 @@ component ConnStatusIndicator inherits Rectangle {
}
component RefreshButton inherits HorizontalLayout {
spacing: 8px;
spacing: 8px;
alignment: center;
Button {
text: "Refresh";
@@ -234,6 +237,7 @@ component RefreshButton inherits HorizontalLayout {
State.refresh-list();
}
}
ConnStatusIndicator { }
}
@@ -243,7 +247,7 @@ component AddView inherits VerticalLayout {
padding: 8px;
spacing: 8px;
RefreshButton {}
RefreshButton { }
goods := GoodsListAdd {
items <=> list;
@@ -281,24 +285,25 @@ component AddView inherits VerticalLayout {
GoodButtons { }
}
component ShopView inherits VerticalLayout {
component ShopView inherits ScrollView {
in property <[SItem]> list;
mouse-drag-pan-enabled: true;
VerticalLayout {
RefreshButton { }
padding: 8px;
spacing: 8px;
padding: 8px;
spacing: 8px;
goods := GoodsList {
items <=> list;
}
RefreshButton { }
goods := GoodsList {
items <=> list;
}
HorizontalLayout {
padding: 12px;
Button {
text: "I am done hehe";
clicked => {
State.delete-checked();
HorizontalLayout {
padding: 12px;
Button {
text: "I am done hehe";
clicked => {
State.delete-checked();
}
}
}
}
@@ -322,23 +327,26 @@ component CatItem inherits HorizontalBox {
}
component CatView inherits VerticalLayout {
component CatView inherits ScrollView {
in-out property <[SButtonItem]> cats;
for item in cats: CatItem {
item: item;
mouse-drag-pan-enabled: true;
VerticalLayout {
for item in cats: CatItem {
item: item;
}
}
}
export component App inherits Window {
in property <int> prefered-start-tab: 0;
title: "Inköpslista";
icon: @image-url("../images/icon.svg");
preferred-height: 700px;
preferred-width: 480px;
TabWidget {
tabs := TabWidget {
current-index: prefered-start-tab;
Tab {
title: "Add";
AddView {