본문 바로가기
프로그래밍/Flutter

[Flutter] List<Widget>을 ListView로 사용하는 방법

by YuminK 2022. 5. 16.
SmartRefresher(controller: notifier.refreshController,
  enablePullDown: true,
  enablePullUp: false,
  header: const ClassicHeader(),
    onRefresh: () {
      notifier.loadConf(context);
    },
    child: ListView(
      children: notifier.confList,
    )
  ),

Android로 치면 RefreshLayout 부분을 개발을 하고 있었는데 주어진 형태는 List<Widget>의 형태가 들어가길 원하고 있었다. pull to refresh라는 라이브러리를 사용하여 개발을 하고 있었고 child에 Column을 감싸고 children에 List<Widget>의 형태를 주고 있는데 오류를 계속 뿜어내면서 안 되었다.

 

이걸 왜 지원을 안 하지... 이런 생각도 많이 들었고 Flutter에서 원본 그대로 제공하는 라이브버리도 사용을 해봤는데 결국에는 똑같아서 ... 계속 찾다가 그냥 ListView라는 위젯에.. children으로 List<Widget>을 주면 된다고 하더라...

https://stackoverflow.com/questions/52801075/add-listwidget-to-listview-children-dynamically 
  
엉엉 겨우 이거 때문에 얼마나 삽질을 한건지 ㅠ 
UI처리는 쉽다가도 어렵습니다. 

 

 

댓글