I need to update the value ListTile inside a card. So onLongPress(), I use showDialog to show a textfield. The initial value of the textfield is updated in initState().
@override
void initState() {
super.initState();
print(widget.project['status_long']);
projectDetailsController = TextEditingController(text: widget.project['status_long']);
}
Here is my showdialog:
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Project Update"),
content: TextField(
controller: projectDetailsController,
maxLines: 100,
keyboardType: TextInputType.multiline,
),
actions: <Widget>[
FlatButton(
child: Text("UPDATE"),
onPressed: () {
_updateProjectDetails("projects/" + widget.project.documentID, projectDetailsController.text);
projectDetailsController.clear();
Navigator.pop(context);
},
),
],
);
},
);
Here is the produced showdialog:

maxLines: 100. If you don't setmaxLinesthen there's no limit. If you need to enforce a limit, you can usemaxLengthinstead. - Derek Lakin