| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- import QtQuick
- import Felgo
- // ========== 启动过渡界面(纯色底 + "启动中...")==========
- // 用途:Qt 起来后、锁屏页出现之前的那一小段时间,显示纯色底 + 启动提示,
- // 避免"纯色空屏"看起来像卡死。
- //
- // 与上一版的差别:
- // · 上一版的退出条件是"最短 800ms + themeReady + navigation.count>0",任一不满足就顶到
- // 6 秒兜底,结果过渡界面盖住了本该立刻出现的锁屏页;
- // · 这里只等 themeReady(onInitTheme 在 App 创建时同步执行完,通常几十毫秒),
- // 最短 500ms、兜底 1.5 秒,绝不会长时间挡住界面。
- //
- // 只用 Rectangle / Text / 属性动画,不加载任何图片(res/mipmap/logo.png 是 TFLite 标志,不能用),
- // 不依赖 Material/控件实现差异,任何 Felgo 版本、任何设备都能稳定渲染。
- Item {
- id: splash
- property bool night: false // 跟随主题,夜间用深底避免"闪白"
- property string titleText: "植物病菌孢子捕捉分析系统"
- property string hintText: "启动中..." // 纯色底上的启动提示文字
- property string versionText: "" // 传空字符串则不显示版本
- readonly property color bgColor: night ? "#263238" : "#e8f5e9"
- readonly property color accentColor: night ? "#81c784" : "#2e7d32"
- readonly property color textColor: night ? "#ffffff" : "#1b1b1b"
- readonly property color subTextColor: night ? "#9e9e9e" : "#5f6368"
- readonly property color trackColor: night ? "#33ffffff" : "#26000000"
- // 盖住期间拦截所有触摸:过渡还没结束就点到下面的密码键盘会乱
- MouseArea {
- anchors.fill: parent
- }
- Rectangle {
- anchors.fill: parent
- color: splash.bgColor
- }
- Column {
- anchors.centerIn: parent
- width: Math.min(splash.width - dp(48), dp(560))
- spacing: dp(16)
- Text {
- width: parent.width
- text: splash.titleText
- color: splash.textColor
- font.pixelSize: dp(26)
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- wrapMode: Text.WordWrap
- }
- // 三点跳动:每个点错开 160ms,缩放 + 透明度同步变化
- Row {
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: dp(12)
- Repeater {
- model: 3
- Rectangle {
- width: dp(12)
- height: dp(12)
- radius: width / 2
- color: splash.accentColor
- SequentialAnimation on opacity {
- loops: Animation.Infinite
- running: splash.visible
- PauseAnimation { duration: index * 160 }
- NumberAnimation { from: 0.25; to: 1.0; duration: 320; easing.type: Easing.OutQuad }
- NumberAnimation { from: 1.0; to: 0.25; duration: 320; easing.type: Easing.InQuad }
- }
- SequentialAnimation on scale {
- loops: Animation.Infinite
- running: splash.visible
- PauseAnimation { duration: index * 160 }
- NumberAnimation { from: 0.75; to: 1.15; duration: 320; easing.type: Easing.OutQuad }
- NumberAnimation { from: 1.15; to: 0.75; duration: 320; easing.type: Easing.InQuad }
- }
- }
- }
- }
- // 进度条:一段高亮块在轨道里往返,比"静止的进度"更像在推进
- Rectangle {
- id: track
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width * 0.62
- height: dp(4)
- radius: height / 2
- color: splash.trackColor
- clip: true
- Rectangle {
- id: sweep
- width: track.width * 0.34
- height: track.height
- radius: track.radius
- color: splash.accentColor
- SequentialAnimation on x {
- loops: Animation.Infinite
- running: splash.visible
- NumberAnimation {
- from: 0
- to: track.width - sweep.width
- duration: 900
- easing.type: Easing.InOutQuad
- }
- NumberAnimation {
- to: 0
- duration: 900
- easing.type: Easing.InOutQuad
- }
- }
- }
- }
- Text {
- width: parent.width
- text: splash.hintText
- color: splash.subTextColor
- font.pixelSize: dp(16)
- horizontalAlignment: Text.AlignHCenter
- }
- }
- Text {
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- anchors.margins: dp(12)
- visible: splash.versionText !== ""
- text: "软件版本:" + splash.versionText
- color: splash.subTextColor
- font.pixelSize: dp(12)
- }
- }
|