반응형
■ 정보
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
2. API 콜
반응형
'IT' 카테고리의 다른 글
[도커/Docker] Docker란 무엇인가? (5) | 2020.02.13 |
---|---|
[Pivotal][MSA] 마이크로서비스로의 여정 정리 (2) | 2020.02.08 |
댓글