commit 25f66000cbbc91fb750c7a5856cb7726e4a705de Author: Nedifinita Date: Fri Aug 29 13:28:14 2025 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab7da7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,167 @@ +*.iml +.gradle +.kotlin +.idea/caches +.idea/libraries +.idea/modules.xml +.idea/workspace.xml +.idea/navEditor.xml +.idea/assetWizardSettings.xml +.DS_Store +build +captures +.externalNativeBuild +.cxx +local.properties +*.ps1 +.*.bat +*.jks +*.keystore +*.base64 +docs +linux +windows +flutter/ephemeral/ +*.suo +*.user +*.userosscache +*.sln.docstates +x64/ +x86/ +*.[Cc]ache +!*.[Cc]ache/ +.gradle/ +build/ +local.properties +*.log +captures/ +.externalNativeBuild/ +.cxx/ +*.apk +output.json +*.iml +.idea/ +misc.xml +deploymentTargetDropDown.xml +render.experimental.xml +*.jks +*.keystore +google-services.json +*.hprof +gen-external-apklibs +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.fvm/flutter_sdk +.packages +.pub-cache/ +.pub/ +coverage/ +lib/generated_plugin_registrant.dart +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/key.properties +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +*.ap_ +*.aab +*.dex +*.class +bin/ +gen/ +out/ +.gradle +.signing/ +proguard/ +/*/build/ +/*/local.properties +/*/out +/*/*/build +/*/*/production +.navigation/ +*.ipr +*~ +*.swp +.externalNativeBuild +obj/ +*.iws +/out/ +.idea/caches/ +.idea/libraries/ +.idea/shelf/ +.idea/workspace.xml +.idea/tasks.xml +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml +.idea/misc.xml +.idea/modules.xml +.idea/scopes/scope_settings.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/datasources.xml +.idea/dataSources.ids +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/assetWizardSettings.xml +.idea/gradle.xml +.idea/jarRepositories.xml +.idea/navEditor.xml +.classpath +.project +.cproject +.settings/ +.mtj.tmp/ +*.war +*.ear +hs_err_pid* +.idea_modules/ +atlassian-ide-plugin.xml +.idea/mongoSettings.xml +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +!/gradle/wrapper/gradle-wrapper.jar +macos/Flutter/ephemeral/flutter_export_environment.sh +macos/Flutter/ephemeral/Flutter-Generated.xcconfig +*.py \ No newline at end of file diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..d044da8 --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# 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: "dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: android + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: ios + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: linux + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: macos + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: web + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + - platform: windows + create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668 + + # 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..3359a62 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# LBJ_Console + +这是 LBJ_Console 的 Flutter 实现。 \ No newline at end of file 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..55afd91 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..bc5f8c5 --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,83 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace = "org.noxylva.lbjconsole.flutter" + compileSdk = 35 + ndkVersion = "25.1.8937393" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + coreLibraryDesugaringEnabled true + } + + kotlinOptions { + jvmTarget = "11" + } + + defaultConfig { + applicationId = "org.noxylva.lbjconsole.flutter" + minSdk = 29 + targetSdk = 35 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + signingConfigs { + release { + storeFile file("../../keystore.jks") + storePassword System.getenv("KEYSTORE_PASSWORD") ?: "android" + keyAlias System.getenv("KEY_ALIAS") ?: "androidkey" + keyPassword System.getenv("KEY_PASSWORD") ?: "android" + } + } + + buildTypes { + release { + signingConfig = signingConfigs.release + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + splits { + abi { + enable true + reset() + include "arm64-v8a", "armeabi-v7a", "x86", "x86_64" + universalApk true + } + } +} + +dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' +} + +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..a8d274c --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/org/noxylva/lbjconsole/flutter/MainActivity.kt b/android/app/src/main/kotlin/org/noxylva/lbjconsole/flutter/MainActivity.kt new file mode 100644 index 0000000..625fb1b --- /dev/null +++ b/android/app/src/main/kotlin/org/noxylva/lbjconsole/flutter/MainActivity.kt @@ -0,0 +1,5 @@ +package org.noxylva.lbjconsole.flutter + +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 b/android/build.gradle new file mode 100644 index 0000000..47e8b3a --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,19 @@ +allprojects { + repositories { + maven { url 'https://maven.aliyun.com/repository/central' } + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..2597170 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5e6b542 --- /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-8.4-all.zip diff --git a/android/lbjconsole_android.iml b/android/lbjconsole_android.iml new file mode 100644 index 0000000..1899969 --- /dev/null +++ b/android/lbjconsole_android.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..e07c1cb --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return 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 "8.2.2" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..7de1448 Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/loco_info.csv b/assets/loco_info.csv new file mode 100644 index 0000000..fbdcd61 --- /dev/null +++ b/assets/loco_info.csv @@ -0,0 +1,430 @@ +6G,51,90,西安铁路局 宝鸡电力机务段,, +6K,1,85,郑州铁路局 洛阳机务段,, +8G,1,1,太原铁路局 太原北机务段、侯马机务段、石家庄电力机务段,, +8G,2,2,中国铁道博物馆,, +8G,3,75,太原铁路局 太原北机务段、侯马机务段、石家庄电力机务段,, +8G,76,76,太原铁路局 太原机务段北场,, +8G,77,96,太原铁路局 太原北机务段、侯马机务段、石家庄电力机务段,, +8G,97,97,太原铁路局 榆次机务折返段,, +8G,98,100,太原铁路局 太原北机务段、侯马机务段、石家庄电力机务段,, +8K,1,1,北京铁路局 丰台机务段,, +8K,2,7,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,8,8,中国铁道博物馆,*科技号, +8K,9,17,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,18,18,*北京铁路局 丰台机务段,, +8K,19,23,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,24,24,太原铁路局 湖东机务段 大同西运用车间,, +8K,25,64,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,65,65,天津铁道职业技术学院,, +8K,66,71,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,72,72,北京铁路局 丰台机务段,, +8K,73,90,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +8K,91,91,太原铁路局 太原机务段北场 机车展场,, +8K,92,100,*北京铁路局 丰台西段、丰台段;太原铁路局 大同西段、湖东段,, +DJ1,1,1,中国铁道科学研究院 环形铁道,, +DJ1,2,2,株洲西门子牵引设备有限公司,, +DJ1,3,3,西安铁路局 宝鸡机务段 秦岭附加队 ,, +DJ2,1,1,郑州铁路局 郑州机务段京武快车队,奥星, +DJ2,2,3,郑州铁路局 郑州机务段,奥星, +HXD1D,1,15,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,16,16,上海铁路局集团有限公司 杭州机务段,, +HXD1D,17,17,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,18,18,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,19,19,上海铁路局集团有限公司 杭州机务段,, +HXD1D,20,20,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,21,21,上海铁路局集团有限公司 杭州机务段,, +HXD1D,22,24,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,25,25,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,26,26,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,27,27,上海铁路局集团有限公司 杭州机务段,, +HXD1D,28,28,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,29,34,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,35,35,上海铁路局集团有限公司 杭州机务段,, +HXD1D,36,38,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,39,39,中国铁路济南局集团有限公司 济南机务段,, +HXD1D,40,50,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,51,75,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,76,105,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,106,137,上海铁路局集团有限公司 上海机务段,, +HXD1D,138,168,上海铁路局集团有限公司 杭州机务段,, +HXD1D,169,175,上海铁路局集团有限公司 上海机务段,, +HXD1D,176,185,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,186,187,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,188,188,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,189,190,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,191,232,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,233,233,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,234,237,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,238,257,广州铁路(集团)公司 广州机务段,, +HXD1D,258,270,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,271,275,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,276,279,上海铁路局集团有限公司 上海机务段,, +HXD1D,280,289,上海铁路局集团有限公司 徐州机务段,, +HXD1D,290,291,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,292,293,南昌铁路局集团有限公司 鹰潭机务段,, +HXD1D,294,295,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,296,300,广州铁路(集团)公司 广州机务段,, +HXD1D,301,310,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,311,320,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,321,340,青藏铁路集团有限公司 西宁机务段,, +HXD1D,341,362,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,363,382,广州铁路(集团)公司 广州机务段,, +HXD1D,383,392,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,393,405,上海铁路局集团有限公司 上海机务段,, +HXD1D,406,415,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,416,430,广州铁路(集团)公司 长沙机务段,, +HXD1D,431,440,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,441,445,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,446,450,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,451,460,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,461,470,广州铁路(集团)公司 广州机务段,, +HXD1D,471,478,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,479,483,上海铁路局集团有限公司 上海机务段,, +HXD1D,484,488,上海铁路局集团有限公司 杭州机务段,, +HXD1D,489,490,上海铁路局集团有限公司 杭州机务段,, +HXD1D,491,510,郑州铁路局集团有限公司 郑州机务段,, +HXD1D,511,512,上海铁路局集团有限公司 徐州机务段,, +HXD1D,513,515,上海铁路局集团有限公司 上海机务段,, +HXD1D,516,520,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,521,534,广州铁路(集团)公司 广州机务段,, +HXD1D,522,522,广州铁路职业技术学院,, +HXD1D,535,544,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,545,551,上海铁路局集团有限公司 上海机务段,, +HXD1D,552,554,上海铁路局集团有限公司 杭州机务段,, +HXD1D,555,559,郑州铁路局集团有限公司 郑州机务段,, +HXD1D,560,564,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,565,570,广州铁路(集团)公司 广州机务段,, +HXD1D,571,585,南昌铁路局集团有限公司 南昌机务段,, +HXD1D,586,595,上海铁路局集团有限公司 杭州机务段,, +HXD1D,596,613,兰州铁路局集团有限公司 兰州西机务段,, +HXD1D,614,623,广州铁路(集团)公司 广州机务段,, +HXD1D,624,633,上海铁路局集团有限公司 上海机务段,, +HXD1D,634,636,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,637,644,郑州铁路局集团有限公司 郑州机务段,, +HXD1D,645,660,郑州铁路局集团有限公司 郑州机务段,, +HXD1D,661,668,武汉铁路局集团有限公司 武昌南机务段,, +HXD1D,669,673,乌鲁木齐铁路局集团有限公司 乌鲁木齐机务段,, +HXD1D,674,678,郑州铁路局集团有限公司 郑州机务段,, +HXD1D,679,682,上海铁路局集团有限公司 上海机务段,, +HXD1D,683,683,上海铁路局集团有限公司 徐州机务段,, +HXD1D,684,684,上海铁路局集团有限公司 徐州机务段,, +HXD1D,685,689,青藏铁路集团有限公司 格尔木机务段,, +HXD1D,1898,1898,上海铁路局集团有限公司 上海机务段,周恩来号, +HXD1D-J,1,3,青藏铁路集团有限公司 拉萨动车运用所,, +HXD1D-J,1001,1009,昆明铁路局集团有限公司 昆明动车运用所,, +HXD1D-J,1010,1013,青藏铁路集团有限公司 格尔木机务段,, +HXD1D-J,1014,1019,成都铁路局集团有限公司 成都动车运用所,, +HXD1D-J,1020,1027,昆明铁路局集团有限公司 昆明动车运用所,, +HXD3C,446,446,广州铁路(集团)公司 广州机务段,, +HXD3C,805,809,广州铁路(集团)公司 ,, +HXD3C,810,819,中国铁路南宁局集团有限公司,, +HXD3C,820,829,中国铁路武汉局集团有限公司,, +HXD3C,896,925,中国铁路沈阳局集团有限公司,, +HXD3C,926,930,中国铁路南宁局集团有限公司,, +HXD3C,931,945,中国铁路北京局集团有限公司,, +HXD3C,946,955,中国铁路济南局集团有限公司,, +HXD3C,956,965,中国铁路郑州局集团有限公司,, +HXD3C,966,974,中国铁路济南局集团有限公司,, +HXD3D,1,10,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,11,25,西安铁路局集团有限公司 西安机务段,, +HXD3D,26,34,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,35,35,兰州铁路局集团有限公司 迎水桥机务段,雷锋号, +HXD3D,36,38,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,39,39,济南铁路局集团有限公司 济南机务段,共青团号, +HXD3D,40,40,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,41,50,西安铁路局集团有限公司 西安机务段,, +HXD3D,51,70,北京铁路局集团有限公司 北京机务段,, +HXD3D,71,90,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,91,115,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,116,135,昆明铁路局集团有限公司 昆明机务段,, +HXD3D,136,145,北京铁路局集团有限公司 北京机务段,, +HXD3D,146,150,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,151,155,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,156,160,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,161,165,北京铁路局集团有限公司 北京机务段,, +HXD3D,166,170,西安铁路局集团有限公司 西安机务段,, +HXD3D,171,180,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,181,190,济南铁路局集团有限公司 济南机务段,, +HXD3D,191,245,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,246,255,北京铁路局集团有限公司 北京机务段,, +HXD3D,256,265,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,266,290,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,291,300,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,301,310,济南铁路局集团有限公司 济南机务段,, +HXD3D,310,315,昆明铁路局集团有限公司 昆明机务段,, +HXD3D,316,320,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,321,322,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,323,325,北京铁路局集团有限公司 北京机务段,, +HXD3D,326,333,西安铁路局集团有限公司 西安机务段,, +HXD3D,334,340,西安铁路局集团有限公司 安康机务段,, +HXD3D,341,345,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,346,346,成都铁路局集团有限公司 重庆机务段,, +HXD3D,351,351,成都铁路局集团有限公司 重庆机务段,, +HXD3D,356,365,西安铁路局集团有限公司 安康机务段,, +HXD3D,366,369,北京铁路局集团有限公司 北京机务段,, +HXD3D,370,382,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,383,392,昆明铁路局集团有限公司 昆明机务段,, +HXD3D,393,397,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,398,402,西安铁路局集团有限公司 西安机务段,, +HXD3D,403,417,西安铁路局集团有限公司 西安机务段,, +HXD3D,418,419,哈尔滨铁路局集团有限公司 牡丹江机务段,, +HXD3D,420,424,北京铁路局集团有限公司 北京机务段,, +HXD3D,425,429,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,430,433,哈尔滨铁路局集团有限公司 牡丹江机务段,, +HXD3D,434,443,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,444,449,济南铁路局集团有限公司 济南机务段,, +HXD3D,450,464,西安铁路局集团有限公司 西安机务段,, +HXD3D,465,468,济南铁路局集团有限公司 济南机务段,, +HXD3D,469,473,济南铁路局集团有限公司 济南机务段,, +HXD3D,474,479,昆明铁路局集团有限公司 昆明机务段,, +HXD3D,480,484,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,485,489,西安铁路局集团有限公司 西安机务段,, +HXD3D,490,499,北京铁路局集团有限公司 北京机务段,, +HXD3D,500,503,哈尔滨铁路局集团有限公司 牡丹江机务段,, +HXD3D,504,514,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,515,515,成都铁路局集团有限公司 重庆机务段,, +HXD3D,516,518,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,519,528,西安铁路局集团有限公司 西安机务段,, +HXD3D,529,538,北京铁路局集团有限公司 北京机务段,, +HXD3D,539,541,呼和浩特铁路局集团有限公司 集宁机务段,, +HXD3D,542,553,西安铁路局集团有限公司 西安机务段,, +HXD3D,554,563,济南铁路局集团有限公司 济南机务段,, +HXD3D,564,568,昆明铁路局集团有限公司 昆明机务段,, +HXD3D,569,573,成都铁路局集团有限公司 重庆机务段,, +HXD3D,574,583,济南铁路局集团有限公司 济南机务段,, +HXD3D,584,584,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,585,609,哈尔滨铁路局集团有限公司 三棵树机务段,, +HXD3D,610,611,北京铁路局集团有限公司 北京机务段,, +HXD3D,612,621,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,622,626,南昌铁路局集团有限公司 南昌机务段,, +HXD3D,627,629,哈尔滨铁路局集团有限公司 三棵树机务段,, +HXD3D,630,630,哈尔滨铁路局集团有限公司 哈尔滨机务段,, +HXD3D,631,631,西安铁路局集团有限公司 西安机务段,第五代“钢人铁马号”, +HXD3D,632,653,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,654,673,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,674,681,沈阳铁路局集团有限公司 沈阳机务段,, +HXD3D,682,688,兰州铁路局集团有限公司 兰州西机务段,, +HXD3D,1886,1886,哈尔滨铁路局集团有限公司 哈尔滨机务段,第五代“朱德号”, +HXD3D,1893,1893,北京铁路局集团有限公司 丰台机务段,第六代“毛泽东号”, +HXD3D,1921,1921,沈阳铁路局集团有限公司 沈阳机务段,共产党员号, +HXD3D,7001,7002,广西沿海铁路股份有限公司 南宁南机务运用段,, +HXD3D,7003,7003,吉林铁道职业技术学院,, +HXD3D,8001,8025,沈阳铁路局集团有限公司 沈阳机务段,,大同 +HXD3D,8026,8028,太原铁路局集团有限公司 太原南机务段,,大同 +东方红2,1,50,,,资阳 +东风,1201,1830,,,大连、成都 +东风,2001,2094,,,戚墅堰 +东风11,1,459,,,戚墅堰 +东风12,8001,8001,吉林铁道职业技术学院,, +东风2,3201,3348,,,戚墅堰 +东风21,1,5,中国铁路昆明局集团有限公司 昆明机务段,, +东风21,6,6,中国铁路昆明局集团有限公司 昆明机务段,状元号, +东风21,7,7,中国铁路昆明局集团有限公司 昆明机务段,亲年号, +东风21,8,8,中国铁路昆明局集团有限公司 昆明机务段,建水古城, +东风21,9,100,中国铁路昆明局集团有限公司 昆明机务段,, +东风21,101,101,中国铁路昆明局集团有限公司 昆明机务段,异龙号, +东风21,102,102,中国铁路昆明局集团有限公司 昆明机务段,, +东风21,1001,1002,云南钢铁厂,, +东风2Z,3251,3251,*齐齐哈尔铁路局 加格达奇机务段,, +东风3,3243,3243,中车共享城机车公园,, +东风4,3247,3247,中车成都轨道交通产业园,, +东风4B,1001,1999,,,大连 +东风4B,1963,1963,*北京铁路局 丰台机务段,, +东风4B,2101,2685,,,大连 +东风4B,2104,2104,*上海铁路局 蚌埠机务段,, +东风4B,2376,2376,*南昌铁路局 鹰潭机务段,, +东风4B,3101,3999,,,资阳 +东风4B,3214,3214,*浙江金温铁道开发有限公司 温州机务段,, +东风4B,3249,3249,*西安铁路局 西安机务段,, +东风4B,3390,3390,*成都铁路局 重庆机务段,, +东风4B,3593,3593,*广州铁路(集团)公司 株洲机务段,, +东风4B,6001,6587,,,大同 +东风4B,6530,6530,*南宁铁路局 南宁机务段,, +东风4B,7001,7363,,,大连 +东风4B,7364,7365,,,四方 +东风4B,7366,7796,,,大连 +东风4B,7701,7732,,,戚墅堰改 +东风4B,9001,9702,,,资阳 +东风4B,9167,9167,*南昌铁路局 向塘机务段,, +东风4B,9531,9531,*新长铁路公司,, +东风4C,1,10,,,大同 +东风4C,11,11,北京铁路局 丰台段,青年文明号, +东风4C,12,40,,,大同 +东风4C,2001,2006,,,四方 +东风4C,4001,4465,,,大连 +东风4C,4466,4466,四方机车车辆厂,,四方 +东风4C,5001,5273,,,资阳 +东风4C,5274,5275,三茂铁路公司 三水机务段,东风4CK, +东风4C,5276,5335,,,资阳 +东风4D,7001,7021,中国铁路南宁局集团有限公司,, +东风5,1,1,中国铁路北京局集团有限公司 北京车辆段,, +东风5,1974,1975,中国铁路兰州局集团有限公司 兰州西机务段,,唐山 +东风5,1976,2082,,,唐山 +东风5,2083,2083,中国石油兰州石化公司,,唐山 +东风5,3279,3279,云南铁路博物馆,, +东风6,1,2,*沈阳铁路局 大连机务段,, +东风6,3,3,沈阳铁路陈列馆,, +东风6,4,4,*沈阳铁路局 大连机务段,, +东风7,174,174,太原机务段北场,, +东风7B,3006,3006,中国铁道博物馆,, +东风7B,3015,3015,王坪村铁路公园,, +东风7B,6001,6072,*北京铁路局 邯郸机务段;郑州铁路局 新乡机务段,调车, +东风7D,1,1,中国铁道博物馆,, +东风7D,3001,3001,中国铁道博物馆,, +东风7E,1,1,郑州铁路局 新乡机务段,, +东风7E,2,2,郑州铁路局 郑州机务段,, +东风7G,9001,9004,呼和浩特铁路局 集宁机务段 赛汗塔拉分段,, +东风8,1,1,中国铁道博物馆,, +东风9,1,2,中国铁路广州局集团有限公司广州机务段,, +韶山1,8,8,中国铁道博物馆,, +韶山1,156,156,郑州世纪欢乐园,, +韶山1,160,160,北京铁路电气化学校,, +韶山1,227,227,兰州铁路局 兰州西机务段,, +韶山1,254,254,北京铁路局 丰台机务段 储备厂,, +韶山1,307,307,太原铁路局 榆次机务折返段,, +韶山1,309,309,太原铁路局 太原机务段北场,, +韶山1,321,321,武汉铁路职业技术学院,, +韶山1,681,681,中国铁道博物馆,, +韶山1,695,695,沈阳铁路陈列馆,, +韶山1,762,762,广州铁路(集团)公司 娄底运用车间储备厂,, +韶山1,818,818,西南交通大学 机车博物园,, +韶山1,821,821,韶关机务实训基地,, +韶山1,826,826,韶关机务实训基地,, +韶山3,454,454,成都铁路局 贵阳机务段,先锋号, +韶山3,524,524,武汉铁路局 江岸机务段,青年号, +韶山3,4160,4160,广西沿海铁路公司 南宁南机务运用段,共青团号, +韶山3,4178,4178,广西沿海铁路公司 南宁南机务运用段,共青团号, +韶山3,4235,4235,成都铁路局 重庆机务段,青年文明号, +韶山3,4258,4258,成都铁路局 重庆机务段,党员先锋号, +韶山3,5080,5080,广铁机车博物馆,, +韶山3,6005,6005,湖南交通工程学院,, +韶山3,8050,8050,武汉四美塘铁路遗址公园,, +韶山3B,16,16,西安铁路局 安康机务段,青年文明号, +韶山3B,5001,5001,成都铁路局 贵阳机务段,*先锋力神, +韶山3B,5035,5035,兰州铁路局 迎水桥机务段,雷锋号 (曾), +韶山3B,5038,5038,兰州铁路局 迎水桥机务段,青年文明号, +韶山3B,5151,5151,成都铁路局 西昌机务段,扶贫先锋号, +韶山3B,5162,5162,昆明铁路局 昆明机务段,五四青年号, +韶山3B,5235,5235,成都铁路局 西昌机务段,*共青团号, +韶山3C,1,1,贵阳机务段,, +韶山4,6,6,中国铁道博物馆,, +韶山4,10,10,成都铁路局 西昌机务段,, +韶山4,50,50,郑州铁路局 新乡机务段,先锋号, +韶山4,63,63,太原铁路局 太原机务段,, +韶山4,204,204,郑州铁路局 新乡机务段,先锋号, +韶山4,448,448,沈阳铁路局 苏家屯机务段,先锋号, +韶山4,574,574,中铁三局集团,先锋号, +韶山4,743,743,哈尔滨铁路局 哈尔滨机务段,青年文明号, +韶山4,855,855,西安铁路局 新丰镇机务段,, +韶山4,911,911,中铁三局集团,青年文明号, +韶山4,2006,2006,吉林铁道职业技术学院,, +韶山4B,19,19,神朔铁路公司 神木北机务段,青年号, +韶山4B,89,89,神朔铁路公司 神木北机务段,青年文明号, +韶山4B,90,90,神朔铁路公司 神木北机务段,青年文明号, +韶山4B,257,257,包神铁路公司 东胜机务段,党员先锋号, +韶山4G,159,1177,,,株洲 +韶山4G,168,168,中国铁道博物馆,, +韶山4G,171,171,哈尔滨铁路局 牡丹江机务段,, +韶山4G,179,179,太原铁路局 湖东机务段,, +韶山4G,466,466,石家庄铁道大学,, +韶山4G,1089,1089,*呼和浩特铁路局 包头西机务段,, +韶山4G,1886,1886,哈尔滨铁路局 哈尔滨机务段,*朱德号,株洲 +韶山4G,3001,3002,,,资阳 +韶山4G,6001,6001,中国铁道博物馆,, +韶山4G,6001,6001,中国铁道博物馆,,大同 +韶山4G,7001,7110,,,大连 +韶山4G,7121,7243,,,大连 +韶山5,1,1,中国铁道博物馆,, +韶山5,2,2,郑州世纪欢乐园 ,, +韶山6,1,1,郑州铁路司机学校,, +韶山6,2,2,中国铁道博物馆,, +韶山6B,1011,1011,西安铁路局 西安机务段,*青年文明号, +韶山6B,1026,1026,韶关机务实训基地,, +韶山6B,1088,1088,武汉铁路局 襄阳机务段,*民兵号, +韶山6B,1111,1111,武汉铁路局 襄阳机务段,*先锋号, +韶山6B,6001,6001,韶关机务实训基地,, +韶山6B,6002,6002,广州铁路博物馆,, +韶山7,1,79,南宁铁路局集团有限公司 柳州机务段,, +韶山7,76,76,南宁铁路局集团有限公司 南宁机务段,*五四红旗号, +韶山7,80,84,南宁铁路局集团有限公司 柳州机务段,, +韶山7,85,111,南宁铁路局集团有限公司 柳州机务段,, +韶山7,8112,8113,山西孝柳铁路有限责任公司,, +韶山7B,1,1,*南宁铁路局集团有限公司 南宁机务段,, +韶山7B,2,2,中国铁路南宁局集团有限公司 柳州机务段,, +韶山7D,1,58,西安铁路局集团有限公司 西安机务段,, +韶山7D,631,631,西安铁路局集团有限公司 西安机务段,*钢人铁马号, +韶山7E,1,140,,,大同 +韶山7E,6001,6002,昆明铁路局,,大同 +韶山7E,7001,7004,,,大连 +韶山8,1,1,中国铁路广州局集团有限公司 广州机务段,, +韶山8,2,2,中国铁路广州局集团有限公司 广州机务段,, +韶山8,3,4,中国铁路上海局集团有限公司 上海机务段,, +韶山8,5,5,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,9,9,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,11,11,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,12,12,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,15,16,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,17,17,中国铁路上海局集团有限公司 上海机务段,, +韶山8,20,20,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,24,25,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,27,27,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,29,32,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,33,35,中国铁路上海局集团有限公司 上海机务段,, +韶山8,36,36,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,38,38,中国铁路上海局集团有限公司 上海机务段,, +韶山8,39,39,中国铁路上海局集团有限公司 上海机务段,国祥号, +韶山8,40,40,中国铁路上海局集团有限公司 上海机务段,, +韶山8,41,41,中国铁路北京局集团有限公司 北京机务段,, +韶山8,43,43,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,44,44,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,45,45,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,48,48,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,49,49,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,50,50,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,51,51,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,52,52,中国铁路上海局集团有限公司 上海机务段,, +韶山8,55,55,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,56,57,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,64,64,中国铁路广州局集团有限公司 广州机务段,, +韶山8,72,72,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,73,73,中国铁路北京局集团有限公司 北京机务段,, +韶山8,74,74,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,81,81,中国铁路北京局集团有限公司 北京机务段,, +韶山8,83,84,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,85,85,中国铁路北京局集团有限公司 北京机务段,, +韶山8,88,103,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,104,104,中国铁路北京局集团有限公司 邯郸机务段,, +韶山8,109,111,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,114,116,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,118,119,中国铁路北京局集团有限公司 北京机务段,, +韶山8,121,126,中国铁路北京局集团有限公司 北京机务段,, +韶山8,127,128,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,130,130,中国铁路南昌局集团有限公司 南昌机务段,, +韶山8,131,131,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,132,132,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,133,133,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,134,134,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,136,136,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,141,141,中国铁路广州局集团有限公司 广州机务段,, +韶山8,144,144,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,148,148,中国铁路广州局集团有限公司 广州机务段,, +韶山8,156,156,中国铁路广州局集团有限公司 广州机务段,, +韶山8,163,163,中国铁路广州局集团有限公司 广州机务段,, +韶山8,166,166,中国铁路广州局集团有限公司 广州机务段,新世纪金龙号, +韶山8,171,171,中国铁路上海局集团有限公司 上海机务段,, +韶山8,172,172,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,173,173,中国铁路广州局集团有限公司 广州机务段,, +韶山8,181,181,中国铁路广州局集团有限公司 广州机务段,, +韶山8,186,186,中国铁路广州局集团有限公司 广州机务段,, +韶山8,191,191,中国铁路广州局集团有限公司 广州机务段,, +韶山8,192,192,中国铁路广州局集团有限公司 广州机务段,, +韶山8,197,197,中国铁路郑州局集团有限公司 郑州机务段,, +韶山8,200,204,中国铁路上海局集团有限公司 上海机务段,, +韶山8,205,205,中国铁路广州局集团有限公司 长沙机务段,, +韶山8,214,214,中国铁路郑州局集团有限公司 郑州机务段,, +韶山9,1,3,沈阳铁路局 沈阳机务段;上海铁路局 上海机务段,, +韶山9,5,29,沈阳铁路局 沈阳机务段;上海铁路局 上海机务段,, +韶山9,30,30,沈阳铁路局 通辽机务段,, +韶山9,31,37,沈阳铁路局 沈阳机务段;上海铁路局 上海机务段,, +韶山9,38,38,沈阳铁路局 通辽机务段,, +韶山9,39,43,沈阳铁路局 沈阳机务段;上海铁路局 上海机务段,, \ No newline at end of file diff --git a/assets/loco_type_info.csv b/assets/loco_type_info.csv new file mode 100644 index 0000000..347e896 --- /dev/null +++ b/assets/loco_type_info.csv @@ -0,0 +1,142 @@ +001,解放 +003,前进 +005,建设 +006,KD7 +055,蓝箭控车 +081,东风21 +101,东风 +102,东风2 +103,东风3 +104,东风4 +105,东风4客 +106,东风4C +107,东风5 +108,东风5宽 +109,东风6 +110,东风7 +111,东风8 +112,东风9 +113,东风10 +114,东方红1 +115,东方红2 +116,东方红3 +117,东方红5 +118,北京 +119,北京宽 +120,ND2 +121,ND3 +122,ND4 +123,ND5 +124,NY5 +125,NY6 +126,NY7 +127,轻油 +128,东方红21 +129,东风7B +130,东风5S +131,东风7C +132,东风7S +133,工矿1 +134,工矿1F +135,东风4E +136,东风7D +137,工矿1A +138,东风11 +139,天安 +140,东风10F +141,东风4D +142,东风8B +143,东风12 +144,东风7E +145,NYJ1 +146,NZJ1 +147,NZJ2 +148,东风4DJ +149,新曙光 +150,神州 +151,NJ2 +152,东风7G +153,NDJ3 +157,FXN3D +158,东风11G +160,HXN3 +161,HXN5 +162,HXN3B +163,HXN5B +167,FXN3B +169,FXN3C +170,FXN5C +171,FXN3-J +201,8G +202,8K +203,6G +204,6K +205,韶山1 +206,韶山3 +207,韶山4 +208,韶山5 +209,韶山6 +210,韶山3B +211,韶山7 +212,韶山8 +213,韶山7B +214,韶山7C +215,韶山6B +216,韶山9 +217,韶山7D +218,DJ熊猫 +219,DJ1 +220,DJ2 +221,DJF +222,蓝箭动车 +223,先锋号 +224,韶山7E +225,韶山4G +226,韶山3C +228,天梭 +229,DJ4和谐 +230,KTT +231,HXD1 +232,HXD2 +233,HXD3 +234,HXD1B +235,HXD2B +236,HXD3B +237,HXD1C +238,HXD2C +239,HXD3C +240,HXD1D +241,HXD2D +242,HXD3D +243,FXD1B +244,FXD2B +245,FXD1 +246,FXD3 +247,FXD1-J +248,FXD3-J +249,KZ25TA +251,KZ25TB +252,HXD1D-J +254,FXD1H +300,雪域神州 +301,CRH1 +302,CRH2 +303,CRH3 +305,CRH5 +306,CRH380A +307,CRH380B +308,CRH380C +309,CRH380D +310,CRH6A +311,CR400AF +312,CR400BF +313,CR300AF +314,CR300BF +315,CRH2E +316,CRH6F +330,CJ1 +331,CJ2 +332,CJ3 +333,CJ4 +334,CJ5 +335,CJ6 \ No newline at end of file diff --git a/assets/train_number_info.csv b/assets/train_number_info.csv new file mode 100644 index 0000000..9213b85 --- /dev/null +++ b/assets/train_number_info.csv @@ -0,0 +1,82 @@ +"^[Gg](4000|[1-3]\d{3}|[1-9]\d{0,2})$","直通图定高速动车组" +"^[Gg](400[1-9]|40[1-9]\d|4[1-8]\d{2}|49[0-8]\d|499[0-8])$","直通临客高速动车组" +"^[Gg](9000|[6-8]\d{3}|500[1-9]|50[1-9]\d|5[1-9]\d{2})$","管内图定高速动车组" +"^[Gg](900[1-9]|90[1-9]\d|9[1-8]\d{2}|99[0-8]\d|999[0-8])$","管内临客高速动车组" +"^[Cc]([1-8]\d{3}|9000)$","图定城际动车组" +"^[Cc](900[1-9]|90[1-9]\d|9[1-8]\d{2}|99[0-8]\d|999[0-8])$","临客城际动车组" +"^[Cc][1-9]\d{2}$","动力集中城际动车组" +"^[IDid](4000|[1-3]\d{3}|[1-9]\d{0,2})$","直通图定动车组" +"^[IDid](400[1-9]|40[1-9]\d|4[1-8]\d{2}|49[0-8]\d|499[0-8])$","直通临客动车组" +"^[IDid](9000|[6-8]\d{3}|500[1-9]|50[1-9]\d|5[1-9]\d{2})$","管内图定动车组" +"^[IDid](900[1-9]|90[1-9]\d|9[1-8]\d{2}|99[0-8]\d|999[0-8])$","管内临客动车组" +"^[IDid](8([0-8]\d|9[0-8])|7(0[1-9]|[1-9]\d))$","动力集中动车组" +"^[IDid](300|[12]\d{2}|[1-9]\d?)$","跨局动力集中动车组" +"^[PZpz](4000|[1-3]\d{3}|[1-9]\d{0,2})$","直通图定直达特快旅客列车" +"^[PZpz](400[1-9]|40[1-9]\d|4[1-8]\d{2}|49[0-8]\d|499[0-8])$","直通临客直达特快旅客列车" +"^[PZpz](9000|[6-8]\d{3}|500[1-9]|50[1-9]\d|5[1-9]\d{2})$","管内图定直达特快旅客列车" +"^[PZpz](900[1-9]|90[1-9]\d|9[1-8]\d{2}|99[0-8]\d|999[0-8])$","管内临客直达特快旅客列车" +"^[QTqt](3000|[12]\d{3}|[1-9]\d{0,2})$","直通图定特快旅客列车" +"^[QTqt](300[1-9]|30[1-9]\d|3[1-8]\d{2}|39[0-8]\d|399[0-8])$","直通临客特快旅客列车" +"^[QTqt](4(00[1-9]|0[1-9]\d|[1-8]\d{2}|9[0-8]\d|99[0-8]))$","管内临客特快旅客列车" +"^[QTqt]([5-8]\d{3}|9([0-8]\d{2}|9[0-8]\d|99[0-8])|500[1-9]|50[1-9]\d|5[1-9]\d{2})$","管内图定特快旅客列车" +"^[WKwk](4000|[1-3]\d{3}|[1-9]\d{0,2})$","直通图定快速旅客列车" +"^[WKwk](400[1-9]|40[1-9]\d|4[1-8]\d{2}|49[0-8]\d|499[0-8])$","直通临客快速旅客列车" +"^[WKwk](6([0-8]\d{2}|9[0-8]\d|99[0-8])|500[1-9]|50[1-9]\d|5[1-9]\d{2})$","管内临客快速旅客列车" +"^[WKwk](8\d{3}|9([0-8]\d{2}|9[0-8]\d|99[0-8])|7(00[1-9]|0[1-9]\d|[1-9]\d{2}))$","管内图定快速旅客列车" +"^[Vv1](00[1-9]|0[1-9]\d|[1-9]\d{2})$","跨三局及以上图定普通旅客快车" +"^[Bb2](00[1-9]|0[1-9]\d|[1-9]\d{2})$","跨两局图定普通旅客快车" +"^3(00[1-9]|0[1-9]\d|[1-9]\d{2})$","跨局临时普通旅客快车" +"^[Uu4](00[1-9]|0[1-9]\d|[1-9]\d{2})$","管内图定普通旅客快车" +"^[Xx5](000|1[9][9]|200|3[9][9]|400)$","管内图定普通旅客快车" +"^6(19[0-8]|1[0-8]\d|0[1-9]\d|00[1-9])$","直通普通旅客慢车" +"^(6(20[1-9]|2[1-9]\d|[3-9]\d{2})|7([0-4]\d{2}|5([0-8]\d|9[0-8])))$","管内普通旅客慢车" +"^(8([0-8]\d{2}|9[0-8]\d|99[0-8])|7(60[1-9]|6[1-9]\d|[7-9]\d{2}))$","通勤列车" +"^[Yy](500|[1-4]\d{2}|[1-9]\d?)$","跨局旅游列车" +"^[Yy](50[1-9]|5[1-9]\d|[6-9]\d{2})$","管内旅游列车" +"^[Ss][1-9]\d{0,3}$","市郊旅客列车" +"^[Ll](6([0-8]\d{2}|9[0-8]\d|99[0-8])|[1-5]\d{3}|[1-9]\d{0,2})$","直通临时旅客列车" +"^[Ll]([7-9]\d{3})$","管内临时旅客列车" +"^[Xx](19[0-8]|1[0-8]\d|[1-9]\d?)$","特快货物班列" +"^[Xx](39[0-8]|3[0-8]\d|2[1-9]\d|20[1-9])$","快速货物班列" +"^[Xx]2(40[1-9]|4[1-9]\d|[5-9]\d{2})$","直通货物快运列车" +"^[Xx]([4-9]\d{2}|4[1-9]\d|40[1-9])$","管内货物快运列车" +"^[Xx]8\d{3}$","中欧中亚集装箱班列" +"^[Xx]9([0-4]\d{2}|500)$","中亚集装箱班列" +"^[Xx]9(50[1-9]|5[1-9]\d|[6-9]\d{2})$","水铁联运班列" +"^[Xx][1-4]\d{4}$","加挂零散快运车辆货物列车" +"^1(000[1-9]|00[1-9]\d|0[1-9]\d{2}|[1-9]\d{3})$","技术直达列车" +"^2\d{4}$","直通货物列车" +"^3\d{4}$","区段摘挂列车" +"^4([0-3]\d{3}|4([0-8]\d{2}|9[0-8]\d|99[0-8]))$","摘挂列车" +"^4(500[1-9]|50[1-9]\d|5[1-9]\d{2}|[6-9]\d{3})$","小运转列车" +"^6\d{4}$","自备列车" +"^70\d{3}$","超限货物列车" +"^7([1-6]\d{3}|7([0-8]\d{2}|9[0-8]\d|99[0-8]))$","重载货物列车" +"^78\d{3}$","保温列车" +"^8(0\d{3}|1([0-8]\d{2}|9[0-8]\d|99[0-8]))$","普快货物班列" +"^8(200[1-9]|20[1-9]\d|2[1-9]\d{2}|[34]\d{3})$","煤炭直达列车" +"^85\d{3}$","石油直达列车" +"^86\d{3}$","始发直达列车" +"^87\d{3}$","空车直达列车" +"^(90\d{3}|91([0-8]\d{2}|9[0-8]\d|99[0-8]))$","军用列车" +"^50\d{3}$","客车单机" +"^51\d{3}$","货车单机" +"^52\d{3}$","小运转单机" +"^5(3\d{3}|4([0-8]\d{2}|9[0-8]\d|99[0-8]))$","补机列车" +"^55(300|[0-2]\d{2})$","普通客货试运转列车" +"^55(500|30[1-9]|3[1-9]\d|4\d{2})$","高速动车组试运转列车" +"^55(50[1-9]|5[1-9]\d|[6-9]\d{2})$","普通动车组试运转列车" +"^56\d{3}$","轻油动车与轨道车" +"^57\d{3}$","路用列车" +"^58(10[1-9]|1[1-9]\d|[2-8]\d{2}|9([0-8]\d|9[0-8]))$","救援列车" +"^DJ(400|[1-3]\d{2}|[1-9]\d?)$","动车组检测列车300直通" +"^DJ([4-9]\d{2}|40[1-9]|4[1-9]\d)$","动车组检测列车300管内" +"^DJ1(400|[0-3]\d{2})$","动车组检测列车250直通" +"^DJ1(40[1-9]|4[1-9]\d|[5-9]\d{2})$","动车组检测列车250管内" +"^DJ[56]\d{3}$","直通动车组确认列车" +"^DJ[78]\d{3}$","管内动车组确认列车" +"^[Ff][GDCZTKgdcztk]?\d{1,4}$","因故折返旅客列车" +"^0[GDCZTKgdcztk]\d{1,4}$","回送图定客车底" +"^00(100|[1-9]\d?)$","有火回送动车组车底" +"^00(10[1-9]|1[1-9]\d|2([0-8]\d|9[0-8]))$","无火回送动车组车底" +"^00(30[1-9]|3[1-9]\d|4([0-8]\d|9[0-8]))$","无火回送普速客车底" \ No newline at end of file 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..7c56964 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.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..9a487fd --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*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 */; }; + 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 = ""; }; + 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 = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 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 */, + 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; + 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; + 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 */, + ); + 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 = 12.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 = org.noxylva.lbjconsole.flutter; + 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 = org.noxylva.lbjconsole.flutter.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 = org.noxylva.lbjconsole.flutter.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 = org.noxylva.lbjconsole.flutter.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 = 12.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 = 12.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 = org.noxylva.lbjconsole.flutter; + 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 = org.noxylva.lbjconsole; + 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 */ + }; + 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..8e3ca5d --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..6266644 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} 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..cd5d87b --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Lbjconsole + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + lbjconsole + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + 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/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/lbjconsole.iml b/lbjconsole.iml new file mode 100644 index 0000000..f66303d --- /dev/null +++ b/lbjconsole.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..51a276c --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:lbjconsole/screens/main_screen.dart'; +import 'package:lbjconsole/util/train_type_util.dart'; +import 'package:lbjconsole/util/loco_info_util.dart'; +import 'package:lbjconsole/util/loco_type_util.dart'; +import 'package:lbjconsole/services/loco_type_service.dart'; +import 'package:lbjconsole/services/database_service.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + + await Future.wait([ + TrainTypeUtil.initialize(), + LocoInfoUtil.initialize(), + LocoTypeService().initialize(), + ]); + + runApp(const LBJReceiverApp()); +} + +class LBJReceiverApp extends StatelessWidget { + const LBJReceiverApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'LBJ Console', + debugShowCheckedModeBanner: false, + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + themeMode: ThemeMode.dark, + home: const MainScreen(), + ); + } +} diff --git a/lib/models/merged_record.dart b/lib/models/merged_record.dart new file mode 100644 index 0000000..6365f27 --- /dev/null +++ b/lib/models/merged_record.dart @@ -0,0 +1,60 @@ +import 'package:lbjconsole/models/train_record.dart'; + +class MergedTrainRecord { + final String groupKey; + final List records; + final TrainRecord latestRecord; + + MergedTrainRecord({ + required this.groupKey, + required this.records, + required this.latestRecord, + }); + + int get recordCount => records.length; +} + +class MergeSettings { + final bool enabled; + final GroupBy groupBy; + final TimeWindow timeWindow; + + MergeSettings({ + this.enabled = true, + this.groupBy = GroupBy.trainAndLoco, + this.timeWindow = TimeWindow.unlimited, + }); + + factory MergeSettings.fromMap(Map map) { + return MergeSettings( + enabled: (map['mergeRecordsEnabled'] ?? 0) == 1, + groupBy: GroupBy.values.firstWhere( + (e) => e.name == map['groupBy'], + orElse: () => GroupBy.trainAndLoco, + ), + timeWindow: TimeWindow.values.firstWhere( + (e) => e.name == map['timeWindow'], + orElse: () => TimeWindow.unlimited, + ), + ); + } +} + +enum GroupBy { + trainOnly, + locoOnly, + trainOrLoco, + trainAndLoco, +} + +enum TimeWindow { + oneHour(Duration(hours: 1)), + twoHours(Duration(hours: 2)), + sixHours(Duration(hours: 6)), + twelveHours(Duration(hours: 12)), + oneDay(Duration(days: 1)), + unlimited(null); + + final Duration? duration; + const TimeWindow(this.duration); +} diff --git a/lib/models/train_record.dart b/lib/models/train_record.dart new file mode 100644 index 0000000..ed971b6 --- /dev/null +++ b/lib/models/train_record.dart @@ -0,0 +1,301 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:lbjconsole/util/train_type_util.dart'; +import 'package:lbjconsole/util/loco_info_util.dart'; + +class TrainRecord { + final String uniqueId; + final DateTime timestamp; + final DateTime receivedTimestamp; + final String train; + final int direction; + final String speed; + final String position; + final String time; + final String loco; + final String locoType; + final String lbjClass; + final String route; + final String positionInfo; + final double rssi; + + TrainRecord({ + required this.uniqueId, + required this.timestamp, + required this.receivedTimestamp, + required this.train, + required this.direction, + required this.speed, + required this.position, + required this.time, + required this.loco, + required this.locoType, + required this.lbjClass, + required this.route, + required this.positionInfo, + required this.rssi, + }); + + factory TrainRecord.fromJson(Map json) { + return TrainRecord( + uniqueId: json['uniqueId'] ?? json['unique_id'] ?? '', + timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp'] ?? 0), + receivedTimestamp: DateTime.fromMillisecondsSinceEpoch( + json['receivedTimestamp'] ?? json['received_timestamp'] ?? 0), + train: json['train'] ?? '', + direction: json['direction'] ?? json['dir'] ?? 0, + speed: json['speed'] ?? '', + position: json['position'] ?? json['pos'] ?? '', + time: json['time'] ?? '', + loco: json['loco'] ?? '', + locoType: json['locoType'] ?? json['loco_type'] ?? '', + lbjClass: json['lbjClass'] ?? json['lbj_class'] ?? '', + route: json['route'] ?? '', + positionInfo: json['positionInfo'] ?? json['position_info'] ?? '', + rssi: (json['rssi'] ?? 0.0).toDouble(), + ); + } + + factory TrainRecord.fromJsonString(String jsonString) { + final json = jsonDecode(jsonString); + return TrainRecord.fromJson(json); + } + + Map toJson() { + return { + 'uniqueId': uniqueId, + 'timestamp': timestamp.millisecondsSinceEpoch, + 'receivedTimestamp': receivedTimestamp.millisecondsSinceEpoch, + 'train': train, + 'direction': direction, + 'speed': speed, + 'position': position, + 'time': time, + 'loco': loco, + 'loco_type': locoType, + 'lbj_class': lbjClass, + 'route': route, + 'position_info': positionInfo, + 'rssi': rssi, + }; + } + + Map toDatabaseJson() { + return { + 'uniqueId': uniqueId, + 'timestamp': timestamp.millisecondsSinceEpoch, + 'receivedTimestamp': receivedTimestamp.millisecondsSinceEpoch, + 'train': train, + 'direction': direction, + 'speed': speed, + 'position': position, + 'time': time, + 'loco': loco, + 'locoType': locoType, + 'lbjClass': lbjClass, + 'route': route, + 'positionInfo': positionInfo, + 'rssi': rssi, + }; + } + + factory TrainRecord.fromDatabaseJson(Map json) { + return TrainRecord( + uniqueId: json['uniqueId']?.toString() ?? '', + timestamp: + DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int? ?? 0), + receivedTimestamp: DateTime.fromMillisecondsSinceEpoch( + json['receivedTimestamp'] as int? ?? 0), + train: json['train']?.toString() ?? '', + direction: json['direction'] as int? ?? 0, + speed: json['speed']?.toString() ?? '', + position: json['position']?.toString() ?? '', + time: json['time']?.toString() ?? '', + loco: json['loco']?.toString() ?? '', + locoType: json['locoType']?.toString() ?? '', + lbjClass: json['lbjClass']?.toString() ?? '', + route: json['route']?.toString() ?? '', + positionInfo: json['positionInfo']?.toString() ?? '', + rssi: (json['rssi'] as num?)?.toDouble() ?? 0.0, + ); + } + + String get directionText { + switch (direction) { + case 0: + return '上行'; + case 1: + return '下行'; + default: + return '未知'; + } + } + + String get locoTypeText { + if (locoType.isEmpty) return '未知'; + return locoType; + } + + String get trainType { + final lbjClassValue = lbjClass.isEmpty ? "NA" : lbjClass; + return TrainTypeUtil.getTrainType(lbjClassValue, train) ?? '未知'; + } + + String? get locoInfo { + return LocoInfoUtil.getLocoInfoDisplay(locoType, train); + } + + String get fullTrainNumber { + final lbjClassValue = lbjClass.trim(); + final trainValue = train.trim(); + + if (trainValue == "") { + return ""; + } + + if (lbjClassValue.isEmpty || lbjClassValue == "NA") { + return trainValue; + } else { + return "$lbjClassValue$trainValue"; + } + } + + String get lbjClassText { + if (lbjClass.isEmpty) return '未知'; + return lbjClass; + } + + double get speedValue { + try { + return double.parse(speed.replaceAll(RegExp(r'[^\d.]'), '')); + } catch (e) { + return 0.0; + } + } + + String get speedUnit { + if (speed.contains('km/h')) return 'km/h'; + if (speed.contains('m/s')) return 'm/s'; + return ''; + } + + String get formattedTime { + return '${timestamp.hour.toString().padLeft(2, '0')}:${timestamp.minute.toString().padLeft(2, '0')}:${timestamp.second.toString().padLeft(2, '0')}'; + } + + String get formattedDate { + return '${timestamp.year}-${timestamp.month.toString().padLeft(2, '0')}-${timestamp.day.toString().padLeft(2, '0')}'; + } + + String get relativeTime { + final now = DateTime.now(); + final difference = now.difference(timestamp); + + if (difference.inMinutes < 1) { + return '刚刚'; + } else if (difference.inHours < 1) { + return '${difference.inMinutes}分钟前'; + } else if (difference.inDays < 1) { + return '${difference.inHours}小时前'; + } else if (difference.inDays < 7) { + return '${difference.inDays}天前'; + } else { + return formattedDate; + } + } + + String get rssiDescription { + if (rssi > -50) return '强'; + if (rssi > -70) return '中'; + if (rssi > -90) return '弱'; + return '无信号'; + } + + Color get rssiColor { + if (rssi > -50) return Colors.green; + if (rssi > -70) return Colors.orange; + if (rssi > -90) return Colors.red; + return Colors.grey; + } + + Map toMap() { + return { + 'uniqueId': uniqueId, + 'timestamp': timestamp.millisecondsSinceEpoch, + 'receivedTimestamp': receivedTimestamp.millisecondsSinceEpoch, + 'train': train, + 'direction': direction, + 'speed': speed, + 'position': position, + 'time': time, + 'loco': loco, + 'locoType': locoType, + 'lbjClass': lbjClass, + 'route': route, + 'positionInfo': positionInfo, + 'rssi': rssi, + }; + } + + Map getCoordinates() { + final parts = position.split(','); + if (parts.length >= 2) { + try { + final lat = double.parse(parts[0].trim()); + final lng = double.parse(parts[1].trim()); + return {'lat': lat, 'lng': lng}; + } catch (e) { + return {'lat': 0.0, 'lng': 0.0}; + } + } + return {'lat': 0.0, 'lng': 0.0}; + } + + TrainRecord copyWith({ + String? uniqueId, + DateTime? timestamp, + DateTime? receivedTimestamp, + String? train, + int? direction, + String? speed, + String? position, + String? time, + String? loco, + String? locoType, + String? lbjClass, + String? route, + String? positionInfo, + double? rssi, + }) { + return TrainRecord( + uniqueId: uniqueId ?? this.uniqueId, + timestamp: timestamp ?? this.timestamp, + receivedTimestamp: receivedTimestamp ?? this.receivedTimestamp, + train: train ?? this.train, + direction: direction ?? this.direction, + speed: speed ?? this.speed, + position: position ?? this.position, + time: time ?? this.time, + loco: loco ?? this.loco, + locoType: locoType ?? this.locoType, + lbjClass: lbjClass ?? this.lbjClass, + route: route ?? this.route, + positionInfo: positionInfo ?? this.positionInfo, + rssi: rssi ?? this.rssi, + ); + } + + @override + String toString() { + return 'TrainRecord(uniqueId: $uniqueId, train: $train, direction: $direction, speed: $speed, position: $position)'; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + return other is TrainRecord && other.uniqueId == uniqueId; + } + + @override + int get hashCode => uniqueId.hashCode; +} diff --git a/lib/screens/history_screen.dart b/lib/screens/history_screen.dart new file mode 100644 index 0000000..a9eee7f --- /dev/null +++ b/lib/screens/history_screen.dart @@ -0,0 +1,566 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:lbjconsole/models/merged_record.dart'; +import 'package:lbjconsole/services/database_service.dart'; +import 'package:lbjconsole/models/train_record.dart'; +import 'package:lbjconsole/services/merge_service.dart'; + +class HistoryScreen extends StatefulWidget { + final Function(bool isEditing) onEditModeChanged; + final Function() onSelectionChanged; + + const HistoryScreen({ + super.key, + required this.onEditModeChanged, + required this.onSelectionChanged, + }); + + @override + HistoryScreenState createState() => HistoryScreenState(); +} + +class HistoryScreenState extends State { + final List _displayItems = []; + bool _isLoading = true; + bool _isEditMode = false; + final Set _selectedRecords = {}; + final Map _expandedStates = {}; + final ScrollController _scrollController = ScrollController(); + bool _isAtTop = true; + MergeSettings _mergeSettings = MergeSettings(); + + int getSelectedCount() => _selectedRecords.length; + Set getSelectedRecordIds() => _selectedRecords; + List getDisplayItems() => _displayItems; + void clearSelection() => setState(() => _selectedRecords.clear()); + + void setEditMode(bool isEditing) { + setState(() { + _isEditMode = isEditing; + widget.onEditModeChanged(isEditing); + if (!isEditing) { + _selectedRecords.clear(); + } + }); + } + + @override + void initState() { + super.initState(); + loadRecords(); + _scrollController.addListener(() { + if (_scrollController.position.atEdge) { + if (_scrollController.position.pixels == 0) { + if (!_isAtTop) setState(() => _isAtTop = true); + } + } else { + if (_isAtTop) setState(() => _isAtTop = false); + } + }); + } + + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + + Future loadRecords({bool scrollToTop = true}) async { + if (mounted) setState(() => _isLoading = true); + try { + final allRecords = await DatabaseService.instance.getAllRecords(); + final settingsMap = await DatabaseService.instance.getAllSettings() ?? {}; + _mergeSettings = MergeSettings.fromMap(settingsMap); + final items = MergeService.getMixedList(allRecords, _mergeSettings); + + if (mounted) { + setState(() { + _displayItems.clear(); + _displayItems.addAll(items); + _isLoading = false; + }); + if (scrollToTop && (_isAtTop) && _scrollController.hasClients) { + _scrollController.animateTo(0.0, + duration: const Duration(milliseconds: 300), + curve: Curves.easeOut); + } + } + } catch (e) { + if (mounted) setState(() => _isLoading = false); + } + } + + @override + Widget build(BuildContext context) { + if (_isLoading) { + return const Center(child: CircularProgressIndicator()); + } + if (_displayItems.isEmpty) { + return const Center( + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + Icon(Icons.history, size: 64, color: Colors.grey), + SizedBox(height: 16), + Text('暂无记录', style: TextStyle(color: Colors.white, fontSize: 18)) + ])); + } + return ListView.builder( + controller: _scrollController, + padding: const EdgeInsets.all(16.0), + itemCount: _displayItems.length, + itemBuilder: (context, index) { + final item = _displayItems[index]; + if (item is MergedTrainRecord) { + return _buildMergedRecordCard(item); + } else if (item is TrainRecord) { + return _buildRecordCard(item); + } + return const SizedBox.shrink(); + }); + } + + Widget _buildMergedRecordCard(MergedTrainRecord mergedRecord) { + final bool isSelected = + mergedRecord.records.any((r) => _selectedRecords.contains(r.uniqueId)); + final isExpanded = _expandedStates[mergedRecord.groupKey] ?? false; + return Card( + color: isSelected && _isEditMode + ? const Color(0xFF2E2E2E) + : const Color(0xFF1E1E1E), + elevation: 1, + margin: const EdgeInsets.only(bottom: 8.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + side: BorderSide( + color: isSelected && _isEditMode + ? Colors.blue + : Colors.transparent, + width: 2.0)), + child: InkWell( + borderRadius: BorderRadius.circular(8.0), + onTap: () { + if (_isEditMode) { + setState(() { + final allIdsInGroup = + mergedRecord.records.map((r) => r.uniqueId).toSet(); + if (isSelected) { + _selectedRecords.removeAll(allIdsInGroup); + } else { + _selectedRecords.addAll(allIdsInGroup); + } + widget.onSelectionChanged(); + }); + } else { + setState( + () => _expandedStates[mergedRecord.groupKey] = !isExpanded); + } + }, + onLongPress: () { + if (!_isEditMode) setEditMode(true); + setState(() { + final allIdsInGroup = + mergedRecord.records.map((r) => r.uniqueId).toSet(); + _selectedRecords.addAll(allIdsInGroup); + widget.onSelectionChanged(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildRecordHeader(mergedRecord.latestRecord, + isMerged: true), + _buildPositionAndSpeed(mergedRecord.latestRecord), + _buildLocoInfo(mergedRecord.latestRecord), + if (isExpanded) _buildMergedExpandedContent(mergedRecord) + ])))); + } + + Widget _buildMergedExpandedContent(MergedTrainRecord mergedRecord) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildExpandedMapForAll(mergedRecord.records), + const Divider(color: Colors.white24, height: 24), + ...mergedRecord.records.map((record) => _buildSubRecordItem( + record, mergedRecord.latestRecord, _mergeSettings.groupBy)), + ], + ); + } + + Widget _buildSubRecordItem( + TrainRecord record, TrainRecord latest, GroupBy groupBy) { + String differingInfo = _getDifferingInfo(record, latest, groupBy); + String locationInfo = _getLocationInfo(record); + + return Padding( + padding: const EdgeInsets.only(bottom: 8.0, top: 4.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + record.receivedTimestamp.toString().split('.')[0], + style: const TextStyle(color: Colors.grey, fontSize: 12), + ), + if (differingInfo.isNotEmpty) + Text( + differingInfo, + style: + const TextStyle(color: Color(0xFF81D4FA), fontSize: 12), + ), + ], + ), + const SizedBox(height: 4), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Text( + locationInfo, + style: const TextStyle(color: Colors.white70, fontSize: 14), + overflow: TextOverflow.ellipsis, + ), + ), + Text( + record.speed.isNotEmpty ? "${record.speed} km/h" : "", + style: const TextStyle(color: Colors.white70, fontSize: 14), + ), + ], + ), + ], + ), + ); + } + + String _getDifferingInfo( + TrainRecord record, TrainRecord latest, GroupBy groupBy) { + final train = record.train.trim(); + final loco = record.loco.trim(); + final latestTrain = latest.train.trim(); + final latestLoco = latest.loco.trim(); + + switch (groupBy) { + case GroupBy.trainOnly: + return loco != latestLoco && loco.isNotEmpty ? "机车: $loco" : ""; + case GroupBy.locoOnly: + return train != latestTrain && train.isNotEmpty ? "车次: $train" : ""; + case GroupBy.trainOrLoco: + if (train.isNotEmpty && train != latestTrain) return "车次: $train"; + if (loco.isNotEmpty && loco != latestLoco) return "机车: $loco"; + return ""; + case GroupBy.trainAndLoco: + return ""; + } + } + + String _getLocationInfo(TrainRecord record) { + List parts = []; + if (record.route.isNotEmpty && record.route != "") + parts.add(record.route); + if (record.direction != 0) parts.add(record.direction == 1 ? "下" : "上"); + if (record.position.isNotEmpty && record.position != "") + parts.add("${record.position}K"); + return parts.join(' '); + } + + Widget _buildExpandedMapForAll(List records) { + final positions = records + .map((record) => _parsePosition(record.positionInfo)) + .whereType() + .toList(); + if (positions.isEmpty) return const SizedBox.shrink(); + final bounds = LatLngBounds.fromPoints(positions); + return Column(children: [ + const SizedBox(height: 8), + Container( + height: 220, + margin: const EdgeInsets.symmetric(vertical: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), color: Colors.grey[900]), + child: FlutterMap( + options: MapOptions( + initialCenter: bounds.center, + initialZoom: 10, + minZoom: 5, + maxZoom: 18, + cameraConstraint: CameraConstraint.contain(bounds: bounds)), + children: [ + TileLayer( + urlTemplate: + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'org.noxylva.lbjconsole'), + MarkerLayer( + markers: positions + .map((pos) => Marker( + point: pos, + width: 40, + height: 40, + child: Container( + decoration: BoxDecoration( + color: Colors.red.withOpacity(0.8), + shape: BoxShape.circle, + border: Border.all( + color: Colors.white, width: 2)), + child: const Icon(Icons.train, + color: Colors.white, size: 20)))) + .toList()) + ])) + ]); + } + + Widget _buildRecordCard(TrainRecord record, {bool isSubCard = false}) { + final isSelected = _selectedRecords.contains(record.uniqueId); + final isExpanded = + !isSubCard && (_expandedStates[record.uniqueId] ?? false); + return Card( + color: isSelected && _isEditMode + ? const Color(0xFF2E2E2E) + : const Color(0xFF1E1E1E), + elevation: isSubCard ? 0 : 1, + margin: EdgeInsets.only(bottom: isSubCard ? 4.0 : 8.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + side: BorderSide( + color: isSelected && _isEditMode + ? Colors.blue + : Colors.transparent, + width: 2.0)), + child: InkWell( + borderRadius: BorderRadius.circular(8.0), + onTap: () { + if (_isEditMode) { + setState(() { + if (isSelected) { + _selectedRecords.remove(record.uniqueId); + } else { + _selectedRecords.add(record.uniqueId); + } + widget.onSelectionChanged(); + }); + } else if (!isSubCard) { + setState(() => _expandedStates[record.uniqueId] = !isExpanded); + } + }, + onLongPress: () { + if (!_isEditMode) setEditMode(true); + setState(() { + _selectedRecords.add(record.uniqueId); + widget.onSelectionChanged(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildRecordHeader(record), + _buildPositionAndSpeed(record), + _buildLocoInfo(record), + if (isExpanded) _buildExpandedContent(record) + ])))); + } + + Widget _buildRecordHeader(TrainRecord record, {bool isMerged = false}) { + final trainType = record.trainType; + final trainDisplay = + record.fullTrainNumber.isEmpty ? "未知列车" : record.fullTrainNumber; + String formattedLocoInfo = ""; + if (record.locoType.isNotEmpty && record.loco.isNotEmpty) { + final shortLoco = record.loco.length > 5 + ? record.loco.substring(record.loco.length - 5) + : record.loco; + formattedLocoInfo = "${record.locoType}-$shortLoco"; + } else if (record.locoType.isNotEmpty) { + formattedLocoInfo = record.locoType; + } else if (record.loco.isNotEmpty) { + formattedLocoInfo = record.loco; + } + return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Flexible( + child: Text( + (record.time == "" || record.time.isEmpty) + ? record.receivedTimestamp.toString().split(".")[0] + : record.time.split("\n")[0], + style: const TextStyle(fontSize: 12, color: Colors.grey), + overflow: TextOverflow.ellipsis)), + if (trainType.isNotEmpty) + Flexible( + child: Text(trainType, + style: const TextStyle(fontSize: 12, color: Colors.grey), + overflow: TextOverflow.ellipsis)) + ]), + const SizedBox(height: 2), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Flexible( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Flexible( + child: Text(trainDisplay, + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.white), + overflow: TextOverflow.ellipsis)), + const SizedBox(width: 6), + if (record.direction == 1 || record.direction == 3) + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(2)), + child: Center( + child: Text(record.direction == 1 ? "下" : "上", + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.black)))) + ])), + if (formattedLocoInfo.isNotEmpty && formattedLocoInfo != "") + Text(formattedLocoInfo, + style: const TextStyle(fontSize: 14, color: Colors.white70)) + ]), + const SizedBox(height: 2) + ]); + } + + Widget _buildLocoInfo(TrainRecord record) { + final locoInfo = record.locoInfo; + if (locoInfo == null || locoInfo.isEmpty) return const SizedBox.shrink(); + return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + const SizedBox(height: 4), + Text(locoInfo, + style: const TextStyle(fontSize: 14, color: Colors.white), + maxLines: 1, + overflow: TextOverflow.ellipsis) + ]); + } + + Widget _buildPositionAndSpeed(TrainRecord record) { + final routeStr = record.route.trim(); + final position = record.position.trim(); + final speed = record.speed.trim(); + final isValidRoute = routeStr.isNotEmpty && + !routeStr.runes.every((r) => r == '*'.runes.first); + final isValidPosition = position.isNotEmpty && + !position.runes + .every((r) => r == '-'.runes.first || r == '.'.runes.first) && + position != ""; + final isValidSpeed = speed.isNotEmpty && + !speed.runes + .every((r) => r == '*'.runes.first || r == '-'.runes.first) && + speed != "NUL" && + speed != ""; + if (!isValidRoute && !isValidPosition && !isValidSpeed) + return const SizedBox.shrink(); + return Padding( + padding: const EdgeInsets.only(top: 4.0), + child: + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + if (isValidRoute || isValidPosition) + Expanded( + child: Row(children: [ + if (isValidRoute) + Flexible( + child: Text(routeStr, + style: + const TextStyle(fontSize: 16, color: Colors.white), + overflow: TextOverflow.ellipsis)), + if (isValidRoute && isValidPosition) const SizedBox(width: 4), + if (isValidPosition) + Flexible( + child: Text("$position K", + style: + const TextStyle(fontSize: 16, color: Colors.white), + overflow: TextOverflow.ellipsis)) + ])), + if (isValidSpeed) + Text("$speed km/h", + style: const TextStyle(fontSize: 16, color: Colors.white), + textAlign: TextAlign.right) + ])); + } + + Widget _buildExpandedContent(TrainRecord record) { + final position = _parsePosition(record.positionInfo); + return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + if (position != null) + Column(children: [ + const SizedBox(height: 8), + Container( + height: 220, + margin: const EdgeInsets.symmetric(vertical: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.grey[900]), + child: FlutterMap( + options: + MapOptions(initialCenter: position, initialZoom: 15.0), + children: [ + TileLayer( + urlTemplate: + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'org.noxylva.lbjconsole'), + MarkerLayer(markers: [ + Marker( + point: position, + width: 40, + height: 40, + child: Container( + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Colors.white, width: 2)), + child: const Icon(Icons.train, + color: Colors.white, size: 20))) + ]) + ])) + ]) + ]); + } + + LatLng? _parsePosition(String? positionInfo) { + if (positionInfo == null || positionInfo.isEmpty || positionInfo == '') + return null; + try { + final parts = positionInfo.trim().split(RegExp(r'\s+')); + if (parts.length >= 2) { + final lat = _parseDmsCoordinate(parts[0]); + final lng = _parseDmsCoordinate(parts[1]); + if (lat != null && + lng != null && + (lat.abs() > 0.001 || lng.abs() > 0.001)) { + return LatLng(lat, lng); + } + } + } catch (e) {} + return null; + } + + double? _parseDmsCoordinate(String dmsStr) { + try { + final degreeIndex = dmsStr.indexOf('°'); + if (degreeIndex == -1) return null; + final degrees = double.tryParse(dmsStr.substring(0, degreeIndex)); + if (degrees == null) return null; + final minuteIndex = dmsStr.indexOf('′'); + if (minuteIndex == -1) return degrees; + final minutes = + double.tryParse(dmsStr.substring(degreeIndex + 1, minuteIndex)); + if (minutes == null) return degrees; + return degrees + (minutes / 60.0); + } catch (e) { + return null; + } + } +} diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart new file mode 100644 index 0000000..e23b831 --- /dev/null +++ b/lib/screens/main_screen.dart @@ -0,0 +1,398 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'dart:async'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:lbjconsole/models/merged_record.dart'; +import 'package:lbjconsole/models/train_record.dart'; +import 'package:lbjconsole/screens/history_screen.dart'; +import 'package:lbjconsole/screens/map_screen.dart'; +import 'package:lbjconsole/screens/settings_screen.dart'; +import 'package:lbjconsole/services/ble_service.dart'; +import 'package:lbjconsole/services/database_service.dart'; +import 'package:lbjconsole/services/notification_service.dart'; +import 'package:lbjconsole/themes/app_theme.dart'; + +class MainScreen extends StatefulWidget { + const MainScreen({super.key}); + + @override + State createState() => _MainScreenState(); +} + +class _MainScreenState extends State with WidgetsBindingObserver { + int _currentIndex = 0; + + late final BLEService _bleService; + final NotificationService _notificationService = NotificationService(); + + StreamSubscription? _connectionSubscription; + StreamSubscription? _dataSubscription; + + bool _isHistoryEditMode = false; + final GlobalKey _historyScreenKey = + GlobalKey(); + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + _bleService = BLEService(); + _bleService.initialize(); + _initializeServices(); + } + + @override + void dispose() { + _connectionSubscription?.cancel(); + _dataSubscription?.cancel(); + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (state == AppLifecycleState.resumed) { + _bleService.onAppResume(); + } + } + + Future _initializeServices() async { + await _notificationService.initialize(); + + _connectionSubscription = _bleService.connectionStream.listen((_) { + if (mounted) setState(() {}); + }); + + _dataSubscription = _bleService.dataStream.listen((record) { + _notificationService.showTrainNotification(record); + if (_historyScreenKey.currentState != null) { + _historyScreenKey.currentState!.loadRecords(scrollToTop: true); + } + }); + } + + void _showConnectionDialog() { + _bleService.setAutoConnectBlocked(true); + showDialog( + context: context, + barrierDismissible: true, + builder: (context) => + _PixelPerfectBluetoothDialog(bleService: _bleService), + ).then((_) { + _bleService.setAutoConnectBlocked(false); + if (!_bleService.isManualDisconnect) { + _bleService.ensureConnection(); + } + }); + } + + AppBar _buildAppBar(BuildContext context) { + final historyState = _historyScreenKey.currentState; + final selectedCount = historyState?.getSelectedCount() ?? 0; + + if (_currentIndex == 0 && _isHistoryEditMode) { + return AppBar( + backgroundColor: Theme.of(context).primaryColor, + leading: IconButton( + icon: const Icon(Icons.close, color: Colors.white), + onPressed: _handleHistoryCancelSelection, + ), + title: Text( + '已选择 $selectedCount 项', + style: const TextStyle(color: Colors.white, fontSize: 18), + ), + actions: [ + IconButton( + icon: const Icon(Icons.delete, color: Colors.white), + onPressed: selectedCount > 0 ? _handleHistoryDeleteSelected : null, + ), + ], + ); + } + + return AppBar( + backgroundColor: AppTheme.primaryBlack, + elevation: 0, + title: Text( + ['列车记录', '位置地图', '设置'][_currentIndex], + style: const TextStyle( + color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), + ), + centerTitle: false, + actions: [ + Row( + children: [ + Container( + width: 8, + height: 8, + decoration: BoxDecoration( + color: _bleService.isConnected ? Colors.green : Colors.red, + shape: BoxShape.circle, + ), + ), + const SizedBox(width: 8), + Text(_bleService.deviceStatus, + style: const TextStyle(color: Colors.white70)), + IconButton( + icon: const Icon(Icons.bluetooth, color: Colors.white), + onPressed: _showConnectionDialog, + ), + ], + ), + ], + ); + } + + void _handleHistoryEditModeChanged(bool isEditing) { + setState(() { + _isHistoryEditMode = isEditing; + if (!isEditing) { + _historyScreenKey.currentState?.clearSelection(); + } + }); + } + + void _handleSelectionChanged() { + if (_isHistoryEditMode && + (_historyScreenKey.currentState?.getSelectedCount() ?? 0) == 0) { + _handleHistoryCancelSelection(); + } else { + setState(() {}); + } + } + + void _handleHistoryCancelSelection() { + _historyScreenKey.currentState?.setEditMode(false); + } + + Future _handleHistoryDeleteSelected() async { + final historyState = _historyScreenKey.currentState; + if (historyState == null || historyState.getSelectedCount() == 0) return; + + final confirmed = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('确认删除'), + content: Text('确定要删除选中的 ${historyState.getSelectedCount()} 条记录吗?'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('取消')), + ElevatedButton( + onPressed: () => Navigator.pop(context, true), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, foregroundColor: Colors.white), + child: const Text('删除'), + ), + ], + ), + ); + + if (confirmed == true) { + final idsToDelete = historyState.getSelectedRecordIds().toList(); + await DatabaseService.instance.deleteRecords(idsToDelete); + + historyState.setEditMode(false); + + historyState.loadRecords(scrollToTop: false); + } + } + + @override + Widget build(BuildContext context) { + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + systemNavigationBarColor: AppTheme.primaryBlack, + statusBarIconBrightness: Brightness.light, + systemNavigationBarIconBrightness: Brightness.light, + )); + + final pages = [ + HistoryScreen( + key: _historyScreenKey, + onEditModeChanged: _handleHistoryEditModeChanged, + onSelectionChanged: _handleSelectionChanged, + ), + const MapScreen(), + const SettingsScreen(), + ]; + + return Scaffold( + backgroundColor: AppTheme.primaryBlack, + appBar: _buildAppBar(context), + body: IndexedStack( + index: _currentIndex, + children: pages, + ), + bottomNavigationBar: NavigationBar( + backgroundColor: AppTheme.secondaryBlack, + indicatorColor: AppTheme.accentBlue.withOpacity(0.2), + selectedIndex: _currentIndex, + onDestinationSelected: (index) { + if (_currentIndex == 2 && index == 0) { + _historyScreenKey.currentState?.loadRecords(); + } + setState(() { + if (_isHistoryEditMode) _isHistoryEditMode = false; + _currentIndex = index; + }); + }, + destinations: const [ + NavigationDestination( + icon: Icon(Icons.directions_railway), label: '列车记录'), + NavigationDestination(icon: Icon(Icons.location_on), label: '位置地图'), + NavigationDestination(icon: Icon(Icons.settings), label: '设置'), + ], + ), + ); + } +} + +enum _ScanState { initial, scanning, finished } + +class _PixelPerfectBluetoothDialog extends StatefulWidget { + final BLEService bleService; + const _PixelPerfectBluetoothDialog({required this.bleService}); + @override + State<_PixelPerfectBluetoothDialog> createState() => + _PixelPerfectBluetoothDialogState(); +} + +class _PixelPerfectBluetoothDialogState + extends State<_PixelPerfectBluetoothDialog> { + List _devices = []; + _ScanState _scanState = _ScanState.initial; + StreamSubscription? _connectionSubscription; + @override + void initState() { + super.initState(); + _connectionSubscription = widget.bleService.connectionStream.listen((_) { + if (mounted) setState(() {}); + }); + if (!widget.bleService.isConnected) { + _startScan(); + } + } + + @override + void dispose() { + _connectionSubscription?.cancel(); + super.dispose(); + } + + Future _startScan() async { + if (_scanState == _ScanState.scanning) return; + if (mounted) + setState(() { + _devices.clear(); + _scanState = _ScanState.scanning; + }); + await widget.bleService.startScan( + timeout: const Duration(seconds: 8), + onScanResults: (devices) { + if (mounted) setState(() => _devices = devices); + }, + ); + if (mounted) setState(() => _scanState = _ScanState.finished); + } + + Future _connectToDevice(BluetoothDevice device) async { + Navigator.pop(context); + await widget.bleService.connectManually(device); + } + + Future _disconnect() async { + Navigator.pop(context); + await widget.bleService.disconnect(); + } + + @override + Widget build(BuildContext context) { + final isConnected = widget.bleService.isConnected; + return AlertDialog( + title: const Text('蓝牙设备'), + content: SizedBox( + width: double.maxFinite, + child: SingleChildScrollView( + child: isConnected + ? _buildConnectedView(context, widget.bleService.connectedDevice) + : _buildDisconnectedView(context), + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: const Text('关闭'), + ), + ], + ); + } + + Widget _buildConnectedView(BuildContext context, BluetoothDevice? device) { + return Column(mainAxisSize: MainAxisSize.min, children: [ + const Icon(Icons.bluetooth_connected, size: 48, color: Colors.green), + const SizedBox(height: 16), + Text('设备已连接', + style: Theme.of(context) + .textTheme + .titleMedium + ?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 4), + Text(device?.platformName ?? '未知设备', textAlign: TextAlign.center), + Text(device?.remoteId.str ?? '', + style: Theme.of(context).textTheme.bodySmall, + textAlign: TextAlign.center), + const SizedBox(height: 16), + ElevatedButton.icon( + onPressed: _disconnect, + icon: const Icon(Icons.bluetooth_disabled), + label: const Text('断开连接'), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, foregroundColor: Colors.white)) + ]); + } + + Widget _buildDisconnectedView(BuildContext context) { + return Column(mainAxisSize: MainAxisSize.min, children: [ + ElevatedButton.icon( + onPressed: _scanState == _ScanState.scanning ? null : _startScan, + icon: _scanState == _ScanState.scanning + ? const SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator( + strokeWidth: 2, color: Colors.white)) + : const Icon(Icons.search), + label: Text(_scanState == _ScanState.scanning ? '扫描中...' : '扫描设备'), + style: ElevatedButton.styleFrom( + minimumSize: const Size(double.infinity, 40))), + const SizedBox(height: 16), + if (_scanState == _ScanState.finished && _devices.isNotEmpty) + _buildDeviceListView() + ]); + } + + Widget _buildDeviceListView() { + return SizedBox( + height: 200, + child: ListView.builder( + shrinkWrap: true, + itemCount: _devices.length, + itemBuilder: (context, index) { + final device = _devices[index]; + return Card( + margin: const EdgeInsets.symmetric(vertical: 4), + child: ListTile( + leading: const Icon(Icons.bluetooth), + title: Text(device.platformName.isNotEmpty + ? device.platformName + : '未知设备'), + subtitle: Text(device.remoteId.str), + onTap: () => _connectToDevice(device), + ), + ); + }, + ), + ); + } +} diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart new file mode 100644 index 0000000..7c2110f --- /dev/null +++ b/lib/screens/map_screen.dart @@ -0,0 +1,640 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:lbjconsole/services/database_service.dart'; +import 'package:lbjconsole/models/train_record.dart'; + +class MapScreen extends StatefulWidget { + const MapScreen({super.key}); + + @override + State createState() => _MapScreenState(); +} + +class _MapScreenState extends State { + final MapController _mapController = MapController(); + final List _trainRecords = []; + bool _isLoading = true; + bool _railwayLayerVisible = true; + LatLng? _currentLocation; + LatLng? _lastTrainLocation; + LatLng? _userLocation; + double _currentZoom = 12.0; + double _currentRotation = 0.0; + + bool _isMapInitialized = false; + bool _isFollowingLocation = false; + bool _isLocationPermissionGranted = false; + + static const LatLng _defaultPosition = LatLng(39.9042, 116.4074); + + @override + void initState() { + super.initState(); + _initializeMap(); + _loadTrainRecords(); + _loadSettings(); + _requestLocationPermission(); + } + + @override + void dispose() { + _saveSettings(); + super.dispose(); + } + + Future _initializeMap() async {} + + Future _requestLocationPermission() async { + bool serviceEnabled = await Geolocator.isLocationServiceEnabled(); + if (!serviceEnabled) { + return; + } + + LocationPermission permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + } + + if (permission == LocationPermission.deniedForever) { + return; + } + + setState(() { + _isLocationPermissionGranted = true; + }); + + _getCurrentLocation(); + } + + Future _getCurrentLocation() async { + try { + Position position = await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.high, + ); + + setState(() { + _userLocation = LatLng(position.latitude, position.longitude); + }); + + if (!_isMapInitialized && _userLocation != null) { + _mapController.move(_userLocation!, _currentZoom); + } + } catch (e) {} + } + + Future _loadSettings() async { + try { + final settings = await DatabaseService.instance.getAllSettings(); + if (settings != null) { + setState(() { + _railwayLayerVisible = + (settings['mapRailwayLayerVisible'] as int?) == 1; + _currentZoom = (settings['mapZoomLevel'] as num?)?.toDouble() ?? 10.0; + _currentRotation = + (settings['mapRotation'] as num?)?.toDouble() ?? 0.0; + + final lat = (settings['mapCenterLat'] as num?)?.toDouble(); + final lon = (settings['mapCenterLon'] as num?)?.toDouble(); + + if (lat != null && lon != null) { + _currentLocation = LatLng(lat, lon); + } + }); + } + } catch (e) {} + } + + Future _saveSettings() async { + try { + final center = _mapController.camera.center; + await DatabaseService.instance.updateSettings({ + 'mapRailwayLayerVisible': _railwayLayerVisible ? 1 : 0, + 'mapZoomLevel': _currentZoom, + 'mapCenterLat': center.latitude, + 'mapCenterLon': center.longitude, + 'mapRotation': _currentRotation, + }); + } catch (e) {} + } + + Future _loadTrainRecords() async { + setState(() => _isLoading = true); + try { + final records = await DatabaseService.instance.getAllRecords(); + setState(() { + _trainRecords.clear(); + _trainRecords.addAll(records); + _isLoading = false; + + if (_trainRecords.isNotEmpty) { + final lastRecord = _trainRecords.first; + final coords = lastRecord.getCoordinates(); + final dmsCoords = _parseDmsCoordinate(lastRecord.positionInfo); + + if (dmsCoords != null) { + _lastTrainLocation = dmsCoords; + } else if (coords['lat'] != 0.0 && coords['lng'] != 0.0) { + _lastTrainLocation = LatLng(coords['lat']!, coords['lng']!); + } + } + + _initializeMapPosition(); + }); + } catch (e) { + setState(() => _isLoading = false); + } + } + + void _initializeMapPosition() { + if (_isMapInitialized) return; + + LatLng? targetLocation; + + if (_currentLocation != null) { + targetLocation = _currentLocation; + } else if (_userLocation != null) { + targetLocation = _userLocation; + } else if (_lastTrainLocation != null) { + targetLocation = _lastTrainLocation; + } else { + targetLocation = _defaultPosition; + } + + WidgetsBinding.instance.addPostFrameCallback((_) { + _centerMap(targetLocation!, zoom: _currentZoom); + _isMapInitialized = true; + }); + } + + void _centerMap(LatLng location, {double? zoom}) { + _mapController.move(location, zoom ?? _currentZoom); + } + + LatLng? _parseDmsCoordinate(String? positionInfo) { + if (positionInfo == null || + positionInfo.isEmpty || + positionInfo == '') { + return null; + } + + try { + final parts = positionInfo.trim().split(' '); + if (parts.length >= 2) { + final latStr = parts[0]; + final lngStr = parts[1]; + + final lat = _parseDmsString(latStr); + final lng = _parseDmsString(lngStr); + + if (lat != null && + lng != null && + (lat.abs() > 0.001 || lng.abs() > 0.001)) { + return LatLng(lat, lng); + } + } + } catch (e) { + print('解析DMS坐标失败: $e'); + } + + return null; + } + + double? _parseDmsString(String dmsStr) { + try { + final degreeIndex = dmsStr.indexOf('°'); + if (degreeIndex == -1) return null; + + final degrees = double.tryParse(dmsStr.substring(0, degreeIndex)); + if (degrees == null) return null; + + final minuteIndex = dmsStr.indexOf('′'); + if (minuteIndex == -1) return degrees; + + final minutes = + double.tryParse(dmsStr.substring(degreeIndex + 1, minuteIndex)); + if (minutes == null) return degrees; + + return degrees + (minutes / 60.0); + } catch (e) { + return null; + } + } + + List _getValidRecords() { + return _trainRecords.where((record) { + final coords = record.getCoordinates(); + return coords['lat'] != 0.0 && coords['lng'] != 0.0; + }).toList(); + } + + List _getValidDmsRecords() { + return _trainRecords.where((record) { + return _parseDmsCoordinate(record.positionInfo) != null; + }).toList(); + } + + List _buildTrainMarkers() { + final markers = []; + final validRecords = [..._getValidRecords(), ..._getValidDmsRecords()]; + + for (final record in validRecords) { + LatLng? position; + + final dmsPosition = _parseDmsCoordinate(record.positionInfo); + if (dmsPosition != null) { + position = dmsPosition; + } else { + final coords = record.getCoordinates(); + if (coords['lat'] != 0.0 && coords['lng'] != 0.0) { + position = LatLng(coords['lat']!, coords['lng']!); + } + } + + if (position != null) { + final trainDisplay = + record.fullTrainNumber.isEmpty ? "未知列车" : record.fullTrainNumber; + + markers.add( + Marker( + point: position, + width: 80, + height: 60, + child: GestureDetector( + onTap: () => position != null + ? _showTrainDetailsDialog(record, position) + : null, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(18), + border: Border.all(color: Colors.white, width: 2), + ), + child: const Icon( + Icons.train, + color: Colors.white, + size: 18, + ), + ), + const SizedBox(height: 2), + Container( + padding: + const EdgeInsets.symmetric(horizontal: 4, vertical: 1), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.7), + borderRadius: BorderRadius.circular(2), + ), + child: Text( + trainDisplay, + style: const TextStyle( + color: Colors.white, + fontSize: 10, + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ], + ), + ), + ), + ); + } + } + + return markers; + } + + void _centerToMyLocation() { + _centerMap(_lastTrainLocation ?? _defaultPosition, zoom: 15.0); + } + + void _centerToLastTrain() { + if (_trainRecords.isNotEmpty) { + final lastRecord = _trainRecords.first; + final coords = lastRecord.getCoordinates(); + final dmsCoords = _parseDmsCoordinate(lastRecord.positionInfo); + + LatLng? targetPosition; + if (dmsCoords != null) { + targetPosition = dmsCoords; + } else if (coords['lat'] != 0.0 && coords['lng'] != 0.0) { + targetPosition = LatLng(coords['lat']!, coords['lng']!); + } + + if (targetPosition != null) { + _centerMap(targetPosition, zoom: 15.0); + } + } + } + + void _showTrainDetailsDialog(TrainRecord record, LatLng position) { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(28)), + ), + builder: (context) { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + borderRadius: const BorderRadius.vertical(top: Radius.circular(28)), + ), + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 24, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + borderRadius: BorderRadius.circular(2), + ), + ), + const SizedBox(width: 12), + Expanded( + child: Text( + record.fullTrainNumber.isEmpty + ? "未知列车" + : record.fullTrainNumber, + style: + Theme.of(context).textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + const SizedBox(height: 16), + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .surfaceVariant + .withOpacity(0.3), + borderRadius: BorderRadius.circular(16), + ), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + _buildMaterial3DetailRow( + context, "时间", record.formattedTime), + _buildMaterial3DetailRow( + context, "日期", record.formattedDate), + _buildMaterial3DetailRow( + context, "类型", record.trainType), + _buildMaterial3DetailRow( + context, "速度", "${record.speed} km/h"), + _buildMaterial3DetailRow( + context, "位置", record.position), + _buildMaterial3DetailRow(context, "路线", record.route), + _buildMaterial3DetailRow( + context, "机车", "${record.locoType}-${record.loco}"), + _buildMaterial3DetailRow(context, "坐标", + "${position.latitude.toStringAsFixed(4)}, ${position.longitude.toStringAsFixed(4)}"), + ], + ), + ), + ), + const SizedBox(height: 24), + Row( + children: [ + Expanded( + child: FilledButton.tonal( + onPressed: () => Navigator.pop(context), + child: const Text('关闭'), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () { + Navigator.pop(context); + _centerMap(position, zoom: 17.0); + }, + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.my_location, size: 16), + SizedBox(width: 8), + Text('居中查看'), + ], + ), + ), + ), + ], + ), + ], + ), + ), + ); + }, + ); + } + + Widget _buildDetailRow(String label, String value) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 4.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 80, + child: Text( + label, + style: const TextStyle(color: Colors.grey, fontSize: 14), + ), + ), + Expanded( + child: Text( + value.isEmpty ? "未知" : value, + style: const TextStyle(color: Colors.white, fontSize: 14), + ), + ), + ], + ), + ); + } + + Widget _buildMaterial3DetailRow( + BuildContext context, String label, String value) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 60, + child: Text( + label, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + fontWeight: FontWeight.w500, + ), + ), + ), + Expanded( + child: Text( + value.isEmpty ? "未知" : value, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurface, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + final markers = _buildTrainMarkers(); + + if (_userLocation != null) { + markers.add( + Marker( + point: _userLocation!, + width: 40, + height: 40, + child: Container( + decoration: BoxDecoration( + color: Colors.blue, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + ), + child: const Icon( + Icons.my_location, + color: Colors.white, + size: 20, + ), + ), + ), + ); + } + + return Scaffold( + backgroundColor: const Color(0xFF121212), + body: Stack( + children: [ + FlutterMap( + mapController: _mapController, + options: MapOptions( + initialCenter: _lastTrainLocation ?? _defaultPosition, + initialZoom: _currentZoom, + initialRotation: _currentRotation, + minZoom: 4.0, + maxZoom: 18.0, + onPositionChanged: (MapCamera camera, bool hasGesture) { + if (hasGesture) { + setState(() { + _currentLocation = camera.center; + _currentZoom = camera.zoom; + _currentRotation = camera.rotation; + }); + _saveSettings(); + } + }, + onTap: (_, point) { + for (final record in _trainRecords) { + final coords = record.getCoordinates(); + final dmsCoords = _parseDmsCoordinate(record.positionInfo); + LatLng? recordPosition; + + if (dmsCoords != null) { + recordPosition = dmsCoords; + } else if (coords['lat'] != 0.0 && coords['lng'] != 0.0) { + recordPosition = LatLng(coords['lat']!, coords['lng']!); + } + + if (recordPosition != null) { + final distance = const Distance() + .as(LengthUnit.Meter, recordPosition, point); + if (distance < 50) { + _showTrainDetailsDialog(record, recordPosition); + break; + } + } + } + }, + ), + children: [ + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'org.noxylva.lbjconsole', + ), + if (_railwayLayerVisible) + TileLayer( + urlTemplate: + 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', + subdomains: const ['a', 'b', 'c'], + userAgentPackageName: 'org.noxylva.lbjconsole', + ), + MarkerLayer( + markers: markers, + ), + ], + ), + if (_isLoading) + const Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Color(0xFF007ACC)), + ), + ), + Positioned( + right: 16, + top: 40, + child: Column( + children: [ + FloatingActionButton.small( + heroTag: 'railwayLayer', + backgroundColor: const Color(0xFF1E1E1E), + onPressed: () { + setState(() { + _railwayLayerVisible = !_railwayLayerVisible; + }); + _saveSettings(); + }, + child: Icon( + _railwayLayerVisible ? Icons.layers : Icons.layers_outlined, + color: Colors.white, + ), + ), + const SizedBox(height: 8), + FloatingActionButton.small( + heroTag: 'myLocation', + backgroundColor: const Color(0xFF1E1E1E), + onPressed: () { + _getCurrentLocation(); + if (_userLocation != null) { + _centerMap(_userLocation!, zoom: 15.0); + } + }, + child: const Icon(Icons.my_location, color: Colors.white), + ), + const SizedBox(height: 8), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart new file mode 100644 index 0000000..fbbf30d --- /dev/null +++ b/lib/screens/settings_screen.dart @@ -0,0 +1,805 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; +import 'dart:io'; + +import 'package:lbjconsole/models/merged_record.dart'; +import 'package:lbjconsole/services/database_service.dart'; +import 'package:lbjconsole/services/ble_service.dart'; +import 'package:lbjconsole/themes/app_theme.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import 'package:file_picker/file_picker.dart'; +import 'package:path/path.dart' as path; +import 'package:path_provider/path_provider.dart'; +import 'package:package_info_plus/package_info_plus.dart'; + +class SettingsScreen extends StatefulWidget { + const SettingsScreen({super.key}); + + @override + State createState() => _SettingsScreenState(); +} + +class _SettingsScreenState extends State { + late DatabaseService _databaseService; + late TextEditingController _deviceNameController; + + String _deviceName = ''; + bool _backgroundServiceEnabled = false; + bool _notificationsEnabled = true; + int _recordCount = 0; + bool _mergeRecordsEnabled = false; + GroupBy _groupBy = GroupBy.trainAndLoco; + TimeWindow _timeWindow = TimeWindow.unlimited; + + @override + void initState() { + super.initState(); + _databaseService = DatabaseService.instance; + _deviceNameController = TextEditingController(); + _loadSettings(); + _loadRecordCount(); + } + + @override + void dispose() { + _deviceNameController.dispose(); + super.dispose(); + } + + Future _loadSettings() async { + final settingsMap = await _databaseService.getAllSettings() ?? {}; + final settings = MergeSettings.fromMap(settingsMap); + if (mounted) { + setState(() { + _deviceName = settingsMap['deviceName'] ?? 'LBJReceiver'; + _deviceNameController.text = _deviceName; + _backgroundServiceEnabled = + (settingsMap['backgroundServiceEnabled'] ?? 0) == 1; + _notificationsEnabled = (settingsMap['notificationEnabled'] ?? 1) == 1; + _mergeRecordsEnabled = settings.enabled; + _groupBy = settings.groupBy; + _timeWindow = settings.timeWindow; + }); + } + } + + Future _loadRecordCount() async { + final count = await _databaseService.getRecordCount(); + if (mounted) { + setState(() { + _recordCount = count; + }); + } + } + + Future _saveSettings() async { + await _databaseService.updateSettings({ + 'deviceName': _deviceName, + 'backgroundServiceEnabled': _backgroundServiceEnabled ? 1 : 0, + 'notificationEnabled': _notificationsEnabled ? 1 : 0, + 'mergeRecordsEnabled': _mergeRecordsEnabled ? 1 : 0, + 'groupBy': _groupBy.name, + 'timeWindow': _timeWindow.name, + }); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildBluetoothSettings(), + const SizedBox(height: 20), + _buildAppSettings(), + const SizedBox(height: 20), + _buildMergeSettings(), + const SizedBox(height: 20), + _buildDataManagement(), + const SizedBox(height: 20), + _buildAboutSection(), + ], + ), + ); + } + + Widget _buildBluetoothSettings() { + return Card( + color: AppTheme.tertiaryBlack, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.bluetooth, + color: Theme.of(context).colorScheme.primary), + const SizedBox(width: 12), + Text('蓝牙设备', style: AppTheme.titleMedium), + ], + ), + const SizedBox(height: 16), + TextField( + controller: _deviceNameController, + decoration: InputDecoration( + labelText: '设备名称 (用于自动连接)', + hintText: '输入设备名称', + labelStyle: const TextStyle(color: Colors.white70), + hintStyle: const TextStyle(color: Colors.white54), + border: OutlineInputBorder( + borderSide: const BorderSide(color: Colors.white54), + borderRadius: BorderRadius.circular(12.0), + ), + enabledBorder: OutlineInputBorder( + borderSide: const BorderSide(color: Colors.white54), + borderRadius: BorderRadius.circular(12.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).colorScheme.primary), + borderRadius: BorderRadius.circular(12.0), + ), + ), + style: const TextStyle(color: Colors.white), + onChanged: (value) { + setState(() { + _deviceName = value; + }); + _saveSettings(); + }, + ), + ], + ), + ), + ); + } + + Widget _buildAppSettings() { + return Card( + color: AppTheme.tertiaryBlack, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.settings, + color: Theme.of(context).colorScheme.primary), + const SizedBox(width: 12), + Text('应用设置', style: AppTheme.titleMedium), + ], + ), + const SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('后台保活服务', style: AppTheme.bodyLarge), + Text('保持应用在后台运行', style: AppTheme.caption), + ], + ), + Switch( + value: _backgroundServiceEnabled, + onChanged: (value) { + setState(() { + _backgroundServiceEnabled = value; + }); + _saveSettings(); + }, + activeColor: Theme.of(context).colorScheme.primary, + ), + ], + ), + const SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('LBJ消息通知', style: AppTheme.bodyLarge), + Text('接收LBJ消息通知', style: AppTheme.caption), + ], + ), + Switch( + value: _notificationsEnabled, + onChanged: (value) { + setState(() { + _notificationsEnabled = value; + }); + _saveSettings(); + }, + activeColor: Theme.of(context).colorScheme.primary, + ), + ], + ), + ], + ), + ), + ); + } + + Widget _buildMergeSettings() { + return Card( + color: AppTheme.tertiaryBlack, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.merge_type, + color: Theme.of(context).colorScheme.primary), + const SizedBox(width: 12), + Text('记录合并', style: AppTheme.titleMedium), + ], + ), + const SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('启用记录合并', style: AppTheme.bodyLarge), + Text('合并相同内容的LBJ记录', style: AppTheme.caption), + ], + ), + Switch( + value: _mergeRecordsEnabled, + onChanged: (value) { + setState(() { + _mergeRecordsEnabled = value; + }); + _saveSettings(); + }, + activeColor: Theme.of(context).colorScheme.primary, + ), + ], + ), + Visibility( + visible: _mergeRecordsEnabled, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 16), + Text('分组方式', style: AppTheme.bodyLarge), + const SizedBox(height: 8), + DropdownButtonFormField( + value: _groupBy, + items: [ + DropdownMenuItem( + value: GroupBy.trainOnly, + child: Text('仅车次号', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: GroupBy.locoOnly, + child: Text('仅机车号', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: GroupBy.trainOrLoco, + child: Text('车次号或机车号', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: GroupBy.trainAndLoco, + child: Text('车次号与机车号', style: AppTheme.bodyMedium)), + ], + onChanged: (value) { + if (value != null) { + setState(() { + _groupBy = value; + }); + _saveSettings(); + } + }, + decoration: InputDecoration( + filled: true, + fillColor: AppTheme.secondaryBlack, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide.none, + ), + ), + dropdownColor: AppTheme.secondaryBlack, + style: AppTheme.bodyMedium, + ), + const SizedBox(height: 16), + Text('时间窗口', style: AppTheme.bodyLarge), + const SizedBox(height: 8), + DropdownButtonFormField( + value: _timeWindow, + items: [ + DropdownMenuItem( + value: TimeWindow.oneHour, + child: Text('1小时内', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: TimeWindow.twoHours, + child: Text('2小时内', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: TimeWindow.sixHours, + child: Text('6小时内', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: TimeWindow.twelveHours, + child: Text('12小时内', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: TimeWindow.oneDay, + child: Text('24小时内', style: AppTheme.bodyMedium)), + DropdownMenuItem( + value: TimeWindow.unlimited, + child: Text('不限时间', style: AppTheme.bodyMedium)), + ], + onChanged: (value) { + if (value != null) { + setState(() { + _timeWindow = value; + }); + _saveSettings(); + } + }, + decoration: InputDecoration( + filled: true, + fillColor: AppTheme.secondaryBlack, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12.0), + borderSide: BorderSide.none, + ), + ), + dropdownColor: AppTheme.secondaryBlack, + style: AppTheme.bodyMedium, + ), + ], + ), + ), + ], + ), + ), + ); + } + + Widget _buildDataManagement() { + return Card( + color: AppTheme.tertiaryBlack, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.share, color: Theme.of(context).colorScheme.primary), + const SizedBox(width: 12), + Text('数据导出', style: AppTheme.titleMedium), + ], + ), + const SizedBox(height: 16), + _buildActionButton( + icon: Icons.download, + title: '导出数据', + subtitle: '将记录导出为JSON文件', + onTap: _exportData, + ), + const SizedBox(height: 12), + _buildActionButton( + icon: Icons.file_download, + title: '导入数据', + subtitle: '从JSON文件导入记录和设置', + onTap: _importData, + ), + const SizedBox(height: 12), + _buildActionButton( + icon: Icons.clear_all, + title: '清空数据', + subtitle: '删除所有记录和设置', + onTap: _clearAllData, + isDestructive: true, + ), + ], + ), + ), + ); + } + + Widget _buildActionButton({ + required IconData icon, + required String title, + required String subtitle, + required VoidCallback onTap, + bool isDestructive = false, + }) { + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(12.0), + child: Container( + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + color: isDestructive + ? Colors.red.withOpacity(0.1) + : AppTheme.secondaryBlack, + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: isDestructive + ? Colors.red.withOpacity(0.3) + : Colors.transparent, + width: 1, + ), + ), + child: Row( + children: [ + Icon( + icon, + color: isDestructive + ? Colors.red + : Theme.of(context).colorScheme.primary, + size: 24, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: AppTheme.bodyLarge.copyWith( + color: isDestructive ? Colors.red : Colors.white, + ), + ), + Text( + subtitle, + style: AppTheme.caption, + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: Colors.white54, + size: 20, + ), + ], + ), + ), + ); + } + + String _formatFileSize(int bytes) { + if (bytes < 1024) return '$bytes B'; + if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB'; + return '${(bytes / 1024 / 1024).toStringAsFixed(1)} MB'; + } + + String _formatDateTime(DateTime dateTime) { + return '${dateTime.year}-${dateTime.month.toString().padLeft(2, '0')}-${dateTime.day.toString().padLeft(2, '0')} ' + '${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}'; + } + + Future _getAppVersion() async { + try { + final packageInfo = await PackageInfo.fromPlatform(); + return 'v${packageInfo.version}'; + } catch (e) { + return ''; + } + } + + Future _selectDirectory() async { + try { + // 使用文件选择器选择目录 + final directory = await FilePicker.platform.getDirectoryPath( + dialogTitle: '选择导出位置', + lockParentWindow: true, + ); + return directory; + } catch (e) { + // 如果文件选择器失败,使用默认的文档目录 + try { + final documentsDir = await getApplicationDocumentsDirectory(); + final exportDir = Directory(path.join(documentsDir.path, 'LBJ_Exports')); + if (!await exportDir.exists()) { + await exportDir.create(recursive: true); + } + return exportDir.path; + } catch (e) { + return null; + } + } + } + + Future _exportData() async { + final scaffoldMessenger = ScaffoldMessenger.of(context); + + try { + // 让用户选择保存位置 + final fileName = + 'LBJ_Console_${DateTime.now().year}${DateTime.now().month.toString().padLeft(2, '0')}${DateTime.now().day.toString().padLeft(2, '0')}.json'; + + String? selectedDirectory = await _selectDirectory(); + if (selectedDirectory == null) return; + + final filePath = path.join(selectedDirectory, fileName); + + showDialog( + context: context, + barrierDismissible: false, + builder: (context) => const AlertDialog( + content: Row( + children: [ + CircularProgressIndicator(), + SizedBox(width: 16), + Text('正在导出数据...'), + ], + ), + ), + ); + + try { + final exportedPath = await _databaseService.exportDataAsJson(customPath: filePath); + Navigator.pop(context); + + if (exportedPath != null) { + final file = File(exportedPath); + final fileName = file.path.split(Platform.pathSeparator).last; + + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('数据已导出到:$fileName'), + action: SnackBarAction( + label: '查看', + onPressed: () async { + // 打开文件所在目录 + try { + final directory = file.parent; + await Process.run('explorer', [directory.path]); + } catch (e) { + // 如果无法打开目录,显示路径 + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('文件路径:${file.path}'), + ), + ); + } + }, + ), + ), + ); + } else { + scaffoldMessenger.showSnackBar( + const SnackBar( + content: Text('导出失败'), + ), + ); + } + } catch (e) { + Navigator.pop(context); + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('导出错误:$e'), + ), + ); + } + } catch (e) { + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('选择目录错误:$e'), + ), + ); + } + } + + Future _importData() async { + final scaffoldMessenger = ScaffoldMessenger.of(context); + + final result = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('导入数据'), + content: const Text('导入将替换所有现有数据,是否继续?'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('取消'), + ), + TextButton( + onPressed: () => Navigator.pop(context, true), + child: const Text('继续'), + ), + ], + ), + ); + + if (result != true) return; + + final resultFile = await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['json'], + ); + + if (resultFile == null) return; + final selectedFile = resultFile.files.single.path; + if (selectedFile == null) return; + + showDialog( + context: context, + barrierDismissible: false, + builder: (context) => const AlertDialog( + content: Row( + children: [ + CircularProgressIndicator(), + SizedBox(width: 16), + Text('正在导入数据...'), + ], + ), + ), + ); + + try { + final success = await _databaseService.importDataFromJson(selectedFile); + Navigator.pop(context); + + if (success) { + scaffoldMessenger.showSnackBar( + const SnackBar( + content: Text('数据导入成功'), + ), + ); + + await _loadSettings(); + await _loadRecordCount(); + setState(() {}); + } else { + scaffoldMessenger.showSnackBar( + const SnackBar( + content: Text('数据导入失败'), + ), + ); + } + } catch (e) { + Navigator.pop(context); + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('导入错误:$e'), + ), + ); + } + } + + Future _clearAllData() async { + final scaffoldMessenger = ScaffoldMessenger.of(context); + + final result = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('清空数据'), + content: const Text('此操作将删除所有记录和设置,无法撤销。是否继续?'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('取消'), + ), + TextButton( + onPressed: () => Navigator.pop(context, true), + style: TextButton.styleFrom(foregroundColor: Colors.red), + child: const Text('确认清空'), + ), + ], + ), + ); + + if (result != true) return; + + showDialog( + context: context, + barrierDismissible: false, + builder: (context) => const AlertDialog( + content: Row( + children: [ + CircularProgressIndicator(), + SizedBox(width: 16), + Text('正在清空数据...'), + ], + ), + ), + ); + + try { + await _databaseService.deleteAllRecords(); + await _databaseService.updateSettings({ + 'deviceName': 'LBJReceiver', + 'backgroundServiceEnabled': 0, + 'notificationEnabled': 1, + 'mergeRecordsEnabled': 0, + 'groupBy': 'trainAndLoco', + 'timeWindow': 'unlimited', + }); + + Navigator.pop(context); + + scaffoldMessenger.showSnackBar( + const SnackBar( + content: Text('数据已清空'), + ), + ); + + await _loadSettings(); + await _loadRecordCount(); + setState(() {}); + } catch (e) { + Navigator.pop(context); + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text('清空错误:$e'), + ), + ); + } + } + + Widget _buildAboutSection() { + return Card( + color: AppTheme.tertiaryBlack, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16.0), + ), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.info, color: Theme.of(context).colorScheme.primary), + const SizedBox(width: 12), + Text('关于', style: AppTheme.titleMedium), + ], + ), + const SizedBox(height: 16), + Text('LBJ Console', style: AppTheme.titleMedium), + const SizedBox(height: 8), + FutureBuilder( + future: _getAppVersion(), + builder: (context, snapshot) { + if (snapshot.hasData) { + return Text(snapshot.data!, style: AppTheme.bodyMedium); + } else { + return const Text('v0.1.3-flutter', style: AppTheme.bodyMedium); + } + }, + ), + const SizedBox(height: 16), + GestureDetector( + onTap: () async { + final url = Uri.parse('https://github.com/undef-i/LBJConsole'); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } + }, + child: Text( + 'https://github.com/undef-i/LBJConsole', + style: AppTheme.caption, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/services/ble_service.dart b/lib/services/ble_service.dart new file mode 100644 index 0000000..f9ddf8f --- /dev/null +++ b/lib/services/ble_service.dart @@ -0,0 +1,361 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:math'; + +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:lbjconsole/models/train_record.dart'; +import 'package:lbjconsole/services/database_service.dart'; + +class BLEService { + static final BLEService _instance = BLEService._internal(); + factory BLEService() => _instance; + BLEService._internal(); + + static const String TAG = "LBJ_BT_FLUTTER"; + static final Guid serviceUuid = Guid("0000ffe0-0000-1000-8000-00805f9b34fb"); + static final Guid charUuid = Guid("0000ffe1-0000-1000-8000-00805f9b34fb"); + + BluetoothDevice? _connectedDevice; + BluetoothCharacteristic? _characteristic; + StreamSubscription>? _valueSubscription; + StreamSubscription? _connectionStateSubscription; + StreamSubscription>? _scanResultsSubscription; + + final StreamController _statusController = + StreamController.broadcast(); + final StreamController _dataController = + StreamController.broadcast(); + final StreamController _connectionController = + StreamController.broadcast(); + + Stream get statusStream => _statusController.stream; + Stream get dataStream => _dataController.stream; + Stream get connectionStream => _connectionController.stream; + + String _deviceStatus = "未连接"; + String? _lastKnownDeviceAddress; + String _targetDeviceName = "LBJReceiver"; + + bool _isConnecting = false; + bool _isManualDisconnect = false; + bool _isAutoConnectBlocked = false; + + Timer? _heartbeatTimer; + final StringBuffer _dataBuffer = StringBuffer(); + + void initialize() { + _loadSettings(); + FlutterBluePlus.adapterState.listen((state) { + if (state == BluetoothAdapterState.on) { + ensureConnection(); + } else { + _updateConnectionState(false, "蓝牙已关闭"); + stopScan(); + } + }); + _startHeartbeat(); + } + + void _startHeartbeat() { + _heartbeatTimer?.cancel(); + _heartbeatTimer = Timer.periodic(const Duration(seconds: 7), (timer) { + ensureConnection(); + }); + } + + Future _loadSettings() async { + try { + final settings = await DatabaseService.instance.getAllSettings(); + if (settings != null) { + _targetDeviceName = settings['deviceName'] ?? 'LBJReceiver'; + } + } catch (e) { + } + } + + void ensureConnection() { + if (isConnected || _isConnecting) { + return; + } + _tryReconnectDirectly(); + } + + Future _tryReconnectDirectly() async { + if (_lastKnownDeviceAddress == null) { + startScan(); + return; + } + + _isConnecting = true; + _statusController.add("正在重连..."); + + try { + final connected = await FlutterBluePlus.connectedSystemDevices; + final matchingDevices = + connected.where((d) => d.remoteId.str == _lastKnownDeviceAddress); + BluetoothDevice? target = + matchingDevices.isNotEmpty ? matchingDevices.first : null; + + if (target != null) { + await connect(target); + } else { + startScan(); + _isConnecting = false; + } + } catch (e) { + startScan(); + _isConnecting = false; + } + } + + Future startScan({ + String? targetName, + Duration? timeout, + Function(List)? onScanResults, + }) async { + if (FlutterBluePlus.isScanningNow) { + return; + } + + _targetDeviceName = targetName ?? _targetDeviceName; + _statusController.add("正在扫描..."); + + _scanResultsSubscription?.cancel(); + _scanResultsSubscription = FlutterBluePlus.scanResults.listen((results) { + final allFoundDevices = results.map((r) => r.device).toList(); + + final filteredDevices = allFoundDevices.where((device) { + if (_targetDeviceName.isEmpty) return true; + return device.platformName.toLowerCase() == + _targetDeviceName.toLowerCase(); + }).toList(); + + onScanResults?.call(filteredDevices); + + if (isConnected || + _isConnecting || + _isManualDisconnect || + _isAutoConnectBlocked) return; + + for (var device in allFoundDevices) { + if (_shouldAutoConnectTo(device)) { + stopScan(); + connect(device); + break; + } + } + }); + + try { + await FlutterBluePlus.startScan(timeout: timeout); + } catch (e) { + _statusController.add("扫描失败"); + } + } + + bool _shouldAutoConnectTo(BluetoothDevice device) { + final deviceName = device.platformName; + final deviceAddress = device.remoteId.str; + + if (_targetDeviceName.isNotEmpty && + deviceName.toLowerCase() == _targetDeviceName.toLowerCase()) + return true; + if (_lastKnownDeviceAddress != null && + _lastKnownDeviceAddress == deviceAddress) return true; + + return false; + } + + Future stopScan() async { + await FlutterBluePlus.stopScan(); + _scanResultsSubscription?.cancel(); + } + + Future connect(BluetoothDevice device) async { + if (isConnected) return; + + _isConnecting = true; + _isManualDisconnect = false; + _statusController.add("正在连接: ${device.platformName}"); + + try { + _connectionStateSubscription?.cancel(); + _connectionStateSubscription = device.connectionState.listen((state) { + if (state == BluetoothConnectionState.disconnected) { + _onDisconnected(); + } + }); + + await device.connect(timeout: const Duration(seconds: 15)); + await _onConnected(device); + } catch (e) { + _onDisconnected(); + } + } + + Future _onConnected(BluetoothDevice device) async { + _connectedDevice = device; + _lastKnownDeviceAddress = device.remoteId.str; + await _discoverServicesAndSetupNotifications(device); + } + + void _onDisconnected() { + final wasConnected = isConnected; + _updateConnectionState(false, "连接已断开"); + _connectionStateSubscription?.cancel(); + + if (wasConnected && !_isManualDisconnect) { + ensureConnection(); + } + _isConnecting = false; + } + + Future _discoverServicesAndSetupNotifications( + BluetoothDevice device) async { + try { + final services = await device.discoverServices(); + for (var service in services) { + if (service.uuid == serviceUuid) { + for (var char in service.characteristics) { + if (char.uuid == charUuid) { + _characteristic = char; + await device.requestMtu(512); + await char.setNotifyValue(true); + _valueSubscription = char.lastValueStream.listen(_onDataReceived); + + _updateConnectionState(true, "已连接"); + _isConnecting = false; + return; + } + } + } + } + await device.disconnect(); + } catch (e) { + await device.disconnect(); + } + } + + Future connectManually(BluetoothDevice device) async { + _isManualDisconnect = false; + _isAutoConnectBlocked = false; + stopScan(); + await connect(device); + } + + Future disconnect() async { + _isManualDisconnect = true; + stopScan(); + + await _connectionStateSubscription?.cancel(); + await _valueSubscription?.cancel(); + + if (_connectedDevice != null) { + await _connectedDevice!.disconnect(); + } + _onDisconnected(); + } + + void _onDataReceived(List value) { + if (value.isEmpty) return; + try { + final data = utf8.decode(value); + _dataBuffer.write(data); + _processDataBuffer(); + } catch (e) {} + } + + void _processDataBuffer() { + String bufferContent = _dataBuffer.toString(); + if (bufferContent.isEmpty) return; + + int firstBrace = bufferContent.indexOf('{'); + if (firstBrace == -1) { + _dataBuffer.clear(); + return; + } + + bufferContent = bufferContent.substring(firstBrace); + int braceCount = 0; + int lastValidJsonEnd = -1; + + for (int i = 0; i < bufferContent.length; i++) { + if (bufferContent[i] == '{') { + braceCount++; + } else if (bufferContent[i] == '}') { + braceCount--; + } + if (braceCount == 0 && i > 0) { + lastValidJsonEnd = i; + String jsonToParse = bufferContent.substring(0, lastValidJsonEnd + 1); + _parseAndNotify(jsonToParse); + bufferContent = bufferContent.substring(lastValidJsonEnd + 1); + i = -1; + firstBrace = bufferContent.indexOf('{'); + if (firstBrace != -1) { + bufferContent = bufferContent.substring(firstBrace); + } else { + break; + } + } + } + _dataBuffer.clear(); + if (braceCount > 0) { + _dataBuffer.write(bufferContent); + } + } + + void _parseAndNotify(String jsonData) { + try { + final decodedJson = jsonDecode(jsonData); + if (decodedJson is Map) { + final now = DateTime.now(); + final recordData = Map.from(decodedJson); + recordData['uniqueId'] = + '${now.millisecondsSinceEpoch}_${Random().nextInt(9999)}'; + recordData['receivedTimestamp'] = now.millisecondsSinceEpoch; + + final trainRecord = TrainRecord.fromJson(recordData); + _dataController.add(trainRecord); + DatabaseService.instance.insertRecord(trainRecord); + } + } catch (e) { + print("$TAG: JSON Decode Error: $e, Data: $jsonData"); + } + } + + void _updateConnectionState(bool connected, String status) { + if (connected) { + _deviceStatus = "已连接"; + } else { + _deviceStatus = status; + _connectedDevice = null; + _characteristic = null; + } + _statusController.add(_deviceStatus); + _connectionController.add(connected); + } + + void onAppResume() { + ensureConnection(); + } + + void setAutoConnectBlocked(bool blocked) { + _isAutoConnectBlocked = blocked; + } + + bool get isConnected => _connectedDevice != null; + String get deviceStatus => _deviceStatus; + String? get deviceAddress => _connectedDevice?.remoteId.str; + bool get isScanning => FlutterBluePlus.isScanningNow; + BluetoothDevice? get connectedDevice => _connectedDevice; + bool get isManualDisconnect => _isManualDisconnect; + + void dispose() { + _heartbeatTimer?.cancel(); + disconnect(); + _statusController.close(); + _dataController.close(); + _connectionController.close(); + } +} diff --git a/lib/services/database_service.dart b/lib/services/database_service.dart new file mode 100644 index 0000000..e2c18c9 --- /dev/null +++ b/lib/services/database_service.dart @@ -0,0 +1,320 @@ +import 'dart:async'; +import 'package:sqflite/sqflite.dart'; +import 'package:path/path.dart'; +import 'package:path_provider/path_provider.dart'; +import 'dart:io'; +import 'dart:convert'; + +import 'package:lbjconsole/models/train_record.dart'; + +class DatabaseService { + static final DatabaseService instance = DatabaseService._internal(); + factory DatabaseService() => instance; + DatabaseService._internal(); + + static const String _databaseName = 'train_database'; + static const _databaseVersion = 1; + + static const String trainRecordsTable = 'train_records'; + static const String appSettingsTable = 'app_settings'; + + Database? _database; + + Future get database async { + if (_database != null) return _database!; + _database = await _initDatabase(); + return _database!; + } + + Future _initDatabase() async { + final directory = await getApplicationDocumentsDirectory(); + final path = join(directory.path, _databaseName); + + return await openDatabase( + path, + version: _databaseVersion, + onCreate: _onCreate, + ); + } + + Future _onCreate(Database db, int version) async { + await db.execute(''' + CREATE TABLE IF NOT EXISTS $trainRecordsTable ( + uniqueId TEXT PRIMARY KEY, + timestamp INTEGER NOT NULL, + receivedTimestamp INTEGER NOT NULL, + train TEXT NOT NULL, + direction INTEGER NOT NULL, + speed TEXT NOT NULL, + position TEXT NOT NULL, + time TEXT NOT NULL, + loco TEXT NOT NULL, + locoType TEXT NOT NULL, + lbjClass TEXT NOT NULL, + route TEXT NOT NULL, + positionInfo TEXT NOT NULL, + rssi REAL NOT NULL + ) + '''); + + await db.execute(''' + CREATE TABLE IF NOT EXISTS $appSettingsTable ( + id INTEGER PRIMARY KEY, + deviceName TEXT NOT NULL DEFAULT 'LBJReceiver', + currentTab INTEGER NOT NULL DEFAULT 0, + historyEditMode INTEGER NOT NULL DEFAULT 0, + historySelectedRecords TEXT NOT NULL DEFAULT '', + historyExpandedStates TEXT NOT NULL DEFAULT '', + historyScrollPosition INTEGER NOT NULL DEFAULT 0, + historyScrollOffset INTEGER NOT NULL DEFAULT 0, + settingsScrollPosition INTEGER NOT NULL DEFAULT 0, + mapCenterLat REAL, + mapCenterLon REAL, + mapZoomLevel REAL NOT NULL DEFAULT 10.0, + mapRailwayLayerVisible INTEGER NOT NULL DEFAULT 1, + mapRotation REAL NOT NULL DEFAULT 0.0, + specifiedDeviceAddress TEXT, + searchOrderList TEXT NOT NULL DEFAULT '', + autoConnectEnabled INTEGER NOT NULL DEFAULT 1, + backgroundServiceEnabled INTEGER NOT NULL DEFAULT 0, + notificationEnabled INTEGER NOT NULL DEFAULT 0, + mergeRecordsEnabled INTEGER NOT NULL DEFAULT 0, + groupBy TEXT NOT NULL DEFAULT 'trainAndLoco', + timeWindow TEXT NOT NULL DEFAULT 'unlimited' + ) + '''); + + await db.insert(appSettingsTable, { + 'id': 1, + 'deviceName': 'LBJReceiver', + 'currentTab': 0, + 'historyEditMode': 0, + 'historySelectedRecords': '', + 'historyExpandedStates': '', + 'historyScrollPosition': 0, + 'historyScrollOffset': 0, + 'settingsScrollPosition': 0, + 'mapZoomLevel': 10.0, + 'mapRailwayLayerVisible': 1, + 'mapRotation': 0.0, + 'searchOrderList': '', + 'autoConnectEnabled': 1, + 'backgroundServiceEnabled': 0, + 'notificationEnabled': 0, + 'mergeRecordsEnabled': 0, + 'groupBy': 'trainAndLoco', + 'timeWindow': 'unlimited', + }); + } + + Future insertRecord(TrainRecord record) async { + final db = await database; + return await db.insert( + trainRecordsTable, + record.toDatabaseJson(), + conflictAlgorithm: ConflictAlgorithm.replace, + ); + } + + Future> getAllRecords() async { + final db = await database; + final result = await db.query( + trainRecordsTable, + orderBy: 'timestamp DESC', + ); + return result.map((json) => TrainRecord.fromDatabaseJson(json)).toList(); + } + + Future deleteRecord(String uniqueId) async { + final db = await database; + return await db.delete( + trainRecordsTable, + where: 'uniqueId = ?', + whereArgs: [uniqueId], + ); + } + + Future deleteAllRecords() async { + final db = await database; + return await db.delete(trainRecordsTable); + } + + Future getRecordCount() async { + final db = await database; + final result = await db.rawQuery('SELECT COUNT(*) FROM $trainRecordsTable'); + return Sqflite.firstIntValue(result) ?? 0; + } + + Future getLatestRecord() async { + final db = await database; + final result = await db.query( + trainRecordsTable, + orderBy: 'timestamp DESC', + limit: 1, + ); + if (result.isNotEmpty) { + return TrainRecord.fromDatabaseJson(result.first); + } + return null; + } + + Future?> getAllSettings() async { + final db = await database; + try { + final result = await db.query( + appSettingsTable, + where: 'id = 1', + ); + if (result.isEmpty) return null; + return result.first; + } catch (e) { + return null; + } + } + + Future updateSettings(Map settings) async { + final db = await database; + return await db.update( + appSettingsTable, + settings, + where: 'id = 1', + ); + } + + Future setSetting(String key, dynamic value) async { + final db = await database; + return await db.update( + appSettingsTable, + {key: value}, + where: 'id = 1', + ); + } + + Future> getSearchOrderList() async { + final settings = await getAllSettings(); + if (settings != null && settings['searchOrderList'] != null) { + final listString = settings['searchOrderList'] as String; + if (listString.isNotEmpty) { + return listString.split(','); + } + } + return []; + } + + Future updateSearchOrderList(List orderList) async { + return await setSetting('searchOrderList', orderList.join(',')); + } + + Future> getDatabaseInfo() async { + final db = await database; + final count = await getRecordCount(); + final settings = await getAllSettings(); + return { + 'databaseVersion': _databaseVersion, + 'trainRecordCount': count, + 'appSettings': settings, + 'path': db.path, + }; + } + + Future backupDatabase() async { + try { + final db = await database; + final directory = await getApplicationDocumentsDirectory(); + final originalPath = db.path; + final backupDirectory = Directory(join(directory.path, 'backups')); + if (!await backupDirectory.exists()) { + await backupDirectory.create(recursive: true); + } + final backupPath = join(backupDirectory.path, + 'train_database_backup_${DateTime.now().millisecondsSinceEpoch}.db'); + await File(originalPath).copy(backupPath); + return backupPath; + } catch (e) { + return null; + } + } + + Future deleteRecords(List uniqueIds) async { + final db = await database; + for (String id in uniqueIds) { + await db.delete( + 'train_records', + where: 'uniqueId = ?', + whereArgs: [id], + ); + } + } + + Future close() async { + if (_database != null) { + await _database!.close(); + _database = null; + } + } + + Future exportDataAsJson({String? customPath}) async { + try { + final records = await getAllRecords(); + + final exportData = { + 'records': records.map((r) => r.toDatabaseJson()).toList(), + }; + + final jsonString = jsonEncode(exportData); + + String filePath; + if (customPath != null) { + filePath = customPath; + } else { + final tempDir = Directory.systemTemp; + final fileName = + 'LBJ_Console_${DateTime.now().year}${DateTime.now().month.toString().padLeft(2, '0')}${DateTime.now().day.toString().padLeft(2, '0')}.json'; + filePath = join(tempDir.path, fileName); + } + + await File(filePath).writeAsString(jsonString); + return filePath; + } catch (e) { + return null; + } + } + + Future importDataFromJson(String filePath) async { + try { + final jsonString = await File(filePath).readAsString(); + final importData = jsonDecode(jsonString); + + final db = await database; + + await db.transaction((txn) async { + await txn.delete(trainRecordsTable); + + if (importData['records'] != null) { + final records = + List>.from(importData['records']); + for (final record in records) { + await txn.insert(trainRecordsTable, record); + } + } + }); + + return true; + } catch (e) { + return false; + } + } + + Future deleteExportFile(String filePath) async { + try { + final file = File(filePath); + if (await file.exists()) { + await file.delete(); + return true; + } + return false; + } catch (e) { + return false; + } + } +} diff --git a/lib/services/loco_type_service.dart b/lib/services/loco_type_service.dart new file mode 100644 index 0000000..d4e60fb --- /dev/null +++ b/lib/services/loco_type_service.dart @@ -0,0 +1,17 @@ +import 'package:lbjconsole/util/loco_type_util.dart'; + +class LocoTypeService { + static final LocoTypeService _instance = LocoTypeService._internal(); + factory LocoTypeService() => _instance; + LocoTypeService._internal(); + + bool _isInitialized = false; + + Future initialize() async { + if (_isInitialized) return; + + _isInitialized = true; + } + + bool get isInitialized => _isInitialized; +} diff --git a/lib/services/merge_service.dart b/lib/services/merge_service.dart new file mode 100644 index 0000000..642a075 --- /dev/null +++ b/lib/services/merge_service.dart @@ -0,0 +1,85 @@ +import 'package:lbjconsole/models/train_record.dart'; +import 'package:lbjconsole/models/merged_record.dart'; + +class MergeService { + static String? _generateGroupKey(TrainRecord record, GroupBy groupBy) { + final train = record.train.trim(); + final loco = record.loco.trim(); + final hasTrain = train.isNotEmpty && train != ""; + final hasLoco = loco.isNotEmpty && loco != ""; + + switch (groupBy) { + case GroupBy.trainOnly: + return hasTrain ? train : null; + case GroupBy.locoOnly: + return hasLoco ? loco : null; + case GroupBy.trainOrLoco: + if (hasTrain) return train; + if (hasLoco) return loco; + return null; + case GroupBy.trainAndLoco: + return (hasTrain && hasLoco) ? "${train}_$loco" : null; + } + } + + static List getMixedList( + List allRecords, MergeSettings settings) { + if (!settings.enabled) { + allRecords + .sort((a, b) => b.receivedTimestamp.compareTo(a.receivedTimestamp)); + return allRecords; + } + + final now = DateTime.now(); + final validRecords = settings.timeWindow.duration == null + ? allRecords + : allRecords + .where((r) => + now.difference(r.receivedTimestamp) <= + settings.timeWindow.duration!) + .toList(); + + final groupedRecords = >{}; + for (final record in validRecords) { + final key = _generateGroupKey(record, settings.groupBy); + if (key != null) { + groupedRecords.putIfAbsent(key, () => []).add(record); + } + } + + final List mergedRecords = []; + final Set mergedRecordIds = {}; + + groupedRecords.forEach((key, group) { + if (group.length >= 2) { + group + .sort((a, b) => b.receivedTimestamp.compareTo(a.receivedTimestamp)); + final latestRecord = group.first; + mergedRecords.add(MergedTrainRecord( + groupKey: key, + records: group, + latestRecord: latestRecord, + )); + for (final record in group) { + mergedRecordIds.add(record.uniqueId); + } + } + }); + + final singleRecords = + allRecords.where((r) => !mergedRecordIds.contains(r.uniqueId)).toList(); + + final List mixedList = [...mergedRecords, ...singleRecords]; + mixedList.sort((a, b) { + final aTime = a is MergedTrainRecord + ? a.latestRecord.receivedTimestamp + : (a as TrainRecord).receivedTimestamp; + final bTime = b is MergedTrainRecord + ? b.latestRecord.receivedTimestamp + : (b as TrainRecord).receivedTimestamp; + return bTime.compareTo(aTime); + }); + + return mixedList; + } +} diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart new file mode 100644 index 0000000..65bc2f2 --- /dev/null +++ b/lib/services/notification_service.dart @@ -0,0 +1,135 @@ +import 'dart:async'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:lbjconsole/models/train_record.dart'; + +class NotificationService { + static const String channelId = 'lbj_messages'; + static const String channelName = 'LBJ Messages'; + static const String channelDescription = 'Receive LBJ messages'; + + final FlutterLocalNotificationsPlugin _notificationsPlugin = + FlutterLocalNotificationsPlugin(); + int _notificationId = 1000; + bool _notificationsEnabled = true; + + final StreamController _settingsController = + StreamController.broadcast(); + Stream get settingsStream => _settingsController.stream; + + Future initialize() async { + const AndroidInitializationSettings initializationSettingsAndroid = + AndroidInitializationSettings('@mipmap/ic_launcher'); + + final InitializationSettings initializationSettings = + InitializationSettings( + android: initializationSettingsAndroid, + ); + + await _notificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: (details) {}, + ); + + await _createNotificationChannel(); + + _notificationsEnabled = await isNotificationEnabled(); + _settingsController.add(_notificationsEnabled); + } + + Future _createNotificationChannel() async { + const AndroidNotificationChannel channel = AndroidNotificationChannel( + channelId, + channelName, + description: channelDescription, + importance: Importance.high, + enableVibration: true, + playSound: true, + ); + + await _notificationsPlugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin>() + ?.createNotificationChannel(channel); + } + + Future showTrainNotification(TrainRecord record) async { + if (!_notificationsEnabled) return; + + if (!_isValidValue(record.train) || + !_isValidValue(record.route) || + !_isValidValue(record.directionText)) { + return; + } + + final String title = '列车信息更新'; + final String body = _buildNotificationContent(record); + + final AndroidNotificationDetails androidPlatformChannelSpecifics = + AndroidNotificationDetails( + channelId, + channelName, + channelDescription: channelDescription, + importance: Importance.high, + priority: Priority.high, + ticker: 'ticker', + styleInformation: BigTextStyleInformation(body), + ); + + final NotificationDetails platformChannelSpecifics = + NotificationDetails(android: androidPlatformChannelSpecifics); + + await _notificationsPlugin.show( + _notificationId++, + title, + body, + platformChannelSpecifics, + payload: 'train_${record.train}', + ); + } + + String _buildNotificationContent(TrainRecord record) { + final buffer = StringBuffer(); + + buffer.writeln('车次: ${record.fullTrainNumber}'); + buffer.writeln('线路: ${record.route}'); + buffer.writeln('方向: ${record.directionText}'); + + if (_isValidValue(record.speed)) { + buffer.writeln('速度: ${record.speed} km/h'); + } + + if (_isValidValue(record.positionInfo)) { + buffer.writeln('位置: ${record.positionInfo}'); + } + + buffer.writeln('时间: ${record.formattedTime}'); + + return buffer.toString().trim(); + } + + bool _isValidValue(String? value) { + if (value == null || value.isEmpty) return false; + final trimmed = value.trim(); + return trimmed.isNotEmpty && + trimmed != 'NUL' && + trimmed != 'NA' && + trimmed != '*'; + } + + Future enableNotifications(bool enable) async { + _notificationsEnabled = enable; + _settingsController.add(_notificationsEnabled); + } + + Future isNotificationEnabled() async { + return _notificationsEnabled; + } + + Future cancelAllNotifications() async { + await _notificationsPlugin.cancelAll(); + } + + void dispose() { + _settingsController.close(); + } +} diff --git a/lib/themes/app_theme.dart b/lib/themes/app_theme.dart new file mode 100644 index 0000000..cfcd3b1 --- /dev/null +++ b/lib/themes/app_theme.dart @@ -0,0 +1,175 @@ +import 'package:flutter/material.dart'; + +class AppTheme { + static ThemeData get darkTheme { + return ThemeData( + useMaterial3: true, + brightness: Brightness.dark, + scaffoldBackgroundColor: Colors.black, + canvasColor: Colors.black, + cardColor: const Color(0xFF121212), + primaryColor: Colors.blue, + colorScheme: ColorScheme.dark( + primary: Colors.blue, + secondary: Colors.blueAccent, + surface: const Color(0xFF121212), + background: Colors.black, + onSurface: Colors.white, + onBackground: Colors.white, + ), + appBarTheme: const AppBarTheme( + backgroundColor: Colors.black, + elevation: 0, + titleTextStyle: TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.bold, + ), + iconTheme: IconThemeData(color: Colors.white), + ), + bottomNavigationBarTheme: const BottomNavigationBarThemeData( + backgroundColor: Color(0xFF121212), + selectedItemColor: Colors.blue, + unselectedItemColor: Colors.grey, + type: BottomNavigationBarType.fixed, + ), + cardTheme: CardTheme( + color: const Color(0xFF1E1E1E), + elevation: 2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + textTheme: const TextTheme( + headlineLarge: TextStyle( + color: Colors.white, fontSize: 32, fontWeight: FontWeight.bold), + headlineMedium: TextStyle( + color: Colors.white, fontSize: 28, fontWeight: FontWeight.bold), + headlineSmall: TextStyle( + color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), + titleLarge: TextStyle( + color: Colors.white, fontSize: 20, fontWeight: FontWeight.w600), + titleMedium: TextStyle( + color: Colors.white, fontSize: 18, fontWeight: FontWeight.w500), + titleSmall: TextStyle( + color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500), + bodyLarge: TextStyle(color: Colors.white, fontSize: 16), + bodyMedium: TextStyle(color: Colors.white70, fontSize: 14), + bodySmall: TextStyle(color: Colors.white60, fontSize: 12), + labelLarge: TextStyle( + color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500), + labelMedium: TextStyle(color: Colors.white70, fontSize: 12), + labelSmall: TextStyle(color: Colors.white60, fontSize: 10), + ), + iconTheme: const IconThemeData(color: Colors.white), + dividerTheme: const DividerThemeData( + color: Color(0xFF2A2A2A), + thickness: 1, + ), + switchTheme: SwitchThemeData( + thumbColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return Colors.blue; + } + return Colors.grey; + }), + trackColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return Colors.blue.withOpacity(0.5); + } + return Colors.grey.withOpacity(0.5); + }), + ), + dialogTheme: DialogTheme( + backgroundColor: const Color(0xFF1E1E1E), + elevation: 8, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + titleTextStyle: const TextStyle( + color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), + contentTextStyle: const TextStyle(color: Colors.white70, fontSize: 16), + ), + floatingActionButtonTheme: const FloatingActionButtonThemeData( + backgroundColor: Colors.blue, + foregroundColor: Colors.white, + ), + ); + } + + static const Color primaryBlack = Colors.black; + static const Color secondaryBlack = Color(0xFF121212); + static const Color tertiaryBlack = Color(0xFF1E1E1E); + static const Color dividerColor = Color(0xFF2A2A2A); + static const Color textPrimary = Colors.white; + static const Color textSecondary = Color(0xFFB3B3B3); + static const Color textTertiary = Color(0xFF808080); + static const Color accentBlue = Colors.blue; + static const Color accentBlueLight = Color(0xFF64B5F6); + static const Color errorRed = Color(0xFFCF6679); + static const Color successGreen = Color(0xFF4CAF50); + static const Color warningOrange = Color(0xFFFF9800); + + static const TextStyle titleLarge = TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: textPrimary, + ); + + static const TextStyle titleMedium = TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: textPrimary, + ); + + static const TextStyle bodyLarge = TextStyle( + fontSize: 16, + color: textPrimary, + ); + + static const TextStyle bodyMedium = TextStyle( + fontSize: 14, + color: textSecondary, + ); + + static const TextStyle caption = TextStyle( + fontSize: 12, + color: textTertiary, + ); + + static const TextStyle labelLarge = TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: textPrimary, + ); + + static const double spacingXS = 4.0; + static const double spacingS = 8.0; + static const double spacingM = 16.0; + static const double spacingL = 24.0; + static const double spacingXL = 32.0; + static const double spacingXXL = 48.0; + + static const double radiusS = 4.0; + static const double radiusM = 8.0; + static const double radiusL = 12.0; + static const double radiusXL = 16.0; + + static List get cardShadow => [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ]; + + static List get buttonShadow => [ + BoxShadow( + color: Colors.black.withOpacity(0.2), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ]; +} diff --git a/lib/util/loco_info_util.dart b/lib/util/loco_info_util.dart new file mode 100644 index 0000000..abe117c --- /dev/null +++ b/lib/util/loco_info_util.dart @@ -0,0 +1,150 @@ +import 'dart:convert'; +import 'package:flutter/services.dart'; + +class LocoInfoUtil { + static final List _locoData = []; + static bool _initialized = false; + + static Future initialize() async { + if (_initialized) return; + + try { + final csvData = await rootBundle.loadString('assets/loco_info.csv'); + final lines = csvData.split('\n'); + + for (final line in lines) { + if (line.trim().isEmpty) continue; + + final fields = _parseCsvLine(line); + if (fields.length >= 4) { + try { + final model = fields[0]; + final start = int.parse(fields[1]); + final end = int.parse(fields[2]); + final owner = fields[3]; + final alias = fields.length > 4 ? fields[4] : ''; + final manufacturer = fields.length > 5 ? fields[5] : ''; + + _locoData.add(LocoInfo( + model: model, + start: start, + end: end, + owner: owner, + alias: alias, + manufacturer: manufacturer, + )); + } catch (e) {} + } + } + _initialized = true; + } catch (e) { + _initialized = true; + } + } + + static List _parseCsvLine(String line) { + final fields = []; + final buffer = StringBuffer(); + bool inQuotes = false; + + for (int i = 0; i < line.length; i++) { + final char = line[i]; + + if (char == '"') { + inQuotes = !inQuotes; + } else if (char == ',' && !inQuotes) { + fields.add(buffer.toString().trim()); + buffer.clear(); + } else { + buffer.write(char); + } + } + + fields.add(buffer.toString().trim()); + return fields; + } + + static LocoInfo? findLocoInfo(String model, String number) { + if (!_initialized || model.isEmpty || number.isEmpty) { + return null; + } + + try { + final cleanNumber = number.trim().replaceAll('-', '').replaceAll(' ', ''); + final num = cleanNumber.length > 4 + ? int.parse(cleanNumber.substring(cleanNumber.length - 4)) + : int.parse(cleanNumber); + + for (final info in _locoData) { + if (info.model == model && num >= info.start && num <= info.end) { + return info; + } + } + } catch (e) { + return null; + } + + return null; + } + + static String? getLocoInfoDisplay(String model, String number) { + if (_locoData.isEmpty) return null; + + final modelTrimmed = model.trim(); + final numberTrimmed = number.trim(); + + if (modelTrimmed.isEmpty || + numberTrimmed.isEmpty || + numberTrimmed == "") { + return null; + } + + final cleanNumber = numberTrimmed.replaceAll('-', '').replaceAll(' ', ''); + final numberSuffix = cleanNumber.length >= 4 + ? cleanNumber.substring(cleanNumber.length - 4) + : cleanNumber.padLeft(4, '0'); + + final numberInt = int.tryParse(numberSuffix); + if (numberInt == null) { + return null; + } + + for (final info in _locoData) { + if (info.model == modelTrimmed && + numberInt >= info.start && + numberInt <= info.end) { + final buffer = StringBuffer(); + buffer.write(info.owner); + + if (info.alias.isNotEmpty) { + buffer.write(' - ${info.alias}'); + } + + if (info.manufacturer.isNotEmpty) { + buffer.write(' - ${info.manufacturer}'); + } + + return buffer.toString(); + } + } + return null; + } +} + +class LocoInfo { + final String model; + final int start; + final int end; + final String owner; + final String alias; + final String manufacturer; + + LocoInfo({ + required this.model, + required this.start, + required this.end, + required this.owner, + required this.alias, + required this.manufacturer, + }); +} diff --git a/lib/util/loco_type_util.dart b/lib/util/loco_type_util.dart new file mode 100644 index 0000000..014fa3f --- /dev/null +++ b/lib/util/loco_type_util.dart @@ -0,0 +1,54 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/services.dart'; + +class LocoTypeUtil { + static final LocoTypeUtil _instance = LocoTypeUtil._internal(); + factory LocoTypeUtil() => _instance; + LocoTypeUtil._internal() { + _syncInitialize(); + } + + final Map _locoTypeMap = {}; + bool _isInitialized = false; + + void _syncInitialize() { + try { + rootBundle.loadString('assets/loco_type_info.csv').then((csvData) { + final lines = const LineSplitter().convert(csvData); + for (final line in lines) { + final trimmedLine = line.trim(); + if (trimmedLine.isEmpty) continue; + final parts = trimmedLine.split(','); + if (parts.length >= 2) { + final code = parts[0].trim(); + final type = parts[1].trim(); + _locoTypeMap[code] = type; + } + } + _isInitialized = true; + }); + } catch (e) {} + } + + @deprecated + Future initialize() async {} + + String? getLocoTypeByCode(String code) { + return _locoTypeMap[code]; + } + + String? getLocoTypeByLocoNumber(String locoNumber) { + if (locoNumber.length < 3) return null; + final prefix = locoNumber.substring(0, 3); + return getLocoTypeByCode(prefix); + } + + Map getAllMappings() { + return Map.from(_locoTypeMap); + } + + bool get isInitialized => _isInitialized; + + int get mappingCount => _locoTypeMap.length; +} diff --git a/lib/util/train_type_util.dart b/lib/util/train_type_util.dart new file mode 100644 index 0000000..4a8e88c --- /dev/null +++ b/lib/util/train_type_util.dart @@ -0,0 +1,68 @@ +import 'dart:convert'; +import 'package:flutter/services.dart'; + +class TrainTypeUtil { + static final List<_TrainTypePattern> _patterns = []; + static bool _initialized = false; + + static Future initialize() async { + if (_initialized) return; + + try { + final csvData = + await rootBundle.loadString('assets/train_number_info.csv'); + final lines = csvData.split('\n'); + + for (final line in lines) { + if (line.trim().isEmpty) continue; + + final firstQuoteEnd = line.indexOf('"', 1); + if (firstQuoteEnd > 0 && firstQuoteEnd < line.length - 1) { + final regex = line.substring(1, firstQuoteEnd); + final remainingPart = line.substring(firstQuoteEnd + 1).trim(); + + if (remainingPart.startsWith(',"') && remainingPart.endsWith('"')) { + final type = remainingPart.substring(2, remainingPart.length - 1); + try { + _patterns.add(_TrainTypePattern(RegExp(regex), type)); + } catch (e) {} + } + } + } + _initialized = true; + } catch (e) { + _initialized = true; + } + } + + static String? getTrainType(String lbjClass, String train) { + if (!_initialized) { + return null; + } + + final lbjClassTrimmed = lbjClass.trim(); + final trainTrimmed = train.trim(); + + if (trainTrimmed.isEmpty || trainTrimmed == "") { + return null; + } + + final actualTrain = + lbjClassTrimmed == "NA" ? trainTrimmed : lbjClassTrimmed + trainTrimmed; + + for (final pattern in _patterns) { + if (pattern.regex.hasMatch(actualTrain)) { + return pattern.type; + } + } + + return null; + } +} + +class _TrainTypePattern { + final RegExp regex; + final String type; + + _TrainTypePattern(this.regex, this.type); +} 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..e4a19a9 --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,145 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.10) +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 "lbjconsole") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "org.noxylva.lbjconsole") + +# 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) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Define the application target. To change its name, change BINARY_NAME above, +# 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 dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# 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..f6f23bf --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); +} 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..f16b4c3 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux +) + +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/main.cc b/linux/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/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/my_application.cc b/linux/my_application.cc new file mode 100644 index 0000000..b58081f --- /dev/null +++ b/linux/my_application.cc @@ -0,0 +1,124 @@ +#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) + +// 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, "lbjconsole"); + 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, "lbjconsole"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + 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); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), 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() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/my_application.h b/linux/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/linux/my_application.h @@ -0,0 +1,18 @@ +#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/macos/.gitignore b/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..def0774 --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,30 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import file_picker +import flutter_blue_plus_darwin +import flutter_local_notifications +import geolocator_apple +import package_info_plus +import path_provider_foundation +import share_plus +import shared_preferences_foundation +import sqflite_darwin +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) + FlutterBluePlusPlugin.register(with: registry.registrar(forPlugin: "FlutterBluePlusPlugin")) + FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) + GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1534cdf --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,705 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* lbjconsole.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "lbjconsole.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* lbjconsole.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* lbjconsole.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.noxylva.lbjconsole.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lbjconsole.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/lbjconsole"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.noxylva.lbjconsole.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lbjconsole.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/lbjconsole"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.noxylva.lbjconsole.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lbjconsole.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/lbjconsole"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..1a02f7f --- /dev/null +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..8e02df2 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..863ab52 --- /dev/null +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = lbjconsole + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = org.noxylva.lbjconsole + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 org.noxylva. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Warnings.xcconfig b/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..3cc05eb --- /dev/null +++ b/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/macos/RunnerTests/RunnerTests.swift b/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..61f3bd1 --- /dev/null +++ b/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +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/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..a1cc094 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1319 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 + url: "https://pub.flutter-io.cn" + source: hosted + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.7.0" + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.7" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.11.0" + bluez: + dependency: transitive + description: + name: bluez + sha256: "61a7204381925896a374301498f2f5399e59827c6498ae1e924aaa598751b545" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.8.3" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: ba95c961bafcd8686d1cf63be864eb59447e795e124d98d6a27d91fcd13602fb + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.11.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.18.0" + console: + dependency: transitive + description: + name: console + sha256: e04e7824384c5b39389acdd6dc7d33f3efe6b232f6f16d7626f194f6a01ad69a + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.2" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.6" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.8" + dart_earcut: + dependency: transitive + description: + name: dart_earcut + sha256: e485001bfc05dcbc437d7bfb666316182e3522d4c3f9668048e004d0eb2ce43b + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.7" + dbus: + dependency: transitive + description: + name: dbus + sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.11" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.1" + file_picker: + dependency: "direct main" + description: + name: file_picker + sha256: ab13ae8ef5580a411c458d6207b6774a6c237d77ac37011b13994879f68a8810 + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.3.7" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_blue_plus: + dependency: "direct main" + description: + name: flutter_blue_plus + sha256: bfae0d24619940516261045d8b3c74b4c80ca82222426e05ffbf7f3ea9dbfb1a + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.35.5" + flutter_blue_plus_android: + dependency: transitive + description: + name: flutter_blue_plus_android + sha256: "9723dd4ba7dcc3f27f8202e1159a302eb4cdb88ae482bb8e0dd733b82230a258" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.5" + flutter_blue_plus_darwin: + dependency: transitive + description: + name: flutter_blue_plus_darwin + sha256: f34123795352a9761e321589aa06356d3b53f007f13f7e23e3c940e733259b2d + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.1" + flutter_blue_plus_linux: + dependency: transitive + description: + name: flutter_blue_plus_linux + sha256: "635443d1d333e3695733fd70e81ee0d87fa41e78aa81844103d2a8a854b0d593" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.2" + flutter_blue_plus_platform_interface: + dependency: transitive + description: + name: flutter_blue_plus_platform_interface + sha256: a4bb70fa6fd09e0be163b004d773bf19e31104e257a4eb846b67f884ddd87de2 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.2" + flutter_blue_plus_web: + dependency: transitive + description: + name: flutter_blue_plus_web + sha256: "03023c259dbbba1bc5ce0fcd4e88b364f43eec01d45425f393023b9b2722cf4d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + flutter_local_notifications: + dependency: "direct main" + description: + name: flutter_local_notifications + sha256: "674173fd3c9eda9d4c8528da2ce0ea69f161577495a9cc835a2a4ecd7eadeb35" + url: "https://pub.flutter-io.cn" + source: hosted + version: "17.2.4" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.1" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.2.0" + flutter_map: + dependency: "direct main" + description: + name: flutter_map + sha256: "2ecb34619a4be19df6f40c2f8dce1591675b4eff7a6857bd8f533706977385da" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.2" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "1c2b787f99bdca1f3718543f81d38aa1b124817dfeb9fb196201bea85b6134bf" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.26" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: f62bcd90459e63210bbf9c35deb6a51c521f992a78de19a1fe5c11704f9530e2 + url: "https://pub.flutter-io.cn" + source: hosted + version: "13.0.4" + geolocator_android: + dependency: "direct main" + description: + name: geolocator_android + sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.6.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.13" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.2.6" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.3" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.5" + get_it: + dependency: transitive + description: + name: get_it + sha256: a4292e7cf67193f8e7c1258203104eb2a51ec8b3a04baa14695f4064c144297b + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.2" + hive: + dependency: "direct main" + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.3" + hive_flutter: + dependency: "direct main" + description: + name: hive_flutter + sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + hive_generator: + dependency: "direct dev" + description: + name: hive_generator + sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + http: + dependency: transitive + description: + name: http + sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.2" + image: + dependency: transitive + description: + name: image + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.5.4" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.19.0" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.9.0" + latlong2: + dependency: "direct main" + description: + name: latlong2 + sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.9.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + logger: + dependency: transitive + description: + name: logger + sha256: "2621da01aabaf223f8f961e751f2c943dbb374dc3559b982f200ccedadaa6999" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2-main.4" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + mgrs_dart: + dependency: transitive + description: + name: mgrs_dart + sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + msix: + dependency: "direct main" + description: + name: msix + sha256: f88033fcb9e0dd8de5b18897cbebbd28ea30596810f4a7c86b12b0c03ace87e5 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.16.12" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + sha256: "16eee997588c60225bda0488b6dcfac69280a6b7a3cf02c741895dd370a02968" + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.3.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.1" + path: + dependency: "direct main" + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.9.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.15" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.0" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: "59adad729136f01ea9e35a48f5d1395e25cba6cea552249ddbe9cf950f5d7849" + url: "https://pub.flutter-io.cn" + source: hosted + version: "11.4.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: d3971dcdd76182a0c198c096b5db2f0884b0d4196723d21a866fc4cdea057ebc + url: "https://pub.flutter-io.cn" + source: hosted + version: "12.1.0" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023 + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.4.7" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.3+5" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.3.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.8" + polylabel: + dependency: transitive + description: + name: polylabel + sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.1" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.3" + proj4dart: + dependency: transitive + description: + name: proj4dart + sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.0" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.28.0" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: fce43200aa03ea87b91ce4c3ac79f0cecd52e2a7a56c7a4185023c271fbfa6da + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.1.4" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.0.2" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "9f9f3d372d4304723e6136663bb291c0b93f5e4c8a4a6314347f481a33bda2b1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.7" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.5" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.0" + sqflite: + dependency: "direct main" + description: + name: sqflite + sha256: "2d7299468485dca85efeeadf5d38986909c5eb0cd71fd3db2c2f000e6c9454bb" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.0" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "761b9740ecbd4d3e66b8916d784e581861fd3c3553eda85e167bc49fdb68f709" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.4+6" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "22adfd9a2c7d634041e96d6241e6e1c8138ca6817018afc5d443fef91dcefa9c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1+1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.3.0+3" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.2" + timezone: + dependency: transitive + description: + name: timezone + sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.9.4" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.0" + unicode: + dependency: transitive + description: + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.14" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.3" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.4" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.5.1" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "14.2.5" + watcher: + dependency: transitive + description: + name: watcher + sha256: "5bf046f41320ac97a469d506261797f35254fa61c641741ef32dacda98b7d39c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.3" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.3" + win32: + dependency: transitive + description: + name: win32 + sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.10.1" + wkt_parser: + dependency: transitive + description: + name: wkt_parser + sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.5.4 <4.0.0" + flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..81758c0 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,118 @@ +name: lbjconsole +description: "LBJ Console" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +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: 0.1.3-flutter + +environment: + sdk: ^3.5.4 + +# 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 + + cupertino_icons: ^1.0.8 + flutter_blue_plus: ^1.31.15 + permission_handler: ^11.3.1 + provider: ^6.1.2 + shared_preferences: ^2.3.2 + hive: ^2.2.3 + hive_flutter: ^1.1.0 + path: ^1.9.0 + path_provider: ^2.1.4 + intl: ^0.19.0 + flutter_local_notifications: ^17.2.2 + flutter_map: ^7.0.2 + latlong2: ^0.9.1 + geolocator: ^13.0.4 + geolocator_android: 4.6.1 + url_launcher: ^6.2.5 + sqflite: ^2.3.3+1 + share_plus: ^10.0.0 + file_picker: ^8.1.2 + package_info_plus: ^8.1.2 + msix: ^3.16.12 + +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: ^4.0.0 + hive_generator: ^2.0.1 + build_runner: ^2.4.6 +# 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 + + # To add assets to your application, add an assets section, like this: + assets: + - assets/loco_info.csv + - assets/train_number_info.csv + - assets/loco_type_info.csv + + # 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 + +msix_config: + display_name: LBJ Console + publisher_display_name: Noxylva + identity_name: LBJConsole + publisher: CN=noxylva, O=noxylva.org, C=US + logo_path: assets/icon.png + capabilities: bluetooth,internetClient,location + certificate_path: keystore.jks \ No newline at end of file diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..ed9dc65 --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + lbjconsole + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..78e33e0 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "lbjconsole", + "short_name": "lbjconsole", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} 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..2bb5548 --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(lbjconsole 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 "lbjconsole") + +# 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..8186d7f --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,23 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include +#include +#include + +void RegisterPlugins(flutter::PluginRegistry* registry) { + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); +} 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..fb6bd2e --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,27 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + geolocator_windows + permission_handler_windows + share_plus + url_launcher_windows +) + +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..338d5fa --- /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", "org.noxylva" "\0" + VALUE "FileDescription", "lbjconsole" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "lbjconsole" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 org.noxylva. All rights reserved." "\0" + VALUE "OriginalFilename", "lbjconsole.exe" "\0" + VALUE "ProductName", "lbjconsole" "\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..8b0233d --- /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"lbjconsole", 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..3a0b465 --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#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(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || 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_