调整调用和 layout
This commit is contained in:
parent
498cdaedb1
commit
338b784b8b
@ -1,10 +1,17 @@
|
|||||||
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
|
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
|
||||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||||
import { window } from '@kit.ArkUI';
|
import { window } from '@kit.ArkUI';
|
||||||
|
import { ScreenUtil } from '@devwiki/common_ui/Index';
|
||||||
|
|
||||||
export default class AppAbility extends UIAbility {
|
export default class AppAbility extends UIAbility {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability constructor');
|
||||||
|
}
|
||||||
|
|
||||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||||
|
ScreenUtil.getInstance().initScreenSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(): void {
|
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 { TitleBarMenuType } from '@devwiki/common_ui/src/main/ets/component/TitleBar';
|
||||||
import { WebPage } from './WebPage';
|
import { WebPage } from './WebPage';
|
||||||
import { window } from '@kit.ArkUI';
|
import { window } from '@kit.ArkUI';
|
||||||
|
import { WebPageDialog } from './WebPageDialog'
|
||||||
@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%')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -26,15 +11,11 @@ struct Index {
|
|||||||
@State title: string = "Home";
|
@State title: string = "Home";
|
||||||
|
|
||||||
dialogController: CustomDialogController = new CustomDialogController({
|
dialogController: CustomDialogController = new CustomDialogController({
|
||||||
builder: WebViewDialog(),
|
builder: WebPageDialog(),
|
||||||
alignment: DialogAlignment.BottomEnd,
|
alignment: DialogAlignment.BottomEnd,
|
||||||
customStyle: true
|
customStyle: true
|
||||||
})
|
})
|
||||||
|
|
||||||
aboutToAppear(): void {
|
|
||||||
ScreenUtil.getInstance().initScreenSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
onPageShow(): void {
|
onPageShow(): void {
|
||||||
ScreenUtil.getInstance().setPreferredOrientation(window.Orientation.AUTO_ROTATION);
|
ScreenUtil.getInstance().setPreferredOrientation(window.Orientation.AUTO_ROTATION);
|
||||||
}
|
}
|
||||||
@ -45,6 +26,7 @@ struct Index {
|
|||||||
|
|
||||||
onButtonClicked() {
|
onButtonClicked() {
|
||||||
this.dialogController.open();
|
this.dialogController.open();
|
||||||
|
getContext(this).filesDir
|
||||||
|
|
||||||
// router.pushUrl({
|
// router.pushUrl({
|
||||||
// // 两种方式都可以加载Page, 一个是和 resources/base/profile/main_pages.ets中的配置相同
|
// // 两种方式都可以加载Page, 一个是和 resources/base/profile/main_pages.ets中的配置相同
|
||||||
@ -56,6 +38,9 @@ struct Index {
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
|
Row() {}.width('100%')
|
||||||
|
.backgroundColor('#F08080')
|
||||||
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
|
||||||
RelativeContainer() {
|
RelativeContainer() {
|
||||||
TitleBar({
|
TitleBar({
|
||||||
title: this.title,
|
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;
|
@State space: number = 10;
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column({ space: this.space }) {
|
Column({ space: '5' }) {
|
||||||
Text(`space:${this.space}`)
|
Text(`space:${this.space}`)
|
||||||
Row().width('90%')
|
Row({ space: this.space}){
|
||||||
Row().width('90%')
|
Column().height('100%').width('25%').backgroundColor("#ff5577")
|
||||||
Row().width('90%')
|
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