From 018b993977426eac02db4275669a12bc7cd1a537 Mon Sep 17 00:00:00 2001 From: hzt Date: Fri, 16 May 2025 15:00:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/NormalVideo.ets | 13 ++++++++++-- entry/src/main/ets/pages/NormalWeb.ets | 19 ++++++++++++++---- entry/src/main/ets/pages/OpaqueVideo.ets | 11 ++++++++-- entry/src/main/ets/pages/TransparentVideo.ets | 11 ++++++++-- entry/src/main/ets/pages/VideoWithBlur.ets | 13 ++++++++++-- entry/src/main/ets/pages/WebWithBlur.ets | 20 +++++++++++++++---- 6 files changed, 71 insertions(+), 16 deletions(-) diff --git a/entry/src/main/ets/pages/NormalVideo.ets b/entry/src/main/ets/pages/NormalVideo.ets index c4a35be..3d1f6e0 100644 --- a/entry/src/main/ets/pages/NormalVideo.ets +++ b/entry/src/main/ets/pages/NormalVideo.ets @@ -20,11 +20,13 @@ export function NormalVideoBuilder() { NormalVideo() } +// [Start NormalVideo_start] @Component struct NormalVideo { + // [StartExclude NormalVideo_start] pathStack: NavPathStack = new NavPathStack(); mainWindow: window.Window = AppStorage.get('mainWindow') as window.Window; - + // [EndExclude NormalVideo_start] build() { NavDestination() { Stack() { @@ -48,6 +50,7 @@ struct NormalVideo { .borderRadius('50%') .fillColor('rgba(255, 255, 255, 0.9)') .backgroundColor('rgba(0, 0, 0, 0.1)') + // [StartExclude NormalVideo_start] .onClick(() => { this.pathStack.pop(); }) @@ -59,7 +62,9 @@ struct NormalVideo { .lineHeight(26) .padding({ left: 8 }) .fontColor('rgba(255, 255, 255, 0.9)') + // [EndExclude NormalVideo_start] } + // [StartExclude NormalVideo_start] .width('100%') .height(56) .alignRules({ @@ -110,6 +115,7 @@ struct NormalVideo { bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, middle: { anchor: '__container__', align: HorizontalAlign.Center } }) + // [EndExclude NormalVideo_start] } .width('100%') .height('100%') @@ -123,6 +129,7 @@ struct NormalVideo { .width('100%') .height('100%') } + // [StartExclude NormalVideo_start] .hideTitleBar(true) .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; @@ -140,4 +147,6 @@ struct NormalVideo { this.mainWindow.setWindowSystemBarProperties(sysBarProps); }) } -} \ No newline at end of file + // [EndExclude NormalVideo_start] +} +// [End NormalVideo_start] \ No newline at end of file diff --git a/entry/src/main/ets/pages/NormalWeb.ets b/entry/src/main/ets/pages/NormalWeb.ets index 4c4a8dd..9bd113f 100644 --- a/entry/src/main/ets/pages/NormalWeb.ets +++ b/entry/src/main/ets/pages/NormalWeb.ets @@ -13,23 +13,26 @@ * limitations under the License. */ +// [Start NormalWeb_start] import { webview } from '@kit.ArkWeb'; - +// [StartExclude NormalWeb_start] @Builder export function NormalWebBuilder() { NormalWeb() } - +// [EndExclude NormalWeb_start] @Entry @Component struct NormalWeb { @State currentIndex: number = 0; // The index of the currently selected tab page private controller: TabsController = new TabsController(); private webController: webview.WebviewController = new webview.WebviewController(); + // [StartExclude NormalWeb_start] pathStack: NavPathStack = new NavPathStack(); - + // [EndExclude NormalWeb_start] @Builder tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) { + // [StartExclude NormalWeb_start] Column({ space: 4 }) { Image(this.currentIndex === targetIndex ? selectedImg : normalImg) .size({ @@ -44,15 +47,19 @@ struct NormalWeb { .height('100%') .padding({ bottom: 28 }) .justifyContent(FlexAlign.Center) + // [EndExclude NormalWeb_start] } build() { + // [StartExclude NormalWeb_start] NavDestination() { + // [EndExclude NormalWeb_start] Tabs({ barPosition: BarPosition.End, index: 0, controller: this.controller }) { TabContent() { Web({ src: $rawfile('test.html'), controller: this.webController }) } .tabBar(this.tabBuilder('Tab', 0, $r('app.media.tab_icon_activated'), $r('app.media.tab_icon'))) + // [StartExclude NormalWeb_start] .padding({ left: 16, right: 16, @@ -68,12 +75,14 @@ struct NormalWeb { right: 16, top: 10 }) + // [EndExclude NormalWeb_start] } .height('100%') .width('100%') .barOverlap(true) // Set TabBar to overlay on top of TabContent .barBackgroundBlurStyle(BlurStyle.NONE) // Set TabBar to be not blurry .barBackgroundColor('rgba(241, 243, 245, 1)') + // [StartExclude NormalWeb_start] .padding({ top: 36 }) .vertical(false) .barMode(BarMode.Fixed) @@ -88,5 +97,7 @@ struct NormalWeb { .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; }) + // [EndExclude NormalWeb_start] } -} \ No newline at end of file +} +// [End NormalWeb_start] \ No newline at end of file diff --git a/entry/src/main/ets/pages/OpaqueVideo.ets b/entry/src/main/ets/pages/OpaqueVideo.ets index 3ba55cc..5545fe4 100644 --- a/entry/src/main/ets/pages/OpaqueVideo.ets +++ b/entry/src/main/ets/pages/OpaqueVideo.ets @@ -20,14 +20,18 @@ export function OpaqueVideoBuilder() { OpaqueVideo() } +// [Start OpaqueVideo_start] @Entry @Component struct OpaqueVideo { + // [StartExclude OpaqueVideo_start] pathStack: NavPathStack = new NavPathStack(); mainWindow: window.Window = AppStorage.get('mainWindow') as window.Window; - + // [EndExclude OpaqueVideo_start] build() { + // [StartExclude OpaqueVideo_start] NavDestination() { + // [EndExclude OpaqueVideo_start] RelativeContainer() { // Bottom UI component Image($r('app.media.watermark')) @@ -55,6 +59,7 @@ struct OpaqueVideo { .height('100%') .width('100%') } + // [StartExclude OpaqueVideo_start] .hideTitleBar(true) .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; @@ -72,4 +77,6 @@ struct OpaqueVideo { this.mainWindow.setWindowSystemBarProperties(sysBarProps); }) } -} \ No newline at end of file + // [EndExclude OpaqueVideo_start] +} +// [End OpaqueVideo_start] \ No newline at end of file diff --git a/entry/src/main/ets/pages/TransparentVideo.ets b/entry/src/main/ets/pages/TransparentVideo.ets index 0a58f92..a3501e5 100644 --- a/entry/src/main/ets/pages/TransparentVideo.ets +++ b/entry/src/main/ets/pages/TransparentVideo.ets @@ -20,14 +20,18 @@ export function TransparentVideoBuilder() { TransparentVideo() } +// [Start TransparentVideo_start] @Entry @Component struct TransparentVideo { + // [StartExclude TransparentVideo_start] pathStack: NavPathStack = new NavPathStack(); mainWindow: window.Window = AppStorage.get('mainWindow') as window.Window; - + // [EndExclude TransparentVideo_start] build() { + // [StartExclude TransparentVideo_start] NavDestination() { + // [EndExclude TransparentVideo_start] RelativeContainer() { // Bottom UI component Image($r('app.media.watermark')) @@ -55,6 +59,7 @@ struct TransparentVideo { .height('100%') .width('100%') } + // [StartExclude TransparentVideo_start] .hideTitleBar(true) .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; @@ -72,4 +77,6 @@ struct TransparentVideo { this.mainWindow.setWindowSystemBarProperties(sysBarProps); }) } -} \ No newline at end of file + // [EndExclude TransparentVideo_start] +} +// [End TransparentVideo_start] \ No newline at end of file diff --git a/entry/src/main/ets/pages/VideoWithBlur.ets b/entry/src/main/ets/pages/VideoWithBlur.ets index 1ebb6a4..5395209 100644 --- a/entry/src/main/ets/pages/VideoWithBlur.ets +++ b/entry/src/main/ets/pages/VideoWithBlur.ets @@ -20,12 +20,14 @@ export function VideoWithBlurBuilder() { VideoWithBlur() } +// [Start VideoWithBlur_start] @Entry @Component struct VideoWithBlur { + // [StartExclude VideoWithBlur_start] pathStack: NavPathStack = new NavPathStack(); mainWindow: window.Window = AppStorage.get('mainWindow') as window.Window; - + // [EndExclude VideoWithBlur_start] build() { NavDestination() { Stack() { @@ -51,6 +53,7 @@ struct VideoWithBlur { .backgroundColor('rgba(0, 0, 0, 0.1)') .backdropBlur(40) // Set this component background blur .backgroundBlurStyle(BlurStyle.BACKGROUND_REGULAR) + // [StartExclude VideoWithBlur_start] .onClick(() => { this.pathStack.pop(); }) @@ -62,7 +65,9 @@ struct VideoWithBlur { .lineHeight(26) .padding({ left: 8 }) .fontColor('rgba(255, 255, 255, 0.9)') + // [EndExclude VideoWithBlur_start] } + // [StartExclude VideoWithBlur_start] .width('100%') .height(56) .alignRules({ @@ -113,6 +118,7 @@ struct VideoWithBlur { bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, middle: { anchor: '__container__', align: HorizontalAlign.Center } }) + // [EndExclude VideoWithBlur_start] } .width('100%') .height('100%') @@ -126,6 +132,7 @@ struct VideoWithBlur { .width('100%') .height('100%') } + // [StartExclude VideoWithBlur_start] .hideTitleBar(true) .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; @@ -143,4 +150,6 @@ struct VideoWithBlur { this.mainWindow.setWindowSystemBarProperties(sysBarProps); }) } -} \ No newline at end of file + // [EndExclude VideoWithBlur_start] +} +// [End VideoWithBlur_start] diff --git a/entry/src/main/ets/pages/WebWithBlur.ets b/entry/src/main/ets/pages/WebWithBlur.ets index c7378d9..2a36cae 100644 --- a/entry/src/main/ets/pages/WebWithBlur.ets +++ b/entry/src/main/ets/pages/WebWithBlur.ets @@ -13,23 +13,27 @@ * limitations under the License. */ -import { webview } from '@kit.ArkWeb'; +// [Start WebWithBlur_start] +import { webview } from '@kit.ArkWeb'; +// [StartExclude WebWithBlur_start] @Builder export function WebWithBlurBuilder() { WebWithBlur() } - +// [EndExclude WebWithBlur_start] @Entry @Component struct WebWithBlur { @State currentIndex: number = 0; // The index of the currently selected tab page private controller: TabsController = new TabsController(); private webController: webview.WebviewController = new webview.WebviewController(); + // [StartExclude WebWithBlur_start] pathStack: NavPathStack = new NavPathStack(); - + // [EndExclude WebWithBlur_start] @Builder tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) { + // [StartExclude WebWithBlur_start] Column({ space: 4 }) { Image(this.currentIndex === targetIndex ? selectedImg : normalImg) .size({ @@ -44,15 +48,19 @@ struct WebWithBlur { .height('100%') .padding({ bottom: 28 }) .justifyContent(FlexAlign.Center) + // [EndExclude WebWithBlur_start] } build() { + // [StartExclude WebWithBlur_start] NavDestination() { + // [EndExclude WebWithBlur_start] Tabs({ barPosition: BarPosition.End, index: 0, controller: this.controller }) { TabContent() { Web({ src: $rawfile('test.html'), controller: this.webController }) } .tabBar(this.tabBuilder('Tab', 0, $r('app.media.tab_icon_activated'), $r('app.media.tab_icon'))) + // [StartExclude WebWithBlur_start] .padding({ left: 16, right: 16, @@ -68,11 +76,13 @@ struct WebWithBlur { right: 16, top: 10 }) + // [EndExclude WebWithBlur_start] } .height('100%') .width('100%') .barOverlap(true) // Set TabBar to be blurred and overlay on top of TabContent .barBackgroundColor('rgba(241, 243, 245, 0.3)') + // [StartExclude WebWithBlur_start] .padding({ top: 36 }) .vertical(false) .barMode(BarMode.Fixed) @@ -87,5 +97,7 @@ struct WebWithBlur { .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack; }) + // [EndExclude WebWithBlur_start] } -} \ No newline at end of file +} +// [End WebWithBlur_start] \ No newline at end of file -- Gitee