Skip to content

Instantly share code, notes, and snippets.

@kn0ch3n
Created June 22, 2018 17:32
Show Gist options
  • Save kn0ch3n/f0ae81adde270b33d46b5d38b7ddcb9b to your computer and use it in GitHub Desktop.
Save kn0ch3n/f0ae81adde270b33d46b5d38b7ddcb9b to your computer and use it in GitHub Desktop.

Revisions

  1. kn0ch3n created this gist Jun 22, 2018.
    28 changes: 28 additions & 0 deletions flutter_example.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    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 new Row(
    children: <Widget>[
    new RaisedButton(
    onPressed: increment,
    child: new Text('Increment'),
    ),
    new Text('Count: $counter'),
    ],
    );
    }
    }