Reputation: 228
I need to show my text on the center of the container. Try to give alignment to container widget and text widget but don't know why it's not showing in the center vertically.
Here is my code
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: stackHeight * 0.5,
width: stackWidth,
color: Colors.red,
child: Column(
children: <Widget>[
Container(
alignment: Alignment.center,
child: Center(
child: Text(
'Would you like to take coffe',
textAlign: TextAlign.center,
)
)
)
],
),
),
),
Upvotes: 0
Views: 817
Reputation: 4119
If you need the column:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
alignment: Alignment.center,
child: Center(
child: Text(
'Would you like to take cock with sand',
textAlign: TextAlign.center,
)))
],
),
And if you don't need it:
Container(
height: 200,
width: 200,
color: Colors.red,
child: Center(
child: Text(
'Would you like to take cock with sand',
textAlign: TextAlign.center,
),
),
),
Upvotes: 2