From 5bffa0d87f4215a2dc62728dddb1009c6b3499cc Mon Sep 17 00:00:00 2001 From: Nixevol Date: Thu, 19 Nov 2026 15:57:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ListView=20=E6=AF=8F=E8=A1=8C=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E9=AB=98=E5=BA=A6=EF=BC=8C=E9=81=BF=E5=85=8D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=A0=E5=9C=A8=E4=B8=80=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/app.slint | 257 ++++++++++++++++++++++++--------------------------- 1 file changed, 121 insertions(+), 136 deletions(-) diff --git a/ui/app.slint b/ui/app.slint index 360b873..d557536 100644 --- a/ui/app.slint +++ b/ui/app.slint @@ -11,88 +11,85 @@ export struct DayRow { problem: bool, } -component Hairline inherits Rectangle { - height: 1px; - background: #e6e6e3; -} - -component DayBlock inherits VerticalLayout { +component DayBlock inherits Rectangle { in property day; - width: 100%; - padding-left: 24px; - padding-right: 24px; - padding-top: 16px; - padding-bottom: 16px; - spacing: 8px; - alignment: start; + height: 168px; + background: transparent; - HorizontalLayout { - width: 100%; - spacing: 16px; + VerticalLayout { + width: parent.width; + height: parent.height; + padding-left: 24px; + padding-right: 24px; + padding-top: 14px; + padding-bottom: 14px; + spacing: 8px; alignment: start; - Text { - text: day.date; - width: 56px; - font-size: 15px; - font-weight: 600; + HorizontalLayout { + spacing: 16px; + alignment: start; + + Text { + text: day.date; + width: 56px; + font-size: 15px; + font-weight: 600; + color: #1a1a1a; + horizontal-alignment: left; + } + Text { + text: day.time; + width: 112px; + font-size: 13px; + color: #6a6a6a; + horizontal-alignment: left; + } + Text { + text: day.hours; + width: 48px; + font-size: 13px; + color: #6a6a6a; + horizontal-alignment: left; + } + if day.mark != "": Text { + text: day.mark; + font-size: 13px; + color: #6a6a6a; + horizontal-alignment: left; + } + Rectangle { horizontal-stretch: 1; } + Text { + text: day.status; + min-width: 96px; + font-size: 13px; + color: day.problem ? #1a1a1a : #6a6a6a; + horizontal-alignment: right; + } + } + + if day.site != "": Text { + text: day.site; + wrap: word-wrap; + font-size: 12px; + color: #8a8a8a; + horizontal-alignment: left; + } + + if day.memo != "": Text { + text: day.memo; + wrap: word-wrap; + font-size: 14px; color: #1a1a1a; horizontal-alignment: left; - vertical-alignment: center; - } - Text { - text: day.time; - width: 112px; - font-size: 13px; - color: #6a6a6a; - horizontal-alignment: left; - vertical-alignment: center; - } - Text { - text: day.hours; - width: 48px; - font-size: 13px; - color: #6a6a6a; - horizontal-alignment: left; - vertical-alignment: center; - } - if day.mark != "": Text { - text: day.mark; - font-size: 13px; - color: #6a6a6a; - horizontal-alignment: left; - vertical-alignment: center; } + + Rectangle { vertical-stretch: 1; } + Rectangle { - horizontal-stretch: 1; - min-width: 0px; + height: 1px; + background: #e6e6e3; } - Text { - text: day.status; - min-width: 96px; - font-size: 13px; - color: day.problem ? #1a1a1a : #6a6a6a; - horizontal-alignment: right; - vertical-alignment: center; - } - } - - if day.site != "": Text { - text: day.site; - width: 100%; - wrap: word-wrap; - font-size: 12px; - color: #8a8a8a; - horizontal-alignment: left; - } - - if day.memo != "": Text { - text: day.memo; - width: 100%; - wrap: word-wrap; - font-size: 14px; - color: #1a1a1a; - horizontal-alignment: left; } } @@ -109,82 +106,70 @@ export component MainWindow inherits Window { default-font-family: "Segoe UI"; VerticalLayout { - width: 100%; - height: 100%; + padding: 0px; alignment: start; - HorizontalLayout { - width: 100%; + Rectangle { height: 52px; - padding-left: 24px; - padding-right: 24px; - spacing: 16px; - alignment: start; + background: #f7f7f5; + HorizontalLayout { + width: parent.width; + height: parent.height; + padding-left: 24px; + padding-right: 24px; + spacing: 16px; + alignment: start; - Text { - text: "打卡"; - font-size: 16px; - font-weight: 600; - color: #1a1a1a; - horizontal-alignment: left; - vertical-alignment: center; - } - Text { - text: root.range; - font-size: 13px; - color: #8a8a8a; - horizontal-alignment: left; - vertical-alignment: center; - } - Rectangle { - horizontal-stretch: 1; - min-width: 0px; - } - Text { - text: "刷新"; - font-size: 13px; - color: #1a1a1a; - horizontal-alignment: right; - vertical-alignment: center; - TouchArea { clicked => { root.refresh(); } } + Text { + text: "打卡"; + font-size: 16px; + font-weight: 600; + color: #1a1a1a; + vertical-alignment: center; + horizontal-alignment: left; + } + Text { + text: root.range; + font-size: 13px; + color: #8a8a8a; + vertical-alignment: center; + horizontal-alignment: left; + } + Rectangle { horizontal-stretch: 1; } + Text { + text: "刷新"; + font-size: 13px; + color: #1a1a1a; + vertical-alignment: center; + horizontal-alignment: right; + TouchArea { clicked => { root.refresh(); } } + } } } - Hairline {} - - if root.error != "": VerticalLayout { - width: 100%; - padding: 24px; - alignment: start; - Text { - text: root.error; - width: 100%; - wrap: word-wrap; - font-size: 14px; - color: #1a1a1a; - horizontal-alignment: left; - } + Rectangle { + height: 1px; + background: #e6e6e3; } - if root.error == "" && root.days.length == 0: VerticalLayout { - width: 100%; - padding: 24px; - alignment: start; - Text { - text: "这一周没有打卡记录。"; - font-size: 14px; - color: #8a8a8a; - horizontal-alignment: left; - } + if root.error != "": Text { + text: root.error; + wrap: word-wrap; + font-size: 14px; + color: #1a1a1a; + horizontal-alignment: left; + } + + if root.error == "" && root.days.length == 0: Text { + text: "这一周没有打卡记录。"; + font-size: 14px; + color: #8a8a8a; + horizontal-alignment: left; } if root.error == "" && root.days.length > 0: ListView { vertical-stretch: 1; - for day in root.days: VerticalLayout { - alignment: start; - DayBlock { day: day; } - Hairline {} - } + for day in root.days: DayBlock { day: day; } } } }