Skip to content

Instantly share code, notes, and snippets.

@miyoyo
Created November 27, 2018 13:36
Show Gist options
  • Save miyoyo/41f08fef5b9548a07dc1cf4d35abc149 to your computer and use it in GitHub Desktop.
Save miyoyo/41f08fef5b9548a07dc1cf4d35abc149 to your computer and use it in GitHub Desktop.
class MyWidget extends StatefulWidget {
@override
LoginState createState() {
return MyState();
}
}
class MyState extends State<Login> {
int value = 0;
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text('Flutter + Dartea = ❤'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'$value',
style: Theme.of(context).textTheme.display1,
),
Padding(
child: RaisedButton.icon(
label: Text('Increment'),
icon: Icon(Icons.add),
onPressed: () => setState(() => value++),
),
padding: EdgeInsets.all(5.0),
),
RaisedButton.icon(
label: Text('Decrement'),
icon: Icon(Icons.remove),
onPressed: () => setState(() => value--),
),
],
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment