From efbc8892827fb3cf1401374a1046b628d0f7c1e8 Mon Sep 17 00:00:00 2001 From: "@feng-yu4279" Date: Thu, 29 May 2025 10:48:52 +0800 Subject: [PATCH] =?UTF-8?q?feat=20(=E6=A0=87=E8=AF=86):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20CustomizeKeyboard=20=E4=BB=93=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/MainPage.ets | 8 ++++---- entry/src/main/ets/view/CustomKeyboard.ets | 20 +++++++++---------- .../src/main/ets/view/TextInputComponent.ets | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index b493c50..0195d7a 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -21,17 +21,17 @@ import { TextInputComponent } from '../view/TextInputComponent'; @Entry @Component struct MainPage { - @State bottomPadding: number = Constants.MAIN_PAGE_INITIAL_PADDING; + @State bottomPadding: number = 210; aboutToAppear(): void { let event: emitter.InnerEvent = { - eventId: Constants.AVOID_EVENT_ID + eventId: 1 } emitter.on(event, (eventData: emitter.EventData) => { if (eventData.data) { let avoidHeight: number = eventData.data['avoidHeight']; if (avoidHeight === 0) { - this.bottomPadding = Constants.MAIN_PAGE_INITIAL_PADDING; + this.bottomPadding = 210; } else { this.bottomPadding = avoidHeight; } @@ -46,7 +46,7 @@ struct MainPage { Image($r('app.media.arkui_background')) .height($r('app.float.main_page_image_height')) .width('100%') - .borderRadius(Constants.IMAGE_BORDER) + .borderRadius(12) .padding({ left: $r('app.float.main_page_margin'), right: $r('app.float.main_page_margin') }) TextInputComponent() diff --git a/entry/src/main/ets/view/CustomKeyboard.ets b/entry/src/main/ets/view/CustomKeyboard.ets index db0d18e..217f57e 100644 --- a/entry/src/main/ets/view/CustomKeyboard.ets +++ b/entry/src/main/ets/view/CustomKeyboard.ets @@ -18,12 +18,12 @@ import { KeyboardController } from '../model/KeyboardController'; import { EnglishKeyboard } from './EnglishKeyboard'; import { NumberKeyboard } from './NumberKeyboard'; -// [Start CustomKeyboard_start] +// [Start customKeyboard_start1] // [Start avoidHeight_start] @Component export struct CustomKeyboard { // [StartExclude avoidHeight_start] - // [StartExclude CustomKeyboard_start] + // [StartExclude customKeyboard_start1] @Consume isCustomKeyboardAttach: boolean; @Consume inputText: string; @Consume keyBoardController: KeyboardController; @@ -31,11 +31,11 @@ export struct CustomKeyboard { @Consume customKeyboardHeight: number; @Consume bottomRectHeight: number; // [EndExclude avoidHeight_start] - // [EndExclude CustomKeyboard_start] + // [EndExclude customKeyboard_start1] build() { Column() { // [StartExclude avoidHeight_start] - // [StartExclude CustomKeyboard_start] + // [StartExclude customKeyboard_start1] NumberKeyboard() .visibility(this.keyBoardController.keyBoardType === Constants.NUMBER_KEYBOARD ? Visibility.Visible : Visibility.None) @@ -45,10 +45,10 @@ export struct CustomKeyboard { .visibility(this.keyBoardController.keyBoardType === Constants.ENGLISH_KEYBOARD ? Visibility.Visible : Visibility.None) .margin({ top: $r('app.float.keyboard_margin_top') }) - // [EndExclude CustomKeyboard_start] + // [EndExclude customKeyboard_start1] // [EndExclude avoidHeight_start] } - // [StartExclude CustomKeyboard_start] + // [StartExclude customKeyboard_start1] .onAreaChange((oldValue: Area, newValue: Area) => { this.customKeyboardHeight = Number(newValue.height); let avoidHeight: number = (this.isCustomKeyboardAttach ? this.customKeyboardHeight : this.systemKeyboardHeight) @@ -57,15 +57,15 @@ export struct CustomKeyboard { }) // [StartExclude avoidHeight_start] .padding({ left: $r('app.float.keyboard_padding'), right: $r('app.float.keyboard_padding') }) - // [EndExclude CustomKeyboard_start] + // [EndExclude customKeyboard_start1] .height($r('app.float.keyboard_total_height')) - // [StartExclude CustomKeyboard_start] + // [StartExclude customKeyboard_start1] .width('100%') .backgroundColor($r('app.color.keyboard_background_color')) - // [EndExclude CustomKeyboard_start] + // [EndExclude customKeyboard_start1] // [EndExclude avoidHeight_start] } } -// [End CustomKeyboard_start] +// [End customKeyboard_start1] // [End avoidHeight_start] diff --git a/entry/src/main/ets/view/TextInputComponent.ets b/entry/src/main/ets/view/TextInputComponent.ets index e67d748..88877c9 100644 --- a/entry/src/main/ets/view/TextInputComponent.ets +++ b/entry/src/main/ets/view/TextInputComponent.ets @@ -54,7 +54,7 @@ export struct TextInputComponent { // [Start TextInput_start] // [Start switchover_start] TextInput({ - placeholder: $r('app.string.textInput_placeholder_custom'), + placeholder: 'Bind Custom Keyboard', text: this.inputText, controller: this.textInputController }) -- Gitee