From 787f8465ad9c342ce185201dcdb9c91d050ab115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=B8=8C=E7=A6=B9?= <1532141002@qq.com> Date: Thu, 19 Jun 2025 17:40:19 +0800 Subject: [PATCH 1/3] add ux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 赵希禹 <1532141002@qq.com> --- .../src/main/ets/pages/ConfirmDialog.ets | 509 +++++++++--------- 1 file changed, 259 insertions(+), 250 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index e4c67dc9b..0203037ef 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -268,13 +268,13 @@ struct ConfirmCustomDialog { this.marginValue = 0; } else if (this.fontSizeScale === 1.75) { this.fontSize = '35vp'; - this.marginValue = 16; + this.marginValue = 5; } else if (this.fontSizeScale === 2) { this.fontSize = '40vp'; - this.marginValue = 20; + this.marginValue = 9; } else if (this.fontSizeScale === 3.2) { this.fontSize = '40vp'; - this.marginValue = 24; + this.marginValue = 13; } } @@ -422,97 +422,99 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') .width('100%') - Scroll(){ - Column(){ - Text(this.peerCustomDescription) - .textAlign(TextAlign.Center) - .fontColor($r('sys.color.font_primary')) - .fontSize($r('sys.float.Body_L')) - .width('100%') - .lineHeight(this.isTibetanLanguages() ? 22 : 0) - .margin({ - bottom: 12, left: 24, right: 24 - }) - .padding({ left: (this.isPC) ? 10 : 0, right: (this.isPC) ? 10 : 0 }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - - Stack(){ - List({ space: 0 }) { - ForEach(this.appDataList, (app: AppData, index: number) => { - ListItem() { - Row() { - Column() { - Column() { - Text(app.hostPkgLabel) - .fontSize($r('sys.float.Body_L')) - .fontColor($r('sys.color.font_primary')) - .textAlign(TextAlign.Start) - .maxLines(2) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .width('100%') - } - .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Scroll(){ + Column(){ + Text(this.peerCustomDescription) + .textAlign(TextAlign.Center) + .fontColor($r('sys.color.font_primary')) + .fontSize($r('sys.float.Body_L')) + .width('100%') + .lineHeight(this.isTibetanLanguages() ? 22 : 0) + .margin({ + bottom: 12, left: 24, right: 24 + }) + .padding({ left: (this.isPC) ? 10 : 0, right: (this.isPC) ? 10 : 0 }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + + Stack(){ + List({ space: 0 }) { + ForEach(this.appDataList, (app: AppData, index: number) => { + ListItem() { + Row() { Column() { - Text(app.bundleInfo) - .fontSize($r('sys.float.Body_M')) - .fontColor($r('sys.color.font_secondary')) - .textAlign(TextAlign.Start) - .width('100%') + Column() { + Text(app.hostPkgLabel) + .fontSize($r('sys.float.Body_L')) + .fontColor($r('sys.color.font_primary')) + .textAlign(TextAlign.Start) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .width('100%') + } + .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Text(app.bundleInfo) + .fontSize($r('sys.float.Body_M')) + .fontColor($r('sys.color.font_secondary')) + .textAlign(TextAlign.Start) + .width('100%') + } + .margin({ bottom: this.marginValue }) } - .margin({ bottom: this.marginValue }) + .layoutWeight(1) + .padding({ + right: 8 + }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + .margin({ + top: index === 0 ? 4 : 0, + bottom: index === (this.appDataList.length - 1) ? 4 : 0 + }) + + Checkbox({ name: app.hostPkgLabel, }) + .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) + .shape(CheckBoxShape.CIRCLE) + .size({ width: 20, height: 20 }) + .onChange((checked: boolean) => { + this.toggleSelection(app, index, checked); + }) } - .layoutWeight(1) - .padding({ - right: 8 - }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - .margin({ - top: index === 0 ? 4 : 0, - bottom: index === (this.appDataList.length - 1) ? 4 : 0 - }) - - Checkbox({ name: app.hostPkgLabel, }) - .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) - .shape(CheckBoxShape.CIRCLE) - .size({ width: 20, height: 20 }) - .onChange((checked: boolean) => { - this.toggleSelection(app, index, checked); - }) + .width('100%') + .padding({ top: 11, bottom: 11, left: 12, right: 12 }) } - .width('100%') - .padding({ top: 11, bottom: 11, left: 12, right: 12 }) - } - }, (app: AppData) => app.hostPkgLabel) + }, (app: AppData) => app.hostPkgLabel) + } + .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) + .backgroundColor($r('sys.color.comp_background_list_card')) + .width('100%') + .divider({ + strokeWidth: 1, + color: $r('sys.color.ohos_id_color_sub_background'), + startMargin: 12, + endMargin: 12 + }) + .edgeEffect(EdgeEffect.Spring) } - .margin({ bottom: 8 }) - .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) - .backgroundColor($r('sys.color.comp_background_list_card')) - .width('100%') - .divider({ - strokeWidth: 1, - color: $r('sys.color.ohos_id_color_sub_background'), - startMargin: 12, - endMargin: 12 - }) - .edgeEffect(EdgeEffect.Spring) } } + .onAreaChange((o, n) => { + this.scrollHeight = n.height as number; + console.info('**scrollHeight**:${this.scrollHeight}') + }) + .constraintSize({ + maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 81) + }) + .onAreaChange((o, n) => { + this.scrollHeight = n.height as number; + }) + .margin({ left: 12, right: 12 }) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) } - .onAreaChange((o, n) => { - this.scrollHeight = n.height as number; - console.info('**scrollHeight**:${this.scrollHeight}') - }) - .constraintSize({ - maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 73) - }) - .onAreaChange((o, n) => { - this.scrollHeight = n.height as number; - }) - .margin({ left: 12, right: 12 }) - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.Off) + .margin({ bottom: 8}) Column() { Button($r('app.string.dm_allow_always')) @@ -622,7 +624,9 @@ struct ConfirmCustomDialog { bottom: this.isPC ? 16 : 8 }) } - .width(328) + .margin({ + left: 16, right: 16, + }) .height('auto') .clip(true) .backgroundColor($r('sys.color.mask_fourth')) @@ -786,7 +790,7 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum)) - .margin({ bottom: 4, right: 4, left: 4 }) + .margin({ bottom: 8, right: 4, left: 4 }) .padding({ top: 8, bottom: 8 }) .type(ButtonType.ROUNDED_RECTANGLE) .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) @@ -832,7 +836,7 @@ struct ConfirmCustomDialog { }) .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.Off) + .scrollBar(BarState.On) } .width(400) .height(266) @@ -869,92 +873,94 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') .width('100%') - Scroll() { - Column() { - Text(this.peerCustomDescription) - .textAlign(TextAlign.Center) - .fontColor($r('sys.color.font_primary')) - .fontSize($r('sys.float.Body_L')) - .width('100%') - .lineHeight(this.isTibetanLanguages() ? 22 : 0) - .margin({ - bottom: 12, left: 24, right: 24 - }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - Stack() { - List({ space: 0 }) { - ForEach(this.appDataList, (app: AppData, index: number) => { - ListItem() { - Row() { - Column() { - Column() { - Text(app.hostPkgLabel) - .fontSize($r('sys.float.Body_L')) - .fontColor($r('sys.color.font_primary')) - .textAlign(TextAlign.Start) - .maxLines(2) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .width('100%') - } - .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Scroll() { + Column() { + Text(this.peerCustomDescription) + .textAlign(TextAlign.Center) + .fontColor($r('sys.color.font_primary')) + .fontSize($r('sys.float.Body_L')) + .width('100%') + .lineHeight(this.isTibetanLanguages() ? 22 : 0) + .margin({ + bottom: 12, left: 24, right: 24 + }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + Stack() { + List({ space: 0 }) { + ForEach(this.appDataList, (app: AppData, index: number) => { + ListItem() { + Row() { Column() { - Text(app.bundleInfo) - .fontSize($r('sys.float.Body_M')) - .fontColor($r('sys.color.font_secondary')) - .textAlign(TextAlign.Start) - .width('100%') + Column() { + Text(app.hostPkgLabel) + .fontSize($r('sys.float.Body_L')) + .fontColor($r('sys.color.font_primary')) + .textAlign(TextAlign.Start) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .width('100%') + } + .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Text(app.bundleInfo) + .fontSize($r('sys.float.Body_M')) + .fontColor($r('sys.color.font_secondary')) + .textAlign(TextAlign.Start) + .width('100%') + } + .margin({ bottom: this.marginValue }) } - .margin({ bottom: this.marginValue }) + .layoutWeight(1) + .padding({ + right: 8 + }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + .margin({ + top: index === 0 ? 4 : 0, + bottom: index === (this.appDataList.length - 1) ? 4 : 0 + }) + + Checkbox({ name: app.hostPkgLabel, }) + .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) + .shape(CheckBoxShape.CIRCLE) + .size({ width: 20, height: 20 }) + .onChange((checked: boolean) => { + this.toggleSelection(app, index, checked); + }) } - .layoutWeight(1) - .padding({ - right: 8 - }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - .margin({ - top: index === 0 ? 4 : 0, - bottom: index === (this.appDataList.length - 1) ? 4 : 0 - }) - - Checkbox({ name: app.hostPkgLabel, }) - .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) - .shape(CheckBoxShape.CIRCLE) - .size({ width: 20, height: 20 }) - .onChange((checked: boolean) => { - this.toggleSelection(app, index, checked); - }) + .width('100%') + .padding({ top: 11, bottom: 11, left: 12, right: 12 }) } - .width('100%') - .padding({ top: 11, bottom: 11, left: 12, right: 12 }) - } - }, (app: AppData) => app.hostPkgLabel) + }, (app: AppData) => app.hostPkgLabel) + } + .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) + .backgroundColor($r('sys.color.comp_background_list_card')) + .width('100%') + .divider({ + strokeWidth: 1, + color: $r('sys.color.ohos_id_color_sub_background'), + startMargin: 24, + endMargin: 24 + }) + .edgeEffect(EdgeEffect.Spring) } - .margin({ bottom: 8 }) - .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) - .backgroundColor($r('sys.color.comp_background_list_card')) - .width('100%') - .divider({ - strokeWidth: 1, - color: $r('sys.color.ohos_id_color_sub_background'), - startMargin: 24, - endMargin: 24 - }) - .edgeEffect(EdgeEffect.Spring) } } + .onAreaChange((o, n) => { + this.scrollHeight = n.height as number; + console.info('**scrollHeight**:${this.scrollHeight}') + }) + .constraintSize({ + maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 81) + }) + .margin({ left: 12, right: 12 }) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) } - .onAreaChange((o, n) => { - this.scrollHeight = n.height as number; - console.info('**scrollHeight**:${this.scrollHeight}') - }) - .constraintSize({ - maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 73) - }) - .margin({ left: 12, right: 12 }) - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.Off) + .margin({ bottom: 8}) Column() { Button($r('app.string.dm_allow_always')) @@ -1099,94 +1105,95 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') .width('100%') - Scroll(){ - Column(){ - Text(this.peerCustomDescription) - .textAlign(TextAlign.Center) - .fontColor($r('sys.color.font_primary')) - .fontSize($r('sys.float.Body_L')) - .width('100%') - .lineHeight(this.isTibetanLanguages() ? 22 : 0) - .margin({ - bottom: 12, left: 24, right: 24 - }) - .padding({ left: (this.isPC) ? 10 : 0, right: (this.isPC) ? 10 : 0 }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - - Stack(){ - List({ space: 0 }) { - ForEach(this.appDataList, (app: AppData, index: number) => { - ListItem() { - Row() { - Column() { - Column() { - Text(app.hostPkgLabel) - .fontSize($r('sys.float.Body_L')) - .fontColor($r('sys.color.font_primary')) - .textAlign(TextAlign.Start) - .maxLines(2) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .width('100%') - } - .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Scroll(){ + Column(){ + Text(this.peerCustomDescription) + .textAlign(TextAlign.Center) + .fontColor($r('sys.color.font_primary')) + .fontSize($r('sys.float.Body_L')) + .width('100%') + .lineHeight(this.isTibetanLanguages() ? 22 : 0) + .margin({ + bottom: 12, left: 24, right: 24 + }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + + Stack(){ + List({ space: 0 }) { + ForEach(this.appDataList, (app: AppData, index: number) => { + ListItem() { + Row() { Column() { - Text(app.bundleInfo) - .fontSize($r('sys.float.Body_M')) - .fontColor($r('sys.color.font_secondary')) - .textAlign(TextAlign.Start) - .width('100%') + Column() { + Text(app.hostPkgLabel) + .fontSize($r('sys.float.Body_L')) + .fontColor($r('sys.color.font_primary')) + .textAlign(TextAlign.Start) + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .width('100%') + } + .margin({ top: this.marginValue, bottom: 2 }) + Column() { + Text(app.bundleInfo) + .fontSize($r('sys.float.Body_M')) + .fontColor($r('sys.color.font_secondary')) + .textAlign(TextAlign.Start) + .width('100%') + } + .margin({ bottom: this.marginValue }) } - .margin({ bottom: this.marginValue }) - } - .layoutWeight(1) - .padding({ - right: 8 - }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - .margin({ - top: index === 0 ? 4 : 0, - bottom: index === (this.appDataList.length - 1) ? 4 : 0 - }) - - Checkbox({ name: app.hostPkgLabel, }) - .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) - .shape(CheckBoxShape.CIRCLE) - .size({ width: 20, height: 20 }) - .onChange((checked: boolean) => { - this.toggleSelection(app, index, checked); + .layoutWeight(1) + .padding({ + right: 8 }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + .margin({ + top: index === 0 ? 4 : 0, + bottom: index === (this.appDataList.length - 1) ? 4 : 0 + }) + + Checkbox({ name: app.hostPkgLabel, }) + .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) + .shape(CheckBoxShape.CIRCLE) + .size({ width: 20, height: 20 }) + .onChange((checked: boolean) => { + this.toggleSelection(app, index, checked); + }) + } + .width('100%') + .padding({ top: 11, bottom: 11, left: 12, right: 12 }) } - .width('100%') - .padding({ top: 11, bottom: 11, left: 12, right: 12 }) - } - }, (app: AppData) => app.hostPkgLabel) + }, (app: AppData) => app.hostPkgLabel) + } + .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) + .backgroundColor($r('sys.color.comp_background_list_card')) + .width('100%') + .divider({ + strokeWidth: 1, + color: $r('sys.color.ohos_id_color_sub_background'), + startMargin: 12, + endMargin: 12 + }) + .edgeEffect(EdgeEffect.Spring) } - .margin({ bottom: 8 }) - .borderRadius($r('sys.float.ohos_id_corner_radius_dialog')) - .backgroundColor($r('sys.color.comp_background_list_card')) - .width('100%') - .divider({ - strokeWidth: 1, - color: $r('sys.color.ohos_id_color_sub_background'), - startMargin: 12, - endMargin: 12 - }) - .edgeEffect(EdgeEffect.Spring) } } + .constraintSize({ + maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 82) + }) + .onAreaChange((o, n) => { + this.scrollHeight = n.height as number; + console.info(`**scrollHeight**:${this.scrollHeight}`) + }) + .margin({ left: 12, right: 12 }) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) } - .constraintSize({ - maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 74) - }) - .onAreaChange((o, n) => { - this.scrollHeight = n.height as number; - console.info(`**scrollHeight**:${this.scrollHeight}`) - }) - .margin({ left: (this.isPC) ? 16 : 12, right: (this.isPC) ? 16 : 12 }) - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.Off) + .margin({ bottom: 8 }) Column() { Button($r('app.string.dm_allow_always')) @@ -1296,7 +1303,9 @@ struct ConfirmCustomDialog { bottom: this.isPC ? 16 : 8 }) } - .width(328) + .margin({ + left: 16, right: 16, + }) .height('auto') .clip(true) .backgroundColor($r('sys.color.mask_fourth')) @@ -1460,7 +1469,7 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum)) - .margin({ bottom: 4, right: 4, left: 4 }) + .margin({ bottom: 8, right: 4, left: 4 }) .padding({ top: 8, bottom: 8 }) .type(ButtonType.ROUNDED_RECTANGLE) .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) @@ -1506,7 +1515,7 @@ struct ConfirmCustomDialog { }) .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.Off) + .scrollBar(BarState.On) } .width(400) .height(266) -- Gitee From 590d9b0dfc0fe2c888c0b7087d3ca7477193c6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=B8=8C=E7=A6=B9?= <1532141002@qq.com> Date: Thu, 19 Jun 2025 22:38:02 +0800 Subject: [PATCH 2/3] add ux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 赵希禹 <1532141002@qq.com> --- .../src/main/ets/pages/ConfirmDialog.ets | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index 0203037ef..5fd1f77e3 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -420,7 +420,6 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - .width('100%') Column() { Scroll(){ @@ -429,10 +428,10 @@ struct ConfirmCustomDialog { .textAlign(TextAlign.Center) .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Body_L')) - .width('100%') + .width('auto') .lineHeight(this.isTibetanLanguages() ? 22 : 0) .margin({ - bottom: 12, left: 24, right: 24 + bottom: 12, left: 12, right: 12 }) .padding({ left: (this.isPC) ? 10 : 0, right: (this.isPC) ? 10 : 0 }) .accessibilityGroup(true) @@ -830,13 +829,13 @@ struct ConfirmCustomDialog { .accessibilityLevel('yes') } } - .layoutWeight(1) - .constraintSize({ - maxHeight: 'auto' - }) - .margin({ left: 12, right: 12 }) - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.On) + .layoutWeight(1) + .constraintSize({ + maxHeight: 'auto' + }) + .margin({ left: 12, right: 12 }) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) } .width(400) .height(266) @@ -871,7 +870,6 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - .width('100%') Column() { Scroll() { @@ -880,7 +878,7 @@ struct ConfirmCustomDialog { .textAlign(TextAlign.Center) .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Body_L')) - .width('100%') + .width('auto') .lineHeight(this.isTibetanLanguages() ? 22 : 0) .margin({ bottom: 12, left: 24, right: 24 @@ -1090,7 +1088,6 @@ struct ConfirmCustomDialog { .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) .lineHeight(this.isTibetanLanguages() ? 22 : 23) .textOverflow({ overflow: TextOverflow.None }) - .width('100%') .maxLines(2) } .onAreaChange((o, n) => { @@ -1103,7 +1100,6 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - .width('100%') Column() { Scroll(){ @@ -1112,7 +1108,7 @@ struct ConfirmCustomDialog { .textAlign(TextAlign.Center) .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Body_L')) - .width('100%') + .width('auto') .lineHeight(this.isTibetanLanguages() ? 22 : 0) .margin({ bottom: 12, left: 24, right: 24 -- Gitee From c6be58bbf56b6a18b8eb89522ed7caa26724a608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=B8=8C=E7=A6=B9?= <1532141002@qq.com> Date: Fri, 20 Jun 2025 17:26:10 +0800 Subject: [PATCH 3/3] add ux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 赵希禹 <1532141002@qq.com> --- .../src/main/ets/pages/ConfirmDialog.ets | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/display/entry/src/main/ets/pages/ConfirmDialog.ets b/display/entry/src/main/ets/pages/ConfirmDialog.ets index 5fd1f77e3..d9a163fce 100644 --- a/display/entry/src/main/ets/pages/ConfirmDialog.ets +++ b/display/entry/src/main/ets/pages/ConfirmDialog.ets @@ -60,7 +60,7 @@ struct ConfirmCustomDialog { @State selectedAppDataList: AppSendData[] = []; @State isFoldable: boolean = display.isFoldable(); @State isFolded: display.FoldStatus = display.getFoldStatus(); - @State displayImpl: display.Display = display.getDefaultDisplaySync(); + @State mLocalHeight: number = display.getDefaultDisplaySync().height; @State currentOrientation: window.Orientation = window.Orientation.UNSPECIFIED; @State marginValue: number = 0; @State fontSizeScale: number = AppStorage.get('fontSizeScale') as number; @@ -68,7 +68,7 @@ struct ConfirmCustomDialog { @State isPC: boolean = false; @State isTablet: boolean = false; @State isCar: boolean = false; - @State fontSize: string = ''; + @State fontSize: string = ''; @State textHeight: number = 0; @State scrollHeight: number = 0; @State buttonHeight: number = 0; @@ -98,7 +98,7 @@ struct ConfirmCustomDialog { this.updateOrientation(); this.getDeviceType(); this.appDataList = this.getAppDataList(); - + if (AppStorage.get('isProxyBind') != null) { this.isProxy = AppStorage.get('isProxyBind') as boolean; console.log('isProxy is ' + this.isProxy); @@ -322,7 +322,7 @@ struct ConfirmCustomDialog { ); } console.log('The currently selected data:', this.selectedAppDataList); -} + } getImages(peerdeviceType: number): Resource { console.info('peerdeviceType is ' + peerdeviceType); @@ -405,7 +405,7 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) .width('auto') .maxLines(2) @@ -462,16 +462,16 @@ struct ConfirmCustomDialog { } .margin({ bottom: this.marginValue }) } - .layoutWeight(1) - .padding({ - right: 8 - }) - .accessibilityGroup(true) - .accessibilityLevel('yes') - .margin({ - top: index === 0 ? 4 : 0, - bottom: index === (this.appDataList.length - 1) ? 4 : 0 - }) + .layoutWeight(1) + .padding({ + right: 8 + }) + .accessibilityGroup(true) + .accessibilityLevel('yes') + .margin({ + top: index === 0 ? 4 : 0, + bottom: index === (this.appDataList.length - 1) ? 4 : 0 + }) Checkbox({ name: app.hostPkgLabel, }) .select(this.selectedAppDataList.some(item => item.bundleName === app.bundleName)) @@ -498,18 +498,18 @@ struct ConfirmCustomDialog { .edgeEffect(EdgeEffect.Spring) } } + .margin({ left: 12, right: 12 }) } .onAreaChange((o, n) => { this.scrollHeight = n.height as number; console.info('**scrollHeight**:${this.scrollHeight}') - }) + }) .constraintSize({ maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 81) }) .onAreaChange((o, n) => { this.scrollHeight = n.height as number; }) - .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) } @@ -536,10 +536,10 @@ struct ConfirmCustomDialog { }) .stateStyles({ pressed: { - .backgroundColor($r('sys.color.ohos_id_color_click_effect')) + .backgroundColor($r('sys.color.ohos_id_color_click_effect')) }, normal: { - .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent) + .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent) } }) .accessibilityGroup(true) @@ -643,7 +643,7 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) .width('auto') .maxLines(2) @@ -758,7 +758,7 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - + Button($r('app.string.dm_allow_this_time')) .margin({ bottom: 4, right: 4, left: 4 }) .padding({ top: 8, bottom: 8 }) @@ -827,15 +827,15 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - } } - .layoutWeight(1) - .constraintSize({ - maxHeight: 'auto' - }) .margin({ left: 12, right: 12 }) - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.On) + } + .layoutWeight(1) + .constraintSize({ + maxHeight: 'auto' + }) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) } .width(400) .height(266) @@ -855,7 +855,7 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) .width('auto') .maxLines(2) @@ -946,6 +946,7 @@ struct ConfirmCustomDialog { .edgeEffect(EdgeEffect.Spring) } } + .margin({ left: 12, right: 12 }) } .onAreaChange((o, n) => { this.scrollHeight = n.height as number; @@ -954,7 +955,6 @@ struct ConfirmCustomDialog { .constraintSize({ maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 81) }) - .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) } @@ -1086,8 +1086,9 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) + .width('auto') .maxLines(2) } .onAreaChange((o, n) => { @@ -1111,11 +1112,11 @@ struct ConfirmCustomDialog { .width('auto') .lineHeight(this.isTibetanLanguages() ? 22 : 0) .margin({ - bottom: 12, left: 24, right: 24 + bottom: 12, left: 12, right: 12 }) .accessibilityGroup(true) .accessibilityLevel('yes') - + Stack(){ List({ space: 0 }) { ForEach(this.appDataList, (app: AppData, index: number) => { @@ -1177,6 +1178,7 @@ struct ConfirmCustomDialog { .edgeEffect(EdgeEffect.Spring) } } + .margin({ left: 12, right: 12 }) } .constraintSize({ maxHeight: (this.columnHeight - this.symbolHeight - this.buttonHeight - this.textHeight - 82) @@ -1185,7 +1187,6 @@ struct ConfirmCustomDialog { this.scrollHeight = n.height as number; console.info(`**scrollHeight**:${this.scrollHeight}`) }) - .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) } @@ -1288,7 +1289,7 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - } + } .onAreaChange((o, n) => { this.buttonHeight = n.height as number; console.info(`**buttonHeight**:${this.buttonHeight}`) @@ -1319,7 +1320,7 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) .width('auto') .maxLines(2) @@ -1404,7 +1405,7 @@ struct ConfirmCustomDialog { }) .margin({ bottom: 4 }) .edgeEffect(EdgeEffect.Spring) - .scrollBar(BarState.On) + .scrollBar(BarState.Off) Button($r('app.string.dm_allow_always')) .margin({ top: 4, bottom: 4, right: 4, left: 4 }) @@ -1463,7 +1464,7 @@ struct ConfirmCustomDialog { }) .accessibilityGroup(true) .accessibilityLevel('yes') - + Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum)) .margin({ bottom: 8, right: 4, left: 4 }) .padding({ top: 8, bottom: 8 }) @@ -1504,12 +1505,12 @@ struct ConfirmCustomDialog { .accessibilityGroup(true) .accessibilityLevel('yes') } + .margin({ left: 12, right: 12 }) } .layoutWeight(1) .constraintSize({ maxHeight: 'auto' }) - .margin({ left: 12, right: 12 }) .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) } @@ -1531,7 +1532,7 @@ struct ConfirmCustomDialog { .fontWeight(FontWeight.Bold) .fontColor($r('sys.color.ohos_id_color_text_primary')) .heightAdaptivePolicy(TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST) - .lineHeight(this.isTibetanLanguages() ? 22 : 23) + .lineHeight(this.isTibetanLanguages() ? 22 : 0) .textOverflow({ overflow: TextOverflow.None }) .width('auto') .maxLines(2) @@ -1608,7 +1609,7 @@ struct ConfirmCustomDialog { normal: { .backgroundColor(this.isPC ? $r('sys.color.ohos_id_color_button_normal') : Color.Transparent) } - }) + }) Button($r('app.plural.dm_not_allow', this.secondsNum, this.secondsNum)) .margin({ left: 16, right: 16 }) .padding({ top: 8, bottom: 8 }) @@ -1662,8 +1663,8 @@ struct ConfirmCustomDialog { this.columnHeight = n.height as number; console.info(`**columnHeight**:${this.columnHeight}`) }) - .constraintSize({ maxHeight: '90%' }) - .height('100%') + .constraintSize({ maxHeight: (px2vp(this.mLocalHeight) - 28 - 39)*0.9 }) + .height('auto') } } @@ -1708,7 +1709,7 @@ struct dialogPlusPage { } onWillDismiss() { - console.log(TAG + 'onWillDismiss: ' + ACTION_CANCEL_AUTH) + console.log(TAG + 'onWillDismiss: ' + ACTION_CANCEL_AUTH) this.setUserOperation(ACTION_CANCEL_AUTH); this.destruction(); } @@ -1754,4 +1755,4 @@ struct dialogPlusPage { build() { Column(this.dialogController.open()) } -} \ No newline at end of file +} -- Gitee