Andy
Andy

Reputation: 175

ButtonStyle not reducing padding

I'm trying to get my TextButtons smaller to make more room on the Row.

TextButton( // Reply button
    child: Text('Reply'),
    style: ButtonStyle(
        padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.fromLTRB(0, 0, 0, 0)),
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
    )
)

Here's what it looks like in the Inspector enter image description here

Is there any way to get the buttons and the icon up close and personal with each other and get rid of those yellow lines? I must be missing something. Is there a margin property I'm missing?

Any help would be greatly appreciated.

Upvotes: 0

Views: 2787

Answers (2)

Yuriy N.
Yuriy N.

Reputation: 6077

My buttons looked like this before the style was applied:

enter image description here

this code was added:

style: ButtonStyle(
        padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.all(2)),
      )

and now they look like this:

enter image description here

fromLTRB constructor also works - I cannot say what the problem is with OP code.

Upvotes: 1

Vinay Jain
Vinay Jain

Reputation: 428

Wrap your text button inside an sized box . It will reduce its size.Give dimensions of sized box according to your requirements.

Upvotes: 1

Related Questions