반응형
■ 정보
1. 변경 없는 위젯(statelessWidget) vs 변경 있는 위젯(staefuleWidget)
2. 플러터는 모든것이 위젯( 텍스트, 버튼, 화면구성 등 모든 컴포넌트 및 레이아웃이 위젯임!! )
3. 배경위젯위에 다양한 위젯들을 겹겹히 쌓아올려서 만드는 방식
4. 머터리얼앱 - 구글머터리얼 디자인을 사용하기 위해서 사용
5. 스캐폴드 - 구글 머터리얼 디자인의 구조를 잡아줌
import 'package:flutter/material.dart';
void main() => runApp(MyApp()); //MAIN 실행
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page2'), //MyHomePage 실행
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
final String title;
@override
_MyHomePageState createState() => _MyHomePageState(); //_MyHomePageState 실행
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
위 소스코드의 뼈대
※ 정리 잘되어있는 블로그
1. 기초
https://software-creator.tistory.com/10
Flutter Layout - 첫 플러터 앱 만들어보기
Flutter Layout - 첫 플러터 앱 만들어보기 Flutter Layout - 첫 플러터 앱 만들어보기 - UI 만들어보기 플러터란? 위젯이란? 기본 위젯 사용해보기 변경 없는 위젯(statelessWidget) vs 변경 있는 위젯(staefuleW..
software-creator.tistory.com
2. API 콜
플러터(Flutter) 앱 만들기 : 블로그 글 상세
이번에는 플러터와 JSONPlaceholder 중 블로그 포스트 상세 API를 이용해 한개 아이템을 HTTP 클라이언트로 요청하고 화면에 그리는 방법을 알아봅니다.
medium.com
반응형
'IT' 카테고리의 다른 글
[도커/Docker] Docker란 무엇인가? (5) | 2020.02.13 |
---|---|
[Pivotal][MSA] 마이크로서비스로의 여정 정리 (2) | 2020.02.08 |
댓글