add icon in textfield 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: text form field prefix icon
TextField(
// ...,other fields
decoration: InputDecoration(
prefixIcon: prefixIcon??Icon(Icons.done),
),
),