flutter - 垂直分隔线未显示

标签 flutter flutter-layout

我正在尝试使用 VerticalDivider用于分隔 Row 中的项目的小部件. Here是整个 body 。

enter image description here

行:

Row(
  children: <Widget>[
    Text('420 Posts', style: TextStyle(color: Color(0xff666666)),),
    VerticalDivider(
      thickness: 2,
      width: 20,
      color: Colors.black,
    ),
    Text('420 Posts', style: TextStyle(color: Color(0xff666666)),)
  ],
),

最佳答案

包裹您的 RowIntrinsicHeight ,

IntrinsicHeight(
  child: Row(
    children: <Widget>[
      Text('420 Posts', style: TextStyle(color: Color(0xff666666)),),
      VerticalDivider(
        thickness: 2,
        width: 20,
        color: Colors.black,
      ),
      Text('420 Posts', style: TextStyle(color: Color(0xff666666)),)
    ],
  ),
)

关于flutter - 垂直分隔线未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59960153/

相关文章:

Flutter:导航后淡入小部件

flutter - 参数类型 'Stream<dynamic>' 无法分配给参数类型 'Stream<QuerySnapshot>?'

dart - 如何在Listview.Builder中添加一些底部值?

flutter - Flutter :- Create circular border around icons

flutter - 它们在 flutter 中是什么意思 'cross axis' ?

android - Flutter RawKeyboardListener 听两次?

Flutter:SliverPersistentHeader 在滚动时重建自身

flutter - 更改小部件评论颜色的 flutter 结束

使用分隔符按百分比进行 flutter 行布局

Flutter:Dismissible 小部件内的 SnackBar 无法正常工作