Skip to content

Commit

Permalink
[*] improve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
heng30 committed Apr 10, 2024
1 parent 8fea6cf commit 84436e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
15 changes: 12 additions & 3 deletions ui/base/radio-btn.slint
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Theme } from "../theme.slint";
import { Label } from "./label.slint";
import { Palette } from "std-widgets.slint";

export component RadioBtn inherits Rectangle {
in-out property text <=> txt.text;
Expand All @@ -11,23 +12,31 @@ export component RadioBtn inherits Rectangle {

callback check();

Rectangle {
x: hbox.x - (self.width - inner.width) / 2;
width: inner.width + Theme.spacing * 4;
height: self.width;
border-radius: self.width / 2;
background: ta.has-hover ? Palette.background : Colors.transparent;
}

hbox := HorizontalLayout {
spacing: Theme.spacing * 4;
alignment: start;

VerticalLayout {
alignment: center;
Rectangle {
inner := Rectangle {
width: Theme.default-font-size * 1.1;
height: self.width;
border-width: 2px;
border-radius: self.width / 2;
border-color: root.checked ? Theme.brand-color : Theme.secondary-text-color;
border-color: root.checked ? Palette.accent-background : Theme.secondary-text-color;

if root.checked : Rectangle {
width: 60%;
height: self.width;
background: Theme.brand-color;
background: parent.border-color;
border-radius: self.width / 2;
}
}
Expand Down
16 changes: 3 additions & 13 deletions ui/base/txtedit.slint
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TextEdit } from "std-widgets.slint";
import { TextEdit, Palette } from "std-widgets.slint";
import { Theme } from "../theme.slint";

export component TxtEdit inherits Rectangle {
clip: true;
forward-focus: edit;
border-width: 1px;
border-width: edit.has-focus ? 2px : 1px;
border-radius: Theme.border-radius;
border-color: edit.has-focus ? Theme.brand-color : Theme.placeholder-text-color;
border-color: edit.has-focus ? Palette.accent-background : Palette.border;

in-out property text <=> edit.text;
callback edited <=> edit.edited;
Expand All @@ -22,15 +22,5 @@ export component TxtEdit inherits Rectangle {
edit := TextEdit {
font-size: Theme.default-font-size;
}

// Flickable {
// viewport-height: edit.preferred-height;

// edit := TextInput {
// font-size: Theme.default-font-size;
// single-line: false;
// wrap: word-wrap;
// }
// }
}
}

0 comments on commit 84436e3

Please sign in to comment.