개발노트/Flutter
[Flutter]RenderBox was not laid out 에러 처리
전지적진영시점
2023. 3. 18. 09:29
개발 환경
---------------------------------
OS : Mac
개발 툴 : android studio
개발 언어 : dart
개발 프레임워크 : flutter
---------------------------------
====================================================================================================
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: RenderDecoratedBox#d1e30 relayoutBoundary=up6
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2009 pos 12: 'hasSize'
1. Expanded Widget 사용
Column(
children: <Widget>[
Expanded(
child: ListView(...),
)
],
)
2. Flexible Widget 사용
Column(
children: <Widget>[
Flexible(
child: ListView(...),
)
],
)
3. SizedBox Widget 사용
Column(
children: <Widget>[
SizedBox(
height: 200,
child: ListView(),
)
],
)
4. ListView의 shrinkWrap 사용
Column(
children: <Widget>[
ListView(
shrinkWrap: true,
)
],
)