[Flutter] Hello world!

Sunki-Kim·2023년 12월 10일
0

flutter

목록 보기
1/1

flutter로 모든 개발의 튜토리얼 헬로 월드를 구현해보았다.

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
   // build method override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Material 스타일 UI
      home: Scaffold( // home으로 메인 화면 정의
        appBar: AppBar(
          title: Text("hello flutter!"),
        ),
        body: Center(
          child: Text("hello world!"),
        ),
      ),
    );
  }
}

첫 위젯으로 선언된 app이 구현이 된다.

Material app은 구글이 지향하는 Material Design 요소에 맞춰 개발을 진행 할 수 있도록, 도와주며 라우팅이나 테마에 따라 공통 코드를 분리 시켜준다.

이에 따라오는 부분이 Scaffold인데, 사전적의미로 조립식 발판으로 html 코드에서 흔히 보이던 <body></body> 같은 개념으로 보면 될 것 같다.

profile
당신에게 가치있는 Developer가 되고자

0개의 댓글