As titled, padding: EdgeInsets.zero
doesn’t seem to work.
Container(
height: 30,
width: 60,
padding: EdgeInsets.zero,
decoration: BoxDecoration(
color: Colors.green, borderRadius: BorderRadius.circular(6)),
child: Padding(
padding: EdgeInsets.zero,
child: TextButton(
child: Text('Login', style: TextStyle(fontSize: 14, color: Colors.white)),
onPressed: () {},
),
),
),
2
Answers
Try this: Wrap your container in this
From your comment:
You can do that like this. No need for Containers
You can also change the minimum size of the widget by adding
minimumSize
to theButtonStyle
. For example:minimumSize: MaterialStateProperty.all(Size(10, 10)),
This will make the minimum size 10×10, if your text size is small enough.
But keep in mind that you need to be able to easily press the button too.
Also check this:
https://api.flutter.dev/flutter/material/ButtonStyle-class.html