2021-01-28

How to fix a Form that doesn't scroll

I'm doing a Form but I can't make it scrollable, it just works on the edge from the 'window' but not inside the form, and I made this with the final X = TextFormField because is the only way I found to validate info before submit, this is my code:

I have all the Q's like this:

final usuarioForm = TextFormField(
controller: _idusuarioController,
validator: (value) {
if (value.isEmpty) return 'Llenar campo de Usuario';
return null;
},
style: TextStyle(fontSize: 17.0, color: Colors.deepOrangeAccent),
decoration: InputDecoration(
icon: Icon(Icons.person),
labelText: 'Usuario',
),
);

My form like this:

 final vuelosForm = Form(
      key: _formKey,
      child: ListView(
        shrinkWrap: true,
        scrollDirection: Axis.vertical,
        padding: EdgeInsets.all(10),
        children: [
          usuarioForm,
        ],
      ),
    );

and my scaffold like this:

return Scaffold(
      key: _scaffoldKey,
      resizeToAvoidBottomPadding: false,
      appBar: AppBar(
        title: Text('Vuelos'),
        backgroundColor: Colors.deepOrangeAccent,
      ),
      body: Container(
        child: ListView(
          shrinkWrap: true,
          padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
          children: [
            Center(
              child: Card(
                elevation: 18.0,
                child: Container(
                  padding: EdgeInsets.all(10.0),
                  child: Column(
                    children: [
                      vuelosForm,
                    ],
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );

obviously I have more questions but I don't paste them here because it will be a lot of code.



from Recent Questions - Stack Overflow https://ift.tt/3ppfUoh
https://ift.tt/eA8V8J

No comments:

Post a Comment