Reputation: 45
i want add two line of different type text in my homepage. But when i add another Text widget nothing happen. Here is my code;
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Center(
child: Text(
"Hello",
style: TextStyle(fontSize: 28, color: Colors.white),
),
),
],
);
}
}
i want to get this output in picture exactly. Thanks a lot!
Upvotes: 1
Views: 618
Reputation: 1698
I hope this answers your question
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// first text
Text('Hello', style: TextStyle(fontSize: 15, color: Colors.white)),
// second text
Text('Izabella',
style: TextStyle(fontSize: 25, color: Colors.white)),
],
),
),
);
}
}
Upvotes: 0
Reputation: 399
You need to use container to give blue background and then use Column and Text widget. You are using Text color as white with background color also white, how will that show...
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.blue,
child: Column(
children: <Widget>[
Center(
child: Text(
"Hello",
style: TextStyle(fontSize: 28, color: Colors.white),
),
),
Center(
child: Text(
"Izabella",
style: TextStyle(fontSize: 38, color: Colors.white),
),
),
],
),
);
}
}
Upvotes: 1
Reputation: 3218
this is like your Image ...
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Center(
child: Text(
"Hello",
style: TextStyle(fontSize: 14, color: Colors.white),
),
),
Center(
child: Text(
"Izabella",
style: TextStyle(fontSize: 38, color: Colors.white),
),
),
],
);
}
}
I hope this help you...
Upvotes: 0