add icon to text field flutter code example
Example 1: flutter textfield with icon onclick
TextField(
controller: _controller,
decoration: InputDecoration(
hintText: "Enter a message",
suffixIcon: IconButton(
onPressed: () => _controller.clear(),
icon: Icon(Icons.clear),
),
),
)
Example 2: add a leading icon to text field in flutter
TextField(
// ...,other fields
decoration: InputDecoration(
prefixIcon: prefixIcon??Icon(Icons.done),
),
),