How to set Icon on TextField Widget in Flutter App

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

In this example, we’ll demonstrate how to set an icon on a TextField widget to appear at the start and end of input in a Flutter application. The most effective technique to display the data type of a TextField is through icons. For further details, see the example below:

Set the TextField Icon at the Head and Tail of Input

Full Code Example:

Output Screenshot:

How to add icon inside the field
You need to use the prefixIcon attribute instead of an icon like

TextField(
  decoration: InputDecoration(prefixIcon: Icon(Icons.mail)),
)Code language: CSS (css)
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x