├── .github └── workflows │ ├── Build.yml │ └── Release.yml ├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── opensource │ │ │ │ └── wax │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ci ├── cmd │ ├── check_asset │ │ └── main.go │ ├── check_release │ │ └── main.go │ ├── send_to_community │ │ └── main.go │ └── upload_asset │ │ └── main.go ├── commons │ ├── funcs.go │ └── types.go ├── go.mod ├── go.sum ├── linux_font.yaml ├── version.code.txt └── version.info.txt ├── images └── ic.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── assets │ ├── error.png │ ├── icon.png │ └── startup.png ├── basic │ ├── cates.dart │ ├── commons.dart │ └── methods.dart ├── configs │ ├── android_display_mode.dart │ ├── android_version.dart │ ├── app_orientation.dart │ ├── auto_clean.dart │ ├── download_thread_count.dart │ ├── host.dart │ ├── is_pro.dart │ ├── login_state.dart │ ├── pager_column_number.dart │ ├── pager_controller_mode.dart │ ├── pager_view_mode.dart │ ├── reader_controller_type.dart │ ├── reader_direction.dart │ ├── reader_slider_position.dart │ ├── reader_type.dart │ ├── themes.dart │ ├── versions.dart │ ├── view_log_clean.dart │ └── volume_controller.dart ├── main.dart ├── main_desktop.dart ├── protos │ ├── properties.pb.dart │ ├── properties.pbenum.dart │ ├── properties.pbjson.dart │ └── properties.pbserver.dart └── screens │ ├── app_screen.dart │ ├── browser_screen.dart │ ├── calculator_screen.dart │ ├── comic_histories_screen.dart │ ├── comic_info_screen.dart │ ├── comic_reader_screen.dart │ ├── components │ ├── actions.dart │ ├── badge.dart │ ├── browser_bottom_sheet.dart │ ├── comic_info_card.dart │ ├── comic_list.dart │ ├── comic_pager.dart │ ├── content_builder.dart │ ├── content_error.dart │ ├── content_loading.dart │ ├── download_info_card.dart │ ├── error_types.dart │ ├── images.dart │ └── mouse_and_touch_scroll_behavior.dart │ ├── download_info_screen.dart │ ├── downloads_screen.dart │ ├── exporting_screen.dart │ ├── exports_screen.dart │ ├── favourite_screen.dart │ ├── file_photo_view_screen.dart │ ├── first_login_screen.dart │ ├── init_screen.dart │ ├── pro_screen.dart │ ├── search_screen.dart │ └── settings_screen.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── protos └── properties.proto ├── pubspec.lock ├── pubspec.yaml ├── scripts ├── README.md ├── bind-android-arm64.sh ├── bind-android-debug.sh ├── bind-ios-arm64.sh ├── bind-ios.sh ├── build-apk-arm.sh ├── build-apk-arm64.sh ├── build-apk-x64.sh ├── build-apk-x86.sh ├── build-ipa.sh ├── build-macos-dmg.sh ├── protoc.sh ├── sign-apk-github-actions.sh ├── test.http ├── thin-payload.sh └── version.sh ├── test └── widget_test.dart └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | 48 | #lib/protos/ 49 | #go/protos/ 50 | go/mobile/lib/*.jar 51 | go/mobile/lib/*.aar 52 | go/mobile/lib/*.xcframework 53 | lib/assets/version.txt 54 | 55 | .vscode/ 56 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7e9793dee1b85a243edd0e06cb1658e98b077561 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2022 niuhuan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | 5 |
6 | Wax Comic 7 | 8 | 9 | [![license](https://img.shields.io/github/license/niuhuan/wax)](https://raw.githubusercontent.com/niuhuan/wax/master/LICENSE) 10 | [![releases](https://img.shields.io/github/v/release/niuhuan/wax)](https://github.com/niuhuan/wax/releases) 11 |

12 |
13 | 14 | 15 |
16 | 17 | 18 | - 美观易用且无广告的漫画客户端, 能运行在Windows/MacOS/Linux/Android/IOS中。 19 | - 您的star和issue是对开发者的莫大鼓励, 可以源仓库下载最新的源码/安装包, 表示支持/提出建议。 20 | - 源仓库地址 [https://github.com/niuhuan/wax](https://github.com/niuhuan/wax) 21 | 22 | 23 | ## 技术架构 24 | 25 | ### 多平台适配 26 | 27 | 这个应用程序使用golang和dart(flutter)作为主要语言, 可以兼容Windows, linux, MacOS, Android, IOS 28 | 29 | 使用了不同的框架桥接到桌面和移动平台上 30 | 31 | - go-flutter => Windows / MacOS / Linux 32 | - gomobile => Android / IOS 33 | 34 | 35 | ### 构建环境 36 | 37 | - [golang](https://golang.org/) (1.16) 38 | - [flutter](https://flutter.dev/) (2.10.3) 39 | 40 | ## 请您遵守使用规则 41 | 42 | 软件副本分发和使用规则 (Releases) 43 | 44 | - 本软件仅供学习交流使用, 本软件或本软件的拓展, 个人或企业不可用于商业用途, 不可上架任何商店 45 | - 不要在任何其他 **二次元软件** 的 **聊天社区** 或 **开发社区** 内, 发布有关本软件的链接或信息 46 | - 不要发送本软件安装包到 **任何社区内** , 不要将APK/IPA/ZIP/DMG发送包括任何聊天软件内的群聊功能。 分享本软件时, 在社区中使用Github中提供的Releases页面的链接, 或使用私聊窗口发送。 47 | 48 | 拓展包括但是不限于以下内容 49 | 50 | - 使用本软件进行继续开发形成的软件。 51 | - 引入本软件部分内容为依赖/参考本软件/使用本软件内代码的同时, 包含本软件内一致内容或功能的软件。 52 | - 直接对本软件进行打包发布 53 | 54 | 责任声明 55 | 56 | - 仓库中的源码您可以按照 [LICENSE](LICENSE) 使用。 57 | 58 | - 此APP内容存在限制级别内容(例如 露骨/血腥/暴力/吸毒),您应当在遵守当地法律法规。 59 | 60 | - 作者仅分享编程技术, 不分发软件, 不对分发软件承担任何后果。 因传播或下载造成的法律问题或纠纷, 需行为人自行承担, 请您遵守当地法以及副本接受方(社区或人)所在地区的法律。 61 | 62 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 33 // flutter.compileSdkVersion 30 | // ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "opensource.wax" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 50 | minSdkVersion 21 // flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1' 72 | implementation fileTree(dir: "../../go/mobile/lib", include: ["*.jar", "*.aar"]) 73 | } 74 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 31 | 35 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /ci/cmd/check_asset/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ci/commons" 5 | "encoding/json" 6 | "fmt" 7 | "io/ioutil" 8 | "net/http" 9 | "os" 10 | "strings" 11 | ) 12 | 13 | func main() { 14 | // get ghToken 15 | ghToken := os.Getenv("GH_TOKEN") 16 | if ghToken == "" { 17 | println("Env ${GH_TOKEN} is not set") 18 | os.Exit(1) 19 | } 20 | // get version 21 | version := commons.LoadVersion() 22 | // get target 23 | target := os.Getenv("TARGET") 24 | if target == "" { 25 | println("Env ${TARGET} is not set") 26 | os.Exit(1) 27 | } 28 | // get target 29 | flutterVersion := os.Getenv("flutter_version") 30 | if target == "" { 31 | println("Env ${flutter_version} is not set") 32 | os.Exit(1) 33 | } 34 | // 35 | var releaseFileName string 36 | switch target { 37 | case "macos": 38 | releaseFileName = fmt.Sprintf("wax-%v-macos-intel.dmg", version.Code) 39 | case "ios": 40 | releaseFileName = fmt.Sprintf("wax-%v-ios-nosign.ipa", version.Code) 41 | case "windows": 42 | releaseFileName = fmt.Sprintf("wax-%v-windows-x86_64.zip", version.Code) 43 | case "linux": 44 | releaseFileName = fmt.Sprintf("wax-%v-linux-x86_64.AppImage", version.Code) 45 | case "android-arm32": 46 | releaseFileName = fmt.Sprintf("wax-%v-android-arm32.apk", version.Code) 47 | case "android-arm64": 48 | releaseFileName = fmt.Sprintf("wax-%v-android-arm64.apk", version.Code) 49 | case "android-x86_64": 50 | releaseFileName = fmt.Sprintf("wax-%v-android-x86_64.apk", version.Code) 51 | } 52 | if strings.HasPrefix(flutterVersion, "2.") { 53 | releaseFileName = "z-of-" + releaseFileName 54 | } 55 | // get version 56 | getReleaseRequest, err := http.NewRequest( 57 | "GET", 58 | fmt.Sprintf("https://api.github.com/repos/%v/%v/releases/tags/%v", commons.Owner, commons.Repo, version.Code), 59 | nil, 60 | ) 61 | if err != nil { 62 | panic(err) 63 | } 64 | getReleaseRequest.Header.Set("User-Agent", commons.Ua) 65 | getReleaseRequest.Header.Set("Authorization", "token "+ghToken) 66 | getReleaseResponse, err := http.DefaultClient.Do(getReleaseRequest) 67 | if err != nil { 68 | panic(err) 69 | } 70 | defer getReleaseResponse.Body.Close() 71 | if getReleaseResponse.StatusCode == 404 { 72 | panic("NOT FOUND RELEASE") 73 | } 74 | buff, err := ioutil.ReadAll(getReleaseResponse.Body) 75 | if err != nil { 76 | panic(err) 77 | } 78 | var release commons.Release 79 | err = json.Unmarshal(buff, &release) 80 | if err != nil { 81 | println(string(buff)) 82 | panic(err) 83 | } 84 | for _, asset := range release.Assets { 85 | if asset.Name == releaseFileName { 86 | println("::set-output name=skip_build::true") 87 | os.Exit(0) 88 | } 89 | } 90 | print("::set-output name=skip_build::false") 91 | } 92 | -------------------------------------------------------------------------------- /ci/cmd/check_release/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "ci/commons" 6 | "encoding/json" 7 | "fmt" 8 | "io/ioutil" 9 | "net/http" 10 | "os" 11 | ) 12 | 13 | func main() { 14 | // get ghToken 15 | ghToken := os.Getenv("GH_TOKEN") 16 | if ghToken == "" { 17 | println("Env ${GH_TOKEN} is not set") 18 | os.Exit(1) 19 | } 20 | // get version 21 | version := commons.LoadVersion() 22 | // get version 23 | getReleaseRequest, err := http.NewRequest( 24 | "GET", 25 | fmt.Sprintf("https://api.github.com/repos/%v/%v/releases/tags/%v", commons.Owner, commons.Repo, version.Code), 26 | nil, 27 | ) 28 | if err != nil { 29 | panic(nil) 30 | } 31 | getReleaseRequest.Header.Set("User-Agent", commons.Ua) 32 | getReleaseRequest.Header.Set("Authorization", "token "+ghToken) 33 | getReleaseResponse, err := http.DefaultClient.Do(getReleaseRequest) 34 | if err != nil { 35 | panic(nil) 36 | } 37 | defer getReleaseResponse.Body.Close() 38 | if getReleaseResponse.StatusCode == 404 { 39 | url := fmt.Sprintf("https://api.github.com/repos/%v/%v/releases", commons.Owner, commons.Repo) 40 | body := map[string]interface{}{ 41 | "tag_name": version.Code, 42 | "target_commitish": commons.MainBranch, 43 | "name": version.Code, 44 | "body": version.Info, 45 | } 46 | var buff []byte 47 | buff, err = json.Marshal(&body) 48 | if err != nil { 49 | panic(err) 50 | } 51 | var createReleaseRequest *http.Request 52 | createReleaseRequest, err = http.NewRequest("POST", url, bytes.NewBuffer(buff)) 53 | if err != nil { 54 | panic(nil) 55 | } 56 | createReleaseRequest.Header.Set("User-Agent", commons.Ua) 57 | createReleaseRequest.Header.Set("Authorization", "token "+ghToken) 58 | var createReleaseResponse *http.Response 59 | createReleaseResponse, err = http.DefaultClient.Do(createReleaseRequest) 60 | if err != nil { 61 | panic(nil) 62 | } 63 | defer createReleaseResponse.Body.Close() 64 | if createReleaseResponse.StatusCode != 201 { 65 | buff, err = ioutil.ReadAll(createReleaseResponse.Body) 66 | if err != nil { 67 | panic(err) 68 | } 69 | println(string(buff)) 70 | panic("NOT 201") 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ci/cmd/send_to_community/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ci/commons" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "github.com/andersfylling/disgord" 9 | tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" 10 | "io/ioutil" 11 | "log" 12 | "os" 13 | "strings" 14 | ) 15 | 16 | func main() { 17 | // get version 18 | var version commons.Version 19 | codeFile, err := ioutil.ReadFile("version.code.txt") 20 | if err != nil { 21 | panic(err) 22 | } 23 | version.Code = strings.TrimSpace(string(codeFile)) 24 | infoFile, err := ioutil.ReadFile("version.info.txt") 25 | if err != nil { 26 | panic(err) 27 | } 28 | version.Info = strings.TrimSpace(string(infoFile)) 29 | // message 30 | var message = fmt.Sprintf( 31 | "%v 版本 %v 发布! \n\n"+ 32 | "更新内容:\n"+ 33 | "%v\n\n"+ 34 | "https://github.com/%v/%v/releases/tag/%v", 35 | commons.Repo, version.Code, version.Info, commons.Owner, commons.Repo, version.Code, 36 | ) 37 | // get accounts 38 | tgToken := os.Getenv("TG_BOT_TOKEN") 39 | tgChatIdsStr := os.Getenv("TG_CHAT_IDS") 40 | discordToken := os.Getenv("DISCORD_BOT_TOKEN") 41 | discordChatIdsStr := os.Getenv("DISCORD_CHAT_IDS") 42 | if tgToken != "" && tgChatIdsStr != "" { 43 | var tgChatIds []int64 44 | json.Unmarshal([]byte(tgChatIdsStr), &tgChatIds) 45 | if len(tgChatIds) > 0 { 46 | sendMessageToTg(tgToken, tgChatIds, message) 47 | } 48 | } 49 | if discordToken != "" && discordChatIdsStr != "" { 50 | var discordChatIds []uint64 51 | json.Unmarshal([]byte(discordChatIdsStr), &discordChatIds) 52 | if len(discordChatIds) > 0 { 53 | sendMessageToDiscord(discordToken, discordChatIds, message) 54 | } 55 | } 56 | } 57 | 58 | func sendMessageToTg(token string, ids []int64, message string) { 59 | bot, err := tgbotapi.NewBotAPI(token) 60 | if err != nil { 61 | log.Panic(err) 62 | } 63 | for _, id := range ids { 64 | msg := tgbotapi.NewMessage(id, message) 65 | _, err = bot.Send(msg) 66 | if err != nil { 67 | fmt.Sprintf("Send message to tg chat : %v (error : %v)", id, err.Error()) 68 | } else { 69 | fmt.Sprintf("Send message to tg chat : %v (success)", id) 70 | } 71 | } 72 | } 73 | 74 | func sendMessageToDiscord(token string, ids []uint64, message string) { 75 | client, err := disgord.NewClient(context.Background(), disgord.Config{ 76 | BotToken: token, 77 | }) 78 | if err != nil { 79 | fmt.Sprintf("discord login failed : %v", err.Error()) 80 | return 81 | } 82 | for _, id := range ids { 83 | _, err = client.SendMsg(disgord.Snowflake(id), message) 84 | if err != nil { 85 | fmt.Sprintf("Send message to tg chat : %v (error : %v)", id, err.Error()) 86 | } else { 87 | fmt.Sprintf("Send message to tg chat : %v (success)", id) 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /ci/cmd/upload_asset/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ci/commons" 5 | "encoding/json" 6 | "fmt" 7 | "io/ioutil" 8 | "net/http" 9 | "os" 10 | "path" 11 | "strings" 12 | ) 13 | 14 | func main() { 15 | // get ghToken 16 | ghToken := os.Getenv("GH_TOKEN") 17 | if ghToken == "" { 18 | println("Env ${GH_TOKEN} is not set") 19 | os.Exit(1) 20 | } 21 | // get version 22 | version := commons.LoadVersion() 23 | // get target 24 | target := os.Getenv("TARGET") 25 | if target == "" { 26 | println("Env ${TARGET} is not set") 27 | os.Exit(1) 28 | } 29 | // get target 30 | flutterVersion := os.Getenv("flutter_version") 31 | if target == "" { 32 | println("Env ${flutter_version} is not set") 33 | os.Exit(1) 34 | } 35 | // 36 | var releaseFileName string 37 | switch target { 38 | case "macos": 39 | releaseFileName = fmt.Sprintf("wax-%v-macos-intel.dmg", version.Code) 40 | case "ios": 41 | releaseFileName = fmt.Sprintf("wax-%v-ios-nosign.ipa", version.Code) 42 | case "windows": 43 | releaseFileName = fmt.Sprintf("wax-%v-windows-x86_64.zip", version.Code) 44 | case "linux": 45 | releaseFileName = fmt.Sprintf("wax-%v-linux-x86_64.AppImage", version.Code) 46 | case "android-arm32": 47 | releaseFileName = fmt.Sprintf("wax-%v-android-arm32.apk", version.Code) 48 | case "android-arm64": 49 | releaseFileName = fmt.Sprintf("wax-%v-android-arm64.apk", version.Code) 50 | case "android-x86_64": 51 | releaseFileName = fmt.Sprintf("wax-%v-android-x86_64.apk", version.Code) 52 | } 53 | if strings.HasPrefix(flutterVersion, "2.") { 54 | releaseFileName = "z-of-" + releaseFileName 55 | } 56 | // 57 | var releaseFilePath string 58 | var contentType string 59 | var contentLength int64 60 | switch target { 61 | case "macos": 62 | releaseFilePath = "build/build.dmg" 63 | contentType = "application/octet-stream" 64 | case "ios": 65 | releaseFilePath = "build/nosign.ipa" 66 | contentType = "application/octet-stream" 67 | case "windows": 68 | releaseFilePath = "build/build.zip" 69 | contentType = "application/octet-stream" 70 | case "linux": 71 | releaseFilePath = "build/build.AppImage" 72 | contentType = "application/octet-stream" 73 | case "android-arm32": 74 | releaseFilePath = "build/app/outputs/flutter-apk/app-release.apk" 75 | contentType = "application/octet-stream" 76 | case "android-arm64": 77 | releaseFilePath = "build/app/outputs/flutter-apk/app-release.apk" 78 | contentType = "application/octet-stream" 79 | case "android-x86_64": 80 | releaseFilePath = "build/app/outputs/flutter-apk/app-release.apk" 81 | contentType = "application/octet-stream" 82 | } 83 | releaseFilePath = path.Join("..", releaseFilePath) 84 | info, err := os.Stat(releaseFilePath) 85 | if err != nil { 86 | panic(err) 87 | } 88 | contentLength = info.Size() 89 | // get version 90 | getReleaseRequest, err := http.NewRequest( 91 | "GET", 92 | fmt.Sprintf("https://api.github.com/repos/%v/%v/releases/tags/%v", commons.Owner, commons.Repo, version.Code), 93 | nil, 94 | ) 95 | if err != nil { 96 | panic(err) 97 | } 98 | getReleaseRequest.Header.Set("User-Agent", commons.Ua) 99 | getReleaseRequest.Header.Set("Authorization", "token "+ghToken) 100 | getReleaseResponse, err := http.DefaultClient.Do(getReleaseRequest) 101 | if err != nil { 102 | panic(err) 103 | } 104 | defer getReleaseResponse.Body.Close() 105 | if getReleaseResponse.StatusCode == 404 { 106 | panic("NOT FOUND RELEASE") 107 | } 108 | buff, err := ioutil.ReadAll(getReleaseResponse.Body) 109 | if err != nil { 110 | panic(err) 111 | } 112 | var release commons.Release 113 | err = json.Unmarshal(buff, &release) 114 | if err != nil { 115 | println(string(buff)) 116 | panic(err) 117 | } 118 | file, err := os.Open(releaseFilePath) 119 | if err != nil { 120 | panic(err) 121 | } 122 | defer file.Close() 123 | uploadUrl := fmt.Sprintf("https://uploads.github.com/repos/%v/%v/releases/%v/assets?name=%v", commons.Owner, commons.Repo, release.Id, releaseFileName) 124 | uploadRequest, err := http.NewRequest("POST", uploadUrl, file) 125 | if err != nil { 126 | panic(err) 127 | } 128 | uploadRequest.Header.Set("User-Agent", commons.Ua) 129 | uploadRequest.Header.Set("Authorization", "token "+ghToken) 130 | uploadRequest.Header.Set("Content-Type", contentType) 131 | uploadRequest.ContentLength = contentLength 132 | uploadResponse, err := http.DefaultClient.Do(uploadRequest) 133 | if err != nil { 134 | panic(err) 135 | } 136 | if uploadResponse.StatusCode != 201 { 137 | buff, err = ioutil.ReadAll(uploadResponse.Body) 138 | if err != nil { 139 | panic(err) 140 | } 141 | println(string(buff)) 142 | panic("NOT 201") 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /ci/commons/funcs.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | import ( 4 | "io/ioutil" 5 | "strings" 6 | ) 7 | 8 | const Owner = "niuhuan" 9 | const Repo = "wax" 10 | const Ua = "niuhuan wax ci" 11 | const MainBranch = "master" 12 | 13 | func LoadVersion() Version { 14 | var version Version 15 | codeFile, err := ioutil.ReadFile("version.code.txt") 16 | if err != nil { 17 | panic(err) 18 | } 19 | version.Code = strings.TrimSpace(string(codeFile)) 20 | infoFile, err := ioutil.ReadFile("version.info.txt") 21 | if err != nil { 22 | panic(err) 23 | } 24 | version.Info = strings.TrimSpace(string(infoFile)) 25 | return version 26 | } 27 | -------------------------------------------------------------------------------- /ci/commons/types.go: -------------------------------------------------------------------------------- 1 | package commons 2 | 3 | import "time" 4 | 5 | type Version struct { 6 | Code string `json:"code"` 7 | Info string `json:"info"` 8 | } 9 | 10 | type Release struct { 11 | Url string `json:"url"` 12 | HtmlUrl string `json:"html_url"` 13 | AssetsUrl string `json:"assets_url"` 14 | UploadUrl string `json:"upload_url"` 15 | TarballUrl string `json:"tarball_url"` 16 | ZipballUrl string `json:"zipball_url"` 17 | DiscussionUrl string `json:"discussion_url"` 18 | Id int `json:"id"` 19 | NodeId string `json:"node_id"` 20 | TagName string `json:"tag_name"` 21 | TargetCommitish string `json:"target_commitish"` 22 | Name string `json:"name"` 23 | Body string `json:"body"` 24 | Draft bool `json:"draft"` 25 | Prerelease bool `json:"prerelease"` 26 | CreatedAt time.Time `json:"created_at"` 27 | PublishedAt time.Time `json:"published_at"` 28 | Author struct { 29 | Login string `json:"login"` 30 | Id int `json:"id"` 31 | NodeId string `json:"node_id"` 32 | AvatarUrl string `json:"avatar_url"` 33 | GravatarId string `json:"gravatar_id"` 34 | Url string `json:"url"` 35 | HtmlUrl string `json:"html_url"` 36 | FollowersUrl string `json:"followers_url"` 37 | FollowingUrl string `json:"following_url"` 38 | GistsUrl string `json:"gists_url"` 39 | StarredUrl string `json:"starred_url"` 40 | SubscriptionsUrl string `json:"subscriptions_url"` 41 | OrganizationsUrl string `json:"organizations_url"` 42 | ReposUrl string `json:"repos_url"` 43 | EventsUrl string `json:"events_url"` 44 | ReceivedEventsUrl string `json:"received_events_url"` 45 | Type string `json:"type"` 46 | SiteAdmin bool `json:"site_admin"` 47 | } `json:"author"` 48 | Assets []struct { 49 | Url string `json:"url"` 50 | BrowserDownloadUrl string `json:"browser_download_url"` 51 | Id int `json:"id"` 52 | NodeId string `json:"node_id"` 53 | Name string `json:"name"` 54 | Label string `json:"label"` 55 | State string `json:"state"` 56 | ContentType string `json:"content_type"` 57 | Size int `json:"size"` 58 | DownloadCount int `json:"download_count"` 59 | CreatedAt time.Time `json:"created_at"` 60 | UpdatedAt time.Time `json:"updated_at"` 61 | Uploader struct { 62 | Login string `json:"login"` 63 | Id int `json:"id"` 64 | NodeId string `json:"node_id"` 65 | AvatarUrl string `json:"avatar_url"` 66 | GravatarId string `json:"gravatar_id"` 67 | Url string `json:"url"` 68 | HtmlUrl string `json:"html_url"` 69 | FollowersUrl string `json:"followers_url"` 70 | FollowingUrl string `json:"following_url"` 71 | GistsUrl string `json:"gists_url"` 72 | StarredUrl string `json:"starred_url"` 73 | SubscriptionsUrl string `json:"subscriptions_url"` 74 | OrganizationsUrl string `json:"organizations_url"` 75 | ReposUrl string `json:"repos_url"` 76 | EventsUrl string `json:"events_url"` 77 | ReceivedEventsUrl string `json:"received_events_url"` 78 | Type string `json:"type"` 79 | SiteAdmin bool `json:"site_admin"` 80 | } `json:"uploader"` 81 | } `json:"assets"` 82 | } -------------------------------------------------------------------------------- /ci/go.mod: -------------------------------------------------------------------------------- 1 | module ci 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/andersfylling/disgord v0.35.1 7 | github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 8 | ) 9 | 10 | require ( 11 | github.com/andersfylling/snowflake/v5 v5.0.1 // indirect 12 | github.com/klauspost/compress v1.15.1 // indirect 13 | go.uber.org/atomic v1.9.0 // indirect 14 | golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect 15 | golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect 16 | golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect 17 | nhooyr.io/websocket v1.8.7 // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /ci/linux_font.yaml: -------------------------------------------------------------------------------- 1 | 2 | fonts: 3 | - family: Roboto 4 | fonts: 5 | - asset: fonts/Roboto.ttf 6 | 7 | -------------------------------------------------------------------------------- /ci/version.code.txt: -------------------------------------------------------------------------------- 1 | v1.3.7 -------------------------------------------------------------------------------- /ci/version.info.txt: -------------------------------------------------------------------------------- 1 | v1.3.7 2 | - [x] 🐛 修复下载数量超出原本数量 3 | 4 | v1.3.6 5 | - [x] ✨ 导出PDF 6 | - [x] ✨ 增加一些分流 7 | - [x] ✨ 分流设置(在设置面板) 8 | - [x] ✨ APP方向设置(在设置面板) 9 | - [x] ✨ 删除所有历史记录功能 10 | - [x] 🐛 修复历史记录第二次进入后消失 11 | - [x] 🐛 修复一些文案错误 12 | -------------------------------------------------------------------------------- /images/ic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/images/ic.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DKImagePickerController/Core (4.3.4): 3 | - DKImagePickerController/ImageDataManager 4 | - DKImagePickerController/Resource 5 | - DKImagePickerController/ImageDataManager (4.3.4) 6 | - DKImagePickerController/PhotoGallery (4.3.4): 7 | - DKImagePickerController/Core 8 | - DKPhotoGallery 9 | - DKImagePickerController/Resource (4.3.4) 10 | - DKPhotoGallery (0.0.17): 11 | - DKPhotoGallery/Core (= 0.0.17) 12 | - DKPhotoGallery/Model (= 0.0.17) 13 | - DKPhotoGallery/Preview (= 0.0.17) 14 | - DKPhotoGallery/Resource (= 0.0.17) 15 | - SDWebImage 16 | - SwiftyGif 17 | - DKPhotoGallery/Core (0.0.17): 18 | - DKPhotoGallery/Model 19 | - DKPhotoGallery/Preview 20 | - SDWebImage 21 | - SwiftyGif 22 | - DKPhotoGallery/Model (0.0.17): 23 | - SDWebImage 24 | - SwiftyGif 25 | - DKPhotoGallery/Preview (0.0.17): 26 | - DKPhotoGallery/Model 27 | - DKPhotoGallery/Resource 28 | - SDWebImage 29 | - SwiftyGif 30 | - DKPhotoGallery/Resource (0.0.17): 31 | - SDWebImage 32 | - SwiftyGif 33 | - file_picker (0.0.1): 34 | - DKImagePickerController/PhotoGallery 35 | - Flutter 36 | - Flutter (1.0.0) 37 | - permission_handler_apple (9.1.0): 38 | - Flutter 39 | - SDWebImage (5.18.3): 40 | - SDWebImage/Core (= 5.18.3) 41 | - SDWebImage/Core (5.18.3) 42 | - SwiftyGif (5.4.4) 43 | - url_launcher_ios (0.0.1): 44 | - Flutter 45 | 46 | DEPENDENCIES: 47 | - file_picker (from `.symlinks/plugins/file_picker/ios`) 48 | - Flutter (from `Flutter`) 49 | - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) 50 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 51 | 52 | SPEC REPOS: 53 | trunk: 54 | - DKImagePickerController 55 | - DKPhotoGallery 56 | - SDWebImage 57 | - SwiftyGif 58 | 59 | EXTERNAL SOURCES: 60 | file_picker: 61 | :path: ".symlinks/plugins/file_picker/ios" 62 | Flutter: 63 | :path: Flutter 64 | permission_handler_apple: 65 | :path: ".symlinks/plugins/permission_handler_apple/ios" 66 | url_launcher_ios: 67 | :path: ".symlinks/plugins/url_launcher_ios/ios" 68 | 69 | SPEC CHECKSUMS: 70 | DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac 71 | DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 72 | file_picker: 5f42b9d5580e30b57b4863f9d94b448016b702e5 73 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 74 | permission_handler_apple: 67471be8e7d2fd175420743893973ac0d98c9511 75 | SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958 76 | SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f 77 | url_launcher_ios: b7f13d9491e07f5230bf3e056ab68678f896980a 78 | 79 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 80 | 81 | COCOAPODS: 1.16.2 82 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIFileSharingEnabled 6 | 7 | LSSupportsOpeningDocumentsInPlace 8 | 9 | CADisableMinimumFrameDurationOnPhone 10 | 11 | CFBundleDevelopmentRegion 12 | $(DEVELOPMENT_LANGUAGE) 13 | CFBundleDisplayName 14 | Wax 15 | CFBundleExecutable 16 | $(EXECUTABLE_NAME) 17 | CFBundleIdentifier 18 | $(PRODUCT_BUNDLE_IDENTIFIER) 19 | CFBundleInfoDictionaryVersion 20 | 6.0 21 | CFBundleName 22 | wax 23 | CFBundlePackageType 24 | APPL 25 | CFBundleShortVersionString 26 | $(FLUTTER_BUILD_NAME) 27 | CFBundleSignature 28 | ???? 29 | CFBundleVersion 30 | $(FLUTTER_BUILD_NUMBER) 31 | LSApplicationCategoryType 32 | public.app-category.entertainment 33 | LSRequiresIPhoneOS 34 | 35 | NSPhotoLibraryAddUsageDescription 36 | Save images 37 | NSPhotoLibraryUsageDescription 38 | Usage images 39 | UIApplicationSupportsIndirectInputEvents 40 | 41 | UILaunchStoryboardName 42 | LaunchScreen 43 | UIMainStoryboardFile 44 | Main 45 | UISupportedInterfaceOrientations 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | UISupportedInterfaceOrientations~ipad 52 | 53 | UIInterfaceOrientationPortrait 54 | UIInterfaceOrientationPortraitUpsideDown 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UIViewControllerBasedStatusBarAppearance 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/assets/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/lib/assets/error.png -------------------------------------------------------------------------------- /lib/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/lib/assets/icon.png -------------------------------------------------------------------------------- /lib/assets/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/lib/assets/startup.png -------------------------------------------------------------------------------- /lib/basic/cates.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/basic/commons.dart'; 3 | import 'package:wax/screens/browser_screen.dart'; 4 | 5 | const catesNvMap = { 6 | "全部漫画": "", 7 | "同人誌": "5", 8 | "同人誌 - 漢化": "1", 9 | "同人誌 - 日語": "12", 10 | "同人誌 - English": "16", 11 | "同人誌 - CG畫集": "2", 12 | "同人誌 - 3D漫畫": "22", 13 | "同人誌 - Cosplay": "3", 14 | "同人誌 - AI圖集": "37", 15 | "單行本": "6", 16 | "單行本 - 漢化": "9", 17 | "單行本 - 日語": "13", 18 | "單行本 - English": "17", 19 | "雜誌&短篇": "7", 20 | "雜誌&短篇 - 漢化": "10", 21 | "雜誌&短篇 - 日語": "14", 22 | "韓漫": "19", 23 | "韓漫 - 漢化": "20", 24 | "韓漫 - 生肉": "21", 25 | }; 26 | 27 | const catesVnMap = { 28 | "": "全部漫画", 29 | "5": "同人誌", 30 | "1": "同人誌 - 漢化", 31 | "12": "同人誌 - 日語", 32 | "16": "同人誌 - English", 33 | "2": "同人誌 - CG畫集", 34 | "3": "同人誌 - Cosplay", 35 | "6": "單行本", 36 | "9": "單行本 - 漢化", 37 | "13": "單行本 - 日語", 38 | "17": "單行本 - English", 39 | "7": "雜誌&短篇", 40 | "10": "雜誌&短篇 - 漢化", 41 | "14": "雜誌&短篇 - 日語", 42 | "19": "韓漫", 43 | "20": "韓漫 - 漢化", 44 | "21": "韓漫 - 生肉", 45 | }; 46 | 47 | Future chooseCate(BuildContext context) async { 48 | return chooseMapDialog(context, title: "选择分类", values: catesNvMap); 49 | } 50 | -------------------------------------------------------------------------------- /lib/configs/android_display_mode.dart: -------------------------------------------------------------------------------- 1 | /// 显示模式, 仅安卓有效 2 | 3 | import 'dart:io'; 4 | 5 | import 'package:flutter/material.dart'; 6 | import '../basic/commons.dart'; 7 | import '../basic/methods.dart'; 8 | import 'android_version.dart'; 9 | 10 | const _propertyName = "androidDisplayMode"; 11 | List _modes = []; 12 | String _androidDisplayMode = ""; 13 | 14 | Future initAndroidDisplayMode() async { 15 | if (Platform.isAndroid) { 16 | _androidDisplayMode = await methods.loadProperty(k: _propertyName); 17 | _modes = await methods.loadAndroidModes(); 18 | await _changeMode(); 19 | } 20 | } 21 | 22 | Future _changeMode() async { 23 | await methods.setAndroidMode(_androidDisplayMode); 24 | } 25 | 26 | Future _chooseAndroidDisplayMode(BuildContext context) async { 27 | if (Platform.isAndroid) { 28 | List list = [""]; 29 | list.addAll(_modes); 30 | String? result = await chooseListDialog( 31 | context, 32 | title: "安卓屏幕刷新率", 33 | values: list, 34 | ); 35 | if (result != null) { 36 | await methods.saveProperty(k: _propertyName, v: result); 37 | _androidDisplayMode = result; 38 | await _changeMode(); 39 | } 40 | } 41 | } 42 | 43 | Widget androidDisplayModeSetting() { 44 | if (Platform.isAndroid && androidVersion >= 23) { 45 | return StatefulBuilder( 46 | builder: (BuildContext context, void Function(void Function()) setState) { 47 | return ListTile( 48 | title: const Text("屏幕刷新率(安卓)"), 49 | subtitle: Text(_androidDisplayMode), 50 | onTap: () async { 51 | await _chooseAndroidDisplayMode(context); 52 | setState(() {}); 53 | }, 54 | ); 55 | }, 56 | ); 57 | } 58 | return Container(); 59 | } 60 | -------------------------------------------------------------------------------- /lib/configs/android_version.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import '../basic/methods.dart'; 4 | 5 | int _androidVersion = 0; 6 | 7 | int get androidVersion => _androidVersion; 8 | 9 | Future initAndroidVersion() async { 10 | _androidVersion = await methods.androidGetVersion(); 11 | } 12 | -------------------------------------------------------------------------------- /lib/configs/app_orientation.dart: -------------------------------------------------------------------------------- 1 | // AppOrientation.dart 2 | 3 | import 'dart:io'; 4 | 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:wax/basic/methods.dart'; 8 | 9 | import '../basic/commons.dart'; 10 | import '../protos/properties.pb.dart'; 11 | 12 | const _propertyName = "appOrientation"; 13 | late AppOrientation _appOrientation; 14 | 15 | enum AppOrientation { 16 | normal, 17 | landscape, 18 | portrait, 19 | } 20 | 21 | String appOrientationName(AppOrientation type) { 22 | switch (type) { 23 | case AppOrientation.normal: 24 | return "正常"; 25 | case AppOrientation.landscape: 26 | return "横屏"; 27 | case AppOrientation.portrait: 28 | return "竖屏"; 29 | } 30 | } 31 | 32 | Future initAppOrientation() async { 33 | var v = await methods.loadProperty(k: _propertyName); 34 | if (v.isEmpty) { 35 | _appOrientation = AppOrientation.normal; 36 | } else { 37 | _appOrientation = _fromString(v); 38 | } 39 | _set(); 40 | } 41 | 42 | AppOrientation _fromString(String valueForm) { 43 | for (var value in AppOrientation.values) { 44 | if (value.toString() == valueForm) { 45 | return value; 46 | } 47 | } 48 | return AppOrientation.values.first; 49 | } 50 | 51 | AppOrientation get currentAppOrientation => _appOrientation; 52 | 53 | Future chooseAppOrientation(BuildContext context) async { 54 | final Map map = {}; 55 | for (var element in AppOrientation.values) { 56 | map[appOrientationName(element)] = element; 57 | } 58 | final newAppOrientation = await chooseMapDialog( 59 | context, 60 | values: map, 61 | title: "请选择APP方向", 62 | ); 63 | if (newAppOrientation != null) { 64 | await methods.saveProperty(k: _propertyName, v: "$newAppOrientation"); 65 | _appOrientation = newAppOrientation; 66 | _set(); 67 | } 68 | } 69 | 70 | Widget appOrientationWidget() { 71 | if (!Platform.isAndroid && !Platform.isIOS) { 72 | return const SizedBox.shrink(); 73 | } 74 | return StatefulBuilder( 75 | builder: (BuildContext context, void Function(void Function()) setState) { 76 | return ListTile( 77 | title: const Text("APP方向"), 78 | subtitle: Text(appOrientationName(_appOrientation)), 79 | onTap: () async { 80 | await chooseAppOrientation(context); 81 | setState(() {}); 82 | }, 83 | ); 84 | }, 85 | ); 86 | } 87 | 88 | void _set() { 89 | if (Platform.isAndroid || Platform.isIOS) { 90 | switch (_appOrientation) { 91 | case AppOrientation.normal: 92 | SystemChrome.setPreferredOrientations([]); 93 | break; 94 | case AppOrientation.landscape: 95 | SystemChrome.setPreferredOrientations([ 96 | DeviceOrientation.landscapeLeft, 97 | DeviceOrientation.landscapeRight, 98 | ]); 99 | break; 100 | case AppOrientation.portrait: 101 | SystemChrome.setPreferredOrientations([ 102 | DeviceOrientation.portraitUp, 103 | DeviceOrientation.portraitDown, 104 | ]); 105 | break; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /lib/configs/auto_clean.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../basic/commons.dart'; 3 | import '../basic/methods.dart'; 4 | 5 | const _propertyName = "auto_clean"; 6 | late String autoClean; 7 | 8 | Map _nameMap(BuildContext context) => { 9 | (1000 * 3600 * 24 * 7).toString(): "一周", 10 | (1000 * 3600 * 24 * 30).toString(): "一月", 11 | (1000 * 3600 * 24 * 30 * 12).toString(): "一年", 12 | }; 13 | 14 | Future initAutoClean() async { 15 | autoClean = await methods.loadProperty(k: _propertyName); 16 | if (autoClean == "") { 17 | autoClean = "${(1000 * 3600 * 24 * 7)}"; 18 | } 19 | await methods.autoClean(time: int.parse(autoClean)); 20 | } 21 | 22 | String autoCleanName(BuildContext context) { 23 | return _nameMap(context)[autoClean] ?? "-"; 24 | } 25 | 26 | Future chooseAutoClean(BuildContext context) async { 27 | String? choose = await chooseMapDialog(context, 28 | title: "自动清理", 29 | values: _nameMap(context).map((key, value) => MapEntry(value, key))); 30 | if (choose != null) { 31 | await methods.saveProperty(k: _propertyName, v: choose); 32 | autoClean = choose; 33 | } 34 | } 35 | 36 | Widget autoCleanSetting() { 37 | return StatefulBuilder( 38 | builder: (BuildContext context, void Function(void Function()) setState) { 39 | return ListTile( 40 | title: const Text("自动清理"), 41 | subtitle: Text(autoCleanName(context)), 42 | onTap: () async { 43 | await chooseAutoClean(context); 44 | setState(() {}); 45 | }, 46 | ); 47 | }, 48 | ); 49 | } 50 | -------------------------------------------------------------------------------- /lib/configs/download_thread_count.dart: -------------------------------------------------------------------------------- 1 | /// 多线程下载并发数 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import '../basic/commons.dart'; 6 | import '../basic/methods.dart'; 7 | import 'is_pro.dart'; 8 | 9 | late int _downloadThreadCount; 10 | int get downloadThreadCount => _downloadThreadCount; 11 | const _values = [1, 2, 3, 4, 5]; 12 | 13 | Future initDownloadThreadCount() async { 14 | _downloadThreadCount = await methods.getDownloadThread(); 15 | } 16 | 17 | Widget downloadThreadCountSetting() { 18 | return StatefulBuilder( 19 | builder: (BuildContext context, void Function(void Function()) setState) { 20 | return ListTile( 21 | title: Text( 22 | "下载线程数" + (!isPro ? "(发电)" : ""), 23 | style: TextStyle( 24 | color: !isPro ? Colors.grey : null, 25 | ), 26 | ), 27 | subtitle: Text("$_downloadThreadCount"), 28 | onTap: () async { 29 | await chooseDownloadThread(context); 30 | setState(() {}); 31 | }, 32 | ); 33 | }, 34 | ); 35 | } 36 | 37 | Future chooseDownloadThread(BuildContext context) async { 38 | if (!isPro) { 39 | defaultToast(context, "先发电才能使用多线程嗷"); 40 | return; 41 | } 42 | int? value = await chooseListDialog(context,title: "选择下载线程数", values:_values,); 43 | if (value != null) { 44 | await methods.setDownloadThread(value); 45 | _downloadThreadCount = value; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/configs/host.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:wax/basic/commons.dart'; 4 | import 'package:wax/basic/methods.dart'; 5 | 6 | const _defaultHost = "https://www.wn01.uk"; 7 | const _hostMap = { 8 | "https://www.wnacg02.cc": "02CC", 9 | "https://www.wnacg01.cc": "01CC", 10 | "https://wnacg.com": "COM", 11 | "https://wnacg.ru": "RU", 12 | }; 13 | 14 | late String host; 15 | final hostEvent = Event(); 16 | 17 | Future initHost() async { 18 | if (await methods.loadProperty(k: "fc_host") == "") { 19 | await methods.saveProperty(k: "fc_host", v: "true"); 20 | await methods.saveProperty(k: "host", v: _defaultHost); 21 | } 22 | host = await methods.loadProperty(k: "host"); 23 | if (host == "") { 24 | host = _defaultHost; 25 | } 26 | } 27 | 28 | Future _updateHost(String choose) async { 29 | await methods.saveProperty(k: "host", v: choose); 30 | host = choose; 31 | hostEvent.broadcast(); 32 | } 33 | 34 | currentHost() { 35 | return _hostMap[host] ?? "自定义"; 36 | } 37 | 38 | Future chooseHost(BuildContext context) async { 39 | var choose = 40 | await chooseListDialog(context, values: ["选择预设", "手动输入"], title: '分流'); 41 | if ("选择预设" == choose) { 42 | choose = await chooseMapDialog(context, 43 | title: "分流", 44 | values: _hostMap.map((key, value) => MapEntry(value, key))); 45 | if (choose != null) { 46 | await _updateHost(choose); 47 | } 48 | } else if ("手动输入" == choose) { 49 | choose = await displayTextInputDialog(context, src: host); 50 | if (choose != null) { 51 | await _updateHost(choose); 52 | } 53 | } 54 | } 55 | 56 | Widget hostSetting() { 57 | return StatefulBuilder( 58 | builder: (BuildContext context, void Function(void Function()) setState) { 59 | return ListTile( 60 | title: const Text("分流"), 61 | subtitle: Text("${currentHost()} (登录注册不上试试换分流或改变网络)"), 62 | onTap: () async { 63 | await chooseHost(context); 64 | setState(() {}); 65 | }, 66 | ); 67 | }, 68 | ); 69 | } 70 | -------------------------------------------------------------------------------- /lib/configs/is_pro.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:wax/basic/methods.dart'; 3 | 4 | var isPro = false; 5 | var isProEx = 0; 6 | 7 | final proEvent = Event(); 8 | 9 | Future reloadIsPro() async { 10 | final p = await methods.isPro(); 11 | isPro = p.isPro; 12 | isProEx = p.expire.toInt(); 13 | proEvent.broadcast(); 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/pager_column_number.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import '../basic/commons.dart'; 5 | import '../basic/methods.dart'; 6 | 7 | const _propertyName = "pager_column_number"; 8 | late int _pagerColumnNumber; 9 | 10 | int get pagerColumnNumber => _pagerColumnNumber; 11 | final pageColumnEvent = Event(); 12 | 13 | Future initPagerColumnCount() async { 14 | String numStr = await methods.loadProperty(k: _propertyName); 15 | if (numStr == "") { 16 | numStr = "4"; 17 | } 18 | _pagerColumnNumber = int.parse(numStr); 19 | } 20 | 21 | Future choosePagerColumnCount(BuildContext context) async { 22 | final choose = await chooseListDialog( 23 | context, 24 | title: "分页每行漫画数", 25 | values: List.generate(10, (i) => i + 1), 26 | ); 27 | if (choose != null) { 28 | await methods.saveProperty(k:_propertyName, v:choose.toString()); 29 | _pagerColumnNumber = choose; 30 | pageColumnEvent.broadcast(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/configs/pager_controller_mode.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import '../basic/commons.dart'; 5 | import '../basic/methods.dart'; 6 | 7 | const _propertyKey = "pager_controller_mode"; 8 | late PagerControllerMode _value; 9 | final currentPagerControllerModeEvent = Event(); 10 | 11 | PagerControllerMode get currentPagerControllerMode => _value; 12 | 13 | enum PagerControllerMode { 14 | stream, 15 | pager, 16 | } 17 | 18 | Map _nameMap = { 19 | PagerControllerMode.stream: "流式", 20 | PagerControllerMode.pager: "分页器", 21 | }; 22 | 23 | String get currentPagerControllerModeName => _nameMap[_value]!; 24 | 25 | Future choosePagerControllerMode(BuildContext context) async { 26 | final target = await chooseMapDialog(context, 27 | title: "请选择分页模式", 28 | values: _nameMap.map((key, value) => MapEntry(value, key))); 29 | if (target != null && target != _value) { 30 | await methods.saveProperty(k: _propertyKey, v: "$target"); 31 | _value = target; 32 | currentPagerControllerModeEvent.broadcast(); 33 | } 34 | } 35 | 36 | PagerControllerMode _parse(String string) { 37 | for (var value in PagerControllerMode.values) { 38 | if ("$value" == string) { 39 | return value; 40 | } 41 | } 42 | return PagerControllerMode.stream; 43 | } 44 | 45 | Future initPagerControllerMode() async { 46 | _value = _parse(await methods.loadProperty(k: _propertyKey)); 47 | } 48 | -------------------------------------------------------------------------------- /lib/configs/pager_view_mode.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import '../basic/commons.dart'; 5 | import '../basic/methods.dart'; 6 | 7 | const _propertyKey = "pager_view_mode"; 8 | late PagerViewMode _value; 9 | final Event currentPagerViewModeEvent = Event(); 10 | 11 | PagerViewMode get currentPagerViewMode => _value; 12 | 13 | enum PagerViewMode { 14 | cover, 15 | info, 16 | titleInCover, 17 | titleAndCover, 18 | } 19 | 20 | Map _nameMap = { 21 | PagerViewMode.cover: "封面", 22 | PagerViewMode.info: "详情", 23 | PagerViewMode.titleInCover: "图文1", 24 | PagerViewMode.titleAndCover: "图文2", 25 | }; 26 | 27 | String get currentPagerViewModeName => _nameMap[_value]!; 28 | 29 | Future choosePagerViewMode(BuildContext context) async { 30 | final target = await chooseMapDialog(context, 31 | title: "请选择展现形式", 32 | values: _nameMap.map((key, value) => MapEntry(value, key))); 33 | if (target != null && target != _value) { 34 | await methods.saveProperty(k: _propertyKey, v: "$target"); 35 | _value = target; 36 | currentPagerViewModeEvent.broadcast(); 37 | } 38 | } 39 | 40 | PagerViewMode _parse(String string) { 41 | for (var value in PagerViewMode.values) { 42 | if ("$value" == string) { 43 | return value; 44 | } 45 | } 46 | return PagerViewMode.cover; 47 | } 48 | 49 | Future initPagerViewMode() async { 50 | _value = _parse(await methods.loadProperty(k: _propertyKey)); 51 | } 52 | -------------------------------------------------------------------------------- /lib/configs/reader_controller_type.dart: -------------------------------------------------------------------------------- 1 | /// 全屏操作 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import '../basic/commons.dart'; 6 | import '../basic/methods.dart'; 7 | 8 | enum ReaderControllerType { 9 | touchOnce, 10 | controller, 11 | touchDouble, 12 | touchDoubleOnceNext, 13 | threeArea, 14 | } 15 | 16 | Map _readerControllerTypeMap = { 17 | "点击屏幕一次全屏": ReaderControllerType.touchOnce, 18 | "使用控制器全屏": ReaderControllerType.controller, 19 | "双击屏幕全屏": ReaderControllerType.touchDouble, 20 | "双击屏幕全屏 + 单击屏幕下一页": ReaderControllerType.touchDoubleOnceNext, 21 | "将屏幕划分成三个区域 (上一页, 下一页, 全屏)": ReaderControllerType.threeArea, 22 | }; 23 | 24 | const _defaultController = ReaderControllerType.touchOnce; 25 | const _propertyName = "reader_controller_type"; 26 | late ReaderControllerType _readerControllerType; 27 | 28 | Future initReaderControllerType() async { 29 | _readerControllerType = _readerControllerTypeFromString( 30 | await methods.loadProperty(k: _propertyName), 31 | ); 32 | } 33 | 34 | ReaderControllerType get currentReaderControllerType => _readerControllerType; 35 | 36 | ReaderControllerType _readerControllerTypeFromString(String string) { 37 | for (var value in ReaderControllerType.values) { 38 | if (string == value.toString()) { 39 | return value; 40 | } 41 | } 42 | return _defaultController; 43 | } 44 | 45 | String currentReaderControllerTypeName() { 46 | for (var e in _readerControllerTypeMap.entries) { 47 | if (e.value == _readerControllerType) { 48 | return e.key; 49 | } 50 | } 51 | return ''; 52 | } 53 | 54 | Future chooseReaderControllerType(BuildContext context) async { 55 | ReaderControllerType? result = await chooseMapDialog( 56 | context, 57 | title: "选择操控方式", 58 | values: _readerControllerTypeMap, 59 | ); 60 | if (result != null) { 61 | await methods.saveProperty(k: _propertyName, v: result.toString()); 62 | _readerControllerType = result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/configs/reader_direction.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../basic/commons.dart'; 4 | import '../basic/methods.dart'; 5 | 6 | enum ReaderDirection { 7 | topToBottom, 8 | leftToRight, 9 | rightToLeft, 10 | } 11 | 12 | const _propertyName = "readerDirection"; 13 | late ReaderDirection _readerDirection; 14 | 15 | Future initReaderDirection() async { 16 | _readerDirection = _fromString(await methods.loadProperty(k: _propertyName)); 17 | } 18 | 19 | ReaderDirection _fromString(String valueForm) { 20 | for (var value in ReaderDirection.values) { 21 | if (value.toString() == valueForm) { 22 | return value; 23 | } 24 | } 25 | return ReaderDirection.values.first; 26 | } 27 | 28 | ReaderDirection get currentReaderDirection => _readerDirection; 29 | 30 | String readerDirectionName(ReaderDirection direction, BuildContext context) { 31 | switch (direction) { 32 | case ReaderDirection.topToBottom: 33 | return "从上到下"; 34 | case ReaderDirection.leftToRight: 35 | return "从左到右"; 36 | case ReaderDirection.rightToLeft: 37 | return "从又到左"; 38 | } 39 | } 40 | 41 | Future chooseReaderDirection(BuildContext context) async { 42 | final Map map = {}; 43 | for (var element in ReaderDirection.values) { 44 | map[readerDirectionName(element, context)] = element; 45 | } 46 | final newReaderDirection = await chooseMapDialog( 47 | context, 48 | title: "请选择阅读器方向", 49 | values: map, 50 | ); 51 | if (newReaderDirection != null) { 52 | await methods.saveProperty(k: _propertyName, v: "$newReaderDirection"); 53 | _readerDirection = newReaderDirection; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/configs/reader_slider_position.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../basic/commons.dart'; 4 | import '../basic/methods.dart'; 5 | 6 | enum ReaderSliderPosition { 7 | bottom, 8 | right, 9 | left, 10 | } 11 | 12 | const _positionNames = { 13 | ReaderSliderPosition.bottom: '下方', 14 | ReaderSliderPosition.right: '右侧', 15 | ReaderSliderPosition.left: '左侧', 16 | }; 17 | 18 | const _propertyName = "reader_slider_position"; 19 | late ReaderSliderPosition _readerSliderPosition; 20 | 21 | Future initReaderSliderPosition() async { 22 | _readerSliderPosition = _readerSliderPositionFromString( 23 | await methods.loadProperty(k: _propertyName), 24 | ); 25 | } 26 | 27 | ReaderSliderPosition _readerSliderPositionFromString(String str) { 28 | for (var value in ReaderSliderPosition.values) { 29 | if (str == value.toString()) return value; 30 | } 31 | return ReaderSliderPosition.bottom; 32 | } 33 | 34 | ReaderSliderPosition get currentReaderSliderPosition => _readerSliderPosition; 35 | 36 | String get currentReaderSliderPositionName => 37 | _positionNames[_readerSliderPosition] ?? ""; 38 | 39 | Future chooseReaderSliderPosition(BuildContext context) async { 40 | Map map = {}; 41 | _positionNames.forEach((key, value) { 42 | map[value] = key; 43 | }); 44 | ReaderSliderPosition? result = await chooseMapDialog( 45 | context, 46 | title: "选择滑动条位置", 47 | values: map, 48 | ); 49 | if (result != null) { 50 | await methods.saveProperty(k: _propertyName, v: result.toString()); 51 | _readerSliderPosition = result; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/configs/reader_type.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../basic/commons.dart'; 4 | import '../basic/methods.dart'; 5 | 6 | enum ReaderType { 7 | webtoon, 8 | gallery, 9 | webToonFreeZoom, 10 | } 11 | 12 | const _propertyName = "readerType"; 13 | late ReaderType _readerType; 14 | 15 | Future initReaderType() async { 16 | _readerType = _fromString(await methods.loadProperty(k: _propertyName)); 17 | } 18 | 19 | ReaderType _fromString(String valueForm) { 20 | for (var value in ReaderType.values) { 21 | if (value.toString() == valueForm) { 22 | return value; 23 | } 24 | } 25 | return ReaderType.values.first; 26 | } 27 | 28 | ReaderType get currentReaderType => _readerType; 29 | 30 | String readerTypeName(ReaderType type, BuildContext context) { 31 | switch (type) { 32 | case ReaderType.webtoon: 33 | return "WebToon"; 34 | case ReaderType.gallery: 35 | return "相册"; 36 | case ReaderType.webToonFreeZoom: 37 | return "自由放大滚动 无法翻页"; 38 | } 39 | } 40 | 41 | Future chooseReaderType(BuildContext context) async { 42 | final Map map = {}; 43 | for (var element in ReaderType.values) { 44 | map[readerTypeName(element, context)] = element; 45 | } 46 | final newReaderType = await chooseMapDialog( 47 | context, 48 | title: "请选择阅读器类型", 49 | values: map, 50 | ); 51 | if (newReaderType != null) { 52 | await methods.saveProperty(k: _propertyName, v: "$newReaderType"); 53 | _readerType = newReaderType; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/configs/themes.dart: -------------------------------------------------------------------------------- 1 | import 'package:event/event.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | 5 | import '../basic/commons.dart'; 6 | import '../basic/methods.dart'; 7 | 8 | final _pink = ThemeData.light().copyWith( 9 | brightness: Brightness.light, 10 | colorScheme: ColorScheme.light( 11 | secondary: Colors.pink.shade200, 12 | ), 13 | appBarTheme: AppBarTheme( 14 | systemOverlayStyle: SystemUiOverlayStyle.light, 15 | color: Colors.pink.shade200, 16 | iconTheme: const IconThemeData( 17 | color: Colors.white, 18 | ), 19 | ), 20 | bottomNavigationBarTheme: BottomNavigationBarThemeData( 21 | selectedItemColor: Colors.pink[300], 22 | unselectedItemColor: Colors.grey[500], 23 | ), 24 | dividerColor: Colors.grey.shade200, 25 | primaryColor: Colors.pink.shade200, 26 | textSelectionTheme: TextSelectionThemeData( 27 | cursorColor: Colors.pink.shade200, 28 | selectionColor: Colors.pink.shade300.withAlpha(150), 29 | selectionHandleColor: Colors.pink.shade300.withAlpha(200), 30 | ), 31 | inputDecorationTheme: InputDecorationTheme( 32 | focusedBorder: UnderlineInputBorder( 33 | borderSide: BorderSide(color: Colors.pink.shade200), 34 | ), 35 | ), 36 | ); 37 | 38 | final _dark = ThemeData.dark().copyWith( 39 | brightness: Brightness.dark, 40 | colorScheme: ColorScheme.light( 41 | secondary: Colors.pink.shade200, 42 | ), 43 | appBarTheme: const AppBarTheme( 44 | systemOverlayStyle: SystemUiOverlayStyle.light, 45 | color: Color(0xFF1E1E1E), 46 | foregroundColor: Colors.white, 47 | iconTheme: IconThemeData( 48 | color: Colors.white, 49 | ), 50 | ), 51 | bottomNavigationBarTheme: BottomNavigationBarThemeData( 52 | selectedItemColor: Colors.white, 53 | unselectedItemColor: Colors.grey.shade300, 54 | backgroundColor: Colors.grey.shade900, 55 | ), 56 | primaryColor: Colors.pink.shade200, 57 | textSelectionTheme: TextSelectionThemeData( 58 | cursorColor: Colors.pink.shade200, 59 | selectionColor: Colors.pink.shade300.withAlpha(150), 60 | selectionHandleColor: Colors.pink.shade300.withAlpha(200), 61 | ), 62 | inputDecorationTheme: InputDecorationTheme( 63 | focusedBorder: UnderlineInputBorder( 64 | borderSide: BorderSide(color: Colors.pink.shade200), 65 | ), 66 | ), 67 | ); 68 | 69 | const _propertyNameLight = "theme.light"; 70 | const _propertyNameDark = "theme.dark"; 71 | String _themeLight = "pink", _themeDark = "dark"; 72 | 73 | Future initTheme() async { 74 | _themeLight = await methods.loadProperty(k: _propertyNameLight); 75 | if (_themeLight == "") { 76 | _themeLight = "pink"; 77 | } 78 | _themeDark = await methods.loadProperty(k: _propertyNameDark); 79 | if (_themeDark == "") { 80 | _themeDark = "dark"; 81 | } 82 | themeEvent.broadcast(); 83 | } 84 | 85 | ThemeData? get lightTheme => _themeByCode(_themeLight); 86 | 87 | ThemeData? get darkTheme => _themeByCode(_themeDark); 88 | 89 | ThemeData? _themeByCode(String code) { 90 | if ("pink" == code) return _pink; 91 | if ("dark" == code) return _dark; 92 | return null; 93 | } 94 | 95 | Event themeEvent = Event(); 96 | 97 | Widget lightThemeSetting() { 98 | return StatefulBuilder( 99 | builder: (BuildContext context, void Function(void Function()) setState) { 100 | return ListTile( 101 | title: const Text("主题"), 102 | subtitle: Text(_themeLight), 103 | onTap: () async { 104 | String? choose = await chooseMapDialog( 105 | context, 106 | title: "选择主题", 107 | values: { 108 | "origin": "origin", 109 | "pink": "pink", 110 | "dark": "dark", 111 | }, 112 | ); 113 | if (choose != null) { 114 | await methods.saveProperty(k: _propertyNameLight, v: choose); 115 | _themeLight = choose; 116 | setState(() {}); 117 | themeEvent.broadcast(); 118 | } 119 | }, 120 | ); 121 | }, 122 | ); 123 | } 124 | 125 | Widget darkThemeSetting() { 126 | return StatefulBuilder( 127 | builder: (BuildContext context, void Function(void Function()) setState) { 128 | return ListTile( 129 | title: const Text("主题 (黑暗模式) (如果设备支持)"), 130 | subtitle: Text(_themeDark), 131 | onTap: () async { 132 | String? choose = await chooseMapDialog( 133 | context, 134 | title: "选择主题 (黑暗模式)", 135 | values: { 136 | "origin": "origin", 137 | "pink": "pink", 138 | "dark": "dark", 139 | }, 140 | ); 141 | if (choose != null) { 142 | await methods.saveProperty(k: _propertyNameDark, v: choose); 143 | _themeDark = choose; 144 | setState(() {}); 145 | themeEvent.broadcast(); 146 | } 147 | }, 148 | ); 149 | }, 150 | ); 151 | } 152 | -------------------------------------------------------------------------------- /lib/configs/view_log_clean.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../basic/commons.dart'; 3 | import '../basic/methods.dart'; 4 | 5 | const _propertyName = "viewLog_clean"; 6 | late String viewLogClean; 7 | 8 | Map _nameMap(BuildContext context) => { 9 | (1000 * 3600 * 24 * 7).toString(): "一周", 10 | (1000 * 3600 * 24 * 30).toString(): "一月", 11 | (1000 * 3600 * 24 * 30 * 12).toString(): "一年", 12 | }; 13 | 14 | Future initViewLogClean() async { 15 | viewLogClean = await methods.loadProperty(k: _propertyName); 16 | if (viewLogClean == "") { 17 | viewLogClean = "${(1000 * 3600 * 24 * 30)}"; 18 | } 19 | await methods.autoClearViewLog(time: int.parse(viewLogClean)); 20 | } 21 | 22 | String viewLogCleanName(BuildContext context) { 23 | return _nameMap(context)[viewLogClean] ?? "-"; 24 | } 25 | 26 | Future chooseViewLogClean(BuildContext context) async { 27 | String? choose = await chooseMapDialog(context, 28 | title: "阅读记录保存时长", 29 | values: _nameMap(context).map((key, value) => MapEntry(value, key))); 30 | if (choose != null) { 31 | await methods.saveProperty(k: _propertyName, v: choose); 32 | viewLogClean = choose; 33 | } 34 | } 35 | 36 | Widget viewLogCleanSetting() { 37 | return StatefulBuilder( 38 | builder: (BuildContext context, void Function(void Function()) setState) { 39 | return ListTile( 40 | title: const Text("阅读记录保存时长"), 41 | subtitle: Text(viewLogCleanName(context)), 42 | onTap: () async { 43 | await chooseViewLogClean(context); 44 | setState(() {}); 45 | }, 46 | ); 47 | }, 48 | ); 49 | } 50 | -------------------------------------------------------------------------------- /lib/configs/volume_controller.dart: -------------------------------------------------------------------------------- 1 | /// 音量键翻页 2 | 3 | import 'dart:io'; 4 | 5 | import 'package:flutter/material.dart'; 6 | 7 | import '../basic/commons.dart'; 8 | import '../basic/methods.dart'; 9 | 10 | const _propertyName = "volumeController"; 11 | late bool volumeController; 12 | 13 | Future initVolumeController() async { 14 | volumeController = (await methods.loadProperty(k: _propertyName)) == "true"; 15 | } 16 | 17 | Future _chooseVolumeController(BuildContext context) async { 18 | String? result = await chooseListDialog( 19 | context, 20 | title: "音量键控制翻页", 21 | values: ["是", "否"], 22 | ); 23 | if (result != null) { 24 | var target = result == "是"; 25 | await methods.saveProperty(k: _propertyName, v: "$target"); 26 | volumeController = target; 27 | } 28 | } 29 | 30 | Widget volumeControllerSetting() { 31 | if (Platform.isAndroid) { 32 | return StatefulBuilder(builder: 33 | (BuildContext context, void Function(void Function()) setState) { 34 | return ListTile( 35 | title: const Text("阅读器音量键翻页"), 36 | subtitle: Text(volumeController ? "是" : "否"), 37 | onTap: () async { 38 | await _chooseVolumeController(context); 39 | setState(() {}); 40 | }); 41 | }); 42 | } 43 | return Container(); 44 | } 45 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/screens/components/mouse_and_touch_scroll_behavior.dart'; 3 | import 'basic/commons.dart'; 4 | import 'configs/themes.dart'; 5 | import 'screens/init_screen.dart'; 6 | 7 | void main() { 8 | runApp(const MyApp()); 9 | } 10 | 11 | class MyApp extends StatefulWidget { 12 | const MyApp({Key? key}) : super(key: key); 13 | 14 | @override 15 | State createState() => _MyAppState(); 16 | } 17 | 18 | class _MyAppState extends State { 19 | @override 20 | void initState() { 21 | themeEvent.subscribe(_setState); 22 | super.initState(); 23 | } 24 | 25 | @override 26 | void dispose() { 27 | themeEvent.unsubscribe(_setState); 28 | super.dispose(); 29 | } 30 | 31 | _setState(_) => setState(() {}); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return MaterialApp( 36 | scrollBehavior: mouseAndTouchScrollBehavior, 37 | navigatorObservers: [ 38 | routeObserver, 39 | ], 40 | theme: lightTheme, 41 | darkTheme: darkTheme, 42 | home: const InitScreen(), 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/main_desktop.dart: -------------------------------------------------------------------------------- 1 | import 'main.dart' as original_main; 2 | 3 | // This file is the default main entry-point for go-flutter application. 4 | void main() { 5 | original_main.main(); 6 | } 7 | -------------------------------------------------------------------------------- /lib/protos/properties.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: protos/properties.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | -------------------------------------------------------------------------------- /lib/protos/properties.pbserver.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: protos/properties.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names 9 | // ignore_for_file: deprecated_member_use_from_same_package, library_prefixes 10 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 11 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 12 | 13 | export 'properties.pb.dart'; 14 | 15 | -------------------------------------------------------------------------------- /lib/screens/app_screen.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:wax/screens/browser_screen.dart'; 4 | 5 | class AppScreen extends StatefulWidget{ 6 | const AppScreen({Key? key}) : super(key: key); 7 | 8 | @override 9 | State createState()=>_AppScreenState(); 10 | } 11 | 12 | class _AppScreenState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return const BrowserScreen(); 16 | } 17 | } -------------------------------------------------------------------------------- /lib/screens/browser_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_search_bar/flutter_search_bar.dart' as sb; 5 | import 'package:wax/basic/methods.dart'; 6 | import 'package:wax/configs/host.dart'; 7 | import 'package:wax/protos/properties.pb.dart'; 8 | import 'package:wax/screens/comic_histories_screen.dart'; 9 | import 'package:wax/screens/downloads_screen.dart'; 10 | import 'package:wax/screens/favourite_screen.dart'; 11 | import 'package:wax/screens/pro_screen.dart'; 12 | import 'package:wax/screens/search_screen.dart'; 13 | 14 | import '../basic/cates.dart'; 15 | import '../configs/is_pro.dart'; 16 | import '../configs/versions.dart'; 17 | import 'components/actions.dart'; 18 | import 'components/browser_bottom_sheet.dart'; 19 | import 'components/comic_pager.dart'; 20 | 21 | class BrowserScreen extends StatefulWidget { 22 | final String tag; 23 | 24 | const BrowserScreen({this.tag = "", Key? key}) : super(key: key); 25 | 26 | @override 27 | State createState() => _BrowserScreenState(); 28 | } 29 | 30 | class _BrowserScreenState extends State 31 | with AutomaticKeepAliveClientMixin { 32 | @override 33 | bool get wantKeepAlive => true; 34 | 35 | @override 36 | void initState() { 37 | hostEvent.subscribe(_setState); 38 | proEvent.subscribe(_setState); 39 | Future.delayed(Duration.zero, () async { 40 | versionPop(context); 41 | versionEvent.subscribe(_versionSub); 42 | }); 43 | super.initState(); 44 | } 45 | 46 | @override 47 | void dispose() { 48 | hostEvent.unsubscribe(_setState); 49 | proEvent.unsubscribe(_setState); 50 | super.dispose(); 51 | } 52 | 53 | _setState(_) { 54 | setState(() {}); 55 | } 56 | 57 | _versionSub(_) { 58 | versionPop(context); 59 | } 60 | 61 | late final sb.SearchBar _searchBar = sb.SearchBar( 62 | hintText: '搜索', 63 | inBar: false, 64 | setState: setState, 65 | onSubmitted: (value) { 66 | if (value.isNotEmpty) { 67 | Navigator.push( 68 | context, 69 | MaterialPageRoute( 70 | builder: (context) => SearchScreen(keyword: value), 71 | ), 72 | ); 73 | } 74 | }, 75 | buildDefaultAppBar: (BuildContext context) { 76 | return AppBar( 77 | title: Text(_title()), 78 | actions: [ 79 | IconButton( 80 | onPressed: () { 81 | Navigator.of(context) 82 | .push(MaterialPageRoute(builder: (BuildContext context) { 83 | return const ComicHistoriesScreen(); 84 | })); 85 | }, 86 | icon: const Icon(Icons.history), 87 | ), 88 | ...alwaysInActions(), 89 | IconButton( 90 | onPressed: () { 91 | Navigator.of(context) 92 | .push(MaterialPageRoute(builder: (BuildContext context) { 93 | return const DownloadsScreen(); 94 | })); 95 | }, 96 | icon: const Icon(Icons.download), 97 | ), 98 | favAction(), 99 | _searchBar.getSearchAction(context), 100 | chooseCateAction(context), 101 | const BrowserBottomSheetAction(), 102 | ], 103 | ); 104 | }, 105 | ); 106 | 107 | late final _tag = widget.tag; 108 | var _cate = ""; 109 | 110 | @override 111 | Widget build(BuildContext context) { 112 | super.build(context); 113 | return Scaffold( 114 | appBar: _searchBar.build(context), 115 | body: ComicPager( 116 | key: Key("$host:$_tag:$_cate"), 117 | onPage: _onPage, 118 | ), 119 | ); 120 | } 121 | 122 | String _title() { 123 | if (_tag != "") { 124 | return _tag; 125 | } 126 | if (_cate != "") { 127 | return catesVnMap[_cate] ?? ""; 128 | } 129 | return "全部漫画"; 130 | } 131 | 132 | Future _onPage(int page) async { 133 | if (_tag != "") { 134 | return methods.fetchComic( 135 | "tag", 136 | _tag, 137 | page, 138 | ); 139 | } 140 | if (_cate != "") { 141 | return methods.fetchComic( 142 | "cate", 143 | _cate, 144 | page, 145 | ); 146 | } 147 | return methods.fetchComic("", "", page); 148 | } 149 | 150 | Widget chooseCateAction(BuildContext context) { 151 | return IconButton( 152 | onPressed: () async { 153 | final c = await chooseCate(context); 154 | if (c != null) { 155 | setState(() { 156 | _cate = c; 157 | }); 158 | } 159 | }, 160 | icon: const Icon(Icons.category), 161 | ); 162 | } 163 | 164 | Widget favAction() { 165 | return IconButton( 166 | onPressed: () { 167 | Navigator.of(context) 168 | .push(MaterialPageRoute(builder: (BuildContext context) { 169 | return const FavouriteScreen(); 170 | })); 171 | }, 172 | icon: const Icon(Icons.favorite), 173 | ); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /lib/screens/comic_histories_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/basic/commons.dart'; 3 | 4 | import '../basic/methods.dart'; 5 | import '../protos/properties.pb.dart'; 6 | import 'components/comic_pager.dart'; 7 | 8 | class ComicHistoriesScreen extends StatefulWidget { 9 | const ComicHistoriesScreen({Key? key}) : super(key: key); 10 | 11 | @override 12 | State createState() => _ComicHistoriesScreenState(); 13 | } 14 | 15 | class _ComicHistoriesScreenState extends State { 16 | var key = UniqueKey(); 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | appBar: AppBar( 27 | title: const Text("历史记录"), 28 | actions: [ 29 | IconButton( 30 | icon: const Icon(Icons.delete_forever), 31 | onPressed: () async { 32 | var a = await confirmDialog(context, "清空所有历史记录", "确定吗?"); 33 | if (a == true) { 34 | try { 35 | await methods.clearHistory(); 36 | setState(() { 37 | key = UniqueKey(); // Reset the pager 38 | }); 39 | } catch (e) { 40 | print("清空历史记录失败: $e"); 41 | } 42 | } 43 | }, 44 | ), 45 | ], 46 | ), 47 | body: ComicPager( 48 | key: key, 49 | onPage: _onPage, 50 | ), 51 | ); 52 | } 53 | 54 | Future _onPage(int page) async { 55 | return await methods.fetchHistory(page); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/screens/components/actions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../configs/versions.dart'; 4 | import '../settings_screen.dart'; 5 | import 'badge.dart'; 6 | 7 | List alwaysInActions() { 8 | return [ 9 | _SettingsAction(), 10 | ]; 11 | } 12 | 13 | class _SettingsAction extends StatefulWidget { 14 | @override 15 | State createState() => _SettingsActionState(); 16 | } 17 | 18 | class _SettingsActionState extends State<_SettingsAction> { 19 | @override 20 | void initState() { 21 | versionEvent.subscribe(_setState); 22 | super.initState(); 23 | } 24 | 25 | @override 26 | void dispose() { 27 | versionEvent.unsubscribe(_setState); 28 | super.dispose(); 29 | } 30 | 31 | void _setState(_) { 32 | setState(() {}); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return IconButton( 38 | onPressed: () { 39 | Navigator.of(context).push(MaterialPageRoute( 40 | builder: (BuildContext context) => const SettingsScreen(), 41 | )); 42 | }, 43 | icon: const VersionBadged( 44 | child: Icon(Icons.settings), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/screens/components/badge.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../configs/versions.dart'; 4 | 5 | // 提示信息, 组件右上角的小红点 6 | class Badged extends StatelessWidget { 7 | final String? badge; 8 | final Widget child; 9 | 10 | const Badged({Key? key, required this.child, this.badge}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | if (badge == null) { 15 | return child; 16 | } 17 | return Stack( 18 | children: [ 19 | child, 20 | Positioned( 21 | right: 0, 22 | child: Container( 23 | padding: const EdgeInsets.all(1), 24 | decoration: BoxDecoration( 25 | color: Colors.red, 26 | borderRadius: BorderRadius.circular(6), 27 | ), 28 | constraints: const BoxConstraints( 29 | minWidth: 12, 30 | minHeight: 12, 31 | ), 32 | child: Text( 33 | badge!, 34 | style: const TextStyle( 35 | color: Colors.white, 36 | fontSize: 8, 37 | ), 38 | textAlign: TextAlign.center, 39 | ), 40 | ), 41 | ), 42 | ], 43 | ); 44 | } 45 | } 46 | 47 | class VersionBadged extends StatefulWidget { 48 | final Widget child; 49 | 50 | const VersionBadged({required this.child, Key? key}) : super(key: key); 51 | 52 | @override 53 | State createState() => _VersionBadgedState(); 54 | } 55 | 56 | class _VersionBadgedState extends State { 57 | @override 58 | void initState() { 59 | versionEvent.subscribe(_onVersion); 60 | super.initState(); 61 | } 62 | 63 | @override 64 | void dispose() { 65 | versionEvent.unsubscribe(_onVersion); 66 | super.dispose(); 67 | } 68 | 69 | void _onVersion(dynamic a) { 70 | setState(() {}); 71 | } 72 | 73 | @override 74 | Widget build(BuildContext context) { 75 | return Badged( 76 | child: widget.child, 77 | badge: latestVersion() == null ? null : "1", 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/screens/components/comic_info_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/protos/properties.pb.dart'; 3 | 4 | import '../../basic/commons.dart'; 5 | import 'images.dart'; 6 | 7 | class ComicInfoCard extends StatelessWidget { 8 | final bool link; 9 | final ComicSimple comic; 10 | 11 | const ComicInfoCard( 12 | this.comic, { 13 | this.link = false, 14 | Key? key, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | const titleStyle = TextStyle(fontWeight: FontWeight.bold); 20 | final authorStyle = TextStyle( 21 | fontSize: 13, 22 | color: Colors.pink.shade300, 23 | ); 24 | return Container( 25 | padding: const EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), 26 | decoration: BoxDecoration( 27 | border: Border( 28 | bottom: BorderSide( 29 | color: Theme.of(context).dividerColor, 30 | ), 31 | ), 32 | ), 33 | child: Row( 34 | children: [ 35 | Card( 36 | child: ComicImage( 37 | url: comic.cover, 38 | width: 100 * coverWidth / coverHeight, 39 | height: 100, 40 | ), 41 | ), 42 | Container(width: 10), 43 | Expanded( 44 | child: Column( 45 | crossAxisAlignment: CrossAxisAlignment.start, 46 | children: [ 47 | link 48 | ? GestureDetector( 49 | onLongPress: () { 50 | confirmCopy(context, comic.title); 51 | }, 52 | child: Text(comic.title, style: titleStyle), 53 | ) 54 | : Text(comic.title, style: titleStyle), 55 | Container(height: 4), 56 | ], 57 | ), 58 | ), 59 | ], 60 | ), 61 | ); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /lib/screens/components/content_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'content_error.dart'; 3 | import 'content_loading.dart'; 4 | 5 | class ContentBuilder extends StatelessWidget { 6 | final Future future; 7 | final Future Function() onRefresh; 8 | final AsyncWidgetBuilder successBuilder; 9 | final String loadingLabel; 10 | 11 | const ContentBuilder( 12 | {Key? key, 13 | required this.future, 14 | required this.onRefresh, 15 | required this.successBuilder, 16 | this.loadingLabel = '加载中'}) 17 | : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return FutureBuilder( 22 | future: future, 23 | builder: (BuildContext context, AsyncSnapshot snapshot) { 24 | if (snapshot.hasError) { 25 | return ContentError( 26 | error: snapshot.error, 27 | stackTrace: snapshot.stackTrace, 28 | onRefresh: onRefresh, 29 | ); 30 | } 31 | if (snapshot.connectionState != ConnectionState.done) { 32 | return ContentLoading(label: loadingLabel); 33 | } 34 | return successBuilder(context, snapshot); 35 | }, 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/screens/components/content_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'error_types.dart'; 3 | 4 | 5 | class ContentError extends StatelessWidget { 6 | final Object? error; 7 | final StackTrace? stackTrace; 8 | final Future Function() onRefresh; 9 | 10 | const ContentError({ 11 | Key? key, 12 | required this.error, 13 | required this.stackTrace, 14 | required this.onRefresh, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | var type = errorType("$error"); 20 | late String message; 21 | late IconData iconData; 22 | switch (type) { 23 | case ERROR_TYPE_NETWORK: 24 | iconData = Icons.wifi_off_rounded; 25 | message = "连接不上啦, 请检查网络"; 26 | break; 27 | case ERROR_TYPE_PERMISSION: 28 | iconData = Icons.highlight_off; 29 | message = "没有权限或路径不可用"; 30 | break; 31 | case ERROR_TYPE_TIME: 32 | iconData = Icons.timer_off; 33 | message = "请检查设备时间"; 34 | break; 35 | case ERROR_TYPE_UNDER_REVIEW: 36 | iconData = Icons.highlight_off; 37 | message = "资源未审核或不可用"; 38 | break; 39 | default: 40 | iconData = Icons.highlight_off; 41 | message = "啊哦, 被玩坏了"; 42 | break; 43 | } 44 | return LayoutBuilder( 45 | builder: (BuildContext context, BoxConstraints constraints) { 46 | print("$error"); 47 | print("$stackTrace"); 48 | var width = constraints.maxWidth; 49 | var height = constraints.maxHeight; 50 | var min = width < height ? width : height; 51 | var iconSize = min / 2.3; 52 | var textSize = min / 16; 53 | var tipSize = min / 20; 54 | var infoSize = min / 30; 55 | return GestureDetector( 56 | onTap: onRefresh, 57 | child: ListView( 58 | children: [ 59 | Container( 60 | height: height, 61 | child: Column( 62 | children: [ 63 | Expanded(child: Container()), 64 | Container( 65 | child: Icon( 66 | iconData, 67 | size: iconSize, 68 | color: Colors.grey.shade600, 69 | ), 70 | ), 71 | Container(height: min / 10), 72 | Container( 73 | padding: const EdgeInsets.only( 74 | left: 30, 75 | right: 30, 76 | ), 77 | child: Text( 78 | message, 79 | style: TextStyle(fontSize: textSize), 80 | textAlign: TextAlign.center, 81 | ), 82 | ), 83 | Text('(点击刷新)', style: TextStyle(fontSize: tipSize)), 84 | Container(height: min / 15), 85 | Text('$error', style: TextStyle(fontSize: infoSize)), 86 | Expanded(child: Container()), 87 | ], 88 | ), 89 | ), 90 | ], 91 | ), 92 | ); 93 | }, 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/screens/components/content_loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ContentLoading extends StatelessWidget { 4 | final String label; 5 | 6 | const ContentLoading({Key? key, this.label = "加载中"}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return LayoutBuilder( 11 | builder: (BuildContext context, BoxConstraints constraints) { 12 | var width = constraints.maxWidth; 13 | var height = constraints.maxHeight; 14 | var min = width < height ? width : height; 15 | var theme = Theme.of(context); 16 | return Center( 17 | child: Column( 18 | children: [ 19 | Expanded(child: Container()), 20 | SizedBox( 21 | width: min / 2, 22 | height: min / 2, 23 | child: CircularProgressIndicator( 24 | color: theme.colorScheme.secondary, 25 | backgroundColor: Colors.grey[100], 26 | ), 27 | ), 28 | Container(height: min / 10), 29 | Text(label, style: TextStyle(fontSize: min / 15)), 30 | Expanded(child: Container()), 31 | ], 32 | ), 33 | ); 34 | }, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/screens/components/download_info_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/protos/properties.pb.dart'; 3 | 4 | import '../../basic/commons.dart'; 5 | import 'images.dart'; 6 | 7 | // todo 加载本地cover 8 | // todo 显示下载状态和进度 9 | class DownloadInfoCard extends StatelessWidget { 10 | final bool link; 11 | final ComicDownloadDto comic; 12 | 13 | const DownloadInfoCard( 14 | this.comic, { 15 | this.link = false, 16 | Key? key, 17 | }) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | const titleStyle = TextStyle(fontWeight: FontWeight.bold); 22 | final authorStyle = TextStyle( 23 | fontSize: 13, 24 | color: Colors.pink.shade300, 25 | ); 26 | return Container( 27 | padding: const EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), 28 | decoration: BoxDecoration( 29 | border: Border( 30 | bottom: BorderSide( 31 | color: Theme.of(context).dividerColor, 32 | ), 33 | ), 34 | ), 35 | child: Row( 36 | children: [ 37 | Card( 38 | child: ComicImage( 39 | url: comic.cover, 40 | width: 100 * coverWidth / coverHeight, 41 | height: 100, 42 | ), 43 | ), 44 | Container(width: 10), 45 | Expanded( 46 | child: Column( 47 | crossAxisAlignment: CrossAxisAlignment.start, 48 | children: [ 49 | link 50 | ? GestureDetector( 51 | onLongPress: () { 52 | confirmCopy(context, comic.title); 53 | }, 54 | child: Text(comic.title, style: titleStyle), 55 | ) 56 | : Text(comic.title, style: titleStyle), 57 | Container(height: 4), 58 | Row(children: [ 59 | Text( 60 | comic.deleting 61 | ? "删除中" 62 | : comic.status == 2 63 | ? "下载失败" 64 | : comic.status == 1 65 | ? "下载成功" 66 | : "下载中", 67 | style: TextStyle( 68 | color: comic.deleting 69 | ? Colors.red 70 | : comic.status == 2 71 | ? Colors.red 72 | : comic.status == 1 73 | ? Colors.green 74 | : Colors.blue, 75 | ), 76 | ), 77 | Container(width: 14), 78 | Text("${comic.pageDown} / ${comic.pageCount}"), 79 | ]), 80 | Container(height: 4), 81 | ], 82 | ), 83 | ), 84 | ], 85 | ), 86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/screens/components/error_types.dart: -------------------------------------------------------------------------------- 1 | const ERROR_TYPE_NETWORK = "NETWORK_ERROR"; 2 | const ERROR_TYPE_PERMISSION = "PERMISSION_ERROR"; 3 | const ERROR_TYPE_TIME = "TIME_ERROR"; 4 | const ERROR_TYPE_UNDER_REVIEW = "UNDER_VIEW_ERROR"; 5 | 6 | // 错误的类型, 方便照展示和谐的提示 7 | String errorType(String error) { 8 | // EXCEPTION 9 | // Get "https://picaapi.picacomic.com/categories": net/http: TLS handshake timeout 10 | // Get "https://picaapi.picacomic.com/comics?c=%E9%95%B7%E7%AF%87&s=ua&page=1": proxyconnect tcp: dial tcp 192.168.123.217:1080: connect: connection refused 11 | // Get "https://picaapi.picacomic.com/comics?c=%E5%85%A8%E5%BD%A9&s=ua&page=1": context deadline exceeded (Client.Timeout exceeded while awaiting headers) 12 | if (error.contains("timeout") || 13 | error.contains("connection refused") || 14 | error.contains("deadline") || 15 | error.contains("connection abort")) { 16 | return ERROR_TYPE_NETWORK; 17 | } 18 | if (error.contains("permission denied")) { 19 | return ERROR_TYPE_PERMISSION; 20 | } 21 | if (error.contains("time is not synchronize")) { 22 | return ERROR_TYPE_TIME; 23 | } 24 | if (error.contains("under review")) { 25 | return ERROR_TYPE_UNDER_REVIEW; 26 | } 27 | return ""; 28 | } 29 | -------------------------------------------------------------------------------- /lib/screens/components/mouse_and_touch_scroll_behavior.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/material.dart'; 3 | 4 | final mouseAndTouchScrollBehavior = MouseAndTouchScrollBehavior(); 5 | 6 | class MouseAndTouchScrollBehavior extends MaterialScrollBehavior { 7 | @override 8 | Set get dragDevices => { 9 | PointerDeviceKind.touch, 10 | PointerDeviceKind.mouse, 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /lib/screens/downloads_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/basic/commons.dart'; 3 | import 'package:wax/basic/methods.dart'; 4 | import 'package:wax/screens/comic_info_screen.dart'; 5 | import 'package:wax/screens/components/content_builder.dart'; 6 | 7 | import '../configs/download_thread_count.dart'; 8 | import '../protos/properties.pb.dart'; 9 | import 'components/download_info_card.dart'; 10 | import 'download_info_screen.dart'; 11 | import 'exports_screen.dart'; 12 | 13 | class DownloadsScreen extends StatefulWidget { 14 | const DownloadsScreen({Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _DownloadsScreenState(); 18 | } 19 | 20 | class _DownloadsScreenState extends State { 21 | Future _future = methods.downloads(); 22 | Key _key = UniqueKey(); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: const Text("下载"), 29 | actions: [ 30 | exportScreenButton(), 31 | threadCountButton(), 32 | IconButton( 33 | onPressed: () async { 34 | await methods.resetDownload(); 35 | setState(() { 36 | _future = methods.downloads(); 37 | _key = UniqueKey(); 38 | }); 39 | }, 40 | icon: const Icon(Icons.refresh), 41 | ), 42 | ], 43 | ), 44 | body: ContentBuilder( 45 | key: _key, 46 | future: _future, 47 | onRefresh: () async {}, 48 | successBuilder: ( 49 | BuildContext context, 50 | AsyncSnapshot snapshot, 51 | ) { 52 | final downloads = snapshot.requireData.downloads; 53 | return ListView(children: [ 54 | ...downloads.map(_downloadCard), 55 | ]); 56 | }, 57 | ), 58 | ); 59 | } 60 | 61 | Widget _downloadCard(ComicDownloadDto e) { 62 | return InkWell( 63 | onTap: () { 64 | if (e.deleting || !e.fetchedInfo || !e.fetchPage) { 65 | defaultToast(context, "此下载还未获取漫画信息\n已跳转到在线页面"); 66 | Navigator.of(context) 67 | .push(MaterialPageRoute(builder: (BuildContext context) { 68 | return ComicInfoScreen( 69 | ComicSimple( 70 | id: e.id, 71 | cover: e.cover, 72 | title: e.title, 73 | ), 74 | ); 75 | })); 76 | } else { 77 | Navigator.of(context) 78 | .push(MaterialPageRoute(builder: (BuildContext context) { 79 | return DownloadInfoScreen( 80 | e, 81 | ); 82 | })); 83 | } 84 | }, 85 | onLongPress: () async { 86 | String? result = await chooseListDialog( 87 | context, 88 | title: "删除漫画 ${e.title}?", 89 | values: ["是", "否"], 90 | ); 91 | if (result == "是") { 92 | await methods.deleteDownloadById(e.id); 93 | setState(() { 94 | _future = methods.downloads(); 95 | _key = UniqueKey(); 96 | }); 97 | } 98 | }, 99 | child: DownloadInfoCard(e), 100 | ); 101 | } 102 | 103 | Widget threadCountButton() { 104 | return MaterialButton( 105 | onPressed: () async { 106 | await chooseDownloadThread(context); 107 | setState(() {}); 108 | }, 109 | minWidth: 0, 110 | child: Text( 111 | "$downloadThreadCount线程", 112 | style: const TextStyle(color: Colors.white), 113 | ), 114 | ); 115 | } 116 | 117 | Widget exportScreenButton() { 118 | return IconButton( 119 | icon: const Icon(Icons.sim_card_download_outlined), 120 | onPressed: () async { 121 | Navigator.of(context) 122 | .push(MaterialPageRoute(builder: (BuildContext context) { 123 | return const ExportsScreen(); 124 | })); 125 | }, 126 | ); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/screens/exports_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/basic/commons.dart'; 3 | import 'package:wax/basic/methods.dart'; 4 | import 'package:wax/screens/components/content_builder.dart'; 5 | import '../protos/properties.pb.dart'; 6 | import 'components/download_info_card.dart'; 7 | import 'package:fixnum/fixnum.dart' as $fixnum; 8 | 9 | import 'exporting_screen.dart'; 10 | 11 | class ExportsScreen extends StatefulWidget { 12 | const ExportsScreen({Key? key}) : super(key: key); 13 | 14 | @override 15 | State createState() => _ExportsScreenState(); 16 | } 17 | 18 | class _ExportsScreenState extends State { 19 | Future _future = methods.downloads(); 20 | Key _key = UniqueKey(); 21 | List<$fixnum.Int64> selected = []; 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | appBar: AppBar( 27 | title: const Text("导出"), 28 | actions: [ 29 | IconButton( 30 | onPressed: () async { 31 | await methods.resetDownload(); 32 | setState(() { 33 | selected = []; 34 | _future = methods.downloads(); 35 | _key = UniqueKey(); 36 | }); 37 | }, 38 | icon: const Icon(Icons.refresh), 39 | ), 40 | IconButton( 41 | onPressed: () async { 42 | if (selected.isEmpty) { 43 | defaultToast(context, "请选择要导出的漫画"); 44 | return; 45 | } 46 | Navigator.push(context, MaterialPageRoute(builder: (context) { 47 | return ExportingScreen(selected); 48 | })); 49 | }, 50 | icon: const Icon(Icons.check), 51 | ), 52 | ], 53 | ), 54 | body: ContentBuilder( 55 | key: _key, 56 | future: _future, 57 | onRefresh: () async {}, 58 | successBuilder: ( 59 | BuildContext context, 60 | AsyncSnapshot snapshot, 61 | ) { 62 | final downloads = snapshot.requireData.downloads; 63 | List items = []; 64 | for (var value in downloads) { 65 | if (value.status == 1 && !value.deleting) { 66 | items.add(value); 67 | } 68 | } 69 | return ListView(children: [ 70 | ...items.map(_downloadCard), 71 | ]); 72 | }, 73 | ), 74 | ); 75 | } 76 | 77 | Widget _downloadCard(ComicDownloadDto e) { 78 | return InkWell( 79 | onTap: () { 80 | if (selected.contains(e.id)) { 81 | selected.remove(e.id); 82 | } else { 83 | selected.add(e.id); 84 | } 85 | setState(() {}); 86 | }, 87 | child: Stack( 88 | children: [ 89 | Align( 90 | alignment: Alignment.topRight, 91 | child: Padding( 92 | padding: EdgeInsets.all(10), 93 | child: Icon( 94 | selected.contains(e.id) 95 | ? Icons.check_box 96 | : Icons.square_outlined, 97 | color: Colors.blue, 98 | ), 99 | ), 100 | ), 101 | DownloadInfoCard(e), 102 | ], 103 | ), 104 | ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/screens/favourite_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_search_bar/flutter_search_bar.dart'; 3 | import 'package:wax/basic/methods.dart'; 4 | 5 | import '../protos/properties.pb.dart'; 6 | import 'components/actions.dart'; 7 | import 'components/browser_bottom_sheet.dart'; 8 | import 'components/comic_pager.dart'; 9 | 10 | class FavouriteScreen extends StatefulWidget { 11 | 12 | const FavouriteScreen({Key? key}) : super(key: key); 13 | 14 | @override 15 | State createState() => _FavouriteScreenState(); 16 | } 17 | 18 | class _FavouriteScreenState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | appBar: AppBar( 23 | title: const Text("收藏"), 24 | actions: [ 25 | ...alwaysInActions(), 26 | const BrowserBottomSheetAction(), 27 | ], 28 | ), 29 | body: ComicPager( 30 | onPage: _fetch, 31 | ), 32 | ); 33 | } 34 | 35 | Future _fetch(int page) async { 36 | return methods.favoriteList(0, page); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/screens/file_photo_view_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:photo_view/photo_view.dart'; 5 | 6 | import '../basic/commons.dart'; 7 | 8 | // 预览图片 9 | class FilePhotoViewScreen extends StatelessWidget { 10 | final String filePath; 11 | 12 | const FilePhotoViewScreen(this.filePath, {Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) => Scaffold( 16 | body: Stack( 17 | children: [ 18 | GestureDetector( 19 | onLongPress: () async { 20 | String? choose = await chooseListDialog( 21 | context, 22 | title: '请选择', 23 | values: ['保存图片'], 24 | ); 25 | switch (choose) { 26 | case '保存图片': 27 | saveImageFileToGallery(context, filePath); 28 | break; 29 | } 30 | }, 31 | child: PhotoView( 32 | imageProvider: FileImage(File(filePath)), 33 | ), 34 | ), 35 | InkWell( 36 | onTap: () => Navigator.of(context).pop(), 37 | child: Container( 38 | margin: EdgeInsets.only(top: 30), 39 | padding: EdgeInsets.only(left: 4, right: 4), 40 | decoration: BoxDecoration( 41 | color: Colors.black.withOpacity(.75), 42 | borderRadius: BorderRadius.only( 43 | topRight: Radius.circular(8), 44 | bottomRight: Radius.circular(8), 45 | ), 46 | ), 47 | child: Icon(Icons.keyboard_backspace, color: Colors.white), 48 | ), 49 | ), 50 | ], 51 | ), 52 | ); 53 | } 54 | -------------------------------------------------------------------------------- /lib/screens/init_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/basic/methods.dart'; 3 | import 'package:wax/configs/host.dart'; 4 | import 'package:wax/configs/is_pro.dart'; 5 | import 'package:wax/configs/pager_column_number.dart'; 6 | import 'package:wax/configs/pager_controller_mode.dart'; 7 | import 'package:wax/configs/pager_view_mode.dart'; 8 | 9 | import '../configs/android_display_mode.dart'; 10 | import '../configs/android_version.dart'; 11 | import '../configs/app_orientation.dart'; 12 | import '../configs/auto_clean.dart'; 13 | import '../configs/download_thread_count.dart'; 14 | import '../configs/login_state.dart'; 15 | import '../configs/reader_controller_type.dart'; 16 | import '../configs/reader_direction.dart'; 17 | import '../configs/reader_slider_position.dart'; 18 | import '../configs/reader_type.dart'; 19 | import '../configs/themes.dart'; 20 | import '../configs/versions.dart'; 21 | import '../configs/view_log_clean.dart'; 22 | import '../configs/volume_controller.dart'; 23 | import 'app_screen.dart'; 24 | import 'first_login_screen.dart'; 25 | 26 | class InitScreen extends StatefulWidget { 27 | const InitScreen({Key? key}) : super(key: key); 28 | 29 | @override 30 | State createState() => _InitScreenState(); 31 | } 32 | 33 | class _InitScreenState extends State { 34 | Future _init() async { 35 | await initAndroidVersion(); 36 | await initAndroidDisplayMode(); 37 | await initAutoClean(); 38 | await initViewLogClean(); 39 | await initReaderControllerType(); 40 | await initReaderDirection(); 41 | await initReaderSliderPosition(); 42 | await initReaderType(); 43 | await initVersion(); 44 | await initTheme(); 45 | await initPagerColumnCount(); 46 | await initPagerControllerMode(); 47 | await initPagerViewMode(); 48 | await initHost(); 49 | await initVolumeController(); 50 | await reloadIsPro(); 51 | await initDownloadThreadCount(); 52 | await initAppOrientation(); 53 | autoCheckNewVersion(); 54 | await initLogin(); 55 | if (await methods.loadProperty(k: "last_username") == "" && 56 | await methods.loadProperty(k: "ignoreLogin") == "") { 57 | Future.delayed(Duration.zero, () async { 58 | Navigator.of(context).pushReplacement( 59 | MaterialPageRoute(builder: (BuildContext context) { 60 | return firstLoginScreen; 61 | }), 62 | ); 63 | }); 64 | } else { 65 | Future.delayed(Duration.zero, () async { 66 | Navigator.of(context).pushReplacement( 67 | MaterialPageRoute(builder: (BuildContext context) { 68 | return const AppScreen(); 69 | }), 70 | ); 71 | }); 72 | } 73 | } 74 | 75 | @override 76 | void initState() { 77 | _init(); 78 | super.initState(); 79 | } 80 | 81 | @override 82 | Widget build(BuildContext context) { 83 | return Scaffold( 84 | body: ConstrainedBox( 85 | constraints: const BoxConstraints.expand(), 86 | child: LayoutBuilder( 87 | builder: (BuildContext context, BoxConstraints constraints) { 88 | var width = 1024; 89 | var height = 1364; 90 | var min = constraints.maxWidth > constraints.maxHeight 91 | ? constraints.maxHeight 92 | : constraints.maxWidth; 93 | var newHeight = min; 94 | var newWidth = min * width / height; 95 | return Center( 96 | child: ShaderMask( 97 | shaderCallback: (Rect bounds) { 98 | return const LinearGradient( 99 | begin: Alignment.topCenter, 100 | end: Alignment.bottomCenter, 101 | colors: [ 102 | Colors.black, 103 | Colors.black, 104 | Colors.transparent, 105 | ], 106 | stops: [0.0, 0.95, 1.0], 107 | ).createShader(bounds); 108 | }, 109 | blendMode: BlendMode.dstIn, 110 | child: Image.asset( 111 | "lib/assets/startup.png", 112 | width: newWidth, 113 | height: newHeight, 114 | ), 115 | ), 116 | ); 117 | }, 118 | ), 119 | ), 120 | ); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/screens/search_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_search_bar/flutter_search_bar.dart' as sb; 3 | import 'package:wax/basic/methods.dart'; 4 | 5 | import '../protos/properties.pb.dart'; 6 | import 'components/actions.dart'; 7 | import 'components/browser_bottom_sheet.dart'; 8 | import 'components/comic_pager.dart'; 9 | 10 | class SearchScreen extends StatefulWidget { 11 | final String keyword; 12 | 13 | const SearchScreen({required this.keyword, Key? key}) : super(key: key); 14 | 15 | @override 16 | State createState() => _SearchScreenState(); 17 | } 18 | 19 | class _SearchScreenState extends State { 20 | late final TextEditingController _textEditController = 21 | TextEditingController(text: widget.keyword); 22 | late final sb.SearchBar _searchBar = sb.SearchBar( 23 | hintText: '搜索', 24 | controller: _textEditController, 25 | inBar: false, 26 | setState: setState, 27 | onSubmitted: (value) { 28 | if (value.isNotEmpty) { 29 | Navigator.pushReplacement( 30 | context, 31 | MaterialPageRoute( 32 | builder: (context) => 33 | SearchScreen( 34 | keyword: value, 35 | ), 36 | ), 37 | ); 38 | } 39 | }, 40 | buildDefaultAppBar: (BuildContext context) { 41 | return AppBar( 42 | title: Text(widget.keyword), 43 | actions: [ 44 | ...alwaysInActions(), 45 | _searchBar.getSearchAction(context), 46 | const BrowserBottomSheetAction(), 47 | ], 48 | ); 49 | }, 50 | ); 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return Scaffold( 55 | appBar: _searchBar.build(context), 56 | body: ComicPager( 57 | onPage: _fetch, 58 | ), 59 | ); 60 | } 61 | 62 | Future _fetch(int page) async { 63 | return methods.searchComic(widget.keyword, page); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/screens/settings_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wax/configs/host.dart'; 3 | import 'package:wax/configs/themes.dart'; 4 | import 'package:wax/configs/versions.dart'; 5 | import 'package:wax/screens/comic_histories_screen.dart'; 6 | import 'package:wax/screens/pro_screen.dart'; 7 | 8 | import '../configs/app_orientation.dart'; 9 | import '../configs/auto_clean.dart'; 10 | import '../configs/is_pro.dart'; 11 | import '../configs/login_state.dart'; 12 | import '../configs/view_log_clean.dart'; 13 | import '../configs/volume_controller.dart'; 14 | 15 | class SettingsScreen extends StatelessWidget { 16 | const SettingsScreen({Key? key}) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: AppBar( 22 | title: const Text("设置"), 23 | actions: const [ 24 | ProAction(), 25 | ], 26 | ), 27 | body: ListView( 28 | children: [ 29 | const Divider(), 30 | const VersionInfo(), 31 | const Divider(), 32 | const LoginStateSetting(), 33 | hostSetting(), 34 | const Divider(), 35 | ListTile( 36 | title: const Text("历史记录"), 37 | onTap: () { 38 | Navigator.of(context) 39 | .push(MaterialPageRoute(builder: (BuildContext context) { 40 | return const ComicHistoriesScreen(); 41 | })); 42 | }, 43 | ), 44 | const Divider(), 45 | lightThemeSetting(), 46 | darkThemeSetting(), 47 | const Divider(), 48 | const Divider(), 49 | volumeControllerSetting(), 50 | appOrientationWidget(), 51 | const Divider(), 52 | viewLogCleanSetting(), 53 | autoCleanSetting(), 54 | const Divider(), 55 | ], 56 | ), 57 | ); 58 | } 59 | } 60 | 61 | class ProAction extends StatefulWidget { 62 | const ProAction({Key? key}) : super(key: key); 63 | 64 | @override 65 | State createState() => _ProActionState(); 66 | } 67 | 68 | class _ProActionState extends State { 69 | 70 | @override 71 | void initState() { 72 | proEvent.subscribe(_setState); 73 | super.initState(); 74 | } 75 | 76 | @override 77 | void dispose() { 78 | proEvent.unsubscribe(_setState); 79 | super.dispose(); 80 | } 81 | 82 | _setState(_) { 83 | setState(() {}); 84 | } 85 | 86 | @override 87 | Widget build(BuildContext context) { 88 | return proAction(); 89 | } 90 | 91 | Widget proAction() { 92 | return IconButton( 93 | onPressed: () { 94 | Navigator.of(context) 95 | .push(MaterialPageRoute(builder: (BuildContext context) { 96 | return const ProScreen(); 97 | })); 98 | }, 99 | icon: Icon( 100 | isPro ? Icons.offline_bolt : Icons.offline_bolt_outlined, 101 | ), 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "wax") 5 | set(APPLICATION_ID "opensource.wax") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "wax"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "wax"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import url_launcher_macos 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - url_launcher_macos (0.0.1): 4 | - FlutterMacOS 5 | 6 | DEPENDENCIES: 7 | - FlutterMacOS (from `Flutter/ephemeral`) 8 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 9 | 10 | EXTERNAL SOURCES: 11 | FlutterMacOS: 12 | :path: Flutter/ephemeral 13 | url_launcher_macos: 14 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 15 | 16 | SPEC CHECKSUMS: 17 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 18 | url_launcher_macos: be8b6bbc62bb3bd5befb226f3345dd434a91802f 19 | 20 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 21 | 22 | COCOAPODS: 1.16.2 23 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = wax 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = opensource.wax 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 niuhuan. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: wax 2 | description: A comic reader. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.3.7+13 19 | 20 | environment: 21 | sdk: ">=2.16.1 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | 34 | # The following adds the Cupertino Icons font to your application. 35 | # Use with the CupertinoIcons class for iOS style icons. 36 | cupertino_icons: ^1.0.2 37 | protobuf: ^2.0.1 38 | url_launcher: ^6.1.2 39 | flutter_styled_toast: ^2.0.0 40 | permission_handler: ^10.1.0 41 | flutter_colorpicker: ^1.0.3 42 | crypto: ^3.0.2 43 | event: ^2.1.2 44 | convert: ^3.0.1 45 | modal_bottom_sheet: ^3.0.0-pre 46 | clipboard: ^0.1.3 47 | photo_view: ^0.14.0 48 | flutter_svg: ^1.0.3 49 | another_xlider: ^1.0.1+2 50 | scrollable_positioned_list: ^0.2.0-nullsafety.0 51 | flutter_search_bar: ^3.0.0-dev.1 52 | file_picker: ^5.2.1 53 | 54 | dev_dependencies: 55 | flutter_test: 56 | sdk: flutter 57 | 58 | # The "flutter_lints" package below contains a set of recommended lints to 59 | # encourage good coding practices. The lint set provided by the package is 60 | # activated in the `analysis_options.yaml` file located at the root of your 61 | # package. See that file for information about deactivating specific lint 62 | # rules and activating additional ones. 63 | flutter_lints: ^1.0.0 64 | 65 | # For information on the generic Dart part of this file, see the 66 | # following page: https://dart.dev/tools/pub/pubspec 67 | 68 | # The following section is specific to Flutter. 69 | flutter: 70 | 71 | # The following line ensures that the Material Icons font is 72 | # included with your application, so that you can use the icons in 73 | # the material Icons class. 74 | uses-material-design: true 75 | 76 | assets: 77 | - lib/assets/ 78 | 79 | # To add assets to your application, add an assets section, like this: 80 | # assets: 81 | # - images/a_dot_burr.jpeg 82 | # - images/a_dot_ham.jpeg 83 | 84 | # An image asset can refer to one or more resolution-specific "variants", see 85 | # https://flutter.dev/assets-and-images/#resolution-aware. 86 | 87 | # For details regarding adding assets from package dependencies, see 88 | # https://flutter.dev/assets-and-images/#from-packages 89 | 90 | # To add custom fonts to your application, add a fonts section here, 91 | # in this "flutter" section. Each entry in this list should have a 92 | # "family" key with the font family name, and a "fonts" key with a 93 | # list giving the asset and other descriptors for the font. For 94 | # example: 95 | # fonts: 96 | # - family: Schyler 97 | # fonts: 98 | # - asset: fonts/Schyler-Regular.ttf 99 | # - asset: fonts/Schyler-Italic.ttf 100 | # style: italic 101 | # - family: Trajan Pro 102 | # fonts: 103 | # - asset: fonts/TrajanPro.ttf 104 | # - asset: fonts/TrajanPro_Bold.ttf 105 | # weight: 700 106 | # 107 | # For details regarding fonts from package dependencies, 108 | # see https://flutter.dev/custom-fonts/#from-packages 109 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | 用于记录作者构建时使用的脚本 2 | -------------------------------------------------------------------------------- /scripts/bind-android-arm64.sh: -------------------------------------------------------------------------------- 1 | # 仅构建arm64的APK 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -target=android/arm64 -o lib/Mobile.aar ./ 8 | cd ../.. 9 | -------------------------------------------------------------------------------- /scripts/bind-android-debug.sh: -------------------------------------------------------------------------------- 1 | # 编译所有架构的依赖 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -androidapi 21 -target=android/arm,android/arm64,android/386,android/amd64 -o lib/Mobile.aar ./ 8 | -------------------------------------------------------------------------------- /scripts/bind-ios-arm64.sh: -------------------------------------------------------------------------------- 1 | # 编译所有架构的依赖 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -iosversion 11.0 -target=ios -o lib/Mobile.xcframework ./ 8 | -------------------------------------------------------------------------------- /scripts/bind-ios.sh: -------------------------------------------------------------------------------- 1 | # 编译所有架构的依赖 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -iosversion 11.0 -target=ios -o lib/Mobile.xcframework ./ 8 | -------------------------------------------------------------------------------- /scripts/build-apk-arm.sh: -------------------------------------------------------------------------------- 1 | # 仅构建arm的APK 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -androidapi 21 -target=android/arm -o lib/Mobile.aar ./ 8 | 9 | cd ../.. 10 | flutter build apk --target-platform android-arm 11 | -------------------------------------------------------------------------------- /scripts/build-apk-arm64.sh: -------------------------------------------------------------------------------- 1 | # 仅构建arm64的APK 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -androidapi 21 -target=android/arm64 -o lib/Mobile.aar ./ 8 | 9 | cd ../.. 10 | flutter build apk --target-platform android-arm64 11 | -------------------------------------------------------------------------------- /scripts/build-apk-x64.sh: -------------------------------------------------------------------------------- 1 | # 仅构建x86_64的APK 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -androidapi 21 -target=android/amd64 -o lib/Mobile.aar ./ 8 | 9 | cd ../.. 10 | flutter build apk --target-platform android-x64 11 | -------------------------------------------------------------------------------- /scripts/build-apk-x86.sh: -------------------------------------------------------------------------------- 1 | # 仅构建x86的APK 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -androidapi 21 -target=android/386 -o lib/Mobile.aar ./ 8 | 9 | cd ../.. 10 | flutter build apk --target-platform android-x86 11 | -------------------------------------------------------------------------------- /scripts/build-ipa.sh: -------------------------------------------------------------------------------- 1 | # 构建未签名的IPA 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | cd go/mobile 6 | gomobile init 7 | gomobile bind -iosversion 11.0 -target=ios -o lib/Mobile.xcframework ./ 8 | 9 | cd ../.. 10 | flutter build ios --release --no-codesign 11 | 12 | cd build 13 | mkdir -p Payload 14 | mv ios/iphoneos/Runner.app Payload 15 | 16 | sh ../scripts/thin-payload.sh 17 | zip -9 nosign.ipa -r Payload 18 | -------------------------------------------------------------------------------- /scripts/build-macos-dmg.sh: -------------------------------------------------------------------------------- 1 | # 构建macos 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | hover build darwin-dmg 5 | -------------------------------------------------------------------------------- /scripts/protoc.sh: -------------------------------------------------------------------------------- 1 | 2 | # go install go install github.com/golang/protobuf/protoc-gen-go@1.5.2 3 | 4 | # dart pub global activate protoc_plugin@21.1.2 5 | # export PATH="$PATH":"$HOME/.pub-cache/bin" 6 | 7 | #protoc --go_out=go/ protos/*.proto 8 | #protoc --dart_out=lib/ protos/*.proto 9 | 10 | protoc --dart_out=lib/ --go_out=go/ protos/*.proto 11 | -------------------------------------------------------------------------------- /scripts/sign-apk-github-actions.sh: -------------------------------------------------------------------------------- 1 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 2 | 3 | echo $KEY_FILE_BASE64 > key.jks.base64 4 | base64 -d key.jks.base64 > key.jks 5 | echo $KEY_PASSWORD | $ANDROID_HOME/build-tools/30.0.2/apksigner sign --ks key.jks build/app/outputs/flutter-apk/app-release.apk -------------------------------------------------------------------------------- /scripts/test.http: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/scripts/test.http -------------------------------------------------------------------------------- /scripts/thin-payload.sh: -------------------------------------------------------------------------------- 1 | # 精简Payload文件夹 (上传到AppStore会自动区分平台, 此代码仅用于构建非签名ipa) 2 | 3 | foreachThin(){ 4 | for file in $1/* 5 | do 6 | if test -f $file 7 | then 8 | mime=$(file --mime-type -b $file) 9 | if [ "$mime" == 'application/x-mach-binary' ] || [ "${file##*.}"x = "dylib"x ] 10 | then 11 | echo thin $file 12 | xcrun -sdk iphoneos lipo "$file" -thin arm64 -output "$file" 13 | xcrun -sdk iphoneos bitcode_strip "$file" -r -o "$file" 14 | strip -S -x "$file" -o "$file" 15 | fi 16 | fi 17 | if test -d $file 18 | then 19 | foreachThin $file 20 | fi 21 | done 22 | } 23 | 24 | foreachThin ./Payload 25 | -------------------------------------------------------------------------------- /scripts/version.sh: -------------------------------------------------------------------------------- 1 | # 设置版本号 2 | 3 | cd "$( cd "$( dirname "$0" )" && pwd )/.." 4 | 5 | if [ "$1" == "set" ] ; then 6 | if [ "$2" != "" ] ; then 7 | echo $2 > lib/assets/version.txt 8 | fi 9 | 10 | elif [ "$1" == "unset" ]; then 11 | rm -f lib/assets/version.txt 12 | fi 13 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:wax/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(wax LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "wax") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "opensource" "\0" 93 | VALUE "FileDescription", "wax" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "wax" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 opensource. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "wax.exe" "\0" 98 | VALUE "ProductName", "wax" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"wax", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuhuan/wax/0e93039f60bdd09d802a9ef3ef6ddfd0d9e76115/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------