├── .firebaserc ├── .git-hooks ├── pre-commit └── pre-push ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── check.yml │ └── deploy_web.yml ├── .gitignore ├── .idea └── runConfigurations │ ├── development.xml │ ├── production.xml │ └── staging.xml ├── .metadata ├── .vscode ├── extensions.json ├── launch.json └── tasks.json ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── io │ │ │ │ └── apparence │ │ │ │ └── flutter_puzzle_hack │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── animations │ └── apparence.riv ├── images │ ├── 2.0x │ │ └── flutter_logo.png │ ├── 3.0x │ │ └── flutter_logo.png │ ├── background.jpg │ ├── buttons │ │ ├── button.png │ │ ├── button_hover.png │ │ ├── button_music_off.png │ │ ├── button_music_on.png │ │ ├── button_play_again_hover.png │ │ ├── button_sound_off.png │ │ └── button_sound_on.png │ ├── flutter_logo.png │ ├── glouglou.png │ ├── logos.png │ └── timer_icon.png └── themes │ └── base │ ├── audio │ ├── music.mp3 │ └── pop.wav │ ├── tile_cross.riv │ ├── tile_end.riv │ ├── tile_horizontal.riv │ ├── tile_left_bottom.riv │ ├── tile_left_top.riv │ ├── tile_right_bottom.riv │ ├── tile_start.riv │ ├── tile_top_right.riv │ └── tile_vertical.riv ├── base_analysis_options.yaml ├── coverage_badge.svg ├── firebase.json ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ ├── Runner.xcscheme │ │ ├── development.xcscheme │ │ ├── production.xcscheme │ │ └── staging.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── l10n.yaml ├── lib ├── boostrap.dart ├── main.dart ├── main_development.dart ├── main_staging.dart └── src │ ├── app.dart │ ├── l10n │ ├── arb │ │ ├── app_en.arb │ │ └── app_fr.arb │ └── l10n.dart │ ├── layout │ ├── breakpoint_provider.dart │ └── responsive_layout_builder.dart │ ├── models │ ├── connection.dart │ ├── dimension.dart │ ├── position.dart │ ├── puzzle.dart │ ├── ticker.dart │ └── tile.dart │ ├── puzzle │ ├── audio_controller │ │ └── audio_controller.dart │ ├── helpers │ │ ├── audio_player.dart │ │ └── puzzle_generator.dart │ ├── view │ │ └── puzzle_page.dart │ └── widgets │ │ ├── puzzle_board.dart │ │ ├── puzzle_move_counter.dart │ │ ├── puzzle_tile.dart │ │ ├── puzzle_timer.dart │ │ ├── puzzle_victory_dialog.dart │ │ └── scale_up_animation.dart │ ├── splashscreen │ └── splashscreen.dart │ └── theme │ └── app_theme.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── readme-doc ├── logos.png └── showcase-readme.jpg ├── scripts └── coverage.sh ├── test ├── helpers │ ├── helpers.dart │ ├── pump_app.dart │ └── set_display_size.dart ├── layout │ ├── breakpoint_provider_test.dart │ └── responsive_layout_builder_test.dart ├── models │ ├── connection_test.dart │ ├── dimension_test.dart │ ├── position_test.dart │ ├── puzzle_test.dart │ ├── ticker_test.dart │ └── tile_test.dart ├── unit_test.dart └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "apparence-flutter-puzzle" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.git-hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Setup: git config core.hooksPath .git-hooks 4 | 5 | # Stash unstaged changes 6 | git stash -q --keep-index 7 | 8 | # Run Flutter analyzer 9 | printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer' 10 | flutter analyze 11 | if [ $? -ne 0 ]; then 12 | printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error' 13 | exit 1 14 | fi 15 | printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer' 16 | 17 | # Run tests 18 | printf "\e[33;1m%s\e[0m\n" 'Running tests' 19 | flutter test 20 | if [ $? -ne 0 ]; then 21 | printf "\e[31;1m%s\e[0m\n" 'Tests error' 22 | exit 1 23 | fi 24 | printf "\e[33;1m%s\e[0m\n" 'Finished running tests' 25 | 26 | # Run Flutter formatter 27 | printf "\e[33;1m%s\e[0m\n" 'Running the Flutter formatter' 28 | flutter format . 29 | printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter formatter' 30 | 31 | # Stage updated files 32 | git add -u 33 | 34 | # Re-apply original unstaged changes 35 | git stash pop -q 36 | -------------------------------------------------------------------------------- /.git-hooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Setup: git config core.hooksPath .git-hooks 4 | 5 | # Run Flutter analyzer 6 | printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer' 7 | flutter analyze 8 | if [ $? -ne 0 ]; then 9 | printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error' 10 | exit 1 11 | fi 12 | printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer' 13 | 14 | # Run tests 15 | printf "\e[33;1m%s\e[0m\n" 'Running tests' 16 | flutter test 17 | if [ $? -ne 0 ]; then 18 | printf "\e[31;1m%s\e[0m\n" 'Tests error' 19 | exit 1 20 | fi 21 | printf "\e[33;1m%s\e[0m\n" 'Finished running tests' 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve 4 | title: "fix: " 5 | labels: bug 6 | --- 7 | 8 | **Description** 9 | A clear and concise description of what the bug is. 10 | 11 | **Steps To Reproduce** 12 | 13 | 1. Go to '...' 14 | 2. Click on '....' 15 | 3. Scroll down to '....' 16 | 4. See error 17 | 18 | **Expected Behavior** 19 | A clear and concise description of what you expected to happen. 20 | 21 | **Screenshots** 22 | If applicable, add screenshots to help explain your problem. 23 | 24 | **Additional Context** 25 | Add any other context about the problem here. 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ## Description 10 | 11 | 12 | 13 | ## Type of Change 14 | 15 | 16 | 17 | - [ ] ✨ New feature (non-breaking change which adds functionality) 18 | - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) 19 | - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) 20 | - [ ] 🧹 Code refactor 21 | - [ ] ✅ Build configuration change 22 | - [ ] 📝 Documentation 23 | - [ ] 🗑️ Chore 24 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: Application Check 2 | 3 | on: 4 | pull_request: 5 | push: 6 | paths: 7 | - "lib/**" 8 | - "test/**" 9 | - "pubspec.yaml" 10 | - "pubspec.lock" 11 | - ".github/workflows/check.yml" 12 | branches-ignore: 13 | - main 14 | 15 | jobs: 16 | check: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v2 21 | 22 | - uses: subosito/flutter-action@v2 23 | with: 24 | flutter-version: 2.8.1 25 | channel: stable 26 | cache: true 27 | 28 | - name: Install Dependencies 29 | run: flutter packages get 30 | 31 | - name: Format 32 | run: flutter format --set-exit-if-changed lib test 33 | 34 | - name: Analyze 35 | run: flutter analyze lib test 36 | 37 | - name: Run tests 38 | run: flutter test --no-pub --coverage --test-randomize-ordering-seed random 39 | 40 | -------------------------------------------------------------------------------- /.github/workflows/deploy_web.yml: -------------------------------------------------------------------------------- 1 | name: Web Deployment 2 | 3 | on: 4 | push: 5 | paths: 6 | - "lib/**" 7 | - "pubspec.yaml" 8 | - "pubspec.lock" 9 | - ".github/workflows/deploy_web.yml" 10 | branches: 11 | - main 12 | 13 | jobs: 14 | deploy: 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - uses: subosito/flutter-action@v2 21 | with: 22 | flutter-version: 2.8.1 23 | channel: stable 24 | cache: true 25 | 26 | - name: Install Dependencies 27 | run: flutter packages get 28 | 29 | - name: Format 30 | run: flutter format --set-exit-if-changed lib test 31 | 32 | - name: Analyze 33 | run: flutter analyze lib test 34 | 35 | - name: Run tests 36 | run: flutter test --no-pub --coverage --test-randomize-ordering-seed random 37 | 38 | - name: Build web version 39 | run: flutter build web 40 | 41 | - name: Deploy on Firebase 42 | uses: FirebaseExtended/action-hosting-deploy@v0 43 | with: 44 | repoToken: "${{ secrets.GITHUB_TOKEN }}" 45 | firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" 46 | projectId: apparence-flutter-puzzle 47 | target: apparence-flutter-puzzle 48 | expires: 30d 49 | channelId: live 50 | 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/* 18 | 19 | # Visual Studio Code related 20 | .classpath 21 | .project 22 | .settings/ 23 | .vscode/* 24 | 25 | # Flutter repo-specific 26 | /bin/cache/ 27 | /bin/mingit/ 28 | /dev/benchmarks/mega_gallery/ 29 | /dev/bots/.recipe_deps 30 | /dev/bots/android_tools/ 31 | /dev/docs/doc/ 32 | /dev/docs/flutter.docs.zip 33 | /dev/docs/lib/ 34 | /dev/docs/pubspec.yaml 35 | /dev/integration_tests/**/xcuserdata 36 | /dev/integration_tests/**/Pods 37 | /packages/flutter/coverage/ 38 | version 39 | 40 | # packages file containing multi-root paths 41 | .packages.generated 42 | 43 | # Flutter/Dart/Pub related 44 | **/doc/api/ 45 | **/ios/Flutter/.last_build_id 46 | .dart_tool/ 47 | .flutter-plugins 48 | .flutter-plugins-dependencies 49 | .packages 50 | .pub-cache/ 51 | .pub/ 52 | build/ 53 | linked_*.ds 54 | unlinked.ds 55 | unlinked_spec.ds 56 | .fvm/ 57 | 58 | # Android related 59 | **/android/**/gradle-wrapper.jar 60 | **/android/.gradle 61 | **/android/captures/ 62 | **/android/gradlew 63 | **/android/gradlew.bat 64 | **/android/local.properties 65 | **/android/**/GeneratedPluginRegistrant.java 66 | **/android/key.properties 67 | **/android/.idea/ 68 | *.jks 69 | 70 | # iOS/XCode related 71 | **/ios/**/*.mode1v3 72 | **/ios/**/*.mode2v3 73 | **/ios/**/*.moved-aside 74 | **/ios/**/*.pbxuser 75 | **/ios/**/*.perspectivev3 76 | **/ios/**/*sync/ 77 | **/ios/**/.sconsign.dblite 78 | **/ios/**/.tags* 79 | **/ios/**/.vagrant/ 80 | **/ios/**/DerivedData/ 81 | **/ios/**/Icon? 82 | **/ios/**/Pods/ 83 | **/ios/**/.symlinks/ 84 | **/ios/**/profile 85 | **/ios/**/xcuserdata 86 | **/ios/.generated/ 87 | **/ios/Flutter/App.framework 88 | **/ios/Flutter/Flutter.framework 89 | **/ios/Flutter/Flutter.podspec 90 | **/ios/Flutter/Generated.xcconfig 91 | **/ios/Flutter/app.flx 92 | **/ios/Flutter/app.zip 93 | **/ios/Flutter/.last_build_id 94 | **/ios/Flutter/flutter_assets/ 95 | **/ios/Flutter/flutter_export_environment.sh 96 | **/ios/ServiceDefinitions.json 97 | **/ios/Runner/GeneratedPluginRegistrant.* 98 | 99 | # Coverage 100 | coverage/ 101 | 102 | # Submodules 103 | !pubspec.lock 104 | packages/**/pubspec.lock 105 | 106 | # Web related 107 | lib/generated_plugin_registrant.dart 108 | 109 | # Symbolication related 110 | app.*.symbols 111 | 112 | # Obfuscation related 113 | app.*.map.json 114 | 115 | # Exceptions to the above rules. 116 | !**/ios/**/default.mode1v3 117 | !**/ios/**/default.mode2v3 118 | !**/ios/**/default.pbxuser 119 | !**/ios/**/default.perspectivev3 120 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 121 | !/dev/ci/**/Gemfile.lock 122 | !.vscode/extensions.json 123 | !.vscode/launch.json 124 | !.vscode/tasks.json 125 | !.idea/codeStyles/ 126 | !.idea/dictionaries/ 127 | !.idea/runConfigurations/ 128 | -------------------------------------------------------------------------------- /.idea/runConfigurations/development.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/runConfigurations/production.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/runConfigurations/staging.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.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: 77d935af4db863f6abd0b9c31c7e6df2a13de57b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dart-code.dart-code", 6 | "dart-code.flutter", 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Tests", 6 | "request": "launch", 7 | "type": "dart", 8 | "presentation": { 9 | "group": "test" 10 | }, 11 | "program": "test", 12 | "args": ["--coverage", "--test-randomize-ordering-seed", "random"] 13 | }, 14 | { 15 | "name": "Development", 16 | "request": "launch", 17 | "type": "dart", 18 | "presentation": { 19 | "group": "launch" 20 | }, 21 | "program": "lib/main_development.dart", 22 | "args": [ 23 | "--flavor", 24 | "development", 25 | "--target", 26 | "lib/main_development.dart" 27 | ] 28 | }, 29 | { 30 | "name": "Development & profile", 31 | "request": "launch", 32 | "type": "dart", 33 | "flutterMode": "profile", 34 | "showMemoryUsage": true, 35 | "openDevTools": "logging", 36 | "presentation": { 37 | "group": "launch" 38 | }, 39 | "program": "lib/main_development.dart", 40 | "args": [ 41 | "--flavor", 42 | "development", 43 | "--target", 44 | "lib/main_development.dart" 45 | ] 46 | }, 47 | { 48 | "name": "Staging", 49 | "request": "launch", 50 | "type": "dart", 51 | "presentation": { 52 | "group": "launch" 53 | }, 54 | "program": "lib/main_staging.dart", 55 | "args": ["--flavor", "staging", "--target", "lib/main_staging.dart"] 56 | }, 57 | { 58 | "name": "Production", 59 | "request": "launch", 60 | "type": "dart", 61 | "presentation": { 62 | "group": "launch" 63 | }, 64 | "program": "lib/main.dart", 65 | "args": ["--flavor", "production", "--target", "lib/main.dart"] 66 | } 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "flutter: flutter build apk", 8 | "type": "flutter", 9 | "command": "flutter", 10 | "args": [ 11 | "build", 12 | "apk", 13 | "--flavor", 14 | "production", 15 | "--target", 16 | "lib/main.dart" 17 | ], 18 | "group": { 19 | "kind": "build", 20 | "isDefault": true 21 | }, 22 | "problemMatcher": [], 23 | "presentation": { 24 | "reveal": "always", 25 | "focus": true, 26 | "showReuseMessage": false, 27 | "panel": "shared" 28 | } 29 | }, 30 | { 31 | "label": "flutter: flutter build ios", 32 | "type": "flutter", 33 | "command": "flutter", 34 | "args": [ 35 | "build", 36 | "ios", 37 | "--flavor", 38 | "production", 39 | "--target", 40 | "lib/main.dart" 41 | ], 42 | "group": "build", 43 | "problemMatcher": [], 44 | "presentation": { 45 | "reveal": "always", 46 | "focus": true, 47 | "showReuseMessage": false, 48 | "panel": "shared" 49 | } 50 | }, 51 | { 52 | "label": "flutter: flutter test", 53 | "type": "flutter", 54 | "command": "flutter", 55 | "args": [ 56 | "test", 57 | "--coverage", 58 | "--test-randomize-ordering-seed", 59 | "random" 60 | ], 61 | "group": "test", 62 | "problemMatcher": [], 63 | "presentation": { 64 | "reveal": "silent", 65 | "focus": true, 66 | "showReuseMessage": false, 67 | "panel": "shared" 68 | } 69 | }, 70 | { 71 | "label": "flutter: flutter install", 72 | "type": "flutter", 73 | "command": "flutter", 74 | "args": [ 75 | "install", 76 | "--flavor", 77 | "production", 78 | "--target", 79 | "lib/main.dart" 80 | ], 81 | "problemMatcher": [], 82 | } 83 | ] 84 | } 85 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Apparence 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | flutter challenge 2022 apparence.io app web android ios 3 |

4 |
5 | 6 | ![coverage][coverage_badge] 7 | [![License: MIT][license_badge]][license_link] 8 | 9 |
10 | 11 | # **Slide puzzle flutter challenge 2022** 12 | ![Flutter and Apparence.io Logos](./readme-doc/logos.png) 13 | Developed with 💙 by Apparence.io 14 | 15 | Gameplay 16 | - 17 | This puzzle game is a bit different from other water pipes games. You can't rotate the pipes, only a slide is allowed! There's one empty space where you will be able to swipe your pipes and organize them to found a solution. 18 | 19 | **Move the pipes with your finger to create a way to let the water flow to the duck. 20 | Are you ready to play?
21 | [🦆 Click here to play !](https://flutter-challenge-2022.web.app/)** 22 | 23 | Features 24 | - 25 | - Random puzzle generation 26 | - Solvability checker, to make sure random generated puzzle have solution 27 | - Rive animations 28 | - Multiplatform (Web, iOS, Android) 29 | - Music & Sounds 30 | - Custom design 31 | 32 | Packages used 33 | - 34 | (confetti, dart_code_metrics, equatable, intl, just_audio, logging, rive, universal_platform) 35 | 36 | 37 | 38 | [coverage_badge]: coverage_badge.svg 39 | [license_badge]: https://img.shields.io/badge/license-MIT-blue.svg 40 | [license_link]: https://opensource.org/licenses/MIT 41 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | include: base_analysis_options.yaml 8 | 9 | linter: 10 | # The lint rules applied to this project can be customized in the 11 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 12 | # included above or to enable additional rules. A list of all available lints 13 | # and their documentation is published at 14 | # https://dart-lang.github.io/linter/lints/index.html. 15 | # 16 | # Instead of disabling a lint rule for the entire project in the 17 | # section below, it can also be suppressed for a single line of code 18 | # or a specific dart file by using the `// ignore: name_of_lint` and 19 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 20 | # producing the lint. 21 | rules: 22 | public_member_api_docs: false 23 | 24 | # Additional information about this file can be found at 25 | # https://dart.dev/guides/language/analysis-options 26 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 | def keystoreProperties = new Properties() 25 | def keystorePropertiesFile = rootProject.file('key.properties') 26 | if (keystorePropertiesFile.exists()) { 27 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 28 | } 29 | 30 | apply plugin: 'com.android.application' 31 | apply plugin: 'kotlin-android' 32 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 33 | 34 | android { 35 | compileSdkVersion 31 36 | 37 | compileOptions { 38 | sourceCompatibility JavaVersion.VERSION_1_8 39 | targetCompatibility JavaVersion.VERSION_1_8 40 | } 41 | 42 | kotlinOptions { 43 | jvmTarget = '1.8' 44 | } 45 | 46 | sourceSets { 47 | main.java.srcDirs += 'src/main/kotlin' 48 | } 49 | 50 | defaultConfig { 51 | applicationId "io.apparence.flutter_puzzle_hack" 52 | minSdkVersion 16 53 | targetSdkVersion 31 54 | versionCode flutterVersionCode.toInteger() 55 | versionName flutterVersionName 56 | } 57 | 58 | signingConfigs { 59 | if (System.getenv("ANDROID_KEYSTORE_PATH")) { 60 | release { 61 | storeFile file(System.getenv("ANDROID_KEYSTORE_PATH")) 62 | keyAlias System.getenv("ANDROID_KEYSTORE_ALIAS") 63 | keyPassword System.getenv("ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD") 64 | storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD") 65 | } 66 | } else { 67 | release { 68 | keyAlias keystoreProperties['keyAlias'] 69 | keyPassword keystoreProperties['keyPassword'] 70 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 71 | storePassword keystoreProperties['storePassword'] 72 | } 73 | } 74 | } 75 | 76 | flavorDimensions "default" 77 | productFlavors { 78 | production { 79 | dimension "default" 80 | applicationIdSuffix "" 81 | manifestPlaceholders = [appName: "Flutter Puzzle Hack"] 82 | } 83 | staging { 84 | dimension "default" 85 | applicationIdSuffix ".stg" 86 | manifestPlaceholders = [appName: "[STG] Flutter Puzzle Hack"] 87 | } 88 | development { 89 | dimension "default" 90 | applicationIdSuffix ".dev" 91 | manifestPlaceholders = [appName: "[DEV] Flutter Puzzle Hack"] 92 | } 93 | } 94 | 95 | buildTypes { 96 | release { 97 | signingConfig signingConfigs.release 98 | minifyEnabled true 99 | useProguard true 100 | proguardFiles getDefaultProguardFile('proguard-android.txt') 101 | } 102 | debug { 103 | signingConfig signingConfigs.debug 104 | } 105 | } 106 | } 107 | 108 | flutter { 109 | source '../..' 110 | } 111 | 112 | dependencies { 113 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 114 | } 115 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/io/apparence/flutter_puzzle_hack/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.apparence.flutter_puzzle_hack 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 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 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /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-6.7-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/animations/apparence.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/animations/apparence.riv -------------------------------------------------------------------------------- /assets/images/2.0x/flutter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/2.0x/flutter_logo.png -------------------------------------------------------------------------------- /assets/images/3.0x/flutter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/3.0x/flutter_logo.png -------------------------------------------------------------------------------- /assets/images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/background.jpg -------------------------------------------------------------------------------- /assets/images/buttons/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button.png -------------------------------------------------------------------------------- /assets/images/buttons/button_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_hover.png -------------------------------------------------------------------------------- /assets/images/buttons/button_music_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_music_off.png -------------------------------------------------------------------------------- /assets/images/buttons/button_music_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_music_on.png -------------------------------------------------------------------------------- /assets/images/buttons/button_play_again_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_play_again_hover.png -------------------------------------------------------------------------------- /assets/images/buttons/button_sound_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_sound_off.png -------------------------------------------------------------------------------- /assets/images/buttons/button_sound_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/buttons/button_sound_on.png -------------------------------------------------------------------------------- /assets/images/flutter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/flutter_logo.png -------------------------------------------------------------------------------- /assets/images/glouglou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/glouglou.png -------------------------------------------------------------------------------- /assets/images/logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/logos.png -------------------------------------------------------------------------------- /assets/images/timer_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/images/timer_icon.png -------------------------------------------------------------------------------- /assets/themes/base/audio/music.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/audio/music.mp3 -------------------------------------------------------------------------------- /assets/themes/base/audio/pop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/audio/pop.wav -------------------------------------------------------------------------------- /assets/themes/base/tile_cross.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_cross.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_end.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_end.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_horizontal.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_horizontal.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_left_bottom.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_left_bottom.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_left_top.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_left_top.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_right_bottom.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_right_bottom.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_start.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_start.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_top_right.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_top_right.riv -------------------------------------------------------------------------------- /assets/themes/base/tile_vertical.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/assets/themes/base/tile_vertical.riv -------------------------------------------------------------------------------- /coverage_badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | coverage 16 | coverage 17 | 100% 18 | 100% 19 | 20 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "build/web", 4 | "site": "apparence-flutter-puzzle", 5 | "cleanUrls": true, 6 | "trailingSlash": false, 7 | "ignore": [".firebase", "firebase.json", "__/**"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/development.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/production.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/staging.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | $(FLAVOR_APP_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_puzzle_hack 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /l10n.yaml: -------------------------------------------------------------------------------- 1 | arb-dir: lib/src/l10n/arb 2 | template-arb-file: app_en.arb 3 | output-localization-file: app_localizations.dart 4 | nullable-getter: false 5 | -------------------------------------------------------------------------------- /lib/boostrap.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:logging/logging.dart'; 5 | 6 | Future bootstrap( 7 | FutureOr Function() builder, 8 | FlavorConfig flavorConfig, 9 | ) async { 10 | AppLogger.init(flavorConfig); 11 | FlutterError.onError = Logger('error').severe; 12 | 13 | Logger('bootstrap') 14 | ..info('------------------------------') 15 | ..info('Starting Flutter Puzzle Hack') 16 | ..info('$flavorConfig') 17 | ..info('------------------------------'); 18 | 19 | runApp(await builder()); 20 | } 21 | 22 | // ignore: prefer-match-file-name 23 | enum Flavor { development, staging, test, production } 24 | 25 | class FlavorConfig { 26 | FlavorConfig(this.flavor, this.logLevel); 27 | 28 | factory FlavorConfig.development() => 29 | FlavorConfig(Flavor.development, Level.ALL); 30 | 31 | factory FlavorConfig.test() => FlavorConfig(Flavor.test, Level.ALL); 32 | 33 | factory FlavorConfig.staging() => FlavorConfig(Flavor.staging, Level.INFO); 34 | 35 | factory FlavorConfig.production() => 36 | FlavorConfig(Flavor.production, Level.SEVERE); 37 | 38 | final Flavor flavor; 39 | final Level logLevel; 40 | 41 | @override 42 | String toString() { 43 | return 'FlavorConfig { flavor: ${flavor.name}, logLevel: $logLevel }'; 44 | } 45 | } 46 | 47 | class AppLogger { 48 | AppLogger(this.flavorConfig); 49 | 50 | static late final AppLogger instance; 51 | 52 | final FlavorConfig flavorConfig; 53 | 54 | static void init(FlavorConfig flavorConfig) { 55 | AppLogger.instance = AppLogger(flavorConfig); 56 | AppLogger.instance._init(); 57 | } 58 | 59 | void _init() { 60 | Logger.root.level = flavorConfig.logLevel; 61 | if (flavorConfig.flavor != Flavor.production) { 62 | Logger.root.onRecord.listen(_logToStdout); 63 | } 64 | } 65 | 66 | void _logToStdout(LogRecord record) { 67 | debugPrint('${record.level.name}: ${record.time}: ${record.message}'); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/boostrap.dart'; 2 | import 'package:flutter_puzzle_hack/src/app.dart'; 3 | 4 | Future main() async { 5 | await bootstrap( 6 | App.new, 7 | FlavorConfig.production(), 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /lib/main_development.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/boostrap.dart'; 2 | import 'package:flutter_puzzle_hack/src/app.dart'; 3 | 4 | Future main() async { 5 | await bootstrap( 6 | App.new, 7 | FlavorConfig.development(), 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /lib/main_staging.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/boostrap.dart'; 2 | import 'package:flutter_puzzle_hack/src/app.dart'; 3 | 4 | Future main() async { 5 | await bootstrap( 6 | App.new, 7 | FlavorConfig.staging(), 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 3 | import 'package:flutter_localizations/flutter_localizations.dart'; 4 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 5 | import 'package:flutter_puzzle_hack/src/puzzle/view/puzzle_page.dart'; 6 | 7 | import 'package:flutter_puzzle_hack/src/splashscreen/splashscreen.dart'; 8 | import 'package:flutter_puzzle_hack/src/theme/app_theme.dart'; 9 | 10 | /// The Widget that configures your application. 11 | class App extends StatelessWidget { 12 | const App({ 13 | Key? key, 14 | this.initialRoute = 'splashscreen', 15 | }) : super(key: key); 16 | 17 | final String? initialRoute; 18 | 19 | Route? generateRoute(RouteSettings routeSettings) { 20 | return MaterialPageRoute( 21 | settings: routeSettings, 22 | builder: (BuildContext context) { 23 | switch (routeSettings.name) { 24 | case 'splashscreen': 25 | return Splashscreen( 26 | onDone: () => Navigator.pushReplacementNamed(context, '/'), 27 | ); 28 | case '/': 29 | default: 30 | return const PuzzlePage(); 31 | } 32 | }, 33 | ); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return MaterialApp( 39 | // Providing a restorationScopeId allows the Navigator built by the 40 | // MaterialApp to restore the navigation stack when a user leaves and 41 | // returns to the app after it has been killed while running in the 42 | // background. 43 | restorationScopeId: 'app', 44 | 45 | // Provide the generated AppLocalizations to the MaterialApp. This 46 | // allows descendant Widgets to display the correct translations 47 | // depending on the user's locale. 48 | localizationsDelegates: const [ 49 | AppLocalizations.delegate, 50 | GlobalMaterialLocalizations.delegate, 51 | GlobalWidgetsLocalizations.delegate, 52 | GlobalCupertinoLocalizations.delegate, 53 | ], 54 | supportedLocales: AppLocalizations.supportedLocales, 55 | 56 | // Use AppLocalizations to configure the correct application title 57 | // depending on the user's locale. 58 | // 59 | // The appTitle is defined in .arb files found in the localization 60 | // directory. 61 | onGenerateTitle: (BuildContext context) => 62 | AppLocalizations.of(context).appTitle, 63 | theme: AppTheme.dark, 64 | darkTheme: AppTheme.dark, 65 | themeMode: ThemeMode.dark, 66 | 67 | // Define a function to handle named routes in order to support 68 | // Flutter web url navigation and deep linking. 69 | initialRoute: initialRoute, 70 | onGenerateRoute: generateRoute, 71 | builder: (context, child) => BreakpointProvider( 72 | screenWidth: MediaQuery.of(context).size.width, 73 | child: child ?? const SizedBox.shrink(), 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/src/l10n/arb/app_en.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "en", 3 | "appTitle": "Flutter Puzzle Hack 2022", 4 | "@appTitle": { 5 | "description": "The title of the application" 6 | }, 7 | "puzzlePageTitle": "Flutter Puzzle Hack 2022", 8 | "@puzzlePageTitle": { 9 | "description": "The title of Puzzle Page" 10 | }, 11 | "puzzlePageSubTitle": "To win, splash the duck.", 12 | "@appTitle": { 13 | "description": "The subtitle of the application" 14 | }, 15 | "buttonStartText": "Start Game", 16 | "@buttonStartText": { 17 | "description": "Start the game" 18 | }, 19 | "buttonRestartText": "Restart Game", 20 | "@buttonRestartText": { 21 | "description": "Restart the game" 22 | }, 23 | "puzzleDurationLabelText": "{hours} hours {minutes} minutes {seconds} seconds", 24 | "@puzzleDurationLabelText": { 25 | "description": "Semantic for the puzzle timer", 26 | "placeholders": { 27 | "hours": { 28 | "type": "String", 29 | "example": "1" 30 | }, 31 | "minutes": { 32 | "type": "String", 33 | "example": "21" 34 | }, 35 | "seconds": { 36 | "type": "String", 37 | "example": "42" 38 | } 39 | } 40 | }, 41 | "nMoves": "{count,plural, =0{{count} move} =1{{count} move} other{{count} moves}}", 42 | "@nMoves": { 43 | "description": "Shown as a number of moves", 44 | "placeholders": { 45 | "count": { 46 | "type": "int" 47 | } 48 | } 49 | }, 50 | "puzzleVictoryDialogTitle": "You've Won!", 51 | "@puzzleVictoryDialogTitle": { 52 | "description": "Title of the victory dialog" 53 | }, 54 | "puzzleVictoryDialogDescription": "Your score:", 55 | "@puzzleVictoryDialogDescription": { 56 | "description": "Description of the victory dialog" 57 | }, 58 | "buttonCloseLabel": "Close", 59 | "@buttonCloseLabel": { 60 | "description": "Close button label of the victory dialog" 61 | } 62 | } -------------------------------------------------------------------------------- /lib/src/l10n/arb/app_fr.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "fr", 3 | "appTitle": "Flutter Puzzle Hack 2022", 4 | "@appTitle": { 5 | "description": "Le titre de l'application" 6 | }, 7 | "puzzlePageTitle": "Flutter Puzzle Hack 2022", 8 | "@puzzlePageTitle": { 9 | "description": "Le titre de la page du puzzle" 10 | }, 11 | "puzzlePageSubTitle": "Pour gagner, arrose le canard", 12 | "@appTitle": { 13 | "description": "Le sous-titre de la page du puzzle" 14 | }, 15 | "buttonStartText": "Commencer", 16 | "@buttonStartText": { 17 | "description": "Démarrage du jeu" 18 | }, 19 | "buttonRestartText": "Recommencer", 20 | "@buttonRestartText": { 21 | "description": "Redémarrage du jeu" 22 | }, 23 | "puzzleDurationLabelText": "{hours} heures {minutes} minutes {seconds} secondes", 24 | "@puzzleDurationLabelText": { 25 | "description": "Sémantique pour le chronomètre du puzzle", 26 | "placeholders": { 27 | "hours": { 28 | "type": "String", 29 | "example": "1" 30 | }, 31 | "minutes": { 32 | "type": "String", 33 | "example": "21" 34 | }, 35 | "seconds": { 36 | "type": "String", 37 | "example": "42" 38 | } 39 | } 40 | }, 41 | "nMoves": "{count,plural, =0{{count} mouvement} =1{{count} mouvement} other{{count} mouvements}}", 42 | "@nMoves": { 43 | "description": "Affiché en tant que nombre de mouvements", 44 | "placeholders": { 45 | "count": { 46 | "type": "int" 47 | } 48 | } 49 | }, 50 | "puzzleVictoryDialogTitle": "Tu as gagné !", 51 | "@puzzleVictoryDialogTitle": { 52 | "description": "Titre du dialogue de victoire" 53 | }, 54 | "puzzleVictoryDialogDescription": "Ton score :", 55 | "@puzzleVictoryDialogDescription": { 56 | "description": "Description du dialogue de victoire" 57 | }, 58 | "buttonCloseLabel": "Fermer", 59 | "@buttonCloseLabel": { 60 | "description": "Label du bouton fermer du dialogue de victoire" 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /lib/src/l10n/l10n.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 3 | 4 | export 'package:flutter_gen/gen_l10n/app_localizations.dart'; 5 | 6 | // ignore: prefer-match-file-name 7 | extension AppLocalizationsX on BuildContext { 8 | AppLocalizations get l10n => AppLocalizations.of(this); 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/layout/breakpoint_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Breakpoint _getBreakpoint(double screenWidth) { 4 | var breakpoint = Breakpoint.xsmall; 5 | if (screenWidth >= BreakpointSize.xlarge) { 6 | breakpoint = Breakpoint.xlarge; 7 | } else if (screenWidth >= BreakpointSize.large) { 8 | breakpoint = Breakpoint.large; 9 | } else if (screenWidth >= BreakpointSize.medium) { 10 | breakpoint = Breakpoint.medium; 11 | } else if (screenWidth >= BreakpointSize.small) { 12 | breakpoint = Breakpoint.small; 13 | } 14 | 15 | return breakpoint; 16 | } 17 | 18 | /// {@template BreakpointProvider} 19 | /// A provider for various responsive breakpoints. 20 | /// {@endtemplate} 21 | class BreakpointProvider extends InheritedWidget { 22 | BreakpointProvider({ 23 | Key? key, 24 | required this.screenWidth, 25 | required Widget child, 26 | }) : breakpoint = _getBreakpoint(screenWidth), 27 | super(key: key, child: child); 28 | 29 | final double screenWidth; 30 | final Breakpoint breakpoint; 31 | 32 | static Breakpoint of(BuildContext context) { 33 | return context 34 | .dependOnInheritedWidgetOfExactType()! 35 | .breakpoint; 36 | } 37 | 38 | @override 39 | bool updateShouldNotify(BreakpointProvider oldWidget) => 40 | oldWidget.breakpoint != breakpoint; 41 | } 42 | 43 | abstract class BreakpointSize { 44 | static const double small = 600; 45 | static const double medium = 900; 46 | static const double large = 1200; 47 | static const double xlarge = 1536; 48 | } 49 | 50 | enum Breakpoint { 51 | xsmall, 52 | small, 53 | medium, 54 | large, 55 | xlarge, 56 | } 57 | -------------------------------------------------------------------------------- /lib/src/layout/responsive_layout_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 3 | 4 | typedef ResponsiveLayoutWidgetBuilder = Widget Function(BuildContext, Widget?); 5 | 6 | Map _createBuilders({ 7 | ResponsiveLayoutWidgetBuilder? xsmall, 8 | ResponsiveLayoutWidgetBuilder? small, 9 | ResponsiveLayoutWidgetBuilder? medium, 10 | ResponsiveLayoutWidgetBuilder? large, 11 | ResponsiveLayoutWidgetBuilder? xlarge, 12 | }) { 13 | final map = {}; 14 | ResponsiveLayoutWidgetBuilder? last; 15 | map[Breakpoint.xsmall] = last = xsmall ?? last; 16 | map[Breakpoint.small] = last = small ?? last; 17 | map[Breakpoint.medium] = last = medium ?? last; 18 | map[Breakpoint.large] = last = large ?? last; 19 | map[Breakpoint.xlarge] = last = xlarge ?? last; 20 | 21 | return map; 22 | } 23 | 24 | /// {@template ResponsiveLayoutBuilder} 25 | /// A wrapper around [LayoutBuilder] which exposes optionnal builders for 26 | /// various responsive breakpoints. 27 | /// 28 | /// If no builder is provided for given breakpoint, a smaller breakpoint builder 29 | /// will be used. 30 | /// 31 | /// If no breakpoint builder is found, the child widget builder will be used. 32 | /// {@endtemplate} 33 | class ResponsiveLayoutBuilder extends StatelessWidget { 34 | ResponsiveLayoutBuilder({ 35 | Key? key, 36 | ResponsiveLayoutWidgetBuilder? xsmall, 37 | ResponsiveLayoutWidgetBuilder? small, 38 | ResponsiveLayoutWidgetBuilder? medium, 39 | ResponsiveLayoutWidgetBuilder? large, 40 | ResponsiveLayoutWidgetBuilder? xlarge, 41 | this.child, 42 | }) : builders = _createBuilders( 43 | xsmall: xsmall, 44 | small: small, 45 | medium: medium, 46 | large: large, 47 | xlarge: xlarge, 48 | ), 49 | super(key: key); 50 | 51 | final Map builders; 52 | 53 | /// Optional child widget builder based on the current layout size 54 | /// which will be passed to the `xsmall`, `small`, `medium`, `large` and 55 | /// `xlarge` builders as a way to share/optimize shared layout. 56 | final Widget Function(Breakpoint breakpoint)? child; 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return LayoutBuilder( 61 | builder: (context, constraints) { 62 | final breakpoint = BreakpointProvider.of(context); 63 | 64 | final builder = builders[breakpoint]; 65 | 66 | return builder?.call(context, child?.call(breakpoint)) ?? 67 | child!.call(breakpoint); 68 | }, 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/src/models/connection.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | /// {@template connection} 4 | /// Tile connection model defining how tiles interact. 5 | /// 6 | /// A left tile having a right connection can connect 7 | /// with a right tile having a left connection. 8 | /// {@endtemplate} 9 | class Connection extends Equatable { 10 | // ignore: avoid_positional_boolean_parameters 11 | const Connection.fromLTRB(this.left, this.top, this.right, this.bottom); 12 | 13 | // ignore: avoid_positional_boolean_parameters 14 | const Connection.all(bool value) 15 | : left = value, 16 | top = value, 17 | right = value, 18 | bottom = value; 19 | 20 | const Connection.horizontal() 21 | : left = true, 22 | top = false, 23 | right = true, 24 | bottom = false; 25 | 26 | const Connection.vertical() 27 | : left = false, 28 | top = true, 29 | right = false, 30 | bottom = true; 31 | 32 | const Connection.leftTop() 33 | : left = true, 34 | top = true, 35 | right = false, 36 | bottom = false; 37 | 38 | const Connection.topRight() 39 | : left = false, 40 | top = true, 41 | right = true, 42 | bottom = false; 43 | 44 | const Connection.leftBottom() 45 | : left = true, 46 | top = false, 47 | right = false, 48 | bottom = true; 49 | 50 | const Connection.rightBottom() 51 | : left = false, 52 | top = false, 53 | right = true, 54 | bottom = true; 55 | 56 | final bool left; 57 | final bool top; 58 | final bool right; 59 | final bool bottom; 60 | 61 | @override 62 | List get props => [left, top, right, bottom]; 63 | } 64 | -------------------------------------------------------------------------------- /lib/src/models/dimension.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class Dimension extends Equatable { 4 | const Dimension({required this.width, required this.height}); 5 | 6 | final int width; 7 | final int height; 8 | 9 | @override 10 | List get props => [width, height]; 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/models/position.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | /// {@template position} 4 | /// 2d position model. 5 | /// 6 | /// Position(1, 1) is the top left corner of the grid. 7 | /// {@endtemplate} 8 | class Position extends Equatable implements Comparable { 9 | const Position(this.x, this.y); 10 | 11 | final int x; 12 | final int y; 13 | 14 | @override 15 | List get props => [x, y]; 16 | 17 | @override 18 | int compareTo(Position other) { 19 | if (y < other.y) { 20 | return -1; 21 | } else if (y > other.y) { 22 | return 1; 23 | } 24 | if (x < other.x) { 25 | return -1; 26 | } else if (x > other.x) { 27 | return 1; 28 | } 29 | 30 | return 0; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/models/ticker.dart: -------------------------------------------------------------------------------- 1 | /// {@template ticker} 2 | /// Object to increment time in seconds. 3 | /// {@endtemplate} 4 | class Ticker { 5 | /// {@macro ticker} 6 | const Ticker(); 7 | 8 | /// Increments time by 1 second. 9 | Stream tick() { 10 | return Stream.periodic(const Duration(seconds: 1), (x) => 1 + x++); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/src/models/tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter_puzzle_hack/src/models/connection.dart'; 3 | import 'package:flutter_puzzle_hack/src/models/position.dart'; 4 | 5 | /// {@template tile} 6 | /// Puzzle tile model. 7 | /// {@endtemplate} 8 | class Tile extends Equatable { 9 | const Tile({ 10 | required this.id, 11 | required this.position, 12 | this.connection = const Connection.all(false), 13 | this.type = TileType.normal, 14 | this.asset, 15 | this.filling, 16 | }); 17 | 18 | const Tile.empty({required this.id, required this.position}) 19 | : connection = const Connection.all(false), 20 | type = TileType.empty, 21 | asset = null, 22 | filling = null; 23 | 24 | final String id; 25 | final Position position; 26 | final Connection connection; 27 | final TileType type; 28 | final String? asset; 29 | final Connection? filling; 30 | 31 | Tile copyWith({required Position position}) { 32 | return Tile( 33 | id: id, 34 | position: position, 35 | connection: connection, 36 | type: type, 37 | asset: asset, 38 | filling: filling, 39 | ); 40 | } 41 | 42 | @override 43 | List get props => [id, position, connection, type, asset, filling]; 44 | } 45 | 46 | /// Tile types. 47 | enum TileType { 48 | /// Default tile type which can be moved 49 | normal, 50 | 51 | /// Empty tile can be swapped with a normal tile 52 | empty, 53 | 54 | /// Start tile define an objective which must be connected to a end tile 55 | start, 56 | 57 | /// End tile define an objective which must be connected to a start tile 58 | end, 59 | 60 | /// Locked tile cannot be moved 61 | locked, 62 | } 63 | -------------------------------------------------------------------------------- /lib/src/puzzle/audio_controller/audio_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter_puzzle_hack/src/puzzle/helpers/audio_player.dart'; 4 | import 'package:just_audio/just_audio.dart'; 5 | 6 | class AudioController { 7 | AudioController({ 8 | required this.themeFolder, 9 | }); 10 | 11 | final String themeFolder; 12 | final _tileSoundPlayer = AudioPlayer(); 13 | final _musicPlayer = AudioPlayer(); 14 | 15 | bool _isTileSoundOn = true; 16 | bool get isTileSoundOn => _isTileSoundOn; 17 | 18 | bool _isMusicOn = true; 19 | bool get isMusicOn => _isMusicOn; 20 | final double _musicVolume = 0.04; 21 | 22 | Future load() async { 23 | await _tileSoundPlayer.fixedSetAsset('$themeFolder/audio/pop.wav'); 24 | await _musicPlayer.fixedSetAsset('$themeFolder/audio/music.mp3'); 25 | await _tileSoundPlayer.setVolume(isTileSoundOn ? 1 : 0); 26 | await _musicPlayer.setVolume(_isMusicOn ? _musicVolume : 0); 27 | await _musicPlayer.setLoopMode(LoopMode.one); 28 | } 29 | 30 | /// Toggle tile sound 31 | bool toggleTileSound() { 32 | _isTileSoundOn = !_isTileSoundOn; 33 | unawaited(_tileSoundPlayer.setVolume(_isTileSoundOn ? 1 : 0)); 34 | 35 | return _isTileSoundOn; 36 | } 37 | 38 | /// Play Tile Pop 39 | Future playTileSound() async { 40 | await _tileSoundPlayer.replay(); 41 | } 42 | 43 | /// Toggle Music 44 | bool toggleMusic() { 45 | _isMusicOn = !_isMusicOn; 46 | unawaited(_musicPlayer.setVolume(_isMusicOn ? _musicVolume : 0)); 47 | 48 | return _isMusicOn; 49 | } 50 | 51 | /// Play Music 52 | Future playMusic() async { 53 | if (_musicPlayer.playing) return; 54 | await _musicPlayer.replay(); 55 | } 56 | 57 | /// Dispose 58 | Future dispose() async { 59 | await _tileSoundPlayer.dispose(); 60 | await _musicPlayer.dispose(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/src/puzzle/helpers/audio_player.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:just_audio/just_audio.dart'; 5 | 6 | /// Defines extensions for [AudioPlayer]. 7 | // ignore: prefer-match-file-name 8 | extension AudioPlayerX on AudioPlayer { 9 | /// Replays the current audio. 10 | Future replay() async { 11 | await stop(); 12 | await seek(null); 13 | unawaited(play()); 14 | } 15 | 16 | /// use until just_audio fixes asset path 17 | Future fixedSetAsset( 18 | String assetPath, { 19 | bool preload = true, 20 | Duration? initialPosition, 21 | }) => 22 | setAudioSource( 23 | AudioSource.uri(Uri.parse((kReleaseMode ? 'assets/' : '') + assetPath)), 24 | initialPosition: initialPosition, 25 | preload: preload, 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/puzzle/helpers/puzzle_generator.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter_puzzle_hack/src/models/connection.dart'; 4 | import 'package:flutter_puzzle_hack/src/models/dimension.dart'; 5 | import 'package:flutter_puzzle_hack/src/models/position.dart'; 6 | import 'package:flutter_puzzle_hack/src/models/puzzle.dart'; 7 | import 'package:flutter_puzzle_hack/src/models/tile.dart'; 8 | 9 | abstract class PuzzleGenerator { 10 | static final _tileTemplates = < 11 | String, 12 | Tile Function( 13 | String id, 14 | Position position, 15 | String themeFolder, 16 | )>{ 17 | 'start': (id, position, themeFolder) => Tile( 18 | id: id, 19 | position: position, 20 | connection: const Connection.all(true), 21 | type: TileType.start, 22 | asset: '$themeFolder/tile_start.riv', 23 | ), 24 | 'end': (id, position, themeFolder) => Tile( 25 | id: id, 26 | position: position, 27 | connection: const Connection.fromLTRB(false, true, false, false), 28 | type: TileType.end, 29 | asset: '$themeFolder/tile_end.riv', 30 | ), 31 | 'empty': (id, position, themeFolder) => Tile.empty( 32 | id: id, 33 | position: position, 34 | ), 35 | 'cross': (id, position, themeFolder) => Tile( 36 | id: id, 37 | position: position, 38 | connection: const Connection.all(true), 39 | asset: '$themeFolder/tile_cross.riv', 40 | ), 41 | 'horizontal': (id, position, themeFolder) => Tile( 42 | id: id, 43 | position: position, 44 | connection: const Connection.horizontal(), 45 | asset: '$themeFolder/tile_horizontal.riv', 46 | ), 47 | 'vertical': (id, position, themeFolder) => Tile( 48 | id: id, 49 | position: position, 50 | connection: const Connection.vertical(), 51 | asset: '$themeFolder/tile_vertical.riv', 52 | ), 53 | 'leftTop': (id, position, themeFolder) => Tile( 54 | id: id, 55 | position: position, 56 | connection: const Connection.leftTop(), 57 | asset: '$themeFolder/tile_left_top.riv', 58 | ), 59 | 'topRight': (id, position, themeFolder) => Tile( 60 | id: id, 61 | position: position, 62 | connection: const Connection.topRight(), 63 | asset: '$themeFolder/tile_top_right.riv', 64 | ), 65 | 'leftBottom': (id, position, themeFolder) => Tile( 66 | id: id, 67 | position: position, 68 | connection: const Connection.leftBottom(), 69 | asset: '$themeFolder/tile_left_bottom.riv', 70 | ), 71 | 'rightBottom': (id, position, themeFolder) => Tile( 72 | id: id, 73 | position: position, 74 | connection: const Connection.rightBottom(), 75 | asset: '$themeFolder/tile_right_bottom.riv', 76 | ), 77 | }; 78 | 79 | static Tile _generateTile( 80 | String template, 81 | Position position, 82 | Dimension dimension, 83 | String themeFolder, 84 | ) { 85 | final id = '${position.x + (position.y - 1) * dimension.width}'; 86 | 87 | return _tileTemplates[template]!.call(id, position, themeFolder); 88 | } 89 | 90 | // ignore: long-method 91 | static Puzzle generatePuzzle({ 92 | required Dimension dimension, 93 | required String themeFolder, 94 | }) { 95 | final rand = Random(); 96 | final positions = []; 97 | 98 | final tiles = []; 99 | final positionPicks = {}; 100 | 101 | // fill positions 102 | for (var y = 1; y <= dimension.height; y++) { 103 | for (var x = 1; x <= dimension.width; x++) { 104 | positions.add(Position(x, y)); 105 | positionPicks.add(x - 1 + (y - 1) * dimension.width); 106 | } 107 | } 108 | 109 | // add start on first row except second and before last column 110 | var index = rand.nextInt(dimension.width - 2); 111 | if (index == 1) index = dimension.width - 1; 112 | tiles.add( 113 | _generateTile('start', positions[index], dimension, themeFolder), 114 | ); 115 | positionPicks.remove(index); 116 | 117 | // add end on last row except second and before last column 118 | index = rand.nextInt(dimension.width - 2); 119 | if (index == 1) index = dimension.width - 1; 120 | index += (dimension.height - 1) * dimension.width; 121 | tiles.add( 122 | _generateTile('end', positions[index], dimension, themeFolder), 123 | ); 124 | positionPicks.remove(index); 125 | 126 | // add empty 127 | index = positionPicks.elementAt(rand.nextInt(positionPicks.length)); 128 | tiles.add( 129 | _generateTile('empty', positions[index], dimension, themeFolder), 130 | ); 131 | positionPicks.remove(index); 132 | 133 | // fill templates 134 | final templates = [ 135 | 'cross', 136 | 'horizontal', 137 | 'vertical', 138 | 'leftTop', 139 | 'topRight', 140 | 'leftBottom', 141 | 'rightBottom', 142 | ]; 143 | final templatePicks = []; 144 | 145 | // add remaining tiles 146 | for (final index in positionPicks) { 147 | // refill 148 | if (templatePicks.isEmpty) { 149 | templatePicks.addAll(templates); 150 | } 151 | final templateIndex = rand.nextInt(templatePicks.length); 152 | tiles.add( 153 | _generateTile( 154 | templatePicks[templateIndex], 155 | positions[index], 156 | dimension, 157 | themeFolder, 158 | ), 159 | ); 160 | templatePicks.removeAt(templateIndex); 161 | } 162 | 163 | return Puzzle(dimension: dimension, tiles: tiles).sort(); 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /lib/src/puzzle/widgets/puzzle_board.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 3 | import 'package:flutter_puzzle_hack/src/layout/responsive_layout_builder.dart'; 4 | import 'package:flutter_puzzle_hack/src/models/dimension.dart'; 5 | import 'package:flutter_puzzle_hack/src/models/tile.dart'; 6 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/puzzle_tile.dart'; 7 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/scale_up_animation.dart'; 8 | 9 | final _breakpointDimensions = { 10 | Breakpoint.xsmall: 180, 11 | Breakpoint.small: 240, 12 | Breakpoint.medium: 270, 13 | Breakpoint.large: 330, 14 | Breakpoint.xlarge: 460, 15 | }; 16 | 17 | class PuzzleBoard extends StatelessWidget { 18 | const PuzzleBoard({ 19 | Key? key, 20 | required this.puzzleDimension, 21 | required this.tiles, 22 | required this.canInteract, 23 | this.onTileHover, 24 | this.onTilePress, 25 | this.onTileFillAnimationComplete, 26 | }) : super(key: key); 27 | 28 | final Dimension puzzleDimension; 29 | final List tiles; 30 | final bool canInteract; 31 | 32 | final Function(Tile tile, bool hovering)? onTileHover; 33 | final Function(Tile tile)? onTilePress; 34 | final Function(Tile tile)? onTileFillAnimationComplete; 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | if (puzzleDimension.width == 0 || puzzleDimension.height == 0) { 39 | return const CircularProgressIndicator(); 40 | } 41 | 42 | return ScaleUpAnimation( 43 | delayMilliseconds: 200, 44 | child: ResponsiveLayoutBuilder( 45 | child: (breakpoint) => Card( 46 | color: Colors.transparent, 47 | child: Padding( 48 | padding: const EdgeInsets.all(4), 49 | child: SizedBox( 50 | key: Key('puzzle_board_${breakpoint.name}'), 51 | width: _breakpointDimensions[breakpoint], 52 | height: puzzleDimension.height / 53 | puzzleDimension.width.toDouble() * 54 | _breakpointDimensions[breakpoint]!, 55 | child: Stack( 56 | children: tiles 57 | .map( 58 | (t) => PuzzleTile( 59 | key: Key('puzzle_tile_${t.id}'), 60 | tile: t, 61 | puzzleDimension: puzzleDimension, 62 | canInteract: canInteract, 63 | onTileHover: onTileHover, 64 | onTilePress: onTilePress, 65 | onTileFillAnimationComplete: 66 | onTileFillAnimationComplete, 67 | ), 68 | ) 69 | .toList(), 70 | ), 71 | ), 72 | ), 73 | ), 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/src/puzzle/widgets/puzzle_move_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_puzzle_hack/src/l10n/l10n.dart'; 3 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 4 | import 'package:flutter_puzzle_hack/src/layout/responsive_layout_builder.dart'; 5 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/scale_up_animation.dart'; 6 | 7 | class PuzzleMoveCounter extends StatelessWidget { 8 | const PuzzleMoveCounter({ 9 | Key? key, 10 | required this.moveCount, 11 | this.textStyle, 12 | }) : super(key: key); 13 | 14 | final int moveCount; 15 | final TextStyle? textStyle; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | final l10n = context.l10n; 20 | 21 | return ScaleUpAnimation( 22 | delayMilliseconds: 700, 23 | child: ResponsiveLayoutBuilder( 24 | // ignore: prefer-extracting-callbacks 25 | child: (breakpoint) { 26 | final theme = Theme.of(context); 27 | final currentTextStyle = textStyle ?? 28 | ((breakpoint.index < Breakpoint.medium.index) 29 | ? theme.textTheme.headline5 30 | : theme.textTheme.headline4); 31 | 32 | return AnimatedDefaultTextStyle( 33 | style: currentTextStyle!, 34 | duration: const Duration(milliseconds: 500), 35 | child: Text(l10n.nMoves(moveCount)), 36 | ); 37 | }, 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/src/puzzle/widgets/puzzle_timer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_puzzle_hack/src/l10n/l10n.dart'; 3 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 4 | import 'package:flutter_puzzle_hack/src/layout/responsive_layout_builder.dart'; 5 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/scale_up_animation.dart'; 6 | 7 | final _iconDimensions = { 8 | Breakpoint.xsmall: 24, 9 | Breakpoint.small: 28, 10 | Breakpoint.medium: 32, 11 | Breakpoint.large: 34, 12 | Breakpoint.xlarge: 36, 13 | }; 14 | 15 | class PuzzleTimer extends StatelessWidget { 16 | const PuzzleTimer({ 17 | Key? key, 18 | required this.timeElapsed, 19 | this.textStyle, 20 | this.iconSize, 21 | this.iconPadding, 22 | this.mainAxisAlignment, 23 | }) : super(key: key); 24 | 25 | final Duration timeElapsed; 26 | final TextStyle? textStyle; 27 | final Size? iconSize; 28 | final double? iconPadding; 29 | final MainAxisAlignment? mainAxisAlignment; 30 | 31 | String _formatDuration(Duration duration) { 32 | String twoDigits(int n) => n.toString().padLeft(2, '0'); 33 | final twoDigitsMinutes = twoDigits(duration.inMinutes.remainder(60)); 34 | final twoDigitsSeconds = twoDigits(duration.inSeconds.remainder(60)); 35 | 36 | return '${twoDigits(duration.inHours)}:$twoDigitsMinutes:$twoDigitsSeconds'; 37 | } 38 | 39 | String _getDurationLabel(BuildContext context, Duration duration) { 40 | return context.l10n.puzzleDurationLabelText( 41 | duration.inHours.toString(), 42 | duration.inMinutes.remainder(60).toString(), 43 | duration.inSeconds.remainder(60).toString(), 44 | ); 45 | } 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return ScaleUpAnimation( 50 | delayMilliseconds: 500, 51 | child: ResponsiveLayoutBuilder( 52 | // ignore: prefer-extracting-callbacks 53 | child: (breakpoint) { 54 | final theme = Theme.of(context); 55 | final currentTextStyle = textStyle ?? 56 | ((breakpoint.index < Breakpoint.medium.index) 57 | ? theme.textTheme.headline5 58 | : theme.textTheme.headline4); 59 | 60 | final currentIconSize = iconSize ?? 61 | Size(_iconDimensions[breakpoint]!, _iconDimensions[breakpoint]!); 62 | 63 | return Row( 64 | mainAxisAlignment: mainAxisAlignment ?? MainAxisAlignment.center, 65 | children: [ 66 | AnimatedDefaultTextStyle( 67 | style: currentTextStyle!, 68 | duration: const Duration(milliseconds: 500), 69 | child: Text( 70 | _formatDuration(timeElapsed), 71 | key: ValueKey(timeElapsed.inSeconds), 72 | semanticsLabel: _getDurationLabel(context, timeElapsed), 73 | ), 74 | ), 75 | SizedBox(width: iconPadding ?? 8), 76 | Image.asset( 77 | 'assets/images/timer_icon.png', 78 | width: currentIconSize.width, 79 | height: currentIconSize.height, 80 | ), 81 | ], 82 | ); 83 | }, 84 | ), 85 | ); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/src/puzzle/widgets/puzzle_victory_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:confetti/confetti.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'package:flutter_puzzle_hack/src/l10n/l10n.dart'; 5 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 6 | import 'package:flutter_puzzle_hack/src/layout/responsive_layout_builder.dart'; 7 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/puzzle_move_counter.dart'; 8 | import 'package:flutter_puzzle_hack/src/puzzle/widgets/puzzle_timer.dart'; 9 | 10 | class PuzzleVictoryDialog extends StatefulWidget { 11 | const PuzzleVictoryDialog({ 12 | Key? key, 13 | required this.moveCount, 14 | required this.timeElapsed, 15 | this.title, 16 | this.description, 17 | this.closeButtonText, 18 | this.actionButtonText, 19 | this.onCloseButtonPress, 20 | this.onActionButtonPress, 21 | }) : super(key: key); 22 | 23 | final int moveCount; 24 | final Duration timeElapsed; 25 | final String? title; 26 | final String? description; 27 | final String? closeButtonText; 28 | final String? actionButtonText; 29 | 30 | final Function()? onCloseButtonPress; 31 | final Function()? onActionButtonPress; 32 | 33 | @override 34 | State createState() => _PuzzleVictoryDialogState(); 35 | } 36 | 37 | class _PuzzleVictoryDialogState extends State { 38 | late ConfettiController _controller; 39 | 40 | @override 41 | void initState() { 42 | super.initState(); 43 | _controller = ConfettiController( 44 | duration: const Duration(milliseconds: 2500), 45 | ); 46 | _controller.play(); 47 | } 48 | 49 | void _onCloseButtonPress() { 50 | Navigator.maybePop(context); 51 | widget.onCloseButtonPress?.call(); 52 | } 53 | 54 | void _onActionButtonPress() { 55 | Navigator.maybePop(context); 56 | widget.onActionButtonPress?.call(); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | final l10n = context.l10n; 62 | final theme = Theme.of(context); 63 | 64 | return ResponsiveLayoutBuilder( 65 | child: (breakpoint) => Dialog( 66 | clipBehavior: Clip.hardEdge, 67 | shape: const RoundedRectangleBorder( 68 | borderRadius: BorderRadius.all( 69 | Radius.circular(12), 70 | ), 71 | ), 72 | child: Padding( 73 | padding: EdgeInsets.all( 74 | breakpoint.index > Breakpoint.small.index ? 40 : 20, 75 | ), 76 | child: SizedBox( 77 | width: breakpoint.index > Breakpoint.small.index ? 400 : 300, 78 | child: Column( 79 | mainAxisAlignment: MainAxisAlignment.center, 80 | mainAxisSize: MainAxisSize.min, 81 | children: [ 82 | Text( 83 | widget.title ?? l10n.puzzleVictoryDialogTitle, 84 | style: (breakpoint.index > Breakpoint.small.index) 85 | ? theme.textTheme.headline2 86 | : theme.textTheme.headline3, 87 | ), 88 | const SizedBox( 89 | height: 32, 90 | ), 91 | Text( 92 | widget.description ?? l10n.puzzleVictoryDialogDescription, 93 | style: (breakpoint.index > Breakpoint.small.index) 94 | ? theme.textTheme.headline3 95 | : theme.textTheme.headline4, 96 | ), 97 | ConfettiWidget( 98 | emissionFrequency: 0.04, 99 | confettiController: _controller, 100 | blastDirectionality: BlastDirectionality.explosive, 101 | colors: const [ 102 | Colors.green, 103 | Colors.blue, 104 | Colors.pink, 105 | Colors.orange, 106 | Colors.purple, 107 | ], 108 | ), 109 | const SizedBox( 110 | height: 32, 111 | ), 112 | PuzzleTimer( 113 | timeElapsed: widget.timeElapsed, 114 | ), 115 | const SizedBox( 116 | height: 8, 117 | ), 118 | PuzzleMoveCounter( 119 | moveCount: widget.moveCount, 120 | ), 121 | const SizedBox( 122 | height: 32, 123 | ), 124 | Row( 125 | mainAxisAlignment: MainAxisAlignment.center, 126 | mainAxisSize: MainAxisSize.min, 127 | children: [ 128 | ElevatedButton( 129 | onPressed: _onCloseButtonPress, 130 | child: Text( 131 | widget.closeButtonText ?? l10n.buttonCloseLabel, 132 | ), 133 | ), 134 | const SizedBox( 135 | width: 32, 136 | ), 137 | ElevatedButton( 138 | onPressed: _onActionButtonPress, 139 | child: Text( 140 | widget.actionButtonText ?? l10n.buttonRestartText, 141 | ), 142 | ), 143 | ], 144 | ), 145 | ], 146 | ), 147 | ), 148 | ), 149 | ), 150 | ); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /lib/src/puzzle/widgets/scale_up_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ScaleUpAnimation extends StatefulWidget { 4 | const ScaleUpAnimation({ 5 | Key? key, 6 | required this.child, 7 | required this.delayMilliseconds, 8 | }) : super(key: key); 9 | 10 | final Widget child; 11 | final int delayMilliseconds; 12 | 13 | @override 14 | State createState() => _ScaleUpAnimationState(); 15 | } 16 | 17 | class _ScaleUpAnimationState extends State 18 | with SingleTickerProviderStateMixin { 19 | late AnimationController animationController; 20 | late Animation animation; 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | 26 | animationController = AnimationController( 27 | duration: const Duration(milliseconds: 1500), 28 | vsync: this, 29 | ); 30 | 31 | animation = Tween(begin: 0, end: 1) 32 | .chain(CurveTween(curve: Curves.elasticOut)) 33 | .animate(animationController); 34 | 35 | Future.delayed( 36 | Duration(milliseconds: widget.delayMilliseconds), 37 | () => animationController.forward(), 38 | ); 39 | } 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | return ScaleTransition( 44 | scale: animation, 45 | child: widget.child, 46 | ); 47 | } 48 | 49 | @override 50 | void dispose() { 51 | animationController.dispose(); 52 | 53 | super.dispose(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/src/splashscreen/splashscreen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 4 | import 'package:flutter_puzzle_hack/src/layout/responsive_layout_builder.dart'; 5 | import 'package:rive/rive.dart'; 6 | 7 | class Splashscreen extends StatefulWidget { 8 | const Splashscreen({ 9 | Key? key, 10 | this.duration = const Duration(milliseconds: 2700), 11 | required this.onDone, 12 | }) : super(key: key); 13 | 14 | final Duration duration; 15 | final Function onDone; 16 | 17 | @override 18 | SplashscreenState createState() => SplashscreenState(); 19 | } 20 | 21 | class SplashscreenState extends State 22 | with SingleTickerProviderStateMixin { 23 | final kLogoAnimation = 300; 24 | 25 | late Animation animation; 26 | late AnimationController controller; 27 | 28 | @override 29 | void initState() { 30 | super.initState(); 31 | 32 | controller = AnimationController( 33 | duration: Duration(milliseconds: kLogoAnimation), 34 | vsync: this, 35 | )..repeat(); 36 | animation = Tween( 37 | begin: 0, 38 | end: 1, 39 | ).animate(controller); 40 | 41 | // ignore: prefer-extracting-callbacks 42 | Future.delayed(widget.duration, () { 43 | // ignore: avoid_dynamic_calls 44 | widget.onDone(); 45 | }); 46 | } 47 | 48 | @override 49 | void didChangeDependencies() { 50 | super.didChangeDependencies(); 51 | controller.forward(); 52 | } 53 | 54 | @override 55 | void dispose() { 56 | controller.dispose(); 57 | super.dispose(); 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return Scaffold( 63 | body: Center( 64 | child: AnimatedBuilder( 65 | animation: animation, 66 | builder: (context, child) { 67 | return Opacity( 68 | opacity: animation.value, 69 | child: ResponsiveLayoutBuilder( 70 | child: (breakpoint) => Column( 71 | mainAxisAlignment: MainAxisAlignment.center, 72 | children: [ 73 | const SizedBox( 74 | height: 100, 75 | child: RiveAnimation.asset( 76 | 'assets/animations/apparence.riv', 77 | ), 78 | ), 79 | Text( 80 | 'Apparence.io', 81 | style: breakpoint.index > Breakpoint.medium.index 82 | ? Theme.of(context).textTheme.headline2 83 | : Theme.of(context).textTheme.headline3, 84 | ), 85 | ], 86 | ), 87 | ), 88 | ); 89 | }, 90 | ), 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/src/theme/app_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | abstract class AppTheme { 4 | static final light = ThemeData.light().copyWith( 5 | brightness: Brightness.light, 6 | appBarTheme: const AppBarTheme(color: Color(0xFFE4000F)), 7 | colorScheme: ColorScheme.fromSwatch( 8 | accentColor: const Color(0xFFE4000F), 9 | ), 10 | backgroundColor: const Color(0xFF75bfff), 11 | textTheme: const TextTheme( 12 | headline1: TextStyle( 13 | fontSize: 42, 14 | fontWeight: FontWeight.w600, 15 | color: Color(0xFFFFFFFF), 16 | ), 17 | headline2: TextStyle( 18 | fontSize: 35, 19 | fontWeight: FontWeight.w600, 20 | color: Color(0xFFFFFFFF), 21 | ), 22 | headline3: TextStyle( 23 | fontSize: 26, 24 | fontWeight: FontWeight.w600, 25 | color: Color(0xFFFFFFFF), 26 | ), 27 | headline4: TextStyle( 28 | fontSize: 22, 29 | fontWeight: FontWeight.w600, 30 | color: Color(0xFFFFFFFF), 31 | ), 32 | headline5: TextStyle( 33 | fontSize: 18, 34 | fontWeight: FontWeight.w600, 35 | color: Color(0xFFFFFFFF), 36 | ), 37 | button: TextStyle( 38 | fontSize: 18, 39 | fontWeight: FontWeight.w600, 40 | color: Color(0xFFFFFFFF), 41 | ), 42 | ), 43 | elevatedButtonTheme: ElevatedButtonThemeData( 44 | style: ButtonStyle( 45 | enableFeedback: true, 46 | shape: MaterialStateProperty.all( 47 | const RoundedRectangleBorder( 48 | borderRadius: BorderRadius.all(Radius.circular(18)), 49 | ), 50 | ), 51 | ), 52 | ), 53 | cardTheme: const CardTheme( 54 | color: Color(0xFF75bfff), 55 | elevation: 0, 56 | ), 57 | iconTheme: const IconThemeData( 58 | color: Color(0xFFFFFFFF), 59 | ), 60 | dialogTheme: const DialogTheme( 61 | backgroundColor: Color(0xFF75bfff), 62 | titleTextStyle: TextStyle( 63 | fontSize: 26, 64 | fontWeight: FontWeight.w600, 65 | color: Color(0xFFFFFFFF), 66 | ), 67 | contentTextStyle: TextStyle( 68 | fontSize: 20, 69 | fontWeight: FontWeight.w600, 70 | color: Color(0xFFFFFFFF), 71 | ), 72 | ), 73 | ); 74 | 75 | static final lightExtra = ExtraThemeData( 76 | title: const TextStyle( 77 | fontSize: 42, 78 | fontWeight: FontWeight.w600, 79 | color: Color(0xFF00DDFF), 80 | ), 81 | titleSmall: const TextStyle( 82 | fontSize: 26, 83 | fontWeight: FontWeight.w600, 84 | color: Color(0xFF00DDFF), 85 | ), 86 | ); 87 | 88 | static final dark = ThemeData.dark().copyWith( 89 | brightness: Brightness.dark, 90 | appBarTheme: const AppBarTheme(color: Color(0xFFE4000F)), 91 | colorScheme: ColorScheme.fromSwatch( 92 | brightness: Brightness.dark, 93 | accentColor: const Color(0xFFE4000F), 94 | ), 95 | backgroundColor: const Color(0xFF000000), 96 | textTheme: const TextTheme( 97 | headline1: TextStyle( 98 | fontSize: 42, 99 | fontWeight: FontWeight.w600, 100 | color: Color(0xFFFFFFFF), 101 | ), 102 | headline2: TextStyle( 103 | fontSize: 35, 104 | fontWeight: FontWeight.w600, 105 | color: Color(0xFFFFFFFF), 106 | ), 107 | headline3: TextStyle( 108 | fontSize: 26, 109 | fontWeight: FontWeight.w600, 110 | color: Color(0xFFFFFFFF), 111 | ), 112 | headline4: TextStyle( 113 | fontSize: 22, 114 | fontWeight: FontWeight.w600, 115 | color: Color(0xFFFFFFFF), 116 | ), 117 | headline5: TextStyle( 118 | fontSize: 18, 119 | fontWeight: FontWeight.w600, 120 | color: Color(0xFFFFFFFF), 121 | ), 122 | button: TextStyle( 123 | fontSize: 18, 124 | fontWeight: FontWeight.w600, 125 | color: Color(0xFFFFFFFF), 126 | ), 127 | ), 128 | elevatedButtonTheme: ElevatedButtonThemeData( 129 | style: ButtonStyle( 130 | enableFeedback: true, 131 | shape: MaterialStateProperty.all( 132 | const RoundedRectangleBorder( 133 | borderRadius: BorderRadius.all(Radius.circular(18)), 134 | ), 135 | ), 136 | ), 137 | ), 138 | cardTheme: const CardTheme( 139 | color: Color(0xFF104673), 140 | elevation: 0, 141 | ), 142 | dialogTheme: const DialogTheme( 143 | backgroundColor: Color(0xFF104673), 144 | titleTextStyle: TextStyle( 145 | fontSize: 26, 146 | fontWeight: FontWeight.w600, 147 | color: Color(0xFFFFFFFF), 148 | ), 149 | contentTextStyle: TextStyle( 150 | fontSize: 20, 151 | fontWeight: FontWeight.w600, 152 | color: Color(0xFFFFFFFF), 153 | ), 154 | ), 155 | ); 156 | 157 | static final darkExtra = ExtraThemeData( 158 | title: const TextStyle( 159 | fontSize: 42, 160 | fontWeight: FontWeight.w600, 161 | color: Color(0xFF00DDFF), 162 | ), 163 | titleSmall: const TextStyle( 164 | fontSize: 26, 165 | fontWeight: FontWeight.w600, 166 | color: Color(0xFF00DDFF), 167 | ), 168 | ); 169 | } 170 | 171 | class ExtraThemeData { 172 | ExtraThemeData({ 173 | this.title, 174 | this.titleSmall, 175 | }); 176 | 177 | final TextStyle? title; 178 | final TextStyle? titleSmall; 179 | } 180 | 181 | extension ExtraTheme on ThemeData { 182 | ExtraThemeData get extra => 183 | brightness == Brightness.dark ? AppTheme.darkExtra : AppTheme.lightExtra; 184 | } 185 | 186 | ExtraThemeData extraTheme(BuildContext context) => Theme.of(context).extra; 187 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "flutter_puzzle_hack") 5 | set(APPLICATION_ID "io.apparence.flutter_puzzle_hack") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | set(PLUGIN_BUNDLED_LIBRARIES) 9 | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 15 | endforeach(plugin) 16 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "flutter_puzzle_hack"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "flutter_puzzle_hack"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import audio_session 9 | import just_audio 10 | import path_provider_macos 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) 14 | JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) 15 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_puzzle_hack 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = io.apparence.flutterPuzzleHack 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 io.apparence. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleLocalizations 6 | 7 | en 8 | fr 9 | 10 | CFBundleDevelopmentRegion 11 | $(DEVELOPMENT_LANGUAGE) 12 | CFBundleExecutable 13 | $(EXECUTABLE_NAME) 14 | CFBundleIconFile 15 | 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | $(PRODUCT_NAME) 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | $(FLUTTER_BUILD_NAME) 26 | CFBundleVersion 27 | $(FLUTTER_BUILD_NUMBER) 28 | LSMinimumSystemVersion 29 | $(MACOSX_DEPLOYMENT_TARGET) 30 | NSHumanReadableCopyright 31 | $(PRODUCT_COPYRIGHT) 32 | NSMainNibFile 33 | MainMenu 34 | NSPrincipalClass 35 | NSApplication 36 | 37 | 38 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_puzzle_hack 2 | description: Flutter Puzzle Hack Challenge 3 | version: 1.0.0+1 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: ">=2.15.1 <3.0.0" 8 | 9 | dependencies: 10 | confetti: ^0.6.0 11 | dart_code_metrics: ^4.9.1 12 | equatable: ^2.0.3 13 | flutter: 14 | sdk: flutter 15 | flutter_localizations: 16 | sdk: flutter 17 | intl: ^0.17.0 18 | just_audio: ^0.9.18 19 | logging: ^1.0.2 20 | rive: ^0.8.1 21 | universal_platform: ^1.0.0+1 22 | 23 | dev_dependencies: 24 | fake_async: ^1.2.0 25 | flutter_lints: ^1.0.0 26 | flutter_test: 27 | sdk: flutter 28 | 29 | flutter: 30 | uses-material-design: true 31 | generate: true 32 | 33 | assets: 34 | - assets/animations/ 35 | - assets/images/ 36 | - assets/images/buttons/ 37 | - assets/themes/base/ 38 | - assets/themes/base/audio/ 39 | -------------------------------------------------------------------------------- /readme-doc/logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/readme-doc/logos.png -------------------------------------------------------------------------------- /readme-doc/showcase-readme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/readme-doc/showcase-readme.jpg -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | PROJECT_PATH="${1:-.}" 5 | PROJECT_COVERAGE=./coverage/lcov.info 6 | 7 | cd ${PROJECT_PATH} 8 | 9 | rm -rf coverage 10 | if grep -q "flutter:" pubspec.yaml; then 11 | flutter --version 12 | flutter test --no-pub --test-randomize-ordering-seed random --coverage -j 28 13 | else 14 | dart --version 15 | dart test --coverage=coverage && pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib 16 | fi 17 | lcov --remove ${PROJECT_COVERAGE} -o ${PROJECT_COVERAGE} \ 18 | '**/l10n/*.dart' \ 19 | '**/l10n/**/*.dart' 20 | genhtml ${PROJECT_COVERAGE} -o coverage 21 | open ./coverage/index.html 22 | -------------------------------------------------------------------------------- /test/helpers/helpers.dart: -------------------------------------------------------------------------------- 1 | export 'pump_app.dart'; 2 | export 'set_display_size.dart'; 3 | -------------------------------------------------------------------------------- /test/helpers/pump_app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_localizations/flutter_localizations.dart'; 3 | import 'package:flutter_puzzle_hack/src/l10n/l10n.dart'; 4 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | 7 | extension PumpApp on WidgetTester { 8 | Future pumpApp(Widget widget) { 9 | return pumpWidget( 10 | MaterialApp( 11 | localizationsDelegates: const [ 12 | AppLocalizations.delegate, 13 | GlobalMaterialLocalizations.delegate, 14 | GlobalWidgetsLocalizations.delegate, 15 | GlobalCupertinoLocalizations.delegate, 16 | ], 17 | supportedLocales: AppLocalizations.supportedLocales, 18 | home: Builder( 19 | builder: (context) { 20 | return BreakpointProvider( 21 | screenWidth: MediaQuery.of(context).size.width, 22 | child: widget, 23 | ); 24 | }, 25 | ), 26 | ), 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/helpers/set_display_size.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | extension PuzzleWidgetTester on WidgetTester { 6 | void setDisplaySize(Size size) { 7 | binding.window.physicalSizeTestValue = size; 8 | binding.window.devicePixelRatioTestValue = 1.0; 9 | addTearDown(() { 10 | binding.window.clearPhysicalSizeTestValue(); 11 | binding.window.clearDevicePixelRatioTestValue(); 12 | }); 13 | } 14 | 15 | void setXLargeDisplaySize() { 16 | setDisplaySize(const Size(BreakpointSize.xlarge, 1000)); 17 | } 18 | 19 | void setLargeDisplaySize() { 20 | setDisplaySize(const Size(BreakpointSize.large, 1000)); 21 | } 22 | 23 | void setMediumDisplaySize() { 24 | setDisplaySize(const Size(BreakpointSize.medium, 1000)); 25 | } 26 | 27 | void setSmallDisplaySize() { 28 | setDisplaySize(const Size(BreakpointSize.small, 1000)); 29 | } 30 | 31 | void setXSmallDisplaySize() { 32 | setDisplaySize(const Size(BreakpointSize.small - 1, 1000)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/layout/breakpoint_provider_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_puzzle_hack/src/layout/breakpoint_provider.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import '../helpers/helpers.dart'; 6 | 7 | void main() { 8 | group('BreakpointProvider', () { 9 | testWidgets( 10 | 'provide xsmall breakpoint for sizes smaller than small', 11 | (tester) async { 12 | tester.setXSmallDisplaySize(); 13 | var tested = false; 14 | await tester.pumpApp( 15 | Builder( 16 | builder: (BuildContext context) { 17 | expect(BreakpointProvider.of(context), Breakpoint.xsmall); 18 | tested = true; 19 | 20 | return Container(); 21 | }, 22 | ), 23 | ); 24 | 25 | final dynamic exception = tester.takeException(); 26 | expect(exception, isNull); 27 | expect(tested, isTrue); 28 | }, 29 | ); 30 | 31 | testWidgets( 32 | 'provide small breakpoint for sizes larger than small', 33 | (tester) async { 34 | tester.setSmallDisplaySize(); 35 | var tested = false; 36 | await tester.pumpApp( 37 | Builder( 38 | builder: (BuildContext context) { 39 | expect(BreakpointProvider.of(context), Breakpoint.small); 40 | tested = true; 41 | 42 | return Container(); 43 | }, 44 | ), 45 | ); 46 | 47 | final dynamic exception = tester.takeException(); 48 | expect(exception, isNull); 49 | expect(tested, isTrue); 50 | }, 51 | ); 52 | 53 | testWidgets( 54 | 'provide medium breakpoint for sizes larger than medium', 55 | (tester) async { 56 | tester.setMediumDisplaySize(); 57 | var tested = false; 58 | await tester.pumpApp( 59 | Builder( 60 | builder: (BuildContext context) { 61 | expect(BreakpointProvider.of(context), Breakpoint.medium); 62 | tested = true; 63 | 64 | return Container(); 65 | }, 66 | ), 67 | ); 68 | 69 | final dynamic exception = tester.takeException(); 70 | expect(exception, isNull); 71 | expect(tested, isTrue); 72 | }, 73 | ); 74 | 75 | testWidgets( 76 | 'provide large breakpoint for sizes larger than large', 77 | (tester) async { 78 | tester.setLargeDisplaySize(); 79 | var tested = false; 80 | await tester.pumpApp( 81 | Builder( 82 | builder: (BuildContext context) { 83 | expect(BreakpointProvider.of(context), Breakpoint.large); 84 | tested = true; 85 | 86 | return Container(); 87 | }, 88 | ), 89 | ); 90 | 91 | final dynamic exception = tester.takeException(); 92 | expect(exception, isNull); 93 | expect(tested, isTrue); 94 | }, 95 | ); 96 | 97 | testWidgets( 98 | 'provide xlarget breakpoint for sizes larger than xlarger', 99 | (tester) async { 100 | tester.setXLargeDisplaySize(); 101 | var tested = false; 102 | await tester.pumpApp( 103 | Builder( 104 | builder: (BuildContext context) { 105 | expect(BreakpointProvider.of(context), Breakpoint.xlarge); 106 | tested = true; 107 | 108 | return Container(); 109 | }, 110 | ), 111 | ); 112 | 113 | final dynamic exception = tester.takeException(); 114 | expect(exception, isNull); 115 | expect(tested, isTrue); 116 | }, 117 | ); 118 | 119 | testWidgets( 120 | 'notifies breakpoint changes', 121 | (tester) async { 122 | var expectedBreakPoint = Breakpoint.xlarge; 123 | tester.setXLargeDisplaySize(); 124 | var tested = false; 125 | await tester.pumpApp( 126 | Builder( 127 | builder: (BuildContext context) { 128 | expect(BreakpointProvider.of(context), expectedBreakPoint); 129 | tested = true; 130 | 131 | return Container(); 132 | }, 133 | ), 134 | ); 135 | expectedBreakPoint = Breakpoint.xsmall; 136 | tester.setXSmallDisplaySize(); 137 | await tester.pumpAndSettle(); 138 | 139 | final dynamic exception = tester.takeException(); 140 | expect(exception, isNull); 141 | expect(tested, isTrue); 142 | }, 143 | ); 144 | }); 145 | } 146 | -------------------------------------------------------------------------------- /test/models/connection_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/src/models/connection.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | group('Connection', () { 6 | test('supports comparison', () { 7 | expect( 8 | const Connection.all(true), 9 | const Connection.fromLTRB(true, true, true, true), 10 | ); 11 | expect( 12 | const Connection.all(true).props, 13 | const Connection.fromLTRB(true, true, true, true).props, 14 | ); 15 | }); 16 | 17 | group('fromLTRB', () { 18 | test( 19 | 'returns a connection object with directions with given values', 20 | () { 21 | const connection = Connection.fromLTRB(true, false, false, true); 22 | expect(connection.left, isTrue); 23 | expect(connection.top, isFalse); 24 | expect(connection.right, isFalse); 25 | expect(connection.bottom, isTrue); 26 | }, 27 | ); 28 | }); 29 | 30 | group('all', () { 31 | test( 32 | 'returns a connection object with all direction with given value', 33 | () { 34 | expect( 35 | const Connection.all(true), 36 | const Connection.fromLTRB(true, true, true, true), 37 | ); 38 | expect( 39 | const Connection.all(false), 40 | const Connection.fromLTRB(false, false, false, false), 41 | ); 42 | }, 43 | ); 44 | }); 45 | 46 | group('horizontal', () { 47 | test( 48 | 'returns a connection object with left and right to true', 49 | () { 50 | expect( 51 | const Connection.horizontal(), 52 | const Connection.fromLTRB(true, false, true, false), 53 | ); 54 | }, 55 | ); 56 | }); 57 | 58 | group('vertical', () { 59 | test( 60 | 'returns a connection object with top and bottom to true', 61 | () { 62 | expect( 63 | const Connection.vertical(), 64 | const Connection.fromLTRB(false, true, false, true), 65 | ); 66 | }, 67 | ); 68 | }); 69 | 70 | group('leftTop', () { 71 | test( 72 | 'returns a connection object with left and top to true', 73 | () { 74 | expect( 75 | const Connection.leftTop(), 76 | const Connection.fromLTRB(true, true, false, false), 77 | ); 78 | }, 79 | ); 80 | }); 81 | 82 | group('topRight', () { 83 | test( 84 | 'returns a connection object with top and right to true', 85 | () { 86 | expect( 87 | const Connection.topRight(), 88 | const Connection.fromLTRB(false, true, true, false), 89 | ); 90 | }, 91 | ); 92 | }); 93 | 94 | group('leftBottom', () { 95 | test( 96 | 'returns a connection object with top and right to true', 97 | () { 98 | expect( 99 | const Connection.leftBottom(), 100 | const Connection.fromLTRB(true, false, false, true), 101 | ); 102 | }, 103 | ); 104 | }); 105 | 106 | group('rightBottom', () { 107 | test( 108 | 'returns a connection object with top and right to true', 109 | () { 110 | expect( 111 | const Connection.rightBottom(), 112 | const Connection.fromLTRB(false, false, true, true), 113 | ); 114 | }, 115 | ); 116 | }); 117 | }); 118 | } 119 | -------------------------------------------------------------------------------- /test/models/dimension_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/src/models/dimension.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | group('Dimension', () { 6 | const width = 3; 7 | const height = 4; 8 | 9 | test('supports comparison', () { 10 | expect( 11 | const Dimension( 12 | width: width, 13 | height: height, 14 | ), 15 | const Dimension( 16 | width: width, 17 | height: height, 18 | ), 19 | ); 20 | expect( 21 | const Dimension( 22 | width: width, 23 | height: height, 24 | ).props, 25 | const Dimension( 26 | width: width, 27 | height: height, 28 | ).props, 29 | ); 30 | }); 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /test/models/position_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/src/models/position.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | group('Position', () { 6 | const positionX = 1; 7 | const positionY = 2; 8 | 9 | test('supports comparison', () { 10 | expect( 11 | const Position( 12 | positionX, 13 | positionY, 14 | ), 15 | const Position( 16 | positionX, 17 | positionY, 18 | ), 19 | ); 20 | 21 | expect( 22 | const Position( 23 | positionX, 24 | positionY, 25 | ).props, 26 | const Position( 27 | positionX, 28 | positionY, 29 | ).props, 30 | ); 31 | }); 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /test/models/ticker_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:fake_async/fake_async.dart'; 2 | import 'package:flutter_puzzle_hack/src/models/ticker.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | group('Ticker', () { 7 | group('tick', () { 8 | test('returns stream of integers', () { 9 | const ticker = Ticker(); 10 | final stream = ticker.tick(); 11 | expect(stream, isA>()); 12 | }); 13 | 14 | test( 15 | 'returns stream of integers counting up from 1 every second', 16 | () async { 17 | await fakeAsync((async) async { 18 | final events = []; 19 | const ticker = Ticker(); 20 | final subscription = ticker.tick().listen(events.add); 21 | async.elapse(const Duration(seconds: 20)); 22 | await subscription.cancel(); 23 | expect( 24 | events, 25 | [ 26 | for (int i = 1; i <= 20; i++) i, 27 | ], 28 | ); 29 | }); 30 | }, 31 | ); 32 | }); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /test/models/tile_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_puzzle_hack/src/models/connection.dart'; 2 | import 'package:flutter_puzzle_hack/src/models/position.dart'; 3 | import 'package:flutter_puzzle_hack/src/models/tile.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | void main() { 7 | const id = 'someId'; 8 | const basePosition = Position(1, 1); 9 | const newPosition = Position(2, 1); 10 | const connection = Connection.all(true); 11 | const type = TileType.start; 12 | const asset = 'asset.png'; 13 | const filling = Connection.all(false); 14 | 15 | group('Tile', () { 16 | test('supports comparison', () { 17 | expect( 18 | const Tile( 19 | id: id, 20 | position: basePosition, 21 | connection: connection, 22 | type: type, 23 | asset: asset, 24 | filling: filling, 25 | ), 26 | const Tile( 27 | id: id, 28 | position: basePosition, 29 | connection: connection, 30 | type: type, 31 | asset: asset, 32 | filling: filling, 33 | ), 34 | ); 35 | 36 | expect( 37 | const Tile( 38 | id: id, 39 | position: basePosition, 40 | connection: connection, 41 | type: type, 42 | asset: asset, 43 | filling: filling, 44 | ).props, 45 | const Tile( 46 | id: id, 47 | position: basePosition, 48 | connection: connection, 49 | type: type, 50 | asset: asset, 51 | filling: filling, 52 | ).props, 53 | ); 54 | }); 55 | 56 | group('copyWith', () { 57 | test('returns a tile object with updated position', () { 58 | expect( 59 | const Tile( 60 | id: id, 61 | position: basePosition, 62 | connection: connection, 63 | type: type, 64 | asset: asset, 65 | ).copyWith(position: newPosition), 66 | const Tile( 67 | id: id, 68 | position: newPosition, 69 | connection: connection, 70 | type: type, 71 | asset: asset, 72 | ), 73 | ); 74 | }); 75 | }); 76 | 77 | group('empty', () { 78 | test('returns an empty tile object with no connection', () { 79 | expect( 80 | const Tile.empty( 81 | id: id, 82 | position: basePosition, 83 | ), 84 | const Tile( 85 | id: id, 86 | position: basePosition, 87 | // ignore: avoid_redundant_argument_values 88 | connection: Connection.all(false), 89 | type: TileType.empty, 90 | // ignore: avoid_redundant_argument_values 91 | asset: null, 92 | ), 93 | ); 94 | }); 95 | }); 96 | }); 97 | } 98 | -------------------------------------------------------------------------------- /test/unit_test.dart: -------------------------------------------------------------------------------- 1 | // This is an example unit test. 2 | // 3 | // A unit test tests a single function, method, or class. To learn more about 4 | // writing unit tests, visit 5 | // https://flutter.dev/docs/cookbook/testing/unit/introduction 6 | 7 | import 'package:flutter_test/flutter_test.dart'; 8 | 9 | void main() { 10 | group('Plus Operator', () { 11 | test('should add two numbers together', () { 12 | expect(1 + 1, 2); 13 | }); 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is an example Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | // 8 | // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for 9 | // more information about Widget testing. 10 | 11 | import 'package:flutter/material.dart'; 12 | import 'package:flutter_test/flutter_test.dart'; 13 | 14 | import '../test/helpers/helpers.dart'; 15 | 16 | void main() { 17 | group('MyWidget', () { 18 | testWidgets('should display a string of text', (WidgetTester tester) async { 19 | // Define a Widget 20 | const myWidget = Scaffold( 21 | body: Text('Hello'), 22 | ); 23 | 24 | // Build myWidget and trigger a frame. 25 | await tester.pumpApp(myWidget); 26 | 27 | // Verify myWidget shows some text 28 | expect(find.byType(Text), findsOneWidget); 29 | }); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_puzzle_hack 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_puzzle_hack", 3 | "short_name": "flutter_puzzle_hack", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Flutter Puzzle Hack Challenge", 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 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(flutter_puzzle_hack LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "flutter_puzzle_hack") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | set(PLUGIN_BUNDLED_LIBRARIES) 9 | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 15 | endforeach(plugin) 16 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "io.apparence" "\0" 93 | VALUE "FileDescription", "Flutter Puzzle Hack Challenge" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_puzzle_hack" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 io.apparence. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_puzzle_hack.exe" "\0" 98 | VALUE "ProductName", "flutter_puzzle_hack" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"flutter_puzzle_hack", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apparence-io/flutter-challenge/b63446634a3fdc5e4edc8879a71339766e6bc1cb/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------