Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android keyboard overlapping input fields, view doesn't scroll automatically

I have the same problem described in this question, but on Trigger.io. Unfortunately, the solution requires to edit AndroidManifest.xml, which appears to be impossible in Trigger.io

In some of my app views, the Android keyboard is overlapping some input fields, making it difficult to input values.

Here is a couple of screenshots showing the problem. The "Senha" field is overlapped by the android keyboard, and the view doesn't scroll to it, even after the user inputs a value.

I tried the trigger.io email support, but they asked me to search here for an answer...

screenshot 1screenshot 2

like image 501
fjsj Avatar asked May 28 '14 14:05

fjsj


2 Answers

If you want to make changes to the AndroidManifest.xml your best bet would be to create a native module for your apps:

https://trigger.io/docs/current/api/native_modules/index.html

Specifically, you can make modifications to the manifest by creating a custom build step:

https://trigger.io/docs/current/api/native_modules/native_build_steps.html

i.e. something like:

[
    {
        "do": {
            "android_add_to_activity_manifest_attributes": {
                "attributes": {
                    "android:windowSoftInputMode": "adjustResize"
                }
            }
        }
    }
]
like image 140
Antoine van Gelder Avatar answered Nov 05 '22 06:11

Antoine van Gelder


This worked for me...

First add this

final bottom = MediaQuery.of(context).viewInsets.bottom;

Then use a SingleChildScrollView() to wrap around the main widget (whatever you're using, e.g. Column, ListView, etc) like this...

You need "reverse: true"

Widget build{
return Scaffold(
body: SingleChildScrollView(
reverse: true;
child: Container(...

You also need these two lines of code for the Scaffold as well..

return Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(...

and finally, reference the 'bottom' for your EdgeInsets..

body: SingleChildScrollView(
reverse: true,
child: Padding(
padding: EdgeInsets.only(bottom: bottom),
child: Container(...
like image 38
Chris Avatar answered Nov 05 '22 08:11

Chris