textfiedl is not a fuction flutter code example
Example 1: edite text in flutter
Widget _editTitleTextField() { if (_isEditingText) return Center( child: TextField( onSubmitted: (newValue){ setState(() { initialText = newValue; _isEditingText =false; }); }, autofocus: true, controller: _editingController, ), ); return InkWell( onTap: () { setState(() { _isEditingText = true; }); }, child: Text( initialText, style: TextStyle( color: Colors.black, fontSize: 18.0, ), );}
Example 2: how to prevent users from entring null values in textfield flutter
FloatingActionButton(
onPressed: ()async {
// setstring(String result){
// widget.updatestring = result;
// return widget.updatestring;
// }
String result1 = await Navigator.push( // string which stores the user entered value
context,
MaterialPageRoute(
builder: (context) => InputScreen(), //screen which has TextField
));
setState(() {
// widget.updatestring = result1;
TodoList(result1);
// setstring(result1);
addItem(result1, false); // function which adds the entered task in a list
});
},
heroTag: "btn2",
child: Icon(Icons.add, color: Color(whitecolor),), backgroundColor: Color(redcolor),),