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