调整调用和 layout
This commit is contained in:
@@ -2,22 +2,7 @@ import { ComponentConst, ScreenUtil, TitleBar } from '@devwiki/common_ui';
|
||||
import { TitleBarMenuType } from '@devwiki/common_ui/src/main/ets/component/TitleBar';
|
||||
import { WebPage } from './WebPage';
|
||||
import { window } from '@kit.ArkUI';
|
||||
|
||||
@CustomDialog
|
||||
struct WebViewDialog {
|
||||
|
||||
@StorageLink(ScreenUtil.isPortraitKey)isPortrait: boolean = true;
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: WebViewDialog({})
|
||||
});
|
||||
|
||||
build() {
|
||||
WebPage({onTitleBarLeftClick: ()=> {
|
||||
this.dialogController.close();
|
||||
}}).height(this.isPortrait ? '95%' : '100%').width(this.isPortrait ? '100%' : '50%')
|
||||
}
|
||||
}
|
||||
import { WebPageDialog } from './WebPageDialog'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@@ -26,15 +11,11 @@ struct Index {
|
||||
@State title: string = "Home";
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: WebViewDialog(),
|
||||
builder: WebPageDialog(),
|
||||
alignment: DialogAlignment.BottomEnd,
|
||||
customStyle: true
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
ScreenUtil.getInstance().initScreenSize();
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
ScreenUtil.getInstance().setPreferredOrientation(window.Orientation.AUTO_ROTATION);
|
||||
}
|
||||
@@ -45,6 +26,7 @@ struct Index {
|
||||
|
||||
onButtonClicked() {
|
||||
this.dialogController.open();
|
||||
getContext(this).filesDir
|
||||
|
||||
// router.pushUrl({
|
||||
// // 两种方式都可以加载Page, 一个是和 resources/base/profile/main_pages.ets中的配置相同
|
||||
@@ -56,6 +38,9 @@ struct Index {
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {}.width('100%')
|
||||
.backgroundColor('#F08080')
|
||||
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
|
||||
RelativeContainer() {
|
||||
TitleBar({
|
||||
title: this.title,
|
||||
|
15
app/src/main/ets/pages/WebPageDialog.ets
Normal file
15
app/src/main/ets/pages/WebPageDialog.ets
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ScreenUtil } from '@devwiki/common_ui/Index';
|
||||
import { WebPage } from './WebPage';
|
||||
|
||||
@CustomDialog
|
||||
export struct WebPageDialog {
|
||||
|
||||
@StorageLink(ScreenUtil.isPortraitKey)isPortrait: boolean = true;
|
||||
dialogController: CustomDialogController;
|
||||
|
||||
build() {
|
||||
WebPage({onTitleBarLeftClick: ()=> {
|
||||
this.dialogController.close();
|
||||
}}).height(this.isPortrait ? '95%' : '90%').width(this.isPortrait ? '100%' : '50%')
|
||||
}
|
||||
}
|
@@ -6,11 +6,18 @@ struct LinearLayoutPage {
|
||||
@State space: number = 10;
|
||||
|
||||
build() {
|
||||
Column({ space: this.space }) {
|
||||
Column({ space: '5' }) {
|
||||
Text(`space:${this.space}`)
|
||||
Row().width('90%')
|
||||
Row().width('90%')
|
||||
Row().width('90%')
|
||||
}
|
||||
Row({ space: this.space}){
|
||||
Column().height('100%').width('25%').backgroundColor("#ff5577")
|
||||
Column().height('100%').width('25%').backgroundColor("#ff5577")
|
||||
Column().height('100%').width('20%').backgroundColor("#ff5577")
|
||||
Column().height('100%').width('20%').backgroundColor("#ff5577")
|
||||
}.width('90%').height('10%').backgroundColor("#11ff4455")
|
||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||
}.height('100%').width('100%')
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user