Flutter RenderBox未布局:RenderFittedBox#79644 relayoutBoundary=up1

Flutter RenderBox未布局:RenderFittedBox#79644 relayoutBoundary=up1,flutter,Flutter,我花了4个小时,无法修复此错误: RenderBox未布局:RenderFittedBox#79644 relayoutBoundary=up1 “package:flatter/src/rendering/box.dart”:失败的断言:第1687行 位置12:“hasSize” 我的代码: Container( width: 50, height: 12, alignment: decorationAlignment,

我花了4个小时,无法修复此错误:

RenderBox未布局:RenderFittedBox#79644 relayoutBoundary=up1 “package:flatter/src/rendering/box.dart”:失败的断言:第1687行 位置12:“hasSize”

我的代码:

Container(
          width: 50,
          height: 12,
          alignment: decorationAlignment,
          child: FittedBox(
            fit: BoxFit.scaleDown,
            child: decoration,
          ),
        ),
但是,如果我删除
alignment:decorationAlignment
,则不会发生错误

你能告诉我为什么吗


非常感谢

添加装饰性标记和装饰的值。默认值似乎是
Container()
,大小已过添加装饰性标记和装饰的值。默认值似乎是
Container()
,大小已过