我使用带有一侧边框的容器做了一些事情
Container(
child:(content goes here....)
margin: EdgeInsets.symmetric(horizontal:16+20.0),
decoration: BoxDecoration(
border: Border(
left: BorderSide(width: 2.0, color: Colors.lightBlue.shade600),
),
color: Colors.white,
),
)
但问题是线的角(顶部和下方)没有圆角。
我想在帖子的左边画一条竖线,右边是内容。
答案 0 :(得分:4)
你可以尝试这样的事情:
IntrinsicHeight(
child: Row(
children: [
Container(
width: 5,
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
color: const Color(0x7f9e9e9e),
),
),
Expanded(child: **content goes here**),
],
),
)
这里有一个 DartPad 示例:Example
这会产生这样的结果:
左侧的栏将根据右侧的内容自动调整大小。