Skip to content

Commit eae12d3

Browse files
committed
visual tweaking
1 parent 0c4289b commit eae12d3

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fn main() {
2-
slint_build::compile("ui/appwindow.slint").unwrap();
2+
let config = slint_build::CompilerConfiguration::new().with_style("fluent".into());
3+
slint_build::compile_with_config("ui/appwindow.slint", config).unwrap();
34
}

src/main.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn main() -> Result<(), slint::PlatformError> {
2222
set_config(config);
2323
let app = ui_handle.unwrap();
2424
if get_config().enabled {
25-
app.set_state("Stop".into())
25+
app.set_state("🚫".into())
2626
} else {
27-
app.set_state("Start".into())
27+
app.set_state("🚀".into())
2828
}
2929
}
3030
});
@@ -49,7 +49,6 @@ fn main() -> Result<(), slint::PlatformError> {
4949
str_seconds = "0".to_owned() + &*str_seconds
5050
}
5151

52-
println!("{:?}", time_seconds);
5352
slint::invoke_from_event_loop(move || {
5453
ui.unwrap()
5554
.set_time((str_minutes.to_string() + ":" + &*str_seconds).into())
@@ -67,7 +66,6 @@ fn main() -> Result<(), slint::PlatformError> {
6766
if str_seconds.len() < 2 {
6867
str_seconds = "0".to_owned() + &*str_seconds
6968
}
70-
println!("{:?}", time_seconds);
7169
slint::invoke_from_event_loop(move || {
7270
ui.unwrap()
7371
.set_time((str_minutes.to_string() + ":" + &*str_seconds).into())

ui/appwindow.slint

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
import { Button, VerticalBox } from "std-widgets.slint";
1+
import { Button } from "std-widgets.slint";
22
import "./assets/font.ttf";
33

44
export component AppWindow inherits Window {
55
width: 300px;
66
height: 400px;
77
in-out property <string> time: "25:00";
8-
in-out property <string> state: "Start";
8+
in-out property <string> state: "🚀";
99
callback start-timer();
10-
// VerticalLayout {
11-
Text {
12-
text: time;
13-
font-size: 70px;
14-
// y: 0px;
15-
font-family: "Bebas Neue";
16-
}
17-
Button {
18-
text: state;
19-
y: 250px;
20-
clicked => {start-timer()}
21-
}
10+
title: "Timer";
11+
Text {
12+
text: time;
13+
font-size: 70px;
14+
y: 150px;
15+
font-family: "Bebas Neue";
2216
}
23-
//}
2417

18+
Button {
19+
text: state;
20+
y: 250px;
21+
width: 100px;
22+
clicked => {
23+
start-timer()
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)