๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Develop Study ๐Ÿ’ป

flutter ์‹œ์ž‘ํ•˜๊ธฐ

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