Instantly share code, notes, and snippets.

@MarcinusX MarcinusX/main.dart Secret
Created Jan 13, 2019

Embed
What would you like to do?
class _MainPageState extends State<MainPage> with SingleTickerProviderStateMixin {
int points = 0; //<-- add points field
...
@override
Widget build(BuildContext context) {
return Material(
child: Stack(
fit: StackFit.passthrough,
children: <Widget>[
Image.asset(...),
Row(...),
_drawPoints(), //<-- add points widget on top of stack
],
),
);
}
void _onTap(Note note) {
setState(() {
note.state = NoteState.tapped;
++points; //<-- increase number of points
});
}
_drawPoints() { //<-- draw points
return Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.only(top: 32.0),
child: Text(
"$points",
style: TextStyle(color: Colors.red, fontSize: 60),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment