【发布时间】:2019-12-24 12:01:35
【问题描述】:
这是完整的代码:
class Application extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
body: new Container(
color: Color(0xff258DED),
height: 400.0,
alignment: Alignment.center,
child: new Container(
height: 200.0,
width: 200.0,
decoration: new BoxDecoration(
image: DecorationImage(
image: new AssetImage('assets/logo.png'),
fit: BoxFit.fill
),
shape: BoxShape.circle
),
),
child: new Container(
child: new Text('Welcome to Prime Message',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Aleo',
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: Colors.white
),
),
),
),
),
);
}
}
我尝试在顶部添加Container,然后在其中添加了两个孩子。第一个孩子工作正常,但第二个孩子给了我错误,例如“已指定命名参数'child'的参数”。
【问题讨论】:
-
您必须使用多子小部件,例如 Column 、 Row 、 Stack ...。它加深了您想要放置小部件的方式
标签: flutter dart flutter-layout