я нуждаюсь в том, чтобы ввести textformfield в конце моей страницы с кнопкой в правую сторону. На этой странице и внутри build widget, у меня есть listview с установленным размером и я хочу, чтобы в конце концов было возможно вводить текст в компьютер.
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Mensajes de trabajo"),
backgroundColor: Colors.deepOrange,
),
body: Container(
height: 450,
child: FutureBuilder(
future: _capturaComuna(),
builder: (BuildContext context, AsyncSnapshot snapshot){
if (snapshot.data == null){
return Container(
child: Center(
child: Text("Cargando...")
)
);
} else {
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
return Card(
child: ListTile(
leading: CircleAvatar(
backgroundImage: NetworkImage(snapshot.data[index].imagen_mensaje),
),
title: new Text(snapshot.data[index].nombre_persona + ' ' + snapshot.data[index].fecha_mensaje),
subtitle: Text(snapshot.data[index].texto_mensaje),
)
);
},
);
}
}
)
)
);
}
AquГ - я сделал пример как deberГ, - чтобы быть, используя MediaQuery
, чтобы не быть должным помещать один tamaГ±o, я закрепляю в Container
, только замени из-за твоего snapshot.
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text("Mensajes de trabajo"),
backgroundColor: Colors.deepOrange,
),
body: Container(
height: MediaQuery.of(context).size.height,
child: FutureBuilder(
future: _capturaComuna(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.data == null) {
return Container(child: Center(child: Text("Cargando...")));
} else {
return Stack(
children: [
ListView.builder(
padding: EdgeInsets.only(bottom: 60),
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
return Card(
child: ListTile(
title: new Text(snapshot.data[index]),
subtitle: Text(snapshot.data[index]),
));
},
),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
color: Colors.white,
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
decoration: InputDecoration(
hintText: "Ingresa texto aquí"),
),
),
),
RaisedButton(
child: Text("Enviar"),
onPressed: () {},
),
],
),
),
)
],
);
}
}),
));
}
С этим, когда клавиатура появляется, толкает твой нижний брусок для того, чтобы ты смог видеть, что ты вводишь информацию в компьютер в TextField.