ListView에 동일한 패딩을 적용하면 마지막 항목에 도달했을때 불필요한 패딩이 들어가는 경우가 있다.
그럴때는 mapIndexed() 메소드를 응용해볼 수 있다.
const List items = [];
items.mapIndexed((index, e) => Padding(padding: EdgeInsets.only(bottom : index == items.length -1 ? 0 : 16.0,
)
728x90
'Flutter' 카테고리의 다른 글
[Flutter] 함수형 프로그래밍 (0) | 2023.06.29 |
---|---|
[Flutter] debounce & Throttle (0) | 2023.06.29 |
[Flutter] (Cache) 캐시 관리 (0) | 2023.06.28 |
[Flutter] Pagination (0) | 2023.06.28 |
[Flutter] constrain box size (0) | 2023.06.10 |