我是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')
),
),
),
);
答案 0 :(得分:0)
只需更改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')),
),
),
);
答案 1 :(得分:0)
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,
),
),;
),
);