How can I decrease the height of the text button? If I force a small height for him it works. But I want the height to be just the height of the text letter. It is possible? I tried wrapping it in an Expanded but it doesn’t work.
Container(
color: Colors.amberAccent[100],
child: TextButton(
onPressed: () {},
child: const Text('Visualizar',
style: TextStyle(color: Colors.black)),
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
),
),
)
as it is now in the code:
How I want it to look:
3
Answers
you can set the width & height of textbutton as follows
or just set height only like this
You can create simple custom buttons with
InkWell
. This way its height is same as yourText
widget’s height.You can also wrap your TextButton with a fixed height/width SizedBox/Container
Container example:
SizedBox(It doesn’t have the color argument, that’s why I removed it from the below code) example: