์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- switch
- POP
- FloatingActionButton
- AlertDialog
- textField
- Routing
- scaffoldmessenger
- InputDecoration
- PushNamed
- AppBar
- GestureDetector
- list
- Scaffold
- button
- slider
- stateful
- image
- TextEditingController
- dart
- icon
- drawer
- sizedbox
- ontap
- Snackbar
- figma
- Webflow
- navigator
- vscode
- ElevatedButton
- flutter
- Today
- Total
์ฌ๋ฐ๋๊ฑฐ๐
Flutter_04. Button ๋ณธ๋ฌธ
๋ค์ํ ๋ฒํผ์ ์ฌ์ฉํ ์ ์๋ค. ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ TextButton์ ์ ๋ ฅํ๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ถ๋ ฅ๋๋ค. ์ฝ๊ฒ ์๊ฐํ๋ฉด, onPressed๋ ๋ฒํผ ํด๋ฆญ ์ ์ถ๋ ฅ๋๋ ์ด๋ฒคํธ๊ฐ ์ ์๋๋ ๋ถ๋ถ์ด๊ณ , child๋ ๋ฒํผ๋ช ์ ๋ฃ๋๋ค๊ณ ์๊ฐํ๋ฉด ๋๋ค.
#์คํ์ผ : styleFrom()์ ์ฌ์ฉํ์ฌ ์คํ์ผ ์ค์ ๊ฐ๋ฅ
style: TextButton.styleFrom()
#๋ณ๋ Function์ ๋ง๋ค์ด์ ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ ๊ตฌํ ๊ฐ๋ฅ
// -- Function ----
longClickAction() {
String action = "long clicked";
print('text button is $action.');
}
TextButton
๐ Button์ ๊ธฐ๋ฅ์ด ๊ถ๊ธํ๋ค๋ฉด?
Command๋ฅผ ๋๋ฅธ ์ํ๋ก ํด๋น ๋ฒํผ์ ํด๋ฆญํด๋ณด์.
๋ค์๊ณผ ๊ฐ์ด ํด๋น ๋ฒํผ์์ ์ฌ์ฉํ ์ ์๋ ๊ธฐ๋ฅ๋ค์ ํ์ธ ํ ์ ์๋ค.
ElevatedButton
#style: ElevatedButton.styleFrom()
- ๋ฒํผ ์นผ๋ผ backgroundColor: const Color.fromARGB(255, 79, 54, 244),
- ๋ฒํผ ๋ชจ์ shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10) )
OutlinedButton
#style: OutlinedButton.styleFrom()
- ๋ฒํผ ์นผ๋ผ backgroundColor: const Color.fromARGB(255, 79, 54, 244),
- ๋ฒํผ ๋ผ์ธ side: const BorderSide( color: Colors.black, width: 2, )
TextButton.icon
#icon: const Icon()
- ์์ด์ฝ ์ด๋ฏธ์ง Icons.home,
- ์์ด์ฝ ์ฌ์ด์ฆ size: 30,
- ์์ด์ฝ ์นผ๋ผ color: Colors.black,
#label: const Text()
- ํ ์คํธ ๋ฒํผ๋ช label: const Text("Go to home"),
#style: TextButton.styleFrom()
- ํ ์คํธ ๋ฒํผ ์นผ๋ผ style: TextButton.styleFrom( foregroundColor: const Color.fromARGB(255, 79, 54, 244) ),
ElevatedButton.icon
#style: ElevatedButton.styleFrom()
- ๋ฒํผ ์นผ๋ผ backgroundColor: const Color.fromARGB(255, 79, 54, 244),
- ๋ฒํผ ์ต์ ์ฌ์ด์ฆ minimumSize: const Size(130, 40)
OutlinedButton.icon
#style: OutlinedButton.styleFrom()
- ๋ฒํผ ํ ์คํธ ์นผ๋ผ foregroundColor: Colors.black,
- ๋ณด๋ ์นผ๋ผ์ ๋๊ป side: const BorderSide( color: Colors.black, width: 2, )
์์ 6๊ฐ์ง ๋ฒํผ ์ฝ๋๋ฅผ ์คํํ๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ถ๋ ฅ๋๋ค.
์ด ๊ธฐ๋ณธ ์ฝ๋๋ค์ ์ ํ์ฉํ์ฌ ๋ค์ํ ๋ฒํผ ์คํ์ผ์ ๊ตฌํํ ์ ์๋ค.
์ค์ ๋ก ํด๋ฆญ๋๋ ๊ฒ์ ํ์ธํ๊ธฐ ์ํ์ฌ print๋ฅผ ๋ฃ์ด ํ์ธํ์. ํ์ง๋ง! ์ค์ ์ฑ์ ์ฌ๋ฆด๋์๋ ๋ฐ๋์ ๋ชจ๋ print๋ฅผ ์ ๊ฑฐํด์ผ ํ๋ค๊ณ ํ๋ค!
'๊ฐ๋ฐํ๊ธฐ > Flutter Start' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Flutter_06. GestureDetector, onTap, AlertDialog (0) | 2023.05.02 |
---|---|
Flutter_05. Button, Link, launchUrl, Plugins (0) | 2023.04.29 |
Flutter_03. CircleAvatar, Divider, Button (0) | 2023.04.24 |
Flutter_02. Column(Image), ScrollView, Padding, Row (0) | 2023.04.16 |
Flutter_01. ์์ (1) | 2023.04.13 |