[Flutter] CustomSingleChildLayout ์ •๋ฆฌ
ยท
๐Ÿ’ง flutter
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(){ ret..