From 76ae099e319439d147e88e7ff9b964d06db1aaa7 Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Fri, 25 Oct 2024 17:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BD=AF=E9=94=AE=E7=9B=98?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=BA=8B=E4=BB=B6=EF=BC=8C=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E8=BD=AF=E9=94=AE=E7=9B=98=E5=8F=91=E7=94=9F=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E5=90=8E=E5=8F=AF=E4=BB=A5=E6=AD=A3=E5=B8=B8=E5=88=B7=E6=96=B0?= =?UTF-8?q?FlutterView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- .../flutter/src/main/ets/view/FlutterView.ets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets index 3924d55c20..5af7b9cf9d 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets @@ -150,6 +150,7 @@ export class FlutterView { this.mainWindow?.on('windowSizeChange', this.windowSizeChangeCallback); this.mainWindow?.on('avoidAreaChange', this.avoidAreaChangeCallback); this.mainWindow?.on('windowStatusChange', this.windowStatusChangeCallback); + this.mainWindow?.on('keyboardHeightChange', this.keyboardHeightChangeCallback); this.systemAvoidArea = this.mainWindow?.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); this.navigationAvoidArea = this.mainWindow?.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); this.gestureAvoidArea = this.mainWindow?.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM_GESTURE); @@ -198,6 +199,14 @@ export class FlutterView { } }; + private keyboardHeightChangeCallback = (data: number) => { + Log.i(TAG, "keyboardHeightChangeCallback " + data); + this.keyboardAvoidArea.bottomRect.height = data; + if (this.isAttachedToFlutterEngine()) { + this.onAreaChange(null); + } + }; + getId(): string { return this.id } @@ -243,6 +252,7 @@ export class FlutterView { this.mainWindow?.off('windowSizeChange', this.windowSizeChangeCallback); this.mainWindow?.off('avoidAreaChange', this.avoidAreaChangeCallback); this.mainWindow?.off('windowStatusChange', this.windowStatusChangeCallback); + this.mainWindow?.off('keyboardHeightChange', this.keyboardHeightChangeCallback); } catch (e) { Log.e(TAG, "mainWindow off error: " + JSON.stringify(e)); } -- Gitee