๋ ์ด์์ ์์ ฏ
โข
Container
โข
Row
โข
Column
โข
Expanded
โข
Stack
โข
Center
โข
Align
โข
SizedBox
โข
Padding
โข
ListView
โข
GridView
โข
Card
Container
1 ๊ฐ์ ์์ ์์ ฏ์ ๋ด์ ์ ์๋ ๋ฐ์ค ํํ์ ์์ ฏ
๋ฌธ๋ฒ
Container(
width: ๊ฐ๋ก ํฌ๊ธฐ
height: ์ธ๋ก ํฌ๊ธฐ
color: ๋ฐฐ๊ฒฝ์
margin: ์ธ๋ถ ์ฌ๋ฐฑ
padding: ๋ด๋ถ ์ฌ๋ฐฑ
child: ์์ ์์ ฏ
decoration: ๋ฐ์ค ์คํ์ผ
)
Dart
๋ณต์ฌ
์์ฑ | ์ค๋ช
| ํด๋์ค |
width | ์ปจํ
์ด๋์ ๊ฐ๋ก ํฌ๊ธฐ๋ฅผ ์ค์ ํฉ๋๋ค. | double |
height | ์ปจํ
์ด๋์ ์ธ๋ก ํฌ๊ธฐ๋ฅผ ์ค์ ํฉ๋๋ค. | double |
color | ์ปจํ
์ด๋์ ๋ฐฐ๊ฒฝ์์ ์ง์ ํฉ๋๋ค. | Color |
margin | ์ปจํ
์ด๋์ ์ธ๋ถ ์ฌ๋ฐฑ์ ์ค์ ํฉ๋๋ค. | EdgeInsets |
padding | ์ปจํ
์ด๋์ ๋ด๋ถ ์ฌ๋ฐฑ์ ์ค์ ํฉ๋๋ค. | EdgeInsets |
child | ์ปจํ
์ด๋ ๋ด์ ๋ฐฐ์น๋ ์์ ์์ ฏ์ ์ง์ ํฉ๋๋ค. | Widget |
decoration | ์ปจํ
์ด๋์ ์คํ์ผ์ ์ง์ ํฉ๋๋ค. | BoxDecoration |
์์
Container(
width: 200.0, // ๊ฐ๋ก ํฌ๊ธฐ (์ต์
)
height: 100.0, // ์ธ๋ก ํฌ๊ธฐ (์ต์
)
color: Colors.blue, // ๋ฐฐ๊ฒฝ์
margin: EdgeInsets.all(16.0), // ์ธ๋ถ ์ฌ๋ฐฑ
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), // ๋ด๋ถ ์ฌ๋ฐฑ
child: Text('Hello, Container!'), // ์์ ์์ ฏ
)
Dart
๋ณต์ฌ
Color
ํ๋ฌํฐ์์ ์์์ ํํํ๋ ํด๋์ค
โข
์ ์ ์์ฑ์๋ฅผ ์ฌ์ฉํ์ฌ ์์ ์์ฑ
โข
๋ฏธ๋ฆฌ ์ ์๋ ์์ ์ฌ์ฉ
์ ์ ์์ฑ์๋ฅผ ์ฌ์ฉํ์ฌ ์์ ์์ฑ
Color myColor = Color.fromRGBO(255, 0, 0, 1.0); // ๋นจ๊ฐ์
Dart
๋ณต์ฌ
๋ฏธ๋ฆฌ ์ ์๋ ์์ ์ฌ์ฉ
Color myColor = Colors.blue; // ํ๋์
Dart
๋ณต์ฌ
EdgeInsets
ํ๋ฌํฐ์์ ์ฌ๋ฐฑ์ ๋ํ๋ด๋ ํด๋์ค
์ฃผ๋ก, Container์ margin์ด๋ padding ์์ฑ์ ์ฌ์ฉ๋ฉ๋๋ค.
์ข ๋ฅ
์์ฑ์ ๋ฐ ๋ฉ์๋ | ์ค๋ช
|
EdgeInsets.all(double) | ๋ชจ๋ ๋ฐฉํฅ์ ๋์ผํ ์ฌ๋ฐฑ์ ์ง์ ํฉ๋๋ค. |
EdgeInsets.fromLTRB(left, top, right, bottom) | ์ข, ์, ์ฐ, ํ์ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ์ ์ง์ ํฉ๋๋ค. |
EdgeInsets.symmetric({vertical, horizontal}) | ์ํ, ์ข์ฐ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ์ ์ง์ ํฉ๋๋ค. |
EdgeInsets.only({left, top, right, bottom}) | ๊ฐ ๋ฐฉํฅ๋ณ๋ก ๋ค๋ฅธ ์ฌ๋ฐฑ์ ์ง์ ํฉ๋๋ค. |
์์
1.
๋ชจ๋ ๋ฐฉํฅ์ ๋์ผํ ์ฌ๋ฐฑ ์ง์ :
EdgeInsets.all(16.0) // ๋ชจ๋ ๋ฐฉํฅ์ 16.0์ ์ฌ๋ฐฑ
Dart
๋ณต์ฌ
2.
์ํ์ข์ฐ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ ์ง์ :
EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0) // ์ข, ์, ์ฐ, ํ์ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ
Dart
๋ณต์ฌ
3.
์ํ, ์ข์ฐ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ ์ง์ :
EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0) // ์ํ, ์ข์ฐ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ
Dart
๋ณต์ฌ
4.
๊ฐ ๋ฐฉํฅ๋ณ๋ก ๋ค๋ฅธ ์ฌ๋ฐฑ ์ง์ :
EdgeInsets.only(top: 10.0, bottom: 20.0, left: 30.0, right: 40.0) // ๊ฐ ๋ฐฉํฅ
Dart
๋ณต์ฌ
maring, padding ์ ์ฉํ๊ธฐ
Container(
margin: EdgeInsets.all(16.0), // ๋ชจ๋ ๋ฐฉํฅ์ 16.0์ ์ฌ๋ฐฑ
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), // ์ํ, ์ข์ฐ ๊ฐ๊ฐ ๋ค๋ฅธ ์ฌ๋ฐฑ
child: Text('Hello, EdgeInsets!'),
)
Dart
๋ณต์ฌ
BoxDecoration
์์ ๋ชจ์์ ์ฅ์์ ์ง์ ํ๋ ํด๋์ค
์์ฑ | ์ค๋ช
|
color | ์์์ ๋ฐฐ๊ฒฝ์์ ์ง์ ํฉ๋๋ค. |
border | ์์์ ํ
๋๋ฆฌ(๊ฒฝ๊ณ์ )์ ์ง์ ํฉ๋๋ค. |
borderRadius | ์์์ ๋ชจ์๋ฆฌ๋ฅผ ๋ฅ๊ธ๊ฒ ๋ง๋ญ๋๋ค. |
boxShadow | ์์์ ๊ทธ๋ฆผ์๋ฅผ ์ถ๊ฐํฉ๋๋ค. |
gradient | ์์์ ๋ฐฐ๊ฒฝ์ ๊ทธ๋ผ๋์ธํธ๋ฅผ ์ถ๊ฐํฉ๋๋ค. |
image | ์์์ ๋ฐฐ๊ฒฝ์ ์ด๋ฏธ์ง๋ฅผ ์ถ๊ฐํฉ๋๋ค. |
1. ๊ธฐ๋ณธ ์ฌ์ฉ:
BoxDecoration(
color: Colors.blue, // ๋ฐฐ๊ฒฝ์
border: Border.all(color: Colors.red, width: 2.0), // ๊ฒฝ๊ณ์
borderRadius: BorderRadius.circular(12.0), // ๋ชจ์๋ฆฌ์ ๋ฐ๊ฒฝ
)
Dart
๋ณต์ฌ
2. ๊ทธ๋ฆผ์ ์ถ๊ฐ:
BoxDecoration(
color: Colors.blue, // ๋ฐฐ๊ฒฝ์
border: Border.all(color: Colors.red, width: 2.0), // ๊ฒฝ๊ณ์
borderRadius: BorderRadius.circular(12.0), // ๋ชจ์๋ฆฌ์ ๋ฐ๊ฒฝ
boxShadow: [
BoxShadow(
color: Colors.grey,
offset: Offset(2.0, 2.0), // ๊ทธ๋ฆผ์์ ์์น
blurRadius: 5.0, // ๊ทธ๋ฆผ์์ ํ๋ฆผ ์ ๋
),
],
)
Dart
๋ณต์ฌ
3. ๊ทธ๋ผ๋์ธํธ ์ถ๊ฐ:
BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.blue, Colors.red], // ๊ทธ๋ผ๋์ธํธ ์์
),
)
Dart
๋ณต์ฌ
4. ์ด๋ฏธ์ง ๋ฐฐ๊ฒฝ ์ถ๊ฐ:
BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/background.jpg'),
fit: BoxFit.cover,
),
)
Dart
๋ณต์ฌ
Row
์ฌ๋ฌ๊ฐ์ง ์์๋ฅผ ํ๋ฐฉํฅ(๊ฐ๋ก)๋ก ๋ฐฐ์นํ๋ ์์ ฏ
mainAxisAlignment
์ฃผ์ถ ์ ๋ ฌ ๋ฐฉ์
Row ์ ์ฃผ์ถ์ ๊ฐ๋ก๋ฐฉํฅ
mainAxisAlignment | ํจ๊ณผ |
start | ์์ ์ง์ ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
center | ๊ฐ์ด๋ฐ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
end | ๋ ์ง์ ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
spaceBetween | ์์๊ณผ ๋์ ์ ๋ ฌํ๊ณ , ์ค๊ฐ์ ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ถ๋ฐฐ |
spaceAround | ๊ฐ ์์์ ์ฃผ์์ ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ถ๋ฐฐ |
spaceEvenly | ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ชจ๋ ์์์ ๋ถ๋ฐฐ |
crossAxisAlignment
๊ต์ฐจ์ถ ์ ๋ ฌ ๋ฐฉ์
Row ์ ๊ต์ฐจ์ถ์ ์ธ๋ก๋ฐฉํฅ
crossAxisAlignment | ํจ๊ณผ |
start | ์์ชฝ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
center | ์ค์์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
end | ์๋์ชฝ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
๋ฌธ๋ฒ
Row(
mainAxisAlignment: MainAxisAlignment.start, // ๊ฐ๋ก ์ ๋ ฌ (์ต์
)
crossAxisAlignment: CrossAxisAlignment.center, // ์ธ๋ก ์ ๋ ฌ (์ต์
)
mainAxisSize: MainAxisSize.max, // Row์ ํฌ๊ธฐ ์ง์ (์ต์
)
children: <Widget>[
// ์์ ์์ ฏ๋ค
],
)
Dart
๋ณต์ฌ
์์
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(color: Colors.red, width: 50.0, height: 50.0),
Container(color: Colors.blue, width: 50.0, height: 50.0),
Container(color: Colors.green, width: 50.0, height: 50.0),
],
)
Dart
๋ณต์ฌ
Column
์ฌ๋ฌ๊ฐ์ง ์์๋ฅผ ์ด๋ฐฉํฅ(์ธ๋ก)๋ก ๋ฐฐ์นํ๋ ์์ ฏ
mainAxisAlignment
์ฃผ์ถ ์ ๋ ฌ ๋ฐฉ์
Column ์ ์ฃผ์ถ์ ์ธ๋ก๋ฐฉํฅ
mainAxisAlignment | ํจ๊ณผ |
start | ์์ ์ง์ ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
center | ๊ฐ์ด๋ฐ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
end | ๋ ์ง์ ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
spaceBetween | ์์๊ณผ ๋์ ์ ๋ ฌํ๊ณ , ์ค๊ฐ์ ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ถ๋ฐฐ |
spaceAround | ๊ฐ ์์์ ์ฃผ์์ ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ถ๋ฐฐ |
spaceEvenly | ๋์ผํ ๊ฐ๊ฒฉ์ผ๋ก ๋ชจ๋ ์์์ ๋ถ๋ฐฐ |
crossAxisAlignment
๊ต์ฐจ์ถ ์ ๋ ฌ ๋ฐฉ์
Column ์ ๊ต์ฐจ์ถ์ ๊ฐ๋ก๋ฐฉํฅ
crossAxisAlignment | ํจ๊ณผ |
start | ์ข์ธก์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
center | ์ค์์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
end | ์ฐ์ธก์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ |
stretch | ์์๋ค์ ์ต๋ ํฌ๊ธฐ๋ก ๋๋ฆฌ๊ณ ์ธ๋ก๋ก ์ ๋ ฌ |
๋ฌธ๋ฒ
Column(
mainAxisAlignment: MainAxisAlignment.start, // ์ธ๋ก ์ ๋ ฌ (์ต์
)
crossAxisAlignment: CrossAxisAlignment.center, // ๊ฐ๋ก ์ ๋ ฌ (์ต์
)
mainAxisSize: MainAxisSize.max, // Column์ ํฌ๊ธฐ ์ง์ (์ต์
)
children: <Widget>[
// ์์ ์์ ฏ๋ค
],
)
Dart
๋ณต์ฌ
์์
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(color: Colors.red, width: 50.0, height: 50.0),
Container(color: Colors.blue, width: 50.0, height: 50.0),
Container(color: Colors.green, width: 50.0, height: 50.0),
],
)
Dart
๋ณต์ฌ
Expanded
๋ถ๋ชจ ์์ ฏ์ ๋ํ์ฌ, ๊ฐ์ง๊ณ ์๋ ์ฌ์ ๊ณต๊ฐ์ ๋ชจ๋ ์ฐจ์งํ๋ ์์ ฏ
Expanded ์์ ฏ์ ์์ ์์ ฏ์ด ๊ฐ์ง๊ณ ์๋ ์ฌ์ ๊ณต๊ฐ์ ๋ชจ๋ ์ฐจ์งํ๋๋ก ๋ง๋๋ ์ญํ ์ ํฉ๋๋ค. ์ฃผ๋ก Row ๋๋ Column ๋ด์์ ์์ ์์ ฏ์ ์ ์ฉ๋์ด ์ฌ์ฉ๋ฉ๋๋ค.
์์
Row(
children: [
Container(width: 50, height: 50, color: Colors.red),
Expanded(
child: Container(color: Colors.blue),
),
Container(width: 50, height: 50, color: Colors.green),
],
)
Dart
๋ณต์ฌ
์ ์์์์ Expanded๋ ํ๋์ ์ปจํ
์ด๋๊ฐ ๋๋จธ์ง ๊ฐ๋ก ๊ณต๊ฐ์ ๋ชจ๋ ์ฐจ์งํ๋๋ก ํฉ๋๋ค.
Stack
์์ ์์ ฏ๋ค์ ๊ฒน์ณ์ ๋ฐฐ์นํ๋ ์์ ฏ
Stack ์์ ฏ์ ์์ ์์ ฏ์ ๊ฒน์น๊ฒ ๋ฐฐ์นํ ๋ ์ฌ์ฉ๋ฉ๋๋ค. ๊ฐ ์์ ์์ ฏ์ ์์น ๋ฐ ํฌ๊ธฐ๋ฅผ ์ง์ ํ์ฌ ์์ผ ์ ์์ต๋๋ค.
์์
Stack(
children: [
Positioned(
top: 10,
left: 10,
child: Container(width: 50, height: 50, color: Colors.red),
),
Positioned(
top: 20,
left: 20,
child: Container(width: 50, height: 50, color: Colors.blue),
),
],
)
Dart
๋ณต์ฌ
์ ์์์์ Stack์ ๋นจ๊ฐ์๊ณผ ํ๋์ ์ปจํ
์ด๋๋ฅผ ๊ฒน์ณ์ ํ์ํฉ๋๋ค.
Center
์์ ์์ ฏ์ ํ๋ฉด์ ๊ฐ์ด๋ฐ ์ ๋ ฌํ๋ ์์ ฏ
Center ์์ ฏ์ ์์ ์์ ฏ์ ํ๋ฉด์ ๊ฐ์ด๋ฐ์ ์ ๋ ฌํฉ๋๋ค.
์์
Center(
child: Container(width: 100, height: 100, color: Colors.green),
)
Dart
๋ณต์ฌ
์ ์์์์ Center๋ ์ด๋ก์ ์ปจํ
์ด๋๋ฅผ ํ๋ฉด ๊ฐ์ด๋ฐ์ ์ ๋ ฌํฉ๋๋ค.
Align
์์ ์์ ฏ์ ์ ํด์ง ์์น์ ๋ฐฐ์นํ๋ ์์ ฏ
Align ์์ ฏ์ ์์ ์์ ฏ์ ์ ํด์ง ์์น์ ๋ฐฐ์นํ ๋ ์ฌ์ฉ๋ฉ๋๋ค. alignment ์์ฑ์ ํตํด ์์น๋ฅผ ์กฐ์ ํ ์ ์์ต๋๋ค.
์์ฑ๊ฐ | ์ค๋ช
|
topLeft | ์ข์ธก ์๋จ |
topCenter | ์๋จ ์ค์ |
topRight | ์ฐ์ธก ์๋จ |
centerLeft | ์ข์ธก ์ค์ |
center | ์ค์ |
centerRight | ์ฐ์ธก ์ค์ |
bottomLeft | ์ข์ธก ํ๋จ |
bottomCenter | ํ๋จ ์ค์ |
bottomRight | ์ฐ์ธก ํ๋จ |
์์
Align(
alignment: Alignment(0.5, 0.5),
child: Container(width: 50, height: 50, color: Colors.orange),
)
Dart
๋ณต์ฌ
์ ์์์์ Align์ ์ค๋ ์ง์ ์ปจํ
์ด๋๋ฅผ ํ๋ฉด์ ๊ฐ๋ก์ ์ธ๋ก ์ค๊ฐ์ ์์นํ๋๋ก ํฉ๋๋ค. Alignment ํด๋์ค์ ๊ฐ์ ์กฐ์ ํ์ฌ ๋ค์ํ ์์น๋ก ์ค์ ํ ์ ์์ต๋๋ค.
SizedBox
๊ณ ์ ๋ ํฌ๊ธฐ์ ๊ณต๊ฐ์ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋๋ ์์ ฏ
์ฃผ๋ก ์ฌ๋ฐฑ์ ๋ง๋ค๊ฑฐ๋ ์ ํํ ํฌ๊ธฐ์ ์์๋ฅผ ๋ง๋ค์ด์ผ ํ ๋ ์ ์ฉํฉ๋๋ค. Container์ ๋ฌ๋ฆฌ ๋ฐ์ฝ๋ ์ด์
์์ด ํฌ๊ธฐ๋ง ์ง์ ํ๋ ๊ฐ๋จํ ์์ ฏ์
๋๋ค.
๋ฌธ๋ฒ
SizedBox(
width: 100.0, // ๊ฐ๋ก ํฌ๊ธฐ (์ต์
)
height: 50.0, // ์ธ๋ก ํฌ๊ธฐ (์ต์
)
child: YourWidget(), // ํฌ๊ธฐ๊ฐ ์ง์ ๋ ์์ ฏ (์ต์
)
)
Dart
๋ณต์ฌ
์์
SizedBox(
width: 200.0,
height: 100.0,
child: Container(
color: Colors.blue,
child: Center(
child: Text('Hello, SizedBox!'),
),
),
)
Dart
๋ณต์ฌ
์์ ์์ ์ฝ๋์์๋ SizedBox๋ก ํฌ๊ธฐ๊ฐ 200x100์ธ ์์๋ฅผ ๋ง๋ค๊ณ , ๊ทธ ์์ Container๋ฅผ ๋ฃ์ด ํ๋์์ผ๋ก ์ฑ์ฐ๊ณ ๊ฐ์ด๋ฐ์ ํ
์คํธ๋ฅผ ๋ฐฐ์นํ ์์๊ฐ ์์ต๋๋ค. width์ height๋ฅผ ์ฌ์ฉํ์ฌ ํฌ๊ธฐ๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
Padding
์์ ์์ ฏ ์ฃผ์์ ์ฌ๋ฐฑ์ ์ถ๊ฐํ๋ ์์ ฏ
๋ฌธ๋ฒ
Padding(
padding: EdgeInsets.all(16.0), // ์ฌ๋ฐฑ์ ํฌ๊ธฐ๋ฅผ ์ง์ (์ต์
)
child: YourWidget(), // ์ฌ๋ฐฑ์ด ์ถ๊ฐ๋ ์์ ฏ (ํ์)
)
Dart
๋ณต์ฌ
์์
Padding(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 10.0),
child: Container(
color: Colors.green,
child: Center(
child: Text('Hello, Padding!'),
),
),
)
Dart
๋ณต์ฌ
์์ ์์ ์ฝ๋์์๋ Padding์ผ๋ก ์์ง์ผ๋ก 20.0, ์ํ์ผ๋ก 10.0์ ์ฌ๋ฐฑ์ ์ถ๊ฐํ ํ, ๊ทธ ์์ Container๋ฅผ ๋ฃ์ด ์ด๋ก์์ผ๋ก ์ฑ์ฐ๊ณ ๊ฐ์ด๋ฐ์ ํ
์คํธ๋ฅผ ๋ฐฐ์นํ ์์๊ฐ ์์ต๋๋ค. padding ์์ฑ์ ์ฌ์ฉํ์ฌ ์ฌ๋ฐฑ์ ํฌ๊ธฐ๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
ListView
์คํฌ๋กค ๊ฐ๋ฅํ ์ธ๋ก ๋ชฉ๋ก์ ๋ง๋ค๊ธฐ ์ํด ์ฌ์ฉ๋๋ ์์ ฏ
ListTile
๋ฆฌ์คํธ ์์ดํ
์ ๋ํ๋ด๊ธฐ ์ํด ์ฌ์ฉ๋๋ ์์ ฏ
์์ฑ | ์ค๋ช
| ํ์
|
leading | ์์ดํ
์ ์์ ๋ถ๋ถ์ ์์นํ๋ ์์ ฏ | Widget |
title | ์์ดํ
์ ์ ๋ชฉ์ ๋ํ๋ด๋ ํ
์คํธ ์์ ฏ | Widget |
subtitle | ์์ดํ
์ ๋ถ์ ๋ชฉ์ ๋ํ๋ด๋ ํ
์คํธ ์์ ฏ | Widget |
trailing | ์์ดํ
์ ๋ ๋ถ๋ถ์ ์์นํ๋ ์์ ฏ | Widget |
onTap | ์์ดํ
์ด ํญ๋์์ ๋ ์คํ๋๋ ์ฝ๋ฐฑ ํจ์ | void Function() |
selected | ์์ดํ
์ด ์ ํ๋์๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ ๋ถ๋ฆฌ์ธ ๊ฐ | bool |
contentPadding | ์์ดํ
์ ๋ด์ฉ ์ฃผ์์ ์ฌ๋ฐฑ์ ์ง์ ํ๋ ์์ฑ | EdgeInsets |
enabled | ์์ดํ
์ด ํ์ฑํ๋์๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ ๋ถ๋ฆฌ์ธ ๊ฐ | bool |
๋ฌธ๋ฒ
ListView(
children: <Widget>[
// ๋ฆฌ์คํธ ์์ดํ
๋ค...
],
)
Dart
๋ณต์ฌ
์์ฑ
์์ฑ | ์ค๋ช
| ํ์
|
children | ListView์ ํฌํจ๋ ์์ ฏ๋ค์ ๋ชฉ๋ก | List<Widget> |
padding | ๋ชฉ๋ก ์ฃผ์์ ์ถ๊ฐ๋๋ ์ฌ๋ฐฑ | EdgeInsets |
shrinkWrap | ๋ฆฌ์คํธ๊ฐ ์์ ์ ์ปจํ
์ธ ํฌ๊ธฐ์ ๋ง๊ฒ ์ถ์๋๋์ง ์ฌ๋ถ | bool |
์์
ListView(
children: <Widget>[
ListTile(
leading: Icon(Icons.map),
title: Text('Map'),
),
ListTile(
leading: Icon(Icons.photo),
title: Text('Album'),
),
// ์ถ๊ฐ์ ์ธ ๋ฆฌ์คํธ ์์ดํ
๋ค...
],
)
Dart
๋ณต์ฌ
GridView
๊ทธ๋ฆฌ๋ ํํ์ ์์ดํ
๋ค์ ๋ํ๋ด๊ธฐ ์ํ ์คํฌ๋กค ๊ฐ๋ฅํ ์์ ฏ
๋ฌธ๋ฒ
GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 8.0,
mainAxisSpacing: 8.0,
),
children: <Widget>[
// ๊ทธ๋ฆฌ๋ ์์ดํ
๋ค...
],
)
Dart
๋ณต์ฌ
์์ฑ
์์ฑ | ์ค๋ช
| ํ์
|
gridDelegate | ๊ทธ๋ฆฌ๋์ ๋ ์ด์์ ๋ฐ ๊ฐ๊ฒฉ์ ์ ์ํ๋ ๋ธ๋ฆฌ๊ฒ์ดํธ | SliverGridDelegate |
children | GridView์ ํฌํจ๋ ์์ ฏ๋ค์ ๋ชฉ๋ก | List<Widget> |
padding | ๊ทธ๋ฆฌ๋ ์ฃผ์์ ์ถ๊ฐ๋๋ ์ฌ๋ฐฑ | EdgeInsets |
shrinkWrap | ๊ทธ๋ฆฌ๋๊ฐ ์์ ์ ์ปจํ
์ธ ํฌ๊ธฐ์ ๋ง๊ฒ ์ถ์๋๋์ง ์ฌ๋ถ | bool |
์์
GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 8.0,
mainAxisSpacing: 8.0,
),
itemCount: 10,
itemBuilder: (BuildContext context, int index) {
return Card(
child: Center(
child: Text('Item $index'),
),
);
},
)
Dart
๋ณต์ฌ
Card
Material Design ์คํ์ผ์ ํ๋ฉด์ ๊ฐ์ง๊ณ ์๋ ์ปจํ
์ด๋
๋ฌธ๋ฒ
Card(
child: // ์นด๋ ๋ด์ฉ,
)
Dart
๋ณต์ฌ
์์ฑ
์์ฑ | ์ค๋ช
| ํ์
|
child | ์นด๋ ๋ด๋ถ์ ํ์๋๋ ์์ ฏ | Widget |
color | ์นด๋์ ๋ฐฐ๊ฒฝ์ | Color |
elevation | ๊ทธ๋ฆผ์ ๋์ด | double |
shape | ์นด๋์ ๋ชจ์ ์ง์ | ShapeBorder |
์์
Card(
elevation: 4.0,
child: ListTile(
leading: Icon(Icons.album),
title: Text('Title'),
subtitle: Text('Subtitle'),
),
)
Dart
๋ณต์ฌ