DevBoi

[Flutter] 정적 리스트뷰 본문

[Mobile]/[Flutter]

[Flutter] 정적 리스트뷰

HiSmith 2023. 7. 15. 15:53
반응형

앱에 거의 필요한 요소이다.

이전에 포스팅한 내용을 가지고, 해당 사람의 정보를 리스트뷰로 보여주자.

 

Container(
                    //Listview
                    child: ListView(
                      shrinkWrap: true,
                      padding:const EdgeInsets.all(8),
                      children: [
                        Container(
                            height: 50,
                            color: Colors.amber[600],
                            child:const Center(
                                child:Text('11111')
                            )
                        ),
                        Container(
                            height: 50,
                            color: Colors.amber[500],
                            child:const Center(
                                child:Text('22222')
                            )
                        ),
                        Container(
                            height: 50,
                            color: Colors.amber[400],
                            child:const Center(
                                child:Text('33333')
                            )
                        )

                      ],
                    ),
                  )

 

 

우선 위와 같이 짤수 있다. 스크롤은 알아서 되고 미리 지정한 값이 있다면

해당 값대로 노출이된다.

결과는 아래와 같다.

근데 잘 알다 싶이, 이렇게 수동으로 값을 정의하고 리스트뷰를 사용하지 않는다.

대부분 객체를 받아서 리스트로 동적으로 표현하기 마련이다.

그럴때 방법은 다음 포스팅에 적어놓을 예정

 

반응형