Flutter--自定义AppBar的actions中组件的大小

AppBar中指定了actions按钮的约束条件,必须通过UnconstrainedBox来 “去除” 父元素的限制。

//如果UnconstrainedBox 的大小超过它父组件约束时,也会导致溢出报错

AppBar(
  title: Text(title),
  actions: <Widget>[
    UnconstrainedBox(
      child: SizedBox(
        width: 20,
        height: 20,
        child: CircularProgressIndicator(
          strokeWidth: 3,
          valueColor: AlwaysStoppedAnimation(Colors.white70),
        ),
      ),
    )
  ],
)

Guess you like

Origin blog.csdn.net/weixin_41735943/article/details/120786496