Search code examples
androidflutterdartuser-interfacekeyboard

Flutter: keyboard is showing as a white box in Android


In a Flutter App, I have a TextField at somewhere, when I tap on the field while running on Android to type something, the keyboard is not showing up, instead a White Box with the same area of the keyboard is showing.

I am facing the issue in everything that has a keyboard inside the app, I mean not just the TextField widget, I am also facing it with TextFormField too and the issue doesn't exist on IOS.


Solution

  • Quick Suggestion:

    Make sure the Hardware Acceleration feature is enabled for the android project.

    Inside the AndroidManifest.xml file, check if you have the property android:hardwareAccelerated set to true like the following:

    <application>
        <activity
            ...
            android:hardwareAccelerated="false"
            ... >
        ...
        </activity>
    </application>
    

    NOTE: If you don't see it while your Android API >= 14 then it is enabled by default.

    If it was not enabled, then enable it, stop the app & rerun it, and check if the problem is solved or not.


    Details:

    Since you mentioned that the problem is only in Android, then it might be strongly related to the Hardware Acceleration feature, here is a brief description about it:

    Beginning in Android 3.0 (API level 11), the Android 2D rendering pipeline supports hardware acceleration, meaning that all drawing operations that are performed on a View's canvas use the GPU. Because of the increased resources required to enable hardware acceleration, your app will consume more RAM.

    Having the Hardware Acceleration disabled can cause issues such as invisible elements (might be your case), exceptions, or wrongly rendered pixels, that's why I'm guessing it's the problem.