
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
listView.builder를 설정하면 아래와 같이 화면이 그려지지 않고 소스에는 에러가 없는데
디버거 콘솔에서 에러가 납니다.
ListView.builder( // 15. ListView.builder 설정 ◆◆◆◆◆◆◆◆◆◆◆◆◆
itemCount: dataList.length,
itemBuilder: (context, index) {
return Text('TEST', // ---> TEST라는 글자가 보여야 되는 거 아닌 가요? ◆◆◆
);
},
),
왜 이런 현상이 일어 나나요?
확인 부탁 드립니다.
감사합니다.
==============================================================================================================
-- 디버거 콘솔에서 @@@
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performResize():
Vertical viewport was given unbounded height.
Viewports expand in the scrolling direction to fill their container. In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. This situation typically happens when a scrollable widget is nested inside another scrollable widget.
If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. In this case, consider using a Column or Wrap instead. Otherwise, consider using a CustomScrollView to concatenate arbitrary slivers into a single scrollable.
The relevant error-causing widget was
ListView
When the exception was thrown, this was the stack
#0 RenderViewport.computeDryLayout.<anonymous closure>
#1 RenderViewport.computeDryLayout
#2 RenderBox.performResize
#3 RenderObject.layout
#4 RenderBox.layout
#5 RenderProxyBoxMixin.performLayout
#6 RenderObject.layout
#7 RenderBox.layout
#8 RenderProxyBoxMixin.performLayout
#9 RenderObject.layout
#10 RenderBox.layout
#11 RenderProxyBoxMixin.performLayout
#12 RenderObject.layout
#13 RenderBox.layout
#14 RenderProxyBoxMixin.performLayout
#15 RenderObject.layout
#16 RenderBox.layout
#17 RenderProxyBoxMixin.performLayout
#18 RenderObject.layout
#19 RenderBox.layout
#20 RenderProxyBoxMixin.performLayout
#21 RenderObject.layout
#22 RenderBox.layout
#23 RenderProxyBoxMixin.performLayout
#24 RenderObject.layout
#25 RenderBox.layout
#26 RenderProxyBoxMixin.performLayout
#27 RenderCustomPaint.performLayout
#28 RenderObject.layout
#29 RenderBox.layout
#30 RenderProxyBoxMixin.performLayout
#31 RenderObject.layout
#32 RenderBox.layout
#33 ChildLayoutHelper.layoutChild
#34 RenderFlex._computeSizes
#35 RenderFlex.performLayout
#36 RenderObject.layout
#37 RenderBox.layout
#38 RenderPadding.performLayout
#39 RenderObject.layout
#40 RenderBox.layout
#41 ChildLayoutHelper.layoutChild
#42 RenderFlex._computeSizes
#43 RenderFlex.performLayout
#44 RenderObject.layout
#45 RenderBox.layout
#46 MultiChildLayoutDelegate.layoutChild
#47 _ScaffoldLayout.performLayout
#48 MultiChildLayoutDelegate._callPerformLayout
#49 RenderCustomMultiChildLayoutBox.performLayout
#50 RenderObject.layout
#51 RenderBox.layout
#52 RenderProxyBoxMixin.performLayout
#53 RenderObject.layout
#54 RenderBox.layout
#55 RenderProxyBoxMixin.performLayout
#56 _RenderCustomClip.performLayout
#57 RenderObject.layout
#58 RenderBox.layout
#59 RenderProxyBoxMixin.performLayout
#60 RenderObject.layout
#61 RenderBox.layout
#62 RenderProxyBoxMixin.performLayout
#63 RenderObject.layout
#64 RenderBox.layout
#65 RenderProxyBoxMixin.performLayout
#66 RenderObject.layout
#67 RenderBox.layout
#68 RenderProxyBoxMixin.performLayout
#69 RenderObject.layout
#70 RenderBox.layout
#71 RenderProxyBoxMixin.performLayout
#72 RenderObject.layout
#73 RenderBox.layout
#74 RenderProxyBoxMixin.performLayout
#75 RenderObject.layout
#76 RenderBox.layout
#77 RenderProxyBoxMixin.performLayout
#78 RenderObject.layout
#79 RenderBox.layout
#80 RenderProxyBoxMixin.performLayout
#81 RenderObject.layout
#82 RenderBox.layout
#83 RenderProxyBoxMixin.performLayout
#84 RenderObject.layout
#85 RenderBox.layout
#86 RenderProxyBoxMixin.performLayout
#87 RenderObject.layout
#88 RenderBox.layout
#89 RenderProxyBoxMixin.performLayout
#90 RenderObject.layout
#91 RenderBox.layout
#92 RenderProxyBoxMixin.performLayout
#93 RenderObject.layout
#94 RenderBox.layout
#95 RenderProxyBoxMixin.performLayout
#96 RenderObject.layout
#97 RenderBox.layout
#98 RenderProxyBoxMixin.performLayout
#99 RenderObject.layout
#100 RenderBox.layout
#101 RenderProxyBoxMixin.performLayout
#102 RenderObject.layout
#103 RenderBox.layout
#104 RenderProxyBoxMixin.performLayout
#105 RenderObject.layout
#106 RenderBox.layout
#107 RenderProxyBoxMixin.performLayout
#108 RenderOffstage.performLayout
#109 RenderObject.layout
#110 RenderBox.layout
#111 RenderProxyBoxMixin.performLayout
#112 RenderObject.layout
#113 RenderBox.layout
#114 _RenderTheatre.performLayout
#115 RenderObject.layout
#116 RenderBox.layout
#117 RenderProxyBoxMixin.performLayout
#118 RenderObject.layout
#119 RenderBox.layout
#120 RenderProxyBoxMixin.performLayout
#121 RenderObject.layout
#122 RenderBox.layout
#123 RenderProxyBoxMixin.performLayout
#124 RenderObject.layout
#125 RenderBox.layout
#126 RenderProxyBoxMixin.performLayout
#127 RenderObject.layout
#128 RenderBox.layout
#129 RenderProxyBoxMixin.performLayout
#130 RenderObject.layout
#131 RenderBox.layout
#132 RenderProxyBoxMixin.performLayout
#133 RenderObject.layout
#134 RenderBox.layout
#135 RenderProxyBoxMixin.performLayout
#136 RenderObject.layout
#137 RenderBox.layout
#138 RenderProxyBoxMixin.performLayout
#139 RenderObject.layout
#140 RenderBox.layout
#141 RenderView.performLayout
#142 RenderObject._layoutWithoutResize
#143 PipelineOwner.flushLayout
#144 RendererBinding.drawFrame
#145 WidgetsBinding.drawFrame
#146 RendererBinding._handlePersistentFrameCallback
#147 SchedulerBinding._invokeFrameCallback
#148 SchedulerBinding.handleDrawFrame
#149 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
The following RenderObject was being processed when the exception was fired: RenderViewport#0c3f2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderViewport#0c3f2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=407.4, 0.0<=h<=Infinity)
size: MISSING
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#4a665(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#40921, ScrollDirection.idle)
anchor: 0.0
center child: RenderSliverPadding#4cff4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: paintOffset=Offset(0.0, 0.0)
constraints: MISSING
geometry: null
padding: EdgeInsets.zero
textDirection: ltr
child: RenderSliverList#e1a71 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: paintOffset=Offset(0.0, 0.0)
constraints: MISSING
geometry: null
no children current live
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderViewport#0c3f2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderViewport#0c3f2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderIgnorePointer#03168 relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderSemanticsAnnotations#51c2b relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPointerListener#4fd51 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderSemanticsGestureHandler#b30c3 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPointerListener#43894 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: _RenderScrollSemantics#cea58 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderRepaintBoundary#3610f relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderCustomPaint#9192d relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderRepaintBoundary#7d352 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Column
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderFlex#32230 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Padding
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPadding#14804 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Column
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderFlex#67c0c relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Scaffold
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderRepaintBoundary#7d352 relayoutBoundary=up4 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Column
════════════════════════════════════════════════════════════════════════════════
Reloaded 0 libraries in 324ms (compile: 6 ms, reload: 0 ms, reassemble: 183 ms).
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomePage(), // 홈페이지 보여주기
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// 음식 사진 데이터
List<Map<String, dynamic>> dataList = [
{
"category": "탑건: 매버릭",
"imgUrl": "https://i.ibb.co/sR32PN3/topgun.jpg",
},
{
"category": "마녀2",
"imgUrl": "https://i.ibb.co/CKMrv91/The-Witch.jpg",
},
{
"category": "범죄도시2",
"imgUrl": "https://i.ibb.co/2czdVdm/The-Outlaws.jpg",
},
{
"category": "헤어질 결심",
"imgUrl": "https://i.ibb.co/gM394CV/Decision-to-Leave.jpg",
},
{
"category": "브로커",
"imgUrl": "https://i.ibb.co/MSy1XNB/broker.jpg",
},
{
"category": "문폴",
"imgUrl": "https://i.ibb.co/4JYHHtc/Moonfall.jpg",
},
];
// 화면에 보이는 영역
return Scaffold(
// 00. home: Scaffold(비계) 위젯 ■■
appBar: AppBar(
// 01. appBar■
centerTitle: false,
backgroundColor: Colors.white, // 배경색 설정
title: Text(
'Movie Reviews[T_01]',
style: TextStyle(
fontSize: 30, // 폰트 크기
fontWeight: FontWeight.bold, // 폰트 두께
color: Color.fromARGB(255, 10, 10, 10), // 폰트 색상
),
),
), // 01. appBar 위젯■ ==================================>
body: Column(
children: [
Padding(
// 02. body■
padding: const EdgeInsets.all(2.0), // 패딩 설정(전방위 모두 동일하게 적용)
child: Column(
children: [
ListView.builder( // 15. ListView.builder 설정 ◆◆◆◆◆◆◆◆◆◆◆◆◆
itemCount: dataList.length,
itemBuilder: (context, index) {
return Text('TEST',
);
},
), // 15. ListView.builder 설정 ◆◆◆◆◆◆◆◆◆◆◆◆◆
],
),
),
],
),
);
}
}
