-
-
Save MarcinusX/cfb13d134086998ada7df85a48d7983a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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