๐์ด ํฌ์คํธ๋ ์์ ค๋ผ์ ์ ๋ฐ๋ฏธ ํ๋ฌํฐ๊ฐ์๋ฅผ ๋ฃ๊ณ ์ ๊ฐ ์ฐพ์๋ณธ ๋ด์ฉ์ ๋ฐํ์ผ๋ก ์์ฑํ ๊ธ์ ๋๋ค! ๐
Theme Widget
https://www.colorzilla.com/ → ์ ์์๋ด๊ธฐ
color class https://api.flutter.dev/flutter/dart-ui/Color-class.html
themedata constructor : https://api.flutter.dev/flutter/material/ThemeData/ThemeData.html
ํ ๋ง ์ค์ ๊ด๋ จ
- theme : ThemeData.dark() ->๋คํฌ๋ชจ๋ ํ ๋ง๋ก ์ ํ
- primarycolor → appbar์ ๋ฐ๊พธ๊ธฐ
- accentcolor → ๋ฒํผ์ ๋ฐ๊พธ๊ธฐ
- width: double.infinity -> ํ๋ฉด ๊ฐ๋ ์ฑ์ฐ๊ธฐ
Final VS Const(immutable)
final // ํ๋ฒ๋ง ์ด๊ธฐํ ๊ฐ๋ฅ // set only once
const // compile-time constant // ์ปดํ์ผ ์๊ฐ ์์ // ์ปดํ์ผ ๋ ๋ค์์ ์์๋ฅผ ๊ฐ์ผ๋ก ๊ฐ์ง ์ ์๋ค.
Dart Enum
- ์ด๊ฑฐํ
- bool(true, false)๋ณด๋ค ๋ง์ ์ต์ ์ ๊ฐ์ง๊ณ ์ถ์ ๋
enum EnumName{type A, type B, type C}
//์คํํ๋ ค๋ฉด
EnumName.type A
mainAxisAlignment, crossAxisAlignment
UI๋ฅผ ๊ตฌํํ๋ ๊ฒ์ด๋ค ๋ณด๋๊น column, row์ ๊ฐ์ ๊ฐ๋ ๋ค์ด ๋ง์ด ์ฐ์ธ๋ค.
ํ์ง๋ง, ๋ถ๋๋ฝ์ง๋ง ๋๋ ์ด๋ด ๋ ์ํ๊ณผ ์์ง์ด ์ฝ๋๋ก ์ธ ๋ ํท๊ฐ๋ฆฌ๋ ๊ฒฝํ์ด ๋ง์๋ค.
column ๊ณผ row์ผ ๋ mainAxis์ crossAxis์ผ ๋๊ฐ ๊ฐ๊ฐ ๋ฌ๋ผ์ง๊ธฐ ๋๋ฌธ์ ํผ๋์ด์๋๋ฐ ์๋์ ์ด๋ฏธ์ง๋ฅผ ๋ณด๊ณ
์ด๊ฑธ ์ธ์ฐ๊ณ column์ ๋ฐ๋!๋ก ์๊ฐํ๋๊ฒ ํธํ๊ฒ ๋ค๊ณ ์๊ฐํ๋ค.
Slider Class
์ฌ๋ผ์ด๋ ํด๋์ค์ ๋ํด์ ์ด๋ ๊ฒ ๋ง์ ์์ฑ๋ค์ด ์กด์ฌํ๋ค. ์ด๋ฌํ ์์ฑ๋ค์ #3์ ํฌ์คํธ์์ ์ด๋ป๊ฒ ๋ฐ๊ฒฌํ ์ ์๋์ง ์ ์ด๋์๋ค.
text์ string์ ๋ฃ๊ณ ์ถ๋ค๋ฉด, height.to.String()์ ์ฌ์ฉํ๋ฉด ๋๋ค.
Text(
height.toString(),
style : kNumberTextStyle,
)
Slide(
value : height.toDouble(),
min : 120.0,
max : 220.0,
activeColor: Colors.pink,
inactiveColor : Colors.grey,
onChanged : (double newValue) {
height = newValue.round(); //์์ง์ด๋ ๋๋ก ํค๋ฅผ ์ค์
}
),
๐จ(ํ) ์ด๋ฆ ์ค์ ์ ์ ๋ฌธ๊ตฌ๋ฅผ ํต์ผ์์ผ ์ฐพ๊ธฐ ์ฝ๊ฒ ํด์ค ex)kNumberTextStyle, kButtonTextStyle
Slider Theme
SliderTheme(
data: SliderTheme.of(context).copyWith(
thumbShape: RoundSliderThumbShape(enalbledThumbRadius : 15.0)
// ๋๊ทธ๋ผ๋ฏธ๋ถ๋ถ ํฌ๊ธฐ ๋๋ฆฌ๊ธฐ
overlayShape: RoundSliderOverlayShape(overlayRadius : 30.0)
//๋๋ ์ ๋, ๋๊ทธ๋ผ๋ฏธ ํฌ๊ฒ ํ๋๋ ์ถ๊ฐ
thumbcolor //๋๊ทธ๋ผ๋ฏธ ์๊น ๋ฐ๊พธ๊ธฐ
),
์ฌ๋ผ์ด๋์ ํ ๋ง๋ฅผ ์์ ์ฝ๋์ ๊ฐ์ด ์์ง์ด๋ ๋๊ทธ๋ผ๋ฏธ์ ์, ํฌ๊ธฐ ๋ฑ์ ๋ฐ๊ฟ์ค ์ ์๋ค.
Composition
BASIC ํ๊ฒ ๋ง๋ค๊ธฐ
*FAB = FloatingActionButton
RawMaterialButton ์ฐ๋ ์ด์ FAB๊ฐ ํ ์คํฌ๋ฆฐ์ ํ๋ ์ฐ์ด๊ธฐ๋ฅผ ๊ถ์ฅํ๊ณ ์๊ธฐ ๋๋ฌธ
Navigating
https://flutter.dev/docs/cookbook/navigation/navigation-basics
์ด์ ์ฑ์์๋ ๋๋ฅด๋ฉด ํ์ด์ง๊ฐ ๋ฐ๋๊ณ ์ด๋ฐ ์ค๊ณ๋ฅผ ํด์ค์ผ ํ๊ธฐ ๋๋ฌธ์ Navigating์ด ํ์ํ๋ค.
์ด๋ฌํ ๋ค๋น๊ฒ์ดํ ์ ๋ํ ์ค๋ช ์ ์์ ๊ณต์๋ฌธ์๋ฅผ ๋ณด๋ฉด ๋ ์์ธํ๊ฒ ๋์์์ผ๋ ๊ผญ ์ฐธ๊ณ ํ๊ธธ ๋ฐ๋!
initialRoute:'/'
routes: {
// When navigating to the "/" route, build the FirstScreen widget.
'/': (context) => FirstScreen(),
// When navigating to the "/second" route, build the SecondScreen widget.
'/second': (context) => SecondScreen(),
},
Dart Maps
Map<keyType, valuetype> mapname{
key:Value
}
//์คํ
mapname[key]
Dart Ternary Operator(์กฐ๊ฑด ์ฐ์ฐ์)
condition ? DoThisIfTrue : DoThisIfFalse
'APP > FLUTTER' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Flutter #3] Xylophone & Quizzler (0) | 2021.01.05 |
---|---|
FLUTTER #2 Dicee & Dart (0) | 2020.09.11 |
FLUTTER #1 I_am_rich (0) | 2020.01.18 |