基础布局

这个提交包含在:
徐勤民 2024-10-15 20:27:59 +08:00
父节点 348174c4c8
当前提交 82e14a060b
共有 7 个文件被更改,包括 81 次插入15 次删除

查看文件

@ -43,6 +43,7 @@ export { WindowHelper } from './src/main/ets/utils/WindowHelper'
* 自定义view * 自定义view
*/ */
export { LoadingView } from './src/main/ets/view/LoadingView' export { LoadingView } from './src/main/ets/view/LoadingView'
export { SafeView } from './src/main/ets/view/SafeView'
/** /**
* 自定义view * 自定义view
*/ */

查看文件

@ -1,30 +1,95 @@
import { WindowHelper } from '../utils/WindowHelper'
import { inputMethod } from '@kit.IMEKit'
@Preview @Preview
@Component @Component
export struct SafeView { export struct SafeView {
@Consume('pageInfos') pageInfos?: NavPathStack
@Link isLoading: boolean @Link isLoading: boolean
@State _titleText: ResourceStr=''
private _onBackEvent?: () => void
@Builder @Builder
doNothingBuilder() { doNothingBuilder() {
} }
onBack(event: () => void) {
this._onBackEvent = event
return this
}
titleText(title: ResourceStr) {
this._titleText = title
return this
}
@BuilderParam customBuilderParam: () => void = this.doNothingBuilder @BuilderParam customBuilderParam: () => void = this.doNothingBuilder
build() { build() {
Stack() { NavDestination() {
this.customBuilderParam() Stack() {
Column() { Column() {
LoadingProgress() Row()
.color(Color.White) .height(WindowHelper.topRectHeight)
.width(80).height(80) .width('100%')
Text('努力加载中..') .backgroundColor('#999999')
.fontSize(16) Row() {
.fontColor(Color.White)
Image($r("app.media.base_back"))
.height(15)
.onClick(() => {
if (this._onBackEvent) {
this._onBackEvent()
} else if (this.pageInfos) {
this.pageInfos.pop()
}
})
Text(this._titleText ?? '')
.maxLines(1)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
Row() {
}
}
.justifyContent(FlexAlign.SpaceBetween)
.padding({
left: 15,
right: 15
})
.height(44)
.width('100%')
this.customBuilderParam()
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
Column() {
LoadingProgress()
.color(Color.White)
.width(80).height(80)
Text('努力加载中..')
.fontSize(16)
.fontColor(Color.White)
}
.visibility(this.isLoading ? Visibility.Visible : Visibility.None)
.width('100%')
.height('100%')
.backgroundColor('#40000000')
.justifyContent(FlexAlign.Center)
} }
.visibility(this.isLoading ? Visibility.Visible : Visibility.None) }.onClick(() => {
.width('100%') inputMethod.getController().stopInputSession()
.height('100%') })
.backgroundColor('#40000000') .hideTitleBar(true)
.justifyContent(FlexAlign.Center) .width('100%')
} .height('100%')
} }
} }

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 274 B

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 438 B

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 536 B

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 922 B

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 1.0 KiB