Browse Source

first commit

master
mohsen zamani 2 years ago
commit
4f84c66942
  1. 5
      .firebaserc
  2. 49
      .gitignore
  3. 10
      .metadata
  4. 65
      Auto_solver_README.md
  5. 21
      LICENSE
  6. 62
      README.md
  7. 29
      analysis_options.yaml
  8. 13
      android/.gitignore
  9. 68
      android/app/build.gradle
  10. 7
      android/app/src/debug/AndroidManifest.xml
  11. 34
      android/app/src/main/AndroidManifest.xml
  12. 6
      android/app/src/main/kotlin/com/souvikbiswas/my_flutter_puzzle/MainActivity.kt
  13. 12
      android/app/src/main/res/drawable-v21/launch_background.xml
  14. 12
      android/app/src/main/res/drawable/launch_background.xml
  15. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  16. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  17. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  18. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  19. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  20. 18
      android/app/src/main/res/values-night/styles.xml
  21. 18
      android/app/src/main/res/values/styles.xml
  22. 7
      android/app/src/profile/AndroidManifest.xml
  23. 31
      android/build.gradle
  24. 3
      android/gradle.properties
  25. 6
      android/gradle/wrapper/gradle-wrapper.properties
  26. 11
      android/settings.gradle
  27. BIN
      assets/images/default_image.png
  28. BIN
      assets/images/puzzle_side_image.png
  29. BIN
      assets/rive/dash.riv
  30. 31
      codemagic.yaml
  31. 16
      firebase.json
  32. BIN
      fonts/GoogleSans-Bold.ttf
  33. BIN
      fonts/GoogleSans-Medium.ttf
  34. BIN
      fonts/GoogleSans-Regular.ttf
  35. 34
      ios/.gitignore
  36. 26
      ios/Flutter/AppFrameworkInfo.plist
  37. 2
      ios/Flutter/Debug.xcconfig
  38. 2
      ios/Flutter/Release.xcconfig
  39. 41
      ios/Podfile
  40. 481
      ios/Runner.xcodeproj/project.pbxproj
  41. 7
      ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  42. 8
      ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  43. 8
      ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  44. 87
      ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  45. 7
      ios/Runner.xcworkspace/contents.xcworkspacedata
  46. 8
      ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  47. 8
      ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  48. 13
      ios/Runner/AppDelegate.swift
  49. 122
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
  50. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
  51. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
  52. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
  53. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
  54. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
  55. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
  56. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
  57. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
  58. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
  59. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
  60. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
  61. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
  62. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
  63. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
  64. BIN
      ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
  65. 23
      ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
  66. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
  67. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
  68. BIN
      ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
  69. 5
      ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
  70. 37
      ios/Runner/Base.lproj/LaunchScreen.storyboard
  71. 26
      ios/Runner/Base.lproj/Main.storyboard
  72. 47
      ios/Runner/Info.plist
  73. 1
      ios/Runner/Runner-Bridging-Header.h
  74. 33
      lib/application/notifiers/anonymous_auth_notifier.dart
  75. 56
      lib/application/notifiers/image_splitter_notifier.dart
  76. 13
      lib/application/notifiers/login_register_notifier.dart
  77. 320
      lib/application/notifiers/puzzle_notifier.dart
  78. 23
      lib/application/notifiers/puzzle_type_notifier.dart
  79. 38
      lib/application/notifiers/timer_notifier.dart
  80. 12
      lib/application/states/add_user_database_state.dart
  81. 644
      lib/application/states/add_user_database_state.freezed.dart
  82. 14
      lib/application/states/email_auth_state.dart
  83. 997
      lib/application/states/email_auth_state.freezed.dart
  84. 17
      lib/application/states/image_splitter_state.dart
  85. 687
      lib/application/states/image_splitter_state.freezed.dart
  86. 13
      lib/application/states/multi_puzzle_state.dart
  87. 831
      lib/application/states/multi_puzzle_state.freezed.dart
  88. 12
      lib/application/states/player_matching_state.dart
  89. 798
      lib/application/states/player_matching_state.freezed.dart
  90. 16
      lib/application/states/puzzle_state.dart
  91. 1465
      lib/application/states/puzzle_state.freezed.dart
  92. 45
      lib/main.dart
  93. 43
      lib/models/puzzle_data.dart
  94. 53
      lib/models/user_info.dart
  95. 35
      lib/providers.dart
  96. 7
      lib/res/palette.dart
  97. 1
      lib/res/puzzle_constants.dart
  98. 19
      lib/res/strings.dart
  99. 79
      lib/screens/level_list/screen/level_list_screen.dart
  100. 54
      lib/screens/login_screen_name.dart

5
.firebaserc

@ -0,0 +1,5 @@
{
"projects": {
"default": "flutterpuzzle-eaf89"
}
}

49
.gitignore

@ -0,0 +1,49 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
lib/firebase_options.dart
.firebase
.vscode/settings.json

10
.metadata

@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
channel: stable
project_type: app

65
Auto_solver_README.md

@ -0,0 +1,65 @@
# Auto solver implementation with A-star
The board is represented as a 1D array initially, which is converted to a 2D matrix(list of list of int).
Lets understand the implementation with a 3 * 3 slide puzzle. However, this will work for any nXn slide puzzle.
```
[1 2 3 4 5 6 7 8 ]
Let's use the A star algorithm to solve the 8 puzzle problem.
Let the initial state be
[]
Let the goal state be
[]
The search tree for the initial state will look like this
At each step, we move our empty block either left or down. We need to make sure we do not reach the original state through these moves, as they can lead to infinite loops.
There are two entities we need to keep into mind
G is the number of steps required to reach the goal state from the initial state. Estimated number of steps from current state to goal state.
H is Manhattan distance. It is the estimated distance to goal.
It can be calculated by adding the difference in the row and column for all the blocks of the initial state from the goal state.
Identify the path with the minimum g+h.
These are the variables in `puzzle_solver.dart` :
* queue - Priority queue
* visited - set
* goal_states - list
* root - object of Node class
* board: board
* previous: null,
* heuristic: manhattan(board, goalStates[currGoal])
* depth: int
>Each node can have maximum of 4 children, the graph fill further expand in a similar fashion with each child pointing to the parent using pointer.
>The g score here, which is the cost of the move will increase by 1 at each depth since each tile sliding to the blank space represents one move and in the end we need to get the optimal moves for the puzzle instance, this basically mean that we have to add 1 to the g score of the parent before storing it in the child nodes.
>Heuristics returns the number of tiles that are not in their final position
>Manhattan Distance of a tile is the distance or the number of slides/tiles away it is from it’s goal state.Thus, for a certain state the Manhattan distance will be the sum of the Manhattan distances of all the tiles except the blank tile.
Functions :
* rowColGoalStates() - Returns the goal states for the slide puzzle
queue is initialised with the first node object, the initial board configuration.
We loop till the queue isnt empty.
Inside the loop, we pop an element from the top.
If it possible to reach the goal state from that configuration

21
LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Soumi Bardhan, Souvik Biswas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

62
README.md

@ -0,0 +1,62 @@
# Flutter Puzzle
[![Codemagic build status](https://api.codemagic.io/apps/61f7d22dafa5dd12bdc7c1bf/61f7d22dafa5dd12bdc7c1be/status_badge.svg)](https://codemagic.io/apps/61f7d22dafa5dd12bdc7c1bf/61f7d22dafa5dd12bdc7c1be/latest_build)
> Web App link: https://flutterpuzzle.codemagic.app
![](screenshots/photo_mode.gif)
Playing a game or solving a puzzle is always fun when you share with friends. We have created a puzzle that consists of three main modes:
* **Normal mode:** The classic slide puzzle configuration.
* **Photo mode:** Ability to generate puzzles from any image uploaded.
* **Multiplayer mode:** Play with others in a competitive head-to-head multiplayer mode.
The puzzle also has an auto solver built-in, it uses the A* algorithm along with some pretty neat tricks to solve the puzzle in the lowest possible moves.
A full explanation of how the A* algorithm works is [here](https://youtu.be/nwtOWpSKGHc).
The puzzle uses **Rive** to display an animated Dash beside the puzzle.
**Riverpod** is used for state management inside the puzzle. The app has pretty challenging state management as there are three modes and the puzzle state is persisted across both the photo mode and the multiplayer mode.
We also used a color palette generator package that can create an entire color palette from just an image, it is used in photo mode to change the theme of the screen according to the image selected.
## Screenshots
**Normal mode:**
![](screenshots/puzzle_normal.png)
**Photo mode:**
![](screenshots/puzzle_photo.png)
**Multiplayer mode:**
![](screenshots/puzzle_multiplayer_1.png)
![](screenshots/puzzle_multiplayer.png)
## License
Copyright (c) 2022 Soumi Bardhan, Souvik Biswas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

29
analysis_options.yaml

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

13
android/.gitignore

@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks

68
android/app/build.gradle

@ -0,0 +1,68 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.souvikbiswas.my_flutter_puzzle"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

7
android/app/src/debug/AndroidManifest.xml

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.souvikbiswas.my_flutter_puzzle">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

34
android/app/src/main/AndroidManifest.xml

@ -0,0 +1,34 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.souvikbiswas.my_flutter_puzzle">
<application
android:label="my_flutter_puzzle"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>

6
android/app/src/main/kotlin/com/souvikbiswas/my_flutter_puzzle/MainActivity.kt

@ -0,0 +1,6 @@
package com.souvikbiswas.my_flutter_puzzle
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}

12
android/app/src/main/res/drawable-v21/launch_background.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

12
android/app/src/main/res/drawable/launch_background.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png

After

Width: 72  |  Height: 72  |  Size: 544 B

BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png

After

Width: 48  |  Height: 48  |  Size: 442 B

BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png

After

Width: 96  |  Height: 96  |  Size: 721 B

BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png

After

Width: 144  |  Height: 144  |  Size: 1.0 KiB

BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

After

Width: 192  |  Height: 192  |  Size: 1.4 KiB

18
android/app/src/main/res/values-night/styles.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

18
android/app/src/main/res/values/styles.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

7
android/app/src/profile/AndroidManifest.xml

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.souvikbiswas.my_flutter_puzzle">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

31
android/build.gradle

@ -0,0 +1,31 @@
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

3
android/gradle.properties

@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

6
android/gradle/wrapper/gradle-wrapper.properties

@ -0,0 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip

11
android/settings.gradle

@ -0,0 +1,11 @@
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

BIN
assets/images/default_image.png

After

Width: 1006  |  Height: 1007  |  Size: 1.2 MiB

BIN
assets/images/puzzle_side_image.png

After

Width: 1061  |  Height: 1400  |  Size: 791 KiB

BIN
assets/rive/dash.riv

31
codemagic.yaml

@ -0,0 +1,31 @@
workflows:
web-workflow:
name: Web Workflow
instance_type: mac_mini
max_build_duration: 60
environment:
flutter: stable
xcode: latest
cocoapods: default
triggering:
events:
- push
scripts:
- name: Install dependencies
script: flutter packages pub get
- name: Enable web
script: flutter config --enable-web
- name: Testing
script: flutter test
- name: Build web
script:
|
flutter build web --release
cd build/web
7z a -r ../web.zip ./*
artifacts:
- build/web.zip
publishing:
email:
recipients:
- sbis1999@gmail.com

16
firebase.json

@ -0,0 +1,16 @@
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}

BIN
fonts/GoogleSans-Bold.ttf

BIN
fonts/GoogleSans-Medium.ttf

BIN
fonts/GoogleSans-Regular.ttf

34
ios/.gitignore

@ -0,0 +1,34 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3

26
ios/Flutter/AppFrameworkInfo.plist

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
</dict>
</plist>

2
ios/Flutter/Debug.xcconfig

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

2
ios/Flutter/Release.xcconfig

@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"

41
ios/Podfile

@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

481
ios/Runner.xcodeproj/project.pbxproj

@ -0,0 +1,481 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.souvikbiswas.myFlutterPuzzle;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.souvikbiswas.myFlutterPuzzle;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.souvikbiswas.myFlutterPuzzle;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}

7
ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

8
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

8
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

87
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

7
ios/Runner.xcworkspace/contents.xcworkspacedata

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

8
ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

8
ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

13
ios/Runner/AppDelegate.swift

@ -0,0 +1,13 @@
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

122
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json

@ -0,0 +1,122 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png

After

Width: 1024  |  Height: 1024  |  Size: 11 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png

After

Width: 20  |  Height: 20  |  Size: 564 B

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png

After

Width: 40  |  Height: 40  |  Size: 1.3 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png

After

Width: 60  |  Height: 60  |  Size: 1.6 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png

After

Width: 29  |  Height: 29  |  Size: 1.0 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png

After

Width: 58  |  Height: 58  |  Size: 1.7 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png

After

Width: 87  |  Height: 87  |  Size: 1.9 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png

After

Width: 40  |  Height: 40  |  Size: 1.3 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png

After

Width: 80  |  Height: 80  |  Size: 1.9 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png

After

Width: 120  |  Height: 120  |  Size: 2.6 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png

After

Width: 120  |  Height: 120  |  Size: 2.6 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png

After

Width: 180  |  Height: 180  |  Size: 3.7 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png

After

Width: 76  |  Height: 76  |  Size: 1.8 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png

After

Width: 152  |  Height: 152  |  Size: 3.2 KiB

BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png

After

Width: 167  |  Height: 167  |  Size: 3.5 KiB

23
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png

After

Width: 1  |  Height: 1  |  Size: 68 B

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png

After

Width: 1  |  Height: 1  |  Size: 68 B

BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png

After

Width: 1  |  Height: 1  |  Size: 68 B

5
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md

@ -0,0 +1,5 @@
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.

37
ios/Runner/Base.lproj/LaunchScreen.storyboard

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>

26
ios/Runner/Base.lproj/Main.storyboard

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

47
ios/Runner/Info.plist

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>My Flutter Puzzle</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>my_flutter_puzzle</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>

1
ios/Runner/Runner-Bridging-Header.h

@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"

33
lib/application/notifiers/anonymous_auth_notifier.dart

@ -0,0 +1,33 @@
// import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:my_flutter_puzzle/application/states/anonymous_auth_state.dart';
// import 'package:my_flutter_puzzle/models/user_info.dart';
// import 'package:my_flutter_puzzle/utils/authentication_client.dart';
// import 'package:my_flutter_puzzle/utils/database_client.dart';
// class AnonymousAuthNotifier extends StateNotifier<AnonymousAuthState> {
// final AuthenticationClient _authentication;
// final DatabaseClient _databaseClient;
// AnonymousAuthNotifier(this._authentication, this._databaseClient)
// : super(const AnonymousAuthState());
// triggerAnonymousLogin({required String name}) async {
// state = const AnonymousAuthState.processing();
// try {
// final user = await _authentication.signInAnonymously(name: name);
// state = AnonymousAuthState.done(user);
// state = const AnonymousAuthState.storingInfo();
// final userData = UserData(
// uid: user.uid,
// name: user.displayName!,
// username: '${user.displayName!.split(' ')[0].toLowerCase()}@${user.uid}',
// timestamp: DateTime.now().millisecondsSinceEpoch,
// );
// await _databaseClient.addUser(userInfo: userData);
// state = AnonymousAuthState.storageDone(userData);
// } catch (e) {
// state = AnonymousAuthState.error(message: e.toString());
// }
// }
// }

56
lib/application/notifiers/image_splitter_notifier.dart

@ -0,0 +1,56 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:image_picker/image_picker.dart';
import 'package:my_flutter_puzzle/application/states/image_splitter_state.dart';
import 'package:my_flutter_puzzle/res/strings.dart';
import 'package:my_flutter_puzzle/utils/image_splitter.dart';
class ImageSplitterNotifier extends StateNotifier<ImageSplitterState> {
final ImageSplitter _splitter;
ImageSplitterNotifier(this._splitter) : super(const ImageSplitterState());
getInitialImages({required int puzzleSize}) async {
state = const ImageSplitterState.generating();
try {
final data = await rootBundle.load(defaultImagePath);
final imageBytes = data.buffer.asUint8List();
final _splitter = ImageSplitter();
final palette =
await _splitter.getImagePalette(const AssetImage(defaultImagePath));
final images = await _splitter.runSplitterIsolate(imageBytes, puzzleSize);
state = ImageSplitterState.complete(
Image.asset(defaultImagePath), images, palette);
} catch (e) {
state = ImageSplitterState.error(message: e.toString());
}
}
generateImages({required ImagePicker picker, required int puzzleSize}) async {
state = const ImageSplitterState.generating();
try {
final imageBytesPalette = await _splitter.getImage(picker: picker);
if (imageBytesPalette != null) {
final image = imageBytesPalette.item1;
final imageBytes = imageBytesPalette.item2;
final palette = imageBytesPalette.item3;
log('Image tuple retrieved');
final images =
await _splitter.runSplitterIsolate(imageBytes, puzzleSize);
state = ImageSplitterState.complete(image, images, palette);
}
} catch (e) {
debugPrint('Error: $e');
state = ImageSplitterState.error(message: e.toString());
}
}
}

13
lib/application/notifiers/login_register_notifier.dart

@ -0,0 +1,13 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
class IsLoginNotifier extends StateNotifier<bool> {
IsLoginNotifier() : super(true);
selectLogin() {
state = true;
}
selectRegister() {
state = false;
}
}

320
lib/application/notifiers/puzzle_notifier.dart

@ -0,0 +1,320 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:my_flutter_puzzle/application/states/puzzle_state.dart';
import 'package:my_flutter_puzzle/models/puzzle_data.dart';
import '../../utils/puzzle_solver.dart';
class PuzzleNotifier extends StateNotifier<PuzzleState> {
final PuzzleSolverClient _solverClient;
PuzzleNotifier(this._solverClient) : super(const PuzzleState());
// List<List<int>>? _board2D;
// List<int>? myList;
// int _moves = 0;
// final _puzzleSize = 3;
// final int _animationSpeedInMilliseconds = 300;
// bool _isComputing = false;
// bool _isAutoSolving = false;
// bool _isSolved = false;
// Map<int, FractionalOffset>? _offsetMap;
final List<int> _solvedList = [];
generateSolvedList() {
var _puzzleSize = _solverClient.size;
for (int i = 1; i < _puzzleSize * _puzzleSize; i++) {
_solvedList.add(i);
}
_solvedList.add(0);
}
generateInitialPuzzle() {
List<int> solvedList = [];
var _puzzleSize = _solverClient.size;
for (int i = 1; i < _puzzleSize * _puzzleSize; i++) {
solvedList.add(i);
}
solvedList.add(0);
final initialOffsetMap = createOffset(solvedList);
final initialPuzzleData = PuzzleData(
board2D: [],
board1D: solvedList,
offsetMap: initialOffsetMap,
moves: 0,
tiles: 0,
puzzleSize: _puzzleSize,
);
return initialPuzzleData;
}
restartPuzzle() async {
final initialPuzzle = generateInitialPuzzle();
state = PuzzleState.scrambling(initialPuzzle);
await Future.delayed(const Duration(seconds: 2));
initializePuzzle(initialPuzzleData: initialPuzzle);
}
initializePuzzle({required PuzzleData initialPuzzleData}) {
state = const PuzzleState.initializing();
_solvedList.clear();
_solverClient.setSize = initialPuzzleData.puzzleSize;
generateSolvedList();
int start = 0;
const period = Duration(milliseconds: 1200);
PuzzleData currentPuzzleData = initialPuzzleData;
currentPuzzleData = scrambleBoard(currentPuzzleData);
Timer.periodic(period, (Timer timer) async {
currentPuzzleData = scrambleBoard(currentPuzzleData);
start++;
if (start == 2) {
timer.cancel();
await Future.delayed(const Duration(milliseconds: 1000));
state = PuzzleState.current(currentPuzzleData);
}
});
}
Map<int, FractionalOffset> createOffset(List<int> board) {
Map<int, FractionalOffset> offsetMap = {};
int j = 0;
log('BOARD: $board');
for (int i = 0; i < board.length; i++) {
var _puzzleSize = _solverClient.size;
final xMod = i % _puzzleSize;
double x = xMod / (_puzzleSize - 1);
if (x % i == 0 && i != 0) j++;
int yMod = j % _puzzleSize;
double y = yMod / (_puzzleSize - 1);
offsetMap.addEntries([
MapEntry<int, FractionalOffset>(
board[i],
FractionalOffset(x, y),
)
]);
}
log('INITIAL OFFSET MAP: $offsetMap');
return offsetMap;
}
onClick({required int index, required PuzzleData prev}) {
log('-----------------------');
log('Tapped index: $index');
var board1D = prev.board1D;
var offsetMap = prev.offsetMap;
var _puzzleSize = prev.puzzleSize;
var _moves = prev.moves;
int emptyTilePosIndex = board1D.indexOf(0);
int emptyTilePosRow = emptyTilePosIndex ~/ _puzzleSize;
int emptyTilePosCol = emptyTilePosIndex % _puzzleSize;
int currentTileRow = index ~/ _puzzleSize;
int currentTileCol = index % _puzzleSize;
//current element moves up
if ((currentTileRow - 1 == emptyTilePosRow) &&
(currentTileCol == emptyTilePosCol)) {
board1D[emptyTilePosIndex] = board1D[index];
board1D[index] = 0;
_moves++;
}
//current element moves down
else if ((currentTileRow + 1 == emptyTilePosRow) &&
(currentTileCol == emptyTilePosCol)) {
board1D[emptyTilePosIndex] = board1D[index];
board1D[index] = 0;
_moves++;
}
//current element moves left
else if ((currentTileRow == emptyTilePosRow) &&
(currentTileCol + 1 == emptyTilePosCol)) {
board1D[emptyTilePosIndex] = board1D[index];
board1D[index] = 0;
_moves++;
}
//current element moves right
else if ((currentTileRow == emptyTilePosRow) &&
(currentTileCol - 1 == emptyTilePosCol)) {
board1D[emptyTilePosIndex] = board1D[index];
board1D[index] = 0;
_moves++;
} else {
if (currentTileCol == emptyTilePosCol) {
int low;
int high;
// multiple elements move up
if (emptyTilePosRow < currentTileRow) {
low = emptyTilePosRow;
high = currentTileRow;
int i = low;
while (i < high) {
board1D[(i * _puzzleSize) + emptyTilePosCol] =
board1D[(((i + 1) * _puzzleSize) + emptyTilePosCol)];
i += 1;
}
board1D[(high * _puzzleSize) + emptyTilePosCol] = 0;
_moves++;
}
//multiple elements move down
else {
low = emptyTilePosRow;
high = currentTileRow;
int i = low;
while (i > high) {
board1D[(i * _puzzleSize) + emptyTilePosCol] =
board1D[(((i - 1) * _puzzleSize) + emptyTilePosCol)];
i -= 1;
}
board1D[(high * _puzzleSize) + emptyTilePosCol] = 0;
_moves++;
}
}
// multiple elements move left or right
if (currentTileRow == emptyTilePosRow) {
int low;
int high;
// multiple elements move left
if (emptyTilePosCol < currentTileCol) {
low = emptyTilePosCol;
high = currentTileCol;
int i = low;
while (i < high) {
board1D[(emptyTilePosRow * _puzzleSize) + i] =
board1D[(emptyTilePosRow * _puzzleSize) + (i + 1)];
i += 1;
}
board1D[high + (emptyTilePosRow * _puzzleSize)] = 0;
_moves++;
}
//multiple elements move right
else {
low = emptyTilePosCol;
high = currentTileCol;
int i = low;
while (i > high) {
board1D[(i + (emptyTilePosRow * _puzzleSize))] =
board1D[(i - 1) + (emptyTilePosRow * _puzzleSize)];
i -= 1;
}
board1D[high + (emptyTilePosRow * _puzzleSize)] = 0;
_moves++;
}
}
}
updateOffset(board1D, _puzzleSize, offsetMap);
var tiles = calculateCorrectTiles(board: board1D);
PuzzleData updatedData = PuzzleData(
board2D: prev.board2D,
board1D: board1D,
offsetMap: offsetMap,
moves: _moves,
tiles: tiles,
puzzleSize: _puzzleSize,
);
state = PuzzleState.current(updatedData);
if (listEquals(board1D, _solvedList)) {
state = PuzzleState.solved(updatedData);
}
log('List: $board1D');
log('-----------------------');
}
int calculateCorrectTiles({required List<int> board}) {
int correctTiles = 0;
for (int i = 0; i < _solverClient.size * _solverClient.size; i++) {
if (board[i] != _solvedList[i] && board[i] != 0) {
correctTiles++;
}
}
return correctTiles;
}
void updateOffset(
List<int> board1D,
int size,
Map<int, FractionalOffset> offsetMap,
) {
int j = 0;
for (int i = 0; i < board1D.length; i++) {
final xMod = i % size;
double x = xMod / (size - 1);
if (x % i == 0 && i != 0) j++;
int yMod = j % size;
double y = yMod / (size - 1);
offsetMap[board1D[i]] = FractionalOffset(x, y);
}
log('OFFSET MAP: $offsetMap');
log('BOARD: $board1D');
}
scrambleBoard(PuzzleData puzzleData) {
final generated2DBoard = _solverClient.createRandomBoard();
final generated1DBoard = _solverClient.convertTo1D(generated2DBoard);
updateOffset(generated1DBoard, puzzleData.puzzleSize, puzzleData.offsetMap);
var tiles = calculateCorrectTiles(board: generated1DBoard);
final newPuzzle = PuzzleData(
board2D: generated2DBoard,
board1D: generated1DBoard,
offsetMap: puzzleData.offsetMap,
moves: 0,
tiles: tiles,
puzzleSize: puzzleData.puzzleSize,
);
state = PuzzleState.scrambling(newPuzzle);
return newPuzzle;
}
}

23
lib/application/notifiers/puzzle_type_notifier.dart

@ -0,0 +1,23 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
enum PuzzleType {
normal,
photo,
multiplayer,
}
class PuzzleTypeNotifier extends StateNotifier<PuzzleType> {
PuzzleTypeNotifier() : super(PuzzleType.normal);
changeToNormal() {
state = PuzzleType.normal;
}
changeToPhoto() {
state = PuzzleType.photo;
}
changeToMultiplayer() {
state = PuzzleType.multiplayer;
}
}

38
lib/application/notifiers/timer_notifier.dart

@ -0,0 +1,38 @@
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class TimerNotifier extends StateNotifier<String> {
TimerNotifier() : super('00:00:00');
Timer? _timer;
final _stopwatch = Stopwatch();
@override
void dispose() {
_stopwatch.stop();
_timer?.cancel();
super.dispose();
}
startTimer() {
_stopwatch.start();
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
state = getDurationString(_stopwatch.elapsed);
});
}
stopTimer() {
_stopwatch.stop();
_stopwatch.reset();
state = getDurationString(_stopwatch.elapsed);
_timer?.cancel();
}
String getDurationString(Duration duration) {
String twoDigits(int n) => n.toString().padLeft(2, "0");
String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
return "${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds";
}
}

12
lib/application/states/add_user_database_state.dart

@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:my_flutter_puzzle/models/user_info.dart';
part 'add_user_database_state.freezed.dart';
@freezed
class AddUserDatabaseState with _$AddUserDatabaseState {
const factory AddUserDatabaseState() = AddUserDatabaseIdle;
const factory AddUserDatabaseState.processing() = AddUserDatabaseProcessing;
const factory AddUserDatabaseState.done(EUserData user) = AddUserDatabaseDone;
const factory AddUserDatabaseState.error({String? message}) = AddUserDatabaseError;
}

644
lib/application/states/add_user_database_state.freezed.dart

@ -0,0 +1,644 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'add_user_database_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$AddUserDatabaseStateTearOff {
const _$AddUserDatabaseStateTearOff();
AddUserDatabaseIdle call() {
return const AddUserDatabaseIdle();
}
AddUserDatabaseProcessing processing() {
return const AddUserDatabaseProcessing();
}
AddUserDatabaseDone done(EUserData user) {
return AddUserDatabaseDone(
user,
);
}
AddUserDatabaseError error({String? message}) {
return AddUserDatabaseError(
message: message,
);
}
}
/// @nodoc
const $AddUserDatabaseState = _$AddUserDatabaseStateTearOff();
/// @nodoc
mixin _$AddUserDatabaseState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function(String? message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value) $default, {
required TResult Function(AddUserDatabaseProcessing value) processing,
required TResult Function(AddUserDatabaseDone value) done,
required TResult Function(AddUserDatabaseError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AddUserDatabaseStateCopyWith<$Res> {
factory $AddUserDatabaseStateCopyWith(AddUserDatabaseState value,
$Res Function(AddUserDatabaseState) then) =
_$AddUserDatabaseStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$AddUserDatabaseStateCopyWithImpl<$Res>
implements $AddUserDatabaseStateCopyWith<$Res> {
_$AddUserDatabaseStateCopyWithImpl(this._value, this._then);
final AddUserDatabaseState _value;
// ignore: unused_field
final $Res Function(AddUserDatabaseState) _then;
}
/// @nodoc
abstract class $AddUserDatabaseIdleCopyWith<$Res> {
factory $AddUserDatabaseIdleCopyWith(
AddUserDatabaseIdle value, $Res Function(AddUserDatabaseIdle) then) =
_$AddUserDatabaseIdleCopyWithImpl<$Res>;
}
/// @nodoc
class _$AddUserDatabaseIdleCopyWithImpl<$Res>
extends _$AddUserDatabaseStateCopyWithImpl<$Res>
implements $AddUserDatabaseIdleCopyWith<$Res> {
_$AddUserDatabaseIdleCopyWithImpl(
AddUserDatabaseIdle _value, $Res Function(AddUserDatabaseIdle) _then)
: super(_value, (v) => _then(v as AddUserDatabaseIdle));
@override
AddUserDatabaseIdle get _value => super._value as AddUserDatabaseIdle;
}
/// @nodoc
class _$AddUserDatabaseIdle implements AddUserDatabaseIdle {
const _$AddUserDatabaseIdle();
@override
String toString() {
return 'AddUserDatabaseState()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is AddUserDatabaseIdle);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function(String? message) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value) $default, {
required TResult Function(AddUserDatabaseProcessing value) processing,
required TResult Function(AddUserDatabaseDone value) done,
required TResult Function(AddUserDatabaseError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class AddUserDatabaseIdle implements AddUserDatabaseState {
const factory AddUserDatabaseIdle() = _$AddUserDatabaseIdle;
}
/// @nodoc
abstract class $AddUserDatabaseProcessingCopyWith<$Res> {
factory $AddUserDatabaseProcessingCopyWith(AddUserDatabaseProcessing value,
$Res Function(AddUserDatabaseProcessing) then) =
_$AddUserDatabaseProcessingCopyWithImpl<$Res>;
}
/// @nodoc
class _$AddUserDatabaseProcessingCopyWithImpl<$Res>
extends _$AddUserDatabaseStateCopyWithImpl<$Res>
implements $AddUserDatabaseProcessingCopyWith<$Res> {
_$AddUserDatabaseProcessingCopyWithImpl(AddUserDatabaseProcessing _value,
$Res Function(AddUserDatabaseProcessing) _then)
: super(_value, (v) => _then(v as AddUserDatabaseProcessing));
@override
AddUserDatabaseProcessing get _value =>
super._value as AddUserDatabaseProcessing;
}
/// @nodoc
class _$AddUserDatabaseProcessing implements AddUserDatabaseProcessing {
const _$AddUserDatabaseProcessing();
@override
String toString() {
return 'AddUserDatabaseState.processing()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AddUserDatabaseProcessing);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function(String? message) error,
}) {
return processing();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
}) {
return processing?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value) $default, {
required TResult Function(AddUserDatabaseProcessing value) processing,
required TResult Function(AddUserDatabaseDone value) done,
required TResult Function(AddUserDatabaseError value) error,
}) {
return processing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
}) {
return processing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing(this);
}
return orElse();
}
}
abstract class AddUserDatabaseProcessing implements AddUserDatabaseState {
const factory AddUserDatabaseProcessing() = _$AddUserDatabaseProcessing;
}
/// @nodoc
abstract class $AddUserDatabaseDoneCopyWith<$Res> {
factory $AddUserDatabaseDoneCopyWith(
AddUserDatabaseDone value, $Res Function(AddUserDatabaseDone) then) =
_$AddUserDatabaseDoneCopyWithImpl<$Res>;
$Res call({EUserData user});
}
/// @nodoc
class _$AddUserDatabaseDoneCopyWithImpl<$Res>
extends _$AddUserDatabaseStateCopyWithImpl<$Res>
implements $AddUserDatabaseDoneCopyWith<$Res> {
_$AddUserDatabaseDoneCopyWithImpl(
AddUserDatabaseDone _value, $Res Function(AddUserDatabaseDone) _then)
: super(_value, (v) => _then(v as AddUserDatabaseDone));
@override
AddUserDatabaseDone get _value => super._value as AddUserDatabaseDone;
@override
$Res call({
Object? user = freezed,
}) {
return _then(AddUserDatabaseDone(
user == freezed
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as EUserData,
));
}
}
/// @nodoc
class _$AddUserDatabaseDone implements AddUserDatabaseDone {
const _$AddUserDatabaseDone(this.user);
@override
final EUserData user;
@override
String toString() {
return 'AddUserDatabaseState.done(user: $user)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AddUserDatabaseDone &&
const DeepCollectionEquality().equals(other.user, user));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(user));
@JsonKey(ignore: true)
@override
$AddUserDatabaseDoneCopyWith<AddUserDatabaseDone> get copyWith =>
_$AddUserDatabaseDoneCopyWithImpl<AddUserDatabaseDone>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function(String? message) error,
}) {
return done(user);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
}) {
return done?.call(user);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (done != null) {
return done(user);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value) $default, {
required TResult Function(AddUserDatabaseProcessing value) processing,
required TResult Function(AddUserDatabaseDone value) done,
required TResult Function(AddUserDatabaseError value) error,
}) {
return done(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
}) {
return done?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
required TResult orElse(),
}) {
if (done != null) {
return done(this);
}
return orElse();
}
}
abstract class AddUserDatabaseDone implements AddUserDatabaseState {
const factory AddUserDatabaseDone(EUserData user) = _$AddUserDatabaseDone;
EUserData get user;
@JsonKey(ignore: true)
$AddUserDatabaseDoneCopyWith<AddUserDatabaseDone> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AddUserDatabaseErrorCopyWith<$Res> {
factory $AddUserDatabaseErrorCopyWith(AddUserDatabaseError value,
$Res Function(AddUserDatabaseError) then) =
_$AddUserDatabaseErrorCopyWithImpl<$Res>;
$Res call({String? message});
}
/// @nodoc
class _$AddUserDatabaseErrorCopyWithImpl<$Res>
extends _$AddUserDatabaseStateCopyWithImpl<$Res>
implements $AddUserDatabaseErrorCopyWith<$Res> {
_$AddUserDatabaseErrorCopyWithImpl(
AddUserDatabaseError _value, $Res Function(AddUserDatabaseError) _then)
: super(_value, (v) => _then(v as AddUserDatabaseError));
@override
AddUserDatabaseError get _value => super._value as AddUserDatabaseError;
@override
$Res call({
Object? message = freezed,
}) {
return _then(AddUserDatabaseError(
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$AddUserDatabaseError implements AddUserDatabaseError {
const _$AddUserDatabaseError({this.message});
@override
final String? message;
@override
String toString() {
return 'AddUserDatabaseState.error(message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AddUserDatabaseError &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$AddUserDatabaseErrorCopyWith<AddUserDatabaseError> get copyWith =>
_$AddUserDatabaseErrorCopyWithImpl<AddUserDatabaseError>(
this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function(String? message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value) $default, {
required TResult Function(AddUserDatabaseProcessing value) processing,
required TResult Function(AddUserDatabaseDone value) done,
required TResult Function(AddUserDatabaseError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(AddUserDatabaseIdle value)? $default, {
TResult Function(AddUserDatabaseProcessing value)? processing,
TResult Function(AddUserDatabaseDone value)? done,
TResult Function(AddUserDatabaseError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class AddUserDatabaseError implements AddUserDatabaseState {
const factory AddUserDatabaseError({String? message}) =
_$AddUserDatabaseError;
String? get message;
@JsonKey(ignore: true)
$AddUserDatabaseErrorCopyWith<AddUserDatabaseError> get copyWith =>
throw _privateConstructorUsedError;
}

14
lib/application/states/email_auth_state.dart

@ -0,0 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:my_flutter_puzzle/models/user_info.dart';
part 'email_auth_state.freezed.dart';
@freezed
class EmailAuthState with _$EmailAuthState {
const factory EmailAuthState() = EmailAuthIdle;
const factory EmailAuthState.processing() = EmailAuthProcessing;
const factory EmailAuthState.done(EUserData user) = EmailAuthDone;
const factory EmailAuthState.storingInfo() = UserStorageProcessing;
const factory EmailAuthState.storageDone(EUserData userData) = UserStorageDone;
const factory EmailAuthState.error({String? message}) = EmailAuthError;
}

997
lib/application/states/email_auth_state.freezed.dart

@ -0,0 +1,997 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'email_auth_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$EmailAuthStateTearOff {
const _$EmailAuthStateTearOff();
EmailAuthIdle call() {
return const EmailAuthIdle();
}
EmailAuthProcessing processing() {
return const EmailAuthProcessing();
}
EmailAuthDone done(EUserData user) {
return EmailAuthDone(
user,
);
}
UserStorageProcessing storingInfo() {
return const UserStorageProcessing();
}
UserStorageDone storageDone(EUserData userData) {
return UserStorageDone(
userData,
);
}
EmailAuthError error({String? message}) {
return EmailAuthError(
message: message,
);
}
}
/// @nodoc
const $EmailAuthState = _$EmailAuthStateTearOff();
/// @nodoc
mixin _$EmailAuthState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $EmailAuthStateCopyWith<$Res> {
factory $EmailAuthStateCopyWith(
EmailAuthState value, $Res Function(EmailAuthState) then) =
_$EmailAuthStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$EmailAuthStateCopyWithImpl<$Res>
implements $EmailAuthStateCopyWith<$Res> {
_$EmailAuthStateCopyWithImpl(this._value, this._then);
final EmailAuthState _value;
// ignore: unused_field
final $Res Function(EmailAuthState) _then;
}
/// @nodoc
abstract class $EmailAuthIdleCopyWith<$Res> {
factory $EmailAuthIdleCopyWith(
EmailAuthIdle value, $Res Function(EmailAuthIdle) then) =
_$EmailAuthIdleCopyWithImpl<$Res>;
}
/// @nodoc
class _$EmailAuthIdleCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $EmailAuthIdleCopyWith<$Res> {
_$EmailAuthIdleCopyWithImpl(
EmailAuthIdle _value, $Res Function(EmailAuthIdle) _then)
: super(_value, (v) => _then(v as EmailAuthIdle));
@override
EmailAuthIdle get _value => super._value as EmailAuthIdle;
}
/// @nodoc
class _$EmailAuthIdle implements EmailAuthIdle {
const _$EmailAuthIdle();
@override
String toString() {
return 'EmailAuthState()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is EmailAuthIdle);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class EmailAuthIdle implements EmailAuthState {
const factory EmailAuthIdle() = _$EmailAuthIdle;
}
/// @nodoc
abstract class $EmailAuthProcessingCopyWith<$Res> {
factory $EmailAuthProcessingCopyWith(
EmailAuthProcessing value, $Res Function(EmailAuthProcessing) then) =
_$EmailAuthProcessingCopyWithImpl<$Res>;
}
/// @nodoc
class _$EmailAuthProcessingCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $EmailAuthProcessingCopyWith<$Res> {
_$EmailAuthProcessingCopyWithImpl(
EmailAuthProcessing _value, $Res Function(EmailAuthProcessing) _then)
: super(_value, (v) => _then(v as EmailAuthProcessing));
@override
EmailAuthProcessing get _value => super._value as EmailAuthProcessing;
}
/// @nodoc
class _$EmailAuthProcessing implements EmailAuthProcessing {
const _$EmailAuthProcessing();
@override
String toString() {
return 'EmailAuthState.processing()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is EmailAuthProcessing);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return processing();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return processing?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return processing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return processing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing(this);
}
return orElse();
}
}
abstract class EmailAuthProcessing implements EmailAuthState {
const factory EmailAuthProcessing() = _$EmailAuthProcessing;
}
/// @nodoc
abstract class $EmailAuthDoneCopyWith<$Res> {
factory $EmailAuthDoneCopyWith(
EmailAuthDone value, $Res Function(EmailAuthDone) then) =
_$EmailAuthDoneCopyWithImpl<$Res>;
$Res call({EUserData user});
}
/// @nodoc
class _$EmailAuthDoneCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $EmailAuthDoneCopyWith<$Res> {
_$EmailAuthDoneCopyWithImpl(
EmailAuthDone _value, $Res Function(EmailAuthDone) _then)
: super(_value, (v) => _then(v as EmailAuthDone));
@override
EmailAuthDone get _value => super._value as EmailAuthDone;
@override
$Res call({
Object? user = freezed,
}) {
return _then(EmailAuthDone(
user == freezed
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as EUserData,
));
}
}
/// @nodoc
class _$EmailAuthDone implements EmailAuthDone {
const _$EmailAuthDone(this.user);
@override
final EUserData user;
@override
String toString() {
return 'EmailAuthState.done(user: $user)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is EmailAuthDone &&
const DeepCollectionEquality().equals(other.user, user));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(user));
@JsonKey(ignore: true)
@override
$EmailAuthDoneCopyWith<EmailAuthDone> get copyWith =>
_$EmailAuthDoneCopyWithImpl<EmailAuthDone>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return done(user);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return done?.call(user);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (done != null) {
return done(user);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return done(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return done?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if (done != null) {
return done(this);
}
return orElse();
}
}
abstract class EmailAuthDone implements EmailAuthState {
const factory EmailAuthDone(EUserData user) = _$EmailAuthDone;
EUserData get user;
@JsonKey(ignore: true)
$EmailAuthDoneCopyWith<EmailAuthDone> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserStorageProcessingCopyWith<$Res> {
factory $UserStorageProcessingCopyWith(UserStorageProcessing value,
$Res Function(UserStorageProcessing) then) =
_$UserStorageProcessingCopyWithImpl<$Res>;
}
/// @nodoc
class _$UserStorageProcessingCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $UserStorageProcessingCopyWith<$Res> {
_$UserStorageProcessingCopyWithImpl(
UserStorageProcessing _value, $Res Function(UserStorageProcessing) _then)
: super(_value, (v) => _then(v as UserStorageProcessing));
@override
UserStorageProcessing get _value => super._value as UserStorageProcessing;
}
/// @nodoc
class _$UserStorageProcessing implements UserStorageProcessing {
const _$UserStorageProcessing();
@override
String toString() {
return 'EmailAuthState.storingInfo()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is UserStorageProcessing);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return storingInfo();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return storingInfo?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (storingInfo != null) {
return storingInfo();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return storingInfo(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return storingInfo?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if (storingInfo != null) {
return storingInfo(this);
}
return orElse();
}
}
abstract class UserStorageProcessing implements EmailAuthState {
const factory UserStorageProcessing() = _$UserStorageProcessing;
}
/// @nodoc
abstract class $UserStorageDoneCopyWith<$Res> {
factory $UserStorageDoneCopyWith(
UserStorageDone value, $Res Function(UserStorageDone) then) =
_$UserStorageDoneCopyWithImpl<$Res>;
$Res call({EUserData userData});
}
/// @nodoc
class _$UserStorageDoneCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $UserStorageDoneCopyWith<$Res> {
_$UserStorageDoneCopyWithImpl(
UserStorageDone _value, $Res Function(UserStorageDone) _then)
: super(_value, (v) => _then(v as UserStorageDone));
@override
UserStorageDone get _value => super._value as UserStorageDone;
@override
$Res call({
Object? userData = freezed,
}) {
return _then(UserStorageDone(
userData == freezed
? _value.userData
: userData // ignore: cast_nullable_to_non_nullable
as EUserData,
));
}
}
/// @nodoc
class _$UserStorageDone implements UserStorageDone {
const _$UserStorageDone(this.userData);
@override
final EUserData userData;
@override
String toString() {
return 'EmailAuthState.storageDone(userData: $userData)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is UserStorageDone &&
const DeepCollectionEquality().equals(other.userData, userData));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(userData));
@JsonKey(ignore: true)
@override
$UserStorageDoneCopyWith<UserStorageDone> get copyWith =>
_$UserStorageDoneCopyWithImpl<UserStorageDone>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return storageDone(userData);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return storageDone?.call(userData);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (storageDone != null) {
return storageDone(userData);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return storageDone(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return storageDone?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if (storageDone != null) {
return storageDone(this);
}
return orElse();
}
}
abstract class UserStorageDone implements EmailAuthState {
const factory UserStorageDone(EUserData userData) = _$UserStorageDone;
EUserData get userData;
@JsonKey(ignore: true)
$UserStorageDoneCopyWith<UserStorageDone> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $EmailAuthErrorCopyWith<$Res> {
factory $EmailAuthErrorCopyWith(
EmailAuthError value, $Res Function(EmailAuthError) then) =
_$EmailAuthErrorCopyWithImpl<$Res>;
$Res call({String? message});
}
/// @nodoc
class _$EmailAuthErrorCopyWithImpl<$Res>
extends _$EmailAuthStateCopyWithImpl<$Res>
implements $EmailAuthErrorCopyWith<$Res> {
_$EmailAuthErrorCopyWithImpl(
EmailAuthError _value, $Res Function(EmailAuthError) _then)
: super(_value, (v) => _then(v as EmailAuthError));
@override
EmailAuthError get _value => super._value as EmailAuthError;
@override
$Res call({
Object? message = freezed,
}) {
return _then(EmailAuthError(
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$EmailAuthError implements EmailAuthError {
const _$EmailAuthError({this.message});
@override
final String? message;
@override
String toString() {
return 'EmailAuthState.error(message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is EmailAuthError &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$EmailAuthErrorCopyWith<EmailAuthError> get copyWith =>
_$EmailAuthErrorCopyWithImpl<EmailAuthError>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(EUserData user) done,
required TResult Function() storingInfo,
required TResult Function(EUserData userData) storageDone,
required TResult Function(String? message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(EUserData user)? done,
TResult Function()? storingInfo,
TResult Function(EUserData userData)? storageDone,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(EmailAuthIdle value) $default, {
required TResult Function(EmailAuthProcessing value) processing,
required TResult Function(EmailAuthDone value) done,
required TResult Function(UserStorageProcessing value) storingInfo,
required TResult Function(UserStorageDone value) storageDone,
required TResult Function(EmailAuthError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(EmailAuthIdle value)? $default, {
TResult Function(EmailAuthProcessing value)? processing,
TResult Function(EmailAuthDone value)? done,
TResult Function(UserStorageProcessing value)? storingInfo,
TResult Function(UserStorageDone value)? storageDone,
TResult Function(EmailAuthError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class EmailAuthError implements EmailAuthState {
const factory EmailAuthError({String? message}) = _$EmailAuthError;
String? get message;
@JsonKey(ignore: true)
$EmailAuthErrorCopyWith<EmailAuthError> get copyWith =>
throw _privateConstructorUsedError;
}

17
lib/application/states/image_splitter_state.dart

@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:palette_generator/palette_generator.dart';
part 'image_splitter_state.freezed.dart';
@freezed
class ImageSplitterState with _$ImageSplitterState {
const factory ImageSplitterState() = ImageSplitterIdle;
const factory ImageSplitterState.generating() = ImageSplitterGenerating;
const factory ImageSplitterState.complete(Image image, List<Image> images, PaletteGenerator palette) =
ImageSplitterComplete;
const factory ImageSplitterState.error({String? message}) = ImageSplitterError;
}

687
lib/application/states/image_splitter_state.freezed.dart

@ -0,0 +1,687 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'image_splitter_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$ImageSplitterStateTearOff {
const _$ImageSplitterStateTearOff();
ImageSplitterIdle call() {
return const ImageSplitterIdle();
}
ImageSplitterGenerating generating() {
return const ImageSplitterGenerating();
}
ImageSplitterComplete complete(
Image image, List<Image> images, PaletteGenerator palette) {
return ImageSplitterComplete(
image,
images,
palette,
);
}
ImageSplitterError error({String? message}) {
return ImageSplitterError(
message: message,
);
}
}
/// @nodoc
const $ImageSplitterState = _$ImageSplitterStateTearOff();
/// @nodoc
mixin _$ImageSplitterState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() generating,
required TResult Function(
Image image, List<Image> images, PaletteGenerator palette)
complete,
required TResult Function(String? message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(ImageSplitterIdle value) $default, {
required TResult Function(ImageSplitterGenerating value) generating,
required TResult Function(ImageSplitterComplete value) complete,
required TResult Function(ImageSplitterError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ImageSplitterStateCopyWith<$Res> {
factory $ImageSplitterStateCopyWith(
ImageSplitterState value, $Res Function(ImageSplitterState) then) =
_$ImageSplitterStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$ImageSplitterStateCopyWithImpl<$Res>
implements $ImageSplitterStateCopyWith<$Res> {
_$ImageSplitterStateCopyWithImpl(this._value, this._then);
final ImageSplitterState _value;
// ignore: unused_field
final $Res Function(ImageSplitterState) _then;
}
/// @nodoc
abstract class $ImageSplitterIdleCopyWith<$Res> {
factory $ImageSplitterIdleCopyWith(
ImageSplitterIdle value, $Res Function(ImageSplitterIdle) then) =
_$ImageSplitterIdleCopyWithImpl<$Res>;
}
/// @nodoc
class _$ImageSplitterIdleCopyWithImpl<$Res>
extends _$ImageSplitterStateCopyWithImpl<$Res>
implements $ImageSplitterIdleCopyWith<$Res> {
_$ImageSplitterIdleCopyWithImpl(
ImageSplitterIdle _value, $Res Function(ImageSplitterIdle) _then)
: super(_value, (v) => _then(v as ImageSplitterIdle));
@override
ImageSplitterIdle get _value => super._value as ImageSplitterIdle;
}
/// @nodoc
class _$ImageSplitterIdle implements ImageSplitterIdle {
const _$ImageSplitterIdle();
@override
String toString() {
return 'ImageSplitterState()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is ImageSplitterIdle);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() generating,
required TResult Function(
Image image, List<Image> images, PaletteGenerator palette)
complete,
required TResult Function(String? message) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(ImageSplitterIdle value) $default, {
required TResult Function(ImageSplitterGenerating value) generating,
required TResult Function(ImageSplitterComplete value) complete,
required TResult Function(ImageSplitterError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class ImageSplitterIdle implements ImageSplitterState {
const factory ImageSplitterIdle() = _$ImageSplitterIdle;
}
/// @nodoc
abstract class $ImageSplitterGeneratingCopyWith<$Res> {
factory $ImageSplitterGeneratingCopyWith(ImageSplitterGenerating value,
$Res Function(ImageSplitterGenerating) then) =
_$ImageSplitterGeneratingCopyWithImpl<$Res>;
}
/// @nodoc
class _$ImageSplitterGeneratingCopyWithImpl<$Res>
extends _$ImageSplitterStateCopyWithImpl<$Res>
implements $ImageSplitterGeneratingCopyWith<$Res> {
_$ImageSplitterGeneratingCopyWithImpl(ImageSplitterGenerating _value,
$Res Function(ImageSplitterGenerating) _then)
: super(_value, (v) => _then(v as ImageSplitterGenerating));
@override
ImageSplitterGenerating get _value => super._value as ImageSplitterGenerating;
}
/// @nodoc
class _$ImageSplitterGenerating implements ImageSplitterGenerating {
const _$ImageSplitterGenerating();
@override
String toString() {
return 'ImageSplitterState.generating()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is ImageSplitterGenerating);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() generating,
required TResult Function(
Image image, List<Image> images, PaletteGenerator palette)
complete,
required TResult Function(String? message) error,
}) {
return generating();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
}) {
return generating?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (generating != null) {
return generating();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(ImageSplitterIdle value) $default, {
required TResult Function(ImageSplitterGenerating value) generating,
required TResult Function(ImageSplitterComplete value) complete,
required TResult Function(ImageSplitterError value) error,
}) {
return generating(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
}) {
return generating?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
required TResult orElse(),
}) {
if (generating != null) {
return generating(this);
}
return orElse();
}
}
abstract class ImageSplitterGenerating implements ImageSplitterState {
const factory ImageSplitterGenerating() = _$ImageSplitterGenerating;
}
/// @nodoc
abstract class $ImageSplitterCompleteCopyWith<$Res> {
factory $ImageSplitterCompleteCopyWith(ImageSplitterComplete value,
$Res Function(ImageSplitterComplete) then) =
_$ImageSplitterCompleteCopyWithImpl<$Res>;
$Res call({Image image, List<Image> images, PaletteGenerator palette});
}
/// @nodoc
class _$ImageSplitterCompleteCopyWithImpl<$Res>
extends _$ImageSplitterStateCopyWithImpl<$Res>
implements $ImageSplitterCompleteCopyWith<$Res> {
_$ImageSplitterCompleteCopyWithImpl(
ImageSplitterComplete _value, $Res Function(ImageSplitterComplete) _then)
: super(_value, (v) => _then(v as ImageSplitterComplete));
@override
ImageSplitterComplete get _value => super._value as ImageSplitterComplete;
@override
$Res call({
Object? image = freezed,
Object? images = freezed,
Object? palette = freezed,
}) {
return _then(ImageSplitterComplete(
image == freezed
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as Image,
images == freezed
? _value.images
: images // ignore: cast_nullable_to_non_nullable
as List<Image>,
palette == freezed
? _value.palette
: palette // ignore: cast_nullable_to_non_nullable
as PaletteGenerator,
));
}
}
/// @nodoc
class _$ImageSplitterComplete implements ImageSplitterComplete {
const _$ImageSplitterComplete(this.image, this.images, this.palette);
@override
final Image image;
@override
final List<Image> images;
@override
final PaletteGenerator palette;
@override
String toString() {
return 'ImageSplitterState.complete(image: $image, images: $images, palette: $palette)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ImageSplitterComplete &&
const DeepCollectionEquality().equals(other.image, image) &&
const DeepCollectionEquality().equals(other.images, images) &&
const DeepCollectionEquality().equals(other.palette, palette));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(image),
const DeepCollectionEquality().hash(images),
const DeepCollectionEquality().hash(palette));
@JsonKey(ignore: true)
@override
$ImageSplitterCompleteCopyWith<ImageSplitterComplete> get copyWith =>
_$ImageSplitterCompleteCopyWithImpl<ImageSplitterComplete>(
this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() generating,
required TResult Function(
Image image, List<Image> images, PaletteGenerator palette)
complete,
required TResult Function(String? message) error,
}) {
return complete(image, images, palette);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
}) {
return complete?.call(image, images, palette);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (complete != null) {
return complete(image, images, palette);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(ImageSplitterIdle value) $default, {
required TResult Function(ImageSplitterGenerating value) generating,
required TResult Function(ImageSplitterComplete value) complete,
required TResult Function(ImageSplitterError value) error,
}) {
return complete(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
}) {
return complete?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
required TResult orElse(),
}) {
if (complete != null) {
return complete(this);
}
return orElse();
}
}
abstract class ImageSplitterComplete implements ImageSplitterState {
const factory ImageSplitterComplete(
Image image, List<Image> images, PaletteGenerator palette) =
_$ImageSplitterComplete;
Image get image;
List<Image> get images;
PaletteGenerator get palette;
@JsonKey(ignore: true)
$ImageSplitterCompleteCopyWith<ImageSplitterComplete> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ImageSplitterErrorCopyWith<$Res> {
factory $ImageSplitterErrorCopyWith(
ImageSplitterError value, $Res Function(ImageSplitterError) then) =
_$ImageSplitterErrorCopyWithImpl<$Res>;
$Res call({String? message});
}
/// @nodoc
class _$ImageSplitterErrorCopyWithImpl<$Res>
extends _$ImageSplitterStateCopyWithImpl<$Res>
implements $ImageSplitterErrorCopyWith<$Res> {
_$ImageSplitterErrorCopyWithImpl(
ImageSplitterError _value, $Res Function(ImageSplitterError) _then)
: super(_value, (v) => _then(v as ImageSplitterError));
@override
ImageSplitterError get _value => super._value as ImageSplitterError;
@override
$Res call({
Object? message = freezed,
}) {
return _then(ImageSplitterError(
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$ImageSplitterError implements ImageSplitterError {
const _$ImageSplitterError({this.message});
@override
final String? message;
@override
String toString() {
return 'ImageSplitterState.error(message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ImageSplitterError &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$ImageSplitterErrorCopyWith<ImageSplitterError> get copyWith =>
_$ImageSplitterErrorCopyWithImpl<ImageSplitterError>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() generating,
required TResult Function(
Image image, List<Image> images, PaletteGenerator palette)
complete,
required TResult Function(String? message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? generating,
TResult Function(Image image, List<Image> images, PaletteGenerator palette)?
complete,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(ImageSplitterIdle value) $default, {
required TResult Function(ImageSplitterGenerating value) generating,
required TResult Function(ImageSplitterComplete value) complete,
required TResult Function(ImageSplitterError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(ImageSplitterIdle value)? $default, {
TResult Function(ImageSplitterGenerating value)? generating,
TResult Function(ImageSplitterComplete value)? complete,
TResult Function(ImageSplitterError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class ImageSplitterError implements ImageSplitterState {
const factory ImageSplitterError({String? message}) = _$ImageSplitterError;
String? get message;
@JsonKey(ignore: true)
$ImageSplitterErrorCopyWith<ImageSplitterError> get copyWith =>
throw _privateConstructorUsedError;
}

13
lib/application/states/multi_puzzle_state.dart

@ -0,0 +1,13 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:my_flutter_puzzle/models/puzzle_data.dart';
part 'multi_puzzle_state.freezed.dart';
@freezed
class MultiPuzzleState with _$MultiPuzzleState {
const factory MultiPuzzleState() = MultiPuzzleIdle;
const factory MultiPuzzleState.initializing() = MultiPuzzleInitializing;
const factory MultiPuzzleState.current(PuzzleData puzzleData) = MultiPuzzleCurrent;
const factory MultiPuzzleState.solved(PuzzleData puzzleData) = MultiPuzzleSolved;
const factory MultiPuzzleState.error({String? message}) = MultiPuzzleError;
}

831
lib/application/states/multi_puzzle_state.freezed.dart

@ -0,0 +1,831 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'multi_puzzle_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$MultiPuzzleStateTearOff {
const _$MultiPuzzleStateTearOff();
MultiPuzzleIdle call() {
return const MultiPuzzleIdle();
}
MultiPuzzleInitializing initializing() {
return const MultiPuzzleInitializing();
}
MultiPuzzleCurrent current(PuzzleData puzzleData) {
return MultiPuzzleCurrent(
puzzleData,
);
}
MultiPuzzleSolved solved(PuzzleData puzzleData) {
return MultiPuzzleSolved(
puzzleData,
);
}
MultiPuzzleError error({String? message}) {
return MultiPuzzleError(
message: message,
);
}
}
/// @nodoc
const $MultiPuzzleState = _$MultiPuzzleStateTearOff();
/// @nodoc
mixin _$MultiPuzzleState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MultiPuzzleStateCopyWith<$Res> {
factory $MultiPuzzleStateCopyWith(
MultiPuzzleState value, $Res Function(MultiPuzzleState) then) =
_$MultiPuzzleStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleStateCopyWith<$Res> {
_$MultiPuzzleStateCopyWithImpl(this._value, this._then);
final MultiPuzzleState _value;
// ignore: unused_field
final $Res Function(MultiPuzzleState) _then;
}
/// @nodoc
abstract class $MultiPuzzleIdleCopyWith<$Res> {
factory $MultiPuzzleIdleCopyWith(
MultiPuzzleIdle value, $Res Function(MultiPuzzleIdle) then) =
_$MultiPuzzleIdleCopyWithImpl<$Res>;
}
/// @nodoc
class _$MultiPuzzleIdleCopyWithImpl<$Res>
extends _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleIdleCopyWith<$Res> {
_$MultiPuzzleIdleCopyWithImpl(
MultiPuzzleIdle _value, $Res Function(MultiPuzzleIdle) _then)
: super(_value, (v) => _then(v as MultiPuzzleIdle));
@override
MultiPuzzleIdle get _value => super._value as MultiPuzzleIdle;
}
/// @nodoc
class _$MultiPuzzleIdle implements MultiPuzzleIdle {
const _$MultiPuzzleIdle();
@override
String toString() {
return 'MultiPuzzleState()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is MultiPuzzleIdle);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class MultiPuzzleIdle implements MultiPuzzleState {
const factory MultiPuzzleIdle() = _$MultiPuzzleIdle;
}
/// @nodoc
abstract class $MultiPuzzleInitializingCopyWith<$Res> {
factory $MultiPuzzleInitializingCopyWith(MultiPuzzleInitializing value,
$Res Function(MultiPuzzleInitializing) then) =
_$MultiPuzzleInitializingCopyWithImpl<$Res>;
}
/// @nodoc
class _$MultiPuzzleInitializingCopyWithImpl<$Res>
extends _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleInitializingCopyWith<$Res> {
_$MultiPuzzleInitializingCopyWithImpl(MultiPuzzleInitializing _value,
$Res Function(MultiPuzzleInitializing) _then)
: super(_value, (v) => _then(v as MultiPuzzleInitializing));
@override
MultiPuzzleInitializing get _value => super._value as MultiPuzzleInitializing;
}
/// @nodoc
class _$MultiPuzzleInitializing implements MultiPuzzleInitializing {
const _$MultiPuzzleInitializing();
@override
String toString() {
return 'MultiPuzzleState.initializing()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is MultiPuzzleInitializing);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) {
return initializing();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) {
return initializing?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (initializing != null) {
return initializing();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) {
return initializing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) {
return initializing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) {
if (initializing != null) {
return initializing(this);
}
return orElse();
}
}
abstract class MultiPuzzleInitializing implements MultiPuzzleState {
const factory MultiPuzzleInitializing() = _$MultiPuzzleInitializing;
}
/// @nodoc
abstract class $MultiPuzzleCurrentCopyWith<$Res> {
factory $MultiPuzzleCurrentCopyWith(
MultiPuzzleCurrent value, $Res Function(MultiPuzzleCurrent) then) =
_$MultiPuzzleCurrentCopyWithImpl<$Res>;
$Res call({PuzzleData puzzleData});
}
/// @nodoc
class _$MultiPuzzleCurrentCopyWithImpl<$Res>
extends _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleCurrentCopyWith<$Res> {
_$MultiPuzzleCurrentCopyWithImpl(
MultiPuzzleCurrent _value, $Res Function(MultiPuzzleCurrent) _then)
: super(_value, (v) => _then(v as MultiPuzzleCurrent));
@override
MultiPuzzleCurrent get _value => super._value as MultiPuzzleCurrent;
@override
$Res call({
Object? puzzleData = freezed,
}) {
return _then(MultiPuzzleCurrent(
puzzleData == freezed
? _value.puzzleData
: puzzleData // ignore: cast_nullable_to_non_nullable
as PuzzleData,
));
}
}
/// @nodoc
class _$MultiPuzzleCurrent implements MultiPuzzleCurrent {
const _$MultiPuzzleCurrent(this.puzzleData);
@override
final PuzzleData puzzleData;
@override
String toString() {
return 'MultiPuzzleState.current(puzzleData: $puzzleData)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MultiPuzzleCurrent &&
const DeepCollectionEquality()
.equals(other.puzzleData, puzzleData));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(puzzleData));
@JsonKey(ignore: true)
@override
$MultiPuzzleCurrentCopyWith<MultiPuzzleCurrent> get copyWith =>
_$MultiPuzzleCurrentCopyWithImpl<MultiPuzzleCurrent>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) {
return current(puzzleData);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) {
return current?.call(puzzleData);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (current != null) {
return current(puzzleData);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) {
return current(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) {
return current?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) {
if (current != null) {
return current(this);
}
return orElse();
}
}
abstract class MultiPuzzleCurrent implements MultiPuzzleState {
const factory MultiPuzzleCurrent(PuzzleData puzzleData) =
_$MultiPuzzleCurrent;
PuzzleData get puzzleData;
@JsonKey(ignore: true)
$MultiPuzzleCurrentCopyWith<MultiPuzzleCurrent> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MultiPuzzleSolvedCopyWith<$Res> {
factory $MultiPuzzleSolvedCopyWith(
MultiPuzzleSolved value, $Res Function(MultiPuzzleSolved) then) =
_$MultiPuzzleSolvedCopyWithImpl<$Res>;
$Res call({PuzzleData puzzleData});
}
/// @nodoc
class _$MultiPuzzleSolvedCopyWithImpl<$Res>
extends _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleSolvedCopyWith<$Res> {
_$MultiPuzzleSolvedCopyWithImpl(
MultiPuzzleSolved _value, $Res Function(MultiPuzzleSolved) _then)
: super(_value, (v) => _then(v as MultiPuzzleSolved));
@override
MultiPuzzleSolved get _value => super._value as MultiPuzzleSolved;
@override
$Res call({
Object? puzzleData = freezed,
}) {
return _then(MultiPuzzleSolved(
puzzleData == freezed
? _value.puzzleData
: puzzleData // ignore: cast_nullable_to_non_nullable
as PuzzleData,
));
}
}
/// @nodoc
class _$MultiPuzzleSolved implements MultiPuzzleSolved {
const _$MultiPuzzleSolved(this.puzzleData);
@override
final PuzzleData puzzleData;
@override
String toString() {
return 'MultiPuzzleState.solved(puzzleData: $puzzleData)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MultiPuzzleSolved &&
const DeepCollectionEquality()
.equals(other.puzzleData, puzzleData));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(puzzleData));
@JsonKey(ignore: true)
@override
$MultiPuzzleSolvedCopyWith<MultiPuzzleSolved> get copyWith =>
_$MultiPuzzleSolvedCopyWithImpl<MultiPuzzleSolved>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) {
return solved(puzzleData);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) {
return solved?.call(puzzleData);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (solved != null) {
return solved(puzzleData);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) {
return solved(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) {
return solved?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) {
if (solved != null) {
return solved(this);
}
return orElse();
}
}
abstract class MultiPuzzleSolved implements MultiPuzzleState {
const factory MultiPuzzleSolved(PuzzleData puzzleData) = _$MultiPuzzleSolved;
PuzzleData get puzzleData;
@JsonKey(ignore: true)
$MultiPuzzleSolvedCopyWith<MultiPuzzleSolved> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MultiPuzzleErrorCopyWith<$Res> {
factory $MultiPuzzleErrorCopyWith(
MultiPuzzleError value, $Res Function(MultiPuzzleError) then) =
_$MultiPuzzleErrorCopyWithImpl<$Res>;
$Res call({String? message});
}
/// @nodoc
class _$MultiPuzzleErrorCopyWithImpl<$Res>
extends _$MultiPuzzleStateCopyWithImpl<$Res>
implements $MultiPuzzleErrorCopyWith<$Res> {
_$MultiPuzzleErrorCopyWithImpl(
MultiPuzzleError _value, $Res Function(MultiPuzzleError) _then)
: super(_value, (v) => _then(v as MultiPuzzleError));
@override
MultiPuzzleError get _value => super._value as MultiPuzzleError;
@override
$Res call({
Object? message = freezed,
}) {
return _then(MultiPuzzleError(
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$MultiPuzzleError implements MultiPuzzleError {
const _$MultiPuzzleError({this.message});
@override
final String? message;
@override
String toString() {
return 'MultiPuzzleState.error(message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MultiPuzzleError &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$MultiPuzzleErrorCopyWith<MultiPuzzleError> get copyWith =>
_$MultiPuzzleErrorCopyWithImpl<MultiPuzzleError>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() initializing,
required TResult Function(PuzzleData puzzleData) current,
required TResult Function(PuzzleData puzzleData) solved,
required TResult Function(String? message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? initializing,
TResult Function(PuzzleData puzzleData)? current,
TResult Function(PuzzleData puzzleData)? solved,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value) $default, {
required TResult Function(MultiPuzzleInitializing value) initializing,
required TResult Function(MultiPuzzleCurrent value) current,
required TResult Function(MultiPuzzleSolved value) solved,
required TResult Function(MultiPuzzleError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(MultiPuzzleIdle value)? $default, {
TResult Function(MultiPuzzleInitializing value)? initializing,
TResult Function(MultiPuzzleCurrent value)? current,
TResult Function(MultiPuzzleSolved value)? solved,
TResult Function(MultiPuzzleError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class MultiPuzzleError implements MultiPuzzleState {
const factory MultiPuzzleError({String? message}) = _$MultiPuzzleError;
String? get message;
@JsonKey(ignore: true)
$MultiPuzzleErrorCopyWith<MultiPuzzleError> get copyWith =>
throw _privateConstructorUsedError;
}

12
lib/application/states/player_matching_state.dart

@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'player_matching_state.freezed.dart';
@freezed
class PlayerMatchingState with _$PlayerMatchingState {
const factory PlayerMatchingState() = PlayerMatchingIdle;
const factory PlayerMatchingState.processing() = PlayerMatchingProcessing;
const factory PlayerMatchingState.isMatched(String id) = PlayerMatched;
const factory PlayerMatchingState.isQueued() = PlayerQueue;
const factory PlayerMatchingState.error({String? message}) = PlayerMatchingError;
}

798
lib/application/states/player_matching_state.freezed.dart

@ -0,0 +1,798 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'player_matching_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$PlayerMatchingStateTearOff {
const _$PlayerMatchingStateTearOff();
PlayerMatchingIdle call() {
return const PlayerMatchingIdle();
}
PlayerMatchingProcessing processing() {
return const PlayerMatchingProcessing();
}
PlayerMatched isMatched(String id) {
return PlayerMatched(
id,
);
}
PlayerQueue isQueued() {
return const PlayerQueue();
}
PlayerMatchingError error({String? message}) {
return PlayerMatchingError(
message: message,
);
}
}
/// @nodoc
const $PlayerMatchingState = _$PlayerMatchingStateTearOff();
/// @nodoc
mixin _$PlayerMatchingState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PlayerMatchingStateCopyWith<$Res> {
factory $PlayerMatchingStateCopyWith(
PlayerMatchingState value, $Res Function(PlayerMatchingState) then) =
_$PlayerMatchingStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerMatchingStateCopyWith<$Res> {
_$PlayerMatchingStateCopyWithImpl(this._value, this._then);
final PlayerMatchingState _value;
// ignore: unused_field
final $Res Function(PlayerMatchingState) _then;
}
/// @nodoc
abstract class $PlayerMatchingIdleCopyWith<$Res> {
factory $PlayerMatchingIdleCopyWith(
PlayerMatchingIdle value, $Res Function(PlayerMatchingIdle) then) =
_$PlayerMatchingIdleCopyWithImpl<$Res>;
}
/// @nodoc
class _$PlayerMatchingIdleCopyWithImpl<$Res>
extends _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerMatchingIdleCopyWith<$Res> {
_$PlayerMatchingIdleCopyWithImpl(
PlayerMatchingIdle _value, $Res Function(PlayerMatchingIdle) _then)
: super(_value, (v) => _then(v as PlayerMatchingIdle));
@override
PlayerMatchingIdle get _value => super._value as PlayerMatchingIdle;
}
/// @nodoc
class _$PlayerMatchingIdle implements PlayerMatchingIdle {
const _$PlayerMatchingIdle();
@override
String toString() {
return 'PlayerMatchingState()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is PlayerMatchingIdle);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class PlayerMatchingIdle implements PlayerMatchingState {
const factory PlayerMatchingIdle() = _$PlayerMatchingIdle;
}
/// @nodoc
abstract class $PlayerMatchingProcessingCopyWith<$Res> {
factory $PlayerMatchingProcessingCopyWith(PlayerMatchingProcessing value,
$Res Function(PlayerMatchingProcessing) then) =
_$PlayerMatchingProcessingCopyWithImpl<$Res>;
}
/// @nodoc
class _$PlayerMatchingProcessingCopyWithImpl<$Res>
extends _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerMatchingProcessingCopyWith<$Res> {
_$PlayerMatchingProcessingCopyWithImpl(PlayerMatchingProcessing _value,
$Res Function(PlayerMatchingProcessing) _then)
: super(_value, (v) => _then(v as PlayerMatchingProcessing));
@override
PlayerMatchingProcessing get _value =>
super._value as PlayerMatchingProcessing;
}
/// @nodoc
class _$PlayerMatchingProcessing implements PlayerMatchingProcessing {
const _$PlayerMatchingProcessing();
@override
String toString() {
return 'PlayerMatchingState.processing()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is PlayerMatchingProcessing);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) {
return processing();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) {
return processing?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) {
return processing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) {
return processing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) {
if (processing != null) {
return processing(this);
}
return orElse();
}
}
abstract class PlayerMatchingProcessing implements PlayerMatchingState {
const factory PlayerMatchingProcessing() = _$PlayerMatchingProcessing;
}
/// @nodoc
abstract class $PlayerMatchedCopyWith<$Res> {
factory $PlayerMatchedCopyWith(
PlayerMatched value, $Res Function(PlayerMatched) then) =
_$PlayerMatchedCopyWithImpl<$Res>;
$Res call({String id});
}
/// @nodoc
class _$PlayerMatchedCopyWithImpl<$Res>
extends _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerMatchedCopyWith<$Res> {
_$PlayerMatchedCopyWithImpl(
PlayerMatched _value, $Res Function(PlayerMatched) _then)
: super(_value, (v) => _then(v as PlayerMatched));
@override
PlayerMatched get _value => super._value as PlayerMatched;
@override
$Res call({
Object? id = freezed,
}) {
return _then(PlayerMatched(
id == freezed
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PlayerMatched implements PlayerMatched {
const _$PlayerMatched(this.id);
@override
final String id;
@override
String toString() {
return 'PlayerMatchingState.isMatched(id: $id)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is PlayerMatched &&
const DeepCollectionEquality().equals(other.id, id));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(id));
@JsonKey(ignore: true)
@override
$PlayerMatchedCopyWith<PlayerMatched> get copyWith =>
_$PlayerMatchedCopyWithImpl<PlayerMatched>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) {
return isMatched(id);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) {
return isMatched?.call(id);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (isMatched != null) {
return isMatched(id);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) {
return isMatched(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) {
return isMatched?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) {
if (isMatched != null) {
return isMatched(this);
}
return orElse();
}
}
abstract class PlayerMatched implements PlayerMatchingState {
const factory PlayerMatched(String id) = _$PlayerMatched;
String get id;
@JsonKey(ignore: true)
$PlayerMatchedCopyWith<PlayerMatched> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PlayerQueueCopyWith<$Res> {
factory $PlayerQueueCopyWith(
PlayerQueue value, $Res Function(PlayerQueue) then) =
_$PlayerQueueCopyWithImpl<$Res>;
}
/// @nodoc
class _$PlayerQueueCopyWithImpl<$Res>
extends _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerQueueCopyWith<$Res> {
_$PlayerQueueCopyWithImpl(
PlayerQueue _value, $Res Function(PlayerQueue) _then)
: super(_value, (v) => _then(v as PlayerQueue));
@override
PlayerQueue get _value => super._value as PlayerQueue;
}
/// @nodoc
class _$PlayerQueue implements PlayerQueue {
const _$PlayerQueue();
@override
String toString() {
return 'PlayerMatchingState.isQueued()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is PlayerQueue);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) {
return isQueued();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) {
return isQueued?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (isQueued != null) {
return isQueued();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) {
return isQueued(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) {
return isQueued?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) {
if (isQueued != null) {
return isQueued(this);
}
return orElse();
}
}
abstract class PlayerQueue implements PlayerMatchingState {
const factory PlayerQueue() = _$PlayerQueue;
}
/// @nodoc
abstract class $PlayerMatchingErrorCopyWith<$Res> {
factory $PlayerMatchingErrorCopyWith(
PlayerMatchingError value, $Res Function(PlayerMatchingError) then) =
_$PlayerMatchingErrorCopyWithImpl<$Res>;
$Res call({String? message});
}
/// @nodoc
class _$PlayerMatchingErrorCopyWithImpl<$Res>
extends _$PlayerMatchingStateCopyWithImpl<$Res>
implements $PlayerMatchingErrorCopyWith<$Res> {
_$PlayerMatchingErrorCopyWithImpl(
PlayerMatchingError _value, $Res Function(PlayerMatchingError) _then)
: super(_value, (v) => _then(v as PlayerMatchingError));
@override
PlayerMatchingError get _value => super._value as PlayerMatchingError;
@override
$Res call({
Object? message = freezed,
}) {
return _then(PlayerMatchingError(
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$PlayerMatchingError implements PlayerMatchingError {
const _$PlayerMatchingError({this.message});
@override
final String? message;
@override
String toString() {
return 'PlayerMatchingState.error(message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is PlayerMatchingError &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$PlayerMatchingErrorCopyWith<PlayerMatchingError> get copyWith =>
_$PlayerMatchingErrorCopyWithImpl<PlayerMatchingError>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() processing,
required TResult Function(String id) isMatched,
required TResult Function() isQueued,
required TResult Function(String? message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? processing,
TResult Function(String id)? isMatched,
TResult Function()? isQueued,
TResult Function(String? message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value) $default, {
required TResult Function(PlayerMatchingProcessing value) processing,
required TResult Function(PlayerMatched value) isMatched,
required TResult Function(PlayerQueue value) isQueued,
required TResult Function(PlayerMatchingError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(PlayerMatchingIdle value)? $default, {
TResult Function(PlayerMatchingProcessing value)? processing,
TResult Function(PlayerMatched value)? isMatched,
TResult Function(PlayerQueue value)? isQueued,
TResult Function(PlayerMatchingError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class PlayerMatchingError implements PlayerMatchingState {
const factory PlayerMatchingError({String? message}) = _$PlayerMatchingError;
String? get message;
@JsonKey(ignore: true)
$PlayerMatchingErrorCopyWith<PlayerMatchingError> get copyWith =>
throw _privateConstructorUsedError;
}

16
lib/application/states/puzzle_state.dart

@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:my_flutter_puzzle/models/puzzle_data.dart';
part 'puzzle_state.freezed.dart';
@freezed
class PuzzleState with _$PuzzleState {
const factory PuzzleState() = PuzzleIdle;
const factory PuzzleState.initializing() = PuzzleInitializing;
const factory PuzzleState.scrambling(PuzzleData puzzleData) = PuzzleScrambling;
const factory PuzzleState.current(PuzzleData puzzleData) = PuzzleCurrent;
const factory PuzzleState.computingSolution(PuzzleData puzzleData) = PuzzleComputingSolution;
const factory PuzzleState.autoSolving(PuzzleData puzzleData) = PuzzleAutoSolving;
const factory PuzzleState.solved(PuzzleData puzzleData) = PuzzleSolved;
const factory PuzzleState.error({String? message}) = PuzzleError;
}

1465
lib/application/states/puzzle_state.freezed.dart
File diff suppressed because it is too large
View File

45
lib/main.dart

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:my_flutter_puzzle/res/palette.dart';
import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart';
import 'package:my_flutter_puzzle/utils/color_brightness.dart';
import 'package:url_strategy/url_strategy.dart';
void main() async {
setPathUrlStrategy();
WidgetsFlutterBinding.ensureInitialized();
runApp(const ProviderScope(child: MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Puzzle',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'GoogleSans',
backgroundColor: Palette.blue.darken(0.3),
colorScheme: ColorScheme(
brightness: Theme.of(context).brightness,
primary: Palette.blue,
onPrimary: Colors.white,
secondary: Palette.blue.withOpacity(0.6),
onSecondary: Palette.blue.withOpacity(0.3),
error: Theme.of(context).colorScheme.error,
onError: Theme.of(context).colorScheme.onError,
background: Palette.blue.darken(0.3),
onBackground: Colors.white,
surface: Palette.crimson,
onSurface: Colors.white38,
),
),
home: const LevelListScreen(),
);
}
}

43
lib/models/puzzle_data.dart

@ -0,0 +1,43 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class PuzzleData {
final List<List<int>> board2D;
final List<int> board1D;
final int moves;
final int tiles;
final int puzzleSize;
final Map<int, FractionalOffset> offsetMap;
PuzzleData({
required this.board2D,
required this.board1D,
required this.offsetMap,
required this.moves,
required this.tiles,
required this.puzzleSize,
});
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is PuzzleData &&
listEquals(other.board2D, board2D) &&
listEquals(other.board1D, board1D) &&
other.moves == moves &&
other.tiles == tiles &&
other.puzzleSize == puzzleSize &&
mapEquals(other.offsetMap, offsetMap);
}
@override
int get hashCode {
return board2D.hashCode ^
board1D.hashCode ^
moves.hashCode ^
tiles.hashCode ^
puzzleSize.hashCode ^
offsetMap.hashCode;
}
}

53
lib/models/user_info.dart

@ -0,0 +1,53 @@
class UserData {
final String uid;
final String name;
final String username;
final int timestamp;
UserData({
required this.uid,
required this.name,
required this.username,
required this.timestamp,
});
UserData.fromJson(Map<String, dynamic> json)
: uid = json['uid'],
name = json['name'],
username = json['username'],
timestamp = json['timestamp'];
Map<String, dynamic> toJson() => {
'uid': uid,
'name': name,
'username': username,
'timestamp': timestamp,
};
}
class EUserData {
final String uid;
final String username;
final String email;
final int timestamp;
EUserData({
required this.uid,
required this.username,
required this.email,
required this.timestamp,
});
EUserData.fromJson(Map<String, dynamic> json)
: uid = json['uid'],
username = json['username'],
email = json['email'],
timestamp = json['timestamp'];
Map<String, dynamic> toJson() => {
'uid': uid,
'username': username,
'email': email,
'timestamp': timestamp,
};
}

35
lib/providers.dart

@ -0,0 +1,35 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:my_flutter_puzzle/application/notifiers/image_splitter_notifier.dart';
import 'package:my_flutter_puzzle/application/notifiers/login_register_notifier.dart';
import 'package:my_flutter_puzzle/application/notifiers/puzzle_notifier.dart';
import 'package:my_flutter_puzzle/application/notifiers/puzzle_type_notifier.dart';
import 'package:my_flutter_puzzle/application/states/image_splitter_state.dart';
import 'package:my_flutter_puzzle/application/states/puzzle_state.dart';
import 'package:my_flutter_puzzle/utils/image_splitter.dart';
import 'package:my_flutter_puzzle/utils/puzzle_solver.dart';
import 'application/notifiers/timer_notifier.dart';
final imageSplitterProvider = Provider<ImageSplitter>((ref) => ImageSplitter());
final puzzleNotifierProvider = StateNotifierProvider.family<PuzzleNotifier, PuzzleState, PuzzleSolverClient>(
(ref, solverClient) => PuzzleNotifier(solverClient),
);
final imageSplitterNotifierProvider = StateNotifierProvider<ImageSplitterNotifier, ImageSplitterState>(
(ref) => ImageSplitterNotifier(
ref.watch(imageSplitterProvider),
),
);
final timerNotifierProvider = StateNotifierProvider<TimerNotifier, String>(
((ref) => TimerNotifier()),
);
final puzzleTypeNotifierProvider = StateNotifierProvider<PuzzleTypeNotifier, PuzzleType>(
(ref) => PuzzleTypeNotifier(),
);
final isLoginNotifier = StateNotifierProvider<IsLoginNotifier, bool>(
(ref) => IsLoginNotifier(),
);

7
lib/res/palette.dart

@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
class Palette {
static const Color blue = Color(0xFF2868d7);
static const Color violet = Color(0xFF5E239D);
static const Color crimson = Color(0xffD33F49);
}

1
lib/res/puzzle_constants.dart

@ -0,0 +1 @@
const int kInitialSpeed = 1000;

19
lib/res/strings.dart

@ -0,0 +1,19 @@
class Strings {
static const usersCollectionName = 'users';
static const queueCollectionName = 'queue';
static const matchedCollectionName = 'matched';
static const idFieldName = 'id';
static const myuidFieldName = 'myuid';
static const otheruidFieldName = 'otheruid';
static const mylistFieldName = 'mylist';
static const otherlistFieldName = 'otherlist';
static const mymovesFieldName = 'mymoves';
static const othermovesFieldName = 'othermoves';
}
const defaultImagePath = 'assets/images/default_image.png';
/// username can be made like this
/// <entered_name>@<uid>
/// eg: souvik@124432523

79
lib/screens/level_list/screen/level_list_screen.dart

@ -0,0 +1,79 @@
import 'package:flutter/material.dart';
import 'package:my_flutter_puzzle/screens/puzzle/puzzle_starter_screen.dart';
import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart';
class LevelListScreen extends StatefulWidget {
const LevelListScreen({Key? key}) : super(key: key);
@override
State<LevelListScreen> createState() => _LevelListScreenState();
}
class _LevelListScreenState extends State<LevelListScreen> {
final List<Level> _levelList = [];
@override
void initState() {
_levelList.add(Level(image: 'default_image'.pngPath, duration: 4, puzzleSize: 3));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 4, puzzleSize: 3));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 4, puzzleSize: 3));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 6, puzzleSize: 4));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 6, puzzleSize: 4));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 6, puzzleSize: 4));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 8, puzzleSize: 5));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 8, puzzleSize: 5));
_levelList.add(Level(image: 'default_image'.pngPath, duration: 8, puzzleSize: 5));
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
itemBuilder: (context, index) {
return Container(
margin: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Text('مرحله شماره ${index + 1}'),
const SizedBox(height: 8),
Text("زمان بازی : ${_levelList[index].duration} دقیقه"),
const SizedBox(height: 8),
GestureDetector(
child: const Text('شروغ'),
onTap: () => _startLevel(_levelList[index]),
),
],
),
);
},
itemCount: _levelList.length,
),
);
}
void _startLevel(Level level) {
Navigator.push(context, MaterialPageRoute(
builder: (context) {
return PuzzleStarterScreen(
duration: level.duration,
puzzleSize: level.puzzleSize,
image: level.image,
);
},
));
}
}
class Level {
final String image;
final int puzzleSize;
final int duration;
Level({required this.image, required this.duration, required this.puzzleSize});
}

54
lib/screens/login_screen_name.dart

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:my_flutter_puzzle/widgets/login_widgets/name_field.dart';
class LoginScreenName extends StatefulWidget {
const LoginScreenName({Key? key}) : super(key: key);
@override
State<LoginScreenName> createState() => _LoginScreenNameState();
}
class _LoginScreenNameState extends State<LoginScreenName> {
late final TextEditingController _nameTextController;
late final FocusNode _nameFocusNode;
String _nameString = '';
@override
void initState() {
super.initState();
_nameTextController = TextEditingController();
_nameFocusNode = FocusNode();
}
@override
Widget build(BuildContext context) {
var screenSize = MediaQuery.of(context).size;
return GestureDetector(
onTap: () => _nameFocusNode.unfocus(),
child: Scaffold(
backgroundColor: Colors.white,
body: Center(
child: SizedBox(
width: screenSize.width * 0.5,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
NameField(
focusNode: _nameFocusNode,
onChange: (value) => setState(
() => _nameString = value,
),
),
const SizedBox(height: 24),
// StartGameWidget(
// nameString: _nameString,
// ),
],
),
),
),
),
);
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save