Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clickable icon on TextFormField - disable TextFormField focus on icon click (Flutter)

I need a textField that has a suffixIcon, but after click on that icon I don't need to open keyboard. How I can do it alternatively without suffixIcon?

enter image description here

like image 661
Andrew Kovalchuk Avatar asked Sep 25 '19 11:09

Andrew Kovalchuk


People also ask

How do you turn off focus on TextFormField in Flutter?

TextField and TextFormField both have an argument called enabled. You can control it using a boolean variable. enabled=true means it will act as an editing text field whereas enabled=false will Disable the TextField Widget.

How do you add a clickable icon on Flutter?

How to Add Icon in Flutter App? You can use Icon() widget to add icons to your Flutter App. You have to pass the icon data as an icon to this widget. You can use default available Material icons with Icons class.

How do I make TextField read only in Flutter?

To make TextField() read only:Use readOnly property of TextField( ) to make TextField read only or not.


1 Answers

Container(
  child: Stack(
    alignment: Alignment.centerRight,
    children: <Widget>[
      TextField(),
      IconButton(
        icon: Icon(Icons.image),
        onPressed: () {
          // do something
        },
      ),
    ],
  ),
)
like image 157
Can Avatar answered Oct 13 '22 22:10

Can