commit 5998044f2b0ef206a43d80fdb64a1acd0830bb85 Author: Meta Vens Date: Fri Jul 10 09:57:05 2026 +0100 Initialize generic Eve Flutter runtime diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8cfaa9e --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ +/assets/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..56e62b8 --- /dev/null +++ b/.metadata @@ -0,0 +1,39 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "924134a44c189315be2148659913dda1671cbe99" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 924134a44c189315be2148659913dda1671cbe99 + base_revision: 924134a44c189315be2148659913dda1671cbe99 + - platform: android + create_revision: 924134a44c189315be2148659913dda1671cbe99 + base_revision: 924134a44c189315be2148659913dda1671cbe99 + - platform: ios + create_revision: 924134a44c189315be2148659913dda1671cbe99 + base_revision: 924134a44c189315be2148659913dda1671cbe99 + - platform: linux + create_revision: 924134a44c189315be2148659913dda1671cbe99 + base_revision: 924134a44c189315be2148659913dda1671cbe99 + - platform: windows + create_revision: 924134a44c189315be2148659913dda1671cbe99 + base_revision: 924134a44c189315be2148659913dda1671cbe99 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..bdaa4c6 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# EveFlutter + +Generic Flutter lowering for Eve surface documents. EveFlutter owns native +Flutter projection, provider selection, command-intent construction, platform +build glue, tests, and captures. Providers retain state and command authority; +plugins retain domain semantics. + +Current smoke target: + +- `CultUiInspectorSurface` +- custom-painted slider track/fill/thumb +- `EmbeddedSurfaceDemo`, which verifies `surface.slot` / + `embeddedDocuments` parsing and rendering from the shared fixture +- golden PNG output through `flutter test --update-goldens` + +Run from the repository root: + +```powershell +powershell -ExecutionPolicy Bypass -File .\scripts\capture-flutter-parity.ps1 -Target windows -SurfacePath +``` + +Linux capture requires running the same harness on a Linux host. The Windows +host must not pretend to be a Linux renderer. + +Split lifecycle evidence lives in `eveflutter-lifecycle.json`. From the +repository root, run: + +```powershell +powershell -ExecutionPolicy Bypass -File .\scripts\run-eveflutter-lifecycle-smoke.ps1 +``` + +That smoke validates the owner lifecycle document and runs the Dart analyzer. +Pass an exported conformance directory and Eve's generic export consumer to +verify contract consumption without importing Eve source layout. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..36062f3 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.application") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.eve_parity" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.eve_parity" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9111a10 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/eve_parity/MainActivity.kt b/android/app/src/main/kotlin/com/example/eve_parity/MainActivity.kt new file mode 100644 index 0000000..047e060 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/eve_parity/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.eve_parity + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..e96108c --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2d428bf --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..c21f0c5 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.0.1" apply false + id("org.jetbrains.kotlin.android") version "2.3.20" apply false +} + +include(":app") diff --git a/eveflutter-lifecycle.json b/eveflutter-lifecycle.json new file mode 100644 index 0000000..2e25c56 --- /dev/null +++ b/eveflutter-lifecycle.json @@ -0,0 +1,56 @@ +{ + "schema": "gamecult.eve.runtime_lifecycle.v1", + "splitTarget": "EveFlutter", + "ownerRepo": "EveFlutter", + "currentHostRepo": "EveFlutter", + "status": "owner-hosted", + "runtimes": [ + "windows-flutter", + "linux-flutter", + "android-flutter" + ], + "release": { + "ownerRepo": "EveFlutter", + "status": "incubating-flutter-app", + "evidencePaths": [ + "pubspec.yaml", + "README.md" + ], + "pendingProofs": [ + "Tagged EveFlutter release is cut from EveFlutter rather than Eve incubation." + ] + }, + "test": { + "ownerRepo": "EveFlutter", + "status": "dart-analyze-and-widget-smoke", + "commands": [ + "dart analyze lib test", + "powershell -ExecutionPolicy Bypass -File scripts/run-eveflutter-conformance-consumer-smoke.ps1" + ], + "evidencePaths": [ + "lib/main.dart", + "test/parity_smoke_test.dart", + "scripts/run-eveflutter-conformance-consumer-smoke.ps1" + ], + "pendingProofs": [ + "Tagged EveFlutter release runs owner-repo tests." + ] + }, + "capture": { + "ownerRepo": "EveFlutter", + "status": "windows-linux-android-capture-smokes", + "evidencePaths": [ + "scripts/capture-flutter-parity.ps1", + "scripts/capture-linux-flutter-parity.ps1", + "scripts/capture-android-flutter-parity.ps1" + ], + "pendingProofs": [ + "Native capture witnesses are attached from EveFlutter on each supported platform." + ] + }, + "remainingSplitBlockers": [ + "Tagged EveFlutter release is cut from EveFlutter rather than Eve incubation.", + "Tagged EveFlutter release runs owner-repo tests.", + "Native capture witnesses are attached from EveFlutter on each supported platform." + ] +} diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..391a902 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1573b41 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,644 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.eveParity; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..c3fedb2 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..c30b367 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,16 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..01c7b8b --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,70 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Eve Parity + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + eve_parity + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneConfigurationName + flutter + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/Runner/SceneDelegate.swift b/ios/Runner/SceneDelegate.swift new file mode 100644 index 0000000..b9ce8ea --- /dev/null +++ b/ios/Runner/SceneDelegate.swift @@ -0,0 +1,6 @@ +import Flutter +import UIKit + +class SceneDelegate: FlutterSceneDelegate { + +} diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..8c4a1c4 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,1512 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +void main() { + runApp(const EveParityApp()); +} + +typedef EveCommandSink = void Function(EveCommandIntent intent, EveNode node); + +class EveParityApp extends StatefulWidget { + const EveParityApp({ + super.key, + this.assetPath = 'assets/current-surface.json', + this.commandSink, + }); + + final String assetPath; + final EveCommandSink? commandSink; + + @override + State createState() => _EveParityAppState(); +} + +class _EveParityAppState extends State { + late Future surface; + + @override + void initState() { + super.initState(); + surface = EveSurfaceState.load(widget.assetPath); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + home: FutureBuilder( + future: surface, + builder: (context, snapshot) { + final state = snapshot.data; + final tokens = state?.tokens ?? EveTokens.defaults; + return Scaffold( + backgroundColor: tokens.background, + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16), + child: snapshot.hasError + ? Text( + 'Eve surface load failed\n${snapshot.error}', + style: const TextStyle( + color: Color(0xFFFFB84F), + fontFamily: 'monospace', + ), + ) + : state == null + ? const SizedBox.shrink() + : SingleChildScrollView( + child: EveSurfaceView( + state: state, + commandSink: widget.commandSink, + ), + ), + ), + ), + ); + }, + ), + ); + } +} + +class EveSurfaceState { + EveSurfaceState({ + required this.providerId, + required this.surfaceId, + required this.title, + required this.root, + required this.tokens, + required this.controlSkins, + required this.values, + }); + + final String providerId; + final String surfaceId; + final String title; + final EveNode root; + final EveTokens tokens; + final Map> controlSkins; + final Map values; + + static Future load(String assetPath) async { + final raw = await rootBundle.loadString(assetPath); + final json = jsonDecode(raw) as Map; + return EveSurfaceState.fromJson(json); + } + + factory EveSurfaceState.fromJson(Map json) { + final surface = json['surface'] as Map; + final styles = (surface['styles'] as Map?) ?? const {}; + final skins = >{}; + final rawSkins = + (styles['controlSkins'] as Map?) ?? const {}; + for (final entry in rawSkins.entries) { + final skin = entry.value as Map; + skins[entry.key] = ((skin['children'] as List?) ?? const []) + .map((child) => EveNode.fromJson(child as Map)) + .toList(); + } + return EveSurfaceState( + providerId: (json['providerId'] ?? '').toString(), + surfaceId: (surface['id'] ?? '').toString(), + title: (json['title'] ?? '').toString(), + root: EveNode.fromJson(surface['root'] as Map), + tokens: EveTokens.fromJson( + (styles['tokens'] as Map?) ?? const {}, + ), + controlSkins: skins, + values: (json['values'] as Map?) ?? const {}, + ); + } +} + +class EveProviderCatalog { + const EveProviderCatalog({required this.providers}); + + final List providers; + + factory EveProviderCatalog.fromConformanceExport(Map json) { + final providers = ((json['providers'] as List?) ?? const []) + .map((provider) { + return EveProviderEntry.fromJson(provider as Map); + }) + .toList(growable: false); + return EveProviderCatalog(providers: providers); + } + + EveProviderEntry? findProvider(String providerId) { + for (final provider in providers) { + if (provider.providerId == providerId) return provider; + } + return null; + } +} + +class EveProviderEntry { + const EveProviderEntry({ + required this.providerId, + required this.status, + required this.ownerRepo, + required this.advertisementPath, + required this.surfaces, + required this.commands, + required this.pluginRequirements, + }); + + final String providerId; + final String status; + final String ownerRepo; + final String advertisementPath; + final List surfaces; + final List commands; + final List pluginRequirements; + + factory EveProviderEntry.fromJson(Map json) { + return EveProviderEntry( + providerId: (json['providerId'] ?? '').toString(), + status: (json['status'] ?? '').toString(), + ownerRepo: (json['ownerRepo'] ?? '').toString(), + advertisementPath: (json['advertisementPath'] ?? '').toString(), + surfaces: _stringList(json['surfaces']), + commands: _stringList(json['commands']), + pluginRequirements: + ((json['pluginRequirements'] as List?) ?? const []) + .map( + (requirement) => EvePluginRequirement.fromJson( + requirement as Map, + ), + ) + .toList(growable: false), + ); + } +} + +class EvePluginRequirement { + const EvePluginRequirement({ + required this.surfaceId, + required this.pluginId, + required this.requiredCapabilities, + }); + + final String surfaceId; + final String pluginId; + final List requiredCapabilities; + + factory EvePluginRequirement.fromJson(Map json) { + return EvePluginRequirement( + surfaceId: (json['surfaceId'] ?? '').toString(), + pluginId: (json['pluginId'] ?? '').toString(), + requiredCapabilities: _stringList(json['requiredCapabilities']), + ); + } +} + +List _stringList(Object? value) { + return ((value as List?) ?? const []) + .map((item) => item.toString()) + .toList(growable: false); +} + +class EveProviderPicker extends StatelessWidget { + const EveProviderPicker({ + required this.catalog, + required this.selectedProviderId, + required this.onSelected, + super.key, + }); + + final EveProviderCatalog catalog; + final String selectedProviderId; + final ValueChanged onSelected; + + @override + Widget build(BuildContext context) { + return DropdownButton( + value: catalog.findProvider(selectedProviderId) == null + ? null + : selectedProviderId, + hint: const Text('Select provider'), + items: [ + for (final provider in catalog.providers) + DropdownMenuItem( + value: provider.providerId, + child: Text(provider.providerId), + ), + ], + onChanged: (value) { + if (value != null) onSelected(value); + }, + ); + } +} + +class EveNode { + EveNode({ + required this.id, + required this.kind, + required this.props, + required this.layout, + required this.children, + required this.embeddedDocuments, + }); + + final String id; + final String kind; + final Map props; + final Map layout; + final List children; + final List embeddedDocuments; + + factory EveNode.fromJson(Map json) { + return EveNode( + id: (json['id'] ?? '').toString(), + kind: (json['kind'] ?? 'panel').toString(), + props: (json['props'] as Map?) ?? const {}, + layout: (json['layout'] as Map?) ?? const {}, + children: ((json['children'] as List?) ?? const []) + .map((child) => EveNode.fromJson(child as Map)) + .toList(), + embeddedDocuments: + ((json['embeddedDocuments'] as List?) ?? const []) + .map( + (slot) => EveEmbeddedDocumentSlot.fromJson( + slot as Map, + ), + ) + .toList(), + ); + } +} + +class EveCommandIntent { + EveCommandIntent({ + required this.type, + required this.schema, + required this.providerId, + required this.surfaceId, + required this.command, + required this.commandId, + required this.clientId, + required this.issuedAtUtc, + required this.payload, + }); + + final String type; + final String schema; + final String providerId; + final String surfaceId; + final String command; + final String commandId; + final String clientId; + final String issuedAtUtc; + final Map payload; + + Map toJson() => { + 'type': type, + 'schema': schema, + 'providerId': providerId, + 'surfaceId': surfaceId, + 'command': command, + 'commandId': commandId, + 'clientId': clientId, + 'issuedAtUtc': issuedAtUtc, + 'payload': payload, + }; +} + +EveCommandIntent createEveCommandIntent( + EveSurfaceState state, + EveNode node, + String command, +) { + return EveCommandIntent( + type: 'surface-command', + schema: 'gamecult.eve.command_invocation.v1', + providerId: state.providerId, + surfaceId: state.surfaceId, + command: command, + commandId: node.props['commandId']?.toString() ?? command, + clientId: 'flutter-parity', + issuedAtUtc: DateTime.now().toUtc().toIso8601String(), + payload: { + 'nodeId': node.id, + 'kind': node.kind, + 'props': node.props, + if (node.props['action'] != null) 'action': node.props['action'], + }, + ); +} + +String resolveComponentCommandId(Map props, EveNode node) { + final action = props['action'] is Map + ? props['action'] as Map + : const {}; + for (final value in [ + props['command'], + action['command'], + action['target'], + action['type'], + props['commandId'], + node.id, + ]) { + if (value is String && value.trim().isNotEmpty) return value; + } + return ''; +} + +class EveEmbeddedDocumentSlot { + EveEmbeddedDocumentSlot({ + required this.slotId, + required this.documentId, + required this.schemaId, + required this.presentationKind, + }); + + final String slotId; + final String documentId; + final String schemaId; + final String presentationKind; + + factory EveEmbeddedDocumentSlot.fromJson(Map json) { + return EveEmbeddedDocumentSlot( + slotId: (json['slotId'] ?? '').toString(), + documentId: (json['documentId'] ?? '').toString(), + schemaId: (json['schemaId'] ?? '').toString(), + presentationKind: (json['presentationKind'] ?? '').toString(), + ); + } +} + +class EveTokens { + const EveTokens({ + required this.background, + required this.panel, + required this.panelAlt, + required this.panelInset, + required this.border, + required this.text, + required this.muted, + required this.accent, + }); + + final Color background; + final Color panel; + final Color panelAlt; + final Color panelInset; + final Color border; + final Color text; + final Color muted; + final Color accent; + + static const defaults = EveTokens( + background: Color(0xFF020909), + panel: Color(0xFF071918), + panelAlt: Color(0xFF15151D), + panelInset: Color(0x57000000), + border: Color(0x4767F0E4), + text: Color(0xFFE7F1F1), + muted: Color(0xFF8BA5A3), + accent: Color(0xFFFFB84F), + ); + + factory EveTokens.fromJson(Map json) { + return EveTokens( + background: _color(json['colorBackground'], defaults.background), + panel: _color(json['colorPanel'], defaults.panel), + panelAlt: _color(json['colorPanelAlt'], defaults.panelAlt), + panelInset: _color(json['colorPanelInset'], defaults.panelInset), + border: _color(json['colorPanelBorder'], defaults.border), + text: _color(json['colorText'], defaults.text), + muted: _color(json['colorMuted'], defaults.muted), + accent: _color(json['colorAccent'], defaults.accent), + ); + } + + static Color _color(Object? value, Color fallback) { + if (value is! String) return fallback; + final hex = value.trim(); + if (!hex.startsWith('#')) return fallback; + final body = hex.substring(1); + if (body.length == 6) return Color(int.parse('ff$body', radix: 16)); + if (body.length == 8) return Color(int.parse(body, radix: 16)); + return fallback; + } +} + +class EveSurfaceView extends StatelessWidget { + const EveSurfaceView({required this.state, this.commandSink, super.key}); + + final EveSurfaceState state; + final EveCommandSink? commandSink; + + @override + Widget build(BuildContext context) { + return EveNodeView( + state: state, + node: state.root, + commandSink: commandSink, + ); + } +} + +class EveNodeView extends StatelessWidget { + const EveNodeView({ + required this.state, + required this.node, + this.commandSink, + super.key, + }); + + final EveSurfaceState state; + final EveNode node; + final EveCommandSink? commandSink; + + @override + Widget build(BuildContext context) { + switch (node.kind) { + case 'surface': + return _surface(); + case 'partition': + return _partition(); + case 'pane': + case 'panel': + return _pane(); + case 'card': + case 'card.external': + return _card(); + case 'label': + case 'text': + case 'text.title': + case 'text.dialogue': + return _text(); + case 'control.slider': + return EveSlider(state: state, node: node); + case 'control.button': + return _button(); + case 'image.preview': + return _imagePreview(); + case 'canvas.preview': + case 'canvas.editor': + return _canvasPlaceholder(editor: node.kind == 'canvas.editor'); + case 'status.stage': + return _statusStage(); + case 'input.file': + case 'dropzone': + return _button(); + case 'input.number': + case 'input.select': + case 'control.range': + return _field(); + case 'control.toggle': + return _toggle(); + case 'color.swatch': + return _swatch(); + case 'vn.stage': + return _vnStage(); + case 'image.background': + return _background(); + case 'embed.norn': + return _norn(); + case 'embed.tex': + return _tex(); + case 'panel.dialogue': + return _dialogue(); + case 'rail.actions': + return _actions(); + case 'surface.slot': + return _surfaceSlot(); + default: + return _fallback(); + } + } + + Widget _surfaceSlot() { + final slot = node.embeddedDocuments.firstOrNull; + final label = + node.props['presentationKind']?.toString() ?? + slot?.presentationKind ?? + node.props['slotId']?.toString() ?? + slot?.slotId ?? + 'embedded surface'; + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelAlt.withValues(alpha: 0.65), + border: Border.all(color: state.tokens.accent.withValues(alpha: 0.45)), + borderRadius: BorderRadius.circular(6), + ), + child: Padding( + padding: const EdgeInsets.all(12), + child: Text( + label, + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ), + ); + } + + Widget _vnStage() { + final background = node.children + .where((child) => child.kind == 'image.background') + .firstOrNull; + final sceneChildren = node.children.where((child) { + return child.kind != 'image.background' && + child.kind != 'panel.dialogue' && + child.kind != 'rail.actions'; + }).toList(); + final dialogue = node.children + .where((child) => child.kind == 'panel.dialogue') + .firstOrNull; + final actions = node.children + .where((child) => child.kind == 'rail.actions') + .firstOrNull; + + return LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth; + final height = constraints.maxHeight.isFinite + ? constraints.maxHeight + : width * 0.56; + return SizedBox( + width: width, + height: height.clamp(520, 900), + child: Stack( + children: [ + Positioned.fill( + child: background == null + ? DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.background, + ), + ) + : EveNodeView( + state: state, + node: background, + commandSink: commandSink, + ), + ), + for (final child in sceneChildren) _stageOverlay(child), + if (dialogue != null) + Positioned( + left: 28, + right: 28, + bottom: actions == null ? 24 : 96, + child: EveNodeView( + state: state, + node: dialogue, + commandSink: commandSink, + ), + ), + if (actions != null) + Positioned( + left: 28, + right: 28, + bottom: 24, + child: EveNodeView( + state: state, + node: actions, + commandSink: commandSink, + ), + ), + ], + ), + ); + }, + ); + } + + Positioned _stageOverlay(EveNode child) { + if (child.kind == 'layer.embedded-surfaces' || + child.kind == 'layer.cards') { + return Positioned.fill( + child: IgnorePointer( + child: Stack( + children: [ + for (final grandchild in child.children) + _stageOverlay(grandchild), + ], + ), + ), + ); + } + final placement = _map(child.props['placement']); + final anchor = placement['anchor']?.toString(); + if (child.kind == 'embed.norn' || anchor == 'whiteboard') { + return Positioned( + left: 54, + top: 46, + width: 520, + height: 310, + child: EveNodeView(state: state, node: child, commandSink: commandSink), + ); + } + if (child.kind == 'embed.tex' || anchor == 'whiteboard-equation') { + return Positioned( + left: 96, + top: 350, + width: 500, + height: 94, + child: EveNodeView(state: state, node: child, commandSink: commandSink), + ); + } + return Positioned( + right: 32, + top: 52, + width: 300, + child: EveNodeView(state: state, node: child, commandSink: commandSink), + ); + } + + Widget _background() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.background, + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + state.tokens.panelAlt, + state.tokens.background, + const Color(0xFF10161F), + ], + ), + ), + child: Stack( + children: [ + Positioned.fill( + child: CustomPaint( + painter: EveGridPainter( + color: state.tokens.accent.withValues(alpha: 0.10), + ), + ), + ), + Positioned( + left: 28, + top: 24, + child: Text( + node.props['label']?.toString() ?? 'Scene', + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + ), + ], + ), + ); + } + + Widget _norn() { + final graph = _map(node.props['graph']); + final nodes = (graph['nodes'] as List?) ?? const []; + final edges = (graph['edges'] as List?) ?? const []; + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panel.withValues(alpha: 0.82), + border: Border.all(color: state.tokens.border), + borderRadius: BorderRadius.circular(6), + ), + child: Padding( + padding: const EdgeInsets.all(12), + child: CustomPaint( + painter: EveNornPainter( + nodes: nodes, + edges: edges, + tokens: state.tokens, + ), + child: const SizedBox.expand(), + ), + ), + ); + } + + Widget _tex() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panel.withValues(alpha: 0.88), + border: Border.all(color: state.tokens.border), + borderRadius: BorderRadius.circular(5), + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (node.props['label'] != null) + Text( + node.props['label'].toString().toUpperCase(), + style: TextStyle( + color: state.tokens.accent, + fontFamily: 'EveParity', + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + Text( + node.props['source']?.toString() ?? '', + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 18, + ), + ), + ], + ), + ), + ); + } + + Widget _dialogue() { + final speaker = node.props['speaker']?.toString() ?? ''; + final text = node.props['text']?.toString() ?? ''; + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panel.withValues(alpha: 0.94), + border: Border.all(color: state.tokens.border), + borderRadius: BorderRadius.circular(8), + boxShadow: const [ + BoxShadow( + color: Color(0x8A000000), + blurRadius: 24, + offset: Offset(0, 10), + ), + ], + ), + child: Padding( + padding: const EdgeInsets.all(18), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + speaker, + style: TextStyle( + color: state.tokens.accent, + fontFamily: 'EveParity', + fontSize: 15, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 8), + Text( + text, + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 20, + ), + ), + ], + ), + ), + ); + } + + Widget _actions() { + return Row( + children: [ + for (var index = 0; index < node.children.length; index += 1) ...[ + Expanded( + child: EveNodeView( + state: state, + node: node.children[index], + commandSink: commandSink, + ), + ), + if (index != node.children.length - 1) const SizedBox(width: 10), + ], + ], + ); + } + + Widget _button() { + final label = + node.props['label']?.toString() ?? node.props['text']?.toString() ?? ''; + final command = resolveComponentCommandId(node.props, node); + final body = DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.accent.withValues(alpha: 0.17), + border: Border.all(color: state.tokens.accent.withValues(alpha: 0.64)), + borderRadius: BorderRadius.circular(6), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), + child: Text( + label, + textAlign: TextAlign.center, + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 14, + fontWeight: FontWeight.w700, + ), + ), + ), + ); + if (command.isEmpty || commandSink == null) return body; + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + commandSink?.call(createEveCommandIntent(state, node, command), node), + child: body, + ); + } + + Widget _imagePreview() { + final label = node.props['label']?.toString() ?? 'Image'; + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 1, + child: DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelInset, + border: Border.all(color: state.tokens.border, width: 2), + ), + child: Stack( + children: [ + Positioned.fill( + child: CustomPaint( + painter: EveGridPainter( + color: state.tokens.accent.withValues(alpha: 0.10), + ), + ), + ), + Center( + child: Padding( + padding: const EdgeInsets.all(10), + child: Text( + label, + textAlign: TextAlign.center, + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ), + ), + ], + ), + ), + ), + const SizedBox(height: 8), + Text( + label, + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ], + ); + } + + Widget _canvasPlaceholder({required bool editor}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + node.props['label']?.toString() ?? 'Canvas', + style: TextStyle( + color: state.tokens.accent, + fontFamily: 'EveParity', + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 8), + SizedBox( + height: editor ? 280 : 170, + width: double.infinity, + child: DecoratedBox( + decoration: BoxDecoration( + color: editor ? const Color(0xFF142033) : state.tokens.panelInset, + border: Border.all(color: state.tokens.border, width: 2), + ), + child: Stack( + children: [ + Positioned.fill( + child: CustomPaint( + painter: EveGridPainter( + color: state.tokens.accent.withValues( + alpha: editor ? 0.18 : 0.08, + ), + ), + ), + ), + Center( + child: Text( + node.props['state']?.toString() ?? '', + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ), + ], + ), + ), + ), + ], + ); + } + + Widget _statusStage() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelAlt, + border: Border.all(color: state.tokens.border, width: 2), + borderRadius: BorderRadius.circular(4), + ), + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + node.props['label']?.toString() ?? 'Status', + style: TextStyle( + color: state.tokens.accent, + fontFamily: 'EveParity', + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 6), + Text( + node.props['stage']?.toString() ?? '', + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 15, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 4), + Text( + node.props['detail']?.toString() ?? '', + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ], + ), + ), + ); + } + + Widget _field() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + node.props['label']?.toString() ?? '', + style: TextStyle( + color: state.tokens.accent, + fontFamily: 'EveParity', + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 4), + DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelInset, + border: Border.all(color: state.tokens.border), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + child: Text( + node.props['value']?.toString() ?? '', + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 13, + ), + ), + ), + ), + ], + ); + } + + Widget _toggle() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelInset, + border: Border.all(color: state.tokens.border), + ), + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + '${node.props['label'] ?? 'Toggle'}: ${node.props['value'] == true ? 'on' : 'off'}', + style: TextStyle( + color: state.tokens.text, + fontFamily: 'EveParity', + fontSize: 12, + ), + ), + ), + ); + } + + Widget _swatch() { + return Container( + width: 38, + height: 38, + decoration: BoxDecoration( + color: _parseColor(node.props['value']) ?? state.tokens.text, + border: Border.all(color: state.tokens.accent, width: 2), + ), + ); + } + + Widget _surface() { + final padding = _number(node.layout['padding'] ?? node.props['padding'], 0); + final direction = node.layout['direction']?.toString(); + return Padding( + padding: EdgeInsets.all(padding), + child: LayoutBuilder( + builder: (context, constraints) { + if (direction == 'vertical') { + return _children(axis: Axis.vertical, maxWidth: 1280); + } + if (direction == 'horizontal') { + return _children(axis: Axis.horizontal, maxWidth: 1280); + } + if (constraints.maxWidth >= 900 && node.children.length > 1) { + return _children(axis: Axis.horizontal, maxWidth: 1280); + } + return _children(axis: Axis.vertical, maxWidth: 1180); + }, + ), + ); + } + + Widget _partition() { + final split = (node.props['split'] ?? _layoutDirection()).toString(); + final gap = _number(node.props['gap'] ?? node.layout['gap'], 0); + final padding = _number(node.props['padding'] ?? node.layout['padding'], 0); + final body = _children( + axis: split == 'x' ? Axis.horizontal : Axis.vertical, + ); + return Padding( + padding: EdgeInsets.all(padding), + child: split == 'x' + ? LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth < 520 && + node.props['role'] == 'inspector.row') { + return _column(gap); + } + return body; + }, + ) + : body, + ); + } + + Widget _pane() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panel, + border: Border.all(color: state.tokens.border), + borderRadius: BorderRadius.circular(6), + boxShadow: const [ + BoxShadow( + color: Color(0x59000000), + blurRadius: 26, + offset: Offset(0, 12), + ), + ], + ), + child: Padding( + padding: EdgeInsets.all(_number(node.props['padding'], 12)), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (node.props['title'] != null) + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: Text( + node.props['title'].toString().toUpperCase(), + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + ), + ..._spacedChildren(Axis.vertical, _number(node.props['gap'], 0)), + ], + ), + ), + ); + } + + Widget _card() { + return DecoratedBox( + decoration: BoxDecoration( + color: state.tokens.panelAlt, + border: Border.all(color: const Color(0x10FFFFFF)), + borderRadius: BorderRadius.circular(4), + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (node.props['title'] != null) + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Text( + node.props['title'].toString(), + style: TextStyle( + color: state.tokens.muted, + fontFamily: 'EveParity', + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + ), + _children(axis: Axis.vertical), + ], + ), + ), + ); + } + + Widget _text() { + final bind = node.props['bind']?.toString(); + final value = bind == null ? node.props['text'] : state.values[bind]; + final text = + '${node.props['prefix'] ?? ''}${value ?? ''}${node.props['suffix'] ?? ''}'; + return Text( + node.kind == 'label' ? text.toUpperCase() : text, + style: TextStyle( + color: node.kind == 'label' ? state.tokens.accent : state.tokens.text, + fontFamily: 'EveParity', + fontSize: node.kind == 'text.title' ? 18 : 13, + fontWeight: node.kind == 'label' ? FontWeight.w700 : FontWeight.w500, + ), + ); + } + + Widget _fallback() { + return node.children.isEmpty + ? const SizedBox.shrink() + : _children(axis: Axis.vertical); + } + + Widget _children({required Axis axis, double? maxWidth}) { + final gap = _number(node.props['gap'], 0); + final childWidgets = _spacedChildren(axis, gap); + final content = axis == Axis.horizontal + ? Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: childWidgets, + ) + : Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: childWidgets, + ); + final constrained = maxWidth == null + ? content + : Align( + alignment: Alignment.topLeft, + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: maxWidth), + child: content, + ), + ); + return constrained; + } + + Widget _column(double gap) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: _spacedChildren(Axis.vertical, gap), + ); + } + + List _spacedChildren(Axis axis, double gap) { + final widgets = []; + for (var index = 0; index < node.children.length; index += 1) { + final child = node.children[index]; + Widget view = EveNodeView( + state: state, + node: child, + commandSink: commandSink, + ); + if (axis == Axis.horizontal && _isFlexible(child)) { + view = Expanded(child: view); + } + widgets.add(view); + if (gap > 0 && index != node.children.length - 1) { + widgets.add( + axis == Axis.horizontal + ? SizedBox(width: gap) + : SizedBox(height: gap), + ); + } + } + return widgets; + } + + bool _isFlexible(EveNode child) { + final size = child.props['size']?.toString(); + return size == null || size.endsWith('fr'); + } + + String _layoutDirection() { + final direction = node.layout['direction']?.toString(); + if (direction == 'horizontal') { + return 'x'; + } + return 'y'; + } + + Map _map(Object? value) => + value is Map ? value : const {}; + + Color? _parseColor(Object? value) { + if (value is! String || !value.startsWith('#')) return null; + final body = value.substring(1); + if (body.length == 8) return Color(int.parse(body, radix: 16)); + if (body.length == 6) return Color(int.parse('ff$body', radix: 16)); + return null; + } +} + +class EveGridPainter extends CustomPainter { + EveGridPainter({required this.color}); + + final Color color; + + @override + void paint(Canvas canvas, Size size) { + final paint = Paint()..color = color; + for (var x = 0.0; x < size.width; x += 32) { + canvas.drawLine(Offset(x, 0), Offset(x, size.height), paint); + } + for (var y = 0.0; y < size.height; y += 32) { + canvas.drawLine(Offset(0, y), Offset(size.width, y), paint); + } + } + + @override + bool shouldRepaint(EveGridPainter oldDelegate) => oldDelegate.color != color; +} + +class EveNornPainter extends CustomPainter { + EveNornPainter({ + required this.nodes, + required this.edges, + required this.tokens, + }); + + final List nodes; + final List edges; + final EveTokens tokens; + + @override + void paint(Canvas canvas, Size size) { + final nodeById = {}; + for (final raw in nodes) { + if (raw is! Map) continue; + final id = raw['id']?.toString(); + if (id == null) continue; + nodeById[id] = Offset( + _number(raw['x'], 0.5) * size.width, + _number(raw['y'], 0.5) * size.height, + ); + } + final edgePaint = Paint() + ..color = tokens.muted.withValues(alpha: 0.5) + ..strokeWidth = 2; + for (final raw in edges) { + if (raw is! Map) continue; + final source = nodeById[raw['source']?.toString()]; + final target = nodeById[raw['target']?.toString()]; + if (source != null && target != null) { + canvas.drawLine(source, target, edgePaint); + } + } + for (final raw in nodes) { + if (raw is! Map) continue; + final id = raw['id']?.toString(); + final center = id == null ? null : nodeById[id]; + if (center == null) continue; + final current = raw['current'] == true; + canvas.drawCircle( + center, + current ? 24 : 20, + Paint()..color = current ? tokens.accent : tokens.panelAlt, + ); + canvas.drawCircle( + center, + current ? 24 : 20, + Paint() + ..color = current ? tokens.accent : tokens.border + ..style = PaintingStyle.stroke + ..strokeWidth = 2, + ); + final label = raw['label']?.toString() ?? id; + final paragraph = TextPainter( + text: TextSpan( + text: label, + style: TextStyle( + color: tokens.text, + fontFamily: 'EveParity', + fontSize: 13, + fontWeight: FontWeight.w700, + ), + ), + textDirection: TextDirection.ltr, + )..layout(maxWidth: 100); + paragraph.paint(canvas, center + Offset(-paragraph.width / 2, 30)); + } + } + + @override + bool shouldRepaint(EveNornPainter oldDelegate) => + oldDelegate.nodes != nodes || oldDelegate.edges != edges; +} + +class EveSlider extends StatelessWidget { + const EveSlider({required this.state, required this.node, super.key}); + + final EveSurfaceState state; + final EveNode node; + + @override + Widget build(BuildContext context) { + final bind = node.props['bind']?.toString(); + final min = _number(node.props['min'], 0); + final max = _number(node.props['max'], 1); + final rawValue = bind == null ? node.props['value'] : state.values[bind]; + final value = _number(rawValue, min).clamp(min, max); + final percent = max == min + ? 0.0 + : ((value - min) / (max - min)).clamp(0.0, 1.0); + final skin = state.controlSkins[node.props['skin']?.toString()] ?? const []; + final box = + skin.where((part) => part.kind == 'control.box').firstOrNull?.props ?? + const {}; + return CustomPaint( + painter: EveSliderPainter( + value: percent, + tokens: state.tokens, + skin: skin, + ), + child: SizedBox( + height: _number(box['height'], 22).clamp(18, 36), + width: double.infinity, + ), + ); + } +} + +class EveSliderPainter extends CustomPainter { + EveSliderPainter({ + required this.value, + required this.tokens, + required this.skin, + }); + + final double value; + final EveTokens tokens; + final List skin; + + @override + void paint(Canvas canvas, Size size) { + final centerY = size.height / 2; + final trackHeight = _partSize('track', 1, 6); + final thumbSize = _partSize('thumb', 0, 12); + final track = RRect.fromRectAndRadius( + Rect.fromLTWH(0, centerY - trackHeight / 2, size.width, trackHeight), + Radius.circular(_partRadius('track', 2)), + ); + final fill = RRect.fromRectAndRadius( + Rect.fromLTWH( + 0, + centerY - trackHeight / 2, + size.width * value, + trackHeight, + ), + Radius.circular(_partRadius('fill', 2)), + ); + + canvas.drawRRect(track, Paint()..color = tokens.panelInset); + canvas.drawRRect(fill, Paint()..color = tokens.accent); + final thumbCenter = Offset(size.width * value, centerY); + canvas.drawCircle( + thumbCenter, + thumbSize / 2 + _partBleed('thumb', 0), + Paint() + ..color = tokens.accent.withValues(alpha: 0.35) + ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 5), + ); + canvas.drawCircle( + thumbCenter, + thumbSize / 2, + Paint()..color = tokens.accent, + ); + } + + double _partSize(String name, int index, double fallback) { + final part = _part(name); + final size = part?['size']; + if (size is List && size.length > index) { + return _number(size[index], fallback); + } + return fallback; + } + + double _partRadius(String name, double fallback) => + _number(_part(name)?['radius'], fallback); + double _partBleed(String name, double fallback) => + _number(_part(name)?['bleed'], fallback); + + Map? _part(String name) { + for (final node in skin) { + if (node.kind == 'control.part' && node.props['name'] == name) { + return node.props; + } + } + return null; + } + + @override + bool shouldRepaint(covariant EveSliderPainter oldDelegate) { + return oldDelegate.value != value || + oldDelegate.tokens != tokens || + oldDelegate.skin != skin; + } +} + +double _number(Object? value, double fallback) { + if (value is num) return value.toDouble(); + if (value is String) return double.tryParse(value) ?? fallback; + return fallback; +} diff --git a/linux/.gitignore b/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 0000000..666ba2a --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "eve_parity") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.eve_parity") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/linux/runner/main.cc b/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/runner/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc new file mode 100644 index 0000000..511b970 --- /dev/null +++ b/linux/runner/my_application.cc @@ -0,0 +1,148 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView* view) { + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "eve_parity"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "eve_parity"); + } + + gtk_window_set_default_size(window, 1280, 720); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments( + project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 + // for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), + self); + gtk_widget_realize(GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, + gchar*** arguments, + int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = + my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, "flags", + G_APPLICATION_NON_UNIQUE, nullptr)); +} diff --git a/linux/runner/my_application.h b/linux/runner/my_application.h new file mode 100644 index 0000000..db16367 --- /dev/null +++ b/linux/runner/my_application.h @@ -0,0 +1,21 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, + my_application, + MY, + APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..2450bf3 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,205 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + url: "https://pub.dev" + source: hosted + version: "1.18.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" + url: "https://pub.dev" + source: hosted + version: "15.2.0" +sdks: + dart: ">=3.12.1 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..a2fe3ea --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,93 @@ +name: eve_parity +description: "Eve Flutter parity renderer and screenshot smoke target." +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.12.1 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + assets: + - assets/current-surface.json + + fonts: + - family: EveParity + fonts: + - asset: assets/fonts/Roboto-Regular.ttf + - asset: assets/fonts/Roboto-Bold.ttf + weight: 700 + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/scripts/capture-android-flutter-parity.ps1 b/scripts/capture-android-flutter-parity.ps1 new file mode 100644 index 0000000..ecbd41b --- /dev/null +++ b/scripts/capture-android-flutter-parity.ps1 @@ -0,0 +1,80 @@ +param( + [string] $FixtureId = "cultui-inspector", + [Parameter(Mandatory = $true)] + [string] $SurfacePath, + [string] $FlutterExe = "E:\Projects\Eve\tools\deps\flutter\bin\flutter.bat", + [string] $OutputPath = "artifacts\parity\android-flutter-cultui-inspector.png", + [int] $Width = 0, + [int] $Height = 0, + [ValidateSet("portrait", "landscape", "natural")] + [string] $Orientation = "natural", + [int] $LaunchDelaySeconds = 4, + [switch] $SkipBuild, + [switch] $ForceInstall +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$flutterRoot = $projectRoot +$flutter = $FlutterExe +$flutterSdkRoot = Split-Path -Parent (Split-Path -Parent $flutter) +$assetPath = Join-Path $flutterRoot "assets\current-surface.json" +$fontDir = Join-Path $flutterRoot "assets\fonts" +$apkPath = Join-Path $flutterRoot "build\app\outputs\flutter-apk\app-debug.apk" + +if (-not (Test-Path $flutter)) { + throw "Flutter is not installed at $flutter" +} + +if (-not $SkipBuild) { + New-Item -ItemType Directory -Force (Split-Path -Parent $assetPath) | Out-Null + New-Item -ItemType Directory -Force $fontDir | Out-Null + Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-regular.ttf") -Destination (Join-Path $fontDir "Roboto-Regular.ttf") -Force + Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-bold.ttf") -Destination (Join-Path $fontDir "Roboto-Bold.ttf") -Force + Copy-Item -LiteralPath $SurfacePath -Destination $assetPath -Force + + Push-Location $flutterRoot + try { + & $flutter pub get + if ($LASTEXITCODE -ne 0) { + throw "Flutter pub get failed with exit code $LASTEXITCODE" + } + & $flutter build apk --debug "--dart-define=EVE_PARITY_FIXTURE=$FixtureId" + if ($LASTEXITCODE -ne 0) { + throw "Flutter Android APK build failed with exit code $LASTEXITCODE" + } + } finally { + Pop-Location + } +} + +if (-not (Test-Path $apkPath)) { + throw "Flutter Android APK not found: $apkPath" +} + +$captureArgs = @( + "-ExecutionPolicy", "Bypass", + "-File", ".\scripts\capture-android-screenshot.ps1", + "-OutputPath", $OutputPath, + "-ApkPath", $apkPath, + "-PackageName", "com.example.eve_parity", + "-ActivityName", ".MainActivity", + "-LaunchDelaySeconds", $LaunchDelaySeconds, + "-Orientation", $Orientation +) + +if ($Width -gt 0) { + $captureArgs += @("-Width", $Width) +} +if ($Height -gt 0) { + $captureArgs += @("-Height", $Height) +} +if ($ForceInstall -or -not $SkipBuild) { + $captureArgs += "-ForceInstall" +} + +powershell @captureArgs +if ($LASTEXITCODE -ne 0) { + throw "Android Flutter screenshot failed with exit code $LASTEXITCODE" +} diff --git a/scripts/capture-android-screenshot.ps1 b/scripts/capture-android-screenshot.ps1 new file mode 100644 index 0000000..c77a0f7 --- /dev/null +++ b/scripts/capture-android-screenshot.ps1 @@ -0,0 +1,102 @@ +param( + [string] $OutputPath = "artifacts\parity\android-periwinkle.png", + [string] $ApkPath = "artifacts\android\eve-debug.apk", + [string] $PackageName = "org.gamecult.eve", + [string] $ActivityName = ".MainActivity", + [int] $LaunchDelaySeconds = 3, + [int] $Width = 0, + [int] $Height = 0, + [ValidateSet("portrait", "landscape", "natural")] + [string] $Orientation = "natural", + [switch] $UseFixture, + [switch] $ForceInstall +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath } +$absoluteApk = if ([System.IO.Path]::IsPathRooted($ApkPath)) { $ApkPath } else { Join-Path $projectRoot $ApkPath } +New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null + +$devices = adb devices | Select-String -Pattern "device$" +if (-not $devices) { + throw "No adb device is connected for Android parity capture." +} + +if (-not (Test-Path $absoluteApk)) { + throw "Android APK not found: $absoluteApk" +} + +$overrideSize = $Width -gt 0 -and $Height -gt 0 +$overrideRotation = $Orientation -ne "natural" +$previousWindowUserRotation = $null +$previousIgnoreOrientationRequest = $null +try { + if ($overrideRotation) { + $previousWindowUserRotation = (adb shell cmd window user-rotation).Trim() + $previousIgnoreOrientationRequest = (adb shell cmd window get-ignore-orientation-request).Trim() + $rotation = if ($Orientation -eq "landscape") { "1" } else { "0" } + adb shell cmd window set-ignore-orientation-request true | Out-Host + adb shell cmd window user-rotation lock $rotation | Out-Host + } + + if ($overrideSize -or $overrideRotation) { + adb shell am force-stop $PackageName | Out-Host + } + + if ($overrideSize) { + $wmWidth = if ($Orientation -eq "landscape") { $Height } else { $Width } + $wmHeight = if ($Orientation -eq "landscape") { $Width } else { $Height } + adb shell wm size "${wmWidth}x${wmHeight}" | Out-Host + if ($LASTEXITCODE -ne 0) { + throw "adb wm size failed with exit code $LASTEXITCODE" + } + } + + $installed = adb shell pm path $PackageName + if ($ForceInstall -or -not $installed) { + adb install -r $absoluteApk | Out-Host + if ($LASTEXITCODE -ne 0) { + throw "adb install failed with exit code $LASTEXITCODE" + } + } + + $launchArgs = @("shell", "am", "start", "-n", "$PackageName/$ActivityName") + if ($UseFixture) { + $launchArgs += @("--ez", "org.gamecult.eve.PARITY_FIXTURE", "true") + } + adb @launchArgs | Out-Host + if ($LASTEXITCODE -ne 0) { + throw "adb launch failed with exit code $LASTEXITCODE" + } + + Start-Sleep -Seconds $LaunchDelaySeconds + + cmd /c "adb exec-out screencap -p > `"$absoluteOutput`"" + if ($LASTEXITCODE -ne 0) { + throw "adb screencap failed with exit code $LASTEXITCODE" + } +} finally { + if ($overrideSize) { + adb shell wm size reset | Out-Host + } + if ($overrideRotation) { + if ($previousWindowUserRotation -match "^free") { + adb shell cmd window user-rotation free | Out-Host + } elseif ($previousWindowUserRotation -match "^lock\s+(\d+)") { + adb shell cmd window user-rotation lock $Matches[1] | Out-Host + } + if ($previousIgnoreOrientationRequest -match "true") { + adb shell cmd window set-ignore-orientation-request true | Out-Host + } elseif ($previousIgnoreOrientationRequest -match "false") { + adb shell cmd window set-ignore-orientation-request false | Out-Host + } + } +} + +if (-not (Test-Path $absoluteOutput) -or (Get-Item $absoluteOutput).Length -le 0) { + throw "adb screencap did not produce a PNG: $absoluteOutput" +} + +Write-Host $absoluteOutput diff --git a/scripts/capture-flutter-parity.ps1 b/scripts/capture-flutter-parity.ps1 new file mode 100644 index 0000000..74b5739 --- /dev/null +++ b/scripts/capture-flutter-parity.ps1 @@ -0,0 +1,54 @@ +param( + [ValidateSet("windows", "linux")] + [string] $Target = "windows", + [ValidateSet("phone", "tablet", "desktop")] + [string] $ViewportId = "desktop", + [string] $FixtureId = "cultui-inspector", + [string] $OutputPath = "artifacts\parity\flutter-windows-cultui-inspector.png", + [Parameter(Mandatory = $true)] + [string] $SurfacePath, + [string] $FlutterExe = "E:\Projects\Eve\tools\deps\flutter\bin\flutter.bat" +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$flutterRoot = $projectRoot +$flutter = $FlutterExe +$flutterSdkRoot = Split-Path -Parent (Split-Path -Parent $flutter) +$assetPath = Join-Path $flutterRoot "assets\current-surface.json" +$fontDir = Join-Path $flutterRoot "assets\fonts" +$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath } +New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null +New-Item -ItemType Directory -Force (Split-Path -Parent $assetPath) | Out-Null +New-Item -ItemType Directory -Force $fontDir | Out-Null + +if (-not (Test-Path $flutter)) { + throw "Flutter is not installed at $flutter" +} + +if ($Target -eq "linux" -and $env:OS -like "Windows*") { + throw "Linux Flutter screenshot requires a Linux runner; this host is Windows." +} + +Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-regular.ttf") -Destination (Join-Path $fontDir "Roboto-Regular.ttf") -Force +Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-bold.ttf") -Destination (Join-Path $fontDir "Roboto-Bold.ttf") -Force +Copy-Item -LiteralPath $SurfacePath -Destination $assetPath -Force + +Push-Location $flutterRoot +try { + & $flutter test --update-goldens "--dart-define=EVE_PARITY_FIXTURE=$FixtureId" --plain-name $ViewportId + if ($LASTEXITCODE -ne 0) { + throw "Flutter golden smoke failed with exit code $LASTEXITCODE" + } +} finally { + Pop-Location +} + +$golden = Join-Path $flutterRoot "test\goldens\$FixtureId-$ViewportId.png" +if (-not (Test-Path $golden) -or (Get-Item $golden).Length -le 0) { + throw "Flutter golden did not produce a PNG: $golden" +} + +Copy-Item -LiteralPath $golden -Destination $absoluteOutput -Force +Write-Host $absoluteOutput diff --git a/scripts/capture-linux-flutter-parity.ps1 b/scripts/capture-linux-flutter-parity.ps1 new file mode 100644 index 0000000..f85a117 --- /dev/null +++ b/scripts/capture-linux-flutter-parity.ps1 @@ -0,0 +1,68 @@ +param( + [string] $SshTarget = "nightwing", + [ValidateSet("phone", "tablet", "desktop")] + [string] $ViewportId = "desktop", + [string] $FixtureId = "cultui-inspector", + [Parameter(Mandatory = $true)] + [string] $SurfacePath, + [string] $LocalFlutterRoot = "E:\Projects\Eve\tools\deps\flutter", + [string] $OutputPath = "artifacts\parity\linux-flutter-cultui-inspector.png", + [string] $RemoteRoot = "~/.local/share/gamecult/eve-parity-runner", + [string] $RemoteFlutter = "~/.local/share/gamecult/flutter/bin/flutter" +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$sourceRoot = $projectRoot +$assetPath = Join-Path $sourceRoot "assets\current-surface.json" +$fontDir = Join-Path $sourceRoot "assets\fonts" +$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath } +$archivePath = Join-Path ([System.IO.Path]::GetTempPath()) "eve-parity-linux-$([guid]::NewGuid()).tar" +New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null +New-Item -ItemType Directory -Force (Split-Path -Parent $assetPath) | Out-Null +New-Item -ItemType Directory -Force $fontDir | Out-Null + +if (-not (Test-Path $sourceRoot)) { + throw "Flutter parity source not found: $sourceRoot" +} + +Copy-Item -LiteralPath $SurfacePath -Destination $assetPath -Force +Copy-Item -LiteralPath (Join-Path $LocalFlutterRoot "bin\cache\artifacts\material_fonts\roboto-regular.ttf") -Destination (Join-Path $fontDir "Roboto-Regular.ttf") -Force +Copy-Item -LiteralPath (Join-Path $LocalFlutterRoot "bin\cache\artifacts\material_fonts\roboto-bold.ttf") -Destination (Join-Path $fontDir "Roboto-Bold.ttf") -Force + +try { + Push-Location $sourceRoot + try { + tar --exclude .dart_tool --exclude build -cf $archivePath . + if ($LASTEXITCODE -ne 0) { + throw "tar failed with exit code $LASTEXITCODE" + } + } finally { + Pop-Location + } + + ssh $SshTarget "rm -rf $RemoteRoot && mkdir -p $RemoteRoot" + scp $archivePath "${SshTarget}:/tmp/eve-parity-linux.tar" | Out-Host + ssh $SshTarget "tar -xf /tmp/eve-parity-linux.tar -C $RemoteRoot && rm /tmp/eve-parity-linux.tar" + ssh $SshTarget "cd $RemoteRoot && $RemoteFlutter test --update-goldens --dart-define=EVE_PARITY_FIXTURE=$FixtureId --plain-name $ViewportId" | Out-Host + if ($LASTEXITCODE -ne 0) { + throw "Nightwing Flutter golden smoke failed with exit code $LASTEXITCODE" + } + + $remoteGolden = "$RemoteRoot/test/goldens/$FixtureId-$ViewportId.png" + scp "${SshTarget}:$remoteGolden" $absoluteOutput | Out-Host + if ($LASTEXITCODE -ne 0) { + throw "scp from Nightwing failed with exit code $LASTEXITCODE" + } +} finally { + if (Test-Path $archivePath) { + Remove-Item -LiteralPath $archivePath -Force + } +} + +if (-not (Test-Path $absoluteOutput) -or (Get-Item $absoluteOutput).Length -le 0) { + throw "Nightwing Flutter capture did not produce a PNG: $absoluteOutput" +} + +Write-Host $absoluteOutput diff --git a/scripts/install-nightwing-flutter-sdk.ps1 b/scripts/install-nightwing-flutter-sdk.ps1 new file mode 100644 index 0000000..149198d --- /dev/null +++ b/scripts/install-nightwing-flutter-sdk.ps1 @@ -0,0 +1,17 @@ +param( + [string] $SshTarget = "nightwing" +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$localScript = Join-Path $projectRoot "scripts\install-nightwing-flutter-sdk.sh" +$remoteScript = "~/.local/bin/install-eve-flutter-sdk.sh" +$stateDir = "~/.local/state/gamecult" +$pidPath = "$stateDir/eve-linux-flutter-install.pid" +$logPath = "$stateDir/eve-linux-flutter-install.log" + +ssh $SshTarget "mkdir -p ~/.local/bin ~/.local/state/gamecult" +scp $localScript "${SshTarget}:$remoteScript" | Out-Host +ssh $SshTarget "chmod +x $remoteScript" +ssh $SshTarget "nohup $remoteScript >/dev/null 2>&1 & echo `$! > $pidPath && echo $pidPath && echo $logPath" diff --git a/scripts/install-nightwing-flutter-sdk.sh b/scripts/install-nightwing-flutter-sdk.sh new file mode 100644 index 0000000..e31c119 --- /dev/null +++ b/scripts/install-nightwing-flutter-sdk.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -euo pipefail + +state_dir="$HOME/.local/state/gamecult" +sdk_dir="$HOME/.local/share/gamecult/flutter" +log_path="$state_dir/eve-linux-flutter-install.log" +status_path="$state_dir/eve-linux-flutter-install.status" + +export CI=true +export FLUTTER_SUPPRESS_ANALYTICS=true +export NO_COLOR=1 + +mkdir -p "$state_dir" "$(dirname "$sdk_dir")" + +{ + date -u '+started %Y-%m-%dT%H:%M:%SZ' + if [ ! -x "$sdk_dir/bin/flutter" ]; then + rm -rf "$sdk_dir.tmp" + git clone --depth 1 -b stable https://github.com/flutter/flutter.git "$sdk_dir.tmp" + rm -rf "$sdk_dir" + mv "$sdk_dir.tmp" "$sdk_dir" + else + git -C "$sdk_dir" fetch --depth 1 origin stable + git -C "$sdk_dir" checkout stable + git -C "$sdk_dir" pull --ff-only origin stable + fi + + "$sdk_dir/bin/flutter" --disable-analytics + "$sdk_dir/bin/flutter" --version + "$sdk_dir/bin/flutter" precache --linux + date -u '+completed %Y-%m-%dT%H:%M:%SZ' + echo complete > "$status_path" +} >> "$log_path" 2>&1 diff --git a/scripts/run-eveflutter-conformance-consumer-smoke.ps1 b/scripts/run-eveflutter-conformance-consumer-smoke.ps1 new file mode 100644 index 0000000..00c03dc --- /dev/null +++ b/scripts/run-eveflutter-conformance-consumer-smoke.ps1 @@ -0,0 +1,57 @@ +param( + [Parameter(Mandatory = $true)] + [string] $ExportDirectory, + [Parameter(Mandatory = $true)] + [string] $ConsumerScript, + [string] $ConsumerDirectory = "artifacts\conformance-consumer-smoke" +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$sourceExport = if ([System.IO.Path]::IsPathRooted($ExportDirectory)) { + $ExportDirectory +} else { + Join-Path $projectRoot $ExportDirectory +} +$consumerRoot = if ([System.IO.Path]::IsPathRooted($ConsumerDirectory)) { + $ConsumerDirectory +} else { + Join-Path $projectRoot $ConsumerDirectory +} +$consumerExport = Join-Path $consumerRoot "export" + +if (-not (Test-Path $sourceExport)) { + throw "Conformance export not found: $sourceExport" +} +if (-not (Test-Path $ConsumerScript -PathType Leaf)) { + throw "Conformance consumer script not found: $ConsumerScript" +} + +if (Test-Path $consumerExport) { + Remove-Item -LiteralPath $consumerExport -Recurse -Force +} +New-Item -ItemType Directory -Force -Path $consumerRoot | Out-Null +Copy-Item -LiteralPath $sourceExport -Destination $consumerExport -Recurse + +Push-Location $projectRoot +try { + node $ConsumerScript $consumerExport ` + --expect-pack runtime ` + --expect-pack provider ` + --expect-fixture sai-vn ` + --expect-provider gamecult.home.vn ` + --expect-runtime windows-flutter ` + --expect-runtime linux-flutter ` + --expect-runtime android-flutter ` + --expect-runtime-status windows-flutter:active ` + --expect-runtime-feature windows-flutter:embeddedDocuments ` + --expect-runtime-command-schema windows-flutter:gamecult.eve.command_invocation.v1 ` + --expect-runtime-capture-status windows-flutter:golden ` + --expect-split-target EveFlutter + if ($LASTEXITCODE -ne 0) { + throw "EveFlutter conformance consumer smoke failed with exit code $LASTEXITCODE" + } +} finally { + Pop-Location +} diff --git a/scripts/run-eveflutter-lifecycle-smoke.ps1 b/scripts/run-eveflutter-lifecycle-smoke.ps1 new file mode 100644 index 0000000..d194e48 --- /dev/null +++ b/scripts/run-eveflutter-lifecycle-smoke.ps1 @@ -0,0 +1,86 @@ +param( + [string] $LifecyclePath = "eveflutter-lifecycle.json", + [string] $DartExe = "E:\Projects\Eve\tools\deps\flutter\bin\cache\dart-sdk\bin\dart.exe", + [string] $ConformanceExport = "", + [string] $ConformanceConsumerScript = "", + [switch] $SkipAnalyze +) + +$ErrorActionPreference = "Stop" + +$projectRoot = Split-Path -Parent $PSScriptRoot +$absoluteLifecyclePath = if ([System.IO.Path]::IsPathRooted($LifecyclePath)) { + $LifecyclePath +} else { + Join-Path $projectRoot $LifecyclePath +} + +if (-not (Test-Path $absoluteLifecyclePath)) { + throw "EveFlutter lifecycle document not found: $absoluteLifecyclePath" +} + +$lifecycle = Get-Content -LiteralPath $absoluteLifecyclePath -Raw | ConvertFrom-Json + +if ($lifecycle.schema -ne "gamecult.eve.runtime_lifecycle.v1") { + throw "Unexpected lifecycle schema: $($lifecycle.schema)" +} +if ($lifecycle.splitTarget -ne "EveFlutter") { + throw "Unexpected split target: $($lifecycle.splitTarget)" +} +if ($lifecycle.ownerRepo -ne "EveFlutter") { + throw "Unexpected owner repo: $($lifecycle.ownerRepo)" +} +if ($lifecycle.currentHostRepo -ne "EveFlutter") { + throw "Unexpected current host repo: $($lifecycle.currentHostRepo)" +} + +$expectedRuntimes = @("windows-flutter", "linux-flutter", "android-flutter") +foreach ($runtimeId in $expectedRuntimes) { + if (-not ($lifecycle.runtimes -contains $runtimeId)) { + throw "EveFlutter lifecycle missing runtime: $runtimeId" + } +} + +foreach ($stage in @("release", "test", "capture")) { + $stageDocument = $lifecycle.$stage + if ($null -eq $stageDocument) { + throw "EveFlutter lifecycle missing stage: $stage" + } + if ($stageDocument.ownerRepo -ne "EveFlutter") { + throw "EveFlutter lifecycle stage $stage has unexpected owner: $($stageDocument.ownerRepo)" + } + if (-not $stageDocument.status) { + throw "EveFlutter lifecycle stage $stage missing status" + } + foreach ($evidencePath in $stageDocument.evidencePaths) { + $absoluteEvidencePath = Join-Path $projectRoot $evidencePath + if (-not (Test-Path $absoluteEvidencePath)) { + throw "EveFlutter lifecycle stage $stage missing evidence path: $evidencePath" + } + } +} + +if (-not $SkipAnalyze) { + if (-not (Test-Path $DartExe)) { + throw "Dart SDK not found: $DartExe" + } + + Push-Location $projectRoot + try { + & $DartExe analyze lib test + if ($LASTEXITCODE -ne 0) { + throw "EveFlutter Dart analyzer failed with exit code $LASTEXITCODE" + } + } finally { + Pop-Location + } +} + +if ($ConformanceExport -and $ConformanceConsumerScript) { + & (Join-Path $projectRoot "scripts\run-eveflutter-conformance-consumer-smoke.ps1") -ExportDirectory $ConformanceExport -ConsumerScript $ConformanceConsumerScript + if ($LASTEXITCODE -ne 0) { + throw "EveFlutter conformance consumer smoke failed with exit code $LASTEXITCODE" + } +} + +Write-Host "EveFlutter lifecycle smoke passed: $absoluteLifecyclePath" diff --git a/test/goldens/cultui-inspector-desktop.png b/test/goldens/cultui-inspector-desktop.png new file mode 100644 index 0000000..4db15be Binary files /dev/null and b/test/goldens/cultui-inspector-desktop.png differ diff --git a/test/goldens/cultui-inspector-phone.png b/test/goldens/cultui-inspector-phone.png new file mode 100644 index 0000000..0a3455f Binary files /dev/null and b/test/goldens/cultui-inspector-phone.png differ diff --git a/test/goldens/cultui-inspector-tablet.png b/test/goldens/cultui-inspector-tablet.png new file mode 100644 index 0000000..fee1624 Binary files /dev/null and b/test/goldens/cultui-inspector-tablet.png differ diff --git a/test/goldens/gamecult.eve.embedded-demo-phone.png b/test/goldens/gamecult.eve.embedded-demo-phone.png new file mode 100644 index 0000000..dd430f5 Binary files /dev/null and b/test/goldens/gamecult.eve.embedded-demo-phone.png differ diff --git a/test/parity_smoke_test.dart b/test/parity_smoke_test.dart new file mode 100644 index 0000000..192b88f --- /dev/null +++ b/test/parity_smoke_test.dart @@ -0,0 +1,277 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:eve_parity/main.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + late EveSurfaceState goldenState; + + setUpAll(() async { + final regular = FontLoader('EveParity') + ..addFont(rootBundle.load('assets/fonts/Roboto-Regular.ttf')) + ..addFont(rootBundle.load('assets/fonts/Roboto-Bold.ttf')); + await regular.load(); + goldenState = EveSurfaceState.fromJson( + jsonDecode(File('assets/current-surface.json').readAsStringSync()) + as Map, + ); + }); + + for (final viewport in _viewports) { + testWidgets('renders selected Eve parity fixture at ${viewport.id}', ( + tester, + ) async { + await tester.binding.setSurfaceSize( + Size(viewport.width, viewport.height), + ); + addTearDown(() => tester.binding.setSurfaceSize(null)); + await tester.pumpWidget( + MaterialApp(home: EveSurfaceView(state: goldenState)), + ); + await tester.pump(const Duration(milliseconds: 100)); + await tester.pumpAndSettle(); + await tester.pumpAndSettle(); + await tester.runAsync(() async { + await Future.delayed(const Duration(milliseconds: 250)); + }); + await tester.pumpAndSettle(); + expect(find.byType(EveSurfaceView), findsOneWidget); + if (fixtureId == 'cultui-inspector') { + expect(find.text('AETHERIC FIELD TESTER'), findsOneWidget); + expect(find.text('FOV'), findsOneWidget); + expect(find.text('THROTTLE DECAY'), findsOneWidget); + expect(find.text('FLOW SPEED'), findsOneWidget); + } + + await expectLater( + find.byType(EveSurfaceView), + matchesGoldenFile('goldens/$fixtureId-${viewport.id}.png'), + ); + }); + } + + test('parses embedded document slots for CultUI nested surfaces', () { + final node = EveNode.fromJson(const { + 'id': 'test.slot', + 'kind': 'surface.slot', + 'props': {'presentationKind': 'inventory.dropdown'}, + 'embeddedDocuments': [ + { + 'slotId': 'inventory.dropdown', + 'documentId': 'cultmesh://test/dropdown', + 'schemaId': 'gamecult.eve.surface.v1', + 'presentationKind': 'inventory.dropdown', + }, + ], + }); + + expect(node.embeddedDocuments, hasLength(1)); + expect(node.embeddedDocuments.single.slotId, 'inventory.dropdown'); + expect( + node.embeddedDocuments.single.documentId, + 'cultmesh://test/dropdown', + ); + }); + + test('embedded_surface_fixture_contract', () { + const json = { + 'schema': 'gamecult.eve.surface.v1', + 'surface': { + 'root': { + 'id': 'root', + 'kind': 'surface.root', + 'children': [ + { + 'id': 'slot', + 'kind': 'surface.slot', + 'embeddedDocuments': [ + { + 'slotId': 'inventory.dropdown', + 'documentId': 'cultmesh://test/dropdown', + 'schemaId': 'gamecult.eve.surface.v1', + 'presentationKind': 'inventory.dropdown', + }, + ], + }, + ], + }, + }, + }; + final surface = json['surface'] as Map; + final root = EveNode.fromJson(surface['root'] as Map); + final slot = root.children.singleWhere( + (node) => node.kind == 'surface.slot', + ); + + expect(json['schema'], 'gamecult.eve.surface.v1'); + expect(slot.embeddedDocuments, hasLength(1)); + expect(slot.embeddedDocuments.single.slotId, 'inventory.dropdown'); + expect(slot.embeddedDocuments.single.schemaId, 'gamecult.eve.surface.v1'); + expect( + slot.embeddedDocuments.single.presentationKind, + 'inventory.dropdown', + ); + }); + + testWidgets('emits a provider-routed Eve command intent', (tester) async { + final state = EveSurfaceState.fromJson(const { + 'schema': 'gamecult.eve.surface.v1', + 'providerId': 'world.example', + 'surfaceId': 'world.example.surface', + 'surface': { + 'id': 'world.example.surface', + 'root': { + 'id': 'root', + 'kind': 'surface', + 'children': [ + { + 'id': 'focus', + 'kind': 'control.button', + 'props': { + 'label': 'Focus Target', + 'command': 'world.example.commands', + 'commandId': 'world.example.focus', + 'action': {'operation': 'focus_entity'}, + }, + }, + ], + }, + }, + }); + final intents = []; + + await tester.pumpWidget( + MaterialApp( + home: EveSurfaceView( + state: state, + commandSink: (intent, node) => intents.add(intent), + ), + ), + ); + + await tester.tap(find.text('Focus Target')); + await tester.pump(); + + expect(intents, hasLength(1)); + expect(intents.single.schema, 'gamecult.eve.command_invocation.v1'); + expect(intents.single.providerId, 'world.example'); + expect(intents.single.surfaceId, 'world.example.surface'); + expect(intents.single.command, 'world.example.commands'); + expect(intents.single.commandId, 'world.example.focus'); + expect(intents.single.clientId, 'flutter-parity'); + expect(intents.single.payload['action']['operation'], 'focus_entity'); + }); + + testWidgets('provider picker consumes conformance export providers', ( + tester, + ) async { + final catalog = EveProviderCatalog.fromConformanceExport( + _providerCatalogExport, + ); + var selected = 'provider.alpha'; + + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: StatefulBuilder( + builder: (context, setState) { + return EveProviderPicker( + catalog: catalog, + selectedProviderId: selected, + onSelected: (providerId) { + setState(() => selected = providerId); + }, + ); + }, + ), + ), + ), + ); + + expect(catalog.providers, hasLength(2)); + expect(catalog.findProvider('provider.beta')?.ownerRepo, 'PluginOwner'); + expect( + catalog + .findProvider('provider.beta') + ?.pluginRequirements + .map((requirement) => requirement.pluginId), + containsAll(['sai.vn', 'norn.graph', 'tex.math']), + ); + expect(find.text('provider.alpha'), findsOneWidget); + + await tester.tap(find.byType(DropdownButton)); + await tester.pumpAndSettle(); + await tester.tap(find.text('provider.beta').last); + await tester.pumpAndSettle(); + + expect(selected, 'provider.beta'); + }); +} + +const fixtureId = String.fromEnvironment( + 'EVE_PARITY_FIXTURE', + defaultValue: 'cultui-inspector', +); + +const _viewports = [ + _Viewport('phone', 390, 844), + _Viewport('tablet', 768, 1024), + _Viewport('desktop', 1280, 720), +]; + +class _Viewport { + const _Viewport(this.id, this.width, this.height); + + final String id; + final double width; + final double height; +} + +const _providerCatalogExport = { + 'schema': 'gamecult.eve.conformance_export.v1', + 'providers': [ + { + 'providerId': 'provider.alpha', + 'status': 'advertised', + 'ownerRepo': 'ProviderAlpha', + 'advertisementPath': 'provider-alpha.json', + 'surfaces': ['provider.alpha.surface'], + 'commands': ['provider.alpha.commands'], + 'pluginRequirements': [], + }, + { + 'providerId': 'provider.beta', + 'status': 'advertised', + 'ownerRepo': 'PluginOwner', + 'advertisementPath': 'provider-beta.json', + 'surfaces': ['provider.beta.surface'], + 'commands': ['provider.beta.act'], + 'pluginRequirements': [ + { + 'surfaceId': 'sai.visual_novel.surface', + 'pluginId': 'sai.vn', + 'requiredCapabilities': [ + 'vn.stage', + 'story.choose', + 'story.continue', + 'story.jump', + ], + }, + { + 'surfaceId': 'sai.visual_novel.surface', + 'pluginId': 'norn.graph', + 'requiredCapabilities': ['embed.norn'], + }, + { + 'surfaceId': 'sai.visual_novel.surface', + 'pluginId': 'tex.math', + 'requiredCapabilities': ['embed.tex'], + }, + ], + }, + ], +}; diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 0000000..e81fa7f --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(eve_parity LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "eve_parity") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..903f489 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 0000000..9115ddb --- /dev/null +++ b/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "eve_parity" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "eve_parity" "\0" + VALUE "LegalCopyright", "Copyright (C) 2026 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "eve_parity.exe" "\0" + VALUE "ProductName", "eve_parity" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..955ee30 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 0000000..df32e22 --- /dev/null +++ b/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"eve_parity", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..153653e --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..3cb7146 --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,69 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + // First, find the length of the string with a safe upper bound (CWE-126). + // UNICODE_STRING_MAX_CHARS (32767) is the maximum length of a UNICODE_STRING. + int input_length = static_cast(wcsnlen(utf16_string, UNICODE_STRING_MAX_CHARS)); + // Now use that bounded length to determine the required buffer size. + // When an explicit length is passed, WideCharToMultiByte does not include + // the null terminator in its returned size. + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, nullptr, 0, nullptr, nullptr); + std::string utf8_string; + if (target_length == 0 || static_cast(target_length) > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/windows/runner/utils.h b/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_