Skip to content

Commit

Permalink
V0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
syf20020816 committed Jun 14, 2024
1 parent 5b34a09 commit 50ea8ea
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ And this template use `SurrealismUI` as default Component Library
| ------------ | ---------- |
| slint | 1.6.0 |
| rust | after 2021 |
| SurrealismUI | 0.4.5 |
| SurrealismUI | 0.5.0 |

## Recommend IDE

Expand Down
1 change: 1 addition & 0 deletions ui/modules/surrealism-ui/src/catalog/catalog.slint
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export component Catalog {
font-weight: root.font-wight;
font-family: root.font-family;
font-italic: root.font-italic;
wrap: TextWrap.no-wrap;
}
}
if item.show-right-icon: Rectangle {
Expand Down
1 change: 1 addition & 0 deletions ui/modules/surrealism-ui/src/checkbox/checkbox.slint
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export component Checkbox inherits Rectangle {
drop-shadow-offset-x: 0;
drop-shadow-offset-y: 0;
toucharea := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => {
if !disabled {
actived = !actived;
Expand Down
34 changes: 23 additions & 11 deletions ui/modules/surrealism-ui/src/collapse/item.slint
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ export component CollapseItem inherits Rectangle{
header.height
}
callback clicked();
init => {
details-view.height = 0;
}
// init => {
// details-view.height = 0;
// }
view:=VerticalLayout {
height: root.height;
width: header.width;
spacing: 0;
header:=SCard{
z: 11;
theme: root.theme;
card-width: root.width;
width: root.width;
card-height: root.header-height;
border-radius: 0;
padding-type: header-padding-type;
Expand All @@ -87,13 +87,21 @@ export component CollapseItem inherits Rectangle{
clicked => {
root.is-show=!root.is-show;
if(is-show){
icon.source = UseIcons.icons.Down-one;
icon.rotation = {
rotation-angle: 90deg,
rotation-origin-x: icon.width / 2,
rotation-origin-y: icon.height / 2,
};
root.height = root.details-height;
details-view.height = root.height - header.height;
details-view.visible = true;

}else{
icon.source = UseIcons.icons.Right-one;
icon.rotation = {
rotation-angle: 0deg,
rotation-origin-x: icon.width / 2,
rotation-origin-y: icon.height / 2,
};
root.height = header.height;
details-view.height = 0;
details-view.visible = false;
Expand All @@ -114,9 +122,9 @@ export component CollapseItem inherits Rectangle{
font-italic: root.font-italic;
font-size: root.font-size;
}
icon-view:=Rectangle{
icon-view:= Rectangle{
width:icon.width ;
icon:=SIcon {
icon:= SIcon {
colorize: self.get-colorize();
theme: root.theme;
height: 16px;
Expand All @@ -129,16 +137,20 @@ export component CollapseItem inherits Rectangle{
}
}
}
details-view:=SCard{
card-height: root.details-height;
card-width: header.card-width;
details-view:= SCard{
height: root.is-show ? root.details-height : 0;
width: header.width;
visible: false;
border-radius: 0;
drop-shadow-blur: 0;
theme: root.theme;
padding-type: details-padding-type;
shadow-type: details-shadow-type;
border-type: details-border-type;
animate height {
easing: ROOT-STYLES.sur-an-easing;
duration: ROOT-STYLES.sur-an-duration;
}
@children
}
}
Expand Down
4 changes: 4 additions & 0 deletions ui/modules/surrealism-ui/src/icon/icon.slint
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export component Icon{
source-clip-y: root.source-clip-y;
height: root.height;
width: root.width;
animate rotation-angle {
easing: ROOT-STYLES.sur-an-easing;
duration: ROOT-STYLES.sur-an-duration;
}
}
clicked => {
root.clicked();
Expand Down
1 change: 1 addition & 0 deletions ui/modules/surrealism-ui/src/radio/radio.slint
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export component Radio inherits Rectangle {
drop-shadow-offset-x: 0;
drop-shadow-offset-y: 0;
touch-area := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => {
actived = !actived;
root.clicked(root.text,root.value,root.actived);
Expand Down
1 change: 1 addition & 0 deletions ui/modules/surrealism-ui/src/switch/switch_group.slint
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export component SwitchGroup inherits SCard {
font-family: root.font-family;
text: item.label;
theme: root.theme;
wrap: TextWrap.no-wrap;
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion ui/modules/surrealism-ui/src/tabbar/tabbar.slint
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* ## functions
* ## callbacks
* - callback change(MenuData): This callback is triggered when the active tab is changed.
* - callback clicked(MenuData): This callback is triggered when a tab item is clicked.
* ============================================
*/
import { SCard } from "../card/index.slint";
Expand All @@ -34,7 +35,7 @@ export component Tabbar inherits SCard {
in-out property <int> active: 0;
in property <bool> show-text: true;
callback change(MenuData);

callback clicked(MenuData);
bar-area:= TouchArea {}
HorizontalLayout {
width: root.width;
Expand All @@ -55,6 +56,7 @@ export component Tabbar inherits SCard {
width: root.tab-size;
source: item.icon;
clicked => {
root.clicked(item);
if root.active != item.id.to-float() {
root.active = item.id.to-float();
root.change(item);
Expand Down
2 changes: 1 addition & 1 deletion ui/modules/surrealism-ui/surrealism-ui.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "surrealism-ui"
version = "0.4.5"
version = "0.5.0"
edition = "2024"
description = "SurrealismUI is a third-party component library built entirely using Slint"
authors = ["syf20020816@outlook.com"]
Expand Down

0 comments on commit 50ea8ea

Please sign in to comment.