Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color in TextButton.icon

I want to have an icon with text, so I used TextButton.icon but I can not change the color of the text or icon! Please suggest if anyone has a solution this is my code:

SizedBox(height: 8,),
        TextButton.icon(
          icon: Icon(Icons.delete),
          label: Text('delete'),

          onPressed: (){},
        ),
like image 938
Saied Rahimi Avatar asked Feb 01 '26 02:02

Saied Rahimi


1 Answers

You can use the TextButton.stylefrom on the style of the TextButton. In this method, you can use "foregroundColor" to set the colors of both the icon and label. If you want to set another color for the icon, you can set the icon color in Icon.

TextButton.icon(
   onPressed:(){},
   style: TextButton.styleFrom(
      foregroundColor: Colors.blue,
   ),
   icon: Icon(Icons.ac_unit, color: Colors.red),
   label: Text("label"),
 )
like image 161
Emmanuel Ashitey Avatar answered Feb 03 '26 00:02

Emmanuel Ashitey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!