Skip to content

Instantly share code, notes, and snippets.

@yjbanov
Created May 10, 2024 17:01
Show Gist options
  • Save yjbanov/57965b689d86d9bd62906e1ee31693ac to your computer and use it in GitHub Desktop.
Save yjbanov/57965b689d86d9bd62906e1ee31693ac to your computer and use it in GitHub Desktop.
@widget Counter {
final int initialValue;
@state {
int count = initialValue;
String buttonLabel = 'Increment';
}
Widget build(context) {
return Column(children: [
Text('$greeting, ${state.count}!'),
GestureDetector(
onTap: () {
state.count++;
},
child: Text(state.buttonLabel),
),
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment