颤振中 IntrinsicHeight 的替代方案是什么?

Tre*_*ree 5 dart flutter

我有这个代码在bottomNavigationBar

      bottomNavigationBar: BottomAppBar(
        child: IntrinsicHeight(
          child: Row(
            children: <Widget>[
              IconButton(
                icon: Icon(Icons.arrow_back_ios),
                onPressed: () => Navigator.of(context).pop(),
              ),
              Spacer(),
              IconButton(
                icon: Text(
                  "QR",
                  style: Theme.of(context).textTheme.title,
                ),
                onPressed: () => Navigator.of(context).pop(),
              ),
              VerticalDivider(
                color: Theme.of(context).textTheme.headline.color,
              ),
              IconButton(
                icon: Icon(Icons.share),
                onPressed: () => Navigator.of(context).pop(),
              ),
            ],
          ),
        ),
      ),
Run Code Online (Sandbox Code Playgroud)

并且代码按预期工作。

在此处输入图片说明

如果我删除 IntrinsicHeight 小部件,则分隔符会一直穿过所有屏幕。

在此处输入图片说明

我想要替代方案的原因是因为在IntrinsicHeight它的文档中说: This class is relatively expensive. Avoid using it where possible.

什么是便宜的替代品?

谢谢

Rém*_*let 7

如果您正在寻找“一种让行适合动态内容最小高度的廉价方法”,那么没有。

廉价的解决方案是,在Row- 通常通过将其包裹在固定高度上SizedBox

SizedBox(
  height: 42,
  child: Row(...),
)
Run Code Online (Sandbox Code Playgroud)

如果内容具有固定高度,这很有效。但如果高度是动态的,则不会。