Mar*_*rek 3 dart flutter flutter-layout
我在容器(1)内创建了容器(2)。您能帮忙如何向容器添加文本吗(1)?下面是我的代码
return Scaffold(
body:
Padding(
padding: const EdgeInsets.only(top: 100, left: 30, right: 30, bottom: 25,),
child: Container(
height: 300,
color: Colors.red,
alignment: Alignment.bottomLeft,
child: Container(
width: 360,
height: 230,
color: Colors.blue,
child: Align(
alignment: Alignment.center,
child: Text(
'Car or sport car'
maxLines: 3,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
),
),
),
),
),
),
Run Code Online (Sandbox Code Playgroud)
小智 6
你只需要Column, Row or Stack在第一个里面放一个Container。这是一个例子,供您理解。
return Scaffold(
body:
Padding(
padding: const EdgeInsets.only(top: 100, left: 30, right: 30, bottom: 25,),
child: Container(
height: 300,
color: Colors.red,
alignment: Alignment.bottomLeft,
child: Column(
children: [
Text("Put your Text Here!!!!"),
Container(
width: 360,
height: 230,
color: Colors.blue,
child: Align(
alignment: Alignment.center,
child: Text(
'Car or sport car'
maxLines: 3,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
),
),
),
),]
),
),
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22635 次 |
| 最近记录: |