Shazam의 기본 페이지를 따라 만드는 도중 GridView 자식 위젯의 bottom overflow 발생...
overflow 발생
자식 위젯인 Container에서 height 설정, GridView의 shrinkWrap 설정 등 최대한 아는 다양한 방법을 시도해봤지만 실패...
2. 해결 방안
Expanded(
child: GridView.count(
// crossAxisCount is the number of columns
crossAxisCount: 2,
// <<해결 방안>>
childAspectRatio: 0.75, // 자식의 비율 설정...
// This creates two columns with two items in each column
children: List.generate(songs.length, (index) {
그러다 찾은 해결 방안은 GridView.count의 설정인 childAspectRatio의 값을 설정해주는 것
childAspectRatio 옵션은 말 그대로 GridView의 자식 위젯의 비율을 정하는 옵션입니다.
저의 경우 자식 위젯이 bottom overflow가 발생했음으로 세로방향의 길이를 늘려야했습니다. 따라서 해당 옵션의 값을 1보다 작게 줘 길이를 세로로 늘렸습니다.