1주차 - Flutter 앱 개발 맛보기 & Dart 문법 익히기

  • PDF 파일

    1주차-Flutter_앱_개발_맛보기__Dart_문법_익히기.pdf

  • 단축키 모음

    • 새로고침 F5
    • 저장
      • Windows: Ctrl + S
      • macOS: command + S
    • 전체선택
      • Windows: Ctrl + A
      • macOS: command + A
    • 잘라내기
      • Windows: Ctrl + X
      • macOS: command + X
    • 콘솔창 줄바꿈
      • shift + enter
    • 코드정렬
      • Windows: Ctrl + Alt + L
      • macOS: option + command + L
    • 들여쓰기
      • Tab
      • 들여쓰기 취소 : Shift + Tab
    • 주석
      • Windows: Ctrl + /
      • macOS: command + /

[수업 목표]

  • Flutter 앱 개발 과정 이해하기
  • VSCode와 친해지기
  • Dart 문법 이해하기

[목차]


01. Why Flutter

  • 1) 앱 개발 방법

    • 네이티브 앱(Native App)

      • Android

        → Google에서 제공하는 Android SDK(Software Development Kit)를 이용하여 개발

        • 프로그래밍 언어 : Java / Kotlin
        • 개발 툴 : Android Studio
      • iOS

        → Apple에서 제공하는 iOS SDK(Software Development Kit)를 이용하여 개발

        • 프로그래밍 언어 : Objective-C / Swift
        • 개발 툴 : XCode
        • 특이사항 : macOS 에서만 개발이 가능

        출처 - [지식iN 앱을 Flutter로 개발하는 이유](https://d2.naver.com/helloworld/3384599)

        출처 - 지식iN 앱을 Flutter로 개발하는 이유

    • 크로스 플랫폼 앱(Cross Platform App)

      • React Native

        • 프로그래밍 언어 : JavaScript
        • 페이스북에서 출시한 오픈 소스 모바일 애플리케이션 프레임 워크
      • Flutter

        • 프로그래밍 언어 : Dart
        • 구글에서 출시한 오픈 소스 모바일 애플리케이션 프레임 워크
  • 2) 왜 크로스 플랫폼을 사용할까요?

    🛠 생산성이 월등하다.

    [출처 - 네이버 지식iN 앱을 Flutter로 만든 이유](https://d2.naver.com/helloworld/3384599)코

    출처 - 네이버 지식iN 앱을 Flutter로 만든 이유

  • 3) 왜 Flutter를 사용할까요?

    1. 🔥 Flutter가 훨씬 핫하다 (React Native 대비. 커뮤니티 & 자료 ⬆)

      → 개발을 할 때 훨씬 편하게 찾아볼 수 있다는 뜻입니다 :)

      출처 - [getstream.io](https://getstream.io/blog/flutter-vs-react-native-the-ultimate-comparison/)

      출처 - getstream.io

    2. 📚 공식 문서가 잘 되어 있다.

      [https://docs.flutter.dev/](https://docs.flutter.dev/)

      https://docs.flutter.dev/

    3. 👍 성능이 뛰어나다

      출처 - [Flutter vs Native vs React-Native: Examining performance](https://medium.com/swlh/flutter-vs-native-vs-react-native-examining-performance-31338f081980)

      출처 - Flutter vs Native vs React-Native: Examining performance

02. 설치하기

  • Windows 사용자를 위한 프로그램 설치 방법
- [잠깐] 혹시 Windows 7를 쓰신다면 아래 가이드를 따라주세요 :)
    - [링크](https://www.microsoft.com/ko-kr/p/powershell/9mz1snwt0n5d?activetab=pivot:overviewtab)에 접속하셔서 Power Shell을 설치해주세요.

**[프레임워크 설치하기]**

- 1. Flutter 설치하기

    <aside>
    💡 Flutter 설치 과정은 일반적인 프로그램 설치와는 조금 다릅니다. 일반적으로는 `.exe` 파일등을 실행해 프로그램을 설치하는데요.

    Flutter 설치는 아래와 같은 과정으로 진행됩니다.

    1. zip 파일을 다운로드 받아서 적절한 경로에 압축 해제
    2. 압축 해제한 flutter 폴더 경로를 환경변수에 등록 
    (flutter 라는 명령어가 이 경로에 있다는 것을 윈도에게 알리는 것과 같습니다)
    </aside>

    - 1) 다운로드
        1. 먼저 flutter 를 설치할 폴더를 만들겠습니다. 

            아래 사진에서 밑줄친 부분을 폴더 경로(주소)라고 하는데요. 

            여기에 **한글이나 공백이 들어가면** 인식을 못하고 에러가 발생합니다.

            ![Screenshot 2022-09-20 024333.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9b6779d0-a45f-40b8-b848-542e143236be/Screenshot_2022-09-20_024333.png)

            에러를 막기 위해 `C 드라이브` 바로 아래에 `src` 라는 이름의 폴더를 생성해줍니다.

            ![Screenshot 2022-09-20 024147.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2090724a-a484-4960-8c32-5fa8f3e49c3b/Screenshot_2022-09-20_024147.png)

        2. flutter 를 다운로드할 수 있는 [링크](https://docs.flutter.dev/get-started/install/windows)로 이동합니다.

            [Windows install](https://docs.flutter.dev/get-started/install/windows)

        3. 파란색 버튼(zip 파일 다운로드 링크)을 클릭합니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/962ad32c-bfeb-410e-bb13-a8117bebdc90/Untitled.png)

            <aside>
            💡 아래 경고 메시지를 꼭 확인해주세요
            1. 특수문자(한글 포함)나 공백이 설치 경로에 포함되면 안된다
            2. `C:\Program Files\` 밑에는 설치하면 안된다 (상위 권한 필요)

            </aside>

        4. 아까 만들어준 `C:\src` 폴더에 해당 zip 파일을 다운로드 해줍니다. 

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/22a72d03-2d30-4090-94e7-03b78ed87e80/Untitled.png)

            <aside>
            💡 zip 파일은 어디에 다운로드하셔도 상관 없습니다. 
            대신 압축을 풀어줄 때 만큼은 꼭 `C:\src` 폴더에 풀어주세요

            </aside>

        5. 압축을 해제해주세요!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e70291ca-afad-49c1-b4ee-368d5f797f21/Untitled.png)

            누르면 아래와 같이 압축 해제 대상 폴더를 지정하는 화면이 나옵니다. 
            여기서 `flutter_windows_…` 이 부분을 지워주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/210a3788-ccb5-4728-b9ca-5823bec0fadd/Untitled.png)

            지우고 난 경로는 아래와 같습니다. 마저 압축 해제를 눌러줄까요?

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1bf07a7d-1a97-421a-837d-13248cf836e4/Untitled.png)

            압축을 모두 해제하는 데 10-20분 정도 걸립니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/187db94f-296d-4810-ab42-b87792dc7d1c/Untitled.png)

            압축 해제가 끝나고 나면 아래와 같이 flutter 라는 폴더가 생성되어 있을 것입니다. 
            (위에서 경로를 잘 지정해줬다면요!)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c4af3a34-0d85-4dcc-be30-8c988e71a46c/Untitled.png)

            <aside>
            💡 간혹가다 위에서 경로 설정을 실수해 `flutter_windows_…` 이런 이름으로 해제된 경우가 있습니다.
            이 때는, 해당 폴더를 클릭해서 들어가면 비로소 `flutter` 라는 이름의 폴더를 보실 수 있습니다. 해당 `flutter` 폴더를 위 사진과 같이 밖으로 빼주세요! 
            (아래 환경 변수 설정을 원활히 하기 위함입니다)

            </aside>

    - 2) 환경 변수 설정

        <aside>
        💡 다운로드한 Flutter를 어디서든지 사용 가능하도록 설정하는 절차입니다.

        </aside>

        1. 압축이 해제된 `flutter` 폴더로 들어가 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4833238e-f729-4f8c-9071-961a744110e9/Untitled.png)

        2. `bin` 폴더로 들어가주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/160d2074-5c6c-447b-96b5-6f7b6a7b24b2/Untitled.png)

        3. 들어가시면 `dart`, `dart.bat`, `flutter`, `flutter.bat` 과 같은 파일들이 있습니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c811e337-c8c9-4e33-afa4-789a2b915b6e/Untitled.png)

            <aside>
            💡 이들이 바로 flutter 실행 파일입니다. cmd 로 이 폴더를 열고 `flutter` 라고 치면, 여기 있는 파일이 실행됩니다.

            지금은 플러터가 설치된 폴더 에서만 `flutter` 라는 명령어를 실행할 수 있습니다.

            우리는 이 flutter 실행 파일을 **컴퓨터 어디에서도 모두 접근 가능하게끔**, 즉 어디에서도 `flutter` 라는 명령어를 사용할 수 있게끔 해야 합니다.

            환경 변수에 flutter 가 위치한 **폴더 경로를 추가**하면, 시스템의 모든 경로에서 이 flutter 파일에 접근하고, 실행할 수 있습니다.

            </aside>

        4. 이를 위해 우선 해당 폴더 경로를 복사하겠습니다. 위 과정을 잘 따라오셨다면 경로는 아래와 같습니다.

            ```
            C:\src\flutter\bin
            ```

            선택된 경로를 복사해주세요. (`Ctrl + C`)

            ![Screenshot 2022-09-20 033732.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3be69e5a-d3cc-4dd2-ac50-0a6337570189/Screenshot_2022-09-20_033732.png)

        5. 윈도우에 `환경 변수` 라고 검색합니다. (띄어쓰기도 하셔야 해요!)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8ec7c12c-472c-495c-894c-a1053c69ad96/Untitled.png)

        6. 아래와 같은 창에서 `환경 변수` 버튼을 클릭해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4b070e0b-98ea-458e-a852-0eb81fe4d496/Untitled.png)

        7. `사용자 변수`에 `path`를 선택한 뒤, `편집` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/85218bab-1214-48fd-be84-88664017d379/Untitled.png)

        8. `새로 만들기(N)`을 선택하신 뒤 복사한 주소를 붙여 넣고 `확인` 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 033954.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b5246c68-425b-4d7b-924c-d03b9c6a09df/Screenshot_2022-09-20_033954.png)

        9. 켜져있는 창들을 모두 `확인` 버튼을 눌러 닫아주세요.


            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3c2ab250-9830-4b25-b116-7dbd8c6c3757/Untitled.png)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/71c100c4-a2f5-4776-87df-d9cb79a55dc2/Untitled.png)

    - 3) 설치 확인
        1. `cmd`를 검색해서 `명령 프롬프트`를 실행해줍니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/383052bb-12ac-468a-8044-7f663e4eaac2/Untitled.png)

        2. 명령 프롬프트에 `flutter --version` 이라고 검색했을 때, 아래와 같은 문구가 뜨면 설치 완료!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/37002ed1-e60e-4265-a98f-1da627f8faf7/Untitled.png)

            <aside>
            💡 이제 시스템의 모든 경로에서 `flutter` 라는 명령어를 사용할 수 있습니다!

            </aside>


**[에디터 설치하기]**

- 2. Visual Studio Code

    <aside>
    💡 Visual Studio Code (줄여서 VSCode) 앞으로 실제 코드를 작성할 편집 툴입니다.

    Flutter 개발은 Android Studio와 VSCode 둘 중 원하는 툴을 사용하여 개발할 수 있는데 VSCode가 더 가볍기 때문에 앞으로 수업은 VSCode에서 진행하도록 하겠습니다.

    </aside>

    - 1) VSCode 설치
        1. [링크](https://code.visualstudio.com/download)에 접속해 주세요.
        2. Window 버튼을 클릭합니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/63572ab2-31fb-47de-8ee1-edb8a771ad70/Untitled.png)

        3. 내 문서에 저장합니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b8406fa7-10d5-4e0c-a62a-8c71df502976/Untitled.png)

        4. VSCodeUserSetup 파일을 실행해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/15e64328-4565-4b1e-9997-a1caf5b97980/Untitled.png)

        5. `동의합니다` 선택 후 `다음` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/26c4868e-98de-4a72-8234-0cf8cdd98c95/Untitled.png)

        6. 경로를 확인하시고, `다음` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ee0ad10c-50f8-4c5e-95ce-a10813d226b1/Untitled.png)

        7. `다음` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3af5829c-429a-423c-9ff8-f79400f451bd/Untitled.png)

        8. `바탕 화면에 바로가기 만들기`를 선택해주시고, `다음` 버튼을 클릭해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/85d38b8f-cd2c-4f29-9dd6-e590ea63fcd1/Untitled.png)

        9. `설치` 버튼을 클릭해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dd0dcbcc-e464-4f96-b883-1b225ae0ab10/Untitled.png)

        10. `종료` 버튼을 클릭해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6c6ba3eb-5b6b-4089-b70a-68dc787e9d3c/Untitled.png)

        11. 아래와 같이 Visual Studio Code가 실행되면, 설치 완료!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/eb31a4ee-2ed8-48df-961e-1d856ff46188/Untitled.png)

            <aside>
            💡 우측 하단에 한국어로 변경하라는 팝업이 뜹니다.
            하지만 VSCode 사용법이나 대부분의 개발 자료는 영어로 되어 있기 때문에, 가급적 적용하지 않기를 권장 드립니다. (수업 자료도 영어 버전으로 되어있어요!)

            해당 알람을 다시 보지 않으려면 `우측 톱니바퀴 ⚙` 아이콘을 누른 뒤 `Don't Show Again`을 선택해 주세요. (만약 사라져서 버튼을 누르지 못했다면 다음번에 눌러주세요!)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1bbcc25a-bac1-412e-a0ee-a8302ce700e2/Untitled.png)

            </aside>

    - 2) Extension 설치

        <aside>
        💡 VSCode는 Flutter 뿐만 아니라 다양한 개발을 모두 할 수 있는 통합 에디터입니다. VSCode에서 Flutter 앱 개발을 하려면 VSCode에 Extension 탭에서 아래 목록의 Extension 들을 설치해야 합니다.

        **Flutter** : VSCode에서 Flutter 개발 환경 지원
        **Dart** : Flutter 개발 시 사용되는 Dart 개발 환경 지원

        </aside>

        1. 좌측에 extension 아이콘(동그라미)을 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/069b334c-7c6b-4eca-814c-24e159788880/Untitled.png)

        2. `flutter` 라고 검색한 뒤, 해당 익스텐션을 선택하고 `install` 버튼을 눌러 설치해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3fd60cf3-786d-427f-852f-08b92eae5795/Untitled.png)

        3. 위 `flutter` 익스텐션을 설치하면서 `dart` 익스텐션도 일반적으로 함께 설치가 됩니다.

            `dart` 라고 검색하신 뒤 혹시 설치가 안되었다면 해당 익스텐션도 같이 설치해주세요. 

            `uninstall`이라고 뜨신다면 이미 설치가 된 것이니 넘어가시면 됩니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b4bbc0d8-e9bc-4b7b-9fb8-ef0989d06ce0/Untitled.png)


**[IDE 설치하기]** ** IDE : 소프트웨어 애플리케이션*

- 3. Android Studio
    - 1) Android Studio 설치
        1. [링크](https://developer.android.com/studio)에 접속한 뒤, `Download Android Studio`를 클릭해주세요.

            ![Screenshot 2022-09-20 035221.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/7ce46c8b-e17a-40d0-b310-104655399374/Screenshot_2022-09-20_035221.png)

        2. 팝업 창이 뜨면, 쭉 읽어보시고, 바닥까지 스크롤을 내려주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/11a77b36-7bdd-4011-bc10-522b6a25894a/Untitled.png)

        3. 약관에 동의하도록 체크하신 뒤, 다운로드 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 035239.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/58b91dbe-952b-49ac-90f2-13e05d6d0c3d/Screenshot_2022-09-20_035239.png)

        4. 다운로드 폴더에 다운로드를 진행해주세요.

            ![Screenshot 2022-09-20 035410.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d923689f-e997-4dd2-b440-1e9b09646f72/Screenshot_2022-09-20_035410.png)

        5. 다운로드가 완료되면, `android-studio`를 클릭해서 실행해주세요.

            ![Screenshot 2022-09-20 035510.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b28f7995-98a2-4fa6-b100-d9ab0fa47387/Screenshot_2022-09-20_035510.png)

        6. 아래 이미지들을 모두 `Next` 버튼을 눌러 설치를 진행해 주세요.

            ![Screenshot 2022-09-20 035732.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5779e09c-c112-48f2-bbb0-952057a29503/Screenshot_2022-09-20_035732.png)

            ![Screenshot 2022-09-20 035744.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0b3b3939-942a-4861-bdce-ae3ffdbed13f/Screenshot_2022-09-20_035744.png)

            ![Screenshot 2022-09-20 035803.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6762f22f-60db-4c64-939d-0df372f4867a/Screenshot_2022-09-20_035803.png)

        7. `Install` 버튼을 눌러 주세요.

            ![Screenshot 2022-09-20 035818.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f8eca212-ff82-4d19-bd05-6cc7799c41a5/Screenshot_2022-09-20_035818.png)

        8. `Next` 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 035928.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/025bbed0-ae37-4c57-8fb2-a34844a07596/Screenshot_2022-09-20_035928.png)

        9. 설치가 완료되었고, `Finish` 버튼을 눌러 Android Studio를 실행해 주세요.

            ![Screenshot 2022-09-20 035954.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3c06fc74-6322-46f0-a89e-251455d29c79/Screenshot_2022-09-20_035954.png)

        10. 아래와 같은 창이 뜨면 `OK`를 눌러주세요.

            ![Screenshot 2022-09-20 040050.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fe9509eb-7bb4-4cbe-8bf9-a3b54db635b1/Screenshot_2022-09-20_040050.png)

        11. Android Studio 사용성 개선을 위해 Google에 데이터를 공유하고 싶으시다면, `Send usage statistics to Google` 버튼을 누르시고, 그렇지 않으시면 `Don't send` 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 040150.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/014b2fd1-a3b1-4610-aa6c-a0a52b65caa5/Screenshot_2022-09-20_040150.png)

        12. Setup Wizard가 실행되면, `Next` 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 040252.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1c2cdfad-1ca2-4ec5-9c9b-99b4ee05f9dc/Screenshot_2022-09-20_040252.png)

        13. `Next` 버튼을 눌러주세요.

            ![Screenshot 2022-09-20 040236.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/382ea58f-be44-4640-8347-8e6d21f13e54/Screenshot_2022-09-20_040236.png)

        14. 원하시는 테마를 선택하신 뒤 `Next`를 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f7e2a5fc-217d-4e63-badc-265e7439904e/Untitled.png)

        15. 만약 계정 이름이 한글이거나 띄어쓰기가 들어가 있다면`Your Android SDK location contains non-ASCII characters` 혹은 `your path contains white space etc.` 라도 뜨며 진행이 안됩니다.

            <aside>
            💡 에러가 없으신 분들은 `Next` 버튼을 누르고 26 순서로 넘어가 주세요

            </aside>

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/efaf14eb-3915-4a67-9509-a86dbad1991e/Untitled.png)

            Android SDK Location 경로를 직접 만들어주도록 하겠습니다.

        16. 이런 경우, 아래 그림과 같이 Android SDK Location에 `C:\Users\내 계정이름\Local`까지만 선택해 복사해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/453fce97-843d-4451-9fb7-a3dc81198db4/Untitled.png)

        17. `탐색기`를 열고 주소창에 붙여 넣은 뒤 엔터를 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0f83a23d-a1ac-4975-ac74-d12b2fd756d9/Untitled.png)

        18. 현재 Local이라는 폴더에 들어와 있고, 여기에 `Android`라는 폴더를 만들어 주세요. (대문자로 시작합니다)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/69dd03b0-8637-46ff-95f8-989545a5f507/Untitled.png)

        19. 생성한 `Android` 폴더에 들어간 뒤 `Sdk` 라는 폴더를 만들어주세요. (대문자로 시작합니다)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/36f523e9-78f0-4bf8-ac4a-e088101e3c89/Untitled.png)

        20. 생성한 `Sdk` 폴더 안으로 들어가 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/983e5efe-61c7-453f-a6f2-b794d91e14c7/Untitled.png)

        21. 윈도우 검색창에 `명령`이라고 검색한 뒤 `명령 프롬프트`를 우클릭하여 `관리자 권한으로 실행`해 주세요. 그냥 실행하면 안됩니다! 

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d164c4b7-9cc1-4e36-820e-423bcce82e1e/Untitled.png)

            실행할지 물어보는 팝업이 뜨면 예를 눌러서 실행해주세요.

        22. 아래 명령어를 복사한 뒤 명령 프롬프트에 붙여 넣어주세요. 아직 실행하시면 안됩니다.

            ```bash
            mklink /D C:\android-sdk 
            ```

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/aa888d25-2d68-41e1-a200-4ee498e8b403/Untitled.png)

            다음 탐색기에서 주소창을 클릭해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c09bbf0b-9031-4dff-80ec-5995cc77b6ac/Untitled.png)

            주소를 복사해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8707cb46-2d75-497e-b4af-c0f8d13b4564/Untitled.png)

            복사한 경로를 명령 프롬프트 `android-sdk` 뒤에 붙여 넣어주세요. 참고로 아래 그림과 같이 사이에 띄어쓰기가 있어야합니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0b2b2e71-d645-4b4e-9912-8268a6cfcdc2/Untitled.png)

            명령어를 실행해 아래와 같이 기호화된 링크를 만들었다고 뜨면 성공입니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/447f5527-cee0-4a38-95ef-ec8e9ea839af/Untitled.png)

            <aside>
            💡 Android/Sdk 폴더에 바로가기를 C 드라이브 바로 밑에 생성하는 과정입니다.

            </aside>

        23. 다시 Android Studio Setup Wizard로 돌아와서, 아래 그림과 같이 Android SDK Location 밑에 폴더 아이콘을 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f15a708c-8f05-4d5b-9b4c-058734307ee2/Untitled.png)

            그러면 아래와 같이 경로를 선택하는 창이 뜹니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a7ea5d26-5815-42d4-a2c1-e05c8c1f0e48/Untitled.png)

        24. 아래 코드를 복사해서 아래 그림과 같이 경로 선택창의 주소에 붙여 넣고 `OK`를 눌러주세요.

            ```bash
            C:\android-sdk
            ```

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ca60021d-a9d3-4d03-a0d4-ea2e36a8b442/Untitled.png)

        25. 이제 경로 관련 빨간 에러가 사라지고 활성화된 `Next` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d970a8c9-2e3f-4e48-b03f-bd534f3b942d/Untitled.png)

        26. `Next` 를 눌러서 세팅을 진행해 주세요.

            ![Screenshot 2022-09-20 040522.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f03635e8-f1ff-4c6a-b91a-85506c8249eb/Screenshot_2022-09-20_040522.png)

        27. **License Agreement** 화면이 나옵니다. 왼쪽 밑줄 친 부분을 클릭해 모두 `Accept` 를 눌러주세요

            ![Screenshot 2022-09-20 040605.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c88f04d6-c9be-4227-a04d-864194411d00/Screenshot_2022-09-20_040605.png)

        28. `Accept` 를 모두 누르고 나면 `Finish` 버튼이 활성화됩니다. 눌러주세요.

            ![Screenshot 2022-09-20 041010.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/99167e06-dc28-4302-8b1a-4e7728c397eb/Screenshot_2022-09-20_041010.png)

        29. 설치가 진행됩니다. 시간이 다소 소요되니 천천히 기다려주세요!

            ![Screenshot 2022-09-20 041021.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0d41bef0-1e89-4670-9de5-2dc25755c5f7/Screenshot_2022-09-20_041021.png)

        30. 중간에 `이 앱이 디바이스를 변경할 수 있도록 허락하시겠어요?` 라는 팝업이 뜨면 `예를 선택`해주세요. 
        31. 모든 세팅이 완료되면 `Finish`를 클릭해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/59ef93c2-cb59-4883-9297-7d78b73b3e77/Untitled.png)

    - 2) Android Command-line Tools 설치

        <aside>
        💡 `Android Command-line Tools`는 Flutter에서 Android에 명령을 내리기 위해 필요합니다.

        </aside>

        1. 아래와 같이 Android Studio가 실행되면, `More Actions`를 클릭한 뒤 `SDK Manager`를 클릭해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8375a11c-71c1-40ba-ba2a-6d5929d738b6/Untitled.png)

        2. `SDK Tools`를 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/31ad9747-b889-4dc8-8b6e-efce041de413/Untitled.png)

        3. `Android SDK Command-line Tools (latest)`를 선택한 뒤 `OK`를 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c6faa542-270d-495f-bb77-3a7cd2b94cbf/Untitled.png)

        4. Dialog가 뜨면 `OK` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5def3ca8-3748-4ae3-bec2-bb118c427cd9/Untitled.png)

        5. 설치가 완료되면 `Finish` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/32b5f758-804f-48c1-85a2-6c710144e705/Untitled.png)

    - 3) Android Virtual Devices 설치

        <aside>
        💡 앱을 개발시 실제 휴대폰을 연결하여 개발을 진행할 때도 있지만, 대부분의 경우 Virtual Device(컴퓨터에 가상의 휴대폰을 띄우는 소프트웨어)를 이용하여 개발합니다.

        </aside>

        1. `More Actions` → `Virtual Device Manager` (또는 `AVD Manager`)를 선택해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/69051de0-5876-460e-8f11-d77cd168cd75/Untitled.png)

        2. 이미 Device 가 있는 분들은 아래 절차를 진행하지 않으셔도 됩니다.

            ![Screenshot 2022-09-20 042622.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8527ebd0-b48f-4daf-ba4b-f470669a0c6b/Screenshot_2022-09-20_042622.png)

        3. (Device 가 없는 경우) `Create Virtual Device`를 선택해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c6e4b33d-a56d-46c0-a041-70ef779cbb25/Untitled.png)

        4. 기본적으로 선택되어 있는, `Phone` → `Pixel 2` 디바이스를 `Next` 버튼을 눌러 생성합니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dbb2fe70-9970-491e-a29b-204668dfc7e1/Untitled.png)

        5. Release Name `Q`의 `Download`를 클릭하여 가상 기기에 설치할 OS를 다운로드 합니다.

            <aside>
            💡 R 버전은 Virtual Device에서 문제가 있다고 해요. 그래서 **Q 버전**으로 진행할게요!

            </aside>

            ![Screenshot 2022-09-20 042844.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cf446b06-b759-4156-af88-5e7de8b1f696/Screenshot_2022-09-20_042844.png)

        6. 설치가 완료되면 `Finish` 버튼을 눌러 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a8304bbc-b8d8-42f4-a5f1-0253ab75dd3a/Untitled.png)

        7. `Q` 버전의 OS를 선택한 뒤 `Next` 버튼을 눌러 주세요.
        **API Level 29**인지 확인해주세요 :)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0442c914-01e1-42bb-afd2-c02bde2ffb9d/Untitled.png)

        8. `Finish` 버튼을 눌러 Virtual Device 설치를 완료 해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c733f125-59d4-423b-93ae-d2434ba46a55/Untitled.png)

        9. 성공적으로 추가된 Virtual Device를 확인하시고, 이제 Android Studio는 종료해주세요!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3215221e-ec74-4c41-ae1c-fa738500babb/Untitled.png)

    - 4) Android Licenses
        1. `cmd`를 검색해서 `명령 프롬프트`를 실행해줍니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/383052bb-12ac-468a-8044-7f663e4eaac2/Untitled.png)

        2. `flutter doctor`라고 입력한 뒤 엔터를 누릅니다.
        아래와 같이 `Android toolchain`의 좌측에  `[!]` 표시가 되어있습니다.

            ![Screenshot 2022-09-20 043142.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/504d7c2f-2725-479d-93b6-889615c328d4/Screenshot_2022-09-20_043142.png)

        3. 문제를 해결하기 위해 `flutter doctor --android-licenses`를 복사해서 실행해 줍니다.
        4. 실행하면 라이센스에 대한 동의를 여러번 구하는데, `y`를 입력하고 엔터를 눌러 진행해줍니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/299f3349-5434-4687-9a37-c0b94b9ce408/Untitled.png)

        5. `All SDK package licenses accepted` 라는 메시지가 뜨면 완료된 것입니다.

            ![Screenshot 2022-09-20 043215.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/915ccacc-e383-48bb-a183-b121b27b5096/Screenshot_2022-09-20_043215.png)

        6. `flutter doctor` 를 입력했을 때 아래와 같이 `Android toolchain`의 좌측에 체크(`[v]`) 되었다면 완료!

            ![Screenshot 2022-09-20 043631.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/64df1c29-20fa-409a-bcfe-fabaa84af36a/Screenshot_2022-09-20_043631.png)

            <aside>
            💡 Visual Studio 는 windows 용 앱을 개발할 때 필요한 툴입니다. 지금은 Android, iOS 앱 개발만 진행하므로 신경쓰지 않으셔도 됩니다.

            </aside>

- 4. Xcode → 애플 정책상 맥환경에서만 사용 가능합니다 😞

    <aside>
    💡 Xcode는 iOS 앱 개발시 필요한 툴로 macOS에서만 설치가 가능하므로 넘어가도록 하겠습니다.

    </aside>

    <aside>
    💡 [잠깐!] 그러면 window에서는 iOS 앱 개발을 할 수 없는 건가요?

    애플의 정책상 iOS 앱은 macOS에서만 개발이 가능합니다. 😂

    하지만 Flutter로 작성한 코드는 Android 뿐만 아니라 iOS에서도 이용할 수 있으니 향후 macOS가 생기신다면 기존 소스코드를 그대로 사용하여 iOS 앱도 출시할 수 있습니다!

    </aside>


**설치를 완료하셨나요~? 잘 설치되었는지 확인해봅시다! ㅎㅎ**

- 최종 설치 확인
    1. `cmd`를 검색해서 `명령 프롬프트`를 실행해줍니다.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/383052bb-12ac-468a-8044-7f663e4eaac2/Untitled.png)

    2. `flutter doctor` 를 입력했을 때 아래와 같이 모든 항목이 체크(`[v]`) 되었다면 설치 완료!

        ![Screenshot 2022-09-20 043631.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/64df1c29-20fa-409a-bcfe-fabaa84af36a/Screenshot_2022-09-20_043631.png)


    <aside>
    💡 고생하셨습니다! 원래 개발 환경을 설정하는데 시간이 많이 들어갑니다 😂
    그럼 1주 차 수업 때 뵙도록 하겠습니다 🙂

    </aside>
  • MacOS ver 프로그램 설치 방법
**[프레임워크 설치하기]**

- **1. Flutter** - Android와 iOS 앱을 하나의 코드로 구현할 수 있도록 도와주는 프레임워크

    <aside>
    💡 Flutter 설치 과정은 일반적인 프로그램 설치와는 조금 다릅니다. 일반적으로는 `.pkg` 파일등을 실행하거나, `Applications` 폴더에 드래그 & 드롭해 설치를 진행하는데요.

    Flutter 설치는 아래와 같은 과정으로 진행됩니다.

    1. zip 파일을 다운로드 받아서 적절한 경로에 압축 해제
    2. 압축 해제한 flutter 폴더 경로를 환경변수에 등록 
    (flutter 라는 명령어가 이 경로에 있다는 것을 macOS에게 알리는 것과 같습니다)
    </aside>

    <aside>
    💡 시작하기에 앞서 **Apple Sillicon (M1, M2 등)** 을 사용하시는 분들은 **터미널**을 열고 아래 명령어를 입력해주세요 (인텔용 소프트웨어를 실행시킬 수 있는 **Rosetta** 라는 번역기를 설치하는 명령어입니다.)

    ```bash
    sudo softwareupdate --install-rosetta --agree-to-license
    ```

    ### 터미널이란?

    터미널은 마우스 클릭이 아닌 키보드로 컴퓨터에게 명령을 내리는 프로그램 입니다.

    ![terminal.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8def37ba-6141-4924-919d-9712a68a8981/terminal.png)

    ### 터미널 실행 방법

    1. macOS 우측 상단에 `돋보기 🔍` 아이콘을 선택해 주세요. 그러면 아래와 같이 `Spotlight 검색` 창이 뜹니다.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1d6cc87e-0a8a-4477-bf51-eb6f302c89b5/Untitled.png)

    2. `Spotlight`에 `terminal`이라고 검색한 뒤, 아래와 같이 하단에 `터미널` 프로그램이 보이면 엔터를 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e6f1ffd0-6481-4c04-b40c-9a530a51fcb2/Untitled.png)

    3. 터미널 프로그램이 실행됩니다.

        ![스크린샷 2021-12-08 오후 10.11.21.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b52a3237-b714-410f-baed-2372d0c844da/스크린샷_2021-12-08_오후_10.11.21.png)

    </aside>

    - 1) 다운로드
        1. 먼저 flutter 를 설치할 폴더를 만들겠습니다. Downloads 폴더를 먼저 열어줍니다

            ![Screen Shot 2022-09-20 at 12.20.17 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/15210334-edd2-43ce-bf65-9e3004dd5942/Screen_Shot_2022-09-20_at_12.20.17_PM.png)

        2. 여기서 `Cmd + ↑(화살표 위 버튼)` 을 눌러주세요. 상위 폴더로 이동하는 단축키입니다. 아래와 같이 유저명과 같은 이름의 폴더로 이동하면 됩니다.

            ![Screen Shot 2022-09-20 at 12.22.11 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0ae831c6-cec3-4b99-8034-2e3e4fb6cd0a/Screen_Shot_2022-09-20_at_12.22.11_PM.png)

        3. 이제 여기에 development 라는 이름의 폴더를 생성하겠습니다. 우측 상단의 `Actions` (점 3개 아이콘) 를 클릭하고 `New Folder` 를 선택해주세요.

            ![Screen Shot 2022-09-20 at 12.26.11 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/27a47ddd-37dc-431c-bfd9-04e6809be11a/Screen_Shot_2022-09-20_at_12.26.11_PM.png)

            `**development**` 라는 이름으로 생성해줍니다.

            ![Screen Shot 2022-09-20 at 12.28.07 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/08feceb1-3e60-41b4-a885-ed44ba1bfa46/Screen_Shot_2022-09-20_at_12.28.07_PM.png)

        4. 이제 생성한 폴더에 flutter 압축 파일을 다운로드하겠습니다.

            Chrome 브라우저에서 [링크](https://docs.flutter.dev/get-started/install/macos)를 열어주세요.

        5. 밑으로 조금 스크롤한 뒤, 파란색 버튼을 클릭해 다운로드를 진행해 주세요.

            ![Screen Shot 2022-09-20 at 12.01.03 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0bc321ce-513c-4200-baa8-251d187fbdbc/Screen_Shot_2022-09-20_at_12.01.03_PM.png)

            Intel 칩을 사용하는 맥북은 왼쪽을 Apple 칩을 사용하는 맥북은 오른쪽을 선택해 주세요.

            <aside>
            💡 **내 mac 이 어떤 프로세서를 사용하는지 알고 싶다면**

            좌측 상단 `Apple 로고` 클릭 → `이 Mac에 관하여`를 클릭하여 프로세서가 Intel 칩인지 Apple 칩인지 확인할 수 있습니다.

            - Intel chip

                ![processor.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2e9a82a1-aed3-4ccf-9f4f-d7db45b782a0/processor.png)

            - Apple chip

                ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/01d99ad9-718d-4a10-8e52-9e0ea731ec38/Untitled.png)

            </aside>

            우선 `다운로드` 폴더에 저장하고, 다운로드가 끝나면 파일을 옮기겠습니다. 저장 버튼을 눌러주세요

            ![Screen Shot 2022-09-20 at 12.31.23 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3cb97280-feb8-4658-bbc3-ac556a116674/Screen_Shot_2022-09-20_at_12.31.23_PM.png)

        6. 바탕화면에서 휴지통 우측에 있는 `다운로드` 폴더를 선택한 뒤 방금 다운로드한 flutter zip 파일을 우리가 만들어준 `development` 폴더로 드래그 앤 드롭합니다.

            ![Screen Shot 2022-09-20 at 12.42.27 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4539ac39-e0fb-47e9-b57a-3e23d9b06b83/Screen_Shot_2022-09-20_at_12.42.27_PM.png)

            아래와 같이 zip 파일이 해당 폴더로 이동했는지 확인합니다.

            ![Screen Shot 2022-09-20 at 12.42.40 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/db5d3cc0-d64e-49ee-9bc9-155c9d96d6ed/Screen_Shot_2022-09-20_at_12.42.40_PM.png)

        7. 다운받은 flutter 압축 파일을 실행해 주세요.

            ![Screen Shot 2022-09-20 at 12.45.08 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d4cc81c9-dfba-4829-bc01-b6286fb98a0d/Screen_Shot_2022-09-20_at_12.45.08_PM.png)

        8. 아래 사진과 같이 압축이 해제되고 `flutter`라는 폴더가 생성 됩니다.

            <aside>
            💡 만약 압축이 해제된 폴더 이름이 아래 사진과 다른 경우 `flutter`로 변경해 주시기 바랍니다.

            </aside>

            ![Screen Shot 2022-09-20 at 12.45.20 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/67baef48-1295-479d-96e8-096fd893ff70/Screen_Shot_2022-09-20_at_12.45.20_PM.png)

        9. `flutter` → `bin` 폴더에 들어가볼까요? 
        `dart`, `dart.bat`, `flutter`, `flutter.bat` 등의 파일이 있는 것을 볼 수 있습니다. 이들이 flutter 실행 파일입니다.

            ![Screen Shot 2022-09-20 at 12.58.43 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c93cea50-d1db-4fdc-bf47-268ba856efeb/Screen_Shot_2022-09-20_at_12.58.43_PM.png)


        <aside>
        💡 우리는 이 flutter 실행 파일을 **컴퓨터 어디에서도 모두 접근 가능하게끔**, 즉 어디에서도 `flutter` 라는 명령어를 사용할 수 있게끔 해야 합니다.

        환경 변수에 flutter 가 위치한 **폴더 경로를 추가**하면, 시스템의 모든 경로에서 이 flutter 파일에 접근하고, 실행할 수 있습니다.

        </aside>

    - 2) 환경변수 설정 및 설치
        1. 바탕화면에서 `사과 아이콘` → `이 Mac에 관하여`를 클릭하여 macOS 버전을 확인해 주세요.

            ![os version.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/311d4d76-7e17-4987-beee-a4690d4db783/os_version.png)

        2. macOS 버전을 확인한 뒤, 해당하는 명령어를 복사해 주세요.

            <aside>
            💡 mac OS 버전 순서

            ![Untitled.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f864e554-d9b0-4eb3-8c3e-70f0f952ace6/Untitled.png)

            **macOS Mojave** 이하 버전을 사용하는 경우 **설정하는 파일이 다릅**니다.

            </aside>

            - macOS 카타리나(Catalina) `**이상**`버전 명령어 (최신 버전은 여기에요!)

                ```bash
                echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.zshrc && source ~/.zshrc
                ```

            - macOS 모하비(Mojave) **`이하`** 버전 명령어

                ```bash
                echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.bash_profile && source ~/.bash_profile
                ```


            <aside>
            💡 어떤 명령어인지 궁금하신 분들은 아래 설명을 참고해 주세요.

            1. `~/development/flutter/bin` 폴더에 있는 flutter 파일을 어디서든 실행할 수 있도록 등록(환경변수에 등록)

                (~ 는 유저명과 같은 이름의 Home 폴더를 의미합니다)

                > macOS 모하비 버전에서는 `.bash_profile`이라는 파일에 등록하고 이후 버전에선 `.zshrc` 파일에 등록하기 때문에 명령어가 다릅니다.
                > 

                ```bash
                echo 'export PATH="$PATH:$HOME/Developments/flutter/bin"' >> ~/.zshrc
                ```

            2. 설정 반영

                ```bash
                source ~/.zsh
                ```

            </aside>

        3. 터미널에 단축키 `Cmd + v` 또는 마우스 우클릭하여 `붙여넣기`를 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8a6e79fa-b9a7-4591-8701-d31a13c59735/Untitled.png)

            아래와 같이 붙여넣으면 아래와 같이 나오고, 엔터(enter)를 눌러 실행해 주세요.

            ![Screen Shot 2022-09-20 at 2.17.02 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9324f3b5-9935-4f32-9cd0-7620d8caac47/Screen_Shot_2022-09-20_at_2.17.02_PM.png)

        4. 다음 명령어는 flutter의 버전을 확인하는 명령어입니다. 아래 명령어를 복사해 주세요.

            ```bash
            flutter --version
            ```

            터미널에 붙여넣고 실행해 주세요.

            ![Screen Shot 2022-09-20 at 2.19.36 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bf87e55f-450b-41b2-a62f-da725622a58f/Screen_Shot_2022-09-20_at_2.19.36_PM.png)

        - [잠깐] 혹시 다음 팝업이 뜨면 `설치` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5e62eddb-6ee7-4664-a88b-51476ae199c2/Untitled.png)

            1. 사용권 계약 팝업이 뜨면 `동의` 버튼을 눌러주세요.

                ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d8f0617d-4b21-45ec-b5e2-ba1aea1b67f8/Untitled.png)

            2. 아래와 같이 설치가 완료되면 `완료` 버튼을 눌러주세요.

                ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/122d8290-ec39-4221-b23b-b25a0bfc93ef/Untitled.png)

    - 3) 설치 확인
        1. 터미널 창에 Flutter 버전을 확인하는 아래 명령어를 붙여넣고 실행해 주세요.

            ```bash
            flutter --version
            ```

            실행하면 `Building flutter tool...` 이라고 출력되고 잠시 후 아래와 같이 Flutter 버전이 출력되면 Flutter 설치 완료!

            ![Screen Shot 2022-09-20 at 2.19.15 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/97a87ad4-67c9-4a28-ab0c-6428707eb0de/Screen_Shot_2022-09-20_at_2.19.15_PM.png)

            <aside>
            💡 위 이미지에선 Flutter 3.3.2 버전이 출력되는데 시간이 지나면 최신 버전으로 업데이트 되어 버전이 다를 수 있습니다. 전혀 문제 없으니 그대로 진행해주세요.

            </aside>

        2. 다음 명령어를 복사해 터미널에 붙여넣고 실행해 주세요.

            <aside>
            💡 Flutter 개발하는데 필요한 항목들의 상태를 확인하는 명령어 입니다.

            </aside>

            ```bash
            flutter doctor
            ```

            ![_flutter doctor.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2cae54a1-1763-4e82-880f-37c3f0cfccdb/_flutter_doctor.png)

            <aside>
            💡 Android 앱을 만드는데 필요

            - Android Studio
            - Android SDK

            iOS 앱을 만드는데 필요

            - Xcode
            - CocoaPods
            </aside>

            위 프로그램들을 하나씩 설치해 보도록 하겠습니다. 


**[에디터 설치하기]**

- 2. Visual Studio Code

    <aside>
    💡 Visual Studio Code (줄여서 VSCode) 는 앞으로 실제 코드를 작성할 편집 툴입니다.

    Flutter 개발은 Android Studio와 VSCode 둘 중 원하는 툴을 사용하여 진행할 수 있습니다. VSCode가 더 가볍기 때문에 앞으로 수업은 VSCode를 활용해 진행하도록 하겠습니다.

    </aside>

    - 1) VSCode 설치
        1. [링크](https://code.visualstudio.com/download)에 접속해 주세요.
        2. 애플 아이콘 하단에 있는 Mac 버튼을 클릭해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/732ff958-a930-4446-9b3a-2eae43005ef4/Untitled.png)

        3. `다운로드` 폴더에 저장해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fc103a3e-b9a5-400a-bcb2-fffcbbb63e28/Untitled.png)

        4. 바탕화면에 다운로드 폴더를 클릭한 뒤 `Finder에서 열기` 버튼을 클릭해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e0efbc3d-75c5-4299-b0ad-94bbcfbfd511/Untitled.png)

        5. 다운받은 `VSCode-darwin-universal.zip` 파일을 실행해 압축을 풀어주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/292fa7d8-ecb7-426b-913e-78e335908468/Untitled.png)

        6. 압축이 풀리고 생성된 `Visual Studio Code` 파일을 드래그해서 왼쪽 `응용 프로그램`에 떨어뜨려 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d6388951-bc4a-4d04-8937-2a0783830a6a/Untitled.png)

        7. 화면 우측 상단 `돋보기 🔍` 아이콘을 클릭한 뒤 `visual` 이라고 검색해 주세요. 그리고 하단에 `Visual Studio Code`가 보이면 엔터를 눌러 실행해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/72e585cc-a9b0-4a46-932d-c725469e69cd/Untitled.png)

        8. 아래와 같은 팝업이 뜨면 `열기` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1b1713a2-0f9a-4bbb-848b-38f76eef5292/Untitled.png)

        9. 그러면 아래와 같이 VSCode가 실행되면 설치 완료!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/64675e1d-55d2-41b9-8a4e-027d93b08eda/Untitled.png)

            <aside>
            💡 우측 하단에 한국어로 변경하라는 팝업이 뜹니다.
            하지만 VSCode 사용법이나 대부분의 개발 자료는 영어로 되어 있기 때문에, 가급적 적용하지 않기를 권장 드립니다. (수업 자료도 영어 버전으로 되어있어요!)

            해당 알람을 다시 보지 않으려면 `우측 톱니바퀴 ⚙` 아이콘을 누른 뒤 `Don't Show Again`을 선택해 주세요. (만약 사라져서 버튼을 누르지 못했다면 다음번에 눌러주세요!)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1bbcc25a-bac1-412e-a0ee-a8302ce700e2/Untitled.png)

            </aside>

    - 2) Extension 설치

        <aside>
        💡 VSCode는 Flutter 뿐만 아니라 다양한 개발을 모두 할 수 있는 통합 에디터입니다. VSCode에서 Flutter 앱 개발을 하려면 VSCode에 Extension 탭에서 아래 목록의 Extension 들을 설치해야 합니다.

        **Flutter** : VSCode에서 Flutter 개발 환경 지원
        **Dart** : Flutter 개발 시 사용되는 Dart 개발 환경 지원

        </aside>

        1. 좌측에 extension 아이콘(동그라미)을 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5fea993b-6a6f-4d4f-9354-fa2a33248122/Untitled.png)

        2. `flutter` 라고 검색한 뒤, 해당 익스텐션을 선택하고 `install` 버튼을 눌러 설치해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3c51b36d-aa33-4ad7-abde-6a334e7bb2cb/Untitled.png)

        3. 위 `flutter` 익스텐션을 설치하면서 `dart` 익스텐션도 일반적으로 함께 설치가 됩니다.

            `dart` 라고 검색하신 뒤 혹시 설치가 안되었다면 해당 익스텐션도 같이 설치해주세요. `uninstall`이라고 뜨신다면 이미 설치가 된 것이니 넘어가시면 됩니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c1ea5cf2-200a-451f-83e9-330a5d4c533e/Untitled.png)


**[IDE 설치하기]** ** IDE : 소프트웨어 애플리케이션*

<aside>
💡 **MacOS 에서는 안드로이드 환경, iOS 환경 모두에서 코드를 돌려볼 수 있습니다!**

아래의 상황에 따라 원하는 원하시는 애뮬레이터를 골라 설치해보세요! ㅎㅎ

**애뮬레이터 : 컴퓨터에서 가상으로 스마트폰 OS를 돌리는 프로그램*

1. **안드로이드와 ios 모두 확인하고 싶은 경우**

    → Android Studio 와 Xcode 모두 설치합니다.

2. **안드로이드만 확인하고 싶은 경우**

    → Android Studio만 설치합니다.

3. **ios만 확인하고 싶은 경우**

    → Xcode만 설치합니다.


**[잠깐!] Xcode 는 용량을 크게 차지하니 주의해주세요! :)**

- 용량이 부족하다면 Android Studio 만 설치하셔도 괜찮습니다. 
이러면 iOS Simulator 는 사용할 수 없지만, 개발에는 큰 지장이 없습니다! ㅎㅎ
</aside>

- 3. Android Studio
    - 1) Android Studio 설치
        1. [링크](https://developer.android.com/studio)에 접속한 뒤, `Download Android Studio` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a9598ce0-fa0e-4c98-acc0-3222c2a34adb/Untitled.png)

        2. 약관이 뜨면 아래로 쭉 스크롤 해주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/95e19502-1158-45c4-9d84-9afdf2df50c7/Untitled.png)

        3. Intel 칩을 사용하는 맥북은 왼쪽 `Mac with Intel chip`을 Apple 칩을 사용하는 맥북은 오른쪽 `Mac with Apple chip`을 선택해 주세요.

            ![Screen Shot 2022-09-20 at 2.29.56 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/39c5a846-f4a1-4a38-b5c4-7ce788a51996/Screen_Shot_2022-09-20_at_2.29.56_PM.png)

            <aside>
            💡 좌측 상단 `Apple 로고` 클릭 → `이 Mac에 관하여`를 클릭하여 Intel 칩인지 Apple 칩인지 확인할 수 있습니다.

            - Intel chip

                ![processor.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2e9a82a1-aed3-4ccf-9f4f-d7db45b782a0/processor.png)

            - Apple chip

                ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/01d99ad9-718d-4a10-8e52-9e0ea731ec38/Untitled.png)

            </aside>

        4. 다운로드 팝업이 뜨면 `저장` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3c495cdb-daa3-4529-a9c0-66c42c002404/Untitled.png)

        5. 바탕화면 하단에 휴지통 좌측에 있는 `다운로드` 폴더를 클릭한 뒤 `Finder`에서 열기 버튼을 클릭해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b129d044-3975-4ff7-ad8b-2dc69078b22f/Untitled.png)

        6. 다운로드가 완료된 `android-studio~~.dmg` 파일을 실행해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/021331d6-475a-4ddf-ae6a-c53aa3078490/Untitled.png)

        7. 아래와 같은 창이 뜨면 왼쪽에 `Android Studio`를 드래그해서 `Applications`에 떨어뜨려주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c72763c1-1eec-4770-a954-bfebbeb7ada1/Untitled.png)

        8. 설치가 완료되면 좌측 상단에 빨간 X를 눌러서 아래 화면을 종료해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c4a1637d-6518-4aa8-b93e-e2cd52e064cd/Untitled.png)

            <aside>
            💡 바탕화면에 아래 사진과 같은 파일이 생겼다면 휴지통으로 드래그해 삭제하셔도 됩니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dfa41421-9575-429e-af13-3d999315cf89/Untitled.png)

            </aside>

        9. 우측 상단에 `돋보기🔍` 아이콘을 클릭하고, 팝업창이 뜨면 `android`라고 입력해 주세요. 그리고 아래와 같이 `Android Studio`가 자동완성으로 뜨면 엔터를 눌러 실행해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a6bad6de-8aa9-4896-a9d8-5372870f604e/Untitled.png)

        10. 아래와 같이 팝업이 뜨면 `열기` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/328ff0d3-085c-4bfb-ad59-f82c67659e6d/Untitled.png)

        11. 아래와 같은 창이 뜬다면 `OK` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fd9a712e-8000-48fd-9764-9bdec2a8aa7f/Untitled.png)

        12. `Import Android Studio Settings` 팝업이 뜨면 `Do not import settings`를 선택하신 뒤 `OK` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/00c3d439-86fd-4334-b944-4b93b2633ea0/Untitled.png)

        13. 안드로이드 스튜디오 사용 데이터를 구글에 전달하여 사용성 개선에 참여하고 싶다면 `Send usage statistics to Google`을 선택해주시고, 그렇지 않은 경우 `Don't send`를 선택해 주세요.

            ![Screen Shot 2022-09-20 at 2.35.27 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/7910e8fc-9433-4cfb-a277-0b2c2dbed8e0/Screen_Shot_2022-09-20_at_2.35.27_PM.png)

        14. 다음과 같은 안드로이드 스튜디오 설정 화면이 나오면 `Next` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/748967d6-689f-4aaf-af7c-f8c7da147582/Untitled.png)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/90290328-7729-429e-bd5f-1b6fd2b48311/Untitled.png)

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/43a8a218-0bc9-4ddb-a5d4-658650c7cbb9/Untitled.png)

        15. `Finish` 버튼을 눌러 Android SDK 설치를 진행해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f8728adf-ae30-4237-aac8-da26ed3af750/Untitled.png)

        16. **License Agreement** 화면이 나온다면 왼쪽 밑줄 친 부분을 클릭해 모두 `Accept` 를 눌러주세요

            ![Screenshot 2022-09-20 040605.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c88f04d6-c9be-4227-a04d-864194411d00/Screenshot_2022-09-20_040605.png)

        17. `Accept` 를 모두 누르고 나면 `Finish` 버튼이 활성화됩니다. 눌러주세요.

            ![Screenshot 2022-09-20 041010.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/99167e06-dc28-4302-8b1a-4e7728c397eb/Screenshot_2022-09-20_041010.png)

        18. 설치가 완료되면 `Finish` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/caef348a-0104-4904-81ac-1f3d62a6e53a/Untitled.png)

        19. 아래와 같은 화면이 뜨면 Android Studio 설치 완료!

            ![Screen Shot 2022-09-20 at 2.43.20 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2c9e3e9a-a781-482d-91a5-92deb90993d8/Screen_Shot_2022-09-20_at_2.43.20_PM.png)

    - 2) Android Command-line Tools 설치

        <aside>
        💡 `Android Command-line Tools`는 Flutter에서 Android에 명령을 내리기 위해 필요합니다.

        </aside>

        1. Android Studio에서 `More Actions`를 선택한 뒤 `SDK Manager`를 선택해 주세요.

            ![Screen Shot 2022-09-20 at 2.43.43 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/765f159a-d30c-452b-82db-56925a758f31/Screen_Shot_2022-09-20_at_2.43.43_PM.png)

        2. 그러면 아래와 같이 `Preferences for New Projects` 팝업이 뜨면 `SDK Tools` 탭을 선택 → `Android SDK Command-line Tools (latest)` 선택 → `Apply` 를 선택해 주세요.

            ![Screen Shot 2022-09-20 at 2.44.40 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/86cdd3d2-0c6d-4bf0-9044-3b1640723ad3/Screen_Shot_2022-09-20_at_2.44.40_PM.png)

        3. 팝업이 뜨면 `OK` 버튼을 클릭해 주세요.

            ![Screen Shot 2022-09-20 at 2.45.33 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5b5466b0-3eda-4a24-b326-5e8f361b0aac/Screen_Shot_2022-09-20_at_2.45.33_PM.png)

        4. 설치가 완료되면 `Finish` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/179110f8-4fef-49e6-a781-8672450baef3/Untitled.png)

    - 3) Android Virtual Devices 설치

        <aside>
        💡 앱을 개발시 실제 휴대폰을 연결하여 개발을 진행할 때도 있지만, 대부분의 경우 Virtual Device(컴퓨터에 가상의 휴대폰을 띄우는 소프트웨어)를 이용하여 개발합니다.

        </aside>

        1. `More Actions` → `Virtual Device Manager` (또는 `AVD Manager`)를 선택해 주세요.

            ![Screen Shot 2022-09-20 at 2.46.47 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e72abe9e-f703-405d-ada1-08eafbdb80e1/Screen_Shot_2022-09-20_at_2.46.47_PM.png)

        2. 이미 Device 가 있는 분들은 아래 절차를 진행하지 않으셔도 됩니다.

            ![Screen Shot 2022-09-20 at 2.51.09 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8d5b8d36-7e78-4ef2-911d-d5a5dc7ef4a4/Screen_Shot_2022-09-20_at_2.51.09_PM.png)

        3. (Device 가 없는 경우) `Create Virtual Device...`를 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/35588fa8-02ce-4a17-82b2-e4ebd4cc1924/Untitled.png)

        4. 하드웨어를 선택하는 화면이 나오면 `Next`를 눌러서 기본으로 설정된 `Pixel 2` 휴대폰을 설치하도록 하겠습니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fe1e55c6-ea12-4d75-b619-e41587b9e51b/Untitled.png)

        5. 휴대폰에 설치할 Android OS를 선택하는 화면입니다. `Q` 옆에 있는 `Download` 버튼을 클릭하여 OS를 다운로드해 주세요.

            <aside>
            💡 R 버전은 Virtual Device에서 문제가 있다고 해요. 그래서 **Q 버전**으로 진행할게요!

            </aside>

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4ca338ba-a53c-448a-84fa-be1735599608/Untitled.png)

        6. 설치가 완료되면 `Finish` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/58629f13-a9e6-4ddd-ac93-acc9441fbfab/Untitled.png)

        7. `Q` 옆에 `Download` 버튼이 사라졌습니다. 우측에 현재 선택된 OS 버전이 29인지 확인한 뒤 `Next` 버튼을 눌러주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6d8fade8-aa03-46b7-b417-c55b3b7b2342/Untitled.png)

        8. `Finish` 버튼을 눌러 Virtual Device 설치를 완료해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/23afd0e5-79c6-426e-9ee3-690f6998ba43/Untitled.png)

        9. 아래와 같이 `Pixel 2 API 29` 라는 Virtual Device가 추가되었습니다.

            이제 좌측 상단에 빨간 버튼을 눌러 창을 종료해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/1134aa4e-c890-4437-9820-264c40413b8a/Untitled.png)

        10. 하단에 Android Studio 아이콘을 우클릭한 뒤 `종료` 버튼을 눌러를 Android Studio를 종료해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0ffcab44-bef5-43d2-b10a-7d0c1d1b1a86/Untitled.png)

            <aside>
            💡 Android Studio를 클릭한 상태에서 단축키(`Cmd + Q`)를 누르셔도 됩니다.

            </aside>

    - 4) Android Licenses
        1. 터미널에서 `flutter doctor`라고 입력한 뒤 엔터를 누릅니다.
        아래와 같이 `Android toolchain`의 좌측에  `[!]` 표시가 되어있습니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cfa0d817-282d-4edd-b7e6-0178ad077990/Untitled.png)

        2. 문제를 해결하기 위해 `flutter doctor --android-licenses`를 복사해서 터미널에 붙여 넣고 실행해 주세요. 실행시 라이센스에 대한 동의를 여러번 구하는데, `y`를 입력하고 엔터를 눌러 진행해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d0492492-b2e0-4205-8875-71fd7c3bc5ce/Untitled.png)

        3. 모든 동의가 완료되면 `All SDK package licenses accepted` 라고 뜹니다.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ef18b6df-8d01-40f7-9657-8b7cfbda449e/Untitled.png)

        4. 마지막으로 터미널에 `flutter doctor` 를 입력했을 때 아래와 같이 `Android toolchain`, `Android Studio` 가 체크 완료되면 완료!

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bfb47eed-12cb-418d-86f0-9044be87cfba/Untitled.png)

- 4. Xcode

    <aside>
    💡 iOS 앱을 개발하는데 필요한 Xcode를 설치해 보도록 하겠습니다.

    </aside>

    1. [링크](https://apps.apple.com/us/app/xcode/id497799835)를 클릭해 열어주세요.
    2. 아래와 같은 팝업이 띄면 `App Store 열기` 버튼을 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dd013e1b-8bc8-415c-8826-7daf6173016b/Untitled.png)

    3. `App Store`가 실행되고 `Xcode`가 아래와 같이 뜨면 `받기` 버튼을 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/63f8b6d9-4a9d-4c7d-918c-c50d2bf3299c/Untitled.png)

    4. `설치` 버튼으로 변하면 한 번 더 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/12804375-a9da-4223-9e13-730cfc461d7c/Untitled.png)

    5. 만약 App Store에 Apple ID로 로그인이 되어있지 않아 아래와 같이 창이 뜨는 경우, 로그인을 진행해 주세요.

        <aside>
        💡 계정이 없다면 `Apple ID 생성`을 눌러 가입을 진행해주신 뒤, 로그인을 진행해 주세요.

        </aside>

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/001c2d44-028a-4b49-962a-86773edc12c1/Untitled.png)

    6. 로그인을 완료하면 설치가 진행 됩니다.

        <aside>
        💡 Xcode 설치 시간은 인터넷 상황에 따라 다르지만 보통 1시간 30분 ~ 2시간 정도 소요 됩니다. 😂

        </aside>

    7. 설치가 완료되면 `열기` 버튼을 눌러주세요!

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/adcee5ed-0d4a-4782-8879-c9945d7d9e49/Untitled.png)

    8. 라이센스 동의 팝업이 뜨면 `Agree`를 선택해 주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2338d57a-712a-482b-a577-27921cb7f9f1/Untitled.png)

    9. 아래와 같이 암호를 입력하는 창이 뜨면 컴퓨터 시작 비밀번호를 입력한 뒤 `확인` 버튼을 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f3cf1771-5843-48fb-96e5-f6d1b30877bd/Untitled.png)

    10. 만약 Xcode가 실행이 안되면, 다시 `열기` 버튼을 눌러주세요.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/adcee5ed-0d4a-4782-8879-c9945d7d9e49/Untitled.png)


    12. 아래와 같은 창이 뜨면 Xcode 설치완료!

    ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c7c37404-84c3-4289-8133-7ead2d049c85/Untitled.png)

    1. 설치를 완료했으니`AppStore`와 `Xcode`를 종료해 주세요.
        - 하단에 App Store를 우클릭하여 `종료`를 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3e4b2242-4ea0-404d-9da3-4ad29444212e/Untitled.png)

        - 하단에 Xcode를 우클릭하여 `종료`를 선택해 주세요.

            ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ac0c0aeb-75bf-420a-8b63-591333ea792b/Untitled.png)

    2. 이제 Homebrew 를 설치하도록 하겠습니다.

        <aside>
        💡 Homebrew 는 맥에서 소프트웨어를 설치 삭제할 수 있는 패키지 관리자입니다.
        아래에서 brew install 명령어를 쓰기 위해 미리 설치해줍니다.

        </aside>

        아래 명령어를 복사해 터미널에 붙여넣고 엔터를 눌러주세요.

        ```bash
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
        ```

        ![Screen Shot 2022-09-20 at 3.11.02 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a3828ed3-a3e0-4880-aa76-d312f986ecd1/Screen_Shot_2022-09-20_at_3.11.02_PM.png)

    3. 다음으로 CocoaPods을 설치해 보도록 하겠습니다.

        <aside>
        💡 CocoaPods은 다른 사람이 만든 코드를 가져올 때 필요한 프로그램으로 Xcode와 함께 iOS 앱 개발시 필요합니다.

        </aside>

        아래 명령어를 복사해 터미널에서 붙여넣고 엔터를 눌러주세요.

        ```bash
        brew install cocoapods
        sudo gem install cocoapods
        ```

    4. 아래와 같이 비밀번호를 입력하는 창이 나오면, 컴퓨터 시작시 입력하는 비밀번호를 입력한 뒤 엔터를 눌러주세요.

        <aside>
        💡 참고로 키보드를 눌러도 화면에 입력되는 모습은 보이지 않으니, 입력한 뒤 엔터를 누르면 됩니다.

        비밀번호를 틀린 경우, `Ctrl + C`를 누르면 명령이 종료되고, 다시 명령어를 붙여넣고 실행해주세요.

        </aside>

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e74269ff-349a-4ae5-addf-2b5d3344dd54/Untitled.png)

    5. 명령이 정상적으로 실행되면 아래와 같이 뜹니다.

        ![Screen Shot 2022-09-20 at 3.12.24 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/06f113d2-7915-4d06-ba45-5a2f9c3b521c/Screen_Shot_2022-09-20_at_3.12.24_PM.png)

    6. 아래 명령어를 복사해 터미널에서 실행해 주세요.

        ```bash
        flutter doctor
        ```

        그러면 아래와 같이 `Xcode` 설치가 완료된 것을 보실 수 있습니다.

        ![Screen Shot 2022-09-20 at 3.13.31 PM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dbcf4554-1f37-4303-a74e-f828f447b5ef/Screen_Shot_2022-09-20_at_3.13.31_PM.png)


**설치를 완료하셨나요~? 잘 설치되었는지 확인해봅시다! ㅎㅎ**

- 최종 설치 확인

    터미널에서 `flutter doctor`라고 검색한 뒤 아래와 같이 화면이 나온다면 모든 설치가 완료하신 것입니다.

    ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/610c4f60-5d66-4495-baf7-7a4b82fa0d6d/Untitled.png)

    <aside>
    💡 다운로드 폴더에 있는 파일들은 모두 삭제하셔도 됩니다.

    </aside>

    <aside>
    💡 고생하셨습니다! 원래 개발 환경을 설정하는데 시간이 많이 들어갑니다 😂
    그럼 1주 차 수업 때 뵙도록 하겠습니다 🙂

    </aside>

03. Flutter 이해하기

  • 1) 레고 같이 조립할 수 있는 위젯(Widget)

    출처 : [pixabay](https://pixabay.com/vectors/lego-toys-blocks-puzzle-6390233/)

    출처 : pixabay

  • 2) Android Material & iOS Cupertino

    코드스니펫을 복사해서 새 탭에서 열면 Flutter에서 위젯을 소개하는 공식 문서가 보입니다.

![Widget Catalog.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d3775be8-a1eb-49e0-b5a1-84e49f827086/Widget_Catalog.png)

<aside>
💡 **머터리얼 위젯(Material Widget)**은 **Android**에서 사용되는 기본 화면 구성 요소를 Flutter에서 재현한 위젯입니다.

**쿠퍼티노 위젯(Cupertino Widget)**은 **iOS**에서 사용되는 화면 구성 요소를 Flutter에서 재현한 위젯입니다.

Flutter는 특정 플랫폼에 종속되지 않은 고유의 디자인을 입힌 **커스텀 위젯(Custom Widget)**도 쉽게 만들 수 있습니다.

</aside>

<aside>
💡 **Material**, **Cupertino** 그리고 **Custom 위젯** 중 어떤 방법을 사용하든 **사용성만 해치지 않는다면** 앱을 출시하실 수 있습니다.

</aside>

<aside>
💡 Flutter에서 위젯이 어떻게 사용되는지 로그인 페이지를 만들며 배워봅시다.

</aside>

05. 프로젝트 준비

  • 1) Flutter 프로젝트 생성하기

    1. 바탕화면에 flutter 폴더를 만들어주세요.

      (이 때, 플러터 프로젝트 경로에 한글이 오지 않도록 주의해주세요!)

      Screen Shot 2022-08-28 at 7.40.46 PM.png

    2. Visual Studio Code(VSCode)를 실행해 주세요.

      Untitled

    3. ViewCommand Palette 버튼을 클릭해주세요.

      Untitled

    4. 명령어를 검색하는 팝업창이 뜨면, flutter라고 입력한 뒤 Flutter: New Project를 선택해주세요.

      Untitled

    5. Application을 선택해주세요.

      Untitled

    6. 프로젝트를 시작할 폴더를 선택하는 과정입니다. 미리 생성해 둔 flutter 폴더를 선택한 뒤 Select a folder to create the project in 버튼을 눌러 주세요.

      Untitled

    7. 프로젝트 이름을 hello_flutter로 입력해주세요.

      Untitled

      macOS의 경우 아래와 같은 팝업이 뜨면 확인 버튼을 눌러주세요.

      Untitled

      중간에 아래와 같은 팝업이 뜬다면, 체크박스를 선택한 뒤 파란 버튼을 클릭해주세요.

      Untitled

    8. 다음과 같이 프로젝트가 생성됩니다.

      Untitled

      왼쪽 폴더 구조를 살짝 보고 가도록 하겠습니다.

      Directory.png

      lib : 주로 코딩하는 폴더

      pubspec.yaml : 라이브러리 및 설정을 하는 폴더


      android : Android 프로젝트 폴더

      ios : iOS 프로젝트 폴더

      web : Web 프로젝트 폴더

    9. 아래 main.dart 코드스니펫을 복사해서 기존 코드를 모두 지운 뒤, main.dart 파일에 붙여 넣고 저장해주세요.

      • [코드스니펫] main.dart

          import 'package:flutter/material.dart';
        
          void main() {
            runApp(MyApp());
          }
        
          class MyApp extends StatelessWidget {
            const MyApp({Key? key}) : super(key: key);
        
            @override
            Widget build(BuildContext context) {
              return MaterialApp(
                debugShowCheckedModeBanner: false,
                home: Scaffold(
                  appBar: AppBar(),
                ),
              );
            }
          }
    10. 다음으로 학습 단계에서 불필요한 내용을 화면에 표시하지 않도록 설정해 주겠습니다.

      analysis_options.yaml 파일을 열고, 아래 코드스니펫을 복사해서 24번째 라인 뒤(rules 뒤)에 붙여 넣고 저장해 주세요. (들여쓰기를 꼭 맞춰주세요)

      • [코드스니펫] analysis_options.yaml

        
              prefer_const_constructors: false
              prefer_const_literals_to_create_immutables: false
    ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8470956b-ccc2-4d75-86d8-83042bafaf22/Untitled.png)

    <aside>
    💡 상세 내용은 아래를 참고해 주세요.

    - 어떤 의미인지 궁금하신 분들을 위해

        `main.dart` 파일을 열어보시면 파란 실선이 있습니다.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d1393a08-a362-4be3-bd9b-835e184f5ef3/Untitled.png)

        파란 줄은, 개선할 여지가 있는 부분을 VSCode가 알려주는 표시입니다.

        12번째 라인에 마우스를 올리면 아래와 같이 설명이 보입니다.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/7fd5cee4-d935-4d2d-9c35-e11d4f3c6cae/Untitled.png)

        위젯이 변경될 일이 없기 때문에 `const`라는 키워드를 앞에 붙여 상수(변하지 않는 수)로 선언하라는 힌트입니다. 화면을 새로고침 할 때(화면 내 값이 변할 때마다 화면은 새로고침 됩니다) 상수로 선언된 위젯들은 새로고침을 할 필요가 없어서 성능상 이점이 있습니다.

        아래와 같이 `Icon`앞에 `const` 키워드를 붙여주시면 됩니다.

        ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2aef9ee8-c4ef-4c42-bd08-d358c4620341/Untitled.png)

        지금은 학습 단계이니 눈에 띄지 않도록 `analysis_options.yaml` 파일에 아래와 같이 설정하여 힌트를 숨기도록 하겠습니다.

        ```dart
            prefer_const_constructors: false
            prefer_const_literals_to_create_immutables: false
        ```

    </aside>
  • 2) VSCode Dart 세팅

    1. ViewCommand Palette를 선택해 주세요.

      Untitled

    2. 아래와 같이 dart recommend라고 검색한 뒤 Dart: Use Recommended Settings를 선택해 주세요. 그러면 저장 시 자동 줄 정렬 기능과 같이 편의 기능 설정이 적용됩니다.

      Untitled

  • 3) Emulator 실행하기

    1. ViewCommand Palatte를 선택해주세요.

      Untitled

    2. launch를 입력한 뒤 Flutter: Launch Emulator를 선택해 주세요.

      Untitled

    3. android 에뮬레이터를 선택해주세요.

      Untitled

      macOS의 경우, Start iOS Simulator를 선택하실 수도 있습니다.

      Untitled

      macOS의 경우 아래와 같은 팝업이 뜬다면 확인 버튼을 눌러주세요.

      Untitled

    4. 잠시 기다리시면, 에뮬레이터가 실행 됩니다. 아래와 같이 완전히 부팅이 끝날 때 까지 기다려주세요!

      emulator.png

      Untitled

  • 4) 실행하기

    1. VSCode 우측 상단에 버튼을 누르고 Run Without Debugging 버튼을 클릭해주세요.

      Untitled

    2. 첫 번째 실행은 시간이 다소 소요되니 잠시만 기다려주세요!

      드디어 첫 번째 앱 화면을 띄웠습니다! 축하드립니다👏👏

      Untitled

      console.png

      • 다시 켜는 방법이 궁금하다면?

        1. VS Code 의 좌측 아래 설정 버튼을 누르고, Settings 를 눌러주세요

          Screen Shot 2022-08-28 at 9.22.58 PM.png

        2. 검색창에 widget inspect 라고 검색하시고, Dart: Open Dev Tools 옵션을 never 에서 flutter 로 변경해주세요.

          Screen Shot 2022-08-28 at 9.24.45 PM.png

        3. 그러면 앱을 실행할 때 아래와 같이 오른쪽에 Widget Inspector 탭이 열립니다.

          Screen Shot 2022-08-29 at 4.03.00 AM.png

  • 05. 로그인 페이지 만들기

    • 최종 완성 이미지

      Screen Shot 2022-08-29 at 6.28.42 AM.png

    • 1) Scaffold & Text

      lib 폴더 밑에 있는 main.dart 파일에서 코딩을 해보도록 하겠습니다.

      Group 90.png

      14번째 줄을 보면 home이라고 되어있습니다. 이곳에 첫 화면에 보여줄 위젯을 넣어주는데, 여기에 Scaffold라는 위젯이 사용되고 있습니다.

      출처 - [https://pixabay.com/photos/construction-work-framework-670278/](https://pixabay.com/photos/construction-work-framework-670278/)

      출처 - https://pixabay.com/photos/construction-work-framework-670278/

      15번째 줄에 Scaffold의 appBar 영역에 AppBar() 위젯이 들어가 에뮬레이터에 상단 영역을 차지하고 있습니다.

      Untitled

      1. Scaffold에 body 영역에 Text 위젯을 추가해보겠습니다. 16번째 줄에 body: Text("Hello Flutter"), 라고 입력한 뒤 저장(Ctrl/Cmd + S)하면 에뮬레이터에 Hello Flutter가 나타납니다.

        Untitled

      2. 16번째 줄에 텍스트 크기를 키워보도록 하겠습니다.

        먼저 16번째 줄 “Hello Flutter" 뒤에 콤마(,)를 추가한 뒤 저장(Ctrl/Cmd + S)해 주세요.

        Group 91.png

        그리고 17번째 줄 맨 뒤에서 아래 자동완성 단축키를 눌러주세요.

        Untitled

        그러면 Text 위젯이 가진 속성 목록이 나옵니다. 이 중에서 style을 이용하면 뭔가 꾸밀 수 있을 것 같다는 느낌이 옵니다. style을 선택해 주세요.

        Untitled

        그러면 위와 같이 style 속성이 추가되는데 여기에 무엇을 넣어야하는지 궁금하실 겁니다.

        이런 경우, style 속성에 마우스를 올리면 여기에 넣는 값의 타입을 볼 수 있습니다. 아래 이미지를 보면 style의 경우TextStyle을 받는다고 적혀있습니다.

        Untitled

        TextStyle을 조금만 타이핑해 보면 자동완성으로 아래와 같이 TextStyle을 추천해 줍니다. 아래 이미지에서 첫 번째 항목을 선택하면 TextStyle까지만 완성해주고, 네 번째 항목을 선택하면 TextStyle()까지 완성해 주므로 네 번째 항목을 선택해 줍니다.

        Untitled

        그리고 저장해주면 아래와 같이 18번째 줄에 style: TextStyle(),이 추가 됩니다.

        Untitled

        TextStyle에 어떤 값을 넣을 수 있는지 자동완성 기능으로 보도록 하겠습니다. 18번째 줄 TextStyle의 소괄호 사이에서 자동완성 단축키(Ctrl + Space / Option + Esc)를 눌러주세요.

        Untitled

        위와 같이 추천된 속성 중에 fontSize를 이용하면 텍스트 크기를 변경할 수 있을 것 같습니다. fontSize를 선택해 주세요.

        Untitled

        fontSize에는 숫자를 넣으시면 됩니다(double은 실수를 의미하는 자료형입니다). 28을 입력한 뒤 저장해보면 에뮬레이터에서 폰트 크기가 커진 것을 볼 수 있습니다.

        Untitled

    • 2) Column & TextField

      Text 위젯 밑에 ID를 입력받는 입력창을 추가해 보도록 하겠습니다. 세로 방향으로 위젯들을 나열하려면 Column 위젯을 사용해야합니다.

      1. 16번째 줄에 Text 위젯을 클릭한 뒤, 왼쪽에 있는 전구(💡) 아이콘을 클릭해 주세요.

        Untitled

        그러면 아래와 같이 Text 위젯을 손쉽게 다른 위젯을 감싸거나 추출할 수 있도록 도와주는 리펙터(Refactor) 기능이 나타납니다.

        Untitled

      2. Wrap with Column을 선택하여 Text 위젯을 Column 위젯으로 감싸주겠습니다.

        Untitled

        그러면 Text 위젯이 Column 위젯의 children 속성으로 들어간 것을 볼 수 있습니다.

        Untitled

      3. 21번째 줄 맨 뒤에, TextField(),를 추가해주세요.

        Untitled

        그리고 저장(Ctrl/Cmd + S)해주면 아래와 같이 에뮬레이터에 텍스트 입력란이 생성됩니다.

        Untitled

        • iOS 에뮬레이터에서 가상 키보드 보이도록 설정하는 법

          실제 모바일 환경에서는 가상 키보드가 화면에 나타나는 부분을 고려하여 화면을 만들어야 합니다. 이럴 때 아래와 같은 방법을 이용해주세요.

          iOS 에뮬레이터에서 처음에 텍스트 입력이 안되는 경우, 에뮬레이터를 선택한 뒤 상단에 I/OKeyboardConnect Hardware Keyboard를 선택해 주세요.

          Untitled

          그리고 Hello Flutter 텍스트 밑에 파란 줄을 클릭하고 키보드를 입력하면 입력이 잘 됩니다.

          Untitled

          키보드를 보이게 하고 싶은 경우, 상단에 I/OKeyboardConnect Hardware Keyboard를 다시 선택하여 체크를 해제하면 키보드를 눌러도 입력되지 않고, 에뮬레이터에 나타난 가상 키보드를 입력할 수 있습니다. 키보드를 내리려면 완료 버튼을 눌러주세요.

          Untitled

          mac OS 의 경우 Cmd + K 를 눌러 가상 키보드를 올리고 내릴 수 있습니다

      4. TextField에 이메일을 입력하도록 이름표를 달아 봅시다. 아래 이미지와 같이 TextFielddecoration속성에 InputDecoration()을 넣고, labelText: "이메일",를 추가해주세요.
        (쉼표를 잘 찍어서 코드가 정렬되도록 합니다)

        Untitled

        에뮬레이터 상에 “이메일”이라는 label이 생성 되었습니다.

        Untitled

      5. 22 ~ 26번째 줄에 TextField를 그대로 복사해서 비밀번호 입력란을 만들어 주세요.

        Untitled

        Untitled

        값을 입력해보면 비밀번호가 그대로 보입니다. 입력된 비밀번호를 보이지 않도록 만들어봅시다.

        Untitled

      6. 28번째 줄에 obscureText: true, 라는 속성을 주면 비밀번호가 안보이게 됩니다.
        TextField 위젯이 이미 속성들을 가지고 있기 때문에 우리는 해당 속성에 적절한 값만 넣어주면 됩니다!

        Untitled

    • 3) Button

      로그인 버튼을 만들어 봅시다.

      1. 33번째 줄(Column 내부)에 elev라고 입력하면 자동완성으로 ElevatedButton()이 추천되고, 해당 항목을 선택해 주세요.

        Untitled

        아래와 같이 완성이 되고, 버튼에 필수로 입력해야하는 속성 두 가지가 뜹니다.

        Group 92.png

        33번째 줄 앞쪽 onPressed에 마우스를 올려보면, 필수로 전달하라는 의미인 required가 보이고 전달해야하는 타입은 함수를 의미하는 void Function()이라고 적혀 있습니다.

        Untitled

      2. 아직 문법을 배우지 않았으므로, 아래와 같이 onPressed() {}를 입력하고, child에 Text("로그인"), 이라고 입력해주세요.

        Untitled

        그리고 저장(Ctrl/Cmd + S)를 누르면 아래와 같이 정렬됩니다.

        Untitled

        에뮬레이터 상에 버튼이 추가된 것을 확인할 수 있습니다.

        Untitled

    • 4) AppBar

      15번째 줄에 AppBar() 위젯에 18 ~ 21번째 줄의 Text를 넣어보도록 하겠습니다.

      Untitled

      1. 15번째 줄 AppBar()의 소괄호 사이 title:이라고 입력해 주세요.

        Untitled

      2. 18 ~ 21번째 줄의 Text 위젯을 15번째 줄에 title: 뒤로 이동해 주세요.

        Untitled

        그리고 저장(Ctrl/Cmd + S)을 눌러주시면 앱바에 title 영역으로 Hello Flutter가 이동됩니다.

        Untitled

      3. AppBarcenterTitle: true, 라고 넣어 두 플랫폼에서 모두 중앙 정렬이 되도록 만들어줍시다.

        Untitled

        이제 Android에서도 중앙 정렬이 됩니다.

        Untitled

    • 5) Padding

      에뮬레이터 상에서 보면 TextField가 기기 외곽에 너무 붙어 있는 것 같아 여백을 추가해 보도록 하겠습니다.

      Untitled

      Scaffoldbody 속성에 위젯들은 아래와 같이 배치되어 있습니다.

      Untitled

      Column 위젯을 Padding이라는 위젯으로 감싸면 여백을 추가할 수 있습니다.

      Untitled

      1. 22번째 줄에 Column 위젯을 클릭한 뒤, 왼쪽 전구(💡) 아이콘을 선택해 주세요. 그리고 Wrap with Padding을 선택해 주세요.

        Untitled

      2. Column 위젯을 Padding 위젯으로 감싸졌고, 어느정도 여백을 줄지 설정하는 23번 째 줄에 padding 속성이 추가되었습니다.

        Untitled

      3. 23번 째 줄에 8.0을 16으로 변경한 뒤 저장해보면 에뮬레이터에 내부에 여백이 추가된 것을 볼 수 있습니다.

        Untitled

    • 6) Container

      로그인 버튼을 화면 가로로 가득 채우도록 키워보겠습니다.

      Untitled

      1. ElevatedButton 자체에는 width 속성이 없고, 부모 위젯에 크기를 이용해 조절 할 수 있습니다.

        37번째 줄에 ElevatedButton을 클릭한 뒤 왼쪽 전구(💡) 아이콘을 클릭하고 Wrap with Container를 선택해 주세요.

        Untitled

        그러면 아래와 같이 Container 위젯이 ElevatedButton 위젯을 감싸게 됩니다.

        Untitled

      2. 다음 Container 위젯에 width: double.infinity,라고 추가해주세요. 그러면 Container의 폭이 부모를 가득 채우게 되고, 버튼도 함께 최대 크기로 늘어납니다.

        Untitled

      3. 비밀번호를 입력하는 TextField와 로그인 버튼 사이에 여백을 추가해 보도록 하겠습니다.

        아래 이미지와 같이 Container에 margin: EdgeInsets.only(top: 24),라고 추가해 주세요.

        Untitled

    • 7) Image & SingleChildScrollView

      이메일 입력란 상단에 이미지를 넣어보겠습니다.

      1. 26번째 줄에 아래와 같이 Image.network 위젯을 추가해주세요.

         Image.network("https://i.ibb.co/nngK6j3/startup.png"),

        Screen Shot 2022-08-29 at 4.54.23 AM.png

        이미지에 크기를 지정하지 않았으므로, 원본 사진의 크기로 들어가게 되고, 이 상태에서 이메일 입력란을 클릭하여 가상 키보드를 올려보면 아래와 같이 하단 화면이 짤린다고 에뮬레이터에 표시됩니다.

        Screen Shot 2022-08-29 at 4.55.48 AM.png

      2. 키보드가 올라와 화면이 가려지는 경우, 스크롤을 할 수 있도록 만들어봅시다. 22번째 줄에 Padding 위젯을 클릭한 뒤 왼쪽에 전구(💡) 아이콘을 선택해 주세요. Wrap with widget...을 선택해 Padding 위젯을 다른 위젯으로 감싸주겠습니다.

        Screen Shot 2022-08-29 at 4.59.11 AM.png

        아래와 같이 Padding 위젯이 widget이라는 익명의 위젯으로 감싸집니다.

        Screen Shot 2022-08-29 at 5.00.13 AM.png

      3. 22번째 줄에 widgetSingleChildScrollView로 변경한 뒤 저장해 주세요.

        Screen Shot 2022-08-29 at 5.00.35 AM.png

        이제 에뮬레이터에서 화면을 이메일을 클릭해도 화면이 넘치지 않고, 스크롤을 할 수 있습니다.

        Screen Shot 2022-08-29 at 5.01.14 AM.png

      4. 이미지를 적절한 크기로 조절해보도록 하겠습니다. width: 81,Image.network 위젯에 추가해 주세요.

        Screen Shot 2022-08-29 at 5.02.30 AM.png

      5. 이미지를 Padding으로 감싸 다른 위젯과 간격을 추가해 보겠습니다. 27번째 줄의 Image를 선택한 뒤 오른쪽 전구(💡) 아이콘을 누르고 Wrap with Padding을 선택해 주세요.

        Screen Shot 2022-08-29 at 5.04.59 AM.png

        아래와 같이 Padding 위젯으로 Image.network 위젯이 감싸집니다.

        Screen Shot 2022-08-29 at 5.06.16 AM.png

        28번째 줄에 EdgeInsets8.032로 변경한 뒤 저장해주면 완성!

        Screen Shot 2022-08-29 at 5.06.45 AM.png

    • 최종 완성 코드

        import 'package:flutter/material.dart';
      
        void main() {
          runApp(MyApp());
        }
      
        class MyApp extends StatelessWidget {
          const MyApp({Key? key}) : super(key: key);
      
          @override
          Widget build(BuildContext context) {
            return MaterialApp(
              debugShowCheckedModeBanner: false,
              home: Scaffold(
                appBar: AppBar(
                  centerTitle: true,
                  title: Text(
                    "Hello Flutter",
                    style: TextStyle(fontSize: 28),
                  ),
                ),
                body: SingleChildScrollView(
                  child: Padding(
                    padding: const EdgeInsets.all(16),
                    child: Column(
                      children: [
                        Padding(
                          padding: const EdgeInsets.all(32),
                          child: Image.network(
                            "https://i.ibb.co/nngK6j3/startup.png",
                            width: 81,
                          ),
                        ),
                        TextField(
                          decoration: InputDecoration(
                            labelText: '이메일',
                          ),
                        ),
                        TextField(
                          obscureText: true,
                          decoration: InputDecoration(
                            labelText: '비밀번호',
                          ),
                        ),
                        Container(
                          width: double.infinity,
                          margin: EdgeInsets.only(top: 24),
                          child: ElevatedButton(
                            onPressed: () {},
                            child: Text("로그인"),
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            );
          }
        }

    06. Flutter 공부 방법

    • Flutter 위젯(Widget) 살펴보기

  • 에러 메시지 잘 읽고 구글링 잘하기

    Screen Shot 2022-08-29 at 5.31.19 AM.png

  • 커뮤니티 가입하기

    1. 질문하기 전에 스스로 Google에 검색해서 해결하려고 노력해보기!
      (검색 키워드 자체를 모른다면 빠르게 물어보기)
    2. 문제 발생시 에러 로그도 함께 올리기!
      Flutter는 에러 발생시 Debug Console에 에러 메세지를 보여줍니다. 먼저 에러 메세지를 먼저 구글에 검색해보고, 해결이 잘 안된다면 에러 로그와 함께 질문해주세요.
      (에러 메세지가 없으면 다른 개발자들이 도와주기가 힘들어요!)
  • 프로그래밍 언어 다트(Dart) 배우기

  • 07. Dart 문법

    • DartPad

        ```dart
        void main() {
          for (int i = 0; i < 5; i++) {
            print('hello ${i + 1}');
          }
        }
        ```
    
    - 실행 순서
    
        <aside>
        💡 `main`은 Dart에서 처음 시작 시 호출하는 약속된 ****함수입니다. 
        앞의 void 자리는 함수가 반환하는 값의 자료형을 표시하는 것입니다. 비워둬도 괜찮습니다.
    
        </aside>
    
        ```dart
        void main() {}
    
        main2 () {}
    
        String main3 () {
            return "Hello";
        }
        ```
    
        ![Screen Shot 2022-08-29 at 5.45.09 AM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/da41bae5-2351-4cea-9f8b-654647bc7de5/Screen_Shot_2022-08-29_at_5.45.09_AM.png)
    
    - `//` : 주석으로 컴퓨터가 읽지 않습니다. 주로 개발하면서 메모할 때 사용합니다.
    - `print()` : print의 소괄호 안쪽에 값을 넣으면 오른쪽 `Console`에 값이 출력 됩니다. 정상적으로 잘 작동하는지 확인(디버깅) 할 때 사용합니다.
    - `;` : Dart에서는 마지막에 세미콜론(semicolon)을 찍어줍니다.
    - 에러 로그 읽는 법
    
        <aside>
        💡 아래 이미지를 보면 3번 째 줄에 마지막 세미콜론이 빠졌습니다. 이 상태로 `Run`을 하게되면 우측에 에러 메세지가 나옵니다.
    
        3:27 (3번째 줄 27번째 칸)에 에러가 발생했군요!
    
        **에러 메세지를 보면 문제가 발생하는 위치와 해결 방법을 알 수 있습니다!** 앞으로 에러가 발생한다면 에러 메세지 부터 확인해 주세요 🙂
    
        </aside>
    
        ![Screen Shot 2022-08-29 at 5.46.28 AM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4575b348-6506-4f62-b826-4de805032f07/Screen_Shot_2022-08-29_at_5.46.28_AM.png)
    
    
    <aside>
    💡 DartPad에서 `Reset` 버튼을 누르면, 변경한 내용이 초기화 됩니다.
    
    ![Screen Shot 2022-08-29 at 5.48.19 AM.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/96a5d3ae-eaa8-4847-b75b-e1c11d0ac9af/Screen_Shot_2022-08-29_at_5.48.19_AM.png)
    
    </aside>
    • 1) 변수

      1. 변수 만들기

        Untitled

        1) 자료형 (= 바구니에 담을 수 있는 값의 종류)

        var : 처음 담긴 값으로 타입이 지정됩니다.

        String : 문자만 담을 수 있습니다.

        String? : 문자 또는 비어있는(null) 상태일 수 있습니다.

        const: 처음에 변수를 선언하며 담은 값을 변경할 수 없습니다.

        final : 선언하고 나중에 값을 담을 수 있으나, 한 번 담으면 변경할 수 없습니다.

         void main() {
           var a = 1;
           String b = "hello world";
           String? c = null;
           const d = 1;
           final e;
           e = 2;
             print(a);
         }

        2) 변수명 (= 바구니 이름)

    • 2) 조건문

        if (bool1) {
            // bool1이 **true**면 실행
        } else {
            // bool1이 **false**면 실행
        }
        if (bool1) {
            // bool1이 **true**면 실행
        } else if (bool2) {
            // bool1이 **false**이고, bool2가 **true**이면 실행
        } else if (bool3) {
            // bool1과 bool2가 **false**이고, bool3가 **true**이면 실행
        } else {
            // bool1, bool2, bool3가 모두 **false**이면 실행
        }
    • 3) 반복문

      _for.png

      • 반복문 구성

        1 : int i = 0i라는 변수가 0으로 시작합니다. (한 번만 실행됩니다)

        2 : i < 5i의 값이 5보다 작은지 조건을 확인합니다. (false → 반복문 종료 / true → 3번)

        3 : 중괄호 안쪽 영역 → 반복해 실행하는 코드들이 들어있습니다.

        4 : i++i값을 1만큼 증가 시키고 2번으로 흐름이 다시 넘어갑니다.

    • 4) 함수(function)

        1. 함수의 호출 & 실행 순서

          아래 코드 스니펫을 복사해서 DartPad에서 실행해보세요!

          • [코드스니펫] Dart 함수

             void main() {
               print("1. 시작");
            
               say();
            
               print("4. 종료!");
             }
            
             void say() {
               print("2. 안녕");
               print("3. Hello");
             }
          • 함수의 생김새

            Untitled

            • say라고 적혀있는 부분이 함수의 이름입니다.
            • 중괄호({ }) 안쪽 영역이 함수가 가진 실행 코드들 입니다.
          • 함수 호출 방법

            Untitled

            Untitled

        1. 함수의 표현 방법

    • 5) 클래스(Class)

        1. 클래스 생김새

          class 클래스이름 {
          
          }
        1. 클래스의 구성 요소

          class Bread {
             // 생성자 함수 (클래스명과 똑같음. 클래스의 객체가 생성될 때 호출되는 함수)
             Bread(String core) {
                 content = core; // 전달 받은 core를 content에 넣어줍니다.
             }
          
             // Bread 클래스가 가진 content 속성 (클래스 내의 변수)
             String? content;
          
             // Bread 클래스가 가진 getDescription 메소드 (클래스 내의 함수)
             String getDescription() {
             return "맛있는 $content빵입니다."; // 맛있는 팥빵입니다.
           }
          }
        1. 인스턴스(Instance)

        1. 상속(extends)

          Untitled

        1. Dart의 모든 것은 Class

          _docs.png

    08. 숙제 - Movie Reviews 만들기

    • 최종 완성 모습
    [Simulator Screen Recording - iPhone 13 - 2022-08-29 at 06.19.22.mp4](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a674a8d1-f48c-4b42-86fd-58d07abbf343/Simulator_Screen_Recording_-_iPhone_13_-_2022-08-29_at_06.19.22.mp4)
    
    ## 사용한 위젯
    
    Scaffold
    
    AppBar
    
    Text
    
    IconButton
    
    Column
    
    Padding
    
    TextField
    
    Icon
    
    Divider
    
    Expanded
    
    ListView.builder
    
    Card
    
    Stack
    
    Image.network
    
    Container
    
    Text
    • 1) 실습 준비

      • 1) Flutter 프로젝트 생성하기

        1. ViewCommand Palette 버튼을 클릭해주세요.

          Untitled

        2. 명령어를 검색하는 팝업창이 뜨면, flutter라고 입력한 뒤 Flutter: New Project를 선택해주세요.

          Untitled

        3. Application을 선택해주세요.

          Untitled

        4. 프로젝트를 시작할 폴더를 선택하는 과정입니다. 미리 생성해 둔 flutter 폴더를 선택한 뒤 Select a folder to create the project in 버튼을 눌러 주세요.

        5. 프로젝트 이름을 movie_reviews 로 입력해주세요.

          Screen Shot 2022-06-20 at 5.17.14 AM.png

        6. 프로젝트가 생성되면 아래 main.dart 코드스니펫을 복사해서 기존 코드를 모두 지운 뒤, main.dart 파일에 붙여 넣고 저장해주세요.

          • [코드스니펫] main.dart

              import 'package:flutter/material.dart';
            
              void main() {
                runApp(MyApp());
              }
            
              class MyApp extends StatelessWidget {
                const MyApp({Key? key}) : super(key: key);
            
                @override
                Widget build(BuildContext context) {
                  return MaterialApp(
                    debugShowCheckedModeBanner: false,
                    home: HomePage(), // 홈페이지 보여주기
                  );
                }
              }
            
              class HomePage extends StatelessWidget {
                const HomePage({Key? key}) : super(key: key);
            
                @override
                Widget build(BuildContext context) {
                  // 음식 사진 데이터
                  List<Map<String, dynamic>> dataList = [
                    {
                      "category": "탑건: 매버릭",
                      "imgUrl": "https://i.ibb.co/sR32PN3/topgun.jpg",
                    },
                    {
                      "category": "마녀2",
                      "imgUrl": "https://i.ibb.co/CKMrv91/The-Witch.jpg",
                    },
                    {
                      "category": "범죄도시2",
                      "imgUrl": "https://i.ibb.co/2czdVdm/The-Outlaws.jpg",
                    },
                    {
                      "category": "헤어질 결심",
                      "imgUrl": "https://i.ibb.co/gM394CV/Decision-to-Leave.jpg",
                    },
                    {
                      "category": "브로커",
                      "imgUrl": "https://i.ibb.co/MSy1XNB/broker.jpg",
                    },
                    {
                      "category": "문폴",
                      "imgUrl": "https://i.ibb.co/4JYHHtc/Moonfall.jpg",
                    },
                  ];
            
                  // 화면에 보이는 영역
                  return Scaffold();
                }
              }
        7. 다음으로 학습 단계에서 불필요한 내용을 화면에 표시하지 않도록 설정해 주겠습니다.

          analysis_options.yaml 파일을 열고, 아래 코드스니펫을 복사해서 24번째 라인 뒤에 붙여 넣고 저장해 주세요.

          • [코드스니펫] analysis_options.yaml

            
                  prefer_const_constructors: false
                  prefer_const_literals_to_create_immutables: false
      • 2) 에뮬레이터 실행하기

        1. VSCode 우측 하단에 Chrome (web-javascript)를 클릭해주세요.

          Untitled

        2. Start Pixel 2 API 29 mobile emulator를 선택해주세요.

          Untitled

          잠시 기다리면 에뮬레이터가 실행됩니다.

          Untitled

        3. VSCode 우측 상단에 아래 화살표를 눌러 Run Without Debugging을 눌러주세요.

          Untitled

          에뮬레이터에 아래와 같이 흰 화면이 나오면 정상적으로 실행이 완료된 것입니다!

          Untitled

    • 2) AppBar 만들기

    ![simulator_screenshot_429E6845-74A6-4FFB-9C5B-31AC91DCAA3E.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ed279ba5-e234-405a-a87c-16dca9a0de65/simulator_screenshot_429E6845-74A6-4FFB-9C5B-31AC91DCAA3E.png)
    
    ## 사용한 위젯
    
    Scaffold
    
    AppBar
    
    IconButton
    
    Text
    
    Icon
    • 3) Body 만들기
    ![simulator_screenshot_52382C76-EC68-46A1-8F79-EF5D14DD85BE.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/eb77a00c-232a-483d-83ff-b377c084364b/simulator_screenshot_52382C76-EC68-46A1-8F79-EF5D14DD85BE.png)
    
    ## 사용한 위젯
    
    Column
    
    Padding
    
    TextField
    
    Icon
    
    Divider
    
    Expanded
    
    ListView.builder
    
    Card
    
    Stack
    
    Image.network
    
    Container
    
    Text

    • 숙제 답안 (main.dart)

        import 'package:flutter/material.dart';
      
        void main() {
          runApp(MyApp());
        }
      
        class MyApp extends StatelessWidget {
          const MyApp({Key? key}) : super(key: key);
      
          @override
          Widget build(BuildContext context) {
            return MaterialApp(
              debugShowCheckedModeBanner: false,
              home: HomePage(), // 홈페이지 보여주기
            );
          }
        }
      
        class HomePage extends StatelessWidget {
          const HomePage({Key? key}) : super(key: key);
      
          @override
          Widget build(BuildContext context) {
            // 영화 제목, 사진 데이터
            List<Map<String, dynamic>> dataList = [
              {
                "category": "탑건: 매버릭",
                "imgUrl": "https://i.ibb.co/sR32PN3/topgun.jpg",
              },
              {
                "category": "마녀2",
                "imgUrl": "https://i.ibb.co/CKMrv91/The-Witch.jpg",
              },
              {
                "category": "범죄도시2",
                "imgUrl": "https://i.ibb.co/2czdVdm/The-Outlaws.jpg",
              },
              {
                "category": "헤어질 결심",
                "imgUrl": "https://i.ibb.co/gM394CV/Decision-to-Leave.jpg",
              },
              {
                "category": "브로커",
                "imgUrl": "https://i.ibb.co/MSy1XNB/broker.jpg",
              },
              {
                "category": "문폴",
                "imgUrl": "https://i.ibb.co/4JYHHtc/Moonfall.jpg",
              },
            ];
      
            // 화면에 보이는 영역
            return Scaffold(
              appBar: AppBar(
                elevation: 0,
                backgroundColor: Colors.white,
                centerTitle: false,
                iconTheme: IconThemeData(color: Colors.black),
                title: Text(
                  "Movie Reviews",
                  style: TextStyle(
                    color: Colors.black,
                    fontSize: 28,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                actions: [
                  IconButton(
                    onPressed: () {},
                    icon: Icon(Icons.person_outline),
                  )
                ],
              ),
              body: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: TextField(
                      decoration: InputDecoration(
                        hintText: "영화 제목을 검색해주세요.",
                        border: OutlineInputBorder(
                          borderSide: BorderSide(color: Colors.black),
                        ),
                        suffixIcon: IconButton(
                          icon: Icon(Icons.search),
                          onPressed: () {},
                        ),
                      ),
                    ),
                  ),
                  Divider(height: 1),
                  Expanded(
                    child: ListView.builder(
                      itemCount: dataList.length,
                      itemBuilder: (context, index) {
                        String category = dataList[index]['category'];
                        String imgUrl = dataList[index]['imgUrl'];
      
                        return Card(
                          child: Stack(
                            alignment: Alignment.center,
                            children: [
                              Image.network(
                                imgUrl,
                                width: double.infinity,
                                height: 200,
                                fit: BoxFit.cover,
                              ),
                              Container(
                                width: double.infinity,
                                height: 200,
                                color: Colors.black.withOpacity(0.5),
                              ),
                              Text(
                                category,
                                style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 36,
                                ),
                              ),
                            ],
                          ),
                        );
                      },
                    ),
                  ),
                ],
              ),
            );
          }
        }

    전체 목록 바로가기

    [스파르타코딩클럽] 앱개발 종합반

    다음 강의 바로가기

    2주차 - 다양한 위젯을 활용해 화면 그리기


    Copyright ⓒ TeamSparta All rights reserved.

    + Recent posts