我无法添加容器
I cannot add container
嗨,我是 Flutter 新手。完成第一个容器后,我无法再添加另一个容器。它一直说错误。这是我的代码供您查看。
class UserProfile 扩展了 StatelessWidget {
const UserProfile({ Key? key }) : super(key: key);
@覆盖
小部件构建(BuildContext 上下文){
return材质应用(
debugShowCheckedModeBanner: false,
家:脚手架(
应用栏:应用栏(
backgroundColor: Colors.black,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text (' SmartParking '),
Icon(Icons.directions_car,
color: Colors.yellow, size: 30),
],), ),
body: Container(
child: Padding(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget> [
Column(
children: [
Icon(Icons.local_parking),
Text("Wallet"),
Text("RM40.00",
style: TextStyle(
fontWeight: FontWeight.bold)
,
),
],
),
Column(
children: [
Icon(Icons.account_balance_wallet_outlined),
Text("110",
style: TextStyle(
fontWeight: FontWeight.bold)),
GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationPage()
), );
},
),
Text ('points',
),
],
),
],
),
),
),
),
);
}
}
Wrap Container
在 Scaffold()
Scaffold(
child: Container(
child: Padding(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget> [
Column(
children: [
Icon(Icons.local_parking),
Text("Wallet"),
Text("RM40.00",
style: TextStyle(
fontWeight: FontWeight.bold),),
],
),
Column(
children: [
Icon(Icons.account_balance_wallet_outlined),
Text("110",
style: TextStyle(
fontWeight: FontWeight.bold)),
Text ('points',
),
],
),
],
),
));
您已经用如下代码所示的列包裹了您的容器
scaffold(child:Column(children:Container()))
嗨,我是 Flutter 新手。完成第一个容器后,我无法再添加另一个容器。它一直说错误。这是我的代码供您查看。
class UserProfile 扩展了 StatelessWidget { const UserProfile({ Key? key }) : super(key: key);
@覆盖 小部件构建(BuildContext 上下文){ return材质应用( debugShowCheckedModeBanner: false, 家:脚手架( 应用栏:应用栏(
backgroundColor: Colors.black,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text (' SmartParking '),
Icon(Icons.directions_car,
color: Colors.yellow, size: 30),
],), ),
body: Container(
child: Padding(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget> [
Column(
children: [
Icon(Icons.local_parking),
Text("Wallet"),
Text("RM40.00",
style: TextStyle(
fontWeight: FontWeight.bold)
,
),
],
),
Column(
children: [
Icon(Icons.account_balance_wallet_outlined),
Text("110",
style: TextStyle(
fontWeight: FontWeight.bold)),
GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationPage()
), );
},
),
Text ('points',
),
],
),
],
),
),
),
),
);
}
}
Wrap Container
在 Scaffold()
Scaffold(
child: Container(
child: Padding(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget> [
Column(
children: [
Icon(Icons.local_parking),
Text("Wallet"),
Text("RM40.00",
style: TextStyle(
fontWeight: FontWeight.bold),),
],
),
Column(
children: [
Icon(Icons.account_balance_wallet_outlined),
Text("110",
style: TextStyle(
fontWeight: FontWeight.bold)),
Text ('points',
),
],
),
],
),
));
您已经用如下代码所示的列包裹了您的容器
scaffold(child:Column(children:Container()))