├── .gitignore
├── .metadata
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ ├── google-services.json
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ └── com
│ │ │ └── myhexaville
│ │ │ └── fluttertictactoe
│ │ │ └── MainActivity.kt
│ │ └── res
│ │ ├── drawable
│ │ └── launch_background.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── flutter_tic_tac_toe.iml
├── flutter_tic_tac_toe_android.iml
├── fonts
└── chalk.ttf
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── .gitignore
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── GoogleService-Info.plist
│ ├── Info.plist
│ ├── Runner.entitlements
│ └── main.m
├── lib
├── ai
│ ├── ai.dart
│ └── decision.dart
├── application.dart
├── common
│ ├── constants.dart
│ └── util.dart
├── game
│ ├── game.dart
│ └── game_state.dart
├── launcher
│ ├── launcher.dart
│ └── launcher_state.dart
├── model
│ └── user.dart
├── shape
│ ├── circle
│ │ ├── circle..dart
│ │ └── circle_painter.dart
│ └── cross
│ │ ├── cross.dart
│ │ └── cross_painter.dart
├── user_list
│ ├── user_list.dart
│ └── user_list_state.dart
└── victory
│ ├── victory.dart
│ ├── victory_checker.dart
│ └── victory_line.dart
├── pubspec.lock
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .atom/
3 | .dart_tool/
4 | .idea
5 | .vscode/
6 | .packages
7 | .pub/
8 | build/
9 | ios/.generated/
10 | packages
11 | .flutter-plugins
12 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: f8ac23cd8646538634f63032df4bfaf3b597007d
8 | channel: dev
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Flutter Tic Tac Toe
2 |
3 | Tic Tac Toe game with Firebase multiplayer written in Flutter that can run both on iOS and Android
4 |
5 | 
6 | 
7 |
8 | ## Backend
9 | Check [here](https://github.com/IhorKlimov/Android-TicTacToe-Backend)
10 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | apply plugin: 'com.android.application'
15 | apply plugin: 'kotlin-android'
16 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
17 |
18 | android {
19 | compileSdkVersion 27
20 |
21 | sourceSets {
22 | main.java.srcDirs += 'src/main/kotlin'
23 | }
24 |
25 | lintOptions {
26 | disable 'InvalidPackage'
27 | }
28 |
29 | defaultConfig {
30 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
31 | applicationId "com.myhexaville.fluttertictactoe"
32 | minSdkVersion 16
33 | targetSdkVersion 27
34 | versionCode 1
35 | versionName "1.0"
36 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
37 | }
38 |
39 | buildTypes {
40 | release {
41 | // TODO: Add your own signing config for the release build.
42 | // Signing with the debug keys for now, so `flutter run --release` works.
43 | signingConfig signingConfigs.debug
44 | }
45 | }
46 | }
47 |
48 | flutter {
49 | source '../..'
50 | }
51 |
52 | dependencies {
53 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
54 | testImplementation 'junit:junit:4.12'
55 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
57 | }
58 | apply plugin: 'com.google.gms.google-services'
59 |
--------------------------------------------------------------------------------
/android/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "245188738884",
4 | "firebase_url": "https://tictactoe-64902.firebaseio.com",
5 | "project_id": "tictactoe-64902",
6 | "storage_bucket": "tictactoe-64902.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:245188738884:android:3c2293b0de253510",
12 | "android_client_info": {
13 | "package_name": "com.myhexaville.fluttertictactoe"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "245188738884-1e23295sqc9e5gkfu1q0mt3gdbd623l0.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "com.myhexaville.fluttertictactoe",
22 | "certificate_hash": "9850a8aeec330d95ce2cec6399039bde6d70b9d2"
23 | }
24 | },
25 | {
26 | "client_id": "245188738884-tota5mu5r3m9mfjsf1svbg0gjhc3njrv.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyC_OVooHG6p-mAjWdY1x72ijbzzoNFpkRw"
33 | }
34 | ],
35 | "services": {
36 | "analytics_service": {
37 | "status": 1
38 | },
39 | "appinvite_service": {
40 | "status": 2,
41 | "other_platform_oauth_client": [
42 | {
43 | "client_id": "245188738884-lb4bv4oo2f8do4pd43c5ef0hh6l8ui0n.apps.googleusercontent.com",
44 | "client_type": 2,
45 | "ios_info": {
46 | "bundle_id": "com.myhexaville.flutterNotifications"
47 | }
48 | },
49 | {
50 | "client_id": "245188738884-tota5mu5r3m9mfjsf1svbg0gjhc3njrv.apps.googleusercontent.com",
51 | "client_type": 3
52 | }
53 | ]
54 | },
55 | "ads_service": {
56 | "status": 2
57 | }
58 | }
59 | },
60 | {
61 | "client_info": {
62 | "mobilesdk_app_id": "1:245188738884:android:c195a095c7650e8f",
63 | "android_client_info": {
64 | "package_name": "com.myhexaville.tictactoe"
65 | }
66 | },
67 | "oauth_client": [
68 | {
69 | "client_id": "245188738884-g247pdehli04r96ao11j4iibak1fktn9.apps.googleusercontent.com",
70 | "client_type": 1,
71 | "android_info": {
72 | "package_name": "com.myhexaville.tictactoe",
73 | "certificate_hash": "9850a8aeec330d95ce2cec6399039bde6d70b9d2"
74 | }
75 | },
76 | {
77 | "client_id": "245188738884-tota5mu5r3m9mfjsf1svbg0gjhc3njrv.apps.googleusercontent.com",
78 | "client_type": 3
79 | }
80 | ],
81 | "api_key": [
82 | {
83 | "current_key": "AIzaSyC_OVooHG6p-mAjWdY1x72ijbzzoNFpkRw"
84 | }
85 | ],
86 | "services": {
87 | "analytics_service": {
88 | "status": 1
89 | },
90 | "appinvite_service": {
91 | "status": 2,
92 | "other_platform_oauth_client": [
93 | {
94 | "client_id": "245188738884-lb4bv4oo2f8do4pd43c5ef0hh6l8ui0n.apps.googleusercontent.com",
95 | "client_type": 2,
96 | "ios_info": {
97 | "bundle_id": "com.myhexaville.flutterNotifications"
98 | }
99 | },
100 | {
101 | "client_id": "245188738884-tota5mu5r3m9mfjsf1svbg0gjhc3njrv.apps.googleusercontent.com",
102 | "client_type": 3
103 | }
104 | ]
105 | },
106 | "ads_service": {
107 | "status": 2
108 | }
109 | }
110 | }
111 | ],
112 | "configuration_version": "1"
113 | }
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
19 |
26 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/myhexaville/fluttertictactoe/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.myhexaville.fluttertictactoe
2 |
3 | import android.os.Bundle
4 |
5 | import io.flutter.app.FlutterActivity
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity(): FlutterActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | GeneratedPluginRegistrant.registerWith(this)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.1.51'
3 | repositories {
4 | google()
5 | jcenter()
6 | maven {
7 | url "https://maven.google.com"
8 | }
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.0.1'
13 | classpath 'com.google.gms:google-services:3.1.0'
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | rootProject.buildDir = '../build'
26 | subprojects {
27 | project.buildDir = "${rootProject.buildDir}/${project.name}"
28 | }
29 | subprojects {
30 | project.evaluationDependsOn(':app')
31 | }
32 |
33 | task clean(type: Delete) {
34 | delete rootProject.buildDir
35 | }
36 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/flutter_tic_tac_toe.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/flutter_tic_tac_toe_android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/fonts/chalk.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/fonts/chalk.ttf
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 |
13 | *.pbxuser
14 | *.mode1v3
15 | *.mode2v3
16 | *.perspectivev3
17 |
18 | !default.pbxuser
19 | !default.mode1v3
20 | !default.mode2v3
21 | !default.perspectivev3
22 |
23 | xcuserdata
24 |
25 | *.moved-aside
26 |
27 | *.pyc
28 | *sync/
29 | Icon?
30 | .tags*
31 |
32 | /Flutter/app.zip
33 | /Flutter/App.framework
34 | /Flutter/Flutter.framework
35 | /Flutter/flutter_assets/
36 | /Flutter/Generated.xcconfig
37 | /ServiceDefinitions.json
38 |
39 | Podfile
40 | Podfile.lock
41 | Pods
42 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | UIRequiredDeviceCapabilities
24 |
25 | arm64
26 |
27 | MinimumOSVersion
28 | 8.0
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
11 | 2EF3EFF8E25860E112E91756 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 799CAB03D87EEEE1FF65E7BE /* libPods-Runner.a */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 5C5A74FB1EAA74D700FE37CF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5C5A74FA1EAA74D700FE37CF /* GoogleService-Info.plist */; };
16 | 5C8223C01EC265DD00E12B15 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C8223BF1EC265DD00E12B15 /* GeneratedPluginRegistrant.m */; };
17 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
18 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
19 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
20 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
21 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
22 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
23 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
24 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
25 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
26 | /* End PBXBuildFile section */
27 |
28 | /* Begin PBXCopyFilesBuildPhase section */
29 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
30 | isa = PBXCopyFilesBuildPhase;
31 | buildActionMask = 2147483647;
32 | dstPath = "";
33 | dstSubfolderSpec = 10;
34 | files = (
35 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
36 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
37 | );
38 | name = "Embed Frameworks";
39 | runOnlyForDeploymentPostprocessing = 0;
40 | };
41 | /* End PBXCopyFilesBuildPhase section */
42 |
43 | /* Begin PBXFileReference section */
44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
47 | 5C5A74FA1EAA74D700FE37CF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; };
48 | 5C8223BE1EC265DD00E12B15 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
49 | 5C8223BF1EC265DD00E12B15 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
50 | 5CDE2B941EA81E0D006C00D0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
51 | 799CAB03D87EEEE1FF65E7BE /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
52 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
53 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
54 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
55 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
56 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
57 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
58 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
59 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
60 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
61 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
62 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
63 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
64 | /* End PBXFileReference section */
65 |
66 | /* Begin PBXFrameworksBuildPhase section */
67 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
72 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
73 | 2EF3EFF8E25860E112E91756 /* libPods-Runner.a in Frameworks */,
74 | );
75 | runOnlyForDeploymentPostprocessing = 0;
76 | };
77 | /* End PBXFrameworksBuildPhase section */
78 |
79 | /* Begin PBXGroup section */
80 | 840012C8B5EDBCF56B0E4AC1 /* Pods */ = {
81 | isa = PBXGroup;
82 | children = (
83 | );
84 | name = Pods;
85 | sourceTree = "";
86 | };
87 | 9740EEB11CF90186004384FC /* Flutter */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 3B80C3931E831B6300D905FE /* App.framework */,
91 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
92 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
93 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
94 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
95 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
96 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
97 | );
98 | name = Flutter;
99 | sourceTree = "";
100 | };
101 | 97C146E51CF9000F007C117D = {
102 | isa = PBXGroup;
103 | children = (
104 | 9740EEB11CF90186004384FC /* Flutter */,
105 | 97C146F01CF9000F007C117D /* Runner */,
106 | 97C146EF1CF9000F007C117D /* Products */,
107 | 840012C8B5EDBCF56B0E4AC1 /* Pods */,
108 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
109 | );
110 | sourceTree = "";
111 | };
112 | 97C146EF1CF9000F007C117D /* Products */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 97C146EE1CF9000F007C117D /* Runner.app */,
116 | );
117 | name = Products;
118 | sourceTree = "";
119 | };
120 | 97C146F01CF9000F007C117D /* Runner */ = {
121 | isa = PBXGroup;
122 | children = (
123 | 5C8223BE1EC265DD00E12B15 /* GeneratedPluginRegistrant.h */,
124 | 5C8223BF1EC265DD00E12B15 /* GeneratedPluginRegistrant.m */,
125 | 5CDE2B941EA81E0D006C00D0 /* Runner.entitlements */,
126 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
127 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
128 | 5C5A74FA1EAA74D700FE37CF /* GoogleService-Info.plist */,
129 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
130 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
131 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
132 | 97C147021CF9000F007C117D /* Info.plist */,
133 | 97C146F11CF9000F007C117D /* Supporting Files */,
134 | );
135 | path = Runner;
136 | sourceTree = "";
137 | };
138 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
139 | isa = PBXGroup;
140 | children = (
141 | 97C146F21CF9000F007C117D /* main.m */,
142 | );
143 | name = "Supporting Files";
144 | sourceTree = "";
145 | };
146 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */ = {
147 | isa = PBXGroup;
148 | children = (
149 | 799CAB03D87EEEE1FF65E7BE /* libPods-Runner.a */,
150 | );
151 | name = Frameworks;
152 | sourceTree = "";
153 | };
154 | /* End PBXGroup section */
155 |
156 | /* Begin PBXNativeTarget section */
157 | 97C146ED1CF9000F007C117D /* Runner */ = {
158 | isa = PBXNativeTarget;
159 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
160 | buildPhases = (
161 | AB1344B0443C71CD721E1BB7 /* [CP] Check Pods Manifest.lock */,
162 | 9740EEB61CF901F6004384FC /* Run Script */,
163 | 97C146EA1CF9000F007C117D /* Sources */,
164 | 97C146EB1CF9000F007C117D /* Frameworks */,
165 | 97C146EC1CF9000F007C117D /* Resources */,
166 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
167 | 532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */,
168 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
169 | A8FD3BAA0362C0A00919B9C8 /* [CP] Embed Pods Frameworks */,
170 | );
171 | buildRules = (
172 | );
173 | dependencies = (
174 | );
175 | name = Runner;
176 | productName = Runner;
177 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
178 | productType = "com.apple.product-type.application";
179 | };
180 | /* End PBXNativeTarget section */
181 |
182 | /* Begin PBXProject section */
183 | 97C146E61CF9000F007C117D /* Project object */ = {
184 | isa = PBXProject;
185 | attributes = {
186 | LastUpgradeCheck = 0830;
187 | ORGANIZATIONNAME = "The Chromium Authors";
188 | TargetAttributes = {
189 | 97C146ED1CF9000F007C117D = {
190 | CreatedOnToolsVersion = 7.3.1;
191 | DevelopmentTeam = 9JHGLN7WTV;
192 | ProvisioningStyle = Manual;
193 | SystemCapabilities = {
194 | com.apple.Push = {
195 | enabled = 1;
196 | };
197 | };
198 | };
199 | };
200 | };
201 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
202 | compatibilityVersion = "Xcode 3.2";
203 | developmentRegion = English;
204 | hasScannedForEncodings = 0;
205 | knownRegions = (
206 | en,
207 | Base,
208 | );
209 | mainGroup = 97C146E51CF9000F007C117D;
210 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
211 | projectDirPath = "";
212 | projectRoot = "";
213 | targets = (
214 | 97C146ED1CF9000F007C117D /* Runner */,
215 | );
216 | };
217 | /* End PBXProject section */
218 |
219 | /* Begin PBXResourcesBuildPhase section */
220 | 97C146EC1CF9000F007C117D /* Resources */ = {
221 | isa = PBXResourcesBuildPhase;
222 | buildActionMask = 2147483647;
223 | files = (
224 | 5C5A74FB1EAA74D700FE37CF /* GoogleService-Info.plist in Resources */,
225 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
226 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
227 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
228 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
229 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
230 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
231 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
232 | );
233 | runOnlyForDeploymentPostprocessing = 0;
234 | };
235 | /* End PBXResourcesBuildPhase section */
236 |
237 | /* Begin PBXShellScriptBuildPhase section */
238 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
239 | isa = PBXShellScriptBuildPhase;
240 | buildActionMask = 2147483647;
241 | files = (
242 | );
243 | inputPaths = (
244 | );
245 | name = "Thin Binary";
246 | outputPaths = (
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | shellPath = /bin/sh;
250 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
251 | };
252 | 532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */ = {
253 | isa = PBXShellScriptBuildPhase;
254 | buildActionMask = 2147483647;
255 | files = (
256 | );
257 | inputPaths = (
258 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
259 | "${PODS_ROOT}/GTMOAuth2/Source/Touch/GTMOAuth2ViewTouch.xib",
260 | "${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle",
261 | );
262 | name = "[CP] Copy Pods Resources";
263 | outputPaths = (
264 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMOAuth2ViewTouch.nib",
265 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle",
266 | );
267 | runOnlyForDeploymentPostprocessing = 0;
268 | shellPath = /bin/sh;
269 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
270 | showEnvVarsInLog = 0;
271 | };
272 | 9740EEB61CF901F6004384FC /* Run Script */ = {
273 | isa = PBXShellScriptBuildPhase;
274 | buildActionMask = 2147483647;
275 | files = (
276 | );
277 | inputPaths = (
278 | );
279 | name = "Run Script";
280 | outputPaths = (
281 | );
282 | runOnlyForDeploymentPostprocessing = 0;
283 | shellPath = /bin/sh;
284 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
285 | };
286 | A8FD3BAA0362C0A00919B9C8 /* [CP] Embed Pods Frameworks */ = {
287 | isa = PBXShellScriptBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | );
291 | inputPaths = (
292 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
293 | "${PODS_ROOT}/.symlinks/flutter/ios/Flutter.framework",
294 | );
295 | name = "[CP] Embed Pods Frameworks";
296 | outputPaths = (
297 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
298 | );
299 | runOnlyForDeploymentPostprocessing = 0;
300 | shellPath = /bin/sh;
301 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
302 | showEnvVarsInLog = 0;
303 | };
304 | AB1344B0443C71CD721E1BB7 /* [CP] Check Pods Manifest.lock */ = {
305 | isa = PBXShellScriptBuildPhase;
306 | buildActionMask = 2147483647;
307 | files = (
308 | );
309 | inputPaths = (
310 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
311 | "${PODS_ROOT}/Manifest.lock",
312 | );
313 | name = "[CP] Check Pods Manifest.lock";
314 | outputPaths = (
315 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
316 | );
317 | runOnlyForDeploymentPostprocessing = 0;
318 | shellPath = /bin/sh;
319 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
320 | showEnvVarsInLog = 0;
321 | };
322 | /* End PBXShellScriptBuildPhase section */
323 |
324 | /* Begin PBXSourcesBuildPhase section */
325 | 97C146EA1CF9000F007C117D /* Sources */ = {
326 | isa = PBXSourcesBuildPhase;
327 | buildActionMask = 2147483647;
328 | files = (
329 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
330 | 97C146F31CF9000F007C117D /* main.m in Sources */,
331 | 5C8223C01EC265DD00E12B15 /* GeneratedPluginRegistrant.m in Sources */,
332 | );
333 | runOnlyForDeploymentPostprocessing = 0;
334 | };
335 | /* End PBXSourcesBuildPhase section */
336 |
337 | /* Begin PBXVariantGroup section */
338 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
339 | isa = PBXVariantGroup;
340 | children = (
341 | 97C146FB1CF9000F007C117D /* Base */,
342 | );
343 | name = Main.storyboard;
344 | sourceTree = "";
345 | };
346 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
347 | isa = PBXVariantGroup;
348 | children = (
349 | 97C147001CF9000F007C117D /* Base */,
350 | );
351 | name = LaunchScreen.storyboard;
352 | sourceTree = "";
353 | };
354 | /* End PBXVariantGroup section */
355 |
356 | /* Begin XCBuildConfiguration section */
357 | 97C147031CF9000F007C117D /* Debug */ = {
358 | isa = XCBuildConfiguration;
359 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
360 | buildSettings = {
361 | ALWAYS_SEARCH_USER_PATHS = NO;
362 | CLANG_ANALYZER_NONNULL = YES;
363 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
364 | CLANG_CXX_LIBRARY = "libc++";
365 | CLANG_ENABLE_MODULES = YES;
366 | CLANG_ENABLE_OBJC_ARC = YES;
367 | CLANG_WARN_BOOL_CONVERSION = YES;
368 | CLANG_WARN_CONSTANT_CONVERSION = YES;
369 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
370 | CLANG_WARN_EMPTY_BODY = YES;
371 | CLANG_WARN_ENUM_CONVERSION = YES;
372 | CLANG_WARN_INFINITE_RECURSION = YES;
373 | CLANG_WARN_INT_CONVERSION = YES;
374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
375 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
376 | CLANG_WARN_UNREACHABLE_CODE = YES;
377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
379 | COPY_PHASE_STRIP = NO;
380 | DEBUG_INFORMATION_FORMAT = dwarf;
381 | ENABLE_STRICT_OBJC_MSGSEND = YES;
382 | ENABLE_TESTABILITY = YES;
383 | GCC_C_LANGUAGE_STANDARD = gnu99;
384 | GCC_DYNAMIC_NO_PIC = NO;
385 | GCC_NO_COMMON_BLOCKS = YES;
386 | GCC_OPTIMIZATION_LEVEL = 0;
387 | GCC_PREPROCESSOR_DEFINITIONS = (
388 | "DEBUG=1",
389 | "$(inherited)",
390 | );
391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
393 | GCC_WARN_UNDECLARED_SELECTOR = YES;
394 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
395 | GCC_WARN_UNUSED_FUNCTION = YES;
396 | GCC_WARN_UNUSED_VARIABLE = YES;
397 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
398 | MTL_ENABLE_DEBUG_INFO = YES;
399 | ONLY_ACTIVE_ARCH = YES;
400 | SDKROOT = iphoneos;
401 | TARGETED_DEVICE_FAMILY = "1,2";
402 | };
403 | name = Debug;
404 | };
405 | 97C147041CF9000F007C117D /* Release */ = {
406 | isa = XCBuildConfiguration;
407 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
408 | buildSettings = {
409 | ALWAYS_SEARCH_USER_PATHS = NO;
410 | CLANG_ANALYZER_NONNULL = YES;
411 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
412 | CLANG_CXX_LIBRARY = "libc++";
413 | CLANG_ENABLE_MODULES = YES;
414 | CLANG_ENABLE_OBJC_ARC = YES;
415 | CLANG_WARN_BOOL_CONVERSION = YES;
416 | CLANG_WARN_CONSTANT_CONVERSION = YES;
417 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
418 | CLANG_WARN_EMPTY_BODY = YES;
419 | CLANG_WARN_ENUM_CONVERSION = YES;
420 | CLANG_WARN_INFINITE_RECURSION = YES;
421 | CLANG_WARN_INT_CONVERSION = YES;
422 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
423 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
424 | CLANG_WARN_UNREACHABLE_CODE = YES;
425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
427 | COPY_PHASE_STRIP = NO;
428 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
429 | ENABLE_NS_ASSERTIONS = NO;
430 | ENABLE_STRICT_OBJC_MSGSEND = YES;
431 | GCC_C_LANGUAGE_STANDARD = gnu99;
432 | GCC_NO_COMMON_BLOCKS = YES;
433 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
434 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
435 | GCC_WARN_UNDECLARED_SELECTOR = YES;
436 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
437 | GCC_WARN_UNUSED_FUNCTION = YES;
438 | GCC_WARN_UNUSED_VARIABLE = YES;
439 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
440 | MTL_ENABLE_DEBUG_INFO = NO;
441 | SDKROOT = iphoneos;
442 | TARGETED_DEVICE_FAMILY = "1,2";
443 | VALIDATE_PRODUCT = YES;
444 | };
445 | name = Release;
446 | };
447 | 97C147061CF9000F007C117D /* Debug */ = {
448 | isa = XCBuildConfiguration;
449 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
450 | buildSettings = {
451 | ARCHS = arm64;
452 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
453 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
454 | CODE_SIGN_STYLE = Manual;
455 | DEVELOPMENT_TEAM = 9JHGLN7WTV;
456 | ENABLE_BITCODE = NO;
457 | FRAMEWORK_SEARCH_PATHS = (
458 | "$(inherited)",
459 | "$(PROJECT_DIR)/Flutter",
460 | );
461 | INFOPLIST_FILE = Runner/Info.plist;
462 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
464 | LIBRARY_SEARCH_PATHS = (
465 | "$(inherited)",
466 | "$(PROJECT_DIR)/Flutter",
467 | );
468 | PRODUCT_BUNDLE_IDENTIFIER = com.myhexaville.flutterTicTacToe;
469 | PRODUCT_NAME = "$(TARGET_NAME)";
470 | PROVISIONING_PROFILE = "69a7f764-fbe1-4935-a46b-e8220e9b70c6";
471 | PROVISIONING_PROFILE_SPECIFIER = "Tic Tac Toe";
472 | TARGETED_DEVICE_FAMILY = "1,2";
473 | };
474 | name = Debug;
475 | };
476 | 97C147071CF9000F007C117D /* Release */ = {
477 | isa = XCBuildConfiguration;
478 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
479 | buildSettings = {
480 | ARCHS = arm64;
481 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
482 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
483 | CODE_SIGN_STYLE = Manual;
484 | DEVELOPMENT_TEAM = 9JHGLN7WTV;
485 | ENABLE_BITCODE = NO;
486 | FRAMEWORK_SEARCH_PATHS = (
487 | "$(inherited)",
488 | "$(PROJECT_DIR)/Flutter",
489 | );
490 | INFOPLIST_FILE = Runner/Info.plist;
491 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
493 | LIBRARY_SEARCH_PATHS = (
494 | "$(inherited)",
495 | "$(PROJECT_DIR)/Flutter",
496 | );
497 | PRODUCT_BUNDLE_IDENTIFIER = com.myhexaville.flutterTicTacToe;
498 | PRODUCT_NAME = "$(TARGET_NAME)";
499 | PROVISIONING_PROFILE = "69a7f764-fbe1-4935-a46b-e8220e9b70c6";
500 | PROVISIONING_PROFILE_SPECIFIER = "Tic Tac Toe";
501 | TARGETED_DEVICE_FAMILY = "1,2";
502 | };
503 | name = Release;
504 | };
505 | /* End XCBuildConfiguration section */
506 |
507 | /* Begin XCConfigurationList section */
508 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
509 | isa = XCConfigurationList;
510 | buildConfigurations = (
511 | 97C147031CF9000F007C117D /* Debug */,
512 | 97C147041CF9000F007C117D /* Release */,
513 | );
514 | defaultConfigurationIsVisible = 0;
515 | defaultConfigurationName = Release;
516 | };
517 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
518 | isa = XCConfigurationList;
519 | buildConfigurations = (
520 | 97C147061CF9000F007C117D /* Debug */,
521 | 97C147071CF9000F007C117D /* Release */,
522 | );
523 | defaultConfigurationIsVisible = 0;
524 | defaultConfigurationName = Release;
525 | };
526 | /* End XCConfigurationList section */
527 | };
528 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
529 | }
530 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/.gitignore:
--------------------------------------------------------------------------------
1 | GeneratedPluginRegistrant.h
2 | GeneratedPluginRegistrant.m
3 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | #import
6 | #import
7 |
8 | @interface AppDelegate : FlutterAppDelegate
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | #include "AppDelegate.h"
6 | #include "GeneratedPluginRegistrant.h"
7 |
8 | @implementation AppDelegate
9 |
10 | - (BOOL)application:(UIApplication *)application
11 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
12 | [GeneratedPluginRegistrant registerWithRegistry:self];
13 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IhorKlimov/Flutter-Tic-Tac-Toe/67df5d25eab9e9d4463e9381109af55b1a3c40e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/GoogleService-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AD_UNIT_ID_FOR_BANNER_TEST
6 | ca-app-pub-3940256099942544/2934735716
7 | AD_UNIT_ID_FOR_INTERSTITIAL_TEST
8 | ca-app-pub-3940256099942544/4411468910
9 | CLIENT_ID
10 | 245188738884-dg2henqrvagoh9m068n4huag0799i5lj.apps.googleusercontent.com
11 | REVERSED_CLIENT_ID
12 | com.googleusercontent.apps.245188738884-dg2henqrvagoh9m068n4huag0799i5lj
13 | API_KEY
14 | AIzaSyAWMJIdSNss95GaJ0PeDoGJVLygXZMwCWE
15 | GCM_SENDER_ID
16 | 245188738884
17 | PLIST_VERSION
18 | 1
19 | BUNDLE_ID
20 | com.myhexaville.flutterTicTacToe
21 | PROJECT_ID
22 | tictactoe-64902
23 | STORAGE_BUCKET
24 | tictactoe-64902.appspot.com
25 | IS_ADS_ENABLED
26 |
27 | IS_ANALYTICS_ENABLED
28 |
29 | IS_APPINVITE_ENABLED
30 |
31 | IS_GCM_ENABLED
32 |
33 | IS_SIGNIN_ENABLED
34 |
35 | GOOGLE_APP_ID
36 | 1:245188738884:ios:2d7477dafeb566a9
37 | DATABASE_URL
38 | https://tictactoe-64902.firebaseio.com
39 |
40 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_tic_tac_toe
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | arm64
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 | CFBundleURLTypes
49 |
50 |
51 | CFBundleTypeRole
52 | Editor
53 | CFBundleURLSchemes
54 |
55 | com.googleusercontent.apps.245188738884-dg2henqrvagoh9m068n4huag0799i5lj
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/ios/Runner/Runner.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | #import
6 | #import
7 | #import "AppDelegate.h"
8 |
9 | int main(int argc, char* argv[]) {
10 | @autoreleasepool {
11 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/ai/ai.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter_tic_tac_toe/ai/decision.dart';
4 |
5 | class AI {
6 | List> _field;
7 | String _playerChar;
8 | String _aiChar;
9 | Decision _decision;
10 |
11 | AI(this._field, this._playerChar, this._aiChar);
12 |
13 | Decision getDecision() {
14 | _makeDecision();
15 | return _decision;
16 | }
17 |
18 | _makeDecision() {
19 | if (_isCenterEmpty()) return;
20 | if (_aiIsCloseToWin()) return;
21 | if (_playerIsCloseToWin()) return;
22 | if (_playerHasOneChar()) return;
23 | _chooseRandom();
24 | }
25 |
26 | bool _isCenterEmpty() {
27 | if (_field[1][1].isEmpty) {
28 | _decision = new Decision(1, 1);
29 | return true;
30 | } else {
31 | return false;
32 | }
33 | }
34 |
35 | bool _aiIsCloseToWin() {
36 | return _hasTwoCharsInLine(0, 0, 0, 1, 0, 2, _aiChar) ||
37 | _hasTwoCharsInLine(1, 0, 1, 1, 1, 2, _aiChar) ||
38 | _hasTwoCharsInLine(2, 0, 2, 1, 2, 2, _aiChar) ||
39 | _hasTwoCharsInLine(0, 0, 1, 0, 2, 0, _aiChar) ||
40 | _hasTwoCharsInLine(0, 1, 1, 1, 2, 1, _aiChar) ||
41 | _hasTwoCharsInLine(0, 2, 1, 2, 2, 2, _aiChar) ||
42 | _hasTwoCharsInLine(0, 0, 1, 1, 2, 2, _aiChar) ||
43 | _hasTwoCharsInLine(0, 2, 1, 1, 2, 0, _aiChar);
44 | }
45 |
46 | bool _playerIsCloseToWin() {
47 | return _hasTwoCharsInLine(0, 0, 0, 1, 0, 2, _playerChar) ||
48 | _hasTwoCharsInLine(1, 0, 1, 1, 1, 2, _playerChar) ||
49 | _hasTwoCharsInLine(2, 0, 2, 1, 2, 2, _playerChar) ||
50 | _hasTwoCharsInLine(0, 0, 1, 0, 2, 0, _playerChar) ||
51 | _hasTwoCharsInLine(0, 1, 1, 1, 2, 1, _playerChar) ||
52 | _hasTwoCharsInLine(0, 2, 1, 2, 2, 2, _playerChar) ||
53 | _hasTwoCharsInLine(0, 0, 1, 1, 2, 2, _playerChar) ||
54 | _hasTwoCharsInLine(0, 2, 1, 1, 2, 0, _playerChar);
55 | }
56 |
57 | bool _hasTwoCharsInLine(
58 | int r1, int c1, int r2, int c2, int r3, int c3, String side) {
59 | if (_field[r1][c1] == side &&
60 | _field[r2][c2] == side &&
61 | _field[r3][c3].isEmpty) {
62 | _decision = new Decision(r3, c3);
63 | return true;
64 | }
65 | if (_field[r1][c1] == side &&
66 | _field[r3][c3] == side &&
67 | _field[r2][c2].isEmpty) {
68 | _decision = new Decision(r2, c2);
69 | return true;
70 | }
71 | if (_field[r2][c2] == side &&
72 | _field[r3][c3] == side &&
73 | _field[r1][c1].isEmpty) {
74 | _decision = new Decision(r1, c1);
75 | return true;
76 | }
77 | return false;
78 | }
79 |
80 | bool _playerHasOneChar() {
81 | return _playerHasOneCharInLine(0, 0, 0, 1, 0, 2) ||
82 | _playerHasOneCharInLine(1, 0, 1, 1, 1, 2) ||
83 | _playerHasOneCharInLine(2, 0, 2, 1, 2, 2) ||
84 | _playerHasOneCharInLine(0, 0, 1, 0, 2, 0) ||
85 | _playerHasOneCharInLine(0, 1, 1, 1, 2, 1) ||
86 | _playerHasOneCharInLine(0, 2, 1, 2, 2, 2) ||
87 | _playerHasOneCharInLine(0, 0, 1, 1, 2, 2) ||
88 | _playerHasOneCharInLine(0, 2, 1, 1, 2, 0);
89 | }
90 |
91 | _playerHasOneCharInLine(int r1, int c1, int r2, int c2, int r3, int c3) {
92 | if (_field[r1][c1] == _playerChar &&
93 | _field[r2][c2].isEmpty &&
94 | _field[r3][c3].isEmpty) {
95 | _decision = new Decision(r3, c3);
96 | return true;
97 | }
98 | if (_field[r2][c2] == _playerChar &&
99 | _field[r1][c1].isEmpty &&
100 | _field[r3][c3].isEmpty) {
101 | _decision = new Decision(r1, c1);
102 | return true;
103 | }
104 | if (_field[r3][c3] == _playerChar &&
105 | _field[r1][c1].isEmpty &&
106 | _field[r2][c2].isEmpty) {
107 | _decision = new Decision(r1, c1);
108 | return true;
109 | }
110 | return false;
111 | }
112 |
113 | _chooseRandom() {
114 | var random = new Random();
115 | while (true) {
116 | var _row = random.nextInt(3);
117 | var _column = random.nextInt(3);
118 |
119 | if (_field[_row][_column].isEmpty) {
120 | _decision = new Decision(_row, _column);
121 | break;
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/lib/ai/decision.dart:
--------------------------------------------------------------------------------
1 | class Decision {
2 | int row;
3 | int column;
4 |
5 | Decision(this.row, this.column);
6 |
7 | }
--------------------------------------------------------------------------------
/lib/application.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/common/constants.dart';
3 | import 'package:flutter_tic_tac_toe/game/game.dart';
4 | import 'package:flutter_tic_tac_toe/launcher/launcher.dart';
5 | import 'package:flutter_tic_tac_toe/user_list/user_list.dart';
6 |
7 | void main() => runApp(TicTacToe());
8 |
9 | class TicTacToe extends StatelessWidget {
10 | @override
11 | Widget build(BuildContext context) => MaterialApp(
12 | title: 'Tic Tac Toe',
13 | theme: ThemeData(
14 | primarySwatch: Colors.blue,
15 | ),
16 | home: Launcher(title: 'Tic Tac Toe'),
17 | routes: {
18 | SINGLE_GAME: (BuildContext context) => Game(title: 'Tic Tac Toe'),
19 | USER_LIST: (BuildContext context) => UserList(title: 'All users')
20 | },
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/lib/common/constants.dart:
--------------------------------------------------------------------------------
1 | const HORIZONTAL = 0;
2 | const VERTICAL = 1;
3 | const DIAGONAL_ASCENDING = 2;
4 | const DIAGONAL_DESCENDING = 3;
5 |
6 | const PLAYER_WINNER = 10;
7 | const AI_WINNER = 11;
8 | const DRAFT = 12;
9 |
10 | const NAME = 'name';
11 | const PHOTO_URL = 'photoUrl';
12 | const PUSH_ID = 'pushId';
13 | const USERS = 'users';
14 | const USER_ID = 'userId';
15 | const USER_NAME = 'userName';
16 |
17 | const SINGLE_GAME = 'singleGame';
18 | const MULTIPLAYER = 'Multiplayer';
19 | const USER_LIST = 'userList';
20 |
--------------------------------------------------------------------------------
/lib/common/util.dart:
--------------------------------------------------------------------------------
1 | dynamic getValueFromMap(Map map, String key) {
2 | print(map);
3 | var result;
4 | map.forEach((k, value) {
5 | if (k == key) {
6 | result = value;
7 | }
8 | });
9 | return result;
10 | }
11 |
--------------------------------------------------------------------------------
/lib/game/game.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/game/game_state.dart';
3 |
4 | class Game extends StatefulWidget {
5 | Game({Key key, this.title, this.type, this.me, this.gameId, this.withId})
6 | : super(key: key);
7 |
8 | final String title, type, me, gameId, withId;
9 |
10 | @override
11 | GameState createState() => GameState(type: type, me: me, gameId: gameId, withId: withId);
12 | }
13 |
--------------------------------------------------------------------------------
/lib/game/game_state.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:firebase_database/firebase_database.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_tic_tac_toe/ai/ai.dart';
6 | import 'package:flutter_tic_tac_toe/common/constants.dart';
7 | import 'package:flutter_tic_tac_toe/game/game.dart';
8 | import 'package:flutter_tic_tac_toe/victory/victory.dart';
9 | import 'package:flutter_tic_tac_toe/victory/victory_checker.dart';
10 | import 'package:flutter_tic_tac_toe/victory/victory_line.dart';
11 | import 'package:flutter_tic_tac_toe/shapes/circle/circle..dart';
12 | import 'package:flutter_tic_tac_toe/shape/cross/cross.dart';
13 |
14 | class GameState extends State {
15 | BuildContext _context;
16 | List> field = [
17 | ['', '', ''],
18 | ['', '', ''],
19 | ['', '', '']
20 | ];
21 | AI ai;
22 | String playerChar = 'X', aiChar = 'O';
23 | bool playersTurn = true;
24 | Victory victory;
25 | final String type, me, gameId, withId;
26 |
27 | GameState({this.type, this.me, this.gameId, this.withId});
28 |
29 | @override
30 | void initState() {
31 | super.initState();
32 | if (me != null) {
33 | playersTurn = me == 'X';
34 | playerChar = me;
35 |
36 | FirebaseDatabase.instance
37 | .reference()
38 | .child('games')
39 | .child(gameId)
40 | .onChildAdded
41 | .listen((Event event) {
42 | String key = event.snapshot.key;
43 | if (key != 'restart') {
44 | int row = int.parse(key.substring(0, 1));
45 | int column = int.parse(key.substring(2, 3));
46 | if (field[row][column] != me) {
47 | setState(() {
48 | field[row][column] = event.snapshot.value;
49 | playersTurn = true;
50 | Timer(Duration(milliseconds: 600), () {
51 | setState(() {
52 | checkForVictory();
53 | });
54 | });
55 | });
56 | }
57 | } else if (key == 'restart') {
58 | FirebaseDatabase.instance.reference().child(gameId).set(null);
59 |
60 | setState(() {
61 | Scaffold.of(_context).hideCurrentSnackBar();
62 | cleanUp();
63 | });
64 | }
65 | });
66 |
67 | // Haven't figured out how to display a Snackbar during build yet
68 | new Timer(Duration(milliseconds: 1000), () {
69 | String text = playersTurn ? 'Your turn' : 'Opponent\'s turn';
70 | print(text);
71 | Scaffold.of(_context).showSnackBar(SnackBar(content: Text(text)));
72 | });
73 | }
74 | }
75 |
76 | @override
77 | Widget build(BuildContext context) {
78 | print('game build');
79 | print(type);
80 | print(me);
81 | print(gameId);
82 | print(withId);
83 |
84 | ai = AI(field, playerChar, aiChar);
85 |
86 | return Scaffold(
87 | appBar: AppBar(
88 | title: Text(widget.title),
89 | ),
90 | body: Builder(builder: (BuildContext context) {
91 | _context = context;
92 | return Center(
93 | child: Stack(
94 | children: [buildGrid(), buildField(), buildVictoryLine()]));
95 | }));
96 | }
97 |
98 | Widget buildGrid() => AspectRatio(
99 | aspectRatio: 1.0,
100 | child: Stack(
101 | children: [
102 | Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
103 | buildHorizontalLine,
104 | buildHorizontalLine,
105 | ]),
106 | Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
107 | buildVerticalLine,
108 | buildVerticalLine,
109 | ])
110 | ],
111 | ));
112 |
113 | Container get buildVerticalLine => Container(
114 | margin: EdgeInsets.only(top: 16.0, bottom: 16.0),
115 | color: Colors.grey,
116 | width: 5.0);
117 |
118 | Container get buildHorizontalLine => Container(
119 | margin: EdgeInsets.only(left: 16.0, right: 16.0),
120 | color: Colors.grey,
121 | height: 5.0);
122 |
123 | Widget buildField() => AspectRatio(
124 | aspectRatio: 1.0,
125 | child:
126 | Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
127 | Expanded(
128 | child: Row(
129 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
130 | children: [
131 | buildCell(0, 0),
132 | buildCell(0, 1),
133 | buildCell(0, 2),
134 | ])),
135 | Expanded(
136 | child: Row(
137 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
138 | children: [
139 | buildCell(1, 0),
140 | buildCell(1, 1),
141 | buildCell(1, 2),
142 | ])),
143 | Expanded(
144 | child: Row(
145 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
146 | children: [
147 | buildCell(2, 0),
148 | buildCell(2, 1),
149 | buildCell(2, 2),
150 | ]))
151 | ]));
152 |
153 | Widget buildCell(int row, int column) => AspectRatio(
154 | aspectRatio: 1.0,
155 | child: GestureDetector(
156 | onTap: () {
157 | if (!gameIsDone() && playersTurn) {
158 | setState(() {
159 | displayPlayersTurn(row, column);
160 |
161 | if (!gameIsDone() && type == null) {
162 | displayAiTurn();
163 | }
164 | });
165 | }
166 | },
167 | child: buildCellItem(row, column)));
168 |
169 | Widget buildCellItem(int row, int column) {
170 | var cell = field[row][column];
171 | if (cell.isNotEmpty) {
172 | if (cell == 'X') {
173 | return Container(padding: EdgeInsets.all(24.0), child: Cross());
174 | } else {
175 | return Container(padding: EdgeInsets.all(24.0), child: Circle());
176 | }
177 | } else {
178 | return null;
179 | }
180 | }
181 |
182 | Widget buildVictoryLine() => AspectRatio(
183 | aspectRatio: 1.0, child: CustomPaint(painter: VictoryLine(victory)));
184 |
185 | void displayPlayersTurn(int row, int column) {
186 | print('clicked on row $row column $column');
187 | playersTurn = false;
188 | field[row][column] = playerChar;
189 |
190 | if (type != null && type == 'wifi') {
191 | FirebaseDatabase.instance
192 | .reference()
193 | .child('games')
194 | .child(gameId)
195 | .child('${row}_${column}')
196 | .set(me);
197 | }
198 |
199 | Timer(Duration(milliseconds: 600), () {
200 | setState(() {
201 | checkForVictory();
202 | });
203 | });
204 | }
205 |
206 | void displayAiTurn() {
207 | Timer(Duration(milliseconds: 1000), () {
208 | setState(() {
209 | // AI turn
210 | var aiDecision = ai.getDecision();
211 | field[aiDecision.row][aiDecision.column] = aiChar;
212 | playersTurn = true;
213 | Timer(Duration(milliseconds: 600), () {
214 | setState(() {
215 | checkForVictory();
216 | });
217 | });
218 | });
219 | });
220 | }
221 |
222 | bool gameIsDone() {
223 | return allCellsAreTaken() || victory != null;
224 | }
225 |
226 | bool allCellsAreTaken() {
227 | return field[0][0].isNotEmpty &&
228 | field[0][1].isNotEmpty &&
229 | field[0][2].isNotEmpty &&
230 | field[1][0].isNotEmpty &&
231 | field[1][1].isNotEmpty &&
232 | field[1][2].isNotEmpty &&
233 | field[2][0].isNotEmpty &&
234 | field[2][1].isNotEmpty &&
235 | field[2][2].isNotEmpty;
236 | }
237 |
238 | void checkForVictory() {
239 | victory = VictoryChecker.checkForVictory(field, playerChar);
240 | if (victory != null) {
241 | String message;
242 |
243 | if (victory.winner == PLAYER_WINNER) {
244 | message = 'You Win!';
245 | } else if (victory.winner == AI_WINNER) {
246 | message = type == null ? 'AI Win!' : 'You loose!';
247 | } else if (victory.winner == DRAFT) {
248 | message = 'Draft';
249 | }
250 | print(message);
251 | Scaffold.of(_context).showSnackBar(SnackBar(
252 | content: Text(message),
253 | duration: Duration(minutes: 1),
254 | action: SnackBarAction(
255 | label: 'Retry',
256 | onPressed: () {
257 | if (type == null) {
258 | setState(() {
259 | victory = null;
260 | field = [
261 | ['', '', ''],
262 | ['', '', ''],
263 | ['', '', '']
264 | ];
265 | playersTurn = true;
266 | });
267 | } else {
268 | restart();
269 | }
270 | }),
271 | ));
272 | }
273 | }
274 |
275 | void restart() async {
276 | await FirebaseDatabase.instance
277 | .reference()
278 | .child('games')
279 | .child(gameId)
280 | .set(null);
281 |
282 | await FirebaseDatabase.instance
283 | .reference()
284 | .child('games')
285 | .child(gameId)
286 | .child('restart')
287 | .set(true);
288 |
289 | setState(() {
290 | cleanUp();
291 | });
292 | }
293 |
294 | void cleanUp() {
295 | victory = null;
296 | field = [
297 | ['', '', ''],
298 | ['', '', ''],
299 | ['', '', '']
300 | ];
301 | playersTurn = me == 'X';
302 | String text = playersTurn ? 'Your turn' : 'Opponent\'s turn';
303 | print(text);
304 | Scaffold.of(_context).showSnackBar(SnackBar(content: Text(text)));
305 | }
306 | }
307 |
--------------------------------------------------------------------------------
/lib/launcher/launcher.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/launcher/launcher_state.dart';
3 |
4 | class Launcher extends StatefulWidget {
5 | Launcher({Key key, this.title}) : super(key: key);
6 |
7 | final String title;
8 |
9 | @override
10 | LauncherState createState() => LauncherState();
11 | }
12 |
--------------------------------------------------------------------------------
/lib/launcher/launcher_state.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_tic_tac_toe/common/constants.dart';
4 | import 'package:flutter_tic_tac_toe/game/game.dart';
5 | import 'package:flutter_tic_tac_toe/launcher/launcher.dart';
6 | import 'package:firebase_messaging/firebase_messaging.dart';
7 | import 'package:flutter_tic_tac_toe/model/user.dart';
8 | import 'package:google_sign_in/google_sign_in.dart';
9 | import 'package:firebase_auth/firebase_auth.dart';
10 | import 'package:firebase_database/firebase_database.dart';
11 | import 'package:shared_preferences/shared_preferences.dart';
12 | import 'package:flutter_tic_tac_toe/common/util.dart';
13 | import 'package:http/http.dart' as http;
14 |
15 | class LauncherState extends State {
16 | final FirebaseMessaging firebaseMessaging = FirebaseMessaging();
17 | final GoogleSignIn _googleSignIn = GoogleSignIn();
18 | final FirebaseAuth _auth = FirebaseAuth.instance;
19 |
20 | @override
21 | void initState() {
22 | super.initState();
23 | firebaseMessaging.configure(
24 | onMessage: (Map message) {
25 | print("onMessage: $message");
26 | handleMessage(message);
27 | },
28 | onLaunch: (Map message) {
29 | print("onLaunch: $message");
30 | handleMessage(message);
31 | },
32 | onResume: (Map message) {
33 | print("onResume: $message");
34 | handleMessage(message);
35 | },
36 | );
37 | firebaseMessaging.requestNotificationPermissions(
38 | IosNotificationSettings(sound: true, badge: true, alert: true));
39 | updateFcmToken();
40 | }
41 |
42 | @override
43 | Widget build(BuildContext context) => Scaffold(
44 | appBar: AppBar(
45 | title: Text(widget.title),
46 | ),
47 | body: Center(
48 | child: Column(
49 | mainAxisAlignment: MainAxisAlignment.center,
50 | children: [
51 | MaterialButton(
52 | onPressed: () {
53 | Navigator.of(context).pushNamed(SINGLE_GAME);
54 | },
55 | padding: EdgeInsets.all(8.0),
56 | child: Text('Single Mode', style: TextStyle(fontSize: 32.0))),
57 | Container(
58 | margin: EdgeInsets.only(top: 16.0),
59 | child: MaterialButton(
60 | padding: EdgeInsets.all(8.0),
61 | onPressed: () {
62 | openUserList();
63 | },
64 | child:
65 | Text(MULTIPLAYER, style: TextStyle(fontSize: 34.0)))),
66 | ],
67 | ),
68 | ));
69 |
70 | void showInvitePopup(BuildContext context, Map message) {
71 | print(context == null);
72 |
73 | Timer(Duration(milliseconds: 200), () {
74 | showDialog(
75 | context: context,
76 | builder: (_) => buildDialog(context, message),
77 | );
78 | });
79 | }
80 |
81 | Widget buildDialog(BuildContext context, Map message) {
82 | var noti = (message["data"]);
83 | var fromName = noti['fromName'];
84 |
85 | return AlertDialog(
86 | content: Text('$fromName invites you to play!'),
87 | actions: [
88 | FlatButton(
89 | child: Text('Decline'),
90 | onPressed: () {},
91 | ),
92 | FlatButton(
93 | child: Text('Accept'),
94 | onPressed: () {
95 | accept(message);
96 | },
97 | ),
98 | ],
99 | );
100 | }
101 |
102 | void openUserList() async {
103 | FirebaseUser user = await signInWithGoogle();
104 | await saveUserToFirebase(user);
105 | Navigator.of(context).pushNamed('userList');
106 | }
107 |
108 | Future signInWithGoogle() async {
109 | var user = await _auth.currentUser();
110 | if (user == null) {
111 | GoogleSignInAccount googleUser = _googleSignIn.currentUser;
112 | if (googleUser == null) {
113 | googleUser = await _googleSignIn.signInSilently();
114 | if (googleUser == null) {
115 | googleUser = await _googleSignIn.signIn();
116 | }
117 | }
118 |
119 | GoogleSignInAuthentication googleAuth = await googleUser.authentication;
120 | user = await _auth.signInWithGoogle(
121 | accessToken: googleAuth.accessToken,
122 | idToken: googleAuth.idToken,
123 | );
124 | print("signed in as " + user.displayName);
125 | }
126 |
127 | return user;
128 | }
129 |
130 | Future saveUserToFirebase(FirebaseUser user) async {
131 | print('saving user to firebase');
132 | var token = await firebaseMessaging.getToken();
133 |
134 | await saveUserToPreferences(user.uid, user.displayName, token);
135 |
136 | var update = {
137 | NAME: user.displayName,
138 | PHOTO_URL: user.photoUrl,
139 | PUSH_ID: token
140 | };
141 | return FirebaseDatabase.instance
142 | .reference()
143 | .child(USERS)
144 | .child(user.uid)
145 | .update(update);
146 | }
147 |
148 | saveUserToPreferences(String userId, String userName, String pushId) async {
149 | SharedPreferences prefs = await SharedPreferences.getInstance();
150 | prefs.setString(USER_ID, userId);
151 | prefs.setString(PUSH_ID, pushId);
152 | prefs.setString(USER_NAME, userName);
153 | }
154 |
155 | // Not sure how FCM token gets updated yet
156 | // just to make sure correct one is always set
157 | void updateFcmToken() async {
158 | var currentUser = await _auth.currentUser();
159 | if (currentUser != null) {
160 | var token = await firebaseMessaging.getToken();
161 | print(token);
162 |
163 | SharedPreferences prefs = await SharedPreferences.getInstance();
164 | prefs.setString(PUSH_ID, token);
165 |
166 | FirebaseDatabase.instance
167 | .reference()
168 | .child(USERS)
169 | .child(currentUser.uid)
170 | .update({PUSH_ID: token});
171 | print('updated FCM token');
172 | }
173 | }
174 |
175 | void accept(Map message) async {
176 | var noti = (message["data"]);
177 | String fromPushId = noti['fromPushId'];
178 | String fromId = noti['fromId'];
179 | SharedPreferences prefs = await SharedPreferences.getInstance();
180 | var username = prefs.getString(USER_NAME);
181 | var pushId = prefs.getString(PUSH_ID);
182 | var userId = prefs.getString(USER_ID);
183 |
184 | var base = 'https://us-central1-tictactoe-64902.cloudfunctions.net';
185 | String dataURL =
186 | '$base/sendNotification2?to=$fromPushId&fromPushId=$pushId&fromId=$userId&fromName=$username&type=accept';
187 | print(dataURL);
188 | http.Response response = await http.get(dataURL);
189 |
190 | String gameId = '$fromId-$userId';
191 |
192 | Navigator.of(context).push(new MaterialPageRoute(
193 | builder: (context) => new Game(
194 | title: 'Tic Tac Toe',
195 | type: "wifi",
196 | me: 'O',
197 | gameId: gameId,
198 | withId: fromId)));
199 | }
200 |
201 | void handleMessage(Map message) async {
202 | var noti = (message["data"]);
203 | var type = noti['type'];
204 | var fromId = noti['fromId'];
205 |
206 | print(type);
207 | if (type == 'invite') {
208 | showInvitePopup(context, message);
209 | } else if (type == 'accept') {
210 | var currentUser = await _auth.currentUser();
211 |
212 | String gameId = '${currentUser.uid}-$fromId';
213 | Navigator.of(context).push(new MaterialPageRoute(
214 | builder: (context) => new Game(
215 | title: 'Tic Tac Toe',
216 | type: "wifi",
217 | me: 'X',
218 | gameId: gameId,
219 | withId: fromId)));
220 | } else if (type == 'reject') {}
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/lib/model/user.dart:
--------------------------------------------------------------------------------
1 | class User {
2 | String id, name, photoUrl, pushId;
3 |
4 | User(this.id, this.name, this.photoUrl, this.pushId);
5 | }
--------------------------------------------------------------------------------
/lib/shape/circle/circle..dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/shape/circle/circle_painter.dart';
3 |
4 | class Circle extends StatefulWidget {
5 | @override
6 | State createState() => CircleState();
7 | }
8 |
9 | class CircleState extends State
10 | with SingleTickerProviderStateMixin {
11 | CirclePainter painter;
12 | Animation animation;
13 | AnimationController controller;
14 | double fraction = 0.0;
15 |
16 | initState() {
17 | super.initState();
18 | controller = AnimationController(
19 | duration: const Duration(milliseconds: 500), vsync: this);
20 | animation = Tween(begin: 0.0, end: 1.0).animate(controller)
21 | ..addListener(() {
22 | setState(() {
23 | fraction = animation.value;
24 | });
25 | });
26 | controller.forward();
27 | }
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | painter = CirclePainter(fraction);
32 | return CustomPaint(painter: painter);
33 | }
34 |
35 | @override
36 | dispose() {
37 | controller.dispose();
38 | super.dispose();
39 | }
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/lib/shape/circle/circle_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'dart:math';
3 |
4 | class CirclePainter extends CustomPainter {
5 | Paint _paint;
6 | double _fraction;
7 |
8 | CirclePainter(this._fraction) {
9 | _paint = Paint()
10 | ..color = Colors.orange
11 | ..strokeWidth = 10.0
12 | ..style = PaintingStyle.stroke
13 | ..strokeCap = StrokeCap.round;
14 | }
15 |
16 | void paint(Canvas canvas, Size size) {
17 | var rect = Offset(5.0, 5.0) & Size(size.width - 10.0, size.height - 10.0);
18 | canvas.drawArc(rect, -pi / 2, pi * 2 * _fraction, false, _paint);
19 | }
20 |
21 | @override
22 | bool shouldRepaint(CirclePainter oldDelegate) {
23 | return oldDelegate._fraction != _fraction;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/shape/cross/cross.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/shape/cross/cross_painter.dart';
3 |
4 | class Cross extends StatefulWidget {
5 | @override
6 | State createState() => CrossState();
7 | }
8 |
9 | class CrossState extends State
10 | with SingleTickerProviderStateMixin {
11 | CrossPainter painter;
12 | Animation animation;
13 | AnimationController controller;
14 | double fraction = 0.0;
15 |
16 | initState() {
17 | super.initState();
18 | controller = AnimationController(
19 | duration: const Duration(milliseconds: 500), vsync: this);
20 | animation = Tween(begin: 0.0, end: 1.0).animate(controller)
21 | ..addListener(() {
22 | setState(() {
23 | fraction = animation.value;
24 | });
25 | });
26 | controller.forward();
27 | }
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | painter = CrossPainter(fraction);
32 | return CustomPaint(painter: painter);
33 | }
34 |
35 | @override
36 | dispose() {
37 | controller.dispose();
38 | super.dispose();
39 | }
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/lib/shape/cross/cross_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class CrossPainter extends CustomPainter {
4 | Paint _paint;
5 | double _fraction;
6 |
7 | CrossPainter(this._fraction) {
8 | _paint = Paint()
9 | ..color = Colors.blue
10 | ..strokeWidth = 10.0
11 | ..strokeCap = StrokeCap.round;
12 | }
13 |
14 | void paint(Canvas canvas, Size size) {
15 | double leftLineFraction, rightLineFraction;
16 |
17 | if (_fraction < .5) {
18 | leftLineFraction = _fraction / .5;
19 | rightLineFraction = 0.0;
20 | } else {
21 | leftLineFraction = 1.0;
22 | rightLineFraction = (_fraction - .5) / .5;
23 | }
24 |
25 | canvas.drawLine(
26 | Offset(0.0, 0.0),
27 | Offset(size.width * leftLineFraction, size.height * leftLineFraction),
28 | _paint);
29 |
30 | if (_fraction >= .5) {
31 | canvas.drawLine(
32 | Offset(size.width, 0.0),
33 | Offset(size.width - size.width * rightLineFraction,
34 | size.height * rightLineFraction),
35 | _paint);
36 | }
37 | }
38 |
39 | @override
40 | bool shouldRepaint(CrossPainter oldDelegate) {
41 | return oldDelegate._fraction != _fraction;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/lib/user_list/user_list.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_tic_tac_toe/user_list/user_list_state.dart';
3 |
4 | class UserList extends StatefulWidget {
5 | final String title;
6 |
7 | UserList({Key key, this.title}) : super(key: key);
8 |
9 | @override
10 | UserListState createState() => UserListState();
11 | }
12 |
--------------------------------------------------------------------------------
/lib/user_list/user_list_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_database/firebase_database.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_tic_tac_toe/common/constants.dart';
4 | import 'package:flutter_tic_tac_toe/model/user.dart';
5 | import 'package:flutter_tic_tac_toe/user_list/user_list.dart';
6 | import 'package:http/http.dart' as http;
7 | import 'package:shared_preferences/shared_preferences.dart';
8 |
9 | class UserListState extends State {
10 | List _users = List();
11 |
12 | @override
13 | void initState() {
14 | super.initState();
15 | fetchUsers();
16 | }
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | print('build');
21 |
22 | return Scaffold(
23 | appBar: AppBar(
24 | title: Text(widget.title),
25 | ),
26 | body: ListView.builder(
27 | itemCount: _users.length, itemBuilder: buildListRow));
28 | }
29 |
30 | Widget buildListRow(BuildContext context, int index) => Container(
31 | height: 56.0,
32 | child: InkWell(
33 | onTap: () {
34 | Scaffold.of(context).showSnackBar(
35 | SnackBar(content: Text('Clicked on ${_users[index].name}')));
36 | invite(_users[index]);
37 | },
38 | child: Container(
39 | padding: EdgeInsets.all(16.0),
40 | alignment: Alignment.centerLeft,
41 | child: Text(
42 | '${_users[index].name}',
43 | // Some weird bugs if passed without quotes
44 | style: TextStyle(fontSize: 18.0),
45 | ))));
46 |
47 | void fetchUsers() async {
48 | var snapshot =
49 | await FirebaseDatabase.instance.reference().child(USERS).once();
50 |
51 | Map users = snapshot.value.cast();
52 | users.forEach((userId, userMap) {
53 | User user = parseUser(userId, userMap);
54 | setState(() {
55 | _users.add(user);
56 | });
57 | });
58 | }
59 |
60 | // Haven't figured out how to use built-in map-to-POJO parsers yet
61 | User parseUser(String userId, Map user) {
62 | String name, photoUrl, pushId;
63 | user.forEach((key, value) {
64 | if (key == NAME) {
65 | name = value as String;
66 | }
67 | if (key == PHOTO_URL) {
68 | photoUrl = value as String;
69 | }
70 | if (key == PUSH_ID) {
71 | pushId = value as String;
72 | }
73 | });
74 |
75 | return User(userId, name, photoUrl, pushId);
76 | }
77 |
78 | invite(User user) async {
79 | SharedPreferences prefs = await SharedPreferences.getInstance();
80 | var username = prefs.getString(USER_NAME);
81 | var pushId = prefs.getString(PUSH_ID);
82 | var userId = prefs.getString(USER_ID);
83 |
84 | var base = 'https://us-central1-tictactoe-64902.cloudfunctions.net';
85 | String dataURL = '$base/sendNotification2?to=${user
86 | .pushId}&fromPushId=$pushId&fromId=$userId&fromName=$username&type=invite';
87 | print(dataURL);
88 | String gameId = '$userId-${user.id}';
89 | FirebaseDatabase.instance
90 | .reference()
91 | .child('games')
92 | .child(gameId)
93 | .set(null);
94 | http.Response response = await http.get(dataURL);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/lib/victory/victory.dart:
--------------------------------------------------------------------------------
1 | class Victory {
2 | int row;
3 | int col;
4 | int lineType;
5 | int winner;
6 |
7 | Victory(this.row, this.col, this.lineType, this.winner);
8 | }
9 |
--------------------------------------------------------------------------------
/lib/victory/victory_checker.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_tic_tac_toe/common/constants.dart';
2 | import 'package:flutter_tic_tac_toe/victory/victory.dart';
3 |
4 | class VictoryChecker {
5 | static Victory checkForVictory(List> field, String playerChar) {
6 | Victory v;
7 | //check horizontal lines
8 | if (field[0][0].isNotEmpty &&
9 | field[0][0] == field[0][1] &&
10 | field[0][0] == field[0][2]) {
11 | v = new Victory(0, 0, HORIZONTAL,
12 | field[0][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
13 | } else if (field[1][0].isNotEmpty &&
14 | field[1][0] == field[1][1] &&
15 | field[1][0] == field[1][2]) {
16 | v = new Victory(1, 0, HORIZONTAL,
17 | field[1][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
18 | } else if (field[2][0].isNotEmpty &&
19 | field[2][0] == field[2][1] &&
20 | field[2][0] == field[2][2]) {
21 | v = new Victory(2, 0, HORIZONTAL,
22 | field[2][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
23 | }
24 |
25 | //check vertical lines
26 | else if (field[0][0].isNotEmpty &&
27 | field[0][0] == field[1][0] &&
28 | field[0][0] == field[2][0]) {
29 | v = new Victory(0, 0, VERTICAL,
30 | field[0][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
31 | } else if (field[0][1].isNotEmpty &&
32 | field[0][1] == field[1][1] &&
33 | field[0][1] == field[2][1]) {
34 | v = new Victory(0, 1, VERTICAL,
35 | field[0][1] == playerChar ? PLAYER_WINNER : AI_WINNER);
36 | } else if (field[0][2].isNotEmpty &&
37 | field[0][2] == field[1][2] &&
38 | field[0][2] == field[2][2]) {
39 | v = new Victory(0, 2, VERTICAL,
40 | field[0][2] == playerChar ? PLAYER_WINNER : AI_WINNER);
41 | }
42 |
43 | //check diagonal
44 | else if (field[0][0].isNotEmpty &&
45 | field[0][0] == field[1][1] &&
46 | field[0][0] == field[2][2]) {
47 | v = new Victory(0, 0, DIAGONAL_DESCENDING,
48 | field[0][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
49 | } else if (field[2][0].isNotEmpty &&
50 | field[2][0] == field[1][1] &&
51 | field[2][0] == field[0][2]) {
52 | v = new Victory(2, 0, DIAGONAL_ASCENDING,
53 | field[2][0] == playerChar ? PLAYER_WINNER : AI_WINNER);
54 | } else if (field[0][0].isNotEmpty &&
55 | field[0][1].isNotEmpty &&
56 | field[0][2].isNotEmpty &&
57 | field[1][0].isNotEmpty &&
58 | field[1][1].isNotEmpty &&
59 | field[1][2].isNotEmpty &&
60 | field[2][0].isNotEmpty &&
61 | field[2][1].isNotEmpty &&
62 | field[2][2].isNotEmpty) {
63 | v = new Victory(-1, -1, -1, DRAFT);
64 | }
65 |
66 | return v;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/victory/victory_line.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/rendering.dart';
3 | import 'package:flutter_tic_tac_toe/common/constants.dart';
4 | import 'package:flutter_tic_tac_toe/victory/victory.dart';
5 |
6 | class VictoryLine extends CustomPainter {
7 | Paint _paint;
8 | Victory _victory;
9 |
10 | @override
11 | bool hitTest(Offset position) {
12 | return false;
13 | }
14 |
15 | VictoryLine(Victory victory) {
16 | this._victory = victory;
17 | _paint = Paint();
18 | _paint.color = Colors.deepOrange;
19 | _paint.strokeWidth = 10.0;
20 | _paint.strokeCap = StrokeCap.round;
21 | }
22 |
23 | @override
24 | void paint(Canvas canvas, Size size) {
25 | print('paint');
26 | if (_victory != null) {
27 | if (_victory.lineType == HORIZONTAL) {
28 | _drawHorizontalLine(_victory.row, size, canvas);
29 | } else if (_victory.lineType == VERTICAL) {
30 | _drawVerticalLine(_victory.col, size, canvas);
31 | } else if (_victory.lineType == DIAGONAL_ASCENDING) {
32 | _drawDiagonalLine(true, size, canvas);
33 | } else if (_victory.lineType == DIAGONAL_DESCENDING)
34 | _drawDiagonalLine(false, size, canvas);
35 | }
36 | }
37 |
38 | void _drawVerticalLine(int column, Size size, Canvas canvas) {
39 | if (column == 0) {
40 | var x = size.width / 3 / 2;
41 | var top = Offset(x, 8.0);
42 | var bottom = Offset(x, size.height - 8.0);
43 | canvas.drawLine(top, bottom, _paint);
44 | } else if (column == 1) {
45 | var x = size.width / 2;
46 | var top = Offset(x, 8.0);
47 | var bottom = Offset(x, size.height - 8.0);
48 | canvas.drawLine(top, bottom, _paint);
49 | } else {
50 | var columnWidth = size.width / 3;
51 | var x = columnWidth * 2 + columnWidth / 2;
52 | var top = Offset(x, 8.0);
53 | var bottom = Offset(x, size.height - 8.0);
54 | canvas.drawLine(top, bottom, _paint);
55 | }
56 | }
57 |
58 | void _drawHorizontalLine(int row, Size size, Canvas canvas) {
59 | if (row == 0) {
60 | var y = size.height / 3 / 2;
61 | var left = Offset(8.0, y);
62 | var right = Offset(size.width - 8.0, y);
63 | canvas.drawLine(left, right, _paint);
64 | } else if (row == 1) {
65 | var y = size.height / 2;
66 | var left = Offset(8.0, y);
67 | var right = Offset(size.width - 8.0, y);
68 | canvas.drawLine(left, right, _paint);
69 | } else {
70 | var columnHeight = size.height / 3;
71 | var y = columnHeight * 2 + columnHeight / 2;
72 | var left = Offset(8.0, y);
73 | var right = Offset(size.width - 8.0, y);
74 | canvas.drawLine(left, right, _paint);
75 | }
76 | }
77 |
78 | void _drawDiagonalLine(bool isAscending, Size size, Canvas canvas) {
79 | if (isAscending) {
80 | var bottomLeft = Offset(8.0, size.height - 8.0);
81 | var topRight = Offset(size.width - 8.0, 8.0);
82 | canvas.drawLine(bottomLeft, topRight, _paint);
83 | } else {
84 | var topLeft = Offset(8.0, 8.0);
85 | var bottomRight = Offset(size.width - 8.0, size.height - 8.0);
86 | canvas.drawLine(topLeft, bottomRight, _paint);
87 | }
88 | }
89 |
90 | @override
91 | bool shouldRepaint(VictoryLine oldDelegate) => false;
92 |
93 | @override
94 | bool shouldRebuildSemantics(VictoryLine oldDelegate) => false;
95 | }
96 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile
3 | packages:
4 | analyzer:
5 | dependency: transitive
6 | description:
7 | name: analyzer
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "0.31.1"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.4.2"
18 | async:
19 | dependency: transitive
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.0.6"
25 | barback:
26 | dependency: transitive
27 | description:
28 | name: barback
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "0.15.2+15"
32 | boolean_selector:
33 | dependency: transitive
34 | description:
35 | name: boolean_selector
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.0.3"
39 | charcode:
40 | dependency: transitive
41 | description:
42 | name: charcode
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.1.1"
46 | cli_util:
47 | dependency: transitive
48 | description:
49 | name: cli_util
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "0.1.2+1"
53 | collection:
54 | dependency: transitive
55 | description:
56 | name: collection
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "1.14.6"
60 | convert:
61 | dependency: transitive
62 | description:
63 | name: convert
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "2.0.1"
67 | crypto:
68 | dependency: transitive
69 | description:
70 | name: crypto
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "2.0.2+1"
74 | csslib:
75 | dependency: transitive
76 | description:
77 | name: csslib
78 | url: "https://pub.dartlang.org"
79 | source: hosted
80 | version: "0.14.1"
81 | cupertino_icons:
82 | dependency: "direct main"
83 | description:
84 | name: cupertino_icons
85 | url: "https://pub.dartlang.org"
86 | source: hosted
87 | version: "0.1.2"
88 | firebase_auth:
89 | dependency: "direct main"
90 | description:
91 | name: firebase_auth
92 | url: "https://pub.dartlang.org"
93 | source: hosted
94 | version: "0.5.5"
95 | firebase_core:
96 | dependency: transitive
97 | description:
98 | name: firebase_core
99 | url: "https://pub.dartlang.org"
100 | source: hosted
101 | version: "0.2.3"
102 | firebase_database:
103 | dependency: "direct main"
104 | description:
105 | name: firebase_database
106 | url: "https://pub.dartlang.org"
107 | source: hosted
108 | version: "0.4.5"
109 | firebase_messaging:
110 | dependency: "direct main"
111 | description:
112 | name: firebase_messaging
113 | url: "https://pub.dartlang.org"
114 | source: hosted
115 | version: "0.2.4"
116 | flutter:
117 | dependency: "direct main"
118 | description: flutter
119 | source: sdk
120 | version: "0.0.0"
121 | flutter_test:
122 | dependency: "direct dev"
123 | description: flutter
124 | source: sdk
125 | version: "0.0.0"
126 | front_end:
127 | dependency: transitive
128 | description:
129 | name: front_end
130 | url: "https://pub.dartlang.org"
131 | source: hosted
132 | version: "0.1.0-alpha.9"
133 | glob:
134 | dependency: transitive
135 | description:
136 | name: glob
137 | url: "https://pub.dartlang.org"
138 | source: hosted
139 | version: "1.1.5"
140 | google_sign_in:
141 | dependency: "direct main"
142 | description:
143 | name: google_sign_in
144 | url: "https://pub.dartlang.org"
145 | source: hosted
146 | version: "3.0.2"
147 | html:
148 | dependency: transitive
149 | description:
150 | name: html
151 | url: "https://pub.dartlang.org"
152 | source: hosted
153 | version: "0.13.3"
154 | http:
155 | dependency: "direct main"
156 | description:
157 | name: http
158 | url: "https://pub.dartlang.org"
159 | source: hosted
160 | version: "0.11.3+16"
161 | http_multi_server:
162 | dependency: transitive
163 | description:
164 | name: http_multi_server
165 | url: "https://pub.dartlang.org"
166 | source: hosted
167 | version: "2.0.4"
168 | http_parser:
169 | dependency: transitive
170 | description:
171 | name: http_parser
172 | url: "https://pub.dartlang.org"
173 | source: hosted
174 | version: "3.1.1"
175 | io:
176 | dependency: transitive
177 | description:
178 | name: io
179 | url: "https://pub.dartlang.org"
180 | source: hosted
181 | version: "0.3.2+1"
182 | isolate:
183 | dependency: transitive
184 | description:
185 | name: isolate
186 | url: "https://pub.dartlang.org"
187 | source: hosted
188 | version: "1.1.0"
189 | js:
190 | dependency: transitive
191 | description:
192 | name: js
193 | url: "https://pub.dartlang.org"
194 | source: hosted
195 | version: "0.6.1"
196 | kernel:
197 | dependency: transitive
198 | description:
199 | name: kernel
200 | url: "https://pub.dartlang.org"
201 | source: hosted
202 | version: "0.3.0-alpha.9"
203 | logging:
204 | dependency: transitive
205 | description:
206 | name: logging
207 | url: "https://pub.dartlang.org"
208 | source: hosted
209 | version: "0.11.3+1"
210 | matcher:
211 | dependency: transitive
212 | description:
213 | name: matcher
214 | url: "https://pub.dartlang.org"
215 | source: hosted
216 | version: "0.12.1+4"
217 | meta:
218 | dependency: transitive
219 | description:
220 | name: meta
221 | url: "https://pub.dartlang.org"
222 | source: hosted
223 | version: "1.1.2"
224 | mime:
225 | dependency: transitive
226 | description:
227 | name: mime
228 | url: "https://pub.dartlang.org"
229 | source: hosted
230 | version: "0.9.6"
231 | multi_server_socket:
232 | dependency: transitive
233 | description:
234 | name: multi_server_socket
235 | url: "https://pub.dartlang.org"
236 | source: hosted
237 | version: "1.0.1"
238 | node_preamble:
239 | dependency: transitive
240 | description:
241 | name: node_preamble
242 | url: "https://pub.dartlang.org"
243 | source: hosted
244 | version: "1.4.0"
245 | package_config:
246 | dependency: transitive
247 | description:
248 | name: package_config
249 | url: "https://pub.dartlang.org"
250 | source: hosted
251 | version: "1.0.3"
252 | package_resolver:
253 | dependency: transitive
254 | description:
255 | name: package_resolver
256 | url: "https://pub.dartlang.org"
257 | source: hosted
258 | version: "1.0.2"
259 | path:
260 | dependency: transitive
261 | description:
262 | name: path
263 | url: "https://pub.dartlang.org"
264 | source: hosted
265 | version: "1.5.1"
266 | platform:
267 | dependency: transitive
268 | description:
269 | name: platform
270 | url: "https://pub.dartlang.org"
271 | source: hosted
272 | version: "2.1.2"
273 | plugin:
274 | dependency: transitive
275 | description:
276 | name: plugin
277 | url: "https://pub.dartlang.org"
278 | source: hosted
279 | version: "0.2.0+2"
280 | pool:
281 | dependency: transitive
282 | description:
283 | name: pool
284 | url: "https://pub.dartlang.org"
285 | source: hosted
286 | version: "1.3.4"
287 | pub_semver:
288 | dependency: transitive
289 | description:
290 | name: pub_semver
291 | url: "https://pub.dartlang.org"
292 | source: hosted
293 | version: "1.3.6"
294 | quiver:
295 | dependency: transitive
296 | description:
297 | name: quiver
298 | url: "https://pub.dartlang.org"
299 | source: hosted
300 | version: "0.29.0+1"
301 | shared_preferences:
302 | dependency: "direct main"
303 | description:
304 | name: shared_preferences
305 | url: "https://pub.dartlang.org"
306 | source: hosted
307 | version: "0.4.1"
308 | shelf:
309 | dependency: transitive
310 | description:
311 | name: shelf
312 | url: "https://pub.dartlang.org"
313 | source: hosted
314 | version: "0.7.2"
315 | shelf_packages_handler:
316 | dependency: transitive
317 | description:
318 | name: shelf_packages_handler
319 | url: "https://pub.dartlang.org"
320 | source: hosted
321 | version: "1.0.3"
322 | shelf_static:
323 | dependency: transitive
324 | description:
325 | name: shelf_static
326 | url: "https://pub.dartlang.org"
327 | source: hosted
328 | version: "0.2.7"
329 | shelf_web_socket:
330 | dependency: transitive
331 | description:
332 | name: shelf_web_socket
333 | url: "https://pub.dartlang.org"
334 | source: hosted
335 | version: "0.2.2"
336 | sky_engine:
337 | dependency: transitive
338 | description: flutter
339 | source: sdk
340 | version: "0.0.99"
341 | source_map_stack_trace:
342 | dependency: transitive
343 | description:
344 | name: source_map_stack_trace
345 | url: "https://pub.dartlang.org"
346 | source: hosted
347 | version: "1.1.4"
348 | source_maps:
349 | dependency: transitive
350 | description:
351 | name: source_maps
352 | url: "https://pub.dartlang.org"
353 | source: hosted
354 | version: "0.10.4"
355 | source_span:
356 | dependency: transitive
357 | description:
358 | name: source_span
359 | url: "https://pub.dartlang.org"
360 | source: hosted
361 | version: "1.4.0"
362 | stack_trace:
363 | dependency: transitive
364 | description:
365 | name: stack_trace
366 | url: "https://pub.dartlang.org"
367 | source: hosted
368 | version: "1.9.2"
369 | stream_channel:
370 | dependency: transitive
371 | description:
372 | name: stream_channel
373 | url: "https://pub.dartlang.org"
374 | source: hosted
375 | version: "1.6.4"
376 | string_scanner:
377 | dependency: transitive
378 | description:
379 | name: string_scanner
380 | url: "https://pub.dartlang.org"
381 | source: hosted
382 | version: "1.0.2"
383 | term_glyph:
384 | dependency: transitive
385 | description:
386 | name: term_glyph
387 | url: "https://pub.dartlang.org"
388 | source: hosted
389 | version: "1.0.0"
390 | test:
391 | dependency: transitive
392 | description:
393 | name: test
394 | url: "https://pub.dartlang.org"
395 | source: hosted
396 | version: "0.12.34"
397 | typed_data:
398 | dependency: transitive
399 | description:
400 | name: typed_data
401 | url: "https://pub.dartlang.org"
402 | source: hosted
403 | version: "1.1.5"
404 | utf:
405 | dependency: transitive
406 | description:
407 | name: utf
408 | url: "https://pub.dartlang.org"
409 | source: hosted
410 | version: "0.9.0+4"
411 | vector_math:
412 | dependency: transitive
413 | description:
414 | name: vector_math
415 | url: "https://pub.dartlang.org"
416 | source: hosted
417 | version: "2.0.6"
418 | watcher:
419 | dependency: transitive
420 | description:
421 | name: watcher
422 | url: "https://pub.dartlang.org"
423 | source: hosted
424 | version: "0.9.7+7"
425 | web_socket_channel:
426 | dependency: transitive
427 | description:
428 | name: web_socket_channel
429 | url: "https://pub.dartlang.org"
430 | source: hosted
431 | version: "1.0.7"
432 | yaml:
433 | dependency: transitive
434 | description:
435 | name: yaml
436 | url: "https://pub.dartlang.org"
437 | source: hosted
438 | version: "2.1.13"
439 | sdks:
440 | dart: ">=2.0.0-dev.28.0 <=2.0.0-edge.3c4dccbd46f152be9e1b6ca95c57357e8e48057c"
441 | flutter: ">=0.1.4 <2.0.0"
442 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_tic_tac_toe
2 | description: A new Flutter project.
3 |
4 | dependencies:
5 | flutter:
6 | sdk: flutter
7 |
8 | cupertino_icons: 0.1.2
9 | firebase_messaging: 0.2.4
10 | google_sign_in: 3.0.2
11 | firebase_auth: 0.5.5
12 | firebase_database: 0.4.5
13 | http: "^0.11.3+16"
14 | shared_preferences: "^0.4.1"
15 |
16 | dev_dependencies:
17 | flutter_test:
18 | sdk: flutter
19 |
20 |
21 | # For information on the generic Dart part of this file, see the
22 | # following page: https://www.dartlang.org/tools/pub/pubspec
23 |
24 | # The following section is specific to Flutter.
25 | flutter:
26 |
27 | # The following line ensures that the Material Icons font is
28 | # included with your application, so that you can use the icons in
29 | # the material Icons class.
30 | uses-material-design: true
31 |
32 | # To add assets to your application, add an assets section, like this:
33 | # assets:
34 | # - images/a_dot_burr.jpeg
35 | # - images/a_dot_ham.jpeg
36 |
37 | # An image asset can refer to one or more resolution-specific "variants", see
38 | # https://flutter.io/assets-and-images/#resolution-aware.
39 |
40 | # For details regarding adding assets from package dependencies, see
41 | # https://flutter.io/assets-and-images/#from-packages
42 |
43 | # To add custom fonts to your application, add a fonts section here,
44 | # in this "flutter" section. Each entry in this list should have a
45 | # "family" key with the font family name, and a "fonts" key with a
46 | # list giving the asset and other descriptors for the font. For
47 | # example:
48 | fonts:
49 | - family: Chalk
50 | fonts:
51 | - asset: fonts/chalk.ttf
52 | # - asset: fonts/Schyler-Italic.ttf
53 | # style: italic
54 | # - family: Trajan Pro
55 | # fonts:
56 | # - asset: fonts/TrajanPro.ttf
57 | # - asset: fonts/TrajanPro_Bold.ttf
58 | # weight: 700
59 |
60 | # For details regarding fonts from package dependencies,
61 | # see https://flutter.io/custom-fonts/#from-packages
62 |
--------------------------------------------------------------------------------