├── CHANGELOG.md ├── example ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ └── .gitignore ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ └── Icon-512.png │ ├── manifest.json │ └── index.html ├── assets │ └── Jigsaw.jpg ├── android │ ├── gradle.properties │ ├── .gitignore │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── akmal02 │ │ │ │ │ │ └── jigsaw_puzzle_game │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── pubspec.yaml ├── main.dart ├── pubspec.lock ├── analysis_options.yaml └── all_lint_rules.yaml ├── lib ├── flutter_jigsaw_puzzle.dart └── src │ ├── error.dart │ └── jigsaw.dart ├── .metadata ├── pubspec.yaml ├── LICENSE ├── .gitignore ├── README.md ├── pubspec.lock ├── analysis_options.yaml └── all_lint_rules.yaml /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.0 2 | * Initial open source release. 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /example/assets/Jigsaw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/assets/Jigsaw.jpg -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /lib/flutter_jigsaw_puzzle.dart: -------------------------------------------------------------------------------- 1 | library flutter_jigsaw_puzzle; 2 | 3 | export 'src/error.dart'; 4 | export 'src/jigsaw.dart' show JigsawPuzzle, JigsawWidgetState; 5 | -------------------------------------------------------------------------------- /lib/src/error.dart: -------------------------------------------------------------------------------- 1 | // TODO remove me 2 | // ignore_for_file: public_member_api_docs 3 | 4 | class InvalidImageException implements Exception { 5 | InvalidImageException(); 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o-compilador/flutter_jigsaw_puzzle/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/akmal02/jigsaw_puzzle_game/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.akmal02.jigsaw_puzzle_game 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 2294d75bfa8d067ba90230c0fc2268f3636d7584 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_jigsaw_puzzle 2 | description: A simple Jigsaw Puzzle lib built with Flutter that supports custom grids of varying sizes. 3 | version: 0.1.0 4 | homepage: https://github.com/o-compilador/flutter_jigsaw_puzzle 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | image: ^3.0.5 14 | carousel_slider: ^4.0.0 -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | 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. -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: jigsaw_puzzle_example 2 | description: Jigsaw Puzzle lib example. 3 | version: 0.1.0 4 | homepage: https://github.com/o-compilador/flutter_jigsaw_puzzle 5 | publish_to: "none" 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | flutter_jigsaw_puzzle: 15 | path: ../ 16 | 17 | flutter: 18 | uses-material-design: true 19 | assets: 20 | - assets/ -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jigsaw_puzzle_game", 3 | "short_name": "jigsaw_puzzle_game", 4 | "start_url": ".", 5 | "display": "minimal-ui", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A jigsaw puzzle game built with Flutter.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 O Compilador 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | jigsaw_puzzle_game 18 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | jigsaw_puzzle_game 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/ephemeral 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Visual Studio related 72 | .vscode 73 | 74 | # Exceptions to above rules. 75 | !**/ios/**/default.mode1v3 76 | !**/ios/**/default.mode2v3 77 | !**/ios/**/default.pbxuser 78 | !**/ios/**/default.perspectivev3 79 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.akmal02.jigsaw_puzzle_game" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_jigsaw_puzzle/flutter_jigsaw_puzzle.dart'; 3 | 4 | void main() { 5 | runApp(const MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | const MyApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final puzzleKey = GlobalKey(); 14 | 15 | return MaterialApp( 16 | title: 'Jigsaw', 17 | theme: ThemeData.from( 18 | colorScheme: ColorScheme.fromSwatch( 19 | primarySwatch: Colors.blueGrey, 20 | primaryColorDark: Colors.blueGrey.shade700, 21 | backgroundColor: Colors.blueGrey.shade100, 22 | cardColor: Colors.yellow, 23 | errorColor: Colors.orange, 24 | ), 25 | textTheme: Typography.englishLike2018, 26 | ).copyWith( 27 | splashFactory: InkRipple.splashFactory, 28 | ), 29 | home: Scaffold( 30 | backgroundColor: Colors.white, 31 | body: SafeArea( 32 | child: Padding( 33 | padding: const EdgeInsets.all(24), 34 | child: Column( 35 | children: [ 36 | Row( 37 | mainAxisAlignment: MainAxisAlignment.center, 38 | children: [ 39 | ElevatedButton( 40 | onPressed: () async { 41 | await puzzleKey.currentState!.generate(); 42 | }, 43 | child: const Text('Generate'), 44 | ), 45 | const SizedBox(width: 16), 46 | ElevatedButton( 47 | onPressed: () { 48 | puzzleKey.currentState!.reset(); 49 | }, 50 | child: const Text('Clear'), 51 | ), 52 | ], 53 | ), 54 | JigsawPuzzle( 55 | gridSize: 5, 56 | image: const AssetImage('assets/Jigsaw.jpg'), 57 | onFinished: () { 58 | // ignore: avoid_print 59 | print('finished!'); 60 | }, 61 | // ignore: avoid_redundant_argument_values 62 | snapSensitivity: .5, // Between 0 and 1 63 | puzzleKey: puzzleKey, 64 | onBlockSuccess: () { 65 | // ignore: avoid_print 66 | print('block success!'); 67 | }, 68 | ) 69 | ], 70 | ), 71 | ), 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_jigsaw_puzzle 2 | 3 | Geneate a jigsaw puzzle of any size from a `ImageProvider`. 4 | 5 | 6 | 7 | ## Features 8 | 9 | * Create a jigsaw puzzle from any `ImageProvider` 10 | * Configurable grid size (2x2, 3x3, 4x4, 5x5, 6x6, ...) 11 | * Separate callbacks for when each block gets snapped and for when the puzzle is completed 12 | 13 | ## Getting started 14 | 15 | In the `pubspec.yaml` of your flutter project, add the following dependency: 16 | 17 | ```yaml 18 | dependencies: 19 | ... 20 | flutter_jigsaw_puzzle: 21 | ``` 22 | 23 | In your library add the following import: 24 | 25 | ```dart 26 | import 'package:flutter_jigsaw_puzzle/flutter_jigsaw_puzzle.dart'; 27 | ``` 28 | 29 | For help getting started with Flutter, view the online [documentation](https://flutter.io/). 30 | 31 | ## Example 32 | 33 | ### 3x3 34 | 35 | 36 | ### 5x5 37 | 38 | 39 | ### 10x10 40 | 41 | 42 | 43 | ```dart 44 | final puzzleKey = GlobalKey(); 45 | 46 | Column( 47 | children: [ 48 | ElevatedButton( 49 | onPressed: () async { 50 | await puzzleKey.currentState.generate(); 51 | }, 52 | child: const Text('Generate'), 53 | ), 54 | JigsawPuzzle( 55 | gridSize: 10, 56 | image: const AssetImage('assets/Jigsaw.jpg'), 57 | onFinished: () { 58 | // ignore: avoid_print 59 | print('finished!'); 60 | }, 61 | snapSensitivity: .5, // Between 0 and 1 62 | puzzleKey: puzzleKey, 63 | onBlockSuccess: () { 64 | // ignore: avoid_print 65 | print('block success!'); 66 | }, 67 | ) 68 | ], 69 | ), 70 | ``` 71 | 72 | You can find a working example in the [Example](https://github.com/o-compilador/flutter_jigsaw_puzzle/tree/master/example) project. 73 | 74 | ## Changelog 75 | 76 | Please see the [Changelog](https://github.com/o-compilador/flutter_jigsaw_puzzle/blob/master/CHANGELOG.md) page to know what's recently changed. 77 | 78 | ## Contributions 79 | 80 | Feel free to contribute to this project. 81 | 82 | If you find a bug or want a feature, but don't know how to fix/implement it, please fill an [issue](https://github.com/o-compilador/flutter_jigsaw_puzzle/issues). 83 | If you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/o-compilador/flutter_jigsaw_puzzle/pulls). 84 | 85 | ## TODO 86 | * Tests 87 | * Animations 88 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "3.1.2" 11 | carousel_slider: 12 | dependency: "direct main" 13 | description: 14 | name: carousel_slider 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "4.0.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.16.0" 32 | crypto: 33 | dependency: transitive 34 | description: 35 | name: crypto 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "3.0.1" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | image: 45 | dependency: "direct main" 46 | description: 47 | name: image 48 | url: "https://pub.dartlang.org" 49 | source: hosted 50 | version: "3.0.5" 51 | material_color_utilities: 52 | dependency: transitive 53 | description: 54 | name: material_color_utilities 55 | url: "https://pub.dartlang.org" 56 | source: hosted 57 | version: "0.1.4" 58 | meta: 59 | dependency: transitive 60 | description: 61 | name: meta 62 | url: "https://pub.dartlang.org" 63 | source: hosted 64 | version: "1.7.0" 65 | path: 66 | dependency: transitive 67 | description: 68 | name: path 69 | url: "https://pub.dartlang.org" 70 | source: hosted 71 | version: "1.8.0" 72 | petitparser: 73 | dependency: transitive 74 | description: 75 | name: petitparser 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "4.1.0" 79 | sky_engine: 80 | dependency: transitive 81 | description: flutter 82 | source: sdk 83 | version: "0.0.99" 84 | typed_data: 85 | dependency: transitive 86 | description: 87 | name: typed_data 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.3.0" 91 | vector_math: 92 | dependency: transitive 93 | description: 94 | name: vector_math 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "2.1.2" 98 | xml: 99 | dependency: transitive 100 | description: 101 | name: xml 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "5.1.2" 105 | sdks: 106 | dart: ">=2.14.0 <3.0.0" 107 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "3.1.2" 11 | carousel_slider: 12 | dependency: transitive 13 | description: 14 | name: carousel_slider 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "4.0.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.16.0" 32 | crypto: 33 | dependency: transitive 34 | description: 35 | name: crypto 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "3.0.1" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | flutter_jigsaw_puzzle: 45 | dependency: "direct main" 46 | description: 47 | path: ".." 48 | relative: true 49 | source: path 50 | version: "0.1.0" 51 | image: 52 | dependency: transitive 53 | description: 54 | name: image 55 | url: "https://pub.dartlang.org" 56 | source: hosted 57 | version: "3.0.5" 58 | material_color_utilities: 59 | dependency: transitive 60 | description: 61 | name: material_color_utilities 62 | url: "https://pub.dartlang.org" 63 | source: hosted 64 | version: "0.1.4" 65 | meta: 66 | dependency: transitive 67 | description: 68 | name: meta 69 | url: "https://pub.dartlang.org" 70 | source: hosted 71 | version: "1.7.0" 72 | path: 73 | dependency: transitive 74 | description: 75 | name: path 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "1.8.0" 79 | petitparser: 80 | dependency: transitive 81 | description: 82 | name: petitparser 83 | url: "https://pub.dartlang.org" 84 | source: hosted 85 | version: "4.1.0" 86 | sky_engine: 87 | dependency: transitive 88 | description: flutter 89 | source: sdk 90 | version: "0.0.99" 91 | typed_data: 92 | dependency: transitive 93 | description: 94 | name: typed_data 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.3.0" 98 | vector_math: 99 | dependency: transitive 100 | description: 101 | name: vector_math 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.1.2" 105 | xml: 106 | dependency: transitive 107 | description: 108 | name: xml 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "5.1.2" 112 | sdks: 113 | dart: ">=2.14.0 <3.0.0" 114 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Enable all rules by default 2 | include: all_lint_rules.yaml 3 | analyzer: 4 | strong-mode: 5 | implicit-casts: false 6 | implicit-dynamic: false 7 | errors: 8 | dead_code: warning 9 | # Otherwise cause the import of all_lint_rules to warn because of some rules conflicts. 10 | # The conflicts are fixed in this file instead, so we can safely ignore the warning. 11 | included_file_warning: ignore 12 | missing_required_param: error 13 | missing_return: error 14 | enable-experiment: 15 | - non-nullable 16 | 17 | linter: 18 | rules: 19 | # We prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 20 | always_put_required_named_parameters_first: false 21 | 22 | # Depends on your needs 23 | always_require_non_null_named_parameters: false 24 | 25 | # Conflicts with `omit_local_variable_types` and other rules. 26 | # As per Dart guidelines, we want to avoid unnecessary types to make the code 27 | # more readable. 28 | # See https://dart.dev/guides/language/effective-dart/design#avoid-type-annotating-initialized-local-variables 29 | always_specify_types: false 30 | 31 | # conflicts with `prefer_relative_imports` 32 | always_use_package_imports: false 33 | 34 | # Conflicts with always_specify_types 35 | avoid_annotating_with_dynamic: false 36 | 37 | # There are situations where we voluntarily want to catch everything, 38 | # especially as a library. 39 | avoid_catches_without_on_clauses: false 40 | 41 | # Only useful when targeting JS runtime 42 | avoid_double_and_int_checks: false 43 | 44 | # Improve readbility 45 | avoid_function_literals_in_foreach_calls: false 46 | 47 | # Only useful when targeting JS runtime 48 | avoid_js_rounded_ints: false 49 | 50 | # We prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) 51 | avoid_private_typedef_functions: false 52 | 53 | # Useful in a lot of cases 54 | avoid_returning_null: false 55 | 56 | # Can be useful to have a more readable code 57 | avoid_types_on_closure_parameters: false 58 | 59 | # `as` is not that bad (especially with the upcoming non-nullable types). 60 | # Explicit exceptions is better than implicit exceptions. 61 | avoid_as: false 62 | 63 | # Can be difficult to read in some cases 64 | cascade_invocations: false 65 | 66 | # Not reliable enough 67 | close_sinks: false 68 | 69 | # Blocked on https://github.com/flutter/flutter/issues/20765 70 | comment_references: false 71 | 72 | # Not useful for public properties for a constructor 73 | diagnostic_describe_all_properties: false 74 | 75 | # This project doesn't use Flutter-style todos 76 | flutter_style_todos: false 77 | 78 | # Experimental: Too many false positives: https://github.com/dart-lang/linter/issues/811 79 | invariant_booleans: false 80 | 81 | # Can be useful to have a more readable code 82 | join_return_with_assignment: false 83 | 84 | # Not useful for comments 85 | lines_longer_than_80_chars: false 86 | 87 | # Too many false positives: https://github.com/dart-lang/sdk/issues/34181 88 | literal_only_boolean_expressions: false 89 | 90 | # Disabled for now until we have NNBD as it otherwise conflicts with `missing_return` 91 | no_default_cases: false 92 | 93 | # Can be useful to have a more readable code 94 | omit_local_variable_types: false 95 | 96 | # Too many false positives 97 | one_member_abstracts: false 98 | 99 | # Issue: https://github.com/flutter/flutter/issues/5792 100 | only_throw_errors: false 101 | 102 | # Issue: https://github.com/dart-lang/language/issues/32 103 | prefer_mixin: false 104 | 105 | # Intelissence do the jobs for constructors. 106 | prefer_asserts_with_message: false 107 | 108 | # More readable 109 | prefer_relative_imports: false 110 | 111 | # Conflicts with `prefer_single_quotes` 112 | # Single quotes are easier to type and don't compromise on readability. 113 | prefer_double_quotes: false 114 | 115 | # Conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 116 | # Not quite suitable for Flutter, which may have a `build` method with a single 117 | # return, but that return is still complex enough that a "body" is worth it. 118 | prefer_expression_function_bodies: false 119 | 120 | # False positives 121 | top_level_function_literal_block: false 122 | 123 | # We don't want to enforce this rule now. 124 | sort_pub_dependencies: false 125 | 126 | # Too many false positives 127 | unawaited_futures: false 128 | 129 | # Has false positives: https://github.com/dart-lang/linter/issues/498 130 | unnecessary_lambdas: false 131 | 132 | # Has false positives: https://github.com/dart-lang/sdk/issues/34182 133 | use_string_buffers: false 134 | 135 | # Has false positives, so we prefer to catch this by code-review 136 | use_to_and_as_if_applicable: false 137 | 138 | # Incompatible with `prefer_final_locals` 139 | # Having immutable local variables makes larger functions more predictible 140 | # so we will use `prefer_final_locals` instead. 141 | unnecessary_final: false -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Enable all rules by default 2 | include: all_lint_rules.yaml 3 | analyzer: 4 | strong-mode: 5 | implicit-casts: false 6 | implicit-dynamic: false 7 | errors: 8 | dead_code: warning 9 | # Otherwise cause the import of all_lint_rules to warn because of some rules conflicts. 10 | # The conflicts are fixed in this file instead, so we can safely ignore the warning. 11 | included_file_warning: ignore 12 | missing_required_param: error 13 | missing_return: error 14 | enable-experiment: 15 | - non-nullable 16 | 17 | linter: 18 | rules: 19 | # We prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 20 | always_put_required_named_parameters_first: false 21 | 22 | # Depends on your needs 23 | always_require_non_null_named_parameters: false 24 | 25 | # Conflicts with `omit_local_variable_types` and other rules. 26 | # As per Dart guidelines, we want to avoid unnecessary types to make the code 27 | # more readable. 28 | # See https://dart.dev/guides/language/effective-dart/design#avoid-type-annotating-initialized-local-variables 29 | always_specify_types: false 30 | 31 | # conflicts with `prefer_relative_imports` 32 | always_use_package_imports: false 33 | 34 | # Conflicts with always_specify_types 35 | avoid_annotating_with_dynamic: false 36 | 37 | # There are situations where we voluntarily want to catch everything, 38 | # especially as a library. 39 | avoid_catches_without_on_clauses: false 40 | 41 | # Only useful when targeting JS runtime 42 | avoid_double_and_int_checks: false 43 | 44 | # Improve readbility 45 | avoid_function_literals_in_foreach_calls: false 46 | 47 | # Only useful when targeting JS runtime 48 | avoid_js_rounded_ints: false 49 | 50 | # We prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) 51 | avoid_private_typedef_functions: false 52 | 53 | # Useful in a lot of cases 54 | avoid_returning_null: false 55 | 56 | # Can be useful to have a more readable code 57 | avoid_types_on_closure_parameters: false 58 | 59 | # `as` is not that bad (especially with the upcoming non-nullable types). 60 | # Explicit exceptions is better than implicit exceptions. 61 | avoid_as: false 62 | 63 | # Can be difficult to read in some cases 64 | cascade_invocations: false 65 | 66 | # Not reliable enough 67 | close_sinks: false 68 | 69 | # Blocked on https://github.com/flutter/flutter/issues/20765 70 | comment_references: false 71 | 72 | # Not useful for public properties for a constructor 73 | diagnostic_describe_all_properties: false 74 | 75 | # This project doesn't use Flutter-style todos 76 | flutter_style_todos: false 77 | 78 | # Experimental: Too many false positives: https://github.com/dart-lang/linter/issues/811 79 | invariant_booleans: false 80 | 81 | # Can be useful to have a more readable code 82 | join_return_with_assignment: false 83 | 84 | # Not useful for comments 85 | lines_longer_than_80_chars: false 86 | 87 | # Too many false positives: https://github.com/dart-lang/sdk/issues/34181 88 | literal_only_boolean_expressions: false 89 | 90 | # Disabled for now until we have NNBD as it otherwise conflicts with `missing_return` 91 | no_default_cases: false 92 | 93 | # Can be useful to have a more readable code 94 | omit_local_variable_types: false 95 | 96 | # Too many false positives 97 | one_member_abstracts: false 98 | 99 | # Issue: https://github.com/flutter/flutter/issues/5792 100 | only_throw_errors: false 101 | 102 | # Issue: https://github.com/dart-lang/language/issues/32 103 | prefer_mixin: false 104 | 105 | # Intelissence do the jobs for constructors. 106 | prefer_asserts_with_message: false 107 | 108 | # More readable 109 | prefer_relative_imports: false 110 | 111 | # Conflicts with `prefer_single_quotes` 112 | # Single quotes are easier to type and don't compromise on readability. 113 | prefer_double_quotes: false 114 | 115 | # Conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 116 | # Not quite suitable for Flutter, which may have a `build` method with a single 117 | # return, but that return is still complex enough that a "body" is worth it. 118 | prefer_expression_function_bodies: false 119 | 120 | # False positives 121 | top_level_function_literal_block: false 122 | 123 | # We don't want to enforce this rule now. 124 | sort_pub_dependencies: false 125 | 126 | # Too many false positives 127 | unawaited_futures: false 128 | 129 | # Has false positives: https://github.com/dart-lang/linter/issues/498 130 | unnecessary_lambdas: false 131 | 132 | # Has false positives: https://github.com/dart-lang/sdk/issues/34182 133 | use_string_buffers: false 134 | 135 | # Has false positives, so we prefer to catch this by code-review 136 | use_to_and_as_if_applicable: false 137 | 138 | # Incompatible with `prefer_final_locals` 139 | # Having immutable local variables makes larger functions more predictible 140 | # so we will use `prefer_final_locals` instead. 141 | unnecessary_final: false -------------------------------------------------------------------------------- /all_lint_rules.yaml: -------------------------------------------------------------------------------- 1 | linter: 2 | rules: 3 | - always_declare_return_types 4 | - always_put_control_body_on_new_line 5 | - always_put_required_named_parameters_first 6 | - always_require_non_null_named_parameters 7 | - always_specify_types 8 | - always_use_package_imports 9 | - annotate_overrides 10 | - avoid_annotating_with_dynamic 11 | - avoid_as 12 | - avoid_bool_literals_in_conditional_expressions 13 | - avoid_catches_without_on_clauses 14 | - avoid_catching_errors 15 | - avoid_classes_with_only_static_members 16 | - avoid_double_and_int_checks 17 | - avoid_empty_else 18 | - avoid_equals_and_hash_code_on_mutable_classes 19 | - avoid_escaping_inner_quotes 20 | - avoid_field_initializers_in_const_classes 21 | - avoid_function_literals_in_foreach_calls 22 | - avoid_implementing_value_types 23 | - avoid_init_to_null 24 | - avoid_js_rounded_ints 25 | - avoid_null_checks_in_equality_operators 26 | - avoid_positional_boolean_parameters 27 | - avoid_print 28 | - avoid_private_typedef_functions 29 | - avoid_redundant_argument_values 30 | - avoid_relative_lib_imports 31 | - avoid_renaming_method_parameters 32 | - avoid_return_types_on_setters 33 | - avoid_returning_null 34 | - avoid_returning_null_for_future 35 | - avoid_returning_null_for_void 36 | - avoid_returning_this 37 | - avoid_setters_without_getters 38 | - avoid_shadowing_type_parameters 39 | - avoid_single_cascade_in_expression_statements 40 | - avoid_slow_async_io 41 | - avoid_type_to_string 42 | - avoid_types_as_parameter_names 43 | - avoid_types_on_closure_parameters 44 | - avoid_unnecessary_containers 45 | - avoid_unused_constructor_parameters 46 | - avoid_void_async 47 | - avoid_web_libraries_in_flutter 48 | - await_only_futures 49 | - camel_case_extensions 50 | - camel_case_types 51 | - cancel_subscriptions 52 | - cascade_invocations 53 | - cast_nullable_to_non_nullable 54 | - close_sinks 55 | - comment_references 56 | - constant_identifier_names 57 | - control_flow_in_finally 58 | - curly_braces_in_flow_control_structures 59 | - diagnostic_describe_all_properties 60 | - directives_ordering 61 | - do_not_use_environment 62 | - empty_catches 63 | - empty_constructor_bodies 64 | - empty_statements 65 | - exhaustive_cases 66 | - file_names 67 | - flutter_style_todos 68 | - hash_and_equals 69 | - implementation_imports 70 | - invariant_booleans 71 | - iterable_contains_unrelated_type 72 | - join_return_with_assignment 73 | - leading_newlines_in_multiline_strings 74 | - library_names 75 | - library_prefixes 76 | - lines_longer_than_80_chars 77 | - list_remove_unrelated_type 78 | - literal_only_boolean_expressions 79 | - missing_whitespace_between_adjacent_strings 80 | - no_adjacent_strings_in_list 81 | - no_default_cases 82 | - no_duplicate_case_values 83 | - no_logic_in_create_state 84 | - no_runtimeType_toString 85 | - non_constant_identifier_names 86 | - null_check_on_nullable_type_parameter 87 | - null_closures 88 | - omit_local_variable_types 89 | - one_member_abstracts 90 | - only_throw_errors 91 | - overridden_fields 92 | - package_api_docs 93 | - package_names 94 | - package_prefixed_library_names 95 | - parameter_assignments 96 | - prefer_adjacent_string_concatenation 97 | - prefer_asserts_in_initializer_lists 98 | - prefer_asserts_with_message 99 | - prefer_collection_literals 100 | - prefer_conditional_assignment 101 | - prefer_const_constructors 102 | - prefer_const_constructors_in_immutables 103 | - prefer_const_declarations 104 | - prefer_const_literals_to_create_immutables 105 | - prefer_constructors_over_static_methods 106 | - prefer_contains 107 | - prefer_double_quotes 108 | - prefer_equal_for_default_values 109 | - prefer_expression_function_bodies 110 | - prefer_final_fields 111 | - prefer_final_in_for_each 112 | - prefer_final_locals 113 | - prefer_for_elements_to_map_fromIterable 114 | - prefer_foreach 115 | - prefer_function_declarations_over_variables 116 | - prefer_generic_function_type_aliases 117 | - prefer_if_elements_to_conditional_expressions 118 | - prefer_if_null_operators 119 | - prefer_initializing_formals 120 | - prefer_inlined_adds 121 | - prefer_int_literals 122 | - prefer_interpolation_to_compose_strings 123 | - prefer_is_empty 124 | - prefer_is_not_empty 125 | - prefer_is_not_operator 126 | - prefer_iterable_whereType 127 | - prefer_mixin 128 | - prefer_null_aware_operators 129 | - prefer_relative_imports 130 | - prefer_single_quotes 131 | - prefer_spread_collections 132 | - prefer_typing_uninitialized_variables 133 | - prefer_void_to_null 134 | - provide_deprecation_message 135 | - public_member_api_docs 136 | - recursive_getters 137 | - sized_box_for_whitespace 138 | - slash_for_doc_comments 139 | - sort_child_properties_last 140 | - sort_constructors_first 141 | - sort_pub_dependencies 142 | - sort_unnamed_constructors_first 143 | - test_types_in_equals 144 | - throw_in_finally 145 | - tighten_type_of_initializing_formals 146 | - type_annotate_public_apis 147 | - type_init_formals 148 | - unawaited_futures 149 | - unnecessary_await_in_return 150 | - unnecessary_brace_in_string_interps 151 | - unnecessary_const 152 | - unnecessary_final 153 | - unnecessary_getters_setters 154 | - unnecessary_lambdas 155 | - unnecessary_new 156 | - unnecessary_null_aware_assignments 157 | - unnecessary_null_checks 158 | - unnecessary_null_in_if_null_operators 159 | - unnecessary_nullable_for_final_variable_declarations 160 | - unnecessary_overrides 161 | - unnecessary_parenthesis 162 | - unnecessary_raw_strings 163 | - unnecessary_statements 164 | - unnecessary_string_escapes 165 | - unnecessary_string_interpolations 166 | - unnecessary_this 167 | - unrelated_type_equality_checks 168 | - unsafe_html 169 | - use_full_hex_values_for_flutter_colors 170 | - use_function_type_syntax_for_parameters 171 | - use_is_even_rather_than_modulo 172 | - use_key_in_widget_constructors 173 | - use_late_for_private_fields_and_variables 174 | - use_raw_strings 175 | - use_rethrow_when_possible 176 | - use_setters_to_change_properties 177 | - use_string_buffers 178 | - use_to_and_as_if_applicable 179 | - valid_regexps 180 | - void_checks -------------------------------------------------------------------------------- /example/all_lint_rules.yaml: -------------------------------------------------------------------------------- 1 | linter: 2 | rules: 3 | - always_declare_return_types 4 | - always_put_control_body_on_new_line 5 | - always_put_required_named_parameters_first 6 | - always_require_non_null_named_parameters 7 | - always_specify_types 8 | - always_use_package_imports 9 | - annotate_overrides 10 | - avoid_annotating_with_dynamic 11 | - avoid_as 12 | - avoid_bool_literals_in_conditional_expressions 13 | - avoid_catches_without_on_clauses 14 | - avoid_catching_errors 15 | - avoid_classes_with_only_static_members 16 | - avoid_double_and_int_checks 17 | - avoid_empty_else 18 | - avoid_equals_and_hash_code_on_mutable_classes 19 | - avoid_escaping_inner_quotes 20 | - avoid_field_initializers_in_const_classes 21 | - avoid_function_literals_in_foreach_calls 22 | - avoid_implementing_value_types 23 | - avoid_init_to_null 24 | - avoid_js_rounded_ints 25 | - avoid_null_checks_in_equality_operators 26 | - avoid_positional_boolean_parameters 27 | - avoid_print 28 | - avoid_private_typedef_functions 29 | - avoid_redundant_argument_values 30 | - avoid_relative_lib_imports 31 | - avoid_renaming_method_parameters 32 | - avoid_return_types_on_setters 33 | - avoid_returning_null 34 | - avoid_returning_null_for_future 35 | - avoid_returning_null_for_void 36 | - avoid_returning_this 37 | - avoid_setters_without_getters 38 | - avoid_shadowing_type_parameters 39 | - avoid_single_cascade_in_expression_statements 40 | - avoid_slow_async_io 41 | - avoid_type_to_string 42 | - avoid_types_as_parameter_names 43 | - avoid_types_on_closure_parameters 44 | - avoid_unnecessary_containers 45 | - avoid_unused_constructor_parameters 46 | - avoid_void_async 47 | - avoid_web_libraries_in_flutter 48 | - await_only_futures 49 | - camel_case_extensions 50 | - camel_case_types 51 | - cancel_subscriptions 52 | - cascade_invocations 53 | - cast_nullable_to_non_nullable 54 | - close_sinks 55 | - comment_references 56 | - constant_identifier_names 57 | - control_flow_in_finally 58 | - curly_braces_in_flow_control_structures 59 | - diagnostic_describe_all_properties 60 | - directives_ordering 61 | - do_not_use_environment 62 | - empty_catches 63 | - empty_constructor_bodies 64 | - empty_statements 65 | - exhaustive_cases 66 | - file_names 67 | - flutter_style_todos 68 | - hash_and_equals 69 | - implementation_imports 70 | - invariant_booleans 71 | - iterable_contains_unrelated_type 72 | - join_return_with_assignment 73 | - leading_newlines_in_multiline_strings 74 | - library_names 75 | - library_prefixes 76 | - lines_longer_than_80_chars 77 | - list_remove_unrelated_type 78 | - literal_only_boolean_expressions 79 | - missing_whitespace_between_adjacent_strings 80 | - no_adjacent_strings_in_list 81 | - no_default_cases 82 | - no_duplicate_case_values 83 | - no_logic_in_create_state 84 | - no_runtimeType_toString 85 | - non_constant_identifier_names 86 | - null_check_on_nullable_type_parameter 87 | - null_closures 88 | - omit_local_variable_types 89 | - one_member_abstracts 90 | - only_throw_errors 91 | - overridden_fields 92 | - package_api_docs 93 | - package_names 94 | - package_prefixed_library_names 95 | - parameter_assignments 96 | - prefer_adjacent_string_concatenation 97 | - prefer_asserts_in_initializer_lists 98 | - prefer_asserts_with_message 99 | - prefer_collection_literals 100 | - prefer_conditional_assignment 101 | - prefer_const_constructors 102 | - prefer_const_constructors_in_immutables 103 | - prefer_const_declarations 104 | - prefer_const_literals_to_create_immutables 105 | - prefer_constructors_over_static_methods 106 | - prefer_contains 107 | - prefer_double_quotes 108 | - prefer_equal_for_default_values 109 | - prefer_expression_function_bodies 110 | - prefer_final_fields 111 | - prefer_final_in_for_each 112 | - prefer_final_locals 113 | - prefer_for_elements_to_map_fromIterable 114 | - prefer_foreach 115 | - prefer_function_declarations_over_variables 116 | - prefer_generic_function_type_aliases 117 | - prefer_if_elements_to_conditional_expressions 118 | - prefer_if_null_operators 119 | - prefer_initializing_formals 120 | - prefer_inlined_adds 121 | - prefer_int_literals 122 | - prefer_interpolation_to_compose_strings 123 | - prefer_is_empty 124 | - prefer_is_not_empty 125 | - prefer_is_not_operator 126 | - prefer_iterable_whereType 127 | - prefer_mixin 128 | - prefer_null_aware_operators 129 | - prefer_relative_imports 130 | - prefer_single_quotes 131 | - prefer_spread_collections 132 | - prefer_typing_uninitialized_variables 133 | - prefer_void_to_null 134 | - provide_deprecation_message 135 | - public_member_api_docs 136 | - recursive_getters 137 | - sized_box_for_whitespace 138 | - slash_for_doc_comments 139 | - sort_child_properties_last 140 | - sort_constructors_first 141 | - sort_pub_dependencies 142 | - sort_unnamed_constructors_first 143 | - test_types_in_equals 144 | - throw_in_finally 145 | - tighten_type_of_initializing_formals 146 | - type_annotate_public_apis 147 | - type_init_formals 148 | - unawaited_futures 149 | - unnecessary_await_in_return 150 | - unnecessary_brace_in_string_interps 151 | - unnecessary_const 152 | - unnecessary_final 153 | - unnecessary_getters_setters 154 | - unnecessary_lambdas 155 | - unnecessary_new 156 | - unnecessary_null_aware_assignments 157 | - unnecessary_null_checks 158 | - unnecessary_null_in_if_null_operators 159 | - unnecessary_nullable_for_final_variable_declarations 160 | - unnecessary_overrides 161 | - unnecessary_parenthesis 162 | - unnecessary_raw_strings 163 | - unnecessary_statements 164 | - unnecessary_string_escapes 165 | - unnecessary_string_interpolations 166 | - unnecessary_this 167 | - unrelated_type_equality_checks 168 | - unsafe_html 169 | - use_full_hex_values_for_flutter_colors 170 | - use_function_type_syntax_for_parameters 171 | - use_is_even_rather_than_modulo 172 | - use_key_in_widget_constructors 173 | - use_late_for_private_fields_and_variables 174 | - use_raw_strings 175 | - use_rethrow_when_possible 176 | - use_setters_to_change_properties 177 | - use_string_buffers 178 | - use_to_and_as_if_applicable 179 | - valid_regexps 180 | - void_checks -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = ""; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 9.3"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_ANALYZER_NONNULL = YES; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 267 | CLANG_WARN_STRICT_PROTOTYPES = YES; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 274 | ENABLE_NS_ASSERTIONS = NO; 275 | ENABLE_STRICT_OBJC_MSGSEND = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | SUPPORTED_PLATFORMS = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Profile; 292 | }; 293 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 294 | isa = XCBuildConfiguration; 295 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CLANG_ENABLE_MODULES = YES; 299 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 300 | ENABLE_BITCODE = NO; 301 | FRAMEWORK_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | INFOPLIST_FILE = Runner/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | LIBRARY_SEARCH_PATHS = ( 308 | "$(inherited)", 309 | "$(PROJECT_DIR)/Flutter", 310 | ); 311 | PRODUCT_BUNDLE_IDENTIFIER = com.akmal02.jigsawPuzzleGame; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 314 | SWIFT_VERSION = 5.0; 315 | VERSIONING_SYSTEM = "apple-generic"; 316 | }; 317 | name = Profile; 318 | }; 319 | 97C147031CF9000F007C117D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | CLANG_ANALYZER_NONNULL = YES; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_COMMA = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = dwarf; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | ENABLE_TESTABILITY = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_DYNAMIC_NO_PIC = NO; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 368 | MTL_ENABLE_DEBUG_INFO = YES; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 97C147041CF9000F007C117D /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_ANALYZER_NONNULL = YES; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_COMMA = YES; 388 | CLANG_WARN_CONSTANT_CONVERSION = YES; 389 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_EMPTY_BODY = YES; 392 | CLANG_WARN_ENUM_CONVERSION = YES; 393 | CLANG_WARN_INFINITE_RECURSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | SUPPORTED_PLATFORMS = iphoneos; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | 97C147061CF9000F007C117D /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "$(PROJECT_DIR)/Flutter", 438 | ); 439 | INFOPLIST_FILE = Runner/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | LIBRARY_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | PRODUCT_BUNDLE_IDENTIFIER = com.akmal02.jigsawPuzzleGame; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 448 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 449 | SWIFT_VERSION = 5.0; 450 | VERSIONING_SYSTEM = "apple-generic"; 451 | }; 452 | name = Debug; 453 | }; 454 | 97C147071CF9000F007C117D /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 457 | buildSettings = { 458 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 459 | CLANG_ENABLE_MODULES = YES; 460 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 461 | ENABLE_BITCODE = NO; 462 | FRAMEWORK_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "$(PROJECT_DIR)/Flutter", 465 | ); 466 | INFOPLIST_FILE = Runner/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | LIBRARY_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = com.akmal02.jigsawPuzzleGame; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 475 | SWIFT_VERSION = 5.0; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /lib/src/jigsaw.dart: -------------------------------------------------------------------------------- 1 | // TODO remove me 2 | // ignore_for_file: public_member_api_docs 3 | 4 | import 'dart:math' as math; 5 | import 'dart:typed_data'; 6 | import 'dart:ui'; 7 | import 'package:carousel_slider/carousel_slider.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter/rendering.dart'; 10 | import 'package:image/image.dart' as ui; 11 | 12 | import 'package:flutter_jigsaw_puzzle/src/error.dart'; 13 | 14 | class JigsawPuzzle extends StatefulWidget { 15 | const JigsawPuzzle({ 16 | Key? key, 17 | required this.gridSize, 18 | required this.image, 19 | required this.puzzleKey, 20 | this.onFinished, 21 | this.onBlockSuccess, 22 | this.outlineCanvas = true, 23 | this.autoStart = false, 24 | this.snapSensitivity = .5, 25 | }) : super(key: key); 26 | 27 | final int gridSize; 28 | final Function()? onFinished; 29 | final Function()? onBlockSuccess; 30 | final ImageProvider image; 31 | final bool autoStart; 32 | final bool outlineCanvas; 33 | final double snapSensitivity; 34 | final GlobalKey puzzleKey; 35 | 36 | @override 37 | _JigsawPuzzleState createState() => _JigsawPuzzleState(); 38 | } 39 | 40 | class _JigsawPuzzleState extends State { 41 | @override 42 | Widget build(BuildContext context) { 43 | return Column( 44 | mainAxisSize: MainAxisSize.min, 45 | children: [ 46 | const SizedBox(height: 16), 47 | JigsawWidget( 48 | callbackFinish: () { 49 | if (widget.onFinished != null) { 50 | widget.onFinished!(); 51 | } 52 | }, 53 | callbackSuccess: () { 54 | if (widget.onBlockSuccess != null) { 55 | widget.onBlockSuccess!(); 56 | } 57 | }, 58 | key: widget.puzzleKey, 59 | gridSize: widget.gridSize, 60 | snapSensitivity: widget.snapSensitivity, 61 | outlineCanvas: widget.outlineCanvas, 62 | child: Image( 63 | fit: BoxFit.contain, 64 | image: widget.image, 65 | ), 66 | ), 67 | ], 68 | ); 69 | } 70 | } 71 | 72 | class JigsawWidget extends StatefulWidget { 73 | const JigsawWidget({ 74 | Key? key, 75 | required this.gridSize, 76 | required this.snapSensitivity, 77 | required this.child, 78 | this.callbackFinish, 79 | this.callbackSuccess, 80 | this.outlineCanvas = true, 81 | }) : super(key: key); 82 | 83 | final Widget child; 84 | final Function()? callbackSuccess; 85 | final Function()? callbackFinish; 86 | final int gridSize; 87 | final bool outlineCanvas; 88 | final double snapSensitivity; 89 | 90 | @override 91 | JigsawWidgetState createState() => JigsawWidgetState(); 92 | } 93 | 94 | class JigsawWidgetState extends State { 95 | final GlobalKey _globalKey = GlobalKey(); 96 | ui.Image? fullImage; 97 | Size? size; 98 | 99 | List> images = >[]; 100 | ValueNotifier> blocksNotifier = 101 | ValueNotifier>([]); 102 | CarouselController? _carouselController; 103 | 104 | Offset _pos = Offset.zero; 105 | int? _index; 106 | 107 | Future _getImageFromWidget() async { 108 | final RenderRepaintBoundary boundary = 109 | _globalKey.currentContext!.findRenderObject()! as RenderRepaintBoundary; 110 | 111 | size = boundary.size; 112 | final img = await boundary.toImage(); 113 | final byteData = await img.toByteData(format: ImageByteFormat.png); 114 | final pngBytes = byteData?.buffer.asUint8List(); 115 | 116 | if (pngBytes == null) { 117 | throw InvalidImageException(); 118 | } 119 | return ui.decodeImage(List.from(pngBytes)); 120 | } 121 | 122 | void reset() { 123 | images.clear(); 124 | blocksNotifier = ValueNotifier>([]); 125 | // ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member 126 | blocksNotifier.notifyListeners(); 127 | setState(() {}); 128 | } 129 | 130 | Future generate() async { 131 | images = [[]]; 132 | 133 | fullImage ??= await _getImageFromWidget(); 134 | 135 | final int xSplitCount = widget.gridSize; 136 | final int ySplitCount = widget.gridSize; 137 | 138 | final double widthPerBlock = fullImage!.width / xSplitCount; 139 | final double heightPerBlock = fullImage!.height / ySplitCount; 140 | 141 | for (var y = 0; y < ySplitCount; y++) { 142 | final tempImages = []; 143 | 144 | images.add(tempImages); 145 | for (var x = 0; x < xSplitCount; x++) { 146 | final int randomPosRow = math.Random().nextInt(2).isEven ? 1 : -1; 147 | final int randomPosCol = math.Random().nextInt(2).isEven ? 1 : -1; 148 | 149 | Offset offsetCenter = Offset(widthPerBlock / 2, heightPerBlock / 2); 150 | 151 | final ClassJigsawPos jigsawPosSide = ClassJigsawPos( 152 | bottom: y == ySplitCount - 1 ? 0 : randomPosCol, 153 | left: x == 0 154 | ? 0 155 | : -images[y][x - 1].jigsawBlockWidget.imageBox.posSide.right, 156 | right: x == xSplitCount - 1 ? 0 : randomPosRow, 157 | top: y == 0 158 | ? 0 159 | : -images[y - 1][x].jigsawBlockWidget.imageBox.posSide.bottom, 160 | ); 161 | 162 | double xAxis = widthPerBlock * x; 163 | double yAxis = heightPerBlock * y; 164 | 165 | final double minSize = math.min(widthPerBlock, heightPerBlock) / 15 * 4; 166 | 167 | offsetCenter = Offset( 168 | (widthPerBlock / 2) + (jigsawPosSide.left == 1 ? minSize : 0), 169 | (heightPerBlock / 2) + (jigsawPosSide.top == 1 ? minSize : 0), 170 | ); 171 | 172 | xAxis -= jigsawPosSide.left == 1 ? minSize : 0; 173 | yAxis -= jigsawPosSide.top == 1 ? minSize : 0; 174 | 175 | final double widthPerBlockTemp = widthPerBlock + 176 | (jigsawPosSide.left == 1 ? minSize : 0) + 177 | (jigsawPosSide.right == 1 ? minSize : 0); 178 | final double heightPerBlockTemp = heightPerBlock + 179 | (jigsawPosSide.top == 1 ? minSize : 0) + 180 | (jigsawPosSide.bottom == 1 ? minSize : 0); 181 | 182 | final ui.Image temp = ui.copyCrop( 183 | fullImage!, 184 | xAxis.round(), 185 | yAxis.round(), 186 | widthPerBlockTemp.round(), 187 | heightPerBlockTemp.round(), 188 | ); 189 | 190 | final Offset offset = Offset(size!.width / 2 - widthPerBlockTemp / 2, 191 | size!.height / 2 - heightPerBlockTemp / 2); 192 | 193 | final ImageBox imageBox = ImageBox( 194 | image: Image.memory( 195 | Uint8List.fromList(ui.encodePng(temp)), 196 | fit: BoxFit.contain, 197 | ), 198 | isDone: false, 199 | offsetCenter: offsetCenter, 200 | posSide: jigsawPosSide, 201 | radiusPoint: minSize, 202 | size: Size(widthPerBlockTemp, heightPerBlockTemp), 203 | ); 204 | 205 | images[y].add( 206 | BlockClass( 207 | jigsawBlockWidget: JigsawBlockWidget( 208 | imageBox: imageBox, 209 | ), 210 | offset: offset, 211 | offsetDefault: Offset(xAxis, yAxis)), 212 | ); 213 | } 214 | } 215 | 216 | blocksNotifier.value = images.expand((image) => image).toList(); 217 | blocksNotifier.value.shuffle(); 218 | // ignore: invalid_use_of_visible_for_testing_member, invalid_use_of_protected_member 219 | blocksNotifier.notifyListeners(); 220 | setState(() {}); 221 | } 222 | 223 | @override 224 | void initState() { 225 | _carouselController = CarouselController(); 226 | super.initState(); 227 | } 228 | 229 | @override 230 | Widget build(BuildContext context) { 231 | return ValueListenableBuilder( 232 | valueListenable: blocksNotifier, 233 | builder: (context, List blocks, child) { 234 | final List blockNotDone = blocks 235 | .where((block) => !block.jigsawBlockWidget.imageBox.isDone) 236 | .toList(); 237 | final List blockDone = blocks 238 | .where((block) => block.jigsawBlockWidget.imageBox.isDone) 239 | .toList(); 240 | 241 | return Column( 242 | mainAxisSize: MainAxisSize.min, 243 | children: [ 244 | AspectRatio( 245 | aspectRatio: 1, 246 | child: SizedBox( 247 | width: double.infinity, 248 | child: Listener( 249 | onPointerUp: (event) { 250 | if (blockNotDone.isEmpty) { 251 | reset(); 252 | widget.callbackFinish?.call(); 253 | } 254 | 255 | if (_index == null) { 256 | _carouselController?.nextPage( 257 | duration: const Duration(microseconds: 600)); 258 | setState(() {}); 259 | } 260 | }, 261 | onPointerMove: (event) { 262 | if (_index == null) { 263 | return; 264 | } 265 | if (blockNotDone.isEmpty) { 266 | return; 267 | } 268 | 269 | final Offset offset = event.localPosition - _pos; 270 | 271 | blockNotDone[_index!].offset = offset; 272 | 273 | const minSensitivity = 0; 274 | const maxSensitivity = 1; 275 | const maxDistanceThreshold = 20; 276 | const minDistanceThreshold = 1; 277 | 278 | final sensitivity = widget.snapSensitivity; 279 | final distanceThreshold = sensitivity * 280 | (maxSensitivity - minSensitivity) * 281 | (maxDistanceThreshold - minDistanceThreshold) + 282 | minDistanceThreshold; 283 | 284 | if ((blockNotDone[_index!].offset - 285 | blockNotDone[_index!].offsetDefault) 286 | .distance < 287 | distanceThreshold) { 288 | blockNotDone[_index!] 289 | .jigsawBlockWidget 290 | .imageBox 291 | .isDone = true; 292 | 293 | blockNotDone[_index!].offset = 294 | blockNotDone[_index!].offsetDefault; 295 | 296 | _index = null; 297 | 298 | // ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member 299 | blocksNotifier.notifyListeners(); 300 | 301 | widget.callbackSuccess?.call(); 302 | } 303 | 304 | setState(() {}); 305 | }, 306 | child: Stack( 307 | children: [ 308 | if (blocks.isEmpty) ...[ 309 | RepaintBoundary( 310 | key: _globalKey, 311 | child: SizedBox( 312 | height: double.maxFinite, 313 | width: double.maxFinite, 314 | child: widget.child, 315 | ), 316 | ) 317 | ], 318 | Offstage( 319 | offstage: blocks.isEmpty, 320 | child: Container( 321 | color: Colors.white, 322 | width: size?.width, 323 | height: size?.height, 324 | child: CustomPaint( 325 | painter: JigsawPainterBackground( 326 | blocks, 327 | outlineCanvas: widget.outlineCanvas, 328 | ), 329 | child: Stack( 330 | children: [ 331 | if (blockDone.isNotEmpty) 332 | ...blockDone.map( 333 | (map) { 334 | return Positioned( 335 | left: map.offset.dx, 336 | top: map.offset.dy, 337 | child: Container( 338 | child: map.jigsawBlockWidget, 339 | ), 340 | ); 341 | }, 342 | ), 343 | if (blockNotDone.isNotEmpty) 344 | ...blockNotDone.asMap().entries.map( 345 | (map) { 346 | return Positioned( 347 | left: map.value.offset.dx, 348 | top: map.value.offset.dy, 349 | child: Offstage( 350 | offstage: !(_index == map.key), 351 | child: GestureDetector( 352 | onTapDown: (details) { 353 | if (map.value.jigsawBlockWidget 354 | .imageBox.isDone) { 355 | return; 356 | } 357 | 358 | setState(() { 359 | _pos = details.localPosition; 360 | _index = map.key; 361 | }); 362 | }, 363 | child: Container( 364 | child: 365 | map.value.jigsawBlockWidget, 366 | ), 367 | ), 368 | ), 369 | ); 370 | }, 371 | ) 372 | ], 373 | ), 374 | ), 375 | ), 376 | ) 377 | ], 378 | ), 379 | ), 380 | ), 381 | ), 382 | Container( 383 | color: Colors.white, 384 | height: 120, 385 | child: CarouselSlider( 386 | carouselController: _carouselController, 387 | options: CarouselOptions( 388 | initialPage: _index ?? 0, 389 | height: 80, 390 | aspectRatio: 1, 391 | viewportFraction: 0.3, 392 | enlargeCenterPage: true, 393 | onPageChanged: (index, reason) { 394 | _index = index; 395 | setState(() {}); 396 | }, 397 | ), 398 | items: blockNotDone.map((block) { 399 | final Size sizeBlock = 400 | block.jigsawBlockWidget.imageBox.size; 401 | return FittedBox( 402 | child: SizedBox( 403 | width: sizeBlock.width, 404 | height: sizeBlock.height, 405 | child: block.jigsawBlockWidget, 406 | ), 407 | ); 408 | }).toList(), 409 | )) 410 | ], 411 | ); 412 | }); 413 | } 414 | } 415 | 416 | class JigsawPainterBackground extends CustomPainter { 417 | JigsawPainterBackground(this.blocks, {required this.outlineCanvas}); 418 | 419 | List blocks; 420 | bool outlineCanvas; 421 | 422 | @override 423 | void paint(Canvas canvas, Size size) { 424 | final Paint paint = Paint() 425 | ..style = outlineCanvas ? PaintingStyle.stroke : PaintingStyle.fill 426 | ..color = Colors.black12 427 | ..strokeWidth = 2 428 | ..strokeCap = StrokeCap.round; 429 | final Path path = Path(); 430 | 431 | blocks.forEach((element) { 432 | final Path pathTemp = getPiecePath( 433 | element.jigsawBlockWidget.imageBox.size, 434 | element.jigsawBlockWidget.imageBox.radiusPoint, 435 | element.jigsawBlockWidget.imageBox.offsetCenter, 436 | element.jigsawBlockWidget.imageBox.posSide, 437 | ); 438 | 439 | path.addPath(pathTemp, element.offsetDefault); 440 | }); 441 | 442 | canvas.drawPath(path, paint); 443 | } 444 | 445 | @override 446 | bool shouldRepaint(covariant CustomPainter oldDelegate) => true; 447 | } 448 | 449 | class BlockClass { 450 | BlockClass({ 451 | required this.offset, 452 | required this.jigsawBlockWidget, 453 | required this.offsetDefault, 454 | }); 455 | 456 | Offset offset; 457 | Offset offsetDefault; 458 | JigsawBlockWidget jigsawBlockWidget; 459 | } 460 | 461 | class ImageBox { 462 | ImageBox({ 463 | required this.image, 464 | required this.posSide, 465 | required this.isDone, 466 | required this.offsetCenter, 467 | required this.radiusPoint, 468 | required this.size, 469 | }); 470 | 471 | Widget image; 472 | ClassJigsawPos posSide; 473 | Offset offsetCenter; 474 | Size size; 475 | double radiusPoint; 476 | bool isDone; 477 | } 478 | 479 | class ClassJigsawPos { 480 | ClassJigsawPos({ 481 | required this.top, 482 | required this.bottom, 483 | required this.left, 484 | required this.right, 485 | }); 486 | 487 | int top, bottom, left, right; 488 | } 489 | 490 | class JigsawBlockWidget extends StatefulWidget { 491 | const JigsawBlockWidget({Key? key, required this.imageBox}) : super(key: key); 492 | 493 | final ImageBox imageBox; 494 | 495 | @override 496 | _JigsawBlockWidgetState createState() => _JigsawBlockWidgetState(); 497 | } 498 | 499 | class _JigsawBlockWidgetState extends State { 500 | @override 501 | Widget build(BuildContext context) { 502 | return ClipPath( 503 | clipper: PuzzlePieceClipper(imageBox: widget.imageBox), 504 | child: CustomPaint( 505 | foregroundPainter: JigsawBlokPainter(imageBox: widget.imageBox), 506 | child: widget.imageBox.image, 507 | ), 508 | ); 509 | } 510 | } 511 | 512 | class JigsawBlokPainter extends CustomPainter { 513 | JigsawBlokPainter({ 514 | required this.imageBox, 515 | }); 516 | 517 | ImageBox imageBox; 518 | 519 | @override 520 | void paint(Canvas canvas, Size size) { 521 | final Paint paint = Paint() 522 | ..color = imageBox.isDone ? Colors.white.withOpacity(0.2) : Colors.white 523 | ..style = PaintingStyle.stroke 524 | ..strokeWidth = 2; 525 | 526 | canvas.drawPath( 527 | getPiecePath(size, imageBox.radiusPoint, imageBox.offsetCenter, 528 | imageBox.posSide), 529 | paint); 530 | 531 | if (imageBox.isDone) { 532 | final Paint paintDone = Paint() 533 | ..color = Colors.white.withOpacity(0.2) 534 | ..style = PaintingStyle.fill 535 | ..strokeWidth = 2; 536 | canvas.drawPath( 537 | getPiecePath(size, imageBox.radiusPoint, imageBox.offsetCenter, 538 | imageBox.posSide), 539 | paintDone); 540 | } 541 | } 542 | 543 | @override 544 | bool shouldRepaint(covariant CustomPainter oldDelegate) => false; 545 | } 546 | 547 | class PuzzlePieceClipper extends CustomClipper { 548 | PuzzlePieceClipper({ 549 | required this.imageBox, 550 | }); 551 | 552 | ImageBox imageBox; 553 | 554 | @override 555 | Path getClip(Size size) { 556 | return getPiecePath( 557 | size, imageBox.radiusPoint, imageBox.offsetCenter, imageBox.posSide); 558 | } 559 | 560 | @override 561 | bool shouldReclip(covariant CustomClipper oldClipper) => true; 562 | } 563 | 564 | Path getPiecePath( 565 | Size size, 566 | double radiusPoint, 567 | Offset offsetCenter, 568 | ClassJigsawPos posSide, 569 | ) { 570 | final Path path = Path(); 571 | 572 | Offset topLeft = const Offset(0, 0); 573 | Offset topRight = Offset(size.width, 0); 574 | Offset bottomLeft = Offset(0, size.height); 575 | Offset bottomRight = Offset(size.width, size.height); 576 | 577 | topLeft = Offset(posSide.left > 0 ? radiusPoint : 0, 578 | (posSide.top > 0) ? radiusPoint : 0) + 579 | topLeft; 580 | topRight = Offset(posSide.right > 0 ? -radiusPoint : 0, 581 | (posSide.top > 0) ? radiusPoint : 0) + 582 | topRight; 583 | bottomRight = Offset(posSide.right > 0 ? -radiusPoint : 0, 584 | (posSide.bottom > 0) ? -radiusPoint : 0) + 585 | bottomRight; 586 | bottomLeft = Offset(posSide.left > 0 ? radiusPoint : 0, 587 | (posSide.bottom > 0) ? -radiusPoint : 0) + 588 | bottomLeft; 589 | 590 | final double topMiddle = posSide.top == 0 591 | ? topRight.dy 592 | : (posSide.top > 0 593 | ? topRight.dy - radiusPoint 594 | : topRight.dy + radiusPoint); 595 | 596 | final double bottomMiddle = posSide.bottom == 0 597 | ? bottomRight.dy 598 | : (posSide.bottom > 0 599 | ? bottomRight.dy + radiusPoint 600 | : bottomRight.dy - radiusPoint); 601 | 602 | final double leftMiddle = posSide.left == 0 603 | ? topLeft.dx 604 | : (posSide.left > 0 605 | ? topLeft.dx - radiusPoint 606 | : topLeft.dx + radiusPoint); 607 | 608 | final double rightMiddle = posSide.right == 0 609 | ? topRight.dx 610 | : (posSide.right > 0 611 | ? topRight.dx + radiusPoint 612 | : topRight.dx - radiusPoint); 613 | 614 | path.moveTo(topLeft.dx, topLeft.dy); 615 | 616 | if (posSide.top != 0) { 617 | path.extendWithPath( 618 | calculatePoint(Axis.horizontal, topLeft.dy, 619 | Offset(offsetCenter.dx, topMiddle), radiusPoint), 620 | Offset.zero, 621 | ); 622 | } 623 | path.lineTo(topRight.dx, topRight.dy); 624 | 625 | if (posSide.right != 0) { 626 | path.extendWithPath( 627 | calculatePoint(Axis.vertical, topRight.dx, 628 | Offset(rightMiddle, offsetCenter.dy), radiusPoint), 629 | Offset.zero); 630 | } 631 | path.lineTo(bottomRight.dx, bottomRight.dy); 632 | 633 | if (posSide.bottom != 0) { 634 | path.extendWithPath( 635 | calculatePoint(Axis.horizontal, bottomRight.dy, 636 | Offset(offsetCenter.dx, bottomMiddle), -radiusPoint), 637 | Offset.zero); 638 | } 639 | path.lineTo(bottomLeft.dx, bottomLeft.dy); 640 | 641 | if (posSide.left != 0) { 642 | path.extendWithPath( 643 | calculatePoint(Axis.vertical, bottomLeft.dx, 644 | Offset(leftMiddle, offsetCenter.dy), -radiusPoint), 645 | Offset.zero); 646 | } 647 | path.lineTo(topLeft.dx, topLeft.dy); 648 | 649 | path.close(); 650 | 651 | return path; 652 | } 653 | 654 | Path calculatePoint( 655 | Axis axis, 656 | double fromPoint, 657 | Offset point, 658 | double radiusPoint, 659 | ) { 660 | final Path path = Path(); 661 | 662 | if (axis == Axis.horizontal) { 663 | path.moveTo(point.dx - radiusPoint / 2, fromPoint); 664 | path.lineTo(point.dx - radiusPoint / 2, point.dy); 665 | path.lineTo(point.dx + radiusPoint / 2, point.dy); 666 | path.lineTo(point.dx + radiusPoint / 2, fromPoint); 667 | } else if (axis == Axis.vertical) { 668 | path.moveTo(fromPoint, point.dy - radiusPoint / 2); 669 | path.lineTo(point.dx, point.dy - radiusPoint / 2); 670 | path.lineTo(point.dx, point.dy + radiusPoint / 2); 671 | path.lineTo(fromPoint, point.dy + radiusPoint / 2); 672 | } 673 | 674 | return path; 675 | } 676 | --------------------------------------------------------------------------------