AnswerBun.com

Flutter - Como usar ScrollView corretamente ao mostrar o teclado?

Stack Overflow em Português Asked on January 2, 2022

Já vi vários videos no youtube sobre isso mas no meu código não funciona como no video.
Já olhei algumas perguntas e alguns sujerem usar o código abaixo, mas não resolve o problema.

Scaffold(
   body: SingleChildScrollView(...),
   ...

Já tentei usar ListView mas sempre tenho o mesmo resultado.
O gif abaixo ilustra o que ocorre: Ao abrir o teclado o layout não move pra cima mostrando o campo de texto.

gif ilustrativo

Tentei usar FocusNode no TextField mas tbm não funciona.
Meu código é esse.

var itemlBorder = OutlineInputBorder(borderSide: BorderSide(color: MyTheme.tintColor()));

return Scaffold(
   appBar: AppBar(title: Text('PageTitle')),
   body: SingleChildScrollView(
      padding: EdgeInsets.symmetric(horizontal: 10),
      child: Column(children: [
         //Titulo
         Container(
            height: 50,
            margin: EdgeInsets.only(top: 10),
            padding: EdgeInsets.only(left: 10, right: 10, top: 7),
            decoration: BoxDecoration(
               borderRadius: BorderRadius.all(Radius.circular(5)),
               color: MyTheme.tintColor()
            ),
            child: TextField(
              textInputAction: TextInputAction.next,
              controller: _cTitulo,
              keyboardType: TextInputType.name,
              decoration: InputDecoration(
                contentPadding: EdgeInsets.fromLTRB(12, 0, 12, 0),
                enabledBorder: itemlBorder,
                focusedBorder: itemlBorder,
                labelText: 'Titulo'.toUpperCase(),
              ),
            ),
         ),
         //Anexo
         Container(...
      ...
      ]
   )
)

One Answer

Consegui resolver este problema. O problema não está no código e sim no AndroidManifest.xml. Apenas adicionei android:windowSoftInputMode="adjustResize" na tag activity

Answered by Jonas Ferreira on January 2, 2022

Add your own answers!

Related Questions

Web View com zoom

1  Asked on September 8, 2020 by joel-messias-do-nascimento

       

Selecionar uma div sem ela ter uma class ou um id?

3  Asked on September 7, 2020 by i_like_trains

 

Equivalente de “Date.now();” do Javascript em C#?

4  Asked on September 5, 2020 by matheus-miranda

         

EventListener em um link a

0  Asked on September 5, 2020 by user190650

       

Soma de duas tabelas diferentes msql php

1  Asked on September 4, 2020 by renato

   

Erro ao executar projeto Angular

1  Asked on September 3, 2020 by diego-estacho

       

Erro em cadastro.php com mysql (etapa final) “INSERT”

2  Asked on August 25, 2020 by user196053

       

Retornar duas funções em um evento onclick JS

1  Asked on August 24, 2020 by anderson-leandro

       

Erro no incremento de array com foreach mais HTML

0  Asked on August 21, 2020 by wesley-souza

       

Listagem de um array dentro de um JSON angular

1  Asked on August 20, 2020 by joao-vitor-franco

     

Switch Case – Break e Return dentro de uma Função – Arduino

0  Asked on August 15, 2020 by lucio-carlos-resende

       

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP