├── functions
├── .gitignore
├── requirements.txt
└── main.py
├── ios
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── LaunchImage.imageset
│ │ │ ├── Logo.png
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Logo-ios.png
│ │ │ └── Contents.json
│ ├── Runner.entitlements
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
├── RunnerTests
│ └── RunnerTests.swift
├── .gitignore
└── Podfile
├── web
├── favicon.png
└── manifest.json
├── screenshots
├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
├── 6.png
├── 7.png
├── 8.png
├── Logo.png
├── ios
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ └── Logo.png
├── Feature.jpg
└── Feature_resized.jpg
├── assets
├── images
│ ├── ai.png
│ └── user.png
└── audio
│ ├── click.wav
│ ├── click1.ogg
│ ├── click2.mp3
│ ├── click2.ogg
│ └── bg_music.mp3
├── android
├── gradle.properties
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── ic_launcher-playstore.png
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ ├── values
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ └── values-night
│ │ │ │ │ └── styles.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── princeappstudio
│ │ │ │ │ └── tic_tac_toe
│ │ │ │ │ └── MainActivity.java
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── .gitignore
├── settings.gradle
└── build.gradle
├── lib
├── components
│ ├── my_spacer.dart
│ ├── icon_button.dart
│ ├── player_card.dart
│ ├── button.dart
│ └── pop_up.dart
├── helper
│ ├── navigation.dart
│ ├── random_gen.dart
│ ├── screenshot_board.dart
│ ├── audio_controller.dart
│ ├── board_desgin.dart
│ ├── animation_widget.dart
│ ├── show_interstitial_ad.dart
│ ├── check_win.dart
│ ├── show_banner_ad.dart
│ └── game.dart
├── model
│ ├── symbol.dart
│ ├── player.dart
│ └── room.dart
├── provider
│ ├── audio_provider.dart
│ ├── theme_provider.dart
│ ├── room_provider.dart
│ ├── game_provider.dart
│ ├── login_provider.dart
│ └── single_mode_provider.dart
├── constants.dart
├── main.dart
└── screen
│ ├── home.dart
│ ├── settings.dart
│ ├── single_mode.dart
│ ├── room.dart
│ ├── lobby.dart
│ └── game.dart
├── .gitignore
├── analysis_options.yaml
├── .metadata
├── pubspec.yaml
├── README.md
└── privacy_policy.md
/functions/.gitignore:
--------------------------------------------------------------------------------
1 | ./venv
--------------------------------------------------------------------------------
/functions/requirements.txt:
--------------------------------------------------------------------------------
1 | firebase_functions~=0.1.0
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/web/favicon.png
--------------------------------------------------------------------------------
/screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/1.png
--------------------------------------------------------------------------------
/screenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/2.png
--------------------------------------------------------------------------------
/screenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/3.png
--------------------------------------------------------------------------------
/screenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/4.png
--------------------------------------------------------------------------------
/screenshots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/5.png
--------------------------------------------------------------------------------
/screenshots/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/6.png
--------------------------------------------------------------------------------
/screenshots/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/7.png
--------------------------------------------------------------------------------
/screenshots/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/8.png
--------------------------------------------------------------------------------
/assets/images/ai.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/images/ai.png
--------------------------------------------------------------------------------
/screenshots/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/Logo.png
--------------------------------------------------------------------------------
/screenshots/ios/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/1.png
--------------------------------------------------------------------------------
/screenshots/ios/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/2.png
--------------------------------------------------------------------------------
/screenshots/ios/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/3.png
--------------------------------------------------------------------------------
/screenshots/ios/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/4.png
--------------------------------------------------------------------------------
/screenshots/ios/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/5.png
--------------------------------------------------------------------------------
/assets/audio/click.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/audio/click.wav
--------------------------------------------------------------------------------
/assets/audio/click1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/audio/click1.ogg
--------------------------------------------------------------------------------
/assets/audio/click2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/audio/click2.mp3
--------------------------------------------------------------------------------
/assets/audio/click2.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/audio/click2.ogg
--------------------------------------------------------------------------------
/assets/images/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/images/user.png
--------------------------------------------------------------------------------
/screenshots/Feature.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/Feature.jpg
--------------------------------------------------------------------------------
/assets/audio/bg_music.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/assets/audio/bg_music.mp3
--------------------------------------------------------------------------------
/screenshots/ios/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/ios/Logo.png
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/screenshots/Feature_resized.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/screenshots/Feature_resized.jpg
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/android/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/Logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Logo-ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Logo-ios.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/princesanjivy/tic-tac-toe/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/princeappstudio/tic_tac_toe/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.princeappstudio.tic_tac_toe;
2 |
3 | import io.flutter.embedding.android.FlutterActivity;
4 |
5 | public class MainActivity extends FlutterActivity {
6 | }
7 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Logo-ios.png",
5 | "idiom" : "universal",
6 | "platform" : "ios",
7 | "size" : "1024x1024"
8 | }
9 | ],
10 | "info" : {
11 | "author" : "xcode",
12 | "version" : 1
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/Runner.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.applesignin
6 |
7 | Default
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Tic Tac Toe - Online",
3 | "short_name": "tic_tac_toe",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "Tic Tac Toe - Play online, offline with friends.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false
11 | }
12 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Logo.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "author" : "xcode",
19 | "version" : 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | @main
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/components/my_spacer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class VerticalSpacer extends StatelessWidget {
4 | final double space;
5 |
6 | const VerticalSpacer(this.space, {Key? key}) : super(key: key);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return SizedBox(
11 | height: space,
12 | );
13 | }
14 | }
15 |
16 | class HorizontalSpacer extends StatelessWidget {
17 | final double space;
18 |
19 | const HorizontalSpacer(this.space, {Key? key}) : super(key: key);
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return SizedBox(
24 | width: space,
25 | );
26 | }
27 | }
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/lib/helper/navigation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:page_transition/page_transition.dart';
3 |
4 | class Navigation {
5 | late final NavigatorState _navigatorState;
6 |
7 | Navigation(this._navigatorState);
8 |
9 | Future changeScreenReplacement(Widget screen, Widget currentScreen) {
10 | return _navigatorState.pushReplacement(
11 | PageTransition(
12 | child: screen,
13 | type: PageTransitionType.rightToLeftWithFade,
14 | childCurrent: currentScreen,
15 | duration: const Duration(milliseconds: 400),
16 | reverseDuration: const Duration(milliseconds: 400),
17 | ),
18 | );
19 | }
20 |
21 | void goBack(BuildContext context) {
22 | return Navigator.pop(context);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | plugins {
14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
15 | }
16 | }
17 |
18 | include ":app"
19 |
20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
21 |
--------------------------------------------------------------------------------
/lib/helper/random_gen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:tic_tac_toe/model/symbol.dart';
4 |
5 | int generateRandomRoomCode() {
6 | Random random = Random();
7 | int min = 100000; // Minimum 6-digit number
8 | int max = 999999; // Maximum 6-digit number
9 | return min + random.nextInt(max - min);
10 | }
11 |
12 | int generateRandomBoardSize() {
13 | Random random = Random();
14 | int min = 3;
15 | int max = 5;
16 |
17 | int number = min + random.nextInt(max - min + 1);
18 | int size = pow(number, 2) as int;
19 |
20 | return size;
21 | }
22 |
23 | String generateRandomPlaySymbol() {
24 | Random random = Random();
25 | int randomNumber = random.nextInt(2) + 1;
26 |
27 | if (randomNumber == PlaySymbol.xInt) {
28 | return PlaySymbol.x;
29 | }
30 |
31 | return PlaySymbol.o;
32 | }
33 |
--------------------------------------------------------------------------------
/lib/model/symbol.dart:
--------------------------------------------------------------------------------
1 | class PlaySymbol {
2 | static const String _symbolX = "X";
3 | static const String _symbolO = "O";
4 | static const String _symbolDraw = "Draw";
5 |
6 | static const int _symbolXInt = 1;
7 | static const int _symbolOInt = 2;
8 |
9 | static get x {
10 | return _symbolX;
11 | }
12 |
13 | static get o {
14 | return _symbolO;
15 | }
16 |
17 | static get draw {
18 | return _symbolDraw;
19 | }
20 |
21 | static get xInt {
22 | return _symbolXInt;
23 | }
24 |
25 | static get oInt {
26 | return _symbolOInt;
27 | }
28 |
29 | static int inNum(String symbol) {
30 | // can be rewritten using map
31 | if (symbol == _symbolX) {
32 | return _symbolXInt;
33 | }
34 | if (symbol == _symbolO) {
35 | return _symbolOInt;
36 | }
37 |
38 | return 0;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | // START: FlutterFire Configuration
11 | classpath 'com.google.gms:google-services:4.3.10'
12 | // END: FlutterFire Configuration
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | mavenCentral()
21 | }
22 | }
23 |
24 | rootProject.buildDir = '../build'
25 | subprojects {
26 | project.buildDir = "${rootProject.buildDir}/${project.name}"
27 | }
28 | subprojects {
29 | project.evaluationDependsOn(':app')
30 | }
31 |
32 | tasks.register("clean", Delete) {
33 | delete rootProject.buildDir
34 | }
35 |
--------------------------------------------------------------------------------
/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 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/helper/screenshot_board.dart:
--------------------------------------------------------------------------------
1 | import 'dart:typed_data';
2 | import 'dart:ui' as ui;
3 |
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter/rendering.dart';
6 | import 'package:share_plus/share_plus.dart';
7 |
8 | Future screenshotBoard(GlobalKey globalKey) async {
9 | final RenderRepaintBoundary boundary =
10 | globalKey.currentContext!.findRenderObject()! as RenderRepaintBoundary;
11 | final ui.Image image = await boundary.toImage(pixelRatio: 3);
12 | final ByteData? byteData =
13 | await image.toByteData(format: ui.ImageByteFormat.png);
14 | final Uint8List pngBytes = byteData!.buffer.asUint8List();
15 |
16 | String tempName = DateTime
17 | .now()
18 | .microsecondsSinceEpoch
19 | .toString();
20 |
21 | final XFile fileData = XFile.fromData(
22 | pngBytes,
23 | mimeType: "image/png",
24 | name: tempName,
25 | );
26 |
27 | return fileData;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/helper/audio_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:audioplayers/audioplayers.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'package:provider/provider.dart';
4 | import 'package:tic_tac_toe/provider/audio_provider.dart';
5 |
6 | class AudioController {
7 | static final AudioController _audioController = AudioController._internal();
8 |
9 | // bool playAudio = true;
10 | late AssetSource source;
11 | AudioPlayer player = AudioPlayer();
12 |
13 | factory AudioController() {
14 | return _audioController;
15 | }
16 |
17 | AudioController._internal() {
18 | init();
19 | }
20 |
21 | void init() async {
22 | source = AssetSource("audio/click2.mp3");
23 | }
24 |
25 | void buttonClick(BuildContext context) async {
26 | AudioProvider audioProvider =
27 | Provider.of(context, listen: false);
28 | if (audioProvider.canPlayAudio) {
29 | await player.play(source);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib/helper/board_desgin.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:tic_tac_toe/helper/game.dart' as helper;
3 |
4 | class BoardDesign {
5 | List corners = [];
6 | Map borders = {};
7 |
8 | BoardDesign(this.corners, this.borders);
9 | }
10 |
11 | BoardDesign boardDesign(List board) {
12 | Map borders = {};
13 |
14 | List borderRadius = [
15 | const BorderRadius.only(
16 | topLeft: Radius.circular(16),
17 | ),
18 | const BorderRadius.only(
19 | topRight: Radius.circular(16),
20 | ),
21 | const BorderRadius.only(
22 | bottomLeft: Radius.circular(16),
23 | ),
24 | const BorderRadius.only(
25 | bottomRight: Radius.circular(16),
26 | ),
27 | ];
28 | List corners = helper.findCornerPositions(board.length);
29 | for (int i = 0; i < corners.length; i++) {
30 | borders.addAll({corners[i]: borderRadius[i]});
31 | }
32 |
33 | return BoardDesign(corners, borders);
34 | }
35 |
--------------------------------------------------------------------------------
/lib/model/player.dart:
--------------------------------------------------------------------------------
1 | class Player {
2 | final String name;
3 | final String playerId;
4 | final String displayPicture;
5 | String chose = "";
6 | int winCount = 0;
7 |
8 | Player(
9 | this.name,
10 | this.playerId,
11 | this.displayPicture,
12 | );
13 |
14 | Player.fromRoomDataJson(json)
15 | : chose = json!["chose"],
16 | playerId = json!["id"],
17 | winCount = json!["winCount"],
18 | displayPicture = "",
19 |
20 | /// temp
21 | name = "";
22 |
23 | /// temp
24 |
25 | Player.fromJson(json)
26 | : name = json!["name"],
27 | displayPicture = json!["displayPicture"],
28 | playerId = json!["playerId"];
29 |
30 | Map toJson() => {
31 | "id": playerId,
32 | "chose": chose,
33 | "winCount": winCount,
34 | };
35 |
36 | Map toDbJson() => {
37 | "name": name,
38 | "playerId": playerId,
39 | "displayPicture": displayPicture,
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/functions/main.py:
--------------------------------------------------------------------------------
1 | from firebase_functions import scheduler_fn
2 | from firebase_admin import initialize_app, db
3 | from datetime import datetime
4 |
5 | initialize_app()
6 |
7 |
8 | @scheduler_fn.on_schedule(schedule="0 * * * *")
9 | def on_every_hour(event: scheduler_fn.ScheduledEvent) -> None:
10 | date_format = "%Y-%m-%d %H:%M:%S.%f" # eg: 2023-07-26 21:43:50.019983
11 | path = db.reference("room/")
12 | data = path.get()
13 |
14 | print(data)
15 |
16 | if data:
17 | for room in data:
18 | created_at_str = data[room]["createdAt"]
19 | created_at = datetime.strptime(created_at_str, date_format)
20 | current_time = datetime.now()
21 |
22 | # print(created_at)
23 | # print(current_time)
24 |
25 | time_diff = current_time - created_at
26 |
27 | if time_diff.total_seconds() > 3600:
28 | print("Time difference is greater than 1 hour")
29 | print(f"Deleting... room => {room}")
30 |
31 | path.child(room).delete()
32 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .build/
9 | .buildlog/
10 | .history
11 | .svn/
12 | .swiftpm/
13 | migrate_working_dir/
14 |
15 | # IntelliJ related
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 |
21 | # The .vscode folder contains launch configuration and tasks you configure in
22 | # VS Code which you may wish to be included in version control, so this line
23 | # is commented out by default.
24 | #.vscode/
25 |
26 | # Flutter/Dart/Pub related
27 | **/doc/api/
28 | **/ios/Flutter/.last_build_id
29 | .dart_tool/
30 | .flutter-plugins
31 | .flutter-plugins-dependencies
32 | .packages
33 | .pub-cache/
34 | .pub/
35 | /build/
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
48 | /lib/firebase_options.dart
49 | /android/app/google-services.json
50 |
51 | pubspec.lock
52 |
53 | /web/index.html
54 | /web/sw.js
55 |
56 | # functions venv
57 | /functions/venv/
58 | /cloud-functions-js/
59 |
60 | .firebase
61 | firebase.json
62 | .firebaserc
63 |
64 | android/flutter-tic-tac-toe-1f1db-7d46c91ea2c7.json
65 |
66 | web/adsterra_banner_ad.html
67 |
68 | # ios
69 | /ios/Runner/GoogleService-info.plist
70 |
--------------------------------------------------------------------------------
/lib/provider/audio_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 | import 'package:tic_tac_toe/helper/audio_controller.dart';
4 |
5 | class AudioProvider with ChangeNotifier {
6 | AudioController audioController = AudioController();
7 |
8 | bool _canPlayAudio = true;
9 |
10 | AudioProvider.init() {
11 | // showLoading = true;
12 | // notifyListeners();
13 |
14 | getPrefs();
15 | }
16 |
17 | void getPrefs() async {
18 | SharedPreferences preferences = await SharedPreferences.getInstance();
19 | bool? val = preferences.getBool("isLight");
20 |
21 | if (val == null) {
22 | _canPlayAudio = true;
23 | } else {
24 | _canPlayAudio = val;
25 | }
26 |
27 | print("Can playAudio: $_canPlayAudio");
28 | // showLoading = false;
29 | notifyListeners();
30 | }
31 |
32 | void setPrefs(bool value) async {
33 | SharedPreferences preferences = await SharedPreferences.getInstance();
34 | preferences.setBool("canPlayAudio", value);
35 | }
36 |
37 | bool get canPlayAudio {
38 | return _canPlayAudio;
39 | }
40 |
41 | void setPlayAudio() {
42 | _canPlayAudio = !_canPlayAudio;
43 |
44 | setPrefs(_canPlayAudio);
45 | // audioController.playAudio = _canPlayAudio;
46 | notifyListeners();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/helper/animation_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:widget_and_text_animator/widget_and_text_animator.dart';
3 |
4 | class AnimationOnWidget extends StatefulWidget {
5 | final Widget child;
6 | final int? msDelay;
7 | final bool useIncomingEffect, hasRestEffect;
8 | final bool? doStateChange;
9 | final WidgetTransitionEffects? incomingEffect;
10 |
11 | const AnimationOnWidget({
12 | super.key,
13 | required this.child,
14 | this.msDelay,
15 | this.useIncomingEffect = false,
16 | this.hasRestEffect = false,
17 | this.doStateChange = false,
18 | this.incomingEffect,
19 | });
20 |
21 | @override
22 | State createState() => _AnimationOnWidgetState();
23 | }
24 |
25 | class _AnimationOnWidgetState extends State {
26 | @override
27 | Widget build(BuildContext context) {
28 | return WidgetAnimator(
29 | incomingEffect: widget.useIncomingEffect
30 | ? widget.incomingEffect
31 | : WidgetTransitionEffects.incomingScaleUp(
32 | delay: Duration(milliseconds: widget.msDelay!),
33 | curve: Curves.easeInOut,
34 | ),
35 | atRestEffect: widget.hasRestEffect ? WidgetRestingEffects.wave() : null,
36 | doStateChange: widget.doStateChange,
37 | child: widget.child,
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/constants.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | // Color primaryColor = const Color(0xFF404B47);
4 | // Color secondaryColor = const Color(0xFFCB974E);
5 | // Color bgColor = Colors.white;
6 |
7 | // Color primaryColor = const Color(0xFFB95300);
8 | // Color secondaryColor = const Color(0xFFF39C11);
9 | // Color bgColor = const Color(0xFFFBE5A9);
10 | // Color winColor = const Color(0xFF00FF7F);
11 |
12 | double defaultTextSize = 18;
13 | double borderRadius = 12;
14 |
15 | int msAnimationDelay = 150;
16 |
17 | String imageUrl =
18 | "https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80";
19 | String roomPath = "/room/";
20 | String gameLinkAndroid =
21 | "https://play.google.com/store/apps/details?id=com.princeappstudio.tic_tac_toe",
22 | gameLinkWeb = "https://tictactoe.princeappstudio.in";
23 | String gameLinkIos = "https://apps.apple.com/us/app/tic-tac-toe-online-2player/id6740833110";
24 |
25 | List shadow = [
26 | BoxShadow(
27 | color: Colors.grey.withOpacity(0.8),
28 | blurRadius: 8,
29 | offset: const Offset(0, 2),
30 | // blurStyle: BlurStyle.outer,
31 | ),
32 | ];
33 |
34 | /// Test Ad ids
35 | const String bannerId1 = "ca-app-pub-3940256099942544/6300978111";
36 | const String bannerId2 = "ca-app-pub-3940256099942544/6300978111";
37 | const String interstitialId1 = "ca-app-pub-3940256099942544/1033173712";
38 | const String interstitialId2 = "ca-app-pub-3940256099942544/1033173712";
39 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '13.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | target 'RunnerTests' do
36 | inherit! :search_paths
37 | end
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/lib/model/room.dart:
--------------------------------------------------------------------------------
1 | import 'package:tic_tac_toe/model/player.dart';
2 |
3 | class RoomData {
4 | final int code;
5 | final String roomOwnerId;
6 | final String turn;
7 | final DateTime createdAt;
8 | bool isStarted = false;
9 |
10 | final List players;
11 | final List board;
12 |
13 | final int round;
14 |
15 | RoomData(
16 | this.code,
17 | this.roomOwnerId,
18 | this.turn,
19 | this.players,
20 | this.board,
21 | this.round,
22 | this.createdAt,
23 | );
24 |
25 | factory RoomData.fromJson(json, int code) {
26 | List players = [];
27 | List.from(json!["players"]).forEach((element) {
28 | players.add(Player.fromRoomDataJson(element));
29 | });
30 |
31 | RoomData roomData = RoomData(
32 | code,
33 | json!["roomOwnerId"],
34 | json!["turn"],
35 | players,
36 | json!["board"],
37 | json!["round"],
38 | DateTime.parse(
39 | json!["createdAt"],
40 | ),
41 | );
42 | roomData.isStarted = json!["isStarted"];
43 |
44 | return roomData;
45 | }
46 |
47 | List