Answers for "clear textfield in flutter"

1

flutter clear all text in textfield

TextField(
  controller: _controller,
  decoration: InputDecoration(
    hintText: "Enter a message",
    suffixIcon: IconButton(
      onPressed: () => _controller.clear(),
      icon: Icon(Icons.clear),
    ),
  ),
)
Posted by: Guest on July-01-2020
0

flutter textformfield clear value

final TextEditingController _textController = new TextEditingController();
TextField(
          controller: _textController,
          decoration: InputDecoration(
              hintText: "Username",
              suffixIcon: IconButton(
                onPressed: () {
                  setState(() {
                    _textController.clear();
                  });
                },
              )),
        )
Posted by: Guest on November-10-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language