๊ด€๋ฆฌ ๋ฉ”๋‰ด

๋ชฉ๋ก๐Ÿ“ฑFlutter/Flutter Framework (5)

ruriruriya

[Flutter] ๊ธฐ๋ณธ ๋ ˆ์ด์•„์›ƒ์„ ๊ตฌ์„ฑํ•˜๋Š” Scaffold ์œ„์ ฏ

ํ”Œ๋Ÿฌํ„ฐ์—์„œ Scaffold ์œ„์ ฏ์€ ์•ฑ์˜ ํ™”๋ฉด ๋ ˆ์ด์•„์›ƒ์„ ๊ตฌ์„ฑํ•˜๋Š” ๊ธฐ๋ณธ์ ์ธ ํ‹€์„ ์ œ๊ณตํ•œ๋‹ค.๋ชจ๋“  ํ”Œ๋Ÿฌํ„ฐ ์•ฑ์˜ ํ™”๋ฉด์€ ๋ณดํ†ต Scaffold ์œ„์ ฏ์œผ๋กœ ์‹œ์ž‘๋œ๋‹ค.Scaffold๋Š” AppBar, body, FloatingActionButton ๋“ฑ์„ ํฌํ•จํ•œํ”Œ๋Ÿฌํ„ฐ์˜ Material Design ๊ฐ€์ด๋“œ๋ผ์ธ์— ๋”ฐ๋ผ ๊ธฐ๋ณธ UI ๊ตฌ์กฐ๋ฅผ ์ œ๊ณตํ•œ๋‹ค.Scaffold๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ๊ธฐ๋ณธ ๋ ˆ์ด์•„์›ƒ์„ ๋น ๋ฅด๊ฒŒ ์„ค๊ณ„ํ•  ์ˆ˜ ์žˆ๊ณ , Material Design ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ๊ฐ€ ๊ธฐ๋ณธ ์Šคํƒ€์ผ์— ์ ์šฉ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๊น”๋”ํ•˜๊ฒŒ ์ ์šฉ๋œ๋‹ค. ๊ทธ๋ฆฌ๊ณ , body ์˜์—ญ์— ์›ํ•˜๋Š” ๋ชจ๋“  ์œ„์ ฏ์„ ๋ฐฐ์น˜ํ•˜์—ฌ ๋ณต์žกํ•œ ๋ ˆ์ด์•„์›ƒ ์„ค๊ณ„๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.Scaffold ์ฃผ์š” ์†์„ฑ1. appBarํ™”๋ฉด ์ƒ๋‹จ์— ๋‚˜ํƒ€๋‚˜๋Š” AppBar ์˜์—ญ.์ œ๋ชฉ, ๋ฒ„ํŠผ, ๋ฉ”๋‰ด ๋“ฑ์„ ํฌํ•จํ•  ์ˆ˜ ์žˆ๋‹ค.Scaff..

[Flutter] build ๋ฉ”์„œ๋“œ

build ๋ฉ”์„œ๋“œ๋Š” Flutter์—์„œ UI๋ฅผ ๊ทธ๋ฆฌ๋Š” ํ•ต์‹ฌ์ ์ธ ์—ญํ• ์„ ํ•œ๋‹ค.Flutter์—์„œ UI๋Š” ์œ„์ ฏ์œผ๋กœ ๊ตฌ์„ฑ๋˜๊ณ , build ๋ฉ”์„œ๋“œ๋Š” ์ด ์œ„์ ฏ๋“ค์ด ํ™”๋ฉด์— ์–ด๋–ป๊ฒŒ ๋ฐฐ์น˜๋˜๊ณ  ํ‘œ์‹œ๋  ์ง€ ์ •์˜ํ•œ๋‹ค.build ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ ์‹œ๊ธฐ?1. ์ฒ˜์Œ ์œ„์ ฏ์ด ํ™”๋ฉด์— ์ถ”๊ฐ€๋  ๋•Œ์œ„์ ฏ์ด Flutter ์•ฑ ํŠธ๋ฆฌ์— ์‚ฝ์ž…๋˜๋ฉด, build ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ธ์ถœ๋œ๋‹ค.2. ์œ„์ ฏ์˜ ์˜์กด์„ฑ์ด ๋ณ€๊ฒฝ๋  ๋•Œ์˜ˆ๋ฅผ ๋“ค์–ด, ์œ„์ ฏ์ด ์ฐธ์กฐํ•˜๋Š” InheritedWidget์ด ์—…๋ฐ์ดํŠธ๋˜๋ฉด, ํ•ด๋‹น ์œ„์ ฏ์˜ build ๋ฉ”์„œ๋“œ๊ฐ€ ๋‹ค์‹œ ํ˜ธ์ถœ๋œ๋‹ค.3. ์ƒํƒœ๊ฐ€ ๋ณ€๊ฒฝ๋  ๋•Œ(StatefulWidget)์ƒํƒœ๊ฐ€ ๋ณ€ํ•˜๋ฉด build ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ธ์ถœ๋˜์–ด UI๊ฐ€ ์—…๋ฐ์ดํŠธ๋œ๋‹ค. build ๋ฉ”์„œ๋“œ์˜ ํŠน์ง•๋ฐ˜ํ™˜๊ฐ’ํ•ญ์ƒ ๋‹ค๋ฅธ ์œ„์ ฏ์„ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•œ๋‹ค.์˜ˆ๋ฅผ ๋“ค์–ด, ํ…์ŠคํŠธ๋ฅผ ํ‘œ์‹œํ•˜๊ฑฐ๋‚˜ ๋ฒ„ํŠผ์„ ์ƒ์„ฑํ•˜๋Š” ์œ„์ ฏ์„ ๋ฐ˜ํ™˜..

[Flutter] ์œ„์ ฏ์— ๋Œ€ํ•ด์„œ(Widget)

ํ”Œ๋Ÿฌํ„ฐ์—์„œ ์œ„์ ฏ(Widget)์ด๋ž€?ํ”Œ๋Ÿฌํ„ฐ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๊ธฐ๋ณธ ์š”์†Œ์ด๋‹ค.๊ฐ ์œ„์ ฏ์€ ํ…์ŠคํŠธ๋‚˜ ๋ฒ„ํŠผ ๊ฐ™์€ ๋ฌผ๋ฆฌ์  ์š”์†Œ๋ถ€ํ„ฐ ๋ ˆ์ด์•„์›ƒ ํšจ๊ณผ๊นŒ์ง€ ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ชจ๋“  ์ธก๋ฉด์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ณณ์— ์‚ฌ์šฉ๋œ๋‹ค.์œ„์ ฏ ๊ณ„์ธต ๊ตฌ์กฐ์œ„์ ฏ์€ ๊ตฌ์„ฑ(Composition)์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ํ˜•์„ฑํ•œ๋‹ค.๊ฐ ์œ„์ ฏ์€ ๋ถ€๋ชจ ์œ„์ ฏ ๋‚ด๋ถ€์— ์ค‘์ฒฉ๋˜๋ฉฐ, ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ Context๋ฅผ ์ „๋‹ฌ ๋ฐ›๋Š”๋‹ค.์ด ๊ตฌ์กฐ๋Š” ๋ฃจํŠธ ์œ„์ ฏ๊นŒ์ง€ ์—ฐ๊ฒฐ๋œ๋‹ค.import 'package:flutter/material.dart';void main() => runApp(const MyApp());class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(Bui..

[Flutter] ์•ˆ๋“œ๋กœ์ด๋“œ ์‹ค์ œ ํ•ธ๋“œํฐ ์—ฐ๋™ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๊ธฐ

์–ดํ”Œ์„ ๊ฐœ๋ฐœํ•˜๋‹ค ๋ณด๋ฉด ํ”๋“ค๊ธฐ ๋“ฑ๋“ฑ ๋ชจ์…˜์ด ํ•„์š”ํ•  ๋•Œ๊ฐ€ ์žˆ๋Š”๋ฐ ์• ๋ฎฌ๋ ˆ์ดํ„ฐ๋กœ๋Š” ๊ทธ๋Ÿฐ ๊ธฐ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†๋‹ค.๊ทธ๋ž˜์„œ ์‹ค์ œ ์•ˆ๋“œ๋กœ์ด๋“œ ์Šค๋งˆํŠธํฐ ์—ฐ๊ฒฐํ•ด์„œ ํ…Œ์ŠคํŠธํ•ด๋ณด์ž.1. ๊ฐœ๋ฐœ์ž ๋ชจ๋“œ๋กœ ๋ณ€๊ฒฝXcode๋ฅผ ์‹คํ–‰ํ•ด์„œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ์„ ์‹œ์ž‘ํ•œ๋‹ค.[์„ค์ •] - [ํœด๋Œ€์ „ํ™” ์ •๋ณด] - [์†Œํ”„ํŠธ์›จ์–ด ์ •๋ณด]๋กœ ์ ‘์†ํ•ด์„œ๋นŒ๋“œ ๋ฒˆํ˜ธ๋ฅผ ์—ฐ๋‹ฌ์•„์„œ ํ„ฐ์น˜ํ•œ๋‹ค.'์•„๋ž˜์™€ ๊ฐ™์ด ๊ฐœ๋ฐœ์ž ๋ชจ๋“œ๋ฅผ ์ผฐ์Šต๋‹ˆ๋‹ค' ๋ผ๋Š” ๋ฉ”์„ธ์ง€๊ฐ€ ๋‚˜์˜ฌ ๋•Œ ๊นŒ์ง€๊ทธ๋ ‡๊ฒŒ ๋‹ค์‹œ ์„ค์ •์œผ๋กœ ๋‚˜์˜ค๋ฉด [๊ฐœ๋ฐœ์ž ์˜ต์…˜] ๋ฉ”๋‰ด๊ฐ€ ์ƒ๊ธด ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. 2. ์ปดํ“จํ„ฐ์— USB  ์—ฐ๊ฒฐUSB ๋””๋ฒ„๊น…์„ ํ™œ์„ฑํ™” ํ•˜๋ฉดUSB ๋””๋ฒ„๊น…์„ ํ—ˆ์šฉํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ? ๋ผ๋Š” ์ฐฝ์ด ๋‚˜์˜ค๊ณ 'ํ—ˆ์šฉ'์„ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด ๋œ๋‹ค. USB ์—ฐ๊ฒฐ์„ ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฉ”์„ธ์ง€๊ฐ€ ๋‚˜์˜ค๋Š”๋ฐ์ด ์ปดํ“จํ„ฐ์—์„œ ํ•ญ์ƒ ํ—ˆ์šฉ์„ ์ฒดํฌํ•˜๊ณ  'ํ—ˆ์šฉ' ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ๋‹ค. 3...

[Flutter] Xcode ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ ์„ค์น˜ - Unable to get list of installed Simulator runtimes.

Flutter๋ฅผ ๋งฅOS์—์„œ ์„ธํŒ…ํ•˜๋˜ ๋„์ค‘์— flutter doctor๋ช…๋ น์–ด๋กœ ๋ฌธ์ œ๊ฐ€ ์—†๋Š” ์ง€ ํ™•์ธํ•˜๋Š” ์ค‘์—Xcode์˜ ๋ผ์ด์„ ์Šค ๋™์˜๊ฐ€ ์™„๋ฃŒ๊ฐ€ ๋˜์ง€ ์•Š์•„์„œ ์ฐพ์•„๋ณด๋‹ˆXcode ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ ์„ค์ •๋ฌธ์ œ์˜€๋‹ค. Xcode - develop for iOS and macOS (Xcode 16.2)    โœ— Unable to get list of installed Simulator runtimes.์ฒ˜์Œ์—๋Š” ๋ผ์ด์„ ์Šค ๋™์˜ํ•˜๋Š” ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ–ˆ์—ˆ๋‹ค.sudo xcodebuild -license accept ๊ณ„์† ์‹œ๋„ํ–ˆ์ง€๋งŒ ๊ณ„์† Warning ํ‘œ์‹œ๊ฐ€ ๋–ด๋‹ค ....๊ทธ๋Ÿฌ๋‹ค๊ฐ€ ์ฐพ์•„๋ณด๋‹ˆ Xcode ์–ดํ”Œ์—์„œ ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์ง์ ‘ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐํ•˜๊ฒŒ ๋˜์–ด ๊ธฐ๋กํ•œ๋‹ค! 1. Xcode ์‹คํ–‰Xcode๋ฅผ ์‹คํ–‰ํ•ด์„œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ์„ ์‹œ์ž‘ํ•œ๋‹ค.์ผ๋‹จ ..