Skip to content

Commit

Permalink
Merge pull request #26 from Robert3141/new-beta
Browse files Browse the repository at this point in the history
V3.1.0
  • Loading branch information
Robert3141 committed Dec 9, 2019
2 parents 26efd38 + 3798c41 commit e95a22b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 13 deletions.
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"shared_preferences","dependencies":[]}]}
30 changes: 23 additions & 7 deletions lib/UI/UIgame.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:isolate';

import 'package:tinycolor/tinycolor.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -197,8 +197,8 @@ class _GamePageState extends State<GamePage> {
msgBox(globals.outputTitleWin,
globals.outputMsgWinner + globals.playerNames[winnerNumber], false);
//reset variables
globals.playerBombs = new List<bool>.generate(globals.amountOfPlayers,
(i) => false);
globals.playerBombs =
new List<bool>.generate(globals.amountOfPlayers, (i) => false);
globals.mainBoard = new List<List<int>>.generate(globals.boardSize,
(i) => List<int>.generate(globals.boardSize, (j) => 0));
globals.playerNumber = 1;
Expand Down Expand Up @@ -248,6 +248,19 @@ class _GamePageState extends State<GamePage> {
/// INTERFACE
///
Color chooseBackgroundColor() {
//darken or brighten colour appropriately
Color chosenColor = globals.playerColors[globals.playerNumber];
if (Theme.of(context).brightness == Brightness.light) {
chosenColor = TinyColor(chosenColor).brighten(10).color;
} else {
do {
chosenColor = TinyColor(chosenColor).darken(10).color;
} while (!TinyColor(chosenColor).isDark());
}
return chosenColor;
}

@override
Widget build(BuildContext context) {
//local variables of size
Expand All @@ -260,8 +273,7 @@ class _GamePageState extends State<GamePage> {
(globals.boardSize + 1);

return Scaffold(
backgroundColor: globals.playerColors[globals.playerNumber]
.withAlpha(globals.backgroundAlpha),
backgroundColor: chooseBackgroundColor(),
appBar: AppBar(
title: Text(globals.titleGame),
actions: <Widget>[
Expand Down Expand Up @@ -352,8 +364,12 @@ class _GamePageState extends State<GamePage> {
padding: EdgeInsets.only(
left: _paddingInsets, right: _paddingInsets),
child: CircleAvatar(
backgroundColor: globals
.playerColors[globals.mainBoard[boardX][boardY - 1]],
backgroundColor: globals.mainBoard[boardX][boardY - 1] ==
0 &&
Theme.of(context).brightness == Brightness.dark
? Color.fromRGBO(18, 18, 18, 1.0)
: globals.playerColors[globals.mainBoard[boardX]
[boardY - 1]],
radius: _counterRadius,
child: InkWell(
onTap: () {
Expand Down
1 change: 1 addition & 0 deletions lib/UI/UIsettings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:Connectron/globals.dart' as globals;
import 'package:dynamic_theme/dynamic_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:tinycolor/tinycolor.dart';

class SettingsPage extends StatefulWidget {
SettingsPage({Key key, this.title}) : super(key: key);
Expand Down
24 changes: 19 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
version: "2.0.11"
args:
dependency: transitive
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -87,14 +87,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
path:
dependency: transitive
description:
Expand All @@ -116,6 +116,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
pigment:
dependency: transitive
description:
name: pigment
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
quiver:
dependency: transitive
description:
Expand Down Expand Up @@ -176,7 +183,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
tinycolor:
dependency: "direct main"
description:
name: tinycolor
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
typed_data:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: Connect 4 style game
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.0.0+15
version: 3.1.0+16

environment:
sdk: ">=2.1.0 <3.0.0"
Expand All @@ -22,6 +22,7 @@ dependencies:

#imported dependencies
dynamic_theme: ^1.0.1
tinycolor: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit e95a22b

Please sign in to comment.