[英]Adding two column of text on Flutter
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.我想在图片中得到这个 output。 Thanks a lot!
非常感谢!
You need to use container to give blue background and then use Column and Text widget.您需要使用容器提供蓝色背景,然后使用 Column 和 Text 小部件。 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),
),
),
],
),
);
}
}
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...我希望这可以帮助你...
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)),
],
),
),
);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.