【发布时间】:2020-03-02 10:36:14
【问题描述】:
我正在尝试将一条水平线(当前为Divider,但可以更改为CustomPaint)作为Row 的背景。但是,无论孩子的顺序如何,该行始终位于Row 的前面。我不知道出了什么问题。这是代码。
Stack(
children: <Widget>[
Positioned.fill(
child: const Divider(color: Colors.black),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Ink(
decoration: ShapeDecoration(
color: Colors.grey[350],
shape: CircleBorder(),
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Icon(Icons.arrow_forward, size: 32)
),
),
Ink(
decoration: ShapeDecoration(
color: Colors.grey[350],
shape: CircleBorder(),
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Icon(Icons.location_on, size: 32)
),
),
Ink(
decoration: ShapeDecoration(
color: Colors.grey[350],
shape: CircleBorder(),
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Icon(Icons.flag, size: 32)
),
),
],
),
],
),
这是结果图像。
【问题讨论】:
-
移除 Positioned.fill
-
@Z.Cajurao 不工作,并且破坏了布局(行未居中)