1
2
3
4
5
6
7
8
9
10
mainPage() {
return ListView(
padding: const EdgeInsets.all(10),
children: [
cards("카드"),
cards("카드2"),
cards("카드3"),
],
);
}
리스트 뷰에 카드를 추가하려 한다. cards 함수는 String 하나를 받는다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cards(String desc) {
return Card(
color: Colors.grey,
child: SizedBox(
width: 250,
height: 250,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.add,
),
Text(desc),
],
)
)
);
}
Icon은 더하기 아이콘이고, Text로 아까 넘긴 String을 받는다.