i have a little problem with UI component.
I have created my own widget that contains elevatedButton – it is supposed to be used for login instances.
The problem is that i can not center properly my text widget.
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 25,
child: Image.asset(
imagepath,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
text,
textAlign: TextAlign.center,
),
),
),
],
),
],
)
https://imgur.com/a/NF82cW9 – here is example of my problem.
The beggining of Text widget is not on the same width – and it should be.
How can i solve that?
2
Answers
have you tried centering the text widget?
or you should try to wrap text widget only with expanded widget instead of pading widget that will solve your problem probably.
Replace
Expanded
withFlexible
If doesn’t work wrap text widget with
Center