【发布时间】:2021-09-16 00:30:50
【问题描述】:
我正在尝试将所有小部件(2 个图标和文本)居中,但是当我添加中心小部件(在子之前:我放置子行之前:居中(下面的代码))时,没有任何反应, 0 个错误,它只是不工作。
Container(
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(15),
),
),
child: const Icon(
Icons.outbond_outlined,
color: Colors.amber,
size: 50.0,
),
),
Container(
width: 220.0,
height: 100.0,
decoration: const BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.all(
Radius.circular(15),
),
),
child: Row(
// ignore: prefer_const_literals_to_create_immutables
children: [
const Icon(
Icons.call_end_sharp,
color: Colors.amber,
size: 30.0,
),
const Text(
"Skrt",
style: TextStyle(
color: Colors.white,
fontSize: 30.0,
fontFamily: "Lato"),
),
const Icon(
Icons.call_end_sharp,
color: Colors.amber,
size: 30.0,
),
],
),
),
【问题讨论】:
-
嗨马拉克,看起来有两个小部件容器。这些是列还是行?你在哪里使用中心小部件?
-
里面有包装
-
我在第二个Container之前使用它,宽度为220.0
标签: flutter dart widget row center