ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 요즘 주변에 플루터 빌런(?) 이 있습니다.
    잡담 2018. 12. 7. 15:50

    구글에서 C#을 어떻게 개량해서 다트를 만들어서 플루터라는 걸 만들었다는데..


    이게 곧 뜰거라고 익혀야한다는 빌런(?)이 계십니다.


    혹해서 한번 샘프루 코드를 확인.



    class CounterState extends State<Counter> {
      int counter = 0;
    
      void increment() {
        // Tells the Flutter framework that state has changed,
        // so the framework can run build() and update the display.
        setState(() {
          counter++;
        });
      }
    
      Widget build(BuildContext context) {
        // This method is rerun every time setState is called.
        // The Flutter framework has been optimized to make rerunning
        // build methods fast, so that you can just rebuild anything that
        // needs updating rather than having to individually change
        // instances of widgets.
        return Row(
          children: <Widget>[
            RaisedButton(
              onPressed: increment,
              child: Text('Increment'),
            ),
            Text('Count: $counter'),
          ],
        );
      }
    }


    리액트-리덕스식 구조를 java에 녹여놓은듯한 구조.


    널 세이프티는 지원하지 않는다는데 그건 매우 마음에 걸립니다.


    널 세이프티 못 잃어..


    class SampleApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Sample App',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: SampleAppPage(),
        );
      }
    }
    
    class SampleAppPage extends StatefulWidget {
      SampleAppPage({Key key}) : super(key: key);
    
      @override
      _SampleAppPageState createState() => _SampleAppPageState();
    }
    
    class _SampleAppPageState extends State<SampleAppPage> {
      // Default placeholder text
      String textToShow = "I Like Flutter";
      void _updateText() {
        setState(() {
          // update the text
          textToShow = "Flutter is Awesome!";
        });
      }
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("Sample App"),
          ),
          body: Center(child: Text(textToShow)),
          floatingActionButton: FloatingActionButton(
            onPressed: _updateText,
            tooltip: 'Update Text',
            child: Icon(Icons.update),
          ),
        );
      }
    }


    '잡담' 카테고리의 다른 글

    코드잼 예선 응시  (0) 2020.04.10
    삼성고시에 파이선 도입  (1) 2018.12.08
    [펌] 스타트업에서 원하는 개발자상  (0) 2018.12.07
    오늘의 뻘짓  (0) 2018.12.06
    원티드펌 - 개발자가 면접때 질문하면 좋은 것  (0) 2018.12.05
Designed by Tistory.