ram2 🚗

[Flutter] CustomSingleChildLayout 정리 본문

💧 flutter

[Flutter] CustomSingleChildLayout 정리

coram22 2022. 7. 6. 00:42
728x90
반응형

CustomSingleChildLayout

childe의 레이아웃을 지정하는 위젯이다.

  • delegate은 child 레이아웃의 constraints를 결정할 수 있다. 또한 child를 어디에 둘지, parent의 크기를 결정한다. 하지만 parent는 child의 크기에 의존하지 않는다.
  • CustomSingleChildLayout은 delegate를 지정해야 한다.
  • 주로 grid를 만들 때 쓰인다.

정리하면, child의 위치, 크기를 결정할 때 사용하는 layout 중 하나이다.

 

example 1)

const CustomSingleChildLayout({
    Key key,
    @required this.delegate,
    Widget child,
  })

 

example 2)

Widget single(){
  return CustomSingleChildLayout(delegate: delegate)
}
728x90
반응형