Flutter_W3
์ค๋์ ๋ชฉํ
๐ย ์ด๋ค Layout Widget๋ค์ด ์๊ณ , ์ด๋ค ์ญํ ์ธ์ง ๋น ๋ฅด๊ฒ ์ตํ๋ค.
๐ย code lab์ ๊ณต๋ถํ๋ฉฐ ์ง์ ๋ฐฐ์ด ๋ด์ฉ์ ์ ์ฉํด๋ณธ๋ค.
๐ธ * Multi-child layout widgets์ ํ์ widget ํญ๋ชฉ๋ค์ ๋ฐฐ์นํ๋ widget์
๋๋ค.
* Sigle-child layout์ ํ๋์ child ๋ผ๋ฉด, ์ Mulit๋ children ์ ๊ฐ๋
์ผ๋ก ์ฌ๋ฌ๊ฐ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํฉ๋๋ค.
- Column class
- ๋ค์์ ์์ ์์ ฏ๋ค์ ์ธ๋ก๋ก ํ์ํ๋ ์์ ฏ
- Column ์์ ฏ์ ์คํฌ๋กค ๋์ง ์์ผ๋ฉฐ(์ฌ์ฉ ๊ฐ๋ฅํ room๋ณด๋ค ์ด์ ๋ ๋ง์ ์์ ์์ ฏ์ ๊ฐ๋ ๊ฒ์ ์ค๋ฅ๋ก ๊ฐ์ฃผ) -> ์คํฌ๋กค ํ ์ ์๊ฒ ํ๋ ค๋ฉด ListView์ฌ์ฉ
- ๊ฐ๋ก๋ก ํ์ํ๋ ์์ ฏ์ ๊ฒฝ์ฐ Row ์์ ฏ ์ฌ์ฉ
- ์์ ์์ ฏ์ด ํ๋์ผ ๊ฒฝ์ฐ, ์ ๋ ฌ ๋๋ ์ค์ฌ์ ์ฌ์ฉํ์ฌ ๋ฐฐ์นํ๋ ๊ฒ์ด ์ข์
child: Column(
children: const <Widget>[
Text('Deliver features faster'),
Text('Craft beautiful UIs'),
Expanded(
child: FittedBox(
child: FlutterLogo(),
),
),
],
)),
-
Column ์์ ฏ์ ListVIew()๋ฅผ ๋ฃ๊ณ ์ถ๋ค๋ฉด Expanded() or Flexible()๋ก ๋ฌถ๋๋ค.
- ๋ง์ฝ์ size๋ฅผ ์ฃผ๊ณ ์ถ์ผ๋ฉด
SizedBox()๋ก ๋ฌถ๋๋ค.
-
CustomMultiChildLayout class
- ๋๋ฆฌ์๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ์์์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๊ณ ๋ฐฐ์นํ๋ ์์ ฏ์ด๋ค
- ๋๋ฆฌ์ธ์ ๊ฐ ์์์ ๋ํ ๋ ์ด์์ ์ ์ฝ ์กฐ๊ฑด์ ๊ฒฐ์ ํ ์ ์์ผ๋ฉฐ, ๊ฐ ์์์ ๋ฐฐ์นํ ์์น๋ฅผ ๊ฒฐ์ ํ ์ ์๋ค.
- ๋๋ฆฌ์๋ ๋ถ๋ชจ์ ํฌ๊ธฐ๋ฅผ ๊ฒฐ์ ํ ์๋ ์์ง๋ง, ๋ถ๋ชจ์ ํฌ๊ธฐ๋ ์์์ ํฌ๊ธฐ์ ๋ฐ๋ผ ๋ฌ๋ผ ์ง ์ ์๋ค.
-
CustomMultiChildLayout์ ์ฌ๋ฌ ์์ ฏ์ ํฌ๊ธฐ์ ์์น ์ฌ์ด์ ๋ณต์กํ ๊ด๊ณ๊ฐ ์์๋ ์ ํฉํ๋ค.
CustomMultiChildLayout Constructors
CustomMultiChildLayout({Key? key, required MultiChildLayoutDelegate delegate, List children = const []})
Creates a custom multi-child layout.
-
CustomSingleChildLayout์ ๋จ์ผ ์์์ ๋ ์ด์์์ ์ ์ดํ๋ ค ํ ๋ ์ ํฉํ๋ค.
Stack ์์ ฏ์ ์์ ฏ์ ํ๋ ๋๋ ๋ค๋ฅธ ์์ง์ ์ ๋ ฌ ํ ๋ ์ ํฉํ๋ค.
-
Flow ์์ ฏ์ which provides paint-time control of its children using transform matrices.(๋ณํํ๋ ฌ)
-
๊ฐ ์์์ ๋๋ฆฌ์์ ๋ํ ์์ ฏ์ ์๋ณํ๊ธฐ ์ํด LayoutId ์์ ฏ์ ๋ํ๋์ด์ผ ํ๋ค.
-
Flow class
- FlowDelegate์ ๋
ผ๋ฆฌ์ ๋ฐ๋ผ ์์์ ํฌ๊ธฐ๋ฅผ ํจ์จ์ ์ผ๋ก ์กฐ์ ํ๊ณ ๋ฐฐ์นํ๋ ์์ ฏ์ด๋ค.
- Flow ๋ ์ด์์์ ๋ณํํ๋ ฌ์ ์ฌ์ฉํ์ฌ ์์์ ์์น๋ฅผ ๋ณ๊ฒฝํ๋๋ฐ ์ต์ ํ๋์ด ์๋ค.
- Flow ์ปจํ
์ด๋๋ ๋๋ฆฌ์์ FlowDelegate.getSize ํจ์์ ์ํด ์์๊ณผ ๋
๋ฆฝ์ ์ผ๋ก ํฌ๊ธฐ๊ฐ ์กฐ์ ๋๋ค.
Single-child layout ์์ ฏ

- LimitedBox
- A box that limits its size only when it's unconstrained.
- Offstage
- A widget that lays the child out as if it was in the tree, but without painting anything, without making the child available for hitโฆ
- OverflowBox
- A widget that imposes different constraints on its child than it gets from its parent, possibly allowing the child to overflow the parent.
- Padding
- A widget that insets its child by the given padding.
- SizedBox
- A box with a specified size. If given a child, this widget forces its child to have a specific width and/or height (assuming values areโฆ
- SizedOverflowBox
- A widget that is a specific size but passes its original constraints through to its child, which will probably overflow.
- Transform
- A widget that applies a transformation before painting its child.
Multi-child layout ์์ ฏ
Sliver ์์ ฏ
- CupertinoSilverNavigationBar
- CustomScrollView
- SilverAppBar
- SilverChildBuilder Delegate
- A delegate that supplies children for slivers using a builder callback.
- SliverChildLIst Delegate
- A delegate that supplies children for slivers using an explicit list.
- SliverFixedExtent List
- A sliver that places multiple box children with the same main axis extent in a linear array.
- SliverGrid
- A sliver that places multiple box children in a two dimensional arrangement.
- SliverList
- A sliver that places multiple box children in a linear array along the main axis.
- SLiverPadding
- A sliver that applies padding on each side of another sliver.
- SliverPersistentHeader
- A sliver whose size varies when the sliver is scrolled to the edge of the viewport opposite the sliver's GrowthDirection.
- SliverToBoxAdapter
- A sliver that contains a single box widget.