Calculate score

This commit is contained in:
Tony Bark 2021-06-01 08:59:19 -04:00
parent 1b66d28f95
commit 4ac0e61ab7
4 changed files with 13 additions and 11 deletions

View file

@ -1,8 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Flutter
on:

View file

@ -1,3 +1,3 @@
# BullsEye
# Bullseye
A game written in Flutter, based on a tutorial with my own tweaks added.
A game written in Flutter based on a tutorial, with my own tweaks added.

View file

@ -116,6 +116,13 @@ class _GamePageState extends State<GamePage> {
);
}
int _pointsForCurrentRound() {
var maxScore = 100;
var difference = (_model.target - _model.current).abs();
return maxScore - difference;
}
void _showAlert(BuildContext context) {
var okButton = PlatformTextButton(
child: PlatformText("Awesome!"),
@ -130,7 +137,8 @@ class _GamePageState extends State<GamePage> {
builder: (BuildContext context) {
return PlatformAlertDialog(
title: PlatformText("Hello There."),
content: PlatformText("The slider's value is ${_model.current}"),
content: PlatformText("The slider's value is ${_model.current}\n" +
"You scored ${_pointsForCurrentRound()} points this round."),
actions: <Widget>[okButton],
);
});

View file

@ -1,5 +1,5 @@
name: bullseye
description: A new Flutter project.
description: A game written in Flutter based on a tutorial, with my own tweaks added.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
@ -46,8 +46,7 @@ flutter:
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# - images/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see