Flutter - 垂直分频器和水平分频器 [英] Flutter - Vertical Divider and Horizontal Divider
问题描述
在 Flutter 中,是否可以像在图像中一样在组件之间绘制垂直线.
In Flutter, is there an option to draw a vertical lines between components as in the image.
推荐答案
据我所知没有.但是,创建一个非常简单 - 如果您查看 Flutter's Divider 你会看到它只是一个带有单个(底部)边框的 SizedBox
.你可以做同样的事情,但要切换尺寸.
Not as far as I know. However, it is quite simple to create one — if you look at the source for Flutter's Divider you'll see that it is simply a SizedBox
with a single (bottom) border. You could do the same but with dimensions switched.
更新(2018 年 10 月 4 日):VerticalDivider
实现已经 由 Flutter 团队合并.查看 docs 但它使用起来非常简单——只需将其放在连续两个其他项目.
Update (Oct 4, 2018): a VerticalDivider
implementation has been merged in by the Flutter team. Check out the docs but it's very simple to use — simply put it between two other items in a row.
注意:如果您在 Row
小部件中使用 VerticalDivider
作为分隔符,则使用 包装
、Row
IntrinsicHeight Container
或 SizedBox
否则 VerticalDivider
不会显示.对于 Container
和 SizedBox
小部件,您需要定义 height
.
Note: If you are using VerticalDivider
as separator in Row
widget then wrap Row
with IntrinsicHeight
, Container
or SizedBox
else VerticalDivider
will not show up. For Container
and SizedBox
widget you need define height
.
这篇关于Flutter - 垂直分频器和水平分频器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!