티스토리 뷰
[Flutter] ListView 오류 Vertical viewport was given unbounded height.
HoZang 2024. 5. 17. 10:21[Flutter] ListView 오류 Vertical viewport was given unbounded height.
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 ListView:file:///... ...
ListView 위젯을 하위 위젯으로 사용할 때 이런 오류가 나온다면 SizedBox 위젯으로 감싸준다.
...
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 200,
child: ListView(
padding: const EdgeInsets.symmetric(vertical: 8),
children: widget.products.map((product) {
return ShoppingListItem(product: product, inCart: _shoppingCart.contains(product), onCardChanged: _handleCartChanged);
}).toList(),
),
),
],
),
),
);
}
...
'Programming Framework > Flutter' 카테고리의 다른 글
[Flutter] JsonSerialize(encode / decode) (0) | 2024.05.24 |
---|---|
[Flutter] SliverList 고정되는 항목 만들기 (0) | 2024.05.23 |
[Flutter] 우측 상단 'DEBUG' 배너 제거하기 (0) | 2024.05.16 |
[Flutter] IntelliJ Device Manager 버튼 안 보일 때 활성화 방법 (0) | 2024.05.16 |
[Flutter] 플러터 웹 디버깅 포트 지정 (0) | 2024.05.14 |
- Total
- Today
- Yesterday
- CentOS
- Linux
- Java
- Fedora
- Spring
- high1
- Entity Framework Core
- asp.net core
- 전자정부
- 자바
- egov
- Eclipse
- 이클립스
- 하이원
- MySQL
- eGovFrame
- .NET Core
- 스프링
- Flutter
- Windows
- jQuery
- JSP
- DART
- dotnet core
- express
- MariaDB
- c#
- ubuntu
- egoverment
- php
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |