๊ฐœ๋ฐœ/Flutter

โ–ช flutter / firebase ์—ฐ๋™ํ•˜๊ธฐ ํ”Œ๋Ÿฌํ„ฐ์™€ firebase๋ฅผ ์—ฐ๋™ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์‰ฌ์šด ํŽธ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์ „ ์˜ค๋ž˜ ๊ฑธ๋ ธ์Šต๋‹ˆ๋‹ค ๐Ÿ˜‘ firebase ์ฝ˜์†”์—์„œ ์•ˆ๋“œ๋กœ์ดํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒˆ๋กœ ๋งŒ๋“ค์–ด์ฃผ๊ณ  flutter ํŒŒ์ผ๋กœ ๋Œ์•„์™€์„œ app ํด๋”์†์˜ build.gradle ํŒŒ์ผ์— ํ•„์š”ํ•œ ์ •๋ณด๋“ค์„ ๋„ฃ์–ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. firebase๋ฌธ์ œ๊ฐ€ ์ƒ์„ธํ•˜๊ฒŒ ์„ค๋ช…ํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์–ด๋ ค์šธ๊ฒŒ ์—†์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ํŒŒ์ผ๋“ค ์—…๋ฐ์ดํŠธ๋ฅผ ๋๋‚ด๊ณ  ์˜ค๋ฅ˜๋ฉ”์„ธ์ง€๋ฅผ ๋งŒ๋‚ฌ๋Š”๋ฐ, flutter sdk๋ฒ„์ ผ๊ณผ firebase ๋ฒ„์ ผ์ด ์ƒํ˜ธ๊ฐ€ ์•ˆ ๋˜์„œ์˜€์Šต๋‹ˆ๋‹ค. ์ด๋Ÿด๋• android > app > build.gradle ํŒŒ์ผ์— midSdkVersion๊ณผ targetSdkVersion์„ ์•„๋ž˜์™€ ๊ฐ™์ด ๋„ฃ์–ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ˆซ์ž๋งŒ ๋”ํ•ด์ฃผ๋ฉด ๋˜๋Š”๋ฐ ์ „ ๊ทธ๊ฑธ ๋ชจ๋ฅด๊ณ  ์—„์ฒญ ํ•ด๋งธ..
ํ”Œ๋Ÿฌํ„ฐ์—์„œ๋Š” route๋ผ๋Š” ๊ฐœ๋…์œผ๋กœ ํŽ˜์ด์ง€ ์ด๋™์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ด ๋•Œ ์ด๋™ํ•  ๊ณณ์„ page๋ผ๊ณ  ์ƒ๊ฐํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๊ตณ์ด ํŒŒ์ผ์„ ๋”ฐ๋กœ ๋‚˜๋ˆ„์ง€ ์•Š์•„๋„ ๊ฐ™์€ ํŒŒ์ผ ์•ˆ์—์„œ page๋งŒ ๋‚˜๋ˆ ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ฐธ ์‰ฝ์ฃต? ๐Ÿ˜ ์ด๋™ ํ•  ๋•Œ ์“ฐ๋Š” ๊ฒƒ์œผ๋กœ๋Š” Navagator ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. main.dart Container( margin: EdgeInsets.only(top: 100, left: 0), width: 100, child: IconButton( icon: Text('Signup', style: TextStyle(fontSize: 20),), onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context) => SignUpPage(..
๋ฐ˜๋ณต๋˜๋Š” ๋ถ€๋ถ„์„ ์†์ˆ˜ ์“ฐ์ง€ ์•Š๊ณ  ๋ฐ˜๋ณตํ•ด์„œ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค. ์ด ๋•Œ ์“ธ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด ListView.builder ์ด๋‹ค. โ—พ Example ์ง€๊ธˆ๋ถ€ํ„ฐ ๋งŒ๋“ค์–ด ๋ณผ ๋ถ€๋ถ„์ธ๋ฐ ๋ณด๋ผ์ƒ‰์ด list_view๋ถ€๋ถ„์ด๊ณ  icons๊ฐ€ ํŒŒ๋ž€์ƒ‰๋ถ€๋ถ„์ด๋‹ค โ—พ Code list_view์— ๋ฐ˜๋ณต๋˜๋Š” ๋ถ€๋ถ„์„ ๋”ฐ๋กœ ํŒŒ์ผ(icons.dart)๋กœ ๋นผ์„œ ๋”ํ•˜๋Š”๊ฑฐ๋‹ค. list_view.dart Container( margin: EdgeInsets.only(top: 10, bottom: 20), child: Text('${descList[index]}'), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '${majorList[index]}', style: T..
ํ”Œ๋Ÿฌํ„ฐ๋กœ ์ฝ”๋“œ๋ฅผ ์ ์–ด๋‚ด๋ ค๊ฐˆ ๋•Œ๋ฉด ๊ณ„์†ํ•ด์„œ ๋ณด๊ฒŒ๋˜๋Š” ๋‹จ์–ด, BuildContext ... ๊ทธ๋ƒฅ ๋‹จ์ˆœํ•˜๊ฒŒ context๋ผ๋Š” ์–ด๋–ค ์ธ์ž๋ฅผ ๋ฐ›๋Š” ๋ฉ”์†Œ๋“œ๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, ์ฝ”๋”ฉ์…ฐํ”„๋‹˜์ด ์—ฌ๊ธฐ์— ๋Œ€ํ•œ ์ด์•ผ๊ธฐ๋ฅผ ๊ฐ•์˜๋ฅผ ๋งŒ๋“œ์…จ๋‹ค. ์—ฌ์ „ํžˆ ์ž˜ ์ดํ•ด๋Š” ์•ˆ ๋˜์ง€๋งŒ ์ฝ”๋”ฉ์…ฐํ”„๋‹˜์˜ ์ด์•ผ๊ธฐ๋ฅผ ๊ฐ„๋‹จํ•˜๊ฒŒ ์š”์•ฝํ•ด๋ณด์•˜๋‹ค โ—พ A handle to the location of a widget in the widget tree ์œ„์ ฏ ํŠธ๋ฆฌ์—์„œ ํ˜„์žฌ ์œ„์ ฏ์˜ ์œ„์น˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋Š” ์ •๋ณด ๋ชจ๋“  Widget์€ BuildMethod๋ฅผ ๊ฐ€์ง„๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ์œ„์ ฏ์€ ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. Buildmethod๋Š” scaffold๋ฅผ ๋ฆฌํ„ดํ•˜๋Š”๋ฐ context(์ธ์ž๊ฐ’)์„ ๋„ฃ์–ด์„œ ํ•œ๋‹ค. โ—พ Each widget has its own BuildContext, which b..
โ—พ ์™„์„ฑ๋ชจ์Šต ์•ž์„œ ์•„์ด์ฝ˜์„ ๋„ฃ์–ด์„œ ๋งŒ๋“  ๋ฉ”๋‰ด์— ํ–„๋ฒ„๊ฑฐ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ์‚ฌ์ด๋“œ๋กœ ์—ด๋ฆฌ๋Š” ๋ฉ”๋‰ด๋ฅผ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค! flutter์—์„œ๋Š” drawer์ด๋ผ๋Š” ๊ฒƒ์œผ๋กœ ์‰ฝ๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ๊ฐ€ ์žˆ๋‹ต๋‹ˆ๋‹ค! โ—พ ๊ธฐ๋ณธ ๊ตฌ์„ฑ drawer ์„ ๋งŒ๋“ค๊ณ , ๊ทธ ์•ˆ์— ์ž์‹ ์œ„์ ฏ(child)์œผ๋กœ ListView๋ฅผ ๋งŒ๋“ค์–ด์ค๋‹ˆ๋‹ค. ๊ทธ ์ž์‹ ์œ„์ ฏ ์•ˆ์— ๋˜ ๋‹ค๋ฅธ ํ•˜์œ„ ์œ„์ ฏ(children)์„ ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค. ListView๋Š” ๋‘๊ฐ€์ง€๋กœ ๊ตฌ์„ฑ์ด ๋ฉ๋‹ˆ๋‹ค. ์ผ๋‹จ Header๋ถ€๋ถ„์—์„œ ๊ณ„์ •์ด๋ฆ„, ํ”„๋กœํ•„ ์‚ฌ์ง„ ๋“ฑ์„ ๋„ฃ์–ด์ฃผ๊ณ , ๋‹ค๋ฅธ ํŽ˜์ด์ง€๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” ๋ฉ”๋‰ด๋ฅผ ListTile์ด๋ผ๋Š” ์ด๋ฆ„ ์•„๋ž˜ ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค ListTile๊ตฌ์„ฑ์— ๋ณด์‹œ๋ฉด onTap์ด ์žˆ๋Š”๋ฐ, ์ด ๋ถ€๋ถ„์€ ๋‚˜์ค‘์— ๊ฐ€๋ฉด ๋” ๊นŠ๊ฒŒ ๊ณต๋ถ€ํ•  ์˜ˆ์ •์ด์ง€๋งŒ ๊ฐ„๋‹จํ•˜๊ฒŒ onPressed์™€ ๋น„๊ตํ•ด๋ณด์ž๋ฉด onPressed๋Š”..
โ—พ ์™„์„ฑ ๋ชจ์Šต โ—พ code class Grade extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.amber[800], appBar: AppBar( title: Text('BBANTO'), centerTitle: true, backgroundColor: Colors.amber[700], elevation: 0.0, //left side leading: IconButton( icon: Icon(Icons.menu), onPressed: () { print('menu button is clicked'); }, ), actions: [ IconButton( ..
1. Flutter์—์„œ ์œ„์ ฏ์ด๋ž€? UI๋ฅผ ๋งŒ๋“ค๊ณ  ๊ตฌ์„ฑํ•˜๋Š” ๋ชจ๋“  ๊ธฐ๋ณธ ๋‹จ์œ„ ์š”์†Œ๋ฅผ ์œ„์ ฏ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ˆˆ์— ๋ณด์ด๋Š” ์š”์†Œ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๋ณด์ด์ง€ ์•Š๋Š” ์š”์†Œ๋“ค๊นŒ์ง€๋„ ์œ„์ ฏ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ํ•œ๋งˆ๋””๋กœ Eveything is Widget. 2. ์œ„์ ฏ ํƒ€์ž… Stateless widget ์ƒํƒœ๊ฐ€ ์—†๋Š” ์ •์ ์ธ ์œ„์ ฏ์„ ๋œปํ•ฉ๋‹ˆ๋‹ค. ์Šคํฌ๋ฆฐ์ƒ์— ์กด์žฌ๋Š” ํ•˜์ง€๋งŒ ์•„๋ฌด๊ฒƒ๋„ ๊ฐ€์ง€์ง€ ์•Š๊ณ , ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ์ €์žฅ์„ ๋ชปํ•˜๋Š” ์œ„์ ฏ์ž…๋‹ˆ๋‹ค. ์–ด๋– ํ•œ ์ƒํƒฑ๋ฅผ ์œ ๋ฐœํ•˜๋Š” value ๊ฐ’๋„ ๊ฐ€์ง€์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด์„œ image, text Stateful widget ์–ด๋–ค ์ƒํƒœ๋ฅผ ๊ฐ€์ง€๊ณ  ๊ณ„์† ์›€์ง์ž„์ด๋‚˜ ๋ณ€ํ™”๊ฐ€ ์žˆ๋Š” ์œ„์ ฏ ์‚ฌ์šฉ์ž ์ธํ„ฐ๋ž™์…˜์— ๋”ฐ๋ผ์„œ ๋‹ฌ๋ผ์ง€๋Š” ์œ„์ ฏ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด input, checkbox 3. ์œ„์ ฏ ๊ตฌ์„ฑ(ํŠธ๋ฆฌ) ์œ„์˜ ์„ค๋ช…์ฒ˜๋Ÿผ ๋งŽ์€ ์š”์†Œ๋“ค์ด ์œ„..
๋ฐ(Ming) ๐Ÿฐ
'๊ฐœ๋ฐœ/Flutter' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)