[Mobile]/[Flutter]
[Flutter] Rendering Object 오류
CALLMESMITHMYNAME
2023. 11. 27. 21:12
반응형
Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a SizedBox widget.
가끔 Expanded를 붙이면 발생하는 오류이다.
이 에러를 해결하기 위해서는 위젯의 상관관계를 알아야 한다.
그냥 무턱대고 쓰면 안되고
Column이나 확장 가능한 위젯 내에서만 사용가능하다.
child: Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: getChildren(cubit.listPerformer, state),
),
올바른 사용 법 은 위와 같다.
또한 파생되서 발생하는 문제는 이런것들이 있다.
Duplicate GlobalKey detected in widget tree.
가끔 Key를 위젯간의 전달을 해줘서 정합성을 체크해준다.
const OneqDetailScreen({Key? key})
: super(
key: key,
);
위젯간 글로벌 키는 다른 포스팅에서 다루겠지만, 해당 부분을 제거 해주면 일단 발생하지 않는 것을 볼 수 있다.
반응형