├── .github └── workflows │ ├── android-release.yml.bak │ ├── ci_build_package.yml │ ├── ci_release_by_tag.yml │ └── ios-release.yml.bak ├── .gitignore ├── .gitmodules ├── .metadata ├── .run ├── runAppDebug.run.xml └── runAppRelease.run.xml ├── CHANGELOG.MD ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ ├── run_ikaros_app_keystore.jks │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── app │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-ldpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── playstore-icon.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets └── loading_placeholder.jpg ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon-1024.png │ │ ├── icon-20@2x.png │ │ ├── icon-20@3x.png │ │ ├── icon-29@2x.png │ │ ├── icon-29@3x.png │ │ ├── icon-38@2x.png │ │ ├── icon-38@3x.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-64@2x.png │ │ ├── icon-64@3x.png │ │ ├── icon-68@2x.png │ │ ├── icon-76@2x.png │ │ └── icon-83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── api │ ├── actuator │ │ └── ActuatorInfoApi.dart │ ├── attachment │ │ ├── AttachmentApi.dart │ │ ├── AttachmentRelationApi.dart │ │ ├── enums │ │ │ └── AttachmentRelationType.dart │ │ └── model │ │ │ ├── AttachmentRelation.dart │ │ │ ├── AttachmentRelation.g.dart │ │ │ ├── VideoSubtitle.dart │ │ │ └── VideoSubtitle.g.dart │ ├── auth │ │ ├── AuthApi.dart │ │ └── AuthParams.dart │ ├── collection │ │ ├── EpisodeCollectionApi.dart │ │ ├── SubjectCollectionApi.dart │ │ ├── enums │ │ │ └── CollectionType.dart │ │ └── model │ │ │ ├── EpisodeCollection.dart │ │ │ ├── EpisodeCollection.g.dart │ │ │ ├── SubjectCollection.dart │ │ │ └── SubjectCollection.g.dart │ ├── common │ │ ├── PagingWrap.dart │ │ └── PagingWrap.g.dart │ ├── dandanplay │ │ ├── DandanplayCommentApi.dart │ │ ├── DandanplaySearchApi.dart │ │ ├── enums │ │ │ └── SearchEpisodesAnimeType.dart │ │ └── model │ │ │ ├── CommentEpisode.dart │ │ │ ├── CommentEpisode.g.dart │ │ │ ├── CommentEpisodeIdResponse.dart │ │ │ ├── CommentEpisodeIdResponse.g.dart │ │ │ ├── IkarosDanmukuEpisodesResponse.dart │ │ │ ├── IkarosDanmukuEpisodesResponse.g.dart │ │ │ ├── SearchEpisodeDetails.dart │ │ │ ├── SearchEpisodeDetails.g.dart │ │ │ ├── SearchEpisodesAnime.dart │ │ │ ├── SearchEpisodesAnime.g.dart │ │ │ ├── SearchEpisodesResponse.dart │ │ │ └── SearchEpisodesResponse.g.dart │ ├── dio_client.dart │ ├── dio_interceptors.dart │ ├── search │ │ ├── IndicesApi.dart │ │ └── model │ │ │ ├── SubjectHint.dart │ │ │ ├── SubjectHint.g.dart │ │ │ ├── SubjectSearchResult.dart │ │ │ └── SubjectSearchResult.g.dart │ ├── subject │ │ ├── EpisodeApi.dart │ │ ├── SubjectApi.dart │ │ ├── SubjectRelationApi.dart │ │ ├── SubjectSyncApi.dart │ │ ├── enums │ │ │ ├── CollectionType.dart │ │ │ ├── EpisodeGroup.dart │ │ │ ├── SubjectRelationType.dart │ │ │ ├── SubjectSyncPlatform.dart │ │ │ └── SubjectType.dart │ │ └── model │ │ │ ├── Episode.dart │ │ │ ├── Episode.g.dart │ │ │ ├── EpisodeRecord.dart │ │ │ ├── EpisodeRecord.g.dart │ │ │ ├── EpisodeResource.dart │ │ │ ├── EpisodeResource.g.dart │ │ │ ├── Subject.dart │ │ │ ├── Subject.g.dart │ │ │ ├── SubjectMeta.dart │ │ │ ├── SubjectMeta.g.dart │ │ │ ├── SubjectRelation.dart │ │ │ ├── SubjectRelation.g.dart │ │ │ ├── SubjectSync.dart │ │ │ ├── SubjectSync.g.dart │ │ │ ├── Video.dart │ │ │ └── Video.g.dart │ └── user │ │ ├── UserApi.dart │ │ └── model │ │ ├── User.dart │ │ └── User.g.dart ├── collection │ ├── collections.dart │ └── episode_collections.dart ├── component │ ├── dynamic_bar_icon.dart │ ├── full_screen_Image.dart │ ├── route_observer.dart │ ├── setting.dart │ └── subject │ │ └── subject.dart ├── consts │ ├── collection-const.dart │ ├── subject_const.dart │ └── tmp-const.dart ├── layout.dart ├── main.dart ├── player │ ├── player_audio_desktop.dart │ ├── player_audio_mobile.dart │ ├── player_video_desktop.dart │ └── player_video_mobile.dart ├── subject │ ├── episode.dart │ ├── search.dart │ ├── subject.dart │ └── subjects.dart ├── user │ ├── login.dart │ └── user.dart └── utils │ ├── device_info_utils.dart │ ├── message_utils.dart │ ├── number_utils.dart │ ├── screen_utils.dart │ ├── shared_prefs_utils.dart │ ├── string_utils.dart │ ├── throttle_utils.dart │ ├── time_utils.dart │ └── url_utils.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ └── CMakeLists.txt ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ └── Flutter-Release.xcconfig ├── 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 ├── pubspec_overrides.yaml ├── test └── api │ └── dandanplay │ ├── DandanplayCommentApiTest.dart │ └── DandanplaySearchApiTest.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 └── 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 /.github/workflows/android-release.yml.bak: -------------------------------------------------------------------------------- 1 | name: Flutter_Android 2 | 3 | on: 4 | push: 5 | branches: 6 | - release-* 7 | tags: 8 | - '*' 9 | 10 | jobs: 11 | build_android: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout the code 16 | uses: actions/checkout@v2 17 | 18 | - name: Setup Java to compile Android project 19 | uses: actions/setup-java@v1 20 | with: 21 | java-version: '17.x' 22 | 23 | - name: Install and set Flutter version 24 | uses: subosito/flutter-action@v2 25 | with: 26 | flutter-version: '3.10.5' 27 | channel: 'stable' 28 | 29 | - name: Restore packages 30 | run: flutter pub get 31 | 32 | - name: Build Android App Bundle 33 | run: flutter build apk --release 34 | 35 | - name: Publish Android Artefacts 36 | uses: actions/upload-artifact@v1 37 | with: 38 | name: release-android-${{ github.ref_name }} 39 | path: build/app/outputs/flutter-apk -------------------------------------------------------------------------------- /.github/workflows/ci_release_by_tag.yml: -------------------------------------------------------------------------------- 1 | name: Create Draft Release 2 | 3 | permissions: 4 | contents: write 5 | packages: write 6 | 7 | on: 8 | push: 9 | tags: 10 | - v[0-9]+.* 11 | 12 | jobs: 13 | create-release: 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: write 17 | packages: write 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: taiki-e/create-gh-release-action@v1 21 | with: 22 | # (Optional) 23 | changelog: CHANGELOG.MD 24 | draft: false 25 | # (Optional) Format of title. 26 | # [default value: $tag] 27 | # [possible values: variables $tag, $version, and any string] 28 | title: v$version 29 | # (Required) GitHub token for creating GitHub Releases. 30 | token: ${{ secrets.LI_GUOHAO_TOKEN }} 31 | -------------------------------------------------------------------------------- /.github/workflows/ios-release.yml.bak: -------------------------------------------------------------------------------- 1 | name: Flutter_iOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - release-* 7 | tags: 8 | - '*' 9 | 10 | jobs: 11 | build_ios: 12 | runs-on: macos-latest 13 | env: 14 | SHEME: Runner 15 | BUILD_CONFIGURATION: Release 16 | 17 | steps: 18 | - name: Checkout the code 19 | uses: actions/checkout@v2 20 | 21 | - name: Install and set Flutter version 22 | uses: subosito/flutter-action@v2 23 | with: 24 | flutter-version: '3.10.5' 25 | channel: 'stable' 26 | 27 | - name: Restore packages 28 | run: flutter pub get 29 | 30 | - name: Build Flutter 31 | run: flutter build ios --release --no-codesign 32 | 33 | - name: Build xArchive 34 | run: | 35 | mkdir Payload && mv build/ios/iphoneos/Runner.app Payload && zip -r Payload.zip Payload && mkdir output && mv Payload.zip output/ikaros.ipa 36 | 37 | - name: Publish iOS Artefacts 38 | uses: actions/upload-artifact@v1 39 | with: 40 | name: release-ios-${{ github.ref_name }} 41 | path: output -------------------------------------------------------------------------------- /.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 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | 45 | **Generated** 46 | **generated** 47 | /devtools_options.yaml 48 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dependencies/dart_vlc"] 2 | path = dependencies/dart_vlc 3 | url = https://github.com/chivehao/dart_vlc.git 4 | [submodule "dependencies/flutter_vlc_player"] 5 | path = dependencies/flutter_vlc_player 6 | url = https://github.com/chivehao/flutter_vlc_player.git 7 | [submodule "dependencies/ns_danmaku"] 8 | path = dependencies/ns_danmaku 9 | url = https://github.com/chivehao/flutter_ns_danmaku.git 10 | -------------------------------------------------------------------------------- /.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: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819" 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: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 17 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 18 | - platform: android 19 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 20 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 21 | - platform: ios 22 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 23 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 24 | - platform: linux 25 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 26 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 27 | - platform: macos 28 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 29 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 30 | - platform: web 31 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 32 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 33 | - platform: windows 34 | create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 35 | base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 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 | -------------------------------------------------------------------------------- /.run/runAppDebug.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.run/runAppRelease.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ikaros_app 2 | 3 | ikaros app by flutter 4 | 5 | 6 | # Json generate 7 | 8 | ``` 9 | flutter packages pub run build_runner build 10 | ``` 11 | 12 | # Version 13 | APP的版本规定 14 | 15 | 服务端版本.主版本.子版本 16 | 17 | app的服务端版本只取服务端版本的主版本和子版本,忽略第三级别的Bug版本, 18 | 19 | 比如当前APP适配的服务端是 0.15.5, 那么服务端版本就是15,此时APP的版本就是 15.3.0 20 | 21 | 如果服务端版本是1.0.0,此时服务端的子版本最大曾是两位数,则,app的服务端版本是 1 * 100 + 0 = 100 22 | ,此时APP的版本就是 100.3.0 23 | 24 | # Build 25 | 26 | `Android Studio`最新版是JBR21,版本太高, 27 | 建议去[Android Studio Archives](https://developer.android.google.cn/studio/archive)下载老版本的, 28 | 推荐版本:`Android Studio Jellyfish | 2023.3.1 April 30, 2024`, 29 | 30 | git 子模块初始化: 31 | ``` 32 | git submodule init 33 | git submodule update 34 | 35 | cd dependencies/dart_vlc 36 | flutter pub get 37 | 38 | cd ../../ 39 | cd dependencies/flutter_vlc_player 40 | flutter pub get 41 | 42 | cd ../../ 43 | cd dependencies/ns_danmaku 44 | flutter pub get 45 | 46 | 47 | cd ../../ 48 | flutter pub get 49 | ``` 50 | 用`Android Studio`打开后,如果依赖里还有红线的,进对应的目录,`flutter pub get`下就OK了。 51 | 52 | 53 | # 环境 54 | 55 | ```text 56 | flutter doctor -v 57 | ``` 58 | 59 | ```text 60 | [✓] Flutter (Channel stable, 3.24.5, on Microsoft Windows [版本 10.0.22631.4460], locale zh-CN) 61 | • Flutter version 3.24.5 on channel stable at C:\Applications\flutter\3.24.5 62 | • Upstream repository https://github.com/flutter/flutter.git 63 | • Framework revision dec2ee5c1f (15 hours ago), 2024-11-13 11:13:06 -0800 64 | • Engine revision a18df97ca5 65 | • Dart version 3.5.4 66 | • DevTools version 2.37.3 67 | 68 | [✓] Windows Version (Installed version of Windows is version 10 or higher) 69 | 70 | [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) 71 | • Android SDK at C:\Users\chivehao\AppData\Local\Android\Sdk 72 | • Platform android-35, build-tools 35.0.0 73 | • ANDROID_HOME = C:\Users\chivehao\AppData\Local\Android\Sdk 74 | • Java binary at: C:\Applications\android\android-studio\jbr\bin\java 75 | • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) 76 | • All Android licenses accepted. 77 | 78 | [✓] Chrome - develop for the web 79 | • Chrome at C:\Users\chivehao\AppData\Local\Google\Chrome\Application\chrome.exe 80 | 81 | [✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5) 82 | • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community 83 | • Visual Studio Community 2022 version 17.11.35327.3 84 | • Windows 10 SDK version 10.0.22621.0 85 | 86 | [✓] Android Studio (version 2023.3) 87 | • Android Studio at C:\Applications\android\android-studio 88 | • Flutter plugin can be installed from: 89 | 🔨 https://plugins.jetbrains.com/plugin/9212-flutter 90 | • Dart plugin can be installed from: 91 | 🔨 https://plugins.jetbrains.com/plugin/6351-dart 92 | • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) 93 | 94 | [✓] IntelliJ IDEA Community Edition (version 2024.3) 95 | • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.3 96 | • Flutter plugin can be installed from: 97 | 🔨 https://plugins.jetbrains.com/plugin/9212-flutter 98 | • Dart plugin can be installed from: 99 | 🔨 https://plugins.jetbrains.com/plugin/6351-dart 100 | 101 | [✓] VS Code (version 1.94.2) 102 | • VS Code at C:\Users\chivehao\AppData\Local\Programs\Microsoft VS Code 103 | • Flutter extension can be installed from: 104 | 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter 105 | 106 | [✓] Connected device (4 available) 107 | • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator) 108 | • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.22631.4460] 109 | • Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.69 110 | • Edge (web) • edge • web-javascript • Microsoft Edge 126.0.2592.61 111 | 112 | [✓] Network resources 113 | • All expected network resources are available. 114 | 115 | • No issues found! 116 | ``` -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /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/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "run.ikaros.app" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "run.ikaros.app" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | signingConfigs { 34 | release { 35 | keyAlias 'run_ikaros_app' 36 | keyPassword 'ikaros.run' 37 | storeFile file('run_ikaros_app_keystore.jks') 38 | storePassword 'ikaros.run' 39 | } 40 | } 41 | 42 | buildTypes { 43 | release { 44 | // Signing with the debug keys for now, so `flutter run --release` works. 45 | signingConfig = signingConfigs.release 46 | minifyEnabled true // 启用代码压缩 47 | shrinkResources true // 启用资源压缩 48 | // useProguard true 49 | proguardFiles getDefaultProguardFile( 50 | 'proguard-android-optimize.txt'), 51 | 'proguard-rules.pro' 52 | } 53 | } 54 | } 55 | 56 | flutter { 57 | source = "../.." 58 | } 59 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | #Flutter Wrapper 2 | -keep class io.flutter.app.** { *; } 3 | -keep class io.flutter.plugin.** { *; } 4 | -keep class io.flutter.util.** { *; } 5 | -keep class io.flutter.view.** { *; } 6 | -keep class io.flutter.** { *; } 7 | -keep class io.flutter.plugins.** { *; } 8 | -keep class org.videolan.libvlc.** { *; } -------------------------------------------------------------------------------- /android/app/run_ikaros_app_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/run_ikaros_app_keystore.jks -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package run.ikaros.app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/playstore-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/android/app/src/main/res/playstore-icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 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.6.3-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 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.9.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /assets/loading_placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/assets/loading_placeholder.jpg -------------------------------------------------------------------------------- /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 "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /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 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 32 | end 33 | 34 | post_install do |installer| 35 | installer.pods_project.targets.each do |target| 36 | flutter_additional_ios_build_settings(target) 37 | end 38 | end -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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": "universal", 6 | "filename": "icon-20@2x.png", 7 | "scale": "2x", 8 | "platform": "ios" 9 | }, 10 | { 11 | "size": "20x20", 12 | "idiom": "universal", 13 | "filename": "icon-20@3x.png", 14 | "scale": "3x", 15 | "platform": "ios" 16 | }, 17 | { 18 | "size": "29x29", 19 | "idiom": "universal", 20 | "filename": "icon-29@2x.png", 21 | "scale": "2x", 22 | "platform": "ios" 23 | }, 24 | { 25 | "size": "29x29", 26 | "idiom": "universal", 27 | "filename": "icon-29@3x.png", 28 | "scale": "3x", 29 | "platform": "ios" 30 | }, 31 | { 32 | "size": "38x38", 33 | "idiom": "universal", 34 | "filename": "icon-38@2x.png", 35 | "scale": "2x", 36 | "platform": "ios" 37 | }, 38 | { 39 | "size": "38x38", 40 | "idiom": "universal", 41 | "filename": "icon-38@3x.png", 42 | "scale": "3x", 43 | "platform": "ios" 44 | }, 45 | { 46 | "size": "40x40", 47 | "idiom": "universal", 48 | "filename": "icon-40@2x.png", 49 | "scale": "2x", 50 | "platform": "ios" 51 | }, 52 | { 53 | "size": "40x40", 54 | "idiom": "universal", 55 | "filename": "icon-40@3x.png", 56 | "scale": "3x", 57 | "platform": "ios" 58 | }, 59 | { 60 | "size": "60x60", 61 | "idiom": "universal", 62 | "filename": "icon-60@2x.png", 63 | "scale": "2x", 64 | "platform": "ios" 65 | }, 66 | { 67 | "size": "60x60", 68 | "idiom": "universal", 69 | "filename": "icon-60@3x.png", 70 | "scale": "3x", 71 | "platform": "ios" 72 | }, 73 | { 74 | "size": "64x64", 75 | "idiom": "universal", 76 | "filename": "icon-64@2x.png", 77 | "scale": "2x", 78 | "platform": "ios" 79 | }, 80 | { 81 | "size": "64x64", 82 | "idiom": "universal", 83 | "filename": "icon-64@3x.png", 84 | "scale": "3x", 85 | "platform": "ios" 86 | }, 87 | { 88 | "size": "68x68", 89 | "idiom": "universal", 90 | "filename": "icon-68@2x.png", 91 | "scale": "2x", 92 | "platform": "ios" 93 | }, 94 | { 95 | "size": "76x76", 96 | "idiom": "universal", 97 | "filename": "icon-76@2x.png", 98 | "scale": "2x", 99 | "platform": "ios" 100 | }, 101 | { 102 | "size": "83.5x83.5", 103 | "idiom": "universal", 104 | "filename": "icon-83.5@2x.png", 105 | "scale": "2x", 106 | "platform": "ios" 107 | }, 108 | { 109 | "size": "1024x1024", 110 | "idiom": "universal", 111 | "filename": "icon-1024.png", 112 | "scale": "1x", 113 | "platform": "ios" 114 | } 115 | ], 116 | "info": { 117 | "version": 1, 118 | "author": "icon.wuruihong.com" 119 | } 120 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-38@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-38@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-38@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-38@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-64@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-64@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-64@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-64@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-68@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-68@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.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/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Ikaros 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ikaros 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiresFullScreen 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeRight 37 | UIInterfaceOrientationLandscapeLeft 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | CADisableMinimumFrameDurationOnPhone 49 | 50 | UIApplicationSupportsIndirectInputEvents 51 | 52 | NSAppTransportSecurity 53 | 54 | NSAllowsArbitraryLoads 55 | 56 | 57 | LSApplicationQueriesSchemes 58 | 59 | http 60 | https 61 | 62 | NSPhotoLibraryUsageDescription 63 | Ikaros需要访问您的相册以保存图片 64 | CFBundleURLTypes 65 | 66 | 67 | CFBundleURLSchemes 68 | 69 | ikaros 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/api/actuator/ActuatorInfoApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:ikaros/api/dio_client.dart'; 4 | 5 | class ActuatorInfo { 6 | Future getVersion() async { 7 | String apiUrl = "/actuator/info"; 8 | try { 9 | Dio dio = await DioClient.getDio(); 10 | Response response = await dio.get(apiUrl); 11 | // print("response status code: ${response.statusCode}"); 12 | if (response.statusCode != 200) { 13 | return null; 14 | } 15 | Map data = response.data; 16 | return data['build']['version']; 17 | } catch (e) { 18 | if (kDebugMode) { 19 | print(e); 20 | } 21 | return null; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /lib/api/attachment/AttachmentApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:crypto/crypto.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | 5 | class AttachmentApi { 6 | 7 | Future fetchPartialFileMd5(String url)async { 8 | List bytes = await fetchPartialFile(url); 9 | Digest md5Digest = md5.convert(bytes); 10 | return md5Digest.toString(); 11 | } 12 | 13 | Future> fetchPartialFile(String url) async { 14 | if (url == "" || !url.startsWith("http:")) return List.empty(); 15 | 16 | try { 17 | // 使用 range 头部请求文件的前 16MB 数据 18 | Response> response = await Dio().get>( 19 | url, // 替换为你的文件URL 20 | options: Options( 21 | responseType: ResponseType.bytes, 22 | headers: { 23 | 'Range': 'bytes=0-16777215', // 请求文件的前 16MB 字节 (16 * 1024 * 1024 - 1) 24 | }, 25 | ), 26 | ); 27 | 28 | if (response.statusCode == 206) { // 206 表示部分内容获取成功 29 | return response.data!; 30 | } else { 31 | if (kDebugMode) { 32 | print('请求未能返回部分内容。'); 33 | } 34 | } 35 | } catch (e) { 36 | if (kDebugMode) { 37 | print('请求失败: $e'); 38 | } 39 | } 40 | return List.empty(); 41 | } 42 | } -------------------------------------------------------------------------------- /lib/api/attachment/AttachmentRelationApi.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:ikaros/api/attachment/model/VideoSubtitle.dart'; 5 | import 'package:ikaros/api/dio_client.dart'; 6 | 7 | class AttachmentRelationApi { 8 | Future> findByAttachmentId(int attachmentId) async { 9 | String apiUrl = 10 | "/api/v1alpha1/attachment/relation/videoSubtitle/subtitles/$attachmentId"; 11 | try { 12 | // print("queryParams: $queryParams"); 13 | Dio dio = await DioClient.getDio(); 14 | var response = await dio.get(apiUrl); 15 | // print("response status code: ${response.statusCode}"); 16 | if (response.statusCode != 200) { 17 | return []; 18 | } 19 | 20 | var listDynamic = jsonDecode(jsonEncode(response.data)); 21 | 22 | List> listMap = 23 | List>.from(listDynamic); 24 | List videoSubtitles = []; 25 | for (var m in listMap) { 26 | videoSubtitles.add(VideoSubtitle.fromJson(m)); 27 | } 28 | 29 | return videoSubtitles; 30 | } catch (e) { 31 | print(e); 32 | return []; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/api/attachment/enums/AttachmentRelationType.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum AttachmentRelationType { 4 | @JsonValue("VIDEO_SUBTITLE") 5 | VIDEO_SUBTITLE,; 6 | } -------------------------------------------------------------------------------- /lib/api/attachment/model/AttachmentRelation.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | 4 | import '../enums/AttachmentRelationType.dart'; 5 | 6 | part 'AttachmentRelation.g.dart'; 7 | 8 | @JsonSerializable() 9 | class AttachmentRelation { 10 | final int id; 11 | @JsonKey(name: "attachment_id") 12 | final int attachmentId; 13 | final AttachmentRelationType type; 14 | @JsonKey(name: "relation_attachment_id") 15 | final int relationAttachmentId; 16 | 17 | AttachmentRelation({ 18 | required this.id, required this.attachmentId, 19 | required this.type, required this.relationAttachmentId 20 | }); 21 | 22 | factory AttachmentRelation.fromJson(Map json) => _$AttachmentRelationFromJson(json); 23 | 24 | Map toJson() => _$AttachmentRelationToJson(this); 25 | } -------------------------------------------------------------------------------- /lib/api/attachment/model/AttachmentRelation.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'AttachmentRelation.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | AttachmentRelation _$AttachmentRelationFromJson(Map json) => 10 | AttachmentRelation( 11 | id: (json['id'] as num).toInt(), 12 | attachmentId: (json['attachment_id'] as num).toInt(), 13 | type: $enumDecode(_$AttachmentRelationTypeEnumMap, json['type']), 14 | relationAttachmentId: (json['relation_attachment_id'] as num).toInt(), 15 | ); 16 | 17 | Map _$AttachmentRelationToJson(AttachmentRelation instance) => 18 | { 19 | 'id': instance.id, 20 | 'attachment_id': instance.attachmentId, 21 | 'type': _$AttachmentRelationTypeEnumMap[instance.type]!, 22 | 'relation_attachment_id': instance.relationAttachmentId, 23 | }; 24 | 25 | const _$AttachmentRelationTypeEnumMap = { 26 | AttachmentRelationType.VIDEO_SUBTITLE: 'VIDEO_SUBTITLE', 27 | }; 28 | -------------------------------------------------------------------------------- /lib/api/attachment/model/VideoSubtitle.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | 4 | part 'VideoSubtitle.g.dart'; 5 | 6 | @JsonSerializable() 7 | class VideoSubtitle { 8 | @JsonKey(name: "attachment_id") 9 | final int attachmentId; 10 | final String name; 11 | final String url; 12 | 13 | VideoSubtitle({ 14 | required this.attachmentId, required this.name, 15 | required this.url 16 | }); 17 | 18 | factory VideoSubtitle.fromJson(Map json) => _$VideoSubtitleFromJson(json); 19 | 20 | Map toJson() => _$VideoSubtitleToJson(this); 21 | } -------------------------------------------------------------------------------- /lib/api/attachment/model/VideoSubtitle.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'VideoSubtitle.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | VideoSubtitle _$VideoSubtitleFromJson(Map json) => 10 | VideoSubtitle( 11 | attachmentId: (json['attachment_id'] as num).toInt(), 12 | name: json['name'] as String, 13 | url: json['url'] as String, 14 | ); 15 | 16 | Map _$VideoSubtitleToJson(VideoSubtitle instance) => 17 | { 18 | 'attachment_id': instance.attachmentId, 19 | 'name': instance.name, 20 | 'url': instance.url, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/api/auth/AuthApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:ikaros/api/auth/AuthParams.dart'; 3 | import 'package:ikaros/api/dio_client.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | 6 | class AuthApi { 7 | static const String SharedPreferencesKeyAuthBaseUrl = "AUTH_BASE_URL"; 8 | static const String SharedPreferencesKeyAuthUsername = "AUTH_USERNAME"; 9 | static const String SharedPreferencesKeyAuthToken = "AUTH_Token"; 10 | static const String SharedPreferencesKeyAuthRefreshToken = "AUTH_Refresh_Token"; 11 | 12 | Future getAuthParams() async { 13 | final prefs = await SharedPreferences.getInstance(); 14 | String? username = prefs.getString(SharedPreferencesKeyAuthUsername); 15 | String? token = prefs.getString(SharedPreferencesKeyAuthToken); 16 | String? baseUrl = prefs.getString(SharedPreferencesKeyAuthBaseUrl); 17 | String? refreshToken = prefs.getString(SharedPreferencesKeyAuthRefreshToken); 18 | if (username == null || 19 | username.isEmpty || 20 | token == null || 21 | token.isEmpty || 22 | refreshToken == null || 23 | refreshToken.isEmpty || 24 | baseUrl == null || 25 | baseUrl.isEmpty) { 26 | return Future(() => null); 27 | } 28 | var authParams = AuthParams(); 29 | authParams.baseUrl = baseUrl; 30 | authParams.username = username; 31 | authParams.token = token; 32 | authParams.refreshToken = refreshToken; 33 | return Future(() => authParams); 34 | } 35 | 36 | Future login(String baseUrl, String username, String password) async { 37 | String url = "$baseUrl/api/v1alpha1/security/auth/token/jwt/apply"; 38 | Response response = await Dio().post(url, data: { 39 | "authType": "USERNAME_PASSWORD", 40 | "username": username, 41 | "password": password, 42 | "phoneNum": "", 43 | "email": "", 44 | "code": "" 45 | }); 46 | final prefs = await SharedPreferences.getInstance(); 47 | await prefs.setString(SharedPreferencesKeyAuthBaseUrl, baseUrl); 48 | await prefs.setString(SharedPreferencesKeyAuthUsername, username); 49 | await prefs.setString(SharedPreferencesKeyAuthToken, response.data['accessToken']); 50 | await prefs.setString(SharedPreferencesKeyAuthRefreshToken, response.data['refreshToken']); 51 | await DioClient.rebuild(baseUrl: baseUrl); 52 | } 53 | 54 | Future logout() async { 55 | final prefs = await SharedPreferences.getInstance(); 56 | await prefs.remove(SharedPreferencesKeyAuthBaseUrl); 57 | await prefs.remove(SharedPreferencesKeyAuthUsername); 58 | await prefs.remove(SharedPreferencesKeyAuthToken); 59 | await prefs.remove(SharedPreferencesKeyAuthRefreshToken); 60 | } 61 | 62 | Future refreshToken(String refreshToken) async { 63 | String url = "/api/v1alpha1/security/auth/token/jwt/refresh"; 64 | Dio dio = await DioClient.getDio(); 65 | var response = await dio.put(url, data: refreshToken); 66 | final prefs = await SharedPreferences.getInstance(); 67 | await prefs.setString(SharedPreferencesKeyAuthToken, response.data); 68 | return response.data; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/api/auth/AuthParams.dart: -------------------------------------------------------------------------------- 1 | class AuthParams { 2 | String baseUrl = ''; 3 | String username = ''; 4 | String token = ''; 5 | String refreshToken = ''; 6 | } 7 | -------------------------------------------------------------------------------- /lib/api/collection/SubjectCollectionApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:ikaros/api/collection/enums/CollectionType.dart'; 3 | import 'package:ikaros/api/collection/model/SubjectCollection.dart'; 4 | import 'package:ikaros/api/common/PagingWrap.dart'; 5 | import 'package:ikaros/api/dio_client.dart'; 6 | 7 | class SubjectCollectionApi { 8 | 9 | 10 | 11 | Future fetchSubjectCollections( 12 | int? page, int? size, CollectionType? type) async { 13 | page ??= 1; 14 | size ??= 12; 15 | 16 | String apiUrl = "/api/v1alpha1/collection/subjects" 17 | "?page=$page&size=$size"; 18 | if (type != null) { 19 | apiUrl = "$apiUrl&type=${type.name}"; 20 | } 21 | 22 | try { 23 | Dio dio = await DioClient.getDio(); 24 | var response = await dio.get(apiUrl); 25 | // print("response status code: ${response.statusCode}"); 26 | if (response.statusCode != 200) { 27 | return null; 28 | } 29 | return PagingWrap.fromJson(response.data); 30 | } catch (e) { 31 | print(e); 32 | return null; 33 | } 34 | } 35 | 36 | Future findCollectionBySubjectId(int subjectId) async { 37 | String apiUrl = "/api/v1alpha1/collection/subject/$subjectId"; 38 | try { 39 | Dio dio = await DioClient.getDio(); 40 | var response = await dio.get(apiUrl); 41 | // print("response status code: ${response.statusCode}"); 42 | if (response.statusCode != 200) { 43 | return null; 44 | } 45 | return SubjectCollection.fromJson(response.data); 46 | } catch (e) { 47 | print(e); 48 | return null; 49 | } 50 | } 51 | 52 | Future updateCollection( 53 | int subjectId, CollectionType? type, bool? isPrivate) async { 54 | String apiUrl = "/api/v1alpha1/collection/subject/collect" 55 | "?subjectId=$subjectId"; 56 | if (type != null) { 57 | apiUrl += "&type=${type.name}"; 58 | } 59 | 60 | if (isPrivate != null) { 61 | apiUrl = "$apiUrl&isPrivate=$isPrivate"; 62 | } 63 | 64 | try { 65 | Dio dio = await DioClient.getDio(); 66 | var response = await dio.post(apiUrl); 67 | // print("response status code: ${response.statusCode}"); 68 | if (response.statusCode != 200) { 69 | return; 70 | } 71 | return; 72 | } catch (e) { 73 | print(e); 74 | return; 75 | } 76 | } 77 | 78 | Future removeCollection(int subjectId) async { 79 | String apiUrl = "/api/v1alpha1/collection/subject/collect" 80 | "?subjectId=$subjectId"; 81 | try { 82 | Dio dio = await DioClient.getDio(); 83 | var response = await dio.delete(apiUrl); 84 | // print("response status code: ${response.statusCode}"); 85 | if (response.statusCode != 200) { 86 | return; 87 | } 88 | return; 89 | } catch (e) { 90 | print(e); 91 | return; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/api/collection/enums/CollectionType.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum CollectionType { 4 | /// Wist watch. 5 | @JsonValue("WISH") 6 | WISH, 7 | /// Watching. 8 | @JsonValue("DOING") 9 | DOING, 10 | /// Watch done. 11 | @JsonValue("DONE") 12 | DONE, 13 | /// No time to watch it. 14 | @JsonValue("SHELVE") 15 | SHELVE, 16 | /// Discard it. 17 | @JsonValue("DISCARD") 18 | DISCARD; 19 | } -------------------------------------------------------------------------------- /lib/api/collection/model/EpisodeCollection.dart: -------------------------------------------------------------------------------- 1 | import 'package:ikaros/api/subject/enums/EpisodeGroup.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'EpisodeCollection.g.dart'; 5 | 6 | @JsonSerializable() 7 | class EpisodeCollection { 8 | final int id; 9 | @JsonKey(name: "user_id") 10 | final int userId; 11 | @JsonKey(name: "episode_id") 12 | final int episodeId; 13 | 14 | /// 是否已经看过. 15 | final bool? finish; 16 | 17 | /// 观看进度,时间戳,单位 milliseconds. 18 | final int? progress; 19 | 20 | /// 总时长,时间戳. 21 | final int? duration; 22 | 23 | @JsonKey(name: "subject_id") 24 | final int? subjectId; 25 | final String? name; 26 | @JsonKey(name: "name_cn") 27 | final String? nameCn; 28 | final String? description; 29 | @JsonKey(name: "ep_group") 30 | final EpisodeGroup? group; 31 | @JsonKey(name: "update_time") 32 | final String? updateTime; 33 | 34 | EpisodeCollection({this.progress, required this.id, required this.userId, 35 | required this.episodeId, this.finish, this.duration, this.subjectId, 36 | this.name, this.nameCn, this.description, 37 | this.group, this.updateTime}); 38 | 39 | 40 | factory EpisodeCollection.fromJson(Map json) => _$EpisodeCollectionFromJson(json); 41 | 42 | Map toJson() => _$EpisodeCollectionToJson(this); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /lib/api/collection/model/EpisodeCollection.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'EpisodeCollection.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | EpisodeCollection _$EpisodeCollectionFromJson(Map json) => 10 | EpisodeCollection( 11 | progress: (json['progress'] as num?)?.toInt(), 12 | id: (json['id'] as num).toInt(), 13 | userId: (json['user_id'] as num).toInt(), 14 | episodeId: (json['episode_id'] as num).toInt(), 15 | finish: json['finish'] as bool?, 16 | duration: (json['duration'] as num?)?.toInt(), 17 | subjectId: (json['subject_id'] as num?)?.toInt(), 18 | name: json['name'] as String?, 19 | nameCn: json['name_cn'] as String?, 20 | description: json['description'] as String?, 21 | group: $enumDecodeNullable(_$EpisodeGroupEnumMap, json['ep_group']), 22 | updateTime: json['update_time'] as String?, 23 | ); 24 | 25 | Map _$EpisodeCollectionToJson(EpisodeCollection instance) => 26 | { 27 | 'id': instance.id, 28 | 'user_id': instance.userId, 29 | 'episode_id': instance.episodeId, 30 | 'finish': instance.finish, 31 | 'progress': instance.progress, 32 | 'duration': instance.duration, 33 | 'subject_id': instance.subjectId, 34 | 'name': instance.name, 35 | 'name_cn': instance.nameCn, 36 | 'description': instance.description, 37 | 'ep_group': _$EpisodeGroupEnumMap[instance.group], 38 | 'update_time': instance.updateTime, 39 | }; 40 | 41 | const _$EpisodeGroupEnumMap = { 42 | EpisodeGroup.MAIN: 'MAIN', 43 | EpisodeGroup.PROMOTION_VIDEO: 'PROMOTION_VIDEO', 44 | EpisodeGroup.OPENING_SONG: 'OPENING_SONG', 45 | EpisodeGroup.ENDING_SONG: 'ENDING_SONG', 46 | EpisodeGroup.SPECIAL_PROMOTION: 'SPECIAL_PROMOTION', 47 | EpisodeGroup.SMALL_THEATER: 'SMALL_THEATER', 48 | EpisodeGroup.LIVE: 'LIVE', 49 | EpisodeGroup.COMMERCIAL_MESSAGE: 'COMMERCIAL_MESSAGE', 50 | EpisodeGroup.ORIGINAL_SOUND_TRACK: 'ORIGINAL_SOUND_TRACK', 51 | EpisodeGroup.ORIGINAL_VIDEO_ANIMATION: 'ORIGINAL_VIDEO_ANIMATION', 52 | EpisodeGroup.ORIGINAL_ANIMATION_DISC: 'ORIGINAL_ANIMATION_DISC', 53 | EpisodeGroup.MUSIC_DIST1: 'MUSIC_DIST1', 54 | EpisodeGroup.MUSIC_DIST2: 'MUSIC_DIST2', 55 | EpisodeGroup.MUSIC_DIST3: 'MUSIC_DIST3', 56 | EpisodeGroup.MUSIC_DIST4: 'MUSIC_DIST4', 57 | EpisodeGroup.MUSIC_DIST5: 'MUSIC_DIST5', 58 | EpisodeGroup.OTHER: 'OTHER', 59 | }; 60 | -------------------------------------------------------------------------------- /lib/api/collection/model/SubjectCollection.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:ikaros/api/collection/enums/CollectionType.dart'; 3 | import 'package:ikaros/api/subject/enums/SubjectType.dart'; 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'SubjectCollection.g.dart'; 7 | 8 | @JsonSerializable() 9 | class SubjectCollection { 10 | final int id; 11 | @JsonKey(name: "user_id") 12 | final int userId; 13 | @JsonKey(name: "subject_id") 14 | final int subjectId; 15 | final CollectionType type; 16 | 17 | /// User main group episode watching progress. 18 | @JsonKey(name: "main_ep_progress") 19 | final int? mainEpisodeProgress; 20 | 21 | /// Whether it can be accessed without login. 22 | @JsonKey(name: "is_private") 23 | final bool isPrivate; 24 | 25 | @JsonKey(name: "subject_type") 26 | final SubjectType? subjectType; 27 | final String name; 28 | @JsonKey(name: "name_cn") 29 | final String? nameCn; 30 | final String? infobox; 31 | final String? summary; 32 | /// Not Safe/Suitable For Work. 33 | final bool nsfw; 34 | final String cover; 35 | 36 | SubjectCollection({required this.id, required this.userId, required this.subjectId, 37 | required this.type, this.mainEpisodeProgress, required this.isPrivate, this.subjectType, 38 | required this.name, this.nameCn, this.infobox, this.summary, required this.nsfw, required this.cover}); 39 | 40 | 41 | factory SubjectCollection.fromJson(Map json) => _$SubjectCollectionFromJson(json); 42 | 43 | Map toJson() => _$SubjectCollectionToJson(this); 44 | 45 | } -------------------------------------------------------------------------------- /lib/api/collection/model/SubjectCollection.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectCollection.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectCollection _$SubjectCollectionFromJson(Map json) => 10 | SubjectCollection( 11 | id: (json['id'] as num).toInt(), 12 | userId: (json['user_id'] as num).toInt(), 13 | subjectId: (json['subject_id'] as num).toInt(), 14 | type: $enumDecode(_$CollectionTypeEnumMap, json['type']), 15 | mainEpisodeProgress: (json['main_ep_progress'] as num?)?.toInt(), 16 | isPrivate: json['is_private'] as bool, 17 | subjectType: 18 | $enumDecodeNullable(_$SubjectTypeEnumMap, json['subject_type']), 19 | name: json['name'] as String, 20 | nameCn: json['name_cn'] as String?, 21 | infobox: json['infobox'] as String?, 22 | summary: json['summary'] as String?, 23 | nsfw: json['nsfw'] as bool, 24 | cover: json['cover'] as String, 25 | ); 26 | 27 | Map _$SubjectCollectionToJson(SubjectCollection instance) => 28 | { 29 | 'id': instance.id, 30 | 'user_id': instance.userId, 31 | 'subject_id': instance.subjectId, 32 | 'type': _$CollectionTypeEnumMap[instance.type]!, 33 | 'main_ep_progress': instance.mainEpisodeProgress, 34 | 'is_private': instance.isPrivate, 35 | 'subject_type': _$SubjectTypeEnumMap[instance.subjectType], 36 | 'name': instance.name, 37 | 'name_cn': instance.nameCn, 38 | 'infobox': instance.infobox, 39 | 'summary': instance.summary, 40 | 'nsfw': instance.nsfw, 41 | 'cover': instance.cover, 42 | }; 43 | 44 | const _$CollectionTypeEnumMap = { 45 | CollectionType.WISH: 'WISH', 46 | CollectionType.DOING: 'DOING', 47 | CollectionType.DONE: 'DONE', 48 | CollectionType.SHELVE: 'SHELVE', 49 | CollectionType.DISCARD: 'DISCARD', 50 | }; 51 | 52 | const _$SubjectTypeEnumMap = { 53 | SubjectType.ANIME: 'ANIME', 54 | SubjectType.COMIC: 'COMIC', 55 | SubjectType.GAME: 'GAME', 56 | SubjectType.MUSIC: 'MUSIC', 57 | SubjectType.NOVEL: 'NOVEL', 58 | SubjectType.REAL: 'REAL', 59 | SubjectType.OTHER: 'OTHER', 60 | }; 61 | -------------------------------------------------------------------------------- /lib/api/common/PagingWrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'PagingWrap.g.dart'; 4 | 5 | @JsonSerializable() 6 | class PagingWrap { 7 | final int page; 8 | final int size; 9 | final int total; 10 | final List> items; 11 | 12 | PagingWrap({required this.page, required this.size, required this.total, required this.items}); 13 | 14 | /// Connect the generated [_$PagingWrapToJson] function to the `fromJson` 15 | /// factory. 16 | factory PagingWrap.fromJson(Map json) => _$PagingWrapFromJson(json); 17 | 18 | /// Connect the generated [_$PagingWrapToJson] function to the `toJson` method. 19 | Map toJson() => _$PagingWrapToJson(this); 20 | } -------------------------------------------------------------------------------- /lib/api/common/PagingWrap.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'PagingWrap.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | PagingWrap _$PagingWrapFromJson(Map json) => PagingWrap( 10 | page: (json['page'] as num).toInt(), 11 | size: (json['size'] as num).toInt(), 12 | total: (json['total'] as num).toInt(), 13 | items: (json['items'] as List) 14 | .map((e) => e as Map) 15 | .toList(), 16 | ); 17 | 18 | Map _$PagingWrapToJson(PagingWrap instance) => 19 | { 20 | 'page': instance.page, 21 | 'size': instance.size, 22 | 'total': instance.total, 23 | 'items': instance.items, 24 | }; 25 | -------------------------------------------------------------------------------- /lib/api/dandanplay/DandanplayCommentApi.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:package_info_plus/package_info_plus.dart'; 6 | 7 | import 'model/CommentEpisodeIdResponse.dart'; 8 | 9 | class DandanplayCommentApi { 10 | /// chConvert 中文简繁转换。0-不转换,1-转换为简体,2-转换为繁体。 11 | Future commentEpisodeId( 12 | int episodeId, int chConvert) async { 13 | String apiUrl = "https://danmuku.ikaros.run/api/dandanplay/comment/$episodeId"; 14 | try { 15 | final queryParams = { 16 | 'chConvert': chConvert, 17 | }; 18 | 19 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 20 | BaseOptions options = BaseOptions(); 21 | options.headers.putIfAbsent("User-Agent", () => "ikaros/${Platform.operatingSystem} ${packageInfo.version}"); 22 | 23 | // print("queryParams: $queryParams"); 24 | var response = await Dio(options).get(apiUrl, queryParameters: queryParams); 25 | if (kDebugMode || kProfileMode) { 26 | print("request comment episodeId with url:$apiUrl params:$queryParams"); 27 | } 28 | if (response.statusCode != 200) { 29 | return null; 30 | } 31 | 32 | return CommentEpisodeIdResponse.fromJson(response.data); 33 | } catch (e) { 34 | print(e); 35 | return null; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/DandanplaySearchApi.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:package_info_plus/package_info_plus.dart'; 6 | 7 | import 'model/IkarosDanmukuEpisodesResponse.dart'; 8 | 9 | class DandanplaySearchApi { 10 | Future searchEpisodes( 11 | String anime, String episode) async { 12 | String apiUrl = "https://danmuku.ikaros.run/api/dandanplay/search/episodes"; 13 | try { 14 | final queryParams = { 15 | 'anime': anime, 16 | }; 17 | 18 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 19 | BaseOptions options = BaseOptions(); 20 | options.headers.putIfAbsent("User-Agent", () => "ikaros/${Platform.operatingSystem} ${packageInfo.version}"); 21 | 22 | // print("queryParams: $queryParams"); 23 | var response = await Dio(options).get(apiUrl, queryParameters: queryParams); 24 | if (kDebugMode || kProfileMode) { 25 | print("request search episodes with url:$apiUrl params:$queryParams resp:$response"); 26 | } 27 | // print("response status code: ${response.statusCode}"); 28 | if (response.statusCode != 200) { 29 | return null; 30 | } 31 | 32 | return IkarosDanmukuEpisodesResponse.fromJson(response.data); 33 | } catch (e) { 34 | print(e); 35 | return null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/api/dandanplay/enums/SearchEpisodesAnimeType.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | /// 作品类型 5 | enum SearchEpisodesAnimeType { 6 | @JsonValue("tvseries") 7 | tvseries, 8 | @JsonValue("tvspecial") 9 | tvspecial, 10 | @JsonValue("ova") 11 | ova, 12 | @JsonValue("movie") 13 | movie, 14 | @JsonValue("musicvideo") 15 | musicvideo, 16 | @JsonValue("web") 17 | web, 18 | @JsonValue("other") 19 | other, 20 | @JsonValue("jpmovie") 21 | jpmovie, 22 | @JsonValue("jpdrama") 23 | jpdrama, 24 | @JsonValue("unknown") 25 | unknown; 26 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/CommentEpisode.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'CommentEpisode.g.dart'; 5 | 6 | @JsonSerializable() 7 | class CommentEpisode { 8 | /// episodeId 9 | final int cid; 10 | /// p参数格式为出现时间,模式,颜色,用户ID,各个参数之间使用英文逗号分隔 11 | // 12 | // 弹幕出现时间:格式为 0.00,单位为秒,精确到小数点后两位,例如12.34、445.6、789.01 13 | // 弹幕模式:1-普通弹幕,4-底部弹幕,5-顶部弹幕 14 | // 颜色:32位整数表示的颜色,算法为 Rx256x256+Gx256+B,R/G/B的范围应是0-255 15 | // 用户ID:字符串形式表示的用户ID,通常为数字,不会包含特殊字符 16 | final String p; 17 | /// 弹幕文本 18 | final String m; 19 | 20 | CommentEpisode({required this.cid, required this.p, required this.m}); 21 | 22 | factory CommentEpisode.fromJson(Map json) => 23 | _$CommentEpisodeFromJson(json); 24 | 25 | Map toJson() => _$CommentEpisodeToJson(this); 26 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/CommentEpisode.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'CommentEpisode.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | CommentEpisode _$CommentEpisodeFromJson(Map json) => 10 | CommentEpisode( 11 | cid: (json['cid'] as num).toInt(), 12 | p: json['p'] as String, 13 | m: json['m'] as String, 14 | ); 15 | 16 | Map _$CommentEpisodeToJson(CommentEpisode instance) => 17 | { 18 | 'cid': instance.cid, 19 | 'p': instance.p, 20 | 'm': instance.m, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/CommentEpisodeIdResponse.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | import 'CommentEpisode.dart'; 5 | 6 | part 'CommentEpisodeIdResponse.g.dart'; 7 | 8 | @JsonSerializable() 9 | class CommentEpisodeIdResponse { 10 | final int count; 11 | final List comments; 12 | 13 | CommentEpisodeIdResponse({required this.count, required this.comments}); 14 | 15 | factory CommentEpisodeIdResponse.fromJson(Map json) => 16 | _$CommentEpisodeIdResponseFromJson(json); 17 | 18 | Map toJson() => _$CommentEpisodeIdResponseToJson(this); 19 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/CommentEpisodeIdResponse.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'CommentEpisodeIdResponse.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | CommentEpisodeIdResponse _$CommentEpisodeIdResponseFromJson( 10 | Map json) => 11 | CommentEpisodeIdResponse( 12 | count: (json['count'] as num).toInt(), 13 | comments: (json['comments'] as List) 14 | .map((e) => CommentEpisode.fromJson(e as Map)) 15 | .toList(), 16 | ); 17 | 18 | Map _$CommentEpisodeIdResponseToJson( 19 | CommentEpisodeIdResponse instance) => 20 | { 21 | 'count': instance.count, 22 | 'comments': instance.comments, 23 | }; 24 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/IkarosDanmukuEpisodesResponse.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | import 'SearchEpisodesAnime.dart'; 5 | 6 | part 'IkarosDanmukuEpisodesResponse.g.dart'; 7 | 8 | @JsonSerializable() 9 | class IkarosDanmukuEpisodesResponse { 10 | /// 搜索结果(作品信息)列表 11 | final List animes; 12 | 13 | IkarosDanmukuEpisodesResponse({required this.animes}); 14 | 15 | 16 | 17 | factory IkarosDanmukuEpisodesResponse.fromJson(Map json) => 18 | _$IkarosDanmukuEpisodesResponseFromJson(json); 19 | 20 | Map toJson() => _$IkarosDanmukuEpisodesResponseToJson(this); 21 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/IkarosDanmukuEpisodesResponse.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'IkarosDanmukuEpisodesResponse.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | IkarosDanmukuEpisodesResponse _$IkarosDanmukuEpisodesResponseFromJson( 10 | Map json) => 11 | IkarosDanmukuEpisodesResponse( 12 | animes: (json['animes'] as List) 13 | .map((e) => SearchEpisodesAnime.fromJson(e as Map)) 14 | .toList(), 15 | ); 16 | 17 | Map _$IkarosDanmukuEpisodesResponseToJson( 18 | IkarosDanmukuEpisodesResponse instance) => 19 | { 20 | 'animes': instance.animes, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodeDetails.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'SearchEpisodeDetails.g.dart'; 6 | 7 | @JsonSerializable() 8 | class SearchEpisodeDetails { 9 | /// 剧集ID(弹幕库编号) 10 | final int episodeId; 11 | /// 剧集标题 12 | final String? episodeTitle; 13 | 14 | SearchEpisodeDetails({required this.episodeId, this.episodeTitle}); 15 | 16 | 17 | factory SearchEpisodeDetails.fromJson(Map json) => 18 | _$SearchEpisodeDetailsFromJson(json); 19 | 20 | Map toJson() => _$SearchEpisodeDetailsToJson(this); 21 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodeDetails.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SearchEpisodeDetails.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchEpisodeDetails _$SearchEpisodeDetailsFromJson( 10 | Map json) => 11 | SearchEpisodeDetails( 12 | episodeId: (json['episodeId'] as num).toInt(), 13 | episodeTitle: json['episodeTitle'] as String?, 14 | ); 15 | 16 | Map _$SearchEpisodeDetailsToJson( 17 | SearchEpisodeDetails instance) => 18 | { 19 | 'episodeId': instance.episodeId, 20 | 'episodeTitle': instance.episodeTitle, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodesAnime.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:ikaros/api/dandanplay/enums/SearchEpisodesAnimeType.dart'; 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | import 'SearchEpisodeDetails.dart'; 6 | 7 | part 'SearchEpisodesAnime.g.dart'; 8 | 9 | @JsonSerializable() 10 | class SearchEpisodesAnime { 11 | /// 作品编号 12 | final int animeId; 13 | /// 作品标题 14 | final String? animeTitle; 15 | /// 作品类型 16 | final SearchEpisodesAnimeType type; 17 | /// 类型描述 18 | final String? typeDescription; 19 | /// 此作品的剧集列表 20 | final List episodes; 21 | 22 | SearchEpisodesAnime({required this.animeId, required this.animeTitle, required this.type, required this.typeDescription, required this.episodes}); 23 | 24 | 25 | factory SearchEpisodesAnime.fromJson(Map json) => 26 | _$SearchEpisodesAnimeFromJson(json); 27 | 28 | Map toJson() => _$SearchEpisodesAnimeToJson(this); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodesAnime.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SearchEpisodesAnime.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchEpisodesAnime _$SearchEpisodesAnimeFromJson(Map json) => 10 | SearchEpisodesAnime( 11 | animeId: (json['animeId'] as num).toInt(), 12 | animeTitle: json['animeTitle'] as String?, 13 | type: $enumDecode(_$SearchEpisodesAnimeTypeEnumMap, json['type']), 14 | typeDescription: json['typeDescription'] as String?, 15 | episodes: (json['episodes'] as List) 16 | .map((e) => SearchEpisodeDetails.fromJson(e as Map)) 17 | .toList(), 18 | ); 19 | 20 | Map _$SearchEpisodesAnimeToJson( 21 | SearchEpisodesAnime instance) => 22 | { 23 | 'animeId': instance.animeId, 24 | 'animeTitle': instance.animeTitle, 25 | 'type': _$SearchEpisodesAnimeTypeEnumMap[instance.type]!, 26 | 'typeDescription': instance.typeDescription, 27 | 'episodes': instance.episodes, 28 | }; 29 | 30 | const _$SearchEpisodesAnimeTypeEnumMap = { 31 | SearchEpisodesAnimeType.tvseries: 'tvseries', 32 | SearchEpisodesAnimeType.tvspecial: 'tvspecial', 33 | SearchEpisodesAnimeType.ova: 'ova', 34 | SearchEpisodesAnimeType.movie: 'movie', 35 | SearchEpisodesAnimeType.musicvideo: 'musicvideo', 36 | SearchEpisodesAnimeType.web: 'web', 37 | SearchEpisodesAnimeType.other: 'other', 38 | SearchEpisodesAnimeType.jpmovie: 'jpmovie', 39 | SearchEpisodesAnimeType.jpdrama: 'jpdrama', 40 | SearchEpisodesAnimeType.unknown: 'unknown', 41 | }; 42 | -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodesResponse.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | import 'SearchEpisodesAnime.dart'; 5 | 6 | part 'SearchEpisodesResponse.g.dart'; 7 | 8 | @JsonSerializable() 9 | class SearchEpisodesResponse { 10 | /// 是否有更多未显示的搜索结果。当返回的搜索结果过多时此值为true , 11 | final bool hasMore; 12 | /// 搜索结果(作品信息)列表 13 | final List animes; 14 | /// 错误代码,0表示没有发生错误,非0表示有错误,详细信息会包含在errorMessage属性中 15 | final int errorCode; 16 | /// 接口是否调用成功 17 | final bool success; 18 | /// 当发生错误时,说明错误具体原因 19 | final String? errorMessage; 20 | 21 | SearchEpisodesResponse({required this.hasMore, required this.animes, required this.errorCode, required this.success, required this.errorMessage}); 22 | 23 | 24 | 25 | factory SearchEpisodesResponse.fromJson(Map json) => 26 | _$SearchEpisodesResponseFromJson(json); 27 | 28 | Map toJson() => _$SearchEpisodesResponseToJson(this); 29 | } -------------------------------------------------------------------------------- /lib/api/dandanplay/model/SearchEpisodesResponse.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SearchEpisodesResponse.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchEpisodesResponse _$SearchEpisodesResponseFromJson( 10 | Map json) => 11 | SearchEpisodesResponse( 12 | hasMore: json['hasMore'] as bool, 13 | animes: (json['animes'] as List) 14 | .map((e) => SearchEpisodesAnime.fromJson(e as Map)) 15 | .toList(), 16 | errorCode: (json['errorCode'] as num).toInt(), 17 | success: json['success'] as bool, 18 | errorMessage: json['errorMessage'] as String?, 19 | ); 20 | 21 | Map _$SearchEpisodesResponseToJson( 22 | SearchEpisodesResponse instance) => 23 | { 24 | 'hasMore': instance.hasMore, 25 | 'animes': instance.animes, 26 | 'errorCode': instance.errorCode, 27 | 'success': instance.success, 28 | 'errorMessage': instance.errorMessage, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/api/dio_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:ikaros/api/dio_interceptors.dart'; 3 | 4 | import 'auth/AuthApi.dart'; 5 | import 'auth/AuthParams.dart'; 6 | 7 | class DioClient { 8 | static BaseOptions _options = BaseOptions(); 9 | static bool _isInitialized = false; 10 | static Dio _dio = Dio(); 11 | 12 | static Future getDio() async { 13 | if (!_isInitialized) { 14 | await rebuild(); 15 | _isInitialized = true; 16 | } 17 | return _dio; 18 | } 19 | 20 | static Future rebuild({String baseUrl = ""}) async { 21 | if (baseUrl != "") { 22 | _options = BaseOptions(baseUrl: baseUrl); 23 | } else { 24 | AuthParams? authParams = await AuthApi().getAuthParams(); 25 | _options = BaseOptions(baseUrl: authParams?.baseUrl ?? ""); 26 | } 27 | _options.connectTimeout = const Duration(milliseconds: 5000); 28 | _options.receiveTimeout = const Duration(milliseconds: 5000); 29 | _dio = Dio(_options); 30 | // 添加拦截器 31 | _dio.interceptors.addAll([ 32 | // LogInterceptor(requestBody: true, responseBody: true), // 日志拦截器 33 | AuthInterceptor(), // 认证拦截器 34 | AuthExpireInterceptor(), // Token失效重新刷新拦截器 35 | ]); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /lib/api/dio_interceptors.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:ikaros/api/auth/AuthApi.dart'; 4 | import 'package:ikaros/api/auth/AuthParams.dart'; 5 | 6 | import 'dio_client.dart'; 7 | 8 | class AuthInterceptor extends Interceptor { 9 | @override 10 | void onRequest( 11 | RequestOptions options, RequestInterceptorHandler handler) async { 12 | final token = await getToken(); // 从本地存储获取 Token 13 | if (token != null) { 14 | options.headers['Authorization'] = 'Bearer $token'; 15 | } 16 | super.onRequest(options, handler); 17 | } 18 | 19 | Future getToken() async { 20 | AuthParams? authParams = await AuthApi().getAuthParams(); 21 | if (authParams == null) return ""; 22 | return authParams.token; 23 | } 24 | } 25 | 26 | class AuthExpireInterceptor extends Interceptor { 27 | 28 | @override 29 | void onError(DioException err, ErrorInterceptorHandler handler) async { 30 | debugPrint('Error: ${err.response?.statusCode}'); 31 | if (err.response?.statusCode == 401) { 32 | AuthParams? authParams = await AuthApi().getAuthParams(); 33 | if (authParams == null) { 34 | await AuthApi().logout(); 35 | } else { 36 | try { 37 | String newToken = await AuthApi().refreshToken(authParams.refreshToken); 38 | // 2. 更新请求头 39 | final options = err.requestOptions; 40 | options.headers['Authorization'] = 'Bearer $newToken'; 41 | 42 | // 3. 重新发起请求 43 | final dio = await DioClient.getDio(); 44 | final retryResponse = await dio.request( 45 | options.path, 46 | options: Options( 47 | method: options.method, 48 | headers: options.headers, 49 | ), 50 | data: options.data, 51 | queryParameters: options.queryParameters, 52 | ); 53 | 54 | // 成功则将结果返回 55 | return handler.resolve(retryResponse); 56 | } catch (e) { 57 | // 刷新 Token 或重试失败,抛出错误 58 | await AuthApi().logout(); 59 | return handler.reject(err); 60 | } 61 | } 62 | } 63 | 64 | // 对于其他错误,直接抛出 65 | handler.next(err); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /lib/api/search/IndicesApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:ikaros/api/dio_client.dart'; 4 | import 'package:ikaros/api/search/model/SubjectSearchResult.dart'; 5 | 6 | class IndicesApi { 7 | Future searchSubject(String keyword, int limit) async { 8 | if (limit <= 0) limit = 20; 9 | String apiUrl = "/api/v1alpha1/indices/subject"; 10 | try { 11 | final queryParams = { 12 | 'limit': limit, 13 | 'keyword': keyword, 14 | 'highlightPreTag': "", 15 | 'highlightPostTag': "", 16 | // 在这里添加更多查询参数 17 | }; 18 | 19 | Dio dio = await DioClient.getDio(); 20 | var response = await dio.get(apiUrl, queryParameters: queryParams); 21 | if (response.statusCode != 200) { 22 | return null; 23 | } 24 | return SubjectSearchResult.fromJson(response.data); 25 | } catch (e) { 26 | if (kDebugMode) { 27 | print(e); 28 | } 29 | return null; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/api/search/model/SubjectHint.dart: -------------------------------------------------------------------------------- 1 | import 'package:ikaros/api/subject/enums/SubjectType.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'SubjectHint.g.dart'; 5 | 6 | @JsonSerializable() 7 | class SubjectHint { 8 | final int id; 9 | final String name; 10 | final String? nameCn; 11 | final String? infobox; 12 | final String? summary; 13 | final String? airTime; 14 | final bool nsfw; 15 | final SubjectType type; 16 | 17 | factory SubjectHint.fromJson(Map json) => 18 | _$SubjectHintFromJson(json); 19 | 20 | SubjectHint( 21 | {required this.id, 22 | required this.name, 23 | required this.nameCn, 24 | required this.infobox, 25 | required this.summary, 26 | required this.airTime, 27 | required this.nsfw, 28 | required this.type}); 29 | 30 | Map toJson() => _$SubjectHintToJson(this); 31 | } 32 | -------------------------------------------------------------------------------- /lib/api/search/model/SubjectHint.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectHint.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectHint _$SubjectHintFromJson(Map json) => SubjectHint( 10 | id: (json['id'] as num).toInt(), 11 | name: json['name'] as String, 12 | nameCn: json['nameCn'] as String?, 13 | infobox: json['infobox'] as String?, 14 | summary: json['summary'] as String?, 15 | airTime: json['airTime'] as String?, 16 | nsfw: json['nsfw'] as bool, 17 | type: $enumDecode(_$SubjectTypeEnumMap, json['type']), 18 | ); 19 | 20 | Map _$SubjectHintToJson(SubjectHint instance) => 21 | { 22 | 'id': instance.id, 23 | 'name': instance.name, 24 | 'nameCn': instance.nameCn, 25 | 'infobox': instance.infobox, 26 | 'summary': instance.summary, 27 | 'airTime': instance.airTime, 28 | 'nsfw': instance.nsfw, 29 | 'type': _$SubjectTypeEnumMap[instance.type]!, 30 | }; 31 | 32 | const _$SubjectTypeEnumMap = { 33 | SubjectType.ANIME: 'ANIME', 34 | SubjectType.COMIC: 'COMIC', 35 | SubjectType.GAME: 'GAME', 36 | SubjectType.MUSIC: 'MUSIC', 37 | SubjectType.NOVEL: 'NOVEL', 38 | SubjectType.REAL: 'REAL', 39 | SubjectType.OTHER: 'OTHER', 40 | }; 41 | -------------------------------------------------------------------------------- /lib/api/search/model/SubjectSearchResult.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:ikaros/api/search/model/SubjectHint.dart'; 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'SubjectSearchResult.g.dart'; 6 | 7 | @JsonSerializable() 8 | class SubjectSearchResult { 9 | final List hits; 10 | final String keyword; 11 | final int total; 12 | final int limit; 13 | final double processingTimeMillis; 14 | 15 | SubjectSearchResult({required this.hits, required this.keyword, required this.total, required this.limit, required this.processingTimeMillis}); 16 | 17 | factory SubjectSearchResult.fromJson(Map json) => _$SubjectSearchResultFromJson(json); 18 | 19 | Map toJson() => _$SubjectSearchResultToJson(this); 20 | } -------------------------------------------------------------------------------- /lib/api/search/model/SubjectSearchResult.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectSearchResult.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectSearchResult _$SubjectSearchResultFromJson(Map json) => 10 | SubjectSearchResult( 11 | hits: (json['hits'] as List) 12 | .map((e) => SubjectHint.fromJson(e as Map)) 13 | .toList(), 14 | keyword: json['keyword'] as String, 15 | total: (json['total'] as num).toInt(), 16 | limit: (json['limit'] as num).toInt(), 17 | processingTimeMillis: (json['processingTimeMillis'] as num).toDouble(), 18 | ); 19 | 20 | Map _$SubjectSearchResultToJson( 21 | SubjectSearchResult instance) => 22 | { 23 | 'hits': instance.hits, 24 | 'keyword': instance.keyword, 25 | 'total': instance.total, 26 | 'limit': instance.limit, 27 | 'processingTimeMillis': instance.processingTimeMillis, 28 | }; 29 | -------------------------------------------------------------------------------- /lib/api/subject/EpisodeApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:ikaros/api/dio_client.dart'; 3 | import 'package:ikaros/api/subject/model/EpisodeRecord.dart'; 4 | import 'package:ikaros/api/subject/model/EpisodeResource.dart'; 5 | 6 | import 'model/Episode.dart'; 7 | 8 | class EpisodeApi { 9 | Episode error = Episode(id: -1, subjectId: -1, name: "", sequence: -1); 10 | 11 | Future findById(int id) async { 12 | String apiUrl = "/api/v1alpha1/episode/$id"; 13 | try { 14 | // print("queryParams: $queryParams"); 15 | Dio dio = await DioClient.getDio(); 16 | var response = await dio.get(apiUrl); 17 | // print("response status code: ${response.statusCode}"); 18 | if (response.statusCode != 200) { 19 | return error; 20 | } 21 | return Episode.fromJson(response.data); 22 | } catch (e) { 23 | print(e); 24 | return error; 25 | } 26 | } 27 | 28 | Future> findBySubjectId(int subjectId) async { 29 | String apiUrl = "/api/v1alpha1/episodes/subjectId/$subjectId"; 30 | try { 31 | // print("queryParams: $queryParams"); 32 | Dio dio = await DioClient.getDio(); 33 | Response?> response = await dio.get(apiUrl); 34 | // print("response status code: ${response.statusCode}"); 35 | if (response.statusCode != 200) { 36 | return List.empty(); 37 | } 38 | List episodes = []; 39 | for (var e in response.data ?? List.empty()) { 40 | Episode episode = Episode.fromJson(e); 41 | episodes.add(episode); 42 | } 43 | return episodes; 44 | } catch (e) { 45 | print(e); 46 | return List.empty(); 47 | } 48 | } 49 | 50 | Future> findRecordsBySubjectId(int subjectId) async { 51 | String apiUrl = "/api/v1alpha1/episode/records/subjectId/$subjectId"; 52 | try { 53 | // print("queryParams: $queryParams"); 54 | Dio dio = await DioClient.getDio(); 55 | Response?> response = await dio.get(apiUrl); 56 | // print("response status code: ${response.statusCode}"); 57 | if (response.statusCode != 200) { 58 | return List.empty(); 59 | } 60 | List records = []; 61 | for (var e in response.data ?? List.empty()) { 62 | EpisodeRecord record = EpisodeRecord.fromJson(e); 63 | records.add(record); 64 | } 65 | return records; 66 | } catch (e) { 67 | print(e); 68 | return List.empty(); 69 | } 70 | } 71 | 72 | Future> getEpisodeResourcesRefs(int id) async { 73 | String apiUrl = "/api/v1alpha1/episode/attachment/refs/$id"; 74 | try { 75 | // print("queryParams: $queryParams"); 76 | Dio dio = await DioClient.getDio(); 77 | Response?> response = await dio.get(apiUrl); 78 | // print("response status code: ${response.statusCode}"); 79 | if (response.statusCode != 200) { 80 | return List.empty(); 81 | } 82 | List resources = []; 83 | for (var e in response.data ?? List.empty()) { 84 | EpisodeResource resource = EpisodeResource.fromJson(e); 85 | resources.add(resource); 86 | } 87 | return resources; 88 | } catch (e) { 89 | print(e); 90 | return List.empty(); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/api/subject/SubjectApi.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:ikaros/api/common/PagingWrap.dart'; 6 | import 'package:ikaros/api/dio_client.dart'; 7 | 8 | import 'model/Subject.dart'; 9 | 10 | class SubjectApi { 11 | Future listSubjectsByCondition( 12 | int page, int size, String name, String nameCn, bool? nsfw, String? type, 13 | {String? time, bool? airTimeDesc, bool? updateTimeDesc}) async { 14 | String apiUrl = "/api/v1alpha1/subjects/condition"; 15 | try { 16 | final Map queryParams = { 17 | 'page': page.toString(), 18 | 'size': size.toString(), 19 | 'name': base64Encode(utf8.encode(name)), 20 | 'nameCn': base64Encode(utf8.encode(nameCn)), 21 | 'nsfw': nsfw, 22 | // 在这里添加更多查询参数 23 | }; 24 | if (type != null && type != "") { 25 | queryParams.putIfAbsent("type", () => type); 26 | } 27 | if (time != null && time != "") { 28 | queryParams.putIfAbsent("time", () => time); 29 | } 30 | if (airTimeDesc != null) { 31 | queryParams.putIfAbsent("airTimeDesc", () => airTimeDesc); 32 | } 33 | if (updateTimeDesc != null) { 34 | queryParams.putIfAbsent("updateTimeDesc", () => updateTimeDesc); 35 | } 36 | 37 | debugPrint("queryParams: $queryParams"); 38 | Dio dio = await DioClient.getDio(); 39 | var response = await dio.get(apiUrl, queryParameters: queryParams); 40 | // print("response status code: ${response.statusCode}"); 41 | if (response.statusCode != 200) { 42 | return PagingWrap( 43 | page: page, size: size, total: 0, items: List.empty()); 44 | } 45 | return PagingWrap.fromJson(response.data); 46 | } catch (e) { 47 | print(e); 48 | return PagingWrap(page: page, size: size, total: 0, items: List.empty()); 49 | } 50 | } 51 | 52 | Future findById(int id) async { 53 | String apiUrl = "/api/v1alpha1/subject/$id"; 54 | try { 55 | // print("queryParams: $queryParams"); 56 | Dio dio = await DioClient.getDio(); 57 | var response = await dio.get(apiUrl); 58 | // print("response status code: ${response.statusCode}"); 59 | if (response.statusCode != 200) { 60 | return null; 61 | } 62 | return Subject.fromJson(response.data); 63 | } catch (e) { 64 | print(e); 65 | return null; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/api/subject/SubjectRelationApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:ikaros/api/dio_client.dart'; 3 | import 'package:ikaros/api/subject/model/SubjectRelation.dart'; 4 | 5 | class SubjectRelationApi { 6 | Future> findById(int id) async { 7 | String apiUrl = "/api/v1alpha1/subject/relations/$id"; 8 | try { 9 | // print("queryParams: $queryParams"); 10 | Dio dio = await DioClient.getDio(); 11 | var response = await dio.get(apiUrl); 12 | // print("response status code: ${response.statusCode}"); 13 | if (response.statusCode != 200) { 14 | return []; 15 | } 16 | List data = response.data; 17 | List results = 18 | data.map((json) => SubjectRelation.fromJson(json)).toList(); 19 | return results; 20 | } catch (e) { 21 | print(e); 22 | return []; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/api/subject/SubjectSyncApi.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:dio/dio.dart'; 3 | import 'package:ikaros/api/dio_client.dart'; 4 | import 'package:ikaros/api/subject/model/SubjectSync.dart'; 5 | 6 | 7 | class SubjectSyncApi { 8 | Future> getSyncsBySubjectId(int subjectId) async { 9 | String apiUrl = "/api/v1alpha1/subject/syncs/subjectId/$subjectId"; 10 | try { 11 | 12 | // print("queryParams: $queryParams"); 13 | Dio dio = await DioClient.getDio(); 14 | Response?> response = await dio.get(apiUrl); 15 | // print("response status code: ${response.statusCode}"); 16 | if (response.statusCode != 200) { 17 | return List.empty(); 18 | } 19 | List syncs = []; 20 | for (var e in response.data??List.empty()) { 21 | syncs.add(SubjectSync.fromJson(e)); 22 | } 23 | return syncs; 24 | } catch (e) { 25 | print(e); 26 | return List.empty(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/api/subject/enums/CollectionType.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum CollectionType { 4 | /// Not collection. 5 | @JsonValue("NOT") 6 | NOT, 7 | /// Wist watch. 8 | @JsonValue("WISH") 9 | WISH, 10 | /// Watching. 11 | @JsonValue("DOING") 12 | DOING, 13 | /// Watch done. 14 | @JsonValue("DONE") 15 | DONE, 16 | /// No time to watch it. 17 | @JsonValue("SHELVE") 18 | SHELVE, 19 | /// Discard it. 20 | @JsonValue("DISCARD") 21 | DISCARD; 22 | } -------------------------------------------------------------------------------- /lib/api/subject/enums/EpisodeGroup.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum EpisodeGroup { 4 | @JsonValue("MAIN") 5 | MAIN, 6 | @JsonValue("PROMOTION_VIDEO") 7 | PROMOTION_VIDEO, 8 | @JsonValue("OPENING_SONG") 9 | OPENING_SONG, 10 | @JsonValue("ENDING_SONG") 11 | ENDING_SONG, 12 | @JsonValue("SPECIAL_PROMOTION") 13 | SPECIAL_PROMOTION, 14 | @JsonValue("SMALL_THEATER") 15 | SMALL_THEATER, 16 | @JsonValue("LIVE") 17 | LIVE, 18 | @JsonValue("COMMERCIAL_MESSAGE") 19 | COMMERCIAL_MESSAGE, 20 | @JsonValue("ORIGINAL_SOUND_TRACK") 21 | ORIGINAL_SOUND_TRACK, 22 | @JsonValue("ORIGINAL_VIDEO_ANIMATION") 23 | ORIGINAL_VIDEO_ANIMATION, 24 | @JsonValue("ORIGINAL_ANIMATION_DISC") 25 | ORIGINAL_ANIMATION_DISC, 26 | @JsonValue("MUSIC_DIST1") 27 | MUSIC_DIST1, 28 | @JsonValue("MUSIC_DIST2") 29 | MUSIC_DIST2, 30 | @JsonValue("MUSIC_DIST3") 31 | MUSIC_DIST3, 32 | @JsonValue("MUSIC_DIST4") 33 | MUSIC_DIST4, 34 | @JsonValue("MUSIC_DIST5") 35 | MUSIC_DIST5, 36 | @JsonValue("OTHER") 37 | OTHER; 38 | 39 | } -------------------------------------------------------------------------------- /lib/api/subject/enums/SubjectRelationType.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum SubjectRelationType { 4 | @JsonValue("ANIME") 5 | ANIME, 6 | @JsonValue("COMIC") 7 | COMIC, 8 | @JsonValue("GAME") 9 | GAME, 10 | @JsonValue("MUSIC") 11 | MUSIC, 12 | @JsonValue("NOVEL") 13 | NOVEL, 14 | @JsonValue("REAL") 15 | REAL, 16 | @JsonValue("BEFORE") 17 | BEFORE, 18 | @JsonValue("AFTER") 19 | AFTER, 20 | @JsonValue("SAME_WORLDVIEW") 21 | SAME_WORLDVIEW, 22 | @JsonValue("ORIGINAL_SOUND_TRACK") 23 | ORIGINAL_SOUND_TRACK, 24 | @JsonValue("ORIGINAL_VIDEO_ANIMATION") 25 | ORIGINAL_VIDEO_ANIMATION, 26 | @JsonValue("ORIGINAL_ANIMATION_DISC") 27 | ORIGINAL_ANIMATION_DISC, 28 | @JsonValue("OTHER") 29 | OTHER; 30 | 31 | } -------------------------------------------------------------------------------- /lib/api/subject/enums/SubjectSyncPlatform.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum SubjectSyncPlatform { 4 | /// Bangumi 番组计划. 5 | @JsonValue("BGM_TV") 6 | BGM_TV, 7 | /// The Move Database(TMDb).. 8 | @JsonValue("TMDB") 9 | TMDB, 10 | /// AniDB. 11 | @JsonValue("AniDB") 12 | AniDB, 13 | /// 14 | /// tvdb. 15 | @JsonValue("TVDB") 16 | TVDB, 17 | /// The Visual Novel Database. 18 | @JsonValue("VNDB") 19 | VNDB, 20 | 21 | /// 豆瓣. 22 | @JsonValue("DOU_BAN") 23 | DOU_BAN, 24 | /// other platform. 25 | @JsonValue("OTHER") 26 | OTHER; 27 | } -------------------------------------------------------------------------------- /lib/api/subject/enums/SubjectType.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | enum SubjectType { 4 | @JsonValue("ANIME") 5 | ANIME, 6 | @JsonValue("COMIC") 7 | COMIC, 8 | @JsonValue("GAME") 9 | GAME, 10 | @JsonValue("MUSIC") 11 | MUSIC, 12 | @JsonValue("NOVEL") 13 | NOVEL, 14 | @JsonValue("REAL") 15 | REAL, 16 | @JsonValue("OTHER") 17 | OTHER; 18 | } -------------------------------------------------------------------------------- /lib/api/subject/model/Episode.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | 4 | part 'Episode.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Episode { 8 | final int id; 9 | @JsonKey(name: "subject_id") 10 | final int subjectId; 11 | final String name; 12 | @JsonKey(name: "name_cn") 13 | final String? nameCn; 14 | final String? description; 15 | final double sequence; 16 | final String? group; 17 | 18 | Episode({ 19 | required this.id, required this.subjectId, required this.name, 20 | this.nameCn, this.description, required this.sequence, this.group 21 | }); 22 | 23 | factory Episode.fromJson(Map json) => _$EpisodeFromJson(json); 24 | 25 | Map toJson() => _$EpisodeToJson(this); 26 | } -------------------------------------------------------------------------------- /lib/api/subject/model/Episode.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'Episode.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Episode _$EpisodeFromJson(Map json) => Episode( 10 | id: (json['id'] as num).toInt(), 11 | subjectId: (json['subject_id'] as num).toInt(), 12 | name: json['name'] as String, 13 | nameCn: json['name_cn'] as String?, 14 | description: json['description'] as String?, 15 | sequence: (json['sequence'] as num).toDouble(), 16 | group: json['group'] as String?, 17 | ); 18 | 19 | Map _$EpisodeToJson(Episode instance) => { 20 | 'id': instance.id, 21 | 'subject_id': instance.subjectId, 22 | 'name': instance.name, 23 | 'name_cn': instance.nameCn, 24 | 'description': instance.description, 25 | 'sequence': instance.sequence, 26 | 'group': instance.group, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/api/subject/model/EpisodeRecord.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | import 'Episode.dart'; 4 | import 'EpisodeResource.dart'; 5 | 6 | part 'EpisodeRecord.g.dart'; 7 | 8 | @JsonSerializable() 9 | class EpisodeRecord { 10 | final Episode episode; 11 | final List resources; 12 | 13 | EpisodeRecord({ 14 | required this.episode, required this.resources 15 | }); 16 | 17 | factory EpisodeRecord.fromJson(Map json) => _$EpisodeRecordFromJson(json); 18 | 19 | Map toJson() => _$EpisodeRecordToJson(this); 20 | } -------------------------------------------------------------------------------- /lib/api/subject/model/EpisodeRecord.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'EpisodeRecord.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | EpisodeRecord _$EpisodeRecordFromJson(Map json) => 10 | EpisodeRecord( 11 | episode: Episode.fromJson(json['episode'] as Map), 12 | resources: (json['resources'] as List) 13 | .map((e) => EpisodeResource.fromJson(e as Map)) 14 | .toList(), 15 | ); 16 | 17 | Map _$EpisodeRecordToJson(EpisodeRecord instance) => 18 | { 19 | 'episode': instance.episode, 20 | 'resources': instance.resources, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/api/subject/model/EpisodeResource.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'EpisodeResource.g.dart'; 4 | 5 | @JsonSerializable() 6 | class EpisodeResource { 7 | final int attachmentId; 8 | final int parentAttachmentId; 9 | final int episodeId; 10 | final String url; 11 | final bool? canRead; 12 | final String name; 13 | final Set? tags; 14 | 15 | EpisodeResource( 16 | {required this.attachmentId, 17 | required this.parentAttachmentId, 18 | required this.episodeId, 19 | required this.url, 20 | this.canRead, 21 | required this.name, 22 | this.tags}); 23 | 24 | factory EpisodeResource.fromJson(Map json) => 25 | _$EpisodeResourceFromJson(json); 26 | 27 | Map toJson() => _$EpisodeResourceToJson(this); 28 | } 29 | -------------------------------------------------------------------------------- /lib/api/subject/model/EpisodeResource.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'EpisodeResource.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | EpisodeResource _$EpisodeResourceFromJson(Map json) => 10 | EpisodeResource( 11 | attachmentId: (json['attachmentId'] as num).toInt(), 12 | parentAttachmentId: (json['parentAttachmentId'] as num).toInt(), 13 | episodeId: (json['episodeId'] as num).toInt(), 14 | url: json['url'] as String, 15 | canRead: json['canRead'] as bool?, 16 | name: json['name'] as String, 17 | tags: (json['tags'] as List?)?.map((e) => e as String).toSet(), 18 | ); 19 | 20 | Map _$EpisodeResourceToJson(EpisodeResource instance) => 21 | { 22 | 'attachmentId': instance.attachmentId, 23 | 'parentAttachmentId': instance.parentAttachmentId, 24 | 'episodeId': instance.episodeId, 25 | 'url': instance.url, 26 | 'canRead': instance.canRead, 27 | 'name': instance.name, 28 | 'tags': instance.tags?.toList(), 29 | }; 30 | -------------------------------------------------------------------------------- /lib/api/subject/model/Subject.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | import '../enums/SubjectType.dart'; 6 | 7 | part 'Subject.g.dart'; 8 | 9 | @JsonSerializable() 10 | class Subject { 11 | final int id; 12 | final SubjectType type; 13 | final String name; 14 | @JsonKey(name: "name_cn") 15 | final String? nameCn; 16 | final String? infobox; 17 | final String? summary; 18 | final bool nsfw; 19 | final String cover; 20 | final String? airTime; 21 | 22 | factory Subject.fromJson(Map json) => 23 | _$SubjectFromJson(json); 24 | 25 | Subject( 26 | {required this.id, 27 | required this.type, 28 | required this.name, 29 | required this.nameCn, 30 | required this.infobox, 31 | required this.summary, 32 | required this.nsfw, 33 | required this.cover, 34 | required this.airTime}); 35 | 36 | Map toJson() => _$SubjectToJson(this); 37 | } 38 | -------------------------------------------------------------------------------- /lib/api/subject/model/Subject.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'Subject.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Subject _$SubjectFromJson(Map json) => Subject( 10 | id: (json['id'] as num).toInt(), 11 | type: $enumDecode(_$SubjectTypeEnumMap, json['type']), 12 | name: json['name'] as String, 13 | nameCn: json['name_cn'] as String?, 14 | infobox: json['infobox'] as String?, 15 | summary: json['summary'] as String?, 16 | nsfw: json['nsfw'] as bool, 17 | cover: json['cover'] as String, 18 | airTime: json['airTime'] as String?, 19 | ); 20 | 21 | Map _$SubjectToJson(Subject instance) => { 22 | 'id': instance.id, 23 | 'type': _$SubjectTypeEnumMap[instance.type]!, 24 | 'name': instance.name, 25 | 'name_cn': instance.nameCn, 26 | 'infobox': instance.infobox, 27 | 'summary': instance.summary, 28 | 'nsfw': instance.nsfw, 29 | 'cover': instance.cover, 30 | 'airTime': instance.airTime, 31 | }; 32 | 33 | const _$SubjectTypeEnumMap = { 34 | SubjectType.ANIME: 'ANIME', 35 | SubjectType.COMIC: 'COMIC', 36 | SubjectType.GAME: 'GAME', 37 | SubjectType.MUSIC: 'MUSIC', 38 | SubjectType.NOVEL: 'NOVEL', 39 | SubjectType.REAL: 'REAL', 40 | SubjectType.OTHER: 'OTHER', 41 | }; 42 | -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectMeta.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | import '../enums/SubjectType.dart'; 6 | 7 | import '../enums/CollectionType.dart'; 8 | 9 | part 'SubjectMeta.g.dart'; 10 | 11 | @JsonSerializable() 12 | class SubjectMeta { 13 | final int id; 14 | final SubjectType type; 15 | final String name; 16 | @JsonKey(name: "name_cn") 17 | final String? nameCn; 18 | final String? infobox; 19 | final String? summary; 20 | final bool nsfw; 21 | final String cover; 22 | final bool? canRead; 23 | @JsonKey(name: "collection_status") 24 | final CollectionType? collectionType; 25 | 26 | SubjectMeta({required this.id, required this.type, required this.name, 27 | this.nameCn, this.infobox, this.summary, required this.nsfw, 28 | required this.cover, this.canRead, required this.collectionType}); 29 | 30 | factory SubjectMeta.fromJson(Map json) => _$SubjectMetaFromJson(json); 31 | 32 | Map toJson() => _$SubjectMetaToJson(this); 33 | } -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectMeta.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectMeta.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectMeta _$SubjectMetaFromJson(Map json) => SubjectMeta( 10 | id: (json['id'] as num).toInt(), 11 | type: $enumDecode(_$SubjectTypeEnumMap, json['type']), 12 | name: json['name'] as String, 13 | nameCn: json['name_cn'] as String?, 14 | infobox: json['infobox'] as String?, 15 | summary: json['summary'] as String?, 16 | nsfw: json['nsfw'] as bool, 17 | cover: json['cover'] as String, 18 | canRead: json['canRead'] as bool?, 19 | collectionType: $enumDecodeNullable( 20 | _$CollectionTypeEnumMap, json['collection_status']), 21 | ); 22 | 23 | Map _$SubjectMetaToJson(SubjectMeta instance) => 24 | { 25 | 'id': instance.id, 26 | 'type': _$SubjectTypeEnumMap[instance.type]!, 27 | 'name': instance.name, 28 | 'name_cn': instance.nameCn, 29 | 'infobox': instance.infobox, 30 | 'summary': instance.summary, 31 | 'nsfw': instance.nsfw, 32 | 'cover': instance.cover, 33 | 'canRead': instance.canRead, 34 | 'collection_status': _$CollectionTypeEnumMap[instance.collectionType], 35 | }; 36 | 37 | const _$SubjectTypeEnumMap = { 38 | SubjectType.ANIME: 'ANIME', 39 | SubjectType.COMIC: 'COMIC', 40 | SubjectType.GAME: 'GAME', 41 | SubjectType.MUSIC: 'MUSIC', 42 | SubjectType.NOVEL: 'NOVEL', 43 | SubjectType.REAL: 'REAL', 44 | SubjectType.OTHER: 'OTHER', 45 | }; 46 | 47 | const _$CollectionTypeEnumMap = { 48 | CollectionType.NOT: 'NOT', 49 | CollectionType.WISH: 'WISH', 50 | CollectionType.DOING: 'DOING', 51 | CollectionType.DONE: 'DONE', 52 | CollectionType.SHELVE: 'SHELVE', 53 | CollectionType.DISCARD: 'DISCARD', 54 | }; 55 | -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectRelation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | import 'package:ikaros/api/subject/enums/SubjectRelationType.dart'; 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'SubjectRelation.g.dart'; 7 | 8 | @JsonSerializable() 9 | class SubjectRelation { 10 | final int subject; 11 | @JsonKey(name: "relation_type") 12 | final SubjectRelationType relationType; 13 | @JsonKey(name: "relation_subjects") 14 | final List relationSubjects; 15 | 16 | SubjectRelation({required this.subject, required this.relationType, required this.relationSubjects}); 17 | 18 | factory SubjectRelation.fromJson(Map json) => _$SubjectRelationFromJson(json); 19 | 20 | Map toJson() => _$SubjectRelationToJson(this); 21 | } -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectRelation.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectRelation.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectRelation _$SubjectRelationFromJson(Map json) => 10 | SubjectRelation( 11 | subject: (json['subject'] as num).toInt(), 12 | relationType: 13 | $enumDecode(_$SubjectRelationTypeEnumMap, json['relation_type']), 14 | relationSubjects: (json['relation_subjects'] as List) 15 | .map((e) => (e as num).toInt()) 16 | .toList(), 17 | ); 18 | 19 | Map _$SubjectRelationToJson(SubjectRelation instance) => 20 | { 21 | 'subject': instance.subject, 22 | 'relation_type': _$SubjectRelationTypeEnumMap[instance.relationType]!, 23 | 'relation_subjects': instance.relationSubjects, 24 | }; 25 | 26 | const _$SubjectRelationTypeEnumMap = { 27 | SubjectRelationType.ANIME: 'ANIME', 28 | SubjectRelationType.COMIC: 'COMIC', 29 | SubjectRelationType.GAME: 'GAME', 30 | SubjectRelationType.MUSIC: 'MUSIC', 31 | SubjectRelationType.NOVEL: 'NOVEL', 32 | SubjectRelationType.REAL: 'REAL', 33 | SubjectRelationType.BEFORE: 'BEFORE', 34 | SubjectRelationType.AFTER: 'AFTER', 35 | SubjectRelationType.SAME_WORLDVIEW: 'SAME_WORLDVIEW', 36 | SubjectRelationType.ORIGINAL_SOUND_TRACK: 'ORIGINAL_SOUND_TRACK', 37 | SubjectRelationType.ORIGINAL_VIDEO_ANIMATION: 'ORIGINAL_VIDEO_ANIMATION', 38 | SubjectRelationType.ORIGINAL_ANIMATION_DISC: 'ORIGINAL_ANIMATION_DISC', 39 | SubjectRelationType.OTHER: 'OTHER', 40 | }; 41 | -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectSync.dart: -------------------------------------------------------------------------------- 1 | import 'package:ikaros/api/subject/enums/SubjectSyncPlatform.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'SubjectSync.g.dart'; 5 | 6 | @JsonSerializable() 7 | class SubjectSync { 8 | final int subjectId; 9 | final SubjectSyncPlatform platform; 10 | final String platformId; 11 | 12 | SubjectSync( 13 | {required this.subjectId, 14 | required this.platform, 15 | required this.platformId}); 16 | 17 | factory SubjectSync.fromJson(Map json) => _$SubjectSyncFromJson(json); 18 | 19 | Map toJson() => _$SubjectSyncToJson(this); 20 | } 21 | -------------------------------------------------------------------------------- /lib/api/subject/model/SubjectSync.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SubjectSync.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SubjectSync _$SubjectSyncFromJson(Map json) => SubjectSync( 10 | subjectId: (json['subjectId'] as num).toInt(), 11 | platform: $enumDecode(_$SubjectSyncPlatformEnumMap, json['platform']), 12 | platformId: json['platformId'] as String, 13 | ); 14 | 15 | Map _$SubjectSyncToJson(SubjectSync instance) => 16 | { 17 | 'subjectId': instance.subjectId, 18 | 'platform': _$SubjectSyncPlatformEnumMap[instance.platform]!, 19 | 'platformId': instance.platformId, 20 | }; 21 | 22 | const _$SubjectSyncPlatformEnumMap = { 23 | SubjectSyncPlatform.BGM_TV: 'BGM_TV', 24 | SubjectSyncPlatform.TMDB: 'TMDB', 25 | SubjectSyncPlatform.AniDB: 'AniDB', 26 | SubjectSyncPlatform.TVDB: 'TVDB', 27 | SubjectSyncPlatform.VNDB: 'VNDB', 28 | SubjectSyncPlatform.DOU_BAN: 'DOU_BAN', 29 | SubjectSyncPlatform.OTHER: 'OTHER', 30 | }; 31 | -------------------------------------------------------------------------------- /lib/api/subject/model/Video.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'Video.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Video { 8 | @JsonKey(name: "episode_id") 9 | final int episodeId; 10 | @JsonKey(name: "subject_id") 11 | final int subjectId; 12 | final String url; 13 | final String? title; 14 | final String? subhead; 15 | final List? subtitleUrls; 16 | 17 | Video({required this.episodeId, required this.subjectId, 18 | required this.url, this.title, this.subhead, this.subtitleUrls}); 19 | 20 | factory Video.fromJson(Map json) => _$VideoFromJson(json); 21 | 22 | Map toJson() => _$VideoToJson(this); 23 | } -------------------------------------------------------------------------------- /lib/api/subject/model/Video.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'Video.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Video _$VideoFromJson(Map json) => Video( 10 | episodeId: (json['episode_id'] as num).toInt(), 11 | subjectId: (json['subject_id'] as num).toInt(), 12 | url: json['url'] as String, 13 | title: json['title'] as String?, 14 | subhead: json['subhead'] as String?, 15 | subtitleUrls: (json['subtitleUrls'] as List?) 16 | ?.map((e) => e as String) 17 | .toList(), 18 | ); 19 | 20 | Map _$VideoToJson(Video instance) => { 21 | 'episode_id': instance.episodeId, 22 | 'subject_id': instance.subjectId, 23 | 'url': instance.url, 24 | 'title': instance.title, 25 | 'subhead': instance.subhead, 26 | 'subtitleUrls': instance.subtitleUrls, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/api/user/UserApi.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:ikaros/api/dio_client.dart'; 4 | 5 | import 'model/User.dart'; 6 | 7 | class UserApi { 8 | Future getMe() async { 9 | String apiUrl = "/api/v1alpha1/user/me"; 10 | try { 11 | Dio dio = await DioClient.getDio(); 12 | Response response = await dio.get(apiUrl); 13 | // print("response status code: ${response.statusCode}"); 14 | if (response.statusCode != 200) { 15 | return null; 16 | } 17 | Map data = response.data; 18 | return User.fromJson(data['entity']); 19 | } catch (e) { 20 | if (kDebugMode) { 21 | print(e); 22 | } 23 | return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/api/user/model/User.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'User.g.dart'; 4 | 5 | @JsonSerializable() 6 | class User { 7 | final int id; 8 | final String username; 9 | final String password; 10 | final String avatar; 11 | final String? nickname; 12 | final String? introduce; 13 | final String? telephone; 14 | final String? site; 15 | final String? email; 16 | 17 | User( 18 | {required this.id, 19 | required this.username, 20 | required this.password, 21 | required this.avatar, 22 | this.nickname, 23 | this.introduce, 24 | this.telephone, 25 | this.site, 26 | this.email}); 27 | 28 | factory User.fromJson(Map json) => _$UserFromJson(json); 29 | 30 | 31 | Map toJson() => _$UserToJson(this); 32 | } 33 | -------------------------------------------------------------------------------- /lib/api/user/model/User.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'User.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | User _$UserFromJson(Map json) => User( 10 | id: (json['id'] as num).toInt(), 11 | username: json['username'] as String, 12 | password: json['password'] as String, 13 | avatar: json['avatar'] as String, 14 | nickname: json['nickname'] as String?, 15 | introduce: json['introduce'] as String?, 16 | telephone: json['telephone'] as String?, 17 | site: json['site'] as String?, 18 | email: json['email'] as String?, 19 | ); 20 | 21 | Map _$UserToJson(User instance) => { 22 | 'id': instance.id, 23 | 'username': instance.username, 24 | 'password': instance.password, 25 | 'avatar': instance.avatar, 26 | 'nickname': instance.nickname, 27 | 'introduce': instance.introduce, 28 | 'telephone': instance.telephone, 29 | 'site': instance.site, 30 | 'email': instance.email, 31 | }; 32 | -------------------------------------------------------------------------------- /lib/component/dynamic_bar_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DynamicBarIcon extends StatefulWidget { 4 | const DynamicBarIcon({super.key}); 5 | 6 | @override 7 | _DynamicBarIconState createState() => _DynamicBarIconState(); 8 | } 9 | 10 | class _DynamicBarIconState extends State with SingleTickerProviderStateMixin { 11 | late AnimationController _controller; 12 | late List> _barAnimations; 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | 18 | // 初始化 AnimationController,控制动画的时间和曲线 19 | _controller = AnimationController( 20 | duration: const Duration(milliseconds: 500), // 设置动画持续时间 21 | vsync: this, 22 | )..repeat(reverse: true); // 往返重复动画 23 | 24 | // 生成每个柱子的动画,并设置反向动画 25 | _barAnimations = List.generate(3, (index) { 26 | // 中间柱子和两边柱子的动画设置 27 | if (index == 1) { 28 | // 中间柱子的高度从0.2到1.0 29 | return Tween(begin: 0.2, end: 1.0).animate( 30 | CurvedAnimation(parent: _controller, curve: Curves.easeInOut), 31 | ); 32 | } else { 33 | // 两边柱子高度和中间柱子反向变化 34 | return Tween(begin: 1.0, end: 0.2).animate( 35 | CurvedAnimation(parent: _controller, curve: Curves.easeInOut), 36 | ); 37 | } 38 | }); 39 | 40 | } 41 | 42 | @override 43 | void dispose() { 44 | _controller.dispose(); 45 | super.dispose(); 46 | } 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | return SizedBox( 51 | width: 24, // 图标的宽度,与常见图标大小一致 52 | height: 24, // 图标的高度,与常见图标大小一致 53 | child: AnimatedBuilder( 54 | animation: _controller, 55 | builder: (context, child) { 56 | return CustomPaint( 57 | painter: _BarPainter(_barAnimations), 58 | ); 59 | }, 60 | ), 61 | ); 62 | } 63 | } 64 | 65 | class _BarPainter extends CustomPainter { 66 | final List> barAnimations; 67 | 68 | _BarPainter(this.barAnimations); 69 | 70 | @override 71 | void paint(Canvas canvas, Size size) { 72 | final Paint paint = Paint() 73 | ..color = Colors.blue 74 | ..style = PaintingStyle.fill; 75 | 76 | double barWidth = size.width / barAnimations.length; // 控制柱子宽度 77 | double maxHeight = size.height; 78 | 79 | // 绘制三条柱子,使用动画值来控制高度 80 | for (int i = 0; i < barAnimations.length; i++) { 81 | double height = barAnimations[i].value * maxHeight; 82 | double left = i * barWidth; 83 | double top = maxHeight - height; 84 | canvas.drawRect(Rect.fromLTWH(left, top, barWidth - 2, height), paint); // 绘制矩形柱子 85 | } 86 | } 87 | 88 | @override 89 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 90 | return true; // 每次动画更新时都需要重绘 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /lib/component/full_screen_Image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FullScreenImagePage extends StatelessWidget { 4 | final String imageUrl; 5 | 6 | const FullScreenImagePage({super.key, required this.imageUrl}); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | backgroundColor: Colors.black, 12 | body: GestureDetector( 13 | onTap: () { 14 | Navigator.pop(context); 15 | }, 16 | child: Center( 17 | child: Hero( 18 | tag: imageUrl, 19 | child: Image.network( 20 | imageUrl, 21 | fit: BoxFit.contain, 22 | ), 23 | ), 24 | ), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/component/route_observer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | class IkarosRouteObserver extends RouteObserver> { 4 | @override 5 | void didPop(Route route, Route? previousRoute) { 6 | debugPrint("Route popped form [${previousRoute?.settings}] to [${route.settings}]"); 7 | } 8 | 9 | @override 10 | void didPush(Route route, Route? previousRoute) { 11 | debugPrint("Route pushed form [${previousRoute?.settings}] to [${route.settings}]"); 12 | } 13 | 14 | @override 15 | void didRemove(Route route, Route? previousRoute) { 16 | debugPrint("Route removed form [${previousRoute?.settings}] to [${route.settings}]"); 17 | } 18 | 19 | @override 20 | void didReplace({Route? newRoute, Route? oldRoute}) { 21 | debugPrint("Route replaced form [${oldRoute?.settings}] to [${newRoute?.settings}]"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/component/setting.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Setting extends StatelessWidget { 4 | final String title; 5 | final String subtitle; 6 | final Widget? rightWidget; 7 | 8 | const Setting({super.key, required this.title, required this.subtitle, this.rightWidget}); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Padding( 13 | padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), 14 | child: Row( 15 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 16 | children: [ 17 | // 左侧包含标题和副标题 18 | Expanded( 19 | child: Column( 20 | crossAxisAlignment: CrossAxisAlignment.start, 21 | children: [ 22 | // 标题部分,字体加重 23 | Text( 24 | title, 25 | style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), 26 | ), 27 | // 副标题部分,较小的字体 28 | Text( 29 | subtitle, 30 | style: const TextStyle(fontSize: 14, color: Colors.grey), 31 | ), 32 | ], 33 | ), 34 | ), 35 | // 右侧控件,如大文本或开关 36 | rightWidget ?? Container(), 37 | ], 38 | ), 39 | ); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /lib/component/subject/subject.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ikaros/component/full_screen_Image.dart'; 3 | 4 | class SubjectCover extends StatefulWidget { 5 | final String url; 6 | final bool? nsfw; 7 | final VoidCallback? onTap; 8 | 9 | const SubjectCover({super.key, required this.url, this.nsfw = false, this.onTap}); 10 | 11 | @override 12 | State createState() { 13 | return SubjectCoverState(); 14 | } 15 | } 16 | 17 | class SubjectCoverState extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | return AspectRatio( 21 | aspectRatio: 7 / 10, // 设置图片宽高比例 22 | child: GestureDetector( 23 | onTap: (){ 24 | widget.onTap?.call(); 25 | }, 26 | onLongPress: () { 27 | Navigator.push( 28 | context, 29 | MaterialPageRoute( 30 | builder: (context) => FullScreenImagePage( 31 | imageUrl: widget.url, // 替换为你的图片URL 32 | ), 33 | ), 34 | ); 35 | }, 36 | child: Stack( 37 | children: [ 38 | Hero( 39 | tag: widget.url, 40 | child: ClipRRect( 41 | borderRadius: BorderRadius.circular(5), 42 | child: FadeInImage.assetNetwork( 43 | width: double.infinity, 44 | height: double.infinity, 45 | placeholder: 'assets/loading_placeholder.jpg', 46 | image: widget.url, 47 | imageErrorBuilder: (context, error, stackTrace) { 48 | // 如果图片加载失败,显示错误占位图 49 | return const Text("图片加载失败"); 50 | // return Image.asset('assets/error_placeholder.png', fit: BoxFit.fitWidth); 51 | }, 52 | fadeInDuration: const Duration(milliseconds: 500), 53 | fit: BoxFit.cover, 54 | ), 55 | // child: Image.network( 56 | // widget.url, 57 | // fit: BoxFit.cover, 58 | // ), 59 | ), 60 | ), 61 | if (widget.nsfw != null && widget.nsfw!) 62 | Positioned( 63 | top: 8, 64 | right: 0, 65 | child: Container( 66 | padding: const EdgeInsets.only( 67 | left: 2, right: 2, top: 2, bottom: 1), 68 | decoration: const BoxDecoration( 69 | color: Colors.orangeAccent, 70 | borderRadius: BorderRadius.only( 71 | topLeft: Radius.circular(4), 72 | bottomLeft: Radius.circular(4), 73 | topRight: Radius.circular(0), 74 | bottomRight: Radius.circular(0), 75 | ), 76 | ), 77 | alignment: Alignment.center, 78 | child: const Text( 79 | 'NSFW', 80 | style: TextStyle( 81 | color: Colors.white, 82 | fontSize: 6, 83 | fontWeight: FontWeight.bold, 84 | ), 85 | ), 86 | ), 87 | ), 88 | ], 89 | ), 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/consts/collection-const.dart: -------------------------------------------------------------------------------- 1 | class CollectionConst { 2 | static const Map typeCnMap = { 3 | "ALL": "所有", 4 | "WISH": "想看", 5 | "DOING": "在看", 6 | "DONE": "看过", 7 | "SHELVE": "搁置", 8 | "DISCARD": "抛弃", 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /lib/consts/subject_const.dart: -------------------------------------------------------------------------------- 1 | class SubjectConst { 2 | static const Map episodeGroupCnMap = { 3 | "MAIN": "正片", 4 | "PROMOTION_VIDEO": "PV", 5 | "OPENING_SONG": "片头曲", 6 | "ENDING_SONG": "片尾曲", 7 | "SPECIAL_PROMOTION": "特典", 8 | "SMALL_THEATER": "相同世界观", 9 | "LIVE": "直播", 10 | "COMMERCIAL_MESSAGE": "CM", 11 | "ORIGINAL_SOUND_TRACK": "OST", 12 | "ORIGINAL_VIDEO_ANIMATION": "OVA", 13 | "ORIGINAL_ANIMATION_DISC": "OAD", 14 | "MUSIC_DIST1": "音乐列表一", 15 | "MUSIC_DIST2": "音乐列表二", 16 | "MUSIC_DIST3": "音乐列表三", 17 | "MUSIC_DIST4": "音乐列表四", 18 | "MUSIC_DIST5": "音乐列表五", 19 | "OTHER": "其它", 20 | }; 21 | 22 | static const Map typeCnMap = { 23 | "ANIME": "动漫", 24 | "COMIC": "漫画", 25 | "GAME": "游戏", 26 | "MUSIC": "音声", 27 | "NOVEL": "小说", 28 | "REAL": "三次元", 29 | "OTHER": "其它", 30 | }; 31 | 32 | static const Map cnTypeMap = { 33 | "动漫": "ANIME", 34 | "漫画": "COMIC", 35 | "游戏": "GAME", 36 | "音声": "MUSIC", 37 | "小说": "NOVEL", 38 | "三次元": "REAL", 39 | "其它": "OTHER", 40 | }; 41 | 42 | static const Map relationTypeCnMap = { 43 | "ANIME": "动漫", 44 | "COMIC": "漫画", 45 | "GAME": "游戏", 46 | "MUSIC": "音声", 47 | "NOVEL": "小说", 48 | "REAL": "三次元", 49 | "BEFORE": "前传", 50 | "AFTER": "后传", 51 | "SAME_WORLDVIEW": "相同世界观", 52 | "ORIGINAL_SOUND_TRACK": "OST", 53 | "ORIGINAL_VIDEO_ANIMATION": "OVA", 54 | "ORIGINAL_ANIMATION_DISC": "OAD", 55 | "OTHER": "其它", 56 | }; 57 | 58 | static const Map cnRelationTypeMap = { 59 | "动漫": "ANIME", 60 | "漫画": "COMIC", 61 | "游戏": "GAME", 62 | "音声": "MUSIC", 63 | "小说": "NOVEL", 64 | "三次元": "REAL", 65 | "前传": "BEFORE", 66 | "后传": "AFTER", 67 | "相同世界观": "SAME_WORLDVIEW", 68 | "OST": "ORIGINAL_SOUND_TRACK", 69 | "OVA": "ORIGINAL_VIDEO_ANIMATION", 70 | "OAD": "ORIGINAL_ANIMATION_DISC", 71 | "其它": "OTHER", 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /lib/consts/tmp-const.dart: -------------------------------------------------------------------------------- 1 | class TmpConst { 2 | static const String captionUrl = "http://nas:9999/files/2023/7/6/6e6b3eb886b7472a88e2f17a383b0650.ass"; 3 | static const String H264_URL = "http://nas:9999/files/2023/7/6/fa5e4ccd4e1d4d93866d073cbebfb9ff.mp4"; 4 | // [Airota&VCB-Studio] Deaimon [02][Ma10p_1080p][x265_flac].mkv 5 | static const String H265_URL = "http://nas:9999/files/2023/7/6/ddc861e067a749e0b242278422bee832.mkv"; 6 | // [Airota&VCB-Studio] Deaimon [02][Ma10p_1080p][x265_flac].CHS.ass 7 | static const String H265_CHS_ASS_URL = "http://nas:9999/files/2023/7/6/6e6b3eb886b7472a88e2f17a383b0650.ass"; 8 | static const String MULTI_TRACKS_H264_URL = "http://nas:9999/files/2023/7/6/cfd933ccb0df48779c50a8deb52f274d.mkv"; 9 | // [Nekomoe kissaten&LoliHouse] Sono Bisque Doll wa Koi wo Suru - 01 [WebRip 1080p HEVC-10bit AAC ASSx2].mkv 10 | static const String EMBED_ASS_H265_URL = "http://nas:9999/files/2023/7/6/71c4d2955b404237bb1781e3f7301a0f.mkv"; 11 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_localizations/flutter_localizations.dart'; 3 | import 'package:ikaros/layout.dart'; 4 | import 'package:ikaros/utils/screen_utils.dart'; 5 | 6 | 7 | void main() { 8 | runApp(const MyApp()); 9 | } 10 | 11 | class MyApp extends StatelessWidget { 12 | const MyApp({super.key}); 13 | 14 | // This widget is the root of your application. 15 | @override 16 | Widget build(BuildContext context) { 17 | return MaterialApp( 18 | // navigatorObservers: [IkarosRouteObserver()], 19 | debugShowCheckedModeBanner: false, 20 | title: 'Ikaros', 21 | localizationsDelegates: const [ 22 | GlobalMaterialLocalizations.delegate, 23 | GlobalWidgetsLocalizations.delegate, 24 | GlobalCupertinoLocalizations.delegate, 25 | ], 26 | supportedLocales: const [ 27 | Locale('zh', 'CN'), // 中文简体 28 | ], 29 | locale: const Locale('zh', 'CN'), 30 | theme: ThemeData( 31 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), 32 | ), 33 | home: ScreenUtils.screenWidthGt600(context) 34 | ? const DesktopLayout() 35 | : const MobileLayout(), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/player/player_audio_desktop.dart: -------------------------------------------------------------------------------- 1 | import 'package:audio_video_progress_bar/audio_video_progress_bar.dart'; 2 | import 'package:dart_vlc/dart_vlc.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class DesktopAudioPlayer extends StatefulWidget { 6 | const DesktopAudioPlayer({super.key}); 7 | 8 | @override 9 | State createState() { 10 | return DesktopAudioPlayerState(); 11 | } 12 | } 13 | 14 | class DesktopAudioPlayerState extends State { 15 | late Player _player; 16 | late String _audioUrl = ""; 17 | late String _coverUrl = ""; 18 | late String _title = ""; 19 | bool _isPlaying = false; 20 | 21 | void setCoverUrl(String url) { 22 | _coverUrl = url; 23 | } 24 | 25 | void setTitle(String title) { 26 | _title = title; 27 | } 28 | 29 | void open(String audioUrl, {autoStart = false}) { 30 | _audioUrl = audioUrl; 31 | _loadAlbumArt(); 32 | _player.open(Media.network(audioUrl), autoStart: autoStart); 33 | } 34 | 35 | void reload(String audioUrl, {autoStart = false}) { 36 | _audioUrl = audioUrl; 37 | _loadAlbumArt(); 38 | _player.stop(); 39 | _player.open(Media.network(audioUrl), autoStart: autoStart); 40 | } 41 | 42 | Future _loadAlbumArt() async { 43 | // TODO read cover and author form audio url. 44 | setState(() {}); 45 | } 46 | 47 | @override 48 | void initState() { 49 | super.initState(); 50 | 51 | WidgetsFlutterBinding.ensureInitialized(); 52 | 53 | DartVLC.initialize(); 54 | _player = Player(id: hashCode * 2); 55 | _player.playbackStream.listen((state) { 56 | setState(() { 57 | _isPlaying = state.isPlaying; 58 | }); 59 | }); 60 | } 61 | 62 | @override 63 | void dispose() { 64 | _player.stop(); 65 | _player.dispose(); 66 | super.dispose(); 67 | } 68 | 69 | void _togglePlayPause() { 70 | if (_isPlaying) { 71 | _player.pause(); 72 | } else { 73 | _player.play(); 74 | } 75 | setState(() { 76 | _isPlaying = !_isPlaying; 77 | }); 78 | } 79 | 80 | Widget _buildCoverWidget() { 81 | if (_coverUrl == "") { 82 | return const Center( 83 | child: CircularProgressIndicator(), 84 | ); 85 | } 86 | return Image.network(_coverUrl); 87 | } 88 | 89 | @override 90 | Widget build(BuildContext context) { 91 | return Column( 92 | children: [ 93 | _buildCoverWidget(), 94 | Text(_title), 95 | // Text(_tag.artwork ?? "未知"), 96 | // 播放器的进度条 97 | StreamBuilder( 98 | stream: _player.positionStream, 99 | builder: 100 | (BuildContext context, AsyncSnapshot snapshot) { 101 | final durationState = snapshot.data; 102 | final progress = durationState?.position ?? Duration.zero; 103 | final total = durationState?.duration ?? Duration.zero; 104 | return Theme( 105 | data: ThemeData.dark(), 106 | child: ProgressBar( 107 | progress: progress, 108 | total: total, 109 | barHeight: 3, 110 | thumbRadius: 10.0, 111 | thumbGlowRadius: 30.0, 112 | timeLabelLocation: TimeLabelLocation.sides, 113 | timeLabelType: TimeLabelType.totalTime, 114 | timeLabelTextStyle: const TextStyle(color: Colors.black), 115 | onSeek: (duration) { 116 | _player.seek(duration); 117 | }, 118 | ), 119 | ); 120 | }, 121 | ), 122 | 123 | // 播放/暂停按钮 124 | StreamBuilder( 125 | stream: _player.playbackStream, 126 | builder: (context, snapshot) { 127 | final PlaybackState state = snapshot.data ?? PlaybackState(); 128 | return IconButton( 129 | icon: Icon(state.isPlaying ? Icons.pause : Icons.play_arrow), 130 | onPressed: _togglePlayPause, 131 | ); 132 | }, 133 | ), 134 | ], 135 | ); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /lib/player/player_audio_mobile.dart: -------------------------------------------------------------------------------- 1 | import 'package:audio_video_progress_bar/audio_video_progress_bar.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:just_audio/just_audio.dart'; 4 | 5 | class MobileAudioPlayer extends StatefulWidget { 6 | const MobileAudioPlayer({super.key}); 7 | 8 | @override 9 | State createState() { 10 | return MobileAudioPlayerState(); 11 | } 12 | } 13 | 14 | class MobileAudioPlayerState extends State { 15 | late AudioPlayer _player; 16 | late String _audioUrl = ""; 17 | late String _coverUrl = ""; 18 | late String _title = ""; 19 | bool _isPlaying = false; 20 | Duration _duration = Duration.zero; 21 | Duration _position = Duration.zero; 22 | bool _isBuffering = true; 23 | 24 | void setCoverUrl(String url) { 25 | setState(() { 26 | _coverUrl = url; 27 | }); 28 | } 29 | 30 | void setTitle(String title) { 31 | setState(() { 32 | _title = title; 33 | }); 34 | } 35 | 36 | Future open(String audioUrl, {bool autoStart = false}) async { 37 | setState(() { 38 | _audioUrl = audioUrl; 39 | }); 40 | await _loadAlbumArt(); 41 | 42 | _player.setUrl(audioUrl); 43 | _player.play(); 44 | } 45 | 46 | Future reload(String audioUrl) async { 47 | setState(() { 48 | _audioUrl = audioUrl; 49 | }); 50 | await _loadAlbumArt(); 51 | 52 | _player.stop(); 53 | _player.setUrl(audioUrl); 54 | _player.play(); 55 | } 56 | 57 | Future _loadAlbumArt() async { 58 | // TODO read cover and author form audio url. 59 | setState(() {}); 60 | } 61 | 62 | @override 63 | void initState() { 64 | super.initState(); 65 | 66 | WidgetsFlutterBinding.ensureInitialized(); 67 | 68 | _player = AudioPlayer(); 69 | _player.positionStream.listen((position) { 70 | setState(() { 71 | _position = position ?? Duration.zero; 72 | }); 73 | }); 74 | _player.durationStream.listen((duration) { 75 | setState(() { 76 | _duration = duration ?? Duration.zero; 77 | }); 78 | }); 79 | _player.playerStateStream.listen((state) { 80 | setState(() { 81 | _isPlaying = state.playing; 82 | _isBuffering = state.processingState != ProcessingState.ready; 83 | }); 84 | }); 85 | } 86 | 87 | @override 88 | void dispose() { 89 | _player.dispose(); 90 | super.dispose(); 91 | } 92 | 93 | void _togglePlayPause() { 94 | if (_isPlaying) { 95 | _player.pause(); 96 | } else { 97 | _player.play(); 98 | } 99 | setState(() { 100 | _isPlaying = !_isPlaying; 101 | }); 102 | } 103 | 104 | Widget _buildCoverWidget() { 105 | if (_coverUrl == "") { 106 | return const Center( 107 | child: CircularProgressIndicator(), 108 | ); 109 | } 110 | return Image.network(_coverUrl); 111 | } 112 | 113 | Widget _buildPlayOrPauseBtn() { 114 | if (_isBuffering) { 115 | return const SizedBox( 116 | width: 30, 117 | height: 30, 118 | child: Center( 119 | child: CircularProgressIndicator(), 120 | ), 121 | ); 122 | } 123 | return IconButton( 124 | icon: Icon(_isPlaying ? Icons.pause : Icons.play_arrow, size: 30,), 125 | onPressed: _togglePlayPause, 126 | ); 127 | } 128 | 129 | @override 130 | Widget build(BuildContext context) { 131 | return Column( 132 | children: [ 133 | _buildCoverWidget(), 134 | Text(_title), 135 | // Text(_tag.artwork ?? "未知"), 136 | // 播放器的进度条 137 | ProgressBar( 138 | progress: _position, 139 | total: _duration, 140 | barHeight: 3, 141 | thumbRadius: 10.0, 142 | thumbGlowRadius: 30.0, 143 | timeLabelLocation: TimeLabelLocation.sides, 144 | timeLabelType: TimeLabelType.totalTime, 145 | timeLabelTextStyle: const TextStyle(color: Colors.black), 146 | onSeek: (duration) { 147 | _player.seek(duration); 148 | }, 149 | ), 150 | 151 | // 播放/暂停按钮 152 | _buildPlayOrPauseBtn(), 153 | 154 | ], 155 | ); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /lib/utils/device_info_utils.dart: -------------------------------------------------------------------------------- 1 | // import 'dart:io'; 2 | // 3 | // import 'package:device_info_plus/device_info_plus.dart'; 4 | // 5 | // class DeviceInfoUtils { 6 | // static DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); 7 | // 8 | // static Future getAndroidDeviceInfo() async { 9 | // if (!Platform.isAndroid) return null; 10 | // return await deviceInfo.androidInfo; 11 | // } 12 | // 13 | // static Future isAndroidArmv7a() async { 14 | // if (!Platform.isAndroid) return false; 15 | // AndroidDeviceInfo? androidInfo = await getAndroidDeviceInfo(); 16 | // if (androidInfo == null) return false; 17 | // return "armv7" == androidInfo.hardware || "armeabi-v7a" == androidInfo.hardware; 18 | // } 19 | // 20 | // static Future isAndroidArm64() async { 21 | // if (!Platform.isAndroid) return false; 22 | // AndroidDeviceInfo? androidInfo = await getAndroidDeviceInfo(); 23 | // if (androidInfo == null) return false; 24 | // return "arm64" == androidInfo.hardware || "arm64-v8a" == androidInfo.hardware; 25 | // } 26 | // 27 | // static Future isAndroidX86() async { 28 | // if (!Platform.isAndroid) return false; 29 | // AndroidDeviceInfo? androidInfo = await getAndroidDeviceInfo(); 30 | // if (androidInfo == null) return false; 31 | // return "x86" == androidInfo.hardware || "x86_64" == androidInfo.hardware; 32 | // } 33 | // 34 | // } -------------------------------------------------------------------------------- /lib/utils/message_utils.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | // import 'package:fluttertoast/fluttertoast.dart' as FlToast; 4 | 5 | // class MessageUtils { 6 | // static void showToast(String message) { 7 | // if (Platform.isIOS || Platform.isAndroid) { 8 | // FlToast.Fluttertoast.showToast( 9 | // msg: message, 10 | // toastLength: FlToast.Toast.LENGTH_SHORT, 11 | // gravity: FlToast.ToastGravity.CENTER, 12 | // timeInSecForIosWeb: 5, 13 | // backgroundColor: Colors.red, 14 | // textColor: Colors.white, 15 | // fontSize: 16.0); 16 | // return; 17 | // } 18 | // 19 | // return; 20 | // } 21 | // } 22 | 23 | class Toast { 24 | static void show(BuildContext context, String message, 25 | {Duration duration = const Duration(seconds: 2)}) { 26 | OverlayEntry overlayEntry = OverlayEntry( 27 | builder: (context) => Positioned( 28 | top: MediaQuery.of(context).size.height * 0.8, 29 | left: MediaQuery.of(context).size.width * 0.1, 30 | width: MediaQuery.of(context).size.width * 0.8, 31 | child: Material( 32 | color: Colors.transparent, 33 | child: Container( 34 | padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0), 35 | decoration: BoxDecoration( 36 | color: Colors.black.withOpacity(0.7), 37 | borderRadius: BorderRadius.circular(8.0), 38 | ), 39 | child: Text( 40 | message, 41 | style: const TextStyle(color: Colors.white), 42 | ), 43 | ), 44 | ), 45 | ), 46 | ); 47 | 48 | Overlay.of(context).insert(overlayEntry); 49 | 50 | Future.delayed(duration, () { 51 | overlayEntry.remove(); 52 | }); 53 | } 54 | } -------------------------------------------------------------------------------- /lib/utils/number_utils.dart: -------------------------------------------------------------------------------- 1 | class NumberUtils { 2 | static bool doubleIsInt(double num) { 3 | return num == num.toInt(); 4 | } 5 | } -------------------------------------------------------------------------------- /lib/utils/screen_utils.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | class ScreenUtils { 4 | static bool screenWidthGt600(BuildContext context) { 5 | return MediaQuery.of(context).size.width > 600; 6 | } 7 | static bool isDesktop(BuildContext context) { 8 | return screenWidthGt600(context); 9 | } 10 | static bool isMobile(BuildContext context) { 11 | return !isDesktop(context); 12 | } 13 | } -------------------------------------------------------------------------------- /lib/utils/string_utils.dart: -------------------------------------------------------------------------------- 1 | class StringUtils { 2 | static String emptyHint(String? original, String hintElse) { 3 | if (original == null || original == '' || original.trim() == '') { 4 | return hintElse; 5 | } 6 | return original; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /lib/utils/throttle_utils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | class ThrottleController { 4 | Timer? _timer; 5 | 6 | void run(Function action, Duration interval) { 7 | if (_timer?.isActive ?? false) { 8 | return; // 如果Timer还在计时中,则不执行新的action 9 | } 10 | _timer = Timer(interval, () { 11 | action(); 12 | _timer = null; // 计时结束后重置Timer 13 | }); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /lib/utils/time_utils.dart: -------------------------------------------------------------------------------- 1 | import 'package:intl/intl.dart'; 2 | 3 | class TimeUtils { 4 | static String convertMinSec(int milliseconds) { 5 | Duration duration = Duration(milliseconds: milliseconds); 6 | int minutes = duration.inMinutes; 7 | int seconds = duration.inSeconds % 60; 8 | 9 | return '$minutes 分 $seconds 秒'; 10 | } 11 | 12 | static String formatDateString(String isoDate) { 13 | // 解析 ISO 8601 格式的日期字符串 14 | DateTime dateTime = DateTime.parse(isoDate); 15 | // 格式化为“年-月-日”格式 16 | return DateFormat('yyyy-MM-dd').format(dateTime); 17 | } 18 | 19 | static String toIso8601Str(DateTime dateTime) { 20 | return DateFormat('yyyy-MM-ddTHH:mm:ss').format(dateTime); 21 | } 22 | 23 | static String formatDateStringWithPattern(String? isoDate, String pattern) { 24 | if (isoDate == null) return ""; 25 | DateTime dateTime = DateTime.parse(isoDate); 26 | // 格式化为“年-月-日”格式 27 | return DateFormat(pattern).format(dateTime); 28 | } 29 | 30 | static String formatDateTimeWithPattern(DateTime dateTime, String pattern) { 31 | // 格式化为“年-月-日”格式 32 | return DateFormat(pattern).format(dateTime); 33 | } 34 | 35 | static String formatDateTime(DateTime dateTime) { 36 | // 格式化为“年-月-日”格式 37 | return DateFormat('yyyy-MM-dd').format(dateTime); 38 | } 39 | 40 | static String formatDuration(int milliseconds) { 41 | final duration = Duration(milliseconds: milliseconds); 42 | final minutes = duration.inMinutes; 43 | final seconds = duration.inSeconds.remainder(60); 44 | 45 | return '${minutes}分${seconds}秒'; 46 | } 47 | } -------------------------------------------------------------------------------- /lib/utils/url_utils.dart: -------------------------------------------------------------------------------- 1 | class UrlUtils { 2 | static String getCoverUrl(String base, String url) { 3 | if (url.startsWith("http")) return url; 4 | if (!url.startsWith('/')) url = '/$url'; 5 | return base + url; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | flutter/generated* 3 | -------------------------------------------------------------------------------- /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/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.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 "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /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 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 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/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/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 = app 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = run.ikaros.app 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 run.ikaros. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | NSPhotoLibraryUsageDescription 32 | Ikaros需要访问您的相册以保存图片 33 | 34 | 35 | -------------------------------------------------------------------------------- /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 | 8 | 9 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 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 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ikaros 2 | description: ikaros app by flutter 3 | version: 20.4.3 4 | 5 | environment: 6 | sdk: '>=2.18.4 <=3.10.5' 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | fluttertoast: ^8.2.8 12 | cupertino_icons: ^1.0.2 13 | dio: ^5.3.0 14 | json_annotation: ^4.8.1 15 | shared_preferences: ^2.2.0 16 | flutter_easyrefresh: ^2.2.2 17 | path_provider: ^2.0.15 18 | uuid: ^3.0.7 19 | flutter_vlc_player: 20 | path: dependencies/flutter_vlc_player/flutter_vlc_player 21 | provider: ^6.0.5 22 | dart_vlc: 23 | path: dependencies/dart_vlc 24 | audio_video_progress_bar: ^2.0.3 25 | url_launcher: ^6.3.0 26 | package_info_plus: ^8.0.2 27 | open_file: ^3.3.2 28 | permission_handler: ^11.3.1 29 | win32: ^5.5.4 30 | desktop_window: ^0.4.0 31 | ffi: ^2.1.3 32 | ns_danmaku: 33 | path: dependencies/ns_danmaku 34 | synchronized: ^3.2.0 35 | crypto: ^3.0.5 36 | wakelock_plus: ^1.2.8 37 | just_audio: ^0.9.40 38 | photo_manager: ^3.3.0 39 | app_links: ^6.3.2 40 | intl: ^0.19.0 41 | flutter_localizations: 42 | sdk: flutter 43 | 44 | path: any 45 | dev_dependencies: 46 | flutter_test: 47 | sdk: flutter 48 | test: ^1.17.0 49 | flutter_lints: ^2.0.0 50 | json_serializable: ^6.7.1 51 | build_runner: ^2.4.6 52 | 53 | flutter: 54 | uses-material-design: true 55 | assets: 56 | - assets/loading_placeholder.jpg 57 | -------------------------------------------------------------------------------- /pubspec_overrides.yaml: -------------------------------------------------------------------------------- 1 | # melos_managed_dependency_overrides: media_kit 2 | #dependency_overrides: 3 | # flutter_vlc_player_platform_interface: 4 | # path: ../../chivehao/flutter_vlc_player/flutter_vlc_player_platform_interface 5 | -------------------------------------------------------------------------------- /test/api/dandanplay/DandanplayCommentApiTest.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:ikaros/api/dandanplay/DandanplayCommentApi.dart'; 3 | import 'package:ikaros/api/dandanplay/model/CommentEpisodeIdResponse.dart'; 4 | 5 | void main() { 6 | test("comment_episodeId", ()async{ 7 | CommentEpisodeIdResponse? resp = await DandanplayCommentApi().commentEpisodeId(160630001, 1); 8 | expect(resp == null, false); 9 | expect(resp!.count > 0, true); 10 | }); 11 | } -------------------------------------------------------------------------------- /test/api/dandanplay/DandanplaySearchApiTest.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:ikaros/api/dandanplay/DandanplaySearchApi.dart'; 3 | import 'package:ikaros/api/dandanplay/model/IkarosDanmukuEpisodesResponse.dart'; 4 | 5 | void main() { 6 | test('search_episodes', ()async{ 7 | IkarosDanmukuEpisodesResponse? resp = await DandanplaySearchApi().searchEpisodes("ぼっち・ざ・ろっく!", "2"); 8 | expect(resp?.animes.isNotEmpty, true); 9 | }); 10 | } -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/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 | app 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "short_name": "app", 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 | flutter/generated* 3 | 4 | # Visual Studio user-specific files. 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # Visual Studio build-related files. 11 | x64/ 12 | x86/ 13 | 14 | # Visual Studio cache files 15 | # files ending in .cache can be ignored 16 | *.[Cc]ache 17 | # but keep track of directories ending in .cache 18 | !*.[Cc]ache/ 19 | -------------------------------------------------------------------------------- /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 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /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", "run.ikaros" "\0" 93 | VALUE "FileDescription", "ikaros" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "Ikaros" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 run.ikaros. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "ikaros.exe" "\0" 98 | VALUE "ProductName", "Ikaros" "\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"app", 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/ikaros-dev/app/edfe571597f0f967a6a6f70ab74a3c632c0ba946/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 | -------------------------------------------------------------------------------- /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 | unsigned 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 | --------------------------------------------------------------------------------