📅  最后修改于: 2022-03-11 14:59:12.857000             🧑  作者: Mango
//To clear a textField, use a TextEditing Controller
final _controller = TextEditingController();
Column(
children: [
TextField(
decoration: InputDecoration(labelText: 'Title'),
controller: _controller,
onChanged: (value) {
titleInput = value;
}),
ElevatedButton(
onPressed: () => _controller.clear(),
child: Text('Add Transaction!'),
),
],
),