juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 505 forks source link

[Android] White screen on keyboard - issue Long standing problem persist #910

Open Jai931 opened 6 months ago

Jai931 commented 6 months ago

Describe the bug I am using this widget in my project which required combination of unity and flutter. A white screens appears when keyboard is launched, causing the screen to freeze and to make app work normal need to kill the app.This persistent issue has been impacting app users. We tried useAndroidViewSurface to set true and also false. it is not working to solve this issue. As its blocking app flow. Could you please help me to solve this problem .it is happening randomly sometime working sometime won't.

To Reproduce Steps to reproduce the behavior:

  1. Go to Manage Password
  2. Click on Textfield Keyboard would appear
  3. White screen visible and app got freezed
  4. need to kill the app to disappear white screen

Expected behavior Whit screen should not appear. it should work as expected.

Screenshots I am attaching screenshot and video for reference

https://github.com/juicycleff/flutter-unity-view-widget/assets/154322383/fee910ba-7834-4e14-a96f-ab5612883d92

MicrosoftTeams-image (5)

Unity (please complete the following information):

Smartphone (please complete the following information):

Additional context -- https://github.com/juicycleff/flutter-unity-view-widget/tree/master/android/src/main/kotlin/com/xraph/plugin/flutter_unity_widget this is the version of widget, I am using. Your quick support would highly appreciated

timbotimbo commented 6 months ago

Just to confirm, the keyboard is triggered by a textfield inside unity?

Which flutter version are you using?

Can you replicate this while debugging and do you see any errors in the console or using logcat?

Jai931 commented 6 months ago

Hi @timbotimbo
Flutter version - 3.3.10 and i am getting following error when white screen appears

Screenshot 2024-01-03 at 5 41 14 PM

Yes, keyboard is triggered from Unity. I tried from flutter side also for textfield . getting same white screen issue.

Jai931 commented 6 months ago

@timbotimbo Any update?

timbotimbo commented 6 months ago

I can reproduce this with useAndroidViewSurface set to false, but not with it set to true.

I added an input field to the example project:

useAndroidViewSurface: false (virtual display) useAndroidViewSurface: true (hybrid composition)
https://github.com/juicycleff/flutter-unity-view-widget/assets/11444698/26b5258d-93c5-484e-ac8e-66b8fd66b696 https://github.com/juicycleff/flutter-unity-view-widget/assets/11444698/58c7a448-be03-44b8-a4ce-fb35141ce72b

This looks like a Flutter bug that i've seen before on app resume. I don't think this is anything that can be fixed in the plugin, I will see if I can report a bug with flutter.

Sorry to say, but don't expect this to be fixed soon.

Jai931 commented 5 months ago

Hi @timbotimbo thanks for your valuable reply and sorry for being late to reply you back. I tried with useAndroidViewSurface true. But it is not working, maybe because of the flutter version difference. If you find any solution for it please let me know because it is on high priority issue and rest of the things is working fine using this library. I am looking forward for you support.

Jai931 commented 5 months ago

HI @timbotimbo Any update about the fix?

timbotimbo commented 4 months ago

As mentioned above

Sorry to say, but don't expect this to be fixed soon.

This is a Flutter bug, and we can't really influence that.

There are some changes in the Flutter github but those haven't helped:

timbotimbo commented 4 months ago

@Jai931 if all your textfields are in the top part of the screen, you might be able to use resizeToAvoidBottomInset: false in a Flutter Scaffold. Flutter won't resize the body and widget when the keyboard opens and will avoid any of these glitches.
The only thing is that the keyboard might overlap something visible on screen.