texteditingcontroller flutter code example
Example 1: textfield set value flutter
TextFormField(initialValue: "I am smart")
Example 2: 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 3: TextFormFiel text update
TextFormField(
key: Key(_total.toString()),
initialValue: _total.toString(),
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: 'Total',
),
),
Example 4: flutter textfield controller
dependencies:
flutter_spinkit: "^4.1.2"