[英]what is the route cause of Yellow underline for the Text in Flutter
我是Flutter的新手。 我正在准备登录页面。 同样,我正在使用“文本”小部件。 为此,我得到黄色双下划线。
我正在尝试使用脚手架作为路线布局进行修复
return new Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),
),
child: MaterialApp(
home: SingleChildScrollView(
child:Text('Test')
),
),
),
);
只需更改Scaffold
的父级, MaterialApp
应该是所有小部件树的父级。
return MaterialApp(
home: Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),
),
child: SingleChildScrollView(child: Text('Test')),
),
),
);
Remove all other only use text
return new Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),
),
child: new Text(
"your text",
maxLines: 3,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
),
),;
),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.