class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Center(
child: CircleAvatar(
radius: 40.0,
child: Image.asset('images/pic.jpg'),
),
),
Text(
"michael dub",
),
Text("FLUTTER DEVELOPER"),
Container(
width: 350.0,
height: 70.0,
child: Card(
child: Row(
children: <Widget>[
Icon(
Icons.phone,
),
Text(
"+12-345-678-910",
textAlign: TextAlign.center,
),
],
)))
],
),
),
);
}
}
Asked
Active
Viewed 80 times
-1

Viren V Varasadiya
- 25,492
- 9
- 45
- 61
-
https://stackoverflow.com/a/51639681/3762067 – Varad Mondkar Apr 03 '20 at 18:34
-
Do you want the icon to also be in the center? – Josteve Apr 03 '20 at 19:16
2 Answers
0
in your column, try crossAxisAlignment: CrossAxisAlignment.stretch
EDIT: if you're trying to do what I think you're trying to do, try adding
mainAxisAlignment: MainAxisAlignment.center
to your row

milesau
- 85
- 1
- 7
-
Oh hold on, I missed the Row widget that your text is in. In that case I'm not actually sure I understand what you're trying to do here – milesau Apr 03 '20 at 18:29
0
you need to wrap your text widget with Expanded widget. Default Row Widget will not take full width and it is creating issue.
Check out following code.
Expanded(
child: Text(
"+12-345-678-910",
textAlign: TextAlign.center,
),
),

Viren V Varasadiya
- 25,492
- 9
- 45
- 61