gpt4 book ai didi

flutter - 如何在 flutter 中绘制动态高度线?

转载 作者:行者123 更新时间:2023-12-02 16:10:02 26 4
gpt4 key购买 nike

我想画一条动态高度线,如下图所示 as shown here, grey line

我使用带有单边边框的容器做了一些事情

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,
),
)

但问题是线条的角(顶部和底部)没有圆角。
我想在帖子的左侧画一条垂直线,右侧是内容。

最佳答案

你可以尝试这样的事情:

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

这会产生这样的东西:

enter image description here

左边的栏会根据右边的内容自动调整大小。

关于flutter - 如何在 flutter 中绘制动态高度线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68255674/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com