0
In my app it would be interesting this text come from the bank not in formed of placeholder
but in a text where he could change only a comma if he wanted, but I can’t find a way to do that because I’ve been reading the documentation of the flutter and I couldn’t find anything that would help in this regard.
class CommentStyle extends StatelessWidget {
//Parametros que precisam ser passados para o CommentStyle
const CommentStyle(this.index, this.model, {this.comentario});
final int index;
final UserModel model;
final String comentario;
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Center(
child: Padding(
padding: EdgeInsets.fromLTRB(89.0, 0.0, 0.0, 0.0),
child: StyleTextTitle("Perfil do contato"),
),
),
],
),
Row(
children: <Widget>[
Icon(CupertinoIcons.person_solid),
StyleTextTitle("Nome:"),
StyleTextInfo(model.contactsList[index]["fullname"]),
],
),
Row(
children: <Widget>[
Icon(CupertinoIcons.mail),
StyleTextTitle("E-mail:"),
StyleTextInfo(model.contactsList[index]["email"]),
],
),
//Titulo acima do TextField.
Row(
children: <Widget>[
Icon(CupertinoIcons.pen),
StyleTextTitle("Comentário: "),
],
),
//Aqui que eu quero retornar o texto editavel
CupertinoTextField(
controller: controllerComent,
maxLines: 6,
decoration: BoxDecoration(
border: Border.all(width: 1.0, color: Colors.grey),
borderRadius: BorderRadius.circular(15)),
placeholder: model.contactsList[index]["comentario"],
keyboardType: TextInputType.text,
maxLength: 255,
),
],
)),
],
),
);
}
}
Feed the
controllerComent
with the database data oninitState
( If you’re using a Statefullwidget) or beforereturn
within the methodBuild
(If you are using Statelesswidget). Once you have time, I will create a more detailed answer.– Matheus Ribeiro
Thanks, I’ve been testing here and I couldn’t. Your example would be of great help.
– Marcelo Lemos 7
The parameter he needs to receive is
model.contactsList[index]["id"]
however it is only possible to take these parameters inside my widgetStateLess
that within it I pass the parameters that will pull from the seat but if I put the controller inside it, it accuses as if it were a necessary parameter too and that’s where I brake.– Marcelo Lemos 7
In this case then, put the complete code from where this will be used
TextField
, provide a more complete example helps us help you hahaha– Matheus Ribeiro
Okay, I added rsrs
– Marcelo Lemos 7
I saw that you opened another question at the SOP, this one... If the main question of this question here has already been resolved, please mark one of the answers as ACCEPTED!
– Matheus Ribeiro
I forgot to dial. Thank you for remembering
– Marcelo Lemos 7