Guest User

Untitled

a guest
Jun 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. class CounterState extends State<Counter> {
  2. int counter = 0;
  3.  
  4. void increment() {
  5. // Tells the Flutter framework that state has changed,
  6. // so the framework can run build() and update the display.
  7. setState(() {
  8. counter++;
  9. });
  10. }
  11.  
  12. Widget build(BuildContext context) {
  13. // This method is rerun every time setState is called.
  14. // The Flutter framework has been optimized to make rerunning
  15. // build methods fast, so that you can just rebuild anything that
  16. // needs updating rather than having to individually change
  17. // instances of widgets.
  18. return new Row(
  19. children: <Widget>[
  20. new RaisedButton(
  21. onPressed: increment,
  22. child: new Text('Increment'),
  23. ),
  24. new Text('Count: $counter'),
  25. ],
  26. );
  27. }
  28. }
Add Comment
Please, Sign In to add comment