FlutterK 使Row的子元素可以自适应高度

https://stackoverflow.com/questions/52113356/flutter-vertical-divider-as-tall-as-its-parent

You can use IntrinsicHeight for this.

I used Container for my divider in this example, because I needed border radius on my divider, but you can use VerticalDivider too.

IntrinsicHeight(

        child: Row(children: <Widget>[]

)

中间的分割线是自适应高度的

Container(
      padding: EdgeInsets.only(left: 30, top: 40, right: 30, bottom: 20),
      decoration: BoxDecoration(
        color: Colors.white,
      ),
      child: IntrinsicHeight(
        child: Row(
          children: [
            Expanded(
              child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                Text('佣金奖励'),
                SizedBox(
                  height: 20,
                ),
                Text('¥200.00'),
              ]),
            ),
            VerticalDivider(
              width: 1,
              thickness: 1,
              indent:0,
              endIndent: 0,
              color: Colors.red,
            ),
            Expanded(
                child: Padding(
                  padding: const EdgeInsets.only(left:8.0),
                  child: Column(

                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
              Text('成交人数'),
              Expanded(child: Container()),
              Text('拉新人数'),
            ]),
                )),
          ],
        ),
      ),
    );

猜你喜欢

转载自blog.csdn.net/gaoyp/article/details/120561034
今日推荐