Skip to content

Commit

Permalink
#46 - Overview after game
Browse files Browse the repository at this point in the history
  • Loading branch information
astrutz committed Apr 8, 2021
1 parent ea3f4b3 commit 0bc9291
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/components/GameList/GameButton.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:dartsdrill/models/Game.dart';
import 'package:dartsdrill/screens/GameMode.dart';
import 'package:dartsdrill/screens/GameStart.dart';
import 'package:flutter/material.dart';

class GameButton extends StatelessWidget {
Expand All @@ -20,7 +20,7 @@ class GameButton extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return GameMode(_game);
return GameStartScreen(_game, null);
}),
);
},
Expand Down
8 changes: 7 additions & 1 deletion lib/models/Game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import 'Answer.dart';
import 'ThrowSet.dart';

class Game {
final String _name;
late final String _name;
late final String _description;
late final String _metaText;
// ignore: unused_field
late var _nextTarget;
late String _question;
late String _additionalText;
Expand All @@ -19,9 +22,12 @@ class Game {
String getNextTargetText() => '';
String getAlternativeText() => '';
String getLastTargetText() => '';
String getStatStringTMP() => '';

String get name => _name;
dynamic get nextTarget => _nextTarget;
String get description => _description;
String get metaText => _metaText;
String get question => _question;
String get additionalText => _additionalText;
List<Answer> get answers => _answers;
Expand Down
9 changes: 9 additions & 0 deletions lib/models/games/AroundTheWorldGame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import '../Game.dart';

class AroundTheWorldGame implements Game {
final String _name = 'Around the World';
final String _description = 'todo';
final String _metaText = 'Level: Anfänger\nFokus: Sccoring\nDauer: 10 Minuten';
Field _nextTarget = Fields().getByName('S1');
String _question = 'Wie viele Felder wurden getroffen?';
String _additionalText = '';
Expand Down Expand Up @@ -138,7 +140,14 @@ class AroundTheWorldGame implements Game {
return _nextTarget.description;
}

@override
String getStatStringTMP() {
return 'Dauer: tbd\n\nGetroffene Finishes: tbd\n\nHöchstes Finish: 85\n\nNiedrigstes Finish: 53';
}

String get name => _name;
String get description => _description;
String get metaText => _metaText;
dynamic get nextTarget => _nextTarget;
String get question => _question;
String get additionalText => _additionalText;
Expand Down
10 changes: 10 additions & 0 deletions lib/models/games/Survive61.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import '../Game.dart';

class Survive61 implements Game {
final String _name = 'Survive 61';
final String _description =
'Bei Survive 61 gilt es ein Finish mit drei Darts zu checken. Checkt man nicht, sinkt der Score um 1 und man versucht das nächste Finish. Checkt man, erhöht man um 10. Man beginnt mit 61. Wird 61 gecheckt, muss als nächstes 71 gecheckt werden. Checkt man 61 nicht, geht man auf 60.';
final String _metaText = 'Level: Fortgeschritten\nFokus: Doubles, Finishing\nDauer: 5 Minuten - unbegrenzt';
Finish _nextTarget = Finishes().getByValue(61);
String _question = 'Wurde das Finish getroffen?';
String _additionalText = '';
Expand Down Expand Up @@ -103,7 +106,14 @@ class Survive61 implements Game {
return '${_nextTarget.value}';
}

@override
String getStatStringTMP() {
return 'Dauer: tbd\n\nGetroffene Finishes: tbd\n\nHöchstes Finish: 85\n\nNiedrigstes Finish: 53';
}

String get name => _name;
String get description => _description;
String get metaText => _metaText;
dynamic get nextTarget => _nextTarget;
String get question => _question;
String get additionalText => _additionalText;
Expand Down
56 changes: 56 additions & 0 deletions lib/screens/GameSummary.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:dartsdrill/models/Game.dart';
import 'package:flutter/material.dart';

class GameSummaryScreen extends StatelessWidget {
final Game game;
GameSummaryScreen(this.game);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Trainingsspiel absolviert'),
brightness: Brightness.dark,
automaticallyImplyLeading: false,
),
body: Column(
children: <Widget>[
Expanded(
child: ListView(
padding: const EdgeInsets.all(10),
children: <Widget>[
Container(
child: Text(
game.name,
style: Theme.of(context).textTheme.subtitle1,
),
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
),
Container(
child: Text(
game.getStatStringTMP(),
style: Theme.of(context).textTheme.bodyText2,
),
margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
),
],
),
flex: 1,
),
Expanded(
child: Text('tbd Stats'),
flex: 1,
),
Container(
child: ElevatedButton(
child: Text(
'Abschließen',
),
onPressed: () => Navigator.pop(context),
),
margin: EdgeInsets.fromLTRB(0, 0, 10, 40),
),
],
),
);
}
}

0 comments on commit 0bc9291

Please sign in to comment.