gpt4 book ai didi

容器内的 Flutter 文本

转载 作者:行者123 更新时间:2023-12-05 09:33:47 28 4
gpt4 key购买 nike

我在容器 (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,
),
),
),
),
),
),

最佳答案

您只需要在第一个Container 中放置一个Column、Row 或Stack。下面是一个例子,供您理解。

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,
),
),
),
),]
),
),
),

关于容器内的 Flutter 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67054067/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com