본문 바로가기
Flutter

GridView정의 두가지 방법

by YoonTaeseong 2019. 10. 18.

인스타 클론 코딩을 하던 도중 GridView에 대해서 사용을 하게 되었다, GridView는 내가 여태 공부 해오던 RecyclerView의 layoutManagwer에서 GridLayout과 똑같이 열의 개수를 정해서 보여주는 Layout  형태이다

 

열의 갯수를 지정하는 총 두 가지 방식이 있다

첫 번째로는 GridView.count()를 만들어서 해당 클래스 프로퍼티의 crossCount 수를 주는 방법이 있고

 

두 번째로는 OrientationBuilder를 이용해서 해당 빌더의 첫 번째 매개변수는 context 두 번 째는 Orientation 즉 landScape모드와 portrait모드 중에서 어떤 형식으로 보이게 할지 정하는 프로퍼티이다 자세한 예제는 

https://flutter.dev/docs/cookbook/design/orientation

 

Update the UI based on orientation

In some situations,you want to update the display of an app when the userrotates the screen from portrait mode to landscape mode. For example,the app might show one item after the next in portrait mode,yet put those same items side-by-side in landscape mod

flutter.dev

위에 처럼 flutter.dev에 잘 나와있다.

'Flutter' 카테고리의 다른 글

Flutter StreamBuilder란??  (0) 2019.10.29
CustomPagePushed  (0) 2019.10.19
FutureBuilder정의  (0) 2019.10.15
fancy_bottom_navigation사용기  (0) 2019.10.13
플러터 dependencies 다운  (0) 2019.10.08

댓글