Develop Study ๐ป
flutter ์์ํ๊ธฐ
๋น๊ฐ๋ฉ
2019. 8. 21. 22:32
728x90
์ฌ๋ผ์ด๋ ์์น์ ๋ฐ๋ผ ์๋๋ก์ด๋ ์์ด์ฝ์ด ๋์๊ฐ๋ ์ฑ์ ๋ง๋ค์ด๋ด
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
import 'package:flutter/material.dart';
void main(){
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
Widget build(BuildContext context){
return new MaterialApp(
title: "Flutter Demo",
theme: new ThemeData(
primarySwatch: Colors.blue, //์ฑ ํ๋ง ์ง์
),
home: MyHomePage(title: 'MyHomePage'),
//home: MyHomePage(title: '๋จ์น๋น ์งฑ์งฑ'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key : key);
final String title;
_MyHomePageState createState() {
return new _MyHomePageState(); //StatefulWidget์ด๊ธฐ ๋๋ฌธ์ ๊ตฌํ์ด ํ์
}
}
class _MyHomePageState extends State<MyHomePage> {
var _position = 0.0; //๋ด๋ถ ๋ณ์ position ์ถ๊ฐ
Widget build(BuildContext context){
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Slider(
value: _position, //์ด๊ธฐ๊ฐ์ position์ผ๋ก
onChanged: (var position){
//setState๋ก position update ํด์ผํจ
setState(() {
_position = position;
});
}
),
new Transform.rotate(
angle: _position * 2 * 3.14,
child: new Icon(Icons.android),
),
new Transform.rotate(
angle: _position * -2 * 3.14,
child: new Icon(Icons.android),
)
],
)
),
);
}
}
|
cs |
728x90