├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-playstore.png │ │ ├── kotlin │ │ │ └── cc │ │ │ │ └── zsakvo │ │ │ │ └── wenku8x │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ ├── values │ │ │ ├── ic_launcher_background.xml │ │ │ └── styles.xml │ │ │ └── xml │ │ │ └── network_security_config.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── image │ └── akari.jpg └── svg │ ├── ic_bottom_bar_font.svg │ ├── ic_bottom_bar_menu.svg │ ├── ic_bottom_bar_palette.svg │ ├── ic_bottom_bar_setting.svg │ ├── ic_btn_download.svg │ ├── ic_btn_like.svg │ ├── ic_btn_like_line.svg │ ├── ic_btn_read.svg │ ├── ic_btn_share.svg │ ├── ic_pannel_calendar.svg │ ├── ic_pannel_delete.svg │ ├── ic_pannel_drive.svg │ ├── ic_pannel_edit_circle.svg │ ├── ic_pannel_medal.svg │ ├── ic_pannel_nft.svg │ ├── ic_pannel_pen.svg │ ├── ic_pannel_seeding.svg │ ├── ic_pannel_tent.svg │ ├── ic_pannel_thumb.svg │ ├── ic_pannel_vip.svg │ ├── ic_search_bar_back.svg │ ├── ic_topbar_add.svg │ ├── ic_topbar_person_search.svg │ ├── ic_topbar_search.svg │ ├── il_page_error.svg │ ├── il_page_login.svg │ └── il_page_palette.svg ├── build.yaml ├── images ├── Screenshot_1696606553.png ├── Screenshot_1696606671.png ├── Screenshot_1696606691.png ├── Screenshot_1696606722.png ├── Screenshot_1696606775.png ├── Screenshot_1696606791.png ├── Screenshot_1696606827.png ├── Screenshot_1696606886.png ├── Screenshot_1696606932.png ├── Screenshot_1696606959.png ├── Screenshot_1696607250.png └── Screenshot_1696607321.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 └── RunnerTests │ └── RunnerTests.swift ├── lib ├── extension │ ├── bool.dart │ ├── int.dart │ └── string.dart ├── hooks │ └── brightness.dart ├── http │ ├── ajax.dart │ └── api.dart ├── main.dart ├── main.freezed.dart ├── providers │ ├── download_provider.dart │ └── download_provider.freezed.dart ├── router.dart ├── screen │ ├── detail │ │ ├── detail_provider.dart │ │ └── detail_screen.dart │ ├── error │ │ └── error_screen.dart │ ├── home │ │ ├── add_modal.dart │ │ ├── app_bar.dart │ │ ├── book_item.dart │ │ ├── detail_modal.dart │ │ ├── home_provider.dart │ │ ├── home_provider.freezed.dart │ │ ├── home_provider.g.dart │ │ └── home_screen.dart │ ├── login │ │ └── login_screen.dart │ ├── palette │ │ ├── palette_provider.dart │ │ ├── palette_screen.dart │ │ ├── selectable_palette.dart │ │ └── svg.dart │ ├── profile │ │ ├── profile_provider.dart │ │ ├── profile_provider.freezed.dart │ │ ├── profile_screen.dart │ │ ├── switch_card.dart │ │ └── tap_card.dart │ ├── rank │ │ ├── book_item.dart │ │ ├── rank_provider.dart │ │ ├── rank_provider.freezed.dart │ │ ├── rank_screen.dart │ │ └── tab_bar.dart │ ├── reader │ │ ├── custom_scroll.dart │ │ ├── menu_bars │ │ │ ├── menu_bottom.dart │ │ │ ├── menu_catalog.dart │ │ │ ├── menu_config.dart │ │ │ ├── menu_text.dart │ │ │ ├── menu_theme.dart │ │ │ ├── menu_top.dart │ │ │ ├── progress_bar.dart │ │ │ ├── progress_bar_provider.dart │ │ │ └── progress_bar_provider.freezed.dart │ │ ├── reader_provider.dart │ │ ├── reader_provider.freezed.dart │ │ ├── reader_provider.g.dart │ │ ├── reader_screen.dart │ │ ├── scroll_reader.dart │ │ └── themes │ │ │ ├── cherry.dart │ │ │ ├── glacier.dart │ │ │ ├── mulberry.dart │ │ │ ├── spring.dart │ │ │ ├── theme.dart │ │ │ └── walnut.dart │ └── search │ │ ├── app_bar.dart │ │ ├── book_item.dart │ │ ├── search_provider.dart │ │ ├── search_provider.freezed.dart │ │ └── search_screen.dart ├── service │ ├── navigation.dart │ └── observer.dart ├── theme │ └── extend.dart └── utils │ ├── flash.dart │ ├── log.dart │ ├── palette.dart │ ├── render.dart │ ├── render_copy.dart │ ├── splitter.dart │ ├── util.dart │ └── widget.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 └── RunnerTests │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.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: "12fccda598477eddd19f93040a1dba24f915b9be" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 17 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 18 | - platform: android 19 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 20 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 21 | - platform: ios 22 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 23 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 24 | - platform: linux 25 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 26 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 27 | - platform: macos 28 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 29 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 30 | - platform: web 31 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 32 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 33 | - platform: windows 34 | create_revision: 12fccda598477eddd19f93040a1dba24f915b9be 35 | base_revision: 12fccda598477eddd19f93040a1dba24f915b9be 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "wenku8x", 9 | "request": "launch", 10 | "type": "dart" 11 | }, 12 | { 13 | "name": "wenku8x (profile mode)", 14 | "request": "launch", 15 | "type": "dart", 16 | "flutterMode": "profile" 17 | }, 18 | { 19 | "name": "wenku8x (release mode)", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wenku8x 2 | 3 | 基于 flutter 制作的第三方 `轻小说文库` 客户端. 4 | 5 | ## 功能实现 6 | 7 | - [x] 账号登录(暂时仅支持用户名登入) 8 | - [x] 书架获取 9 | - [x] 排行榜 10 | - [x] 搜索书籍和作者 11 | - [x] 书籍详情 12 | - [x] 图书阅读 13 | - [x] 阅读主题 14 | - [x] 阅读字体 15 | - [x] 目录相关 16 | - [-] 阅读设置(未完善) 17 | - [x] 用户签到 18 | - [x] 书籍缓存 19 | - [x] 颜色跟随系统(低版本系统待适配) 20 | - [x] Material You 配色(低版本系统待适配) 21 | - [x] 主题色选取 22 | 23 | ## 截图 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 | 40 | ## 运行与编译 41 | 42 | > 当前平台信息:Channel stable, 3.13.6, on macOS 13.3.1 43 | 44 | ```shell 45 | flutter pub get 46 | flutter run // 运行 47 | flutter build apk --release --target-platform=android-arm64 // 编译 48 | ``` 49 | 50 | ### 平台支持情况 51 | 52 | [x] Android13 —— 主要运行 53 | 54 | [x] iPadOS17 —— 简单测试,大致可运行 55 | 56 | [x] macOS13+ —— 简单测试,可运行 57 | 58 | [ ] Linux —— 未测试,理论可运行 59 | 60 | [ ] Windows —— 未测试,理论可运行 61 | 62 | ## 声明 63 | 64 | - 此项目是个人为了兴趣而开发, 仅供学习交流使用, 无任何商业用途. 65 | - 资源版权仍归原网站或其作者所有. 66 | - 所用 API 皆从官方网站收集, 不含任何非法及破解内容. 67 | 68 | ## 感谢 69 | 70 | - [light-novel-library_Wenku8_Android](https://github.com/MewX/light-novel-library_Wenku8_Android): 轻小说文库既有的公益客户端 71 | -------------------------------------------------------------------------------- /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 | analyzer: 13 | errors: 14 | invalid_annotation_target: ignore 15 | non_constant_identifier_names: ignore 16 | 17 | linter: 18 | # The lint rules applied to this project can be customized in the 19 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 20 | # included above or to enable additional rules. A list of all available lints 21 | # and their documentation is published at https://dart.dev/lints. 22 | # 23 | # Instead of disabling a lint rule for the entire project in the 24 | # section below, it can also be suppressed for a single line of code 25 | # or a specific dart file by using the `// ignore: name_of_lint` and 26 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 27 | # producing the lint. 28 | rules: 29 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 30 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 31 | # Additional information about this file can be found at 32 | # https://dart.dev/guides/language/analysis-options 33 | -------------------------------------------------------------------------------- /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 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "cc.zsakvo.wenku8x" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "cc.zsakvo.wenku8x" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/cc/zsakvo/wenku8x/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package cc.zsakvo.wenku8x 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #A6D9F4 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | wenku8.com 5 | 10.0.2.2 6 | 7 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 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.3.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 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | plugins { 14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 15 | } 16 | } 17 | 18 | include ":app" 19 | 20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" 21 | -------------------------------------------------------------------------------- /assets/image/akari.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/assets/image/akari.jpg -------------------------------------------------------------------------------- /assets/svg/ic_bottom_bar_font.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_bottom_bar_menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_bottom_bar_palette.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_bottom_bar_setting.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_btn_download.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_btn_like.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_btn_like_line.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_btn_read.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_btn_share.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_delete.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_drive.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_edit_circle.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_medal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_nft.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_pen.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_seeding.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_tent.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_thumb.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_pannel_vip.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_search_bar_back.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_topbar_add.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_topbar_person_search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/ic_topbar_search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /build.yaml: -------------------------------------------------------------------------------- 1 | global_options: 2 | freezed:freezed: 3 | runs_before: 4 | - isar_generator:isar_generator 5 | -------------------------------------------------------------------------------- /images/Screenshot_1696606553.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606553.png -------------------------------------------------------------------------------- /images/Screenshot_1696606671.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606671.png -------------------------------------------------------------------------------- /images/Screenshot_1696606691.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606691.png -------------------------------------------------------------------------------- /images/Screenshot_1696606722.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606722.png -------------------------------------------------------------------------------- /images/Screenshot_1696606775.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606775.png -------------------------------------------------------------------------------- /images/Screenshot_1696606791.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606791.png -------------------------------------------------------------------------------- /images/Screenshot_1696606827.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606827.png -------------------------------------------------------------------------------- /images/Screenshot_1696606886.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606886.png -------------------------------------------------------------------------------- /images/Screenshot_1696606932.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606932.png -------------------------------------------------------------------------------- /images/Screenshot_1696606959.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696606959.png -------------------------------------------------------------------------------- /images/Screenshot_1696607250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696607250.png -------------------------------------------------------------------------------- /images/Screenshot_1696607321.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/images/Screenshot_1696607321.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 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - FMDB (2.7.5): 4 | - FMDB/standard (= 2.7.5) 5 | - FMDB/standard (2.7.5) 6 | - isar_flutter_libs (1.0.0): 7 | - Flutter 8 | - path_provider_foundation (0.0.1): 9 | - Flutter 10 | - FlutterMacOS 11 | - shared_preferences_foundation (0.0.1): 12 | - Flutter 13 | - FlutterMacOS 14 | - sqflite (0.0.3): 15 | - Flutter 16 | - FMDB (>= 2.7.5) 17 | - url_launcher_ios (0.0.1): 18 | - Flutter 19 | 20 | DEPENDENCIES: 21 | - Flutter (from `Flutter`) 22 | - isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`) 23 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) 24 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) 25 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 26 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 27 | 28 | SPEC REPOS: 29 | trunk: 30 | - FMDB 31 | 32 | EXTERNAL SOURCES: 33 | Flutter: 34 | :path: Flutter 35 | isar_flutter_libs: 36 | :path: ".symlinks/plugins/isar_flutter_libs/ios" 37 | path_provider_foundation: 38 | :path: ".symlinks/plugins/path_provider_foundation/darwin" 39 | shared_preferences_foundation: 40 | :path: ".symlinks/plugins/shared_preferences_foundation/darwin" 41 | sqflite: 42 | :path: ".symlinks/plugins/sqflite/ios" 43 | url_launcher_ios: 44 | :path: ".symlinks/plugins/url_launcher_ios/ios" 45 | 46 | SPEC CHECKSUMS: 47 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 48 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 49 | isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073 50 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 51 | shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 52 | sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a 53 | url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 54 | 55 | PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 56 | 57 | COCOAPODS: 1.11.3 58 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Wenku8x 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | wenku8x 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | UIApplicationSupportsIndirectInputEvents 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/extension/bool.dart: -------------------------------------------------------------------------------- 1 | extension BoolExtension on bool { 2 | int toInt() => this ? 1 : 0; 3 | } 4 | -------------------------------------------------------------------------------- /lib/extension/int.dart: -------------------------------------------------------------------------------- 1 | extension IntExtension on int { 2 | bool toBool() => this == 1; 3 | 4 | int autoToDarkTone(bool isDarkTheme) { 5 | if (!isDarkTheme) return this; 6 | switch (this) { 7 | case 10: 8 | return 99; 9 | case 20: 10 | return 95; 11 | case 25: 12 | return 90; 13 | case 30: 14 | return 90; 15 | case 40: 16 | return 80; 17 | case 50: 18 | return 60; 19 | case 60: 20 | return 50; 21 | case 70: 22 | return 40; 23 | case 80: 24 | return 40; 25 | case 90: 26 | return 30; 27 | case 95: 28 | return 20; 29 | case 98: 30 | return 10; 31 | case 99: 32 | return 10; 33 | case 100: 34 | return 20; 35 | default: 36 | return this; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/extension/string.dart: -------------------------------------------------------------------------------- 1 | extension StringExtension on String { 2 | String hexToJsColor() { 3 | final prefix = substring(0, 2); 4 | return "#${substring(2, 8)}$prefix"; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /lib/hooks/brightness.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | 6 | void useBrightnessChanged(BuildContext context, 7 | {required bool autoDarkMode, required bool isDarkMode}) { 8 | late final Brightness statusbarColor; 9 | bool isIOS = Platform.isIOS; 10 | if (autoDarkMode) { 11 | statusbarColor = Theme.of(context).brightness == 12 | (isIOS ? Brightness.light : Brightness.dark) 13 | ? Brightness.light 14 | : Brightness.dark; 15 | } else { 16 | final needDark = isIOS ? !isDarkMode : isDarkMode; 17 | statusbarColor = needDark ? Brightness.light : Brightness.dark; 18 | } 19 | // 设置顶栏字体颜色 20 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( 21 | statusBarBrightness: statusbarColor, 22 | statusBarIconBrightness: statusbarColor, 23 | )); 24 | } 25 | -------------------------------------------------------------------------------- /lib/http/ajax.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: constant_identifier_names, non_constant_identifier_names 2 | 3 | import 'dart:io'; 4 | 5 | import 'package:cookie_jar/cookie_jar.dart'; 6 | import 'package:dio/dio.dart'; 7 | import 'package:dio_cookie_manager/dio_cookie_manager.dart'; 8 | // import 'package:go_router/go_router.dart'; 9 | import 'package:path_provider/path_provider.dart'; 10 | import 'package:shared_preferences/shared_preferences.dart'; 11 | // import 'package:wenku8x/service/navigation.dart'; 12 | import 'package:wenku8x/utils/flash.dart'; 13 | import 'dart:convert' as convert; 14 | 15 | import 'package:xml/xml.dart'; 16 | 17 | import '../utils/log.dart'; 18 | import 'api.dart'; 19 | 20 | class Ajax { 21 | static String BASEURL = "http://app.wenku8.com/android.php"; 22 | static String UA = 23 | "Dalvik/2.1.0 (Linux; U; Android 11; IN2010 Build/RP1A.201005.001)"; 24 | static const String _APPVER = "1.13"; 25 | 26 | ///超时时间 27 | static const int CONNECT_TIMEOUT = 30000; 28 | static const int RECEIVE_TIMEOUT = 30000; 29 | 30 | static late Dio _client; 31 | 32 | static late final SharedPreferences sp; 33 | 34 | static init() async { 35 | sp = await SharedPreferences.getInstance(); 36 | Directory appDocDir = await getApplicationDocumentsDirectory(); 37 | final cookieJar = PersistCookieJar(storage: FileStorage(appDocDir.path)); 38 | _client = Dio(BaseOptions( 39 | baseUrl: BASEURL, 40 | connectTimeout: const Duration(milliseconds: CONNECT_TIMEOUT), 41 | receiveTimeout: const Duration(milliseconds: RECEIVE_TIMEOUT), 42 | contentType: Headers.formUrlEncodedContentType, 43 | headers: { 44 | "User-Agent": UA, 45 | })) 46 | ..interceptors.add(CookieManager(cookieJar)); 47 | } 48 | 49 | static String _encrypt(String param) { 50 | return convert.base64Encode(convert.utf8.encode(param)); 51 | } 52 | 53 | static Future post(String param, 54 | {bool isXml = true, download = false, savePath = ""}) async { 55 | // 判断是否是登陆请求 56 | bool isLogin = param.contains("action=login"); 57 | FormData formData = FormData.fromMap({ 58 | "appver": _APPVER, 59 | "request": _encrypt(param), 60 | "timetoken": DateTime.now().millisecondsSinceEpoch 61 | }); 62 | Log.d({ 63 | "appver": _APPVER, 64 | "request": param, 65 | "timetoken": DateTime.now().millisecondsSinceEpoch, 66 | "实际参数": _encrypt(param) 67 | }, "请求参数"); 68 | try { 69 | var res = download 70 | ? await _client.download("", savePath, 71 | data: formData, options: Options(method: "POST")) 72 | : (await _client.post("", data: formData)); 73 | if (isXml) { 74 | try { 75 | return XmlDocument.parse(res.data.toString()); 76 | } catch (err) { 77 | Log.e("请求失败,结果为:${res.data}"); 78 | if (res.data == "4") { 79 | final username = sp.getString("username") ?? ""; 80 | final password = sp.getString("password") ?? ""; 81 | if (username.isNotEmpty && password.isNotEmpty) { 82 | var res = await API.login(username, password); 83 | Log.d(res, "relogin"); 84 | if (res) { 85 | post(param, isXml: isXml); 86 | } 87 | } 88 | // showErrorToast(NavigationService.navigatorKey.currentContext, "鉴权信息失效,请重新登陆账户"); 89 | } 90 | return null; 91 | } 92 | } else { 93 | if (isLogin) { 94 | return res.data.toString() == "1"; 95 | } else { 96 | return res.data.toString(); 97 | } 98 | } 99 | } catch (err) { 100 | Show.error(err.toString()); 101 | // GoRouter.of(NavigationService.navigatorKey.currentContext!) 102 | // .go("/error/$err"); 103 | rethrow; 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/router.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:cookie_jar/cookie_jar.dart'; 4 | import 'package:go_router/go_router.dart'; 5 | import 'package:path_provider/path_provider.dart'; 6 | import 'package:wenku8x/screen/detail/detail_screen.dart'; 7 | import 'package:wenku8x/screen/error/error_screen.dart'; 8 | import 'package:wenku8x/screen/home/home_provider.dart'; 9 | import 'package:wenku8x/screen/palette/palette_screen.dart'; 10 | import 'package:wenku8x/screen/profile/profile_screen.dart'; 11 | import 'package:wenku8x/screen/rank/rank_screen.dart'; 12 | import 'package:wenku8x/screen/reader/reader_screen.dart'; 13 | import 'package:wenku8x/screen/search/search_screen.dart'; 14 | import 'package:wenku8x/service/navigation.dart'; 15 | 16 | import 'http/ajax.dart'; 17 | import 'screen/home/home_screen.dart'; 18 | import 'screen/login/login_screen.dart'; 19 | 20 | final router = GoRouter( 21 | navigatorKey: NavigationService.navigatorKey, 22 | routes: [ 23 | GoRoute( 24 | path: '/', 25 | builder: (context, state) => const HomeScreen(), 26 | redirect: (context, state) async { 27 | Directory appDocDir = await getApplicationDocumentsDirectory(); 28 | final cookieJar = 29 | PersistCookieJar(storage: FileStorage(appDocDir.path)); 30 | final cookies = await cookieJar.loadForRequest(Uri.parse(Ajax.BASEURL)); 31 | if (cookies.isNotEmpty) { 32 | return "/"; 33 | } else { 34 | return "/login"; 35 | } 36 | }, 37 | ), 38 | GoRoute( 39 | path: '/login', 40 | builder: (context, state) => const LoginScreen(), 41 | ), 42 | GoRoute( 43 | path: '/reader/:name/:aid/:cIndex', 44 | builder: (context, state) { 45 | final name = state.pathParameters["name"] as String; 46 | final aid = state.pathParameters["aid"] as String; 47 | final cIndex = int.parse(state.pathParameters["cIndex"] as String); 48 | return ReaderScreen(name: name, aid: aid, cIndex: cIndex); 49 | }, 50 | ), 51 | GoRoute( 52 | path: '/search', 53 | builder: (context, state) { 54 | final searchKey = state.extra as String?; 55 | return SearchScreen(searchKey: searchKey); 56 | }, 57 | ), 58 | GoRoute( 59 | path: '/detail', 60 | builder: (context, state) { 61 | final BookItem bookItem = state.extra as BookItem; 62 | return DetailScreen(bookItem); 63 | }), 64 | GoRoute( 65 | path: '/profile', 66 | builder: (context, state) { 67 | return const ProfileScreen(); 68 | }), 69 | GoRoute( 70 | path: '/palette', 71 | builder: (context, state) { 72 | return const PaletteScreen(); 73 | }), 74 | GoRoute( 75 | path: '/rank/:type/:title', 76 | builder: (context, state) { 77 | final type = state.pathParameters["type"] as String; 78 | return RankScreen(type); 79 | }), 80 | GoRoute( 81 | path: '/error/:err', 82 | builder: (context, state) { 83 | final err = state.pathParameters["err"] as String; 84 | return ErrorScreen(err: err); 85 | }, 86 | ), 87 | ], 88 | ); 89 | -------------------------------------------------------------------------------- /lib/screen/detail/detail_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 2 | import 'package:wenku8x/http/api.dart'; 3 | import 'package:wenku8x/screen/home/home_provider.dart'; 4 | import 'package:wenku8x/screen/reader/reader_provider.dart'; 5 | import 'package:wenku8x/utils/util.dart'; 6 | import 'package:xml/xml.dart'; 7 | 8 | class DetailNotifier extends AutoDisposeFamilyNotifier { 9 | @override 10 | build(arg) { 11 | Future.delayed(const Duration(milliseconds: 300)).then((_) async { 12 | String intro = await _getIntro(arg.aid); 13 | List catalog = await _getCatalog(arg.aid); 14 | BookItem bookItem = await _getMeta(bookItem: arg); 15 | state = bookItem.copyWith(intro: intro, catalog: catalog); 16 | }); 17 | return arg; 18 | } 19 | 20 | _getIntro(aid) async { 21 | return await API.getNovelFullIntro(aid); 22 | } 23 | 24 | _getMeta({required BookItem bookItem}) async { 25 | final value = await API.getNovelFullMeta(bookItem.aid); 26 | if (value != null) { 27 | var eles = value.findAllElements("data").toList(); 28 | final aid = eles[0].getAttribute("aid")!; 29 | return BookItem( 30 | aid: aid, 31 | name: eles[0].innerText, 32 | cover: Util.getCover(aid), 33 | author: eles[1].getAttribute("value"), 34 | status: eles[7].getAttribute("value"), 35 | lastUpdate: eles[9].getAttribute("value"), 36 | lastChapterId: eles[11].getAttribute("cid"), 37 | lastChapter: eles[11].innerText); 38 | } else { 39 | return bookItem; 40 | } 41 | } 42 | 43 | Future> _getCatalog(aid) async { 44 | return await API.getNovelIndex(aid); 45 | } 46 | } 47 | 48 | final detailProvider = NotifierProvider.autoDispose 49 | .family(DetailNotifier.new); 50 | -------------------------------------------------------------------------------- /lib/screen/error/error_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | import 'package:go_router/go_router.dart'; 4 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 5 | 6 | class ErrorScreen extends StatefulHookConsumerWidget { 7 | const ErrorScreen({required this.err, super.key}); 8 | final String err; 9 | 10 | @override 11 | ConsumerState createState() => _ErrorScreenState(); 12 | } 13 | 14 | class _ErrorScreenState extends ConsumerState { 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | body: SafeArea( 19 | child: Column( 20 | crossAxisAlignment: CrossAxisAlignment.start, 21 | children: [ 22 | SvgPicture.asset( 23 | "assets/svg/il_page_error.svg", 24 | width: MediaQuery.of(context).size.width, 25 | ), 26 | const Padding( 27 | padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), 28 | child: Text( 29 | "出错了", 30 | style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16), 31 | ), 32 | ), 33 | Padding( 34 | padding: const EdgeInsets.symmetric(horizontal: 20), 35 | child: Text( 36 | widget.err, 37 | style: TextStyle( 38 | color: Theme.of(context).colorScheme.secondary, fontSize: 14), 39 | ), 40 | ) 41 | ], 42 | )), 43 | floatingActionButton: FloatingActionButton.extended( 44 | onPressed: () { 45 | GoRouter.of(context).go("/"); 46 | }, 47 | icon: const Icon(Icons.arrow_back), 48 | label: const Text("返回首页")), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/screen/home/book_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 4 | import 'package:wenku8x/screen/home/home_provider.dart'; 5 | import 'package:wenku8x/service/navigation.dart'; 6 | 7 | class BookItemComp extends StatefulHookConsumerWidget { 8 | const BookItemComp( 9 | this.bookItem, { 10 | super.key, 11 | this.onItemTap, 12 | this.onItemLongTap, 13 | }); 14 | 15 | final BookItem bookItem; 16 | 17 | final Function(BookItem bookItem)? onItemTap; 18 | final Function(BookItem bookItem)? onItemLongTap; 19 | 20 | @override 21 | ConsumerState createState() => _BookItemCompState(); 22 | } 23 | 24 | class _BookItemCompState extends ConsumerState 25 | with AutomaticKeepAliveClientMixin { 26 | @override 27 | Widget build(BuildContext context) { 28 | super.build(context); 29 | final colorScheme = getColorScheme(context); 30 | return InkWell( 31 | // 隐藏点击效果 32 | splashColor: Colors.transparent, 33 | highlightColor: Colors.transparent, 34 | hoverColor: Colors.transparent, 35 | onTap: widget.onItemTap != null 36 | ? () => widget.onItemTap!(widget.bookItem) 37 | : null, 38 | onLongPress: widget.onItemLongTap != null 39 | ? () => widget.onItemLongTap!(widget.bookItem) 40 | : null, 41 | child: Container( 42 | padding: const EdgeInsets.only(left: 16, bottom: 20, right: 16), 43 | child: Row(children: [ 44 | Container( 45 | width: 64, 46 | height: 86, 47 | margin: const EdgeInsets.only(right: 16), 48 | decoration: BoxDecoration( 49 | borderRadius: BorderRadius.circular(5), 50 | color: getColorScheme(context).surfaceVariant), 51 | child: ClipRRect( 52 | borderRadius: BorderRadius.circular(5), 53 | child: CachedNetworkImage( 54 | imageUrl: widget.bookItem.cover!, 55 | fit: BoxFit.cover, 56 | ), 57 | ), 58 | ), 59 | Expanded( 60 | child: Container( 61 | constraints: const BoxConstraints(minHeight: 86), 62 | child: Column( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | mainAxisAlignment: MainAxisAlignment.center, 65 | children: [ 66 | Text( 67 | widget.bookItem.name, 68 | maxLines: 1, 69 | overflow: TextOverflow.ellipsis, 70 | style: TextStyle( 71 | fontSize: 15, 72 | fontWeight: FontWeight.w600, 73 | color: colorScheme.onSurface), 74 | ), 75 | Padding( 76 | padding: const EdgeInsets.only(top: 10, bottom: 6), 77 | child: Text( 78 | widget.bookItem.author ?? 79 | "上次更新:${widget.bookItem.lastUpdate!}", 80 | style: TextStyle( 81 | fontSize: 13, 82 | color: colorScheme.onSurface.withOpacity(0.6)), 83 | ), 84 | ), 85 | Text( 86 | widget.bookItem.lastChapter ?? "暂无更新", 87 | maxLines: 1, 88 | overflow: TextOverflow.ellipsis, 89 | style: TextStyle( 90 | fontSize: 13, 91 | color: colorScheme.onSurface.withOpacity(0.6)), 92 | ), 93 | ], 94 | )), 95 | ) 96 | ])), 97 | ); 98 | } 99 | 100 | @override 101 | bool get wantKeepAlive => true; 102 | } 103 | -------------------------------------------------------------------------------- /lib/screen/home/detail_modal.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash/flash.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_hooks/flutter_hooks.dart'; 4 | import 'package:flutter_svg/svg.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 7 | import 'package:wenku8x/providers/download_provider.dart'; 8 | import 'package:wenku8x/screen/home/home_provider.dart'; 9 | 10 | class DetailModal extends HookConsumerWidget { 11 | const DetailModal(this.controller, this.bookItem, {super.key}); 12 | final BookItem bookItem; 13 | final FlashController controller; 14 | @override 15 | Widget build(BuildContext context, WidgetRef ref) { 16 | final provider = bookDownloaderProvider(bookItem.aid); 17 | final downloader = ref.watch(provider); 18 | final downloadProgress = useFuture( 19 | useMemoized(() => downloader.progress, [downloader]), 20 | initialData: "缓存"); 21 | return Column( 22 | mainAxisSize: MainAxisSize.min, 23 | children: [ 24 | Padding( 25 | padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24), 26 | child: Text( 27 | bookItem.name, 28 | style: TextStyle( 29 | color: Theme.of(context).colorScheme.secondary.withOpacity(0.7), 30 | fontSize: 12), 31 | ), 32 | ), 33 | Padding( 34 | padding: const EdgeInsets.only(left: 24, right: 24), 35 | child: ListTile( 36 | shape: 37 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), 38 | title: const Text( 39 | "详情", 40 | style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600), 41 | ), 42 | tileColor: Theme.of(context).colorScheme.surface, 43 | trailing: SvgPicture.asset( 44 | "assets/svg/ic_pannel_edit_circle.svg", 45 | width: 18, 46 | ), 47 | onTap: () { 48 | GoRouter.of(context).push("/detail", extra: bookItem); 49 | controller.dismiss(); 50 | }, 51 | ), 52 | ), 53 | Padding( 54 | padding: const EdgeInsets.only(left: 24, right: 24, top: 12), 55 | child: ListTile( 56 | shape: 57 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), 58 | title: Text( 59 | downloadProgress.data!, 60 | style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w600), 61 | ), 62 | tileColor: Theme.of(context).colorScheme.surface, 63 | trailing: SvgPicture.asset( 64 | "assets/svg/ic_btn_download.svg", 65 | width: 18, 66 | ), 67 | onTap: () { 68 | ref.read(provider.notifier).download(bookItem.aid).then((value) { 69 | if (value == true) { 70 | controller.dismiss(); 71 | } 72 | }); 73 | }, 74 | ), 75 | ), 76 | Padding( 77 | padding: 78 | const EdgeInsets.only(left: 24, right: 24, top: 12, bottom: 12), 79 | child: ListTile( 80 | shape: 81 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), 82 | title: Text( 83 | "删除", 84 | style: TextStyle( 85 | fontSize: 14, 86 | fontWeight: FontWeight.w600, 87 | color: Theme.of(context).colorScheme.error), 88 | ), 89 | tileColor: Theme.of(context).colorScheme.surface, 90 | trailing: SvgPicture.asset( 91 | "assets/svg/ic_pannel_delete.svg", 92 | width: 18, 93 | colorFilter: ColorFilter.mode( 94 | Theme.of(context).colorScheme.error, BlendMode.srcIn), 95 | ), 96 | onTap: () { 97 | ref.read(myBooksProvider.notifier).delBook(bookItem.aid); 98 | controller.dismiss(); 99 | }, 100 | ), 101 | ) 102 | ], 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/screen/home/home_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 4 | import 'package:isar/isar.dart'; 5 | import 'package:path_provider/path_provider.dart'; 6 | import 'package:wenku8x/screen/reader/reader_provider.dart'; 7 | 8 | import '../../http/api.dart'; 9 | 10 | part 'home_provider.freezed.dart'; 11 | part 'home_provider.g.dart'; 12 | 13 | @Collection(ignore: {"catalog", "copyWith"}) 14 | @freezed 15 | class BookItem with _$BookItem { 16 | const BookItem._(); 17 | const factory BookItem({ 18 | required String aid, 19 | required String name, 20 | String? cover, 21 | String? author, 22 | String? lastChapter, 23 | String? lastChapterId, 24 | String? lastUpdate, 25 | String? status, 26 | String? intro, 27 | List? catalog, 28 | @Default(false) bool isFav, 29 | }) = _BookItem; 30 | 31 | @Name("id") 32 | Id get id { 33 | return Isar.autoIncrement; 34 | } 35 | } 36 | 37 | const ranks = [ 38 | {"icon": Icons.pan_tool_alt_outlined, "title": "点击"}, 39 | {"icon": Icons.thumb_up_alt_outlined, "title": "推荐"}, 40 | {"icon": Icons.file_open_outlined, "title": "收藏"}, 41 | {"icon": Icons.edit_road_outlined, "title": "字数"}, 42 | {"icon": Icons.school_outlined, "title": "完结"}, 43 | {"icon": Icons.av_timer_outlined, "title": "新书"}, 44 | ]; 45 | 46 | class MyBooksNotifier extends StateNotifier> { 47 | MyBooksNotifier() : super([]) { 48 | _initDB().then((_) => refresh()); 49 | } 50 | 51 | late final Isar _isar; 52 | 53 | Future _initDB() async { 54 | final dir = await getApplicationDocumentsDirectory(); 55 | _isar = Isar.openSync([BookItemSchema], directory: dir.path); 56 | } 57 | 58 | List _getBooksFromDB() { 59 | var res = _isar.bookItems.where().findAllSync().reversed.toList(); 60 | return res; 61 | } 62 | 63 | void _writeBooksToDB() { 64 | final arr = state.reversed.toList(); 65 | _isar.writeTxn(() async { 66 | await _isar.bookItems.clear(); 67 | for (var element in arr) { 68 | await _isar.bookItems.put(element); 69 | } 70 | }); 71 | } 72 | 73 | void refresh() async { 74 | // state = isar.myBooks.where().findAllSync(); 75 | state = _getBooksFromDB(); 76 | var res = await API.getShelfBookList(); 77 | // var localAids = state.map((e) => e.aid).toSet(); 78 | // var remoteAids = res.map((e) => e.aid).toSet(); 79 | // var delAids = localAids.difference(remoteAids); 80 | // var newAids = remoteAids.difference(localAids); 81 | // state = [ 82 | // ...res.where((element) => newAids.contains(element.aid)), 83 | // ...state.where((element) => !delAids.contains(element.aid)) 84 | // ]; 85 | if (res != null) { 86 | state = res; 87 | _writeBooksToDB(); 88 | } 89 | } 90 | 91 | void addBook(BookItem book) { 92 | API.addToBookShelf(book.aid); 93 | state = [book, ...state]; 94 | // _writeBooksToDB(); 95 | _isar.writeTxn(() async { 96 | await _isar.bookItems.put(book); 97 | }); 98 | } 99 | 100 | void delBook(String aid) { 101 | API.removeFromBookShelf(aid); 102 | state = state.where((element) => element.aid != aid).toList(); 103 | _isar.writeTxn(() async { 104 | await _isar.bookItems.filter().aidEqualTo(aid).deleteFirst(); 105 | }); 106 | } 107 | } 108 | 109 | final myBooksProvider = 110 | StateNotifierProvider>((ref) { 111 | return MyBooksNotifier(); 112 | }); 113 | -------------------------------------------------------------------------------- /lib/screen/home/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_refresh/easy_refresh.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:go_router/go_router.dart'; 4 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 5 | import 'package:wenku8x/screen/home/add_modal.dart'; 6 | import 'package:wenku8x/screen/home/app_bar.dart'; 7 | import 'package:wenku8x/screen/home/detail_modal.dart'; 8 | import 'package:wenku8x/screen/home/home_provider.dart'; 9 | import 'package:wenku8x/theme/extend.dart'; 10 | import 'package:wenku8x/utils/flash.dart'; 11 | 12 | import 'book_item.dart'; 13 | 14 | class HomeScreen extends StatefulHookConsumerWidget { 15 | const HomeScreen({super.key}); 16 | 17 | @override 18 | ConsumerState createState() => _HomeScreenState(); 19 | } 20 | 21 | class _HomeScreenState extends ConsumerState { 22 | @override 23 | Widget build(BuildContext context) { 24 | EasyRefreshController controller = EasyRefreshController(); 25 | var books = ref.watch>(myBooksProvider); 26 | return Scaffold( 27 | backgroundColor: 28 | Theme.of(context).extension()!.elevationBackground, 29 | appBar: HomeAppBar( 30 | onSearchTap: () { 31 | GoRouter.of(context).push("/search"); 32 | }, 33 | onAddTap: () { 34 | Show.pannel( 35 | context: context, 36 | builder: (context, controller) { 37 | return AddModal(controller); 38 | }, 39 | ); 40 | }, 41 | onAvatarTap: () { 42 | GoRouter.of(context).push("/profile"); 43 | }, 44 | ), 45 | body: EasyRefresh( 46 | controller: controller, 47 | canLoadAfterNoMore: false, 48 | refreshOnStart: true, 49 | onRefresh: ref.read(myBooksProvider.notifier).refresh, 50 | child: CustomScrollView( 51 | slivers: [ 52 | const HeaderLocator.sliver(), 53 | SliverList.builder( 54 | itemBuilder: (context, index) { 55 | final book = books[index]; 56 | final child = BookItemComp(book, onItemTap: (item) { 57 | GoRouter.of(context) 58 | .push("/reader/${item.name}/${item.aid}/-1"); 59 | }, onItemLongTap: (item) { 60 | Show.pannel( 61 | context: context, 62 | builder: (context, controller) { 63 | return DetailModal(controller, book); 64 | }, 65 | ); 66 | }); 67 | return index == 0 68 | ? Padding( 69 | padding: const EdgeInsets.only(top: 16), 70 | child: child) 71 | : child; 72 | }, 73 | itemCount: books.length, 74 | ), 75 | const FooterLocator.sliver(), 76 | ], 77 | ))); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/screen/palette/palette_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | enum PresetColors { 4 | red(color: Colors.red), 5 | // pink(color: Colors.pink), 6 | // purple(color: Colors.purple), 7 | deepPurple(color: Colors.deepPurple), 8 | // indigo(color: Colors.indigo), 9 | blue(color: Colors.blue), 10 | // lightBlue(color: Colors.lightBlue), 11 | // cyan(color: Colors.cyan), 12 | teal(color: Colors.teal), 13 | // green(color: Colors.green), 14 | lightGreen(color: Colors.lightGreen), 15 | // lime(color: Colors.lime), 16 | yellow(color: Colors.yellow), 17 | // amber(color: Colors.amber), 18 | orange(color: Colors.orange), 19 | // deepOrange(color: Colors.deepOrange), 20 | brown(color: Colors.brown), 21 | // blueGrey(color: Colors.blueGrey), 22 | // grey(color: Colors.grey) 23 | ; 24 | 25 | final Color color; 26 | 27 | const PresetColors({ 28 | required this.color, 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/screen/palette/selectable_palette.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | import 'package:material_color_utilities/material_color_utilities.dart'; 4 | import 'package:wenku8x/screen/palette/palette_provider.dart'; 5 | import 'package:wenku8x/screen/profile/profile_provider.dart'; 6 | 7 | class SelectablePalette extends StatefulHookConsumerWidget { 8 | const SelectablePalette( 9 | {super.key, required this.color, required this.isSelected}); 10 | final PresetColors color; 11 | final bool isSelected; 12 | 13 | @override 14 | ConsumerState createState() => 15 | _SelectablePaletteState(); 16 | } 17 | 18 | class _SelectablePaletteState extends ConsumerState { 19 | @override 20 | Widget build(BuildContext context) { 21 | final tonalPalettes = CorePalette.contentOf(widget.color.color.value); 22 | return GestureDetector( 23 | child: Container( 24 | alignment: Alignment.center, 25 | decoration: BoxDecoration( 26 | borderRadius: BorderRadius.circular(16), 27 | color: Theme.of(context).colorScheme.surface.withOpacity(0.7)), 28 | child: ClipOval( 29 | child: SizedBox( 30 | width: 48, 31 | height: 48, 32 | child: Stack(children: [ 33 | Positioned( 34 | left: 0, 35 | top: 0, 36 | child: Container( 37 | width: 48, 38 | height: 24, 39 | decoration: BoxDecoration( 40 | color: Color(tonalPalettes.primary.get(90))), 41 | ), 42 | ), 43 | Positioned( 44 | bottom: 0, 45 | right: 0, 46 | child: Container( 47 | width: 24, 48 | height: 24, 49 | decoration: BoxDecoration( 50 | // borderRadius: BorderRadius.circular(100), 51 | color: Color(tonalPalettes.secondary.get(60))), 52 | ), 53 | ), 54 | Positioned( 55 | left: 0, 56 | bottom: 0, 57 | child: Container( 58 | width: 24, 59 | height: 24, 60 | decoration: BoxDecoration( 61 | // borderRadius: BorderRadius.circular(100), 62 | color: Color(tonalPalettes.tertiary.get(90))), 63 | ), 64 | ), 65 | if (widget.isSelected) 66 | Positioned( 67 | left: 10, 68 | right: 10, 69 | top: 10, 70 | bottom: 10, 71 | child: Container( 72 | decoration: BoxDecoration( 73 | borderRadius: BorderRadius.circular(30), 74 | color: Color(tonalPalettes.primary.get(40)), 75 | ), 76 | child: const Icon( 77 | Icons.check_outlined, 78 | color: Colors.white, 79 | size: 18, 80 | ), 81 | ), 82 | ) 83 | ]), 84 | ), 85 | )), 86 | onTap: () { 87 | ref 88 | .read(configProvider.notifier) 89 | .updateColorSeed(widget.color.color.value); 90 | }, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/screen/profile/profile_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:freezed_annotation/freezed_annotation.dart'; 5 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 6 | import 'package:path_provider/path_provider.dart'; 7 | import 'package:wenku8x/main.dart'; 8 | import 'package:wenku8x/utils/flash.dart'; 9 | 10 | part 'profile_provider.freezed.dart'; 11 | 12 | @freezed 13 | class Config with _$Config { 14 | const factory Config({ 15 | @Default(true) bool autoDarkMode, 16 | @Default(false) bool isDarkMode, 17 | @Default(true) bool dynamicColor, 18 | @Default(0xFFF44336) int colorSeed, 19 | @Default(false) bool fixedSequence, 20 | @Default(false) bool showImage, 21 | @Default(false) bool zhHant, 22 | @Default("") String customAvataar, 23 | }) = _Config; 24 | 25 | const Config._(); 26 | 27 | static Config fromJson(Map json) { 28 | return Config( 29 | autoDarkMode: json["autoDarkMode"] ?? true, 30 | isDarkMode: json["isDarkMode"] ?? false, 31 | dynamicColor: json["dynamicColor"] ?? true, 32 | colorSeed: json["colorSeed"] ?? 0xFFF44336, 33 | fixedSequence: json["fixedSequence"] ?? false, 34 | showImage: json["showImage"] ?? false, 35 | zhHant: json["zhHant"] ?? false, 36 | customAvataar: json["customAvataar"] ?? "", 37 | ); 38 | } 39 | 40 | Map toJson() { 41 | return { 42 | "autoDarkMode": autoDarkMode, 43 | "isDarkMode": isDarkMode, 44 | "dynamicColor": dynamicColor, 45 | "colorSeed": colorSeed, 46 | "fixedSequence": fixedSequence, 47 | "showImage": showImage, 48 | "zhHant": zhHant, 49 | "customAvataar": customAvataar, 50 | }; 51 | } 52 | } 53 | 54 | @freezed 55 | class UserInfo with _$UserInfo { 56 | const UserInfo._(); 57 | const factory UserInfo( 58 | {String? uname, String? nickname, int? score, String? rank}) = _UserInfo; 59 | 60 | static UserInfo fromJson(Map json) { 61 | return UserInfo( 62 | uname: json["uname"] ?? "", 63 | nickname: json["nickname"] ?? "", 64 | score: json["score"] ?? 0, 65 | rank: json["rank"] ?? "", 66 | ); 67 | } 68 | 69 | Map toJson() { 70 | return { 71 | "uname": uname, 72 | "nickname": nickname, 73 | "score": score, 74 | "rank": rank, 75 | }; 76 | } 77 | } 78 | 79 | class ConfigNotifier extends Notifier { 80 | @override 81 | build() { 82 | _getAccentColor(); 83 | return Config.fromJson(jsonDecode(sp.getString("config") ?? "{}")); 84 | } 85 | 86 | void update(Config config) { 87 | state = config; 88 | sp.setString("config", json.encode(config.toJson())); 89 | } 90 | 91 | void updateColorSeed(int colorSeed) { 92 | state = state.copyWith(colorSeed: colorSeed); 93 | sp.setString("config", json.encode(state.toJson())); 94 | } 95 | 96 | _getAccentColor() {} 97 | } 98 | 99 | final configProvider = 100 | NotifierProvider(ConfigNotifier.new); 101 | 102 | final profileProvider = StateProvider((ref) { 103 | return const UserInfo(nickname: "-", rank: "-", score: 0); 104 | }); 105 | 106 | clearCache() async { 107 | final dir = await getApplicationDocumentsDirectory(); 108 | final booksDir = Directory("${dir.path}/books"); 109 | booksDir.listSync().forEach((element) { 110 | if (element.statSync().type == FileSystemEntityType.directory) { 111 | (Directory(element.path)) 112 | .listSync() 113 | .toList() 114 | .where((element) => !element.path.contains("meta.json")) 115 | .forEach((element) { 116 | element.deleteSync(); 117 | }); 118 | } 119 | }); 120 | Show.success("缓存清除成功"); 121 | } 122 | 123 | final avatarExistProvider = StateProvider((ref) { 124 | return DateTime.now().millisecondsSinceEpoch; 125 | }); 126 | -------------------------------------------------------------------------------- /lib/screen/profile/switch_card.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_hooks/flutter_hooks.dart'; 5 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 6 | 7 | class SwitchCard extends StatefulHookConsumerWidget { 8 | const SwitchCard( 9 | {super.key, 10 | this.margin, 11 | required this.title, 12 | required this.subtitle, 13 | required this.value, 14 | required this.onChanged}); 15 | 16 | final EdgeInsets? margin; 17 | final String title; 18 | final String subtitle; 19 | final bool value; 20 | final Function(bool value) onChanged; 21 | 22 | @override 23 | ConsumerState createState() => _SwitchCardState(); 24 | } 25 | 26 | class _SwitchCardState extends ConsumerState { 27 | @override 28 | Widget build(BuildContext context) { 29 | final switchWidth = Platform.isMacOS ? 42.0 : 48.0; 30 | final switchHeight = Platform.isMacOS ? 28.0 : 36.0; 31 | final value = useState(widget.value); 32 | return Container( 33 | margin: widget.margin ?? 34 | const EdgeInsets.symmetric(horizontal: 20, vertical: 8), 35 | child: ListTile( 36 | contentPadding: 37 | const EdgeInsets.symmetric(horizontal: 16, vertical: 8), 38 | title: Padding( 39 | padding: const EdgeInsets.only(bottom: 8), 40 | child: Text( 41 | widget.title, 42 | style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 15), 43 | ), 44 | ), 45 | subtitle: Text( 46 | widget.subtitle, 47 | style: TextStyle( 48 | color: Theme.of(context).colorScheme.secondary.withOpacity(0.7), 49 | fontSize: 13), 50 | ), 51 | trailing: Padding( 52 | padding: const EdgeInsets.only(left: 8), 53 | child: SizedBox( 54 | width: switchWidth, 55 | height: switchHeight, 56 | child: FittedBox( 57 | fit: BoxFit.fill, 58 | child: Switch( 59 | value: value.value, 60 | onChanged: (val) { 61 | value.value = val; 62 | widget.onChanged(val); 63 | }))), 64 | ), 65 | tileColor: 66 | Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4), 67 | shape: RoundedRectangleBorder( 68 | borderRadius: BorderRadius.circular(10), 69 | ), 70 | )); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/screen/profile/tap_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | 4 | class TapCard extends StatefulHookConsumerWidget { 5 | const TapCard( 6 | {super.key, 7 | this.margin, 8 | this.backgroundColor, 9 | this.titleColor, 10 | this.subTitleColor, 11 | required this.onTap, 12 | required this.title, 13 | required this.subtitle, 14 | required this.trailing}); 15 | 16 | final EdgeInsets? margin; 17 | final String title; 18 | final String subtitle; 19 | final Widget trailing; 20 | final Function() onTap; 21 | final Color? backgroundColor; 22 | final Color? titleColor; 23 | final Color? subTitleColor; 24 | 25 | @override 26 | ConsumerState createState() => _TapCardState(); 27 | } 28 | 29 | class _TapCardState extends ConsumerState { 30 | @override 31 | Widget build(BuildContext context) { 32 | return Container( 33 | margin: widget.margin ?? 34 | const EdgeInsets.symmetric(horizontal: 20, vertical: 8), 35 | child: ListTile( 36 | onTap: widget.onTap, 37 | contentPadding: 38 | const EdgeInsets.symmetric(horizontal: 16, vertical: 8), 39 | title: Padding( 40 | padding: const EdgeInsets.only(bottom: 8), 41 | child: Text( 42 | widget.title, 43 | style: TextStyle( 44 | color: widget.titleColor, 45 | fontWeight: FontWeight.w600, 46 | fontSize: 15), 47 | ), 48 | ), 49 | subtitle: Text( 50 | widget.subtitle, 51 | style: TextStyle( 52 | color: widget.subTitleColor ?? 53 | Theme.of(context).colorScheme.secondary.withOpacity(0.7), 54 | fontSize: 13), 55 | ), 56 | trailing: widget.trailing, 57 | tileColor: widget.backgroundColor ?? 58 | Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4), 59 | shape: RoundedRectangleBorder( 60 | borderRadius: BorderRadius.circular(10), 61 | ), 62 | )); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/screen/rank/book_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 4 | import 'package:wenku8x/screen/home/home_provider.dart'; 5 | import 'package:wenku8x/service/navigation.dart'; 6 | 7 | class BookItemComp extends StatefulHookConsumerWidget { 8 | const BookItemComp(this.bookItem, {super.key, this.onItemTap}); 9 | 10 | final BookItem bookItem; 11 | 12 | final Function(BookItem bookItem)? onItemTap; 13 | 14 | @override 15 | ConsumerState createState() => _BookItemCompState(); 16 | } 17 | 18 | class _BookItemCompState extends ConsumerState 19 | with AutomaticKeepAliveClientMixin { 20 | @override 21 | Widget build(BuildContext context) { 22 | super.build(context); 23 | final colorScheme = getColorScheme(context); 24 | return InkWell( 25 | highlightColor: Colors.transparent, 26 | splashColor: Colors.transparent, 27 | hoverColor: Colors.transparent, 28 | onTap: widget.onItemTap != null 29 | ? () => widget.onItemTap!(widget.bookItem) 30 | : null, 31 | child: Container( 32 | padding: const EdgeInsets.only(left: 16, bottom: 20, right: 16), 33 | child: Row(children: [ 34 | Container( 35 | width: 64, 36 | height: 86, 37 | margin: const EdgeInsets.only(right: 16), 38 | decoration: BoxDecoration( 39 | borderRadius: BorderRadius.circular(5), 40 | color: getColorScheme(context).surfaceVariant), 41 | child: ClipRRect( 42 | borderRadius: BorderRadius.circular(5), 43 | child: CachedNetworkImage( 44 | imageUrl: widget.bookItem.cover!, 45 | fit: BoxFit.cover, 46 | ), 47 | ), 48 | ), 49 | Expanded( 50 | child: Container( 51 | constraints: const BoxConstraints(minHeight: 86), 52 | child: Column( 53 | crossAxisAlignment: CrossAxisAlignment.start, 54 | mainAxisAlignment: MainAxisAlignment.center, 55 | children: [ 56 | Text( 57 | widget.bookItem.name, 58 | maxLines: 1, 59 | overflow: TextOverflow.ellipsis, 60 | style: TextStyle( 61 | fontSize: 15, 62 | fontWeight: FontWeight.w600, 63 | color: colorScheme.onSurface), 64 | ), 65 | Padding( 66 | padding: const EdgeInsets.only(top: 10, bottom: 6), 67 | child: Text( 68 | "${widget.bookItem.author!}\t/\t${widget.bookItem.status!}", 69 | style: TextStyle( 70 | fontSize: 13, 71 | color: colorScheme.onSurface.withOpacity(0.6)), 72 | ), 73 | ), 74 | Text( 75 | "上次更新:${widget.bookItem.lastUpdate!}", 76 | maxLines: 1, 77 | overflow: TextOverflow.ellipsis, 78 | style: TextStyle( 79 | fontSize: 13, 80 | color: colorScheme.onSurface.withOpacity(0.6)), 81 | ), 82 | ], 83 | )), 84 | ) 85 | ])), 86 | ); 87 | } 88 | 89 | @override 90 | bool get wantKeepAlive => true; 91 | } 92 | -------------------------------------------------------------------------------- /lib/screen/rank/rank_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | import 'package:wenku8x/http/api.dart'; 4 | import 'package:wenku8x/screen/home/home_provider.dart'; 5 | import 'package:wenku8x/utils/util.dart'; 6 | import 'package:xml/xml.dart'; 7 | 8 | part 'rank_provider.freezed.dart'; 9 | 10 | final novelSort = { 11 | "visit": { 12 | "title": "点击榜", 13 | "subs": [ 14 | { 15 | "title": "总榜", 16 | "flag": "allvisit", 17 | }, 18 | { 19 | "title": "月榜", 20 | "flag": "monthvisit", 21 | }, 22 | { 23 | "title": "周榜", 24 | "flag": "weekvisit", 25 | }, 26 | { 27 | "title": "日榜", 28 | "flag": "dayvisit", 29 | } 30 | ] 31 | }, 32 | "vote": { 33 | "title": "推荐榜", 34 | "subs": [ 35 | { 36 | "title": "总榜", 37 | "flag": "allvote", 38 | }, 39 | { 40 | "title": "月榜", 41 | "flag": "monthvote", 42 | }, 43 | { 44 | "title": "周榜", 45 | "flag": "weekvote", 46 | }, 47 | { 48 | "title": "日榜", 49 | "flag": "dayvote", 50 | } 51 | ] 52 | }, 53 | "postdate": { 54 | "title": "最新入库", 55 | "flag": "postdate", 56 | }, 57 | "lastupdate": { 58 | "title": "最近更新", 59 | "flag": "lastupdate", 60 | }, 61 | "goodnum": { 62 | "title": "收藏排行", 63 | "flag": "goodnum", 64 | }, 65 | "size": { 66 | "title": "字数排行", 67 | "flag": "size", 68 | }, 69 | "fullflag": { 70 | "title": "完结小说", 71 | "flag": "fullflag", 72 | }, 73 | }; 74 | 75 | @freezed 76 | class Rank with _$Rank { 77 | const Rank._(); 78 | const factory Rank({ 79 | required String flag, 80 | @Default([]) List books, 81 | @Default(0) int subIndex, 82 | }) = _Rank; 83 | 84 | String get title { 85 | return novelSort[flag]!["title"] as String; 86 | } 87 | 88 | List>? get subs { 89 | return novelSort[flag]!["subs"] as List>?; 90 | } 91 | 92 | String get sortFlag { 93 | return subs == null ? flag : subs![subIndex]['flag'] as String; 94 | } 95 | } 96 | 97 | class RankNotifier extends AutoDisposeFamilyNotifier { 98 | int page = 1; 99 | @override 100 | build(arg) { 101 | return Rank(flag: arg); 102 | } 103 | 104 | init() { 105 | page = 1; 106 | state = state.copyWith(books: []); 107 | _getBooks(); 108 | } 109 | 110 | loadMore() async { 111 | page++; 112 | await _getBooks(); 113 | } 114 | 115 | updateSub(String sub) { 116 | state = state.copyWith(books: []); 117 | final index = state.subs!.indexWhere((element) => element["flag"] == sub); 118 | state = state.copyWith(subIndex: index); 119 | } 120 | 121 | _getBooks() async { 122 | var res = await API.getNovelList(state.sortFlag, page); 123 | if (res != null) { 124 | var books = _parseBook(res); 125 | state = state.copyWith(books: [...state.books, ...books]); 126 | } 127 | } 128 | 129 | _parseBook(XmlDocument res) { 130 | return res.findAllElements("item").map((element) { 131 | var elements = 132 | element.children.where((p0) => p0.toString().length > 2).toList(); 133 | final aid = element.getAttribute("aid")!; 134 | return BookItem( 135 | aid: aid, 136 | cover: Util.getCover(aid), 137 | name: elements[0].innerText, 138 | author: elements[4].getAttribute("value").toString(), 139 | status: elements[5].getAttribute("value").toString(), 140 | lastUpdate: elements[6].getAttribute("value").toString()); 141 | // intro: elements[7].innerText.replaceAll("\n", "")); 142 | }); 143 | } 144 | } 145 | 146 | final rankProvider = NotifierProvider.family 147 | .autoDispose(RankNotifier.new); 148 | -------------------------------------------------------------------------------- /lib/screen/rank/rank_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_refresh/easy_refresh.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_svg/svg.dart'; 4 | import 'package:go_router/go_router.dart'; 5 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 6 | import 'package:wenku8x/screen/rank/book_item.dart'; 7 | import 'package:wenku8x/screen/rank/rank_provider.dart'; 8 | import 'package:wenku8x/screen/rank/tab_bar.dart'; 9 | import 'package:wenku8x/theme/extend.dart'; 10 | 11 | class RankScreen extends StatefulHookConsumerWidget { 12 | const RankScreen(this.type, {super.key}); 13 | final String type; 14 | 15 | @override 16 | ConsumerState createState() => _RankScreenState(); 17 | } 18 | 19 | class _RankScreenState extends ConsumerState { 20 | @override 21 | Widget build(BuildContext context) { 22 | EasyRefreshController controller = EasyRefreshController(); 23 | final provider = rankProvider(widget.type); 24 | final rank = ref.watch(provider); 25 | return Scaffold( 26 | backgroundColor: 27 | Theme.of(context).extension()!.elevationBackground, 28 | appBar: AppBar( 29 | titleSpacing: 0, 30 | backgroundColor: 31 | Theme.of(context).extension()!.elevationBackground, 32 | title: Text( 33 | rank.title, 34 | style: const TextStyle(fontSize: 18), 35 | ), 36 | centerTitle: false, 37 | leading: IconButton( 38 | onPressed: () { 39 | GoRouter.of(context).pop(); 40 | }, 41 | icon: SvgPicture.asset( 42 | "assets/svg/ic_search_bar_back.svg", 43 | width: 23, 44 | height: 23, 45 | // colorFilter: ColorFilter.mode( 46 | // Theme.of(context).colorScheme.secondary, 47 | // BlendMode.srcIn), 48 | )), 49 | actions: [ 50 | IconButton( 51 | onPressed: () { 52 | GoRouter.of(context).push("/search"); 53 | }, 54 | icon: SvgPicture.asset( 55 | "assets/svg/ic_topbar_search.svg", 56 | width: 23, 57 | height: 23, 58 | colorFilter: ColorFilter.mode( 59 | Theme.of(context).colorScheme.onSurface, BlendMode.srcIn), 60 | )) 61 | ], 62 | bottom: rank.subs == null 63 | ? null 64 | : RankTabBar( 65 | tabs: rank.subs!, 66 | selectedIndex: rank.subIndex, 67 | onTabChange: (flag) { 68 | ref.read(provider.notifier).updateSub(flag); 69 | controller.callRefresh(force: true); 70 | }, 71 | ), 72 | ), 73 | body: Padding( 74 | padding: const EdgeInsets.only(top: 0), 75 | child: EasyRefresh( 76 | controller: controller, 77 | refreshOnStart: true, 78 | onRefresh: ref.read(provider.notifier).init, 79 | onLoad: ref.read(provider.notifier).loadMore, 80 | child: CustomScrollView(slivers: [ 81 | const HeaderLocator.sliver(), 82 | SliverList.builder( 83 | itemBuilder: (context, index) { 84 | return Padding( 85 | padding: EdgeInsets.only(top: index == 0 ? 10 : 0), 86 | child: BookItemComp( 87 | rank.books[index], 88 | onItemTap: (item) { 89 | GoRouter.of(context).push("/detail", extra: item); 90 | }, 91 | )); 92 | }, 93 | itemCount: rank.books.length, 94 | ), 95 | const FooterLocator.sliver(), 96 | ]), 97 | ))); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/screen/rank/tab_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | 4 | class RankTabBar extends HookConsumerWidget implements PreferredSizeWidget { 5 | const RankTabBar({super.key, this.selectedIndex = 0, required this.tabs, required this.onTabChange}); 6 | final int selectedIndex; 7 | final List> tabs; 8 | final Function(String flag) onTabChange; 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | final ButtonStyle buttonStyle = FilledButton.styleFrom( 12 | minimumSize: const Size(72, 30), 13 | textStyle: const TextStyle(fontSize: 13), 14 | padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8)); 15 | return Padding( 16 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), 17 | child: Row( 18 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 19 | children: tabs 20 | .asMap() 21 | .map((index, e) { 22 | return MapEntry( 23 | index, 24 | index == selectedIndex 25 | ? FilledButton( 26 | onPressed: () { 27 | onTabChange(e["flag"]); 28 | }, 29 | style: buttonStyle, 30 | child: Text(e["title"]), 31 | ) 32 | : FilledButton.tonal( 33 | onPressed: () { 34 | onTabChange(e["flag"]); 35 | }, 36 | style: buttonStyle.copyWith( 37 | backgroundColor: MaterialStateProperty.all(Colors.transparent), 38 | side: 39 | MaterialStateProperty.all(BorderSide(color: Theme.of(context).colorScheme.primary))), 40 | // side: MaterialStateProperty.all(BorderSide(color: Colors.transparent))), 41 | child: Text(e["title"]), 42 | )); 43 | }) 44 | .values 45 | .toList(), 46 | // children: [ 47 | // FilledButton( 48 | // onPressed: () {}, 49 | // style: buttonStyle, 50 | // child: Text("总榜"), 51 | // ), 52 | // FilledButton.tonal( 53 | // onPressed: () {}, 54 | // style: buttonStyle, 55 | // child: Text("月榜"), 56 | // ), 57 | // FilledButton.tonal( 58 | // onPressed: () {}, 59 | // style: buttonStyle, 60 | // child: Text("周榜"), 61 | // ), 62 | // FilledButton.tonal( 63 | // onPressed: () {}, 64 | // style: buttonStyle, 65 | // child: Text("日榜"), 66 | // ) 67 | // ], 68 | ), 69 | ); 70 | } 71 | 72 | @override 73 | Size get preferredSize => const Size.fromHeight(42); 74 | } 75 | -------------------------------------------------------------------------------- /lib/screen/reader/custom_scroll.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CustomPageViewScrollPhysics extends ScrollPhysics { 4 | const CustomPageViewScrollPhysics({ScrollPhysics? parent}) 5 | : super(parent: parent); 6 | 7 | @override 8 | CustomPageViewScrollPhysics applyTo(ScrollPhysics? ancestor) { 9 | return CustomPageViewScrollPhysics(parent: buildParent(ancestor)!); 10 | } 11 | 12 | @override 13 | SpringDescription get spring => const SpringDescription( 14 | mass: 50, 15 | stiffness: 200, 16 | damping: 0.8, 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /lib/screen/reader/menu_bars/menu_top.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | import 'package:go_router/go_router.dart'; 5 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 6 | import 'package:wenku8x/screen/reader/reader_provider.dart'; 7 | 8 | class MenuTop extends StatefulHookConsumerWidget { 9 | const MenuTop(this.provider, {super.key}); 10 | final dynamic provider; 11 | 12 | @override 13 | ConsumerState createState() => _MenuTopState(); 14 | } 15 | 16 | class _MenuTopState extends ConsumerState 17 | with TickerProviderStateMixin { 18 | @override 19 | Widget build(BuildContext context) { 20 | final reader = ref.watch(widget.provider); 21 | final height = MediaQuery.of(context).size.height; 22 | final topPos = useState(-height); 23 | useEffect(() { 24 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 25 | topPos.value = -context.findRenderObject()!.paintBounds.size.height; 26 | }); 27 | return null; 28 | }, []); 29 | 30 | final state = ref 31 | .watch(readerMenuStateProvider.select((value) => value.menuTopVisible)); 32 | return AnimatedPositioned( 33 | top: state ? 0 : topPos.value, 34 | left: 0, 35 | duration: const Duration(milliseconds: 200), 36 | child: Material( 37 | child: Container( 38 | width: MediaQuery.of(context).size.width, 39 | padding: EdgeInsets.only( 40 | top: MediaQuery.of(context).viewPadding.top + 8, bottom: 8), 41 | decoration: BoxDecoration( 42 | color: Theme.of(context).colorScheme.surface, 43 | ), 44 | child: Row( 45 | children: [ 46 | IconButton( 47 | onPressed: () { 48 | GoRouter.of(context).pop(); 49 | }, 50 | icon: Icon( 51 | Icons.arrow_back, 52 | color: Theme.of(context).colorScheme.onBackground, 53 | )), 54 | Expanded( 55 | child: Text( 56 | reader.name, 57 | maxLines: 1, 58 | overflow: TextOverflow.ellipsis, 59 | style: TextStyle( 60 | fontWeight: FontWeight.bold, 61 | color: Theme.of(context).colorScheme.onBackground, 62 | fontSize: 16), 63 | )), 64 | IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)), 65 | // const SizedBox( 66 | // width: 36, 67 | // ) 68 | ], 69 | )), 70 | )); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/screen/reader/menu_bars/progress_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 4 | import 'package:wenku8x/screen/reader/menu_bars/progress_bar_provider.dart'; 5 | import '../reader_provider.dart'; 6 | 7 | class ProgressBar extends StatefulHookConsumerWidget { 8 | const ProgressBar(this.provider, {super.key}); 9 | final dynamic provider; 10 | 11 | @override 12 | ConsumerState createState() => _ProgressBarState(); 13 | } 14 | 15 | class _ProgressBarState extends ConsumerState { 16 | @override 17 | Widget build(BuildContext context) { 18 | final height = MediaQuery.of(context).size.height; 19 | final bottomPos = useState(-height); 20 | final state = ref.watch( 21 | readerMenuStateProvider.select((value) => value.progressVisible)); 22 | final bottomHeight = ref.watch( 23 | readerMenuStateProvider.select((value) => value.bottomBarHeight)); 24 | final progress = ref.watch(progressProvider); 25 | useEffect(() { 26 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 27 | bottomPos.value = -context.findRenderObject()!.paintBounds.size.height; 28 | }); 29 | return null; 30 | }, []); 31 | 32 | return AnimatedPositioned( 33 | duration: const Duration(milliseconds: 200), 34 | left: 0, 35 | bottom: state ? bottomHeight : bottomPos.value, 36 | child: Container( 37 | color: Theme.of(context).colorScheme.surface, 38 | width: MediaQuery.of(context).size.width, 39 | padding: 40 | const EdgeInsets.only(left: 4, right: 4, bottom: 0, top: 8), 41 | child: Row( 42 | children: [ 43 | TextButton( 44 | onPressed: () {}, 45 | child: Text( 46 | "上一章", 47 | style: TextStyle( 48 | color: Theme.of(context).colorScheme.onSurface), 49 | )), 50 | Expanded( 51 | child: SliderTheme( 52 | data: SliderTheme.of(context).copyWith( 53 | activeTrackColor: Theme.of(context).colorScheme.outline, 54 | inactiveTrackColor: 55 | Theme.of(context).colorScheme.background, 56 | trackHeight: 16, 57 | valueIndicatorColor: Colors.transparent, 58 | tickMarkShape: SliderTickMarkShape.noTickMark, 59 | overlayColor: Colors.transparent, 60 | overlayShape: SliderComponentShape.noOverlay, 61 | thumbColor: Theme.of(context).colorScheme.surface, 62 | thumbShape: const RoundSliderThumbShape( 63 | disabledThumbRadius: 8, //禁用时滑块大小 64 | enabledThumbRadius: 8, //滑块大小 65 | ), 66 | ), 67 | child: Slider( 68 | max: progress.totalPages.toDouble() - 1, 69 | value: progress.currentIndex.toDouble(), 70 | divisions: progress.totalPages, 71 | onChanged: (value) { 72 | ref 73 | .read(progressProvider.notifier) 74 | .updateProgress(value.round()); 75 | }, 76 | onChangeEnd: (value) { 77 | ref 78 | .read(widget.provider.notifier) 79 | .jumpToPage(value.round()); 80 | }, 81 | ), 82 | )), 83 | TextButton( 84 | onPressed: () {}, 85 | child: Text( 86 | "下一章", 87 | style: TextStyle( 88 | color: Theme.of(context).colorScheme.onSurface), 89 | )) 90 | ], 91 | ))); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/screen/reader/menu_bars/progress_bar_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | part 'progress_bar_provider.freezed.dart'; 4 | 5 | @freezed 6 | class ChapterProgress with _$ChapterProgress { 7 | const ChapterProgress._(); 8 | const factory ChapterProgress({ 9 | required int chapterIndex, // 章节索引 10 | required int totalPages, // 章节总页数 11 | required int currentIndex, // 章节当前页索引 12 | }) = _ChapterProgress; 13 | } 14 | 15 | class ProgressNotifier extends AutoDisposeNotifier { 16 | @override 17 | ChapterProgress build() { 18 | return const ChapterProgress( 19 | chapterIndex: 0, totalPages: 1, currentIndex: 0); 20 | } 21 | 22 | updateProgress(int index) { 23 | state = state.copyWith(currentIndex: index); 24 | } 25 | 26 | update(ChapterProgress cp) { 27 | state = cp; 28 | } 29 | } 30 | 31 | final progressProvider = 32 | NotifierProvider.autoDispose( 33 | ProgressNotifier.new); 34 | -------------------------------------------------------------------------------- /lib/screen/reader/reader_provider.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'reader_provider.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_Chapter _$$_ChapterFromJson(Map json) => _$_Chapter( 10 | cid: json['cid'] as String, 11 | name: json['name'] as String, 12 | ); 13 | 14 | Map _$$_ChapterToJson(_$_Chapter instance) => 15 | { 16 | 'cid': instance.cid, 17 | 'name': instance.name, 18 | }; 19 | 20 | _$_RecordMeta _$$_RecordMetaFromJson(Map json) => 21 | _$_RecordMeta( 22 | cIndex: json['cIndex'] as int? ?? 0, 23 | pIndex: json['pIndex'] as int? ?? 0, 24 | ); 25 | 26 | Map _$$_RecordMetaToJson(_$_RecordMeta instance) => 27 | { 28 | 'cIndex': instance.cIndex, 29 | 'pIndex': instance.pIndex, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/screen/reader/reader_screen.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: use_build_context_synchronously 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_hooks/flutter_hooks.dart'; 5 | 6 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 7 | import 'package:wenku8x/screen/reader/menu_bars/menu_catalog.dart'; 8 | import 'package:wenku8x/screen/reader/menu_bars/menu_config.dart'; 9 | import 'package:wenku8x/screen/reader/menu_bars/menu_text.dart'; 10 | import 'package:wenku8x/screen/reader/menu_bars/menu_top.dart'; 11 | import 'package:wenku8x/screen/reader/menu_bars/progress_bar.dart'; 12 | import 'package:wenku8x/screen/reader/scroll_reader.dart'; 13 | 14 | import 'menu_bars/menu_bottom.dart'; 15 | import 'menu_bars/menu_theme.dart'; 16 | import 'reader_provider.dart'; 17 | 18 | class ReaderScreen extends StatefulHookConsumerWidget { 19 | const ReaderScreen( 20 | {required this.name, required this.aid, super.key, required this.cIndex}); 21 | 22 | final String name; 23 | final String aid; 24 | final int cIndex; 25 | 26 | @override 27 | ConsumerState createState() => _ReaderScreenState(); 28 | } 29 | 30 | class _ReaderScreenState extends ConsumerState { 31 | List catalog = []; 32 | String cachedText = ''; 33 | @override 34 | Widget build(BuildContext context) { 35 | final provider = readerProvider((widget.name, widget.aid, widget.cIndex)); 36 | final reader = ref.watch(provider); 37 | final loading = ref.watch(loadingProvider); 38 | 39 | useEffect(() { 40 | Future(() { 41 | ref.read(loadingProvider.notifier).state = true; 42 | }); 43 | Future.delayed(const Duration(milliseconds: 500)).then((value) async { 44 | ref.read(provider.notifier).init(context, widget.cIndex); 45 | await ref.read(provider.notifier).initCatalog(); 46 | ref.read(provider.notifier).initPages(); 47 | }); 48 | return null; 49 | }, []); 50 | 51 | return Theme( 52 | data: reader.theme, 53 | child: Scaffold( 54 | body: Stack( 55 | children: [ 56 | Listener( 57 | onPointerMove: ref.read(provider.notifier).onPointerMove, 58 | onPointerUp: ref.read(provider.notifier).onPointerUp, 59 | onPointerDown: ref.read(provider.notifier).onPointerDown, 60 | child: Padding( 61 | padding: EdgeInsets.only( 62 | top: MediaQuery.of(context).padding.top, 63 | bottom: MediaQuery.of(context).padding.bottom, 64 | ), 65 | child: ScrollReader( 66 | reader.pages, ref.read(provider.notifier).pageController, 67 | loadNext: ref.read(provider.notifier).loadNextChapter, 68 | onPageScrollEnd: 69 | ref.read(provider.notifier).onPageScrollEnd), 70 | )), 71 | const MenuBottom(), 72 | ProgressBar(provider), 73 | MenuCatalog(provider), 74 | MenuTop(provider), 75 | MenuPalette(provider), 76 | MenuText(provider), 77 | MenuConfig(provider), 78 | if (loading) 79 | Container( 80 | color: Theme.of(context).colorScheme.background, 81 | width: MediaQuery.of(context).size.width, 82 | height: MediaQuery.of(context).size.height, 83 | child: const Center( 84 | child: SizedBox( 85 | width: 96, height: 3, child: LinearProgressIndicator()), 86 | ), 87 | ) 88 | ], 89 | ))); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/screen/reader/scroll_reader.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | 4 | import 'package:wenku8x/utils/log.dart'; 5 | 6 | class ScrollReader extends StatefulHookConsumerWidget { 7 | const ScrollReader(this.pages, this.controller, 8 | {super.key, required this.loadNext, required this.onPageScrollEnd}); 9 | final List pages; 10 | final PageController controller; 11 | final Function() loadNext; 12 | final Function() onPageScrollEnd; 13 | 14 | @override 15 | ConsumerState createState() => _ScrollReaderState(); 16 | } 17 | 18 | class _ScrollReaderState extends ConsumerState 19 | with TickerProviderStateMixin { 20 | @override 21 | Widget build(BuildContext context) { 22 | onPageChanged(value) { 23 | if (value == widget.pages.length - 3) { 24 | Log.e("load next chapter"); 25 | widget.loadNext(); 26 | } 27 | } 28 | 29 | return Material( 30 | child: NotificationListener( 31 | onNotification: (ScrollNotification notification) { 32 | if (notification.depth == 0 && notification is ScrollEndNotification) { 33 | // onPageChanged(widget.controller.page!.round()); 34 | // var ok = 35 | // (widget.pages[widget.controller.page!.round()].key as ValueKey) 36 | // .value; 37 | // Log.e(ok); 38 | // if (widget.controller.page!.round() == widget.pages.length - 1) { 39 | widget.onPageScrollEnd(); 40 | // } 41 | } 42 | return false; 43 | }, 44 | child: PageView.builder( 45 | physics: const NeverScrollableScrollPhysics(), 46 | pageSnapping: false, 47 | controller: widget.controller, 48 | onPageChanged: onPageChanged, 49 | itemBuilder: (context, index) { 50 | return widget.pages[index]; 51 | }, 52 | itemCount: widget.pages.length), 53 | )); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/screen/reader/themes/cherry.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final cherryTheme = ThemeData( 4 | useMaterial3: true, 5 | colorScheme: const ColorScheme.light( 6 | primary: Color(0xFFFF889E), 7 | primaryContainer: Color(0xFFFFABBB), 8 | secondary: Color(0xFF838D8A), 9 | background: Color(0xFFF8EEF0), 10 | onBackground: Color(0xFF3D2A2B), 11 | surface: Color(0xFFFFF4F6), 12 | outline: Color(0xFFF9E3E7))); 13 | -------------------------------------------------------------------------------- /lib/screen/reader/themes/glacier.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final glacierTheme = ThemeData( 4 | useMaterial3: true, 5 | colorScheme: const ColorScheme.light( 6 | primary: Color(0xFF2E72E5), 7 | primaryContainer: Color(0xFF6C9CEC), 8 | secondary: Color(0xFF83879C), 9 | background: Color(0xFFEAEEF2), 10 | onBackground: Color(0xFF07103A), 11 | surface: Color(0xFFF1F5F8), 12 | outline: Color(0xFFD7DEE5))); 13 | -------------------------------------------------------------------------------- /lib/screen/reader/themes/mulberry.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final mulberryTheme = ThemeData( 4 | useMaterial3: true, 5 | colorScheme: const ColorScheme.light( 6 | primary: Color(0xFFF75C2F), 7 | primaryContainer: Color(0xFFF98C6D), 8 | secondary: Color(0xFFA1A1A1), 9 | background: Color(0xFFFAFAFA), 10 | onBackground: Color(0xFF242424), 11 | surface: Color(0xFFFFFFFF), 12 | outline: Color(0xFFEEEEEE))); 13 | -------------------------------------------------------------------------------- /lib/screen/reader/themes/spring.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final springTheme = ThemeData( 4 | useMaterial3: true, 5 | colorScheme: const ColorScheme.light( 6 | primary: Color(0xFF54B88B), 7 | primaryContainer: Color(0xFF87CDAD), 8 | secondary: Color(0xFF838D8A), 9 | background: Color(0xFFEFF6E9), 10 | onBackground: Color(0xFF081B16), 11 | surface: Color(0xFFF7FCF3), 12 | outline: Color(0xFFE3EBDC))); 13 | -------------------------------------------------------------------------------- /lib/screen/reader/themes/theme.dart: -------------------------------------------------------------------------------- 1 | // import 'package:flutter/material.dart'; 2 | // -------------------------------------------------------------------------------- /lib/screen/reader/themes/walnut.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final walnutTheme = ThemeData( 4 | useMaterial3: true, 5 | colorScheme: const ColorScheme.light( 6 | primary: Color(0xFFA57938), 7 | primaryContainer: Color(0xFFA57938), 8 | secondary: Color(0xFF818181), 9 | background: Color(0xFFEEE9D5), 10 | onBackground: Color(0xFF040403), 11 | surface: Color(0xFFF6F1DC), 12 | outline: Color(0xFFE6E0CD))); 13 | -------------------------------------------------------------------------------- /lib/screen/search/search_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 3 | import 'package:wenku8x/http/api.dart'; 4 | import 'package:xml/xml.dart'; 5 | 6 | part 'search_provider.freezed.dart'; 7 | 8 | @freezed 9 | class Search with _$Search { 10 | const Search._(); 11 | const factory Search({ 12 | @Default(false) isLoading, 13 | @Default([]) List names, 14 | @Default([]) List authors, 15 | @Default(null) String? error, 16 | }) = _Search; 17 | } 18 | 19 | class SearchNotifier extends AutoDisposeNotifier { 20 | int page = 0; 21 | @override 22 | build() { 23 | return const Search(); 24 | } 25 | 26 | // _parseBookMeta(List res) { 27 | // final List bookList = []; 28 | // for (var element in res) { 29 | // if (element == null) continue; 30 | // var eles = element.findAllElements("data").toList(); 31 | // final aid = eles[0].getAttribute("aid")!; 32 | // bookList.add(BookItem( 33 | // aid: aid, 34 | // name: eles[0].innerText, 35 | // cover: Util.getCover(aid), 36 | // author: eles[1].getAttribute("value"), 37 | // status: eles[7].getAttribute("value"), 38 | // lastUpdate: eles[9].getAttribute("value"), 39 | // lastChapterId: eles[11].getAttribute("cid"), 40 | // lastChapter: eles[11].innerText)); 41 | // } 42 | // return bookList; 43 | // } 44 | 45 | _search(String key, searchFunc) async { 46 | List bookAidList = []; 47 | XmlDocument? res = await searchFunc(key); 48 | if (res != null) { 49 | res.findAllElements("item").forEach((element) { 50 | bookAidList.add(element.getAttribute("aid")!); 51 | }); 52 | } 53 | // var aidsRes = (await Future.wait( 54 | // bookAidList.map((aid) => API.getNovelFullMeta(aid)))); 55 | // return _parseBookMeta(aidsRes); 56 | return bookAidList; 57 | } 58 | 59 | init(String key) async { 60 | page = 0; 61 | state = const Search(isLoading: true); 62 | final names = await _search(key, API.searchNovelByNovelName); 63 | final authors = await _search(key, API.searchNovelByAuthorName); 64 | state = 65 | Search(names: names, authors: authors, isLoading: false, error: null); 66 | } 67 | } 68 | 69 | final searchProvider = 70 | NotifierProvider.autoDispose(SearchNotifier.new); 71 | -------------------------------------------------------------------------------- /lib/service/navigation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class NavigationService { 4 | static GlobalKey navigatorKey = GlobalKey(); 5 | } 6 | 7 | ColorScheme getColorScheme(BuildContext context) => 8 | Theme.of(context).colorScheme; 9 | -------------------------------------------------------------------------------- /lib/service/observer.dart: -------------------------------------------------------------------------------- 1 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 2 | // import 'package:wenku8x/views/reader/constants/theme.dart'; 3 | 4 | class MyObserver extends ProviderObserver { 5 | @override 6 | void didUpdateProvider( 7 | ProviderBase provider, 8 | Object? previousValue, 9 | Object? newValue, 10 | ProviderContainer container, 11 | ) { 12 | // if (provider.runtimeType.toString() == 'StateProvider') { 13 | // container.read(readerThemeProvider.notifier).update(); 14 | // } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/theme/extend.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class ExtendColors extends ThemeExtension { 5 | ExtendColors({required this.colorScheme}) { 6 | elevationBackground = ElevationOverlay.applySurfaceTint( 7 | colorScheme.surface, colorScheme.primary, 2); 8 | } 9 | 10 | final ColorScheme colorScheme; 11 | late final Color elevationBackground; 12 | 13 | // Color get elevationBackground { 14 | // return ElevationOverlay.applySurfaceTint( 15 | // colorScheme.surface, colorScheme.surfaceTint, 1.0); 16 | // } 17 | 18 | @override 19 | ExtendColors copyWith({ColorScheme? colorScheme}) { 20 | return ExtendColors( 21 | colorScheme: colorScheme ?? this.colorScheme, 22 | ); 23 | } 24 | 25 | @override 26 | ExtendColors lerp(ThemeExtension? other, double t) { 27 | // if (other is! ExtendColors) { 28 | // return this; 29 | // } 30 | // return ExtendColors( 31 | // colorScheme: other.colorScheme, 32 | // ); 33 | return this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/utils/log.dart: -------------------------------------------------------------------------------- 1 | import 'package:logger/logger.dart'; 2 | 3 | class Log { 4 | static final _logger = Logger( 5 | printer: PrettyPrinter( 6 | methodCount: 2, // Number of method calls to be displayed 7 | errorMethodCount: 2, // Number of method calls if stacktrace is provided 8 | lineLength: 120, // Width of the output 9 | colors: true, // Colorful log messages 10 | printEmojis: true, // Print an emoji for each log message 11 | printTime: false // Should each log print contain a timestamp 12 | ), 13 | ); 14 | 15 | static void t(message, [String? tag]) { 16 | _logger.t(message, error: tag); 17 | } 18 | 19 | static void d(dynamic message, [String? tag]) { 20 | _logger.d(message, error: tag); 21 | } 22 | 23 | static void i(dynamic message, [String? tag]) { 24 | _logger.i(message, error: tag); 25 | } 26 | 27 | static void w(dynamic message, [String? tag]) { 28 | _logger.w(message, error: tag); 29 | } 30 | 31 | static void e(dynamic message, [String? tag]) { 32 | _logger.e(message, error: tag); 33 | } 34 | 35 | static void f(dynamic message, [String? tag]) { 36 | _logger.f(message, error: tag); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/utils/palette.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:material_color_utilities/material_color_utilities.dart'; 3 | import 'package:wenku8x/extension/int.dart'; 4 | import 'package:wenku8x/extension/string.dart'; 5 | 6 | String parseDynamicColor(String svgString, 7 | {required int primaryColor, bool isDarkTheme = false}) { 8 | final tonalPalettes = CorePalette.contentOf(primaryColor); 9 | return svgString.replaceAllMapped( 10 | RegExp(r'fill="(.+?)"'), 11 | (Match match) { 12 | String value = match.group(1)!; 13 | if (value.startsWith("#")) { 14 | return match.group(0)!; 15 | } 16 | 17 | try { 18 | List splitValues = 19 | value.split(RegExp('(?<=\\d)(?=\\D)|(?=\\d)(?<=\\D)')); 20 | String scheme = splitValues[0]; 21 | String tone = splitValues[1]; 22 | int argb; 23 | 24 | switch (scheme) { 25 | case "p": 26 | argb = tonalPalettes.primary 27 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 28 | break; 29 | case "s": 30 | argb = tonalPalettes.secondary 31 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 32 | break; 33 | case "t": 34 | argb = tonalPalettes.tertiary 35 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 36 | break; 37 | case "n": 38 | argb = tonalPalettes.neutral 39 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 40 | break; 41 | case "nv": 42 | argb = tonalPalettes.neutralVariant 43 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 44 | break; 45 | case "e": 46 | argb = tonalPalettes.error 47 | .get(int.parse(tone).autoToDarkTone(isDarkTheme)); 48 | break; 49 | default: 50 | argb = Colors.transparent.value; 51 | } 52 | return 'fill="${argb.toRadixString(16).hexToJsColor().toUpperCase()}"'; 53 | } catch (e) { 54 | return match.group(0)!; 55 | } 56 | }, 57 | ); 58 | } 59 | -------------------------------------------------------------------------------- /lib/utils/util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | class Util { 4 | static getCover(String aid) { 5 | int ia = int.parse(aid); 6 | return "https://img.wenku8.com/image/${ia ~/ 1000}/$aid/${aid}s.jpg"; 7 | } 8 | 9 | static getJsColor(Color color) { 10 | final colorHex = color.value.toRadixString(16); 11 | String firstTwoChars = colorHex.substring(0, 2); 12 | String restOfString = colorHex.substring(2); 13 | return restOfString + firstTwoChars; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/utils/widget.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /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 | #include 11 | #include 12 | 13 | void fl_register_plugins(FlPluginRegistry* registry) { 14 | g_autoptr(FlPluginRegistrar) dynamic_color_registrar = 15 | fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); 16 | dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); 17 | g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar = 18 | fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin"); 19 | isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar); 20 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 21 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 22 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 23 | } 24 | -------------------------------------------------------------------------------- /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 | dynamic_color 7 | isar_flutter_libs 8 | url_launcher_linux 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /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, "wenku8x"); 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, "wenku8x"); 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 dynamic_color 9 | import isar_flutter_libs 10 | import path_provider_foundation 11 | import shared_preferences_foundation 12 | import sqflite 13 | import url_launcher_macos 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) 17 | IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin")) 18 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 19 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 20 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 21 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /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 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - dynamic_color (0.0.2): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - FMDB (2.7.5): 6 | - FMDB/standard (= 2.7.5) 7 | - FMDB/standard (2.7.5) 8 | - isar_flutter_libs (1.0.0): 9 | - FlutterMacOS 10 | - path_provider_foundation (0.0.1): 11 | - Flutter 12 | - FlutterMacOS 13 | - shared_preferences_foundation (0.0.1): 14 | - Flutter 15 | - FlutterMacOS 16 | - sqflite (0.0.2): 17 | - FlutterMacOS 18 | - FMDB (>= 2.7.5) 19 | - url_launcher_macos (0.0.1): 20 | - FlutterMacOS 21 | 22 | DEPENDENCIES: 23 | - dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`) 24 | - FlutterMacOS (from `Flutter/ephemeral`) 25 | - isar_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/isar_flutter_libs/macos`) 26 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) 27 | - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) 28 | - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) 29 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 30 | 31 | SPEC REPOS: 32 | trunk: 33 | - FMDB 34 | 35 | EXTERNAL SOURCES: 36 | dynamic_color: 37 | :path: Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos 38 | FlutterMacOS: 39 | :path: Flutter/ephemeral 40 | isar_flutter_libs: 41 | :path: Flutter/ephemeral/.symlinks/plugins/isar_flutter_libs/macos 42 | path_provider_foundation: 43 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin 44 | shared_preferences_foundation: 45 | :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin 46 | sqflite: 47 | :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos 48 | url_launcher_macos: 49 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 50 | 51 | SPEC CHECKSUMS: 52 | dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f 53 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 54 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 55 | isar_flutter_libs: 43385c99864c168fadba7c9adeddc5d38838ca6a 56 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 57 | shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 58 | sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea 59 | url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 60 | 61 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 62 | 63 | COCOAPODS: 1.11.3 64 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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 = wenku8x 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = cc.zsakvo.wenku8x 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 cc.zsakvo. 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.client 10 | 11 | com.apple.security.network.server 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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() 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 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 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 in the flutter_test package. 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:wenku8x/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 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | wenku8x 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wenku8x", 3 | "short_name": "wenku8x", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /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 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | DynamicColorPluginCApiRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); 16 | IsarFlutterLibsPluginRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin")); 18 | UrlLauncherWindowsRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 20 | } 21 | -------------------------------------------------------------------------------- /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 | dynamic_color 7 | isar_flutter_libs 8 | url_launcher_windows 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /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 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 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", "cc.zsakvo" "\0" 93 | VALUE "FileDescription", "wenku8x" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "wenku8x" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 cc.zsakvo. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "wenku8x.exe" "\0" 98 | VALUE "ProductName", "wenku8x" "\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 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /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.Create(L"wenku8x", 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/zsakvo/wenku8x/57c6312fb2ec619c399be1360d5d16ccdd2cd23c/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 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /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 a win32 window with |title| that is positioned and sized 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 this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------