I want to change the position of the text in this ElevatedButton, how to make it from the center to the right or left
I tried using the TextAlign but it didn't work...
CodePudding user response:
You can specify style
for button
and make needed padding
.
Like in the example below I set padding
from the left 16 and from the right 0.
ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsetsDirectional.only(
start: 16,
top: 8,
end: 0,
bottom: 8,
),
),
child: const Text('Click'),
onPressed: () {},
)
Result can see in the image below
CodePudding user response:
It's fine I found a solution...
You can use something like this:
Align(
alignment: Alignment.centerRight,
child:
Text(
'Button Text',
style: TextStyle(fontSize: 25, color: Color(White), fontWeight: FontWeight.bold),
)
)),