调整调用和 layout
This commit is contained in:
parent
498cdaedb1
commit
338b784b8b
@ -1,10 +1,17 @@
|
||||
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { window } from '@kit.ArkUI';
|
||||
import { ScreenUtil } from '@devwiki/common_ui/Index';
|
||||
|
||||
export default class AppAbility extends UIAbility {
|
||||
constructor() {
|
||||
super();
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability constructor');
|
||||
}
|
||||
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
ScreenUtil.getInstance().initScreenSize();
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
|
@ -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%')
|
||||
}
|
||||
}
|
4
app/src/main/ets/utils/ThemeManager.ets
Normal file
4
app/src/main/ets/utils/ThemeManager.ets
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
class ThemeManager {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user