Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

clear textfield dart

//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!'),
              ),
            ],
          ),
Source by fluttertutorial.in #
 
PREVIOUS NEXT
Tagged: #clear #textfield #dart
ADD COMMENT
Topic
Name
1+3 =