├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ └── request.md └── workflows │ └── main.yml ├── .gitignore ├── .metadata ├── License ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── mystyle │ │ │ │ └── purelive │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxxhdpi │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ └── ic_launcher.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-en │ │ │ └── strings.xml │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── PingFangSC.ttf ├── crypto-js.js ├── icons │ ├── CustomIcons.ttf │ ├── icon.png │ └── icon_foreground.png └── images │ ├── alipay.jpg │ └── wechat.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-50x50@1x.png │ │ ├── Icon-App-50x50@2x.png │ │ ├── Icon-App-57x57@1x.png │ │ ├── Icon-App-57x57@2x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-72x72@1x.png │ │ ├── Icon-App-72x72@2x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── common │ ├── base │ │ └── base_controller.dart │ ├── index.dart │ ├── l10n │ │ ├── generated │ │ │ ├── intl │ │ │ │ ├── messages_all.dart │ │ │ │ ├── messages_en.dart │ │ │ │ └── messages_zh_CN.dart │ │ │ └── l10n.dart │ │ ├── intl_en.arb │ │ └── intl_zh_CN.arb │ ├── models │ │ ├── index.dart │ │ ├── live_area.dart │ │ ├── live_message.dart │ │ └── live_room.dart │ ├── services │ │ ├── index.dart │ │ └── settings_service.dart │ ├── style │ │ ├── index.dart │ │ └── theme.dart │ ├── utils │ │ ├── cache_manager.dart │ │ ├── index.dart │ │ ├── js_engine.dart │ │ ├── pref_util.dart │ │ ├── snackbar_util.dart │ │ ├── text_util.dart │ │ └── version_util.dart │ └── widgets │ │ ├── custom_icons.dart │ │ ├── empty_view.dart │ │ ├── index.dart │ │ ├── menu_button.dart │ │ ├── room_card.dart │ │ ├── search_button.dart │ │ └── section_listtile.dart ├── core │ ├── common │ │ ├── binary_writer.dart │ │ └── websocket_utils.dart │ ├── danmaku │ │ ├── bilibili_danmaku.dart │ │ ├── douyu_danmaku.dart │ │ └── huya_danmaku.dart │ ├── index.dart │ ├── interface │ │ ├── live_danmaku.dart │ │ └── live_site.dart │ ├── site │ │ ├── bilibili_site.dart │ │ ├── douyu_site.dart │ │ └── huya_site.dart │ └── sites.dart ├── main.dart ├── modules │ ├── about │ │ ├── about_page.dart │ │ ├── donate_page.dart │ │ └── widgets │ │ │ └── version_dialog.dart │ ├── area_rooms │ │ ├── area_rooms_controller.dart │ │ └── area_rooms_page.dart │ ├── areas │ │ ├── areas_controller.dart │ │ ├── areas_grid_view.dart │ │ ├── areas_page.dart │ │ ├── favorite_areas_page.dart │ │ └── widgets │ │ │ └── area_card.dart │ ├── backup │ │ └── backup_page.dart │ ├── contact │ │ └── contact_page.dart │ ├── favorite │ │ ├── favorite_controller.dart │ │ └── favorite_page.dart │ ├── history │ │ └── history_page.dart │ ├── home │ │ ├── home_page.dart │ │ ├── mobile_view.dart │ │ └── tablet_view.dart │ ├── live_play │ │ ├── live_play_controller.dart │ │ ├── live_play_page.dart │ │ └── widgets │ │ │ ├── danmaku_list_view.dart │ │ │ ├── index.dart │ │ │ ├── live_dlna_dialog.dart │ │ │ └── video_player │ │ │ ├── danmaku_text.dart │ │ │ ├── video_controller.dart │ │ │ ├── video_controller_panel.dart │ │ │ └── video_player.dart │ ├── popular │ │ ├── popular_controller.dart │ │ ├── popular_grid_controller.dart │ │ ├── popular_grid_view.dart │ │ └── popular_page.dart │ ├── search │ │ ├── search_binding.dart │ │ ├── search_controller.dart │ │ ├── search_list_controller.dart │ │ ├── search_list_view.dart │ │ └── search_page.dart │ └── settings │ │ ├── settings_binding.dart │ │ └── settings_page.dart └── routes │ └── app_pages.dart ├── pubspec.yaml ├── screenshots ├── areas_page.jpg ├── desktop_favorite.png ├── desktop_live_play.png ├── desktop_popular.png ├── favorite_page.jpg ├── live_play_page.jpg ├── popular_page.jpg └── search_page.jpg ├── test └── widget_test.dart └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 错误报告 3 | about: 创建报告以帮助我们改进 4 | title: "[bug]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | **在提出问题时,请确保您已经阅读了以下内容** 10 | - [README](README.md) 11 | 12 | - [ISSUE](https://github.com/Jackiu1997/pure_live/issues?q=) 13 | 14 | - [如何有效地报告 Bug](https://www.chiark.greenend.org.uk/~sgtatham/bugs-cn.html) 15 | 16 | - [提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md) 17 | 18 | 在阅读完以上内容后,如果您仍然有问题,请删除自第一行加粗内容起至下一行加粗内容的所有文字,在最后一行的[]中填写x,然后描述问题。 19 | 20 | **请勿删除自此行之后加粗的模板!** 21 | 22 | **描述错误** 23 | 简明扼要地描述该错误是什么。 24 | 25 | **重现** 26 | 重现该行为的步骤。 27 | 1. 转到 '....' 28 | 2. 点击 '....' 29 | 3. 向下滚动到 '....' 30 | 4. 看到错误 31 | 32 | **预期的行为** 33 | 简明扼要地描述你期望发生的情况。 34 | 35 | **屏幕截图** 36 | 如果适用,添加屏幕截图以帮助解释你的问题。 37 | 38 | **设备信息(请填写以下信息):** 39 | - 操作系统: [例如:Windows] 40 | - 版本: [例如:Windows 11 21H2] 41 | 42 | **额外的背景** 43 | 在这里添加关于问题的任何其他背景。 44 | 45 | [] 我已经阅读了相关内容并且描述准确 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 功能请求 3 | about: 为这个项目提出一个想法 4 | title: "[request]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | **在提出问题时,请确保您已经阅读了以下内容** 10 | - [README](README.md) 11 | 12 | - [ISSUE](https://github.com/Jackiu1997/pure_live/issues?q=) 13 | 14 | - [如何有效地报告 Bug](https://www.chiark.greenend.org.uk/~sgtatham/bugs-cn.html) 15 | 16 | - [提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md) 17 | 18 | 在阅读完以上内容后,如果您仍然有问题,请删除自第一行加粗内容起至下一行加粗内容的所有文字,在最后一行的[]中填写x,然后描述问题。 19 | 20 | **请勿删除自此行之后加粗的模板!** 21 | 22 | **你的功能请求是否与一个问题有关?请描述。** 23 | 清楚而简洁地描述问题是什么。例如:当[......]时,我感到[......]。 24 | 25 | **描述你想要的解决方案** 26 | 对你希望发生的事情进行清晰、简明的描述。 27 | 28 | **描述你所考虑的替代方案** 29 | 对你考虑过的任何替代性解决方案或功能进行清晰、简明的描述。 30 | 31 | **补充** 32 | 在此添加关于该功能请求的任何其他背景或屏幕截图。 33 | 34 | [] 我已经阅读了相关内容并且描述准确 -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: Build 4 | 5 | # Controls when the workflow will run 6 | on: 7 | push: 8 | tags: 9 | - "v*" 10 | 11 | # Allows you to run this workflow manually from the Actions tab 12 | workflow_dispatch: 13 | 14 | 15 | env: 16 | # APP name 17 | APP_NAME: IceLiveViewer 18 | 19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 20 | jobs: 21 | build-windows: 22 | # The type of runner that the job will run on 23 | runs-on: windows-latest 24 | 25 | # Steps represent a sequence of tasks that will be executed as part of the job 26 | steps: 27 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 28 | - uses: actions/checkout@v2 29 | - uses: subosito/flutter-action@v2 30 | with: 31 | channel: 'stable' 32 | 33 | - name: Build 34 | run: | 35 | flutter config --enable-windows-desktop 36 | flutter pub get 37 | flutter build windows 38 | 39 | - name: Archive Release 40 | uses: thedoctor0/zip-release@master 41 | with: 42 | type: 'zip' 43 | filename: IceLiveViewer-${{github.ref_name}}-windows.zip 44 | directory: build/windows/runner/Release 45 | 46 | - name: Release 47 | uses: softprops/action-gh-release@v1 48 | with: 49 | tag_name: ${{github.ref_name}} 50 | draft: true 51 | prerelease: true 52 | token: ${{ secrets.GITHUB_TOKEN }} 53 | files: | 54 | build/windows/runner/Release/IceLiveViewer-${{github.ref_name}}-windows.zip 55 | 56 | - name: Upload Release Asset 57 | uses: actions/upload-artifact@v3 58 | with: 59 | name: artifact-windows 60 | path: build/windows/runner/Release/IceLiveViewer-${{github.ref_name}}-windows.zip 61 | 62 | 63 | build-android: 64 | # The type of runner that the job will run on 65 | runs-on: ubuntu-latest 66 | 67 | # Steps represent a sequence of tasks that will be executed as part of the job 68 | steps: 69 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 70 | - uses: actions/checkout@v2 71 | 72 | - name: Setup Java to compile Android project 73 | uses: actions/setup-java@v1 74 | with: 75 | java-version: '12.x' 76 | 77 | - name: Setup Flutter 78 | uses: subosito/flutter-action@v2 79 | with: 80 | channel: 'stable' 81 | 82 | - name: Create the Keystore file 83 | env: 84 | KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} 85 | KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} 86 | run: | 87 | # import keystore from secrets 88 | echo $KEYSTORE_BASE64 | base64 -di > android/app/key.jks 89 | echo $KEY_PROPERTIES | base64 -di > android/key.properties 90 | 91 | - name: Build 92 | run: | 93 | flutter pub get 94 | flutter build apk 95 | 96 | - name: Rename APK 97 | run: | 98 | mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/IceLiveViewer-${{github.ref_name}}-android.apk 99 | 100 | 101 | - name: Release 102 | uses: softprops/action-gh-release@v1 103 | with: 104 | tag_name: ${{github.ref_name}} 105 | draft: true 106 | prerelease: true 107 | token: ${{ secrets.GITHUB_TOKEN }} 108 | files: | 109 | build/app/outputs/flutter-apk/IceLiveViewer-${{github.ref_name}}-android.apk 110 | 111 | - name: Upload Release Asset 112 | uses: actions/upload-artifact@v3 113 | with: 114 | name: artifact-android 115 | path: build/app/outputs/flutter-apk/IceLiveViewer-${{github.ref_name}}-android.apk 116 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .classpath 21 | .project 22 | .settings/ 23 | .vscode/ 24 | 25 | # VS related 26 | .vs/ 27 | 28 | # Flutter repo-specific 29 | /bin/cache/ 30 | /bin/internal/bootstrap.bat 31 | /bin/internal/bootstrap.sh 32 | /bin/mingit/ 33 | /dev/benchmarks/mega_gallery/ 34 | /dev/bots/.recipe_deps 35 | /dev/bots/android_tools/ 36 | /dev/devicelab/ABresults*.json 37 | /dev/docs/doc/ 38 | /dev/docs/flutter.docs.zip 39 | /dev/docs/lib/ 40 | /dev/docs/pubspec.yaml 41 | /dev/integration_tests/**/xcuserdata 42 | /dev/integration_tests/**/Pods 43 | /packages/flutter/coverage/ 44 | version 45 | analysis_benchmark.json 46 | 47 | # packages file containing multi-root paths 48 | .packages.generated 49 | 50 | # Flutter/Dart/Pub related 51 | **/doc/api/ 52 | .dart_tool/ 53 | .flutter-plugins 54 | .flutter-plugins-dependencies 55 | **/generated_plugin_registrant.dart 56 | .packages 57 | .pub-cache/ 58 | .pub/ 59 | build/ 60 | flutter_*.png 61 | linked_*.ds 62 | unlinked.ds 63 | unlinked_spec.ds 64 | 65 | # Android related 66 | **/android/**/gradle-wrapper.jar 67 | .gradle/ 68 | **/android/captures/ 69 | **/android/gradlew 70 | **/android/gradlew.bat 71 | **/android/local.properties 72 | **/android/**/GeneratedPluginRegistrant.java 73 | **/android/key.properties 74 | *.jks 75 | 76 | # iOS/XCode related 77 | **/ios/**/*.mode1v3 78 | **/ios/**/*.mode2v3 79 | **/ios/**/*.moved-aside 80 | **/ios/**/*.pbxuser 81 | **/ios/**/*.perspectivev3 82 | **/ios/**/*sync/ 83 | **/ios/**/.sconsign.dblite 84 | **/ios/**/.tags* 85 | **/ios/**/.vagrant/ 86 | **/ios/**/DerivedData/ 87 | **/ios/**/Icon? 88 | **/ios/**/Pods/ 89 | **/ios/**/.symlinks/ 90 | **/ios/**/profile 91 | **/ios/**/xcuserdata 92 | **/ios/.generated/ 93 | **/ios/Flutter/.last_build_id 94 | **/ios/Flutter/App.framework 95 | **/ios/Flutter/Flutter.framework 96 | **/ios/Flutter/Flutter.podspec 97 | **/ios/Flutter/Generated.xcconfig 98 | **/ios/Flutter/ephemeral 99 | **/ios/Flutter/app.flx 100 | **/ios/Flutter/app.zip 101 | **/ios/Flutter/flutter_assets/ 102 | **/ios/Flutter/flutter_export_environment.sh 103 | **/ios/ServiceDefinitions.json 104 | **/ios/Runner/GeneratedPluginRegistrant.* 105 | 106 | # macOS 107 | **/Flutter/ephemeral/ 108 | **/Pods/ 109 | **/macos/Flutter/GeneratedPluginRegistrant.swift 110 | **/macos/Flutter/ephemeral 111 | **/xcuserdata/ 112 | 113 | # Coverage 114 | coverage/ 115 | 116 | # Symbols 117 | app.*.symbols 118 | 119 | # Exceptions to above rules. 120 | !**/ios/**/default.mode1v3 121 | !**/ios/**/default.mode2v3 122 | !**/ios/**/default.pbxuser 123 | !**/ios/**/default.perspectivev3 124 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 125 | !/dev/ci/**/Gemfile.lock 126 | 127 | # npm packages 128 | node_modules/ -------------------------------------------------------------------------------- /.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. 5 | 6 | version: 7 | revision: 135454af32477f815a7525073027a3ff9eff1bfd 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: 135454af32477f815a7525073027a3ff9eff1bfd 17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 18 | - platform: android 19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 21 | - platform: ios 22 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 23 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 24 | - platform: windows 25 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 26 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 27 | 28 | # User provided section 29 | 30 | # List of Local paths (relative to this file) that should be 31 | # ignored by the migrate tool. 32 | # 33 | # Files that are not part of the templates will be ignored by default. 34 | unmanaged_files: 35 | - 'lib/main.dart' 36 | - 'ios/Runner.xcodeproj/project.pbxproj' 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pure Live 2 | 3 | image 4 | 5 | ![](https://img.shields.io/badge/language-dart-blue.svg?style=for-the-badge&color=00ACC1) 6 | ![](https://img.shields.io/badge/flutter-00B0FF?style=for-the-badge&logo=flutter) 7 | [![](https://img.shields.io/github/downloads/Jackiu1997/pure_live/total?style=for-the-badge&color=FF2196)](https://github.com/Jackiu1997/pure_live/releases) 8 | ![](https://img.shields.io/github/license/Jackiu1997/pure_live?style=for-the-badge) 9 | ![](https://img.shields.io/github/stars/Jackiu1997/pure_live?style=for-the-badge) 10 | ![](https://img.shields.io/github/issues/Jackiu1997/pure_live?style=for-the-badge&color=9C27B0) 11 | 12 | Pure Live is a live stream transcoding application based on Flutter for android and windows, which can make you watch lives with ease. All data fetched by local machine, no cloud save, all live data and video belongs to original platform. 13 | 14 | Pure Live是一款款平台基于Flutter的直播转码软件,轻松看直播。所有数据均由本地机器获取,不存储在云端,直播数据、视频版权归原平台所有。 15 | 16 | 目前支持设备: 17 | - Android 18 | - Windows 19 | 20 | ## Windows 安装 21 | 使用 msix 安装请删除 .zip 后缀名。 22 | ![Windows](https://user-images.githubusercontent.com/82752643/221176075-b6604bd4-dd76-4427-8f9c-9a5f33d74620.png) 23 | 24 | 25 | ## 开发进度看板[link](https://jackiu-notes.notion.site/50bc0d3d377445eea029c6e3d4195671?v=663125e639b047cea5e69d8264926b8b) 26 | 27 | ## Screenshots 28 | 29 | ### Mobile UI 30 |
31 | 32 | 33 | 36 | 39 | 42 | 45 | 48 | 49 |
34 | 35 | 37 | 38 | 40 | 41 | 43 | 44 | 46 | 47 |
50 |
51 | 52 | ### Tablet/Desktop UI 53 |
54 | 55 | 56 | 59 | 62 | 65 | 66 |
57 | 58 | 60 | 61 | 63 | 64 |
67 |
68 | 69 | ## Platforms 70 | 71 | - [x] [哔哩哔哩](https://app.bilibili.com/) 72 | 73 | - [x] [虎牙APP](https://www.huya.com/download/) 74 | 75 | - [x] [斗鱼APP](https://www.douyu.com/client) 76 | 77 | ## Donate 78 | 79 | 如果你觉得该项目对您有所帮助,可以打赏一杯咖啡给我,支持我继续开发维护PureLive。 80 | 感谢您的支持~ 81 | 82 |
83 | 84 | 85 | 88 | 91 | 92 |
86 | 87 | 89 | 90 |
93 |
94 | 95 | ## Problems 96 | 97 | ### 问题反馈 98 | 99 | - 如果需要反馈问题,请在Github发布[issue](https://github.com/Jackiu1997/pure_live/issues/new/choose) 100 | 101 | ### 部分链接无法播放 102 | 103 | - 对于部分IP,哔哩哔哩的`.flv`格式的直播流无法播放,尝试使用`.m3u8`格式的直播流 104 | 105 | ### 搜索哔哩哔哩直播间不工作 106 | 107 | - 哔哩哔哩官方搜索接口需要使用cookie,请在设置中自行设置自己的cookie 108 | 109 | ### 不定时更新(随缘开发) 110 | 如果你想要更好的用户体验,更人性化的交互设计,更稳定的使用,可以使用[哔哩哔哩APP](https://app.bilibili.com/),[斗鱼APP](https://www.douyu.com/client),[虎牙APP](https://www.huya.com/download/) 111 | 112 | ## Statement 113 | This project is only for learning and communication. Please do not use it for commercial purposes. The copyright of related resources is owned by the original company. 114 | 115 | 这个项目仅作为个人兴趣业余开发,不用于商业用途。相关资源的版权归原公司所有。 116 | 117 | No user privacy is ever collected, the app directly requests the official interface except for detection updates, and the data generated by all operations is kept locally by the user. 118 | 119 | 本项目是一个纯本地直播转码应用,不会收集任何用户隐私,应用程序直接请求直播官方接口,所有操作生成的数据由用户本地保留。 120 | 121 | ## Thanks 122 | - [ice_live_viewer](https://github.com/iiijam/ice_live_viewer) 123 | - [JustLive-Api](https://github.com/guyijie1211/JustLive-Api) 124 | - [real-url](https://github.com/wbt5/real-url) 125 | - [dart_tars_protocol](https://github.com/xiaoyaocz/dart_tars_protocol) 126 | - [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect) 127 | - [alltv_flutter](https://github.com/Ha2ryZhang/alltv_flutter) 128 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | def keystorePropertiesFile = rootProject.file("key.properties") 29 | def keystoreProperties = new Properties() 30 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 31 | 32 | android { 33 | compileSdkVersion 33 //flutter.compileSdkVersion 34 | ndkVersion "25.1.8937393" //flutter.ndkVersion 35 | 36 | compileOptions { 37 | sourceCompatibility JavaVersion.VERSION_1_8 38 | targetCompatibility JavaVersion.VERSION_1_8 39 | } 40 | 41 | kotlinOptions { 42 | jvmTarget = '1.8' 43 | } 44 | 45 | sourceSets { 46 | main.java.srcDirs += 'src/main/kotlin' 47 | } 48 | 49 | defaultConfig { 50 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 51 | applicationId "com.mystyle.purelive" 52 | // You can update the following values to match your application needs. 53 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 54 | minSdkVersion 21 //flutter.minSdkVersion 55 | targetSdkVersion flutter.targetSdkVersion 56 | versionCode flutterVersionCode.toInteger() 57 | versionName flutterVersionName 58 | // Enabling-multidex-support 59 | multiDexEnabled true 60 | } 61 | 62 | signingConfigs { 63 | release { 64 | keyAlias keystoreProperties['keyAlias'] 65 | keyPassword keystoreProperties['keyPassword'] 66 | storeFile file(keystoreProperties['storeFile']) 67 | storePassword keystoreProperties['storePassword'] 68 | } 69 | } 70 | buildTypes { 71 | release { 72 | // TODO: Add your own signing config for the release build. 73 | // Signing with the debug keys for now, so `flutter run --release` works. 74 | signingConfig signingConfigs.release 75 | minifyEnabled true 76 | proguardFiles getDefaultProguardFile( 77 | 'proguard-android-optimize.txt'), 78 | 'proguard-rules.pro' 79 | } 80 | debug { 81 | signingConfig signingConfigs.release 82 | } 83 | } 84 | } 85 | 86 | flutter { 87 | source '../..' 88 | } 89 | 90 | dependencies { 91 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 92 | } 93 | -------------------------------------------------------------------------------- /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 de.prosiebensat1digital.** { *; } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 19 | 29 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/mystyle/purelive/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mystyle.purelive 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /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-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PureLive 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 纯粹直播 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/PingFangSC.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/PingFangSC.ttf -------------------------------------------------------------------------------- /assets/icons/CustomIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/icons/CustomIcons.ttf -------------------------------------------------------------------------------- /assets/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/icons/icon.png -------------------------------------------------------------------------------- /assets/icons/icon_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/icons/icon_foreground.png -------------------------------------------------------------------------------- /assets/images/alipay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/images/alipay.jpg -------------------------------------------------------------------------------- /assets/images/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/assets/images/wechat.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /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" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/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 | PureLive 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | pure_live 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 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/common/base/base_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:developer'; 3 | 4 | import 'package:flutter/widgets.dart'; 5 | 6 | import 'package:get/get.dart'; 7 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 8 | 9 | class BaseController extends GetxController { 10 | /// 加载中,更新页面 11 | var pageLoadding = false.obs; 12 | 13 | /// 加载中,不会更新页面 14 | var loadding = false; 15 | 16 | /// 空白页面 17 | var pageEmpty = false.obs; 18 | 19 | /// 页面错误 20 | var pageError = false.obs; 21 | 22 | /// 未登录 23 | var notLogin = false.obs; 24 | 25 | /// 错误信息 26 | var errorMsg = "".obs; 27 | 28 | /// 显示错误 29 | /// * [msg] 错误信息 30 | /// * [showPageError] 显示页面错误 31 | /// * 只在第一页加载错误时showPageError=true,后续页加载错误时使用Toast弹出通知 32 | void handleError(Object exception, {bool showPageError = false}) { 33 | log(exception.toString(), stackTrace: StackTrace.current); 34 | var msg = exceptionToString(exception); 35 | 36 | if (showPageError) { 37 | pageError.value = true; 38 | errorMsg.value = msg; 39 | } else { 40 | Get.rawSnackbar(message: exceptionToString(msg)); 41 | } 42 | } 43 | 44 | String exceptionToString(Object exception) { 45 | return exception.toString().replaceAll("Exception:", ""); 46 | } 47 | 48 | void onLogin() {} 49 | void onLogout() {} 50 | } 51 | 52 | class BaseListController extends BaseController { 53 | final ScrollController scrollController = ScrollController(); 54 | final RefreshController refreshController = RefreshController(); 55 | int currentPage = 1; 56 | int count = 0; 57 | int maxPage = 0; 58 | int pageSize = 24; 59 | var canLoadMore = false.obs; 60 | var list = [].obs; 61 | 62 | @override 63 | void onInit() { 64 | super.onInit(); 65 | onRefresh(); 66 | } 67 | 68 | Future onRefresh() async { 69 | currentPage = 1; 70 | list.value = []; 71 | 72 | try { 73 | pageError.value = false; 74 | pageEmpty.value = false; 75 | notLogin.value = false; 76 | pageLoadding.value = currentPage == 1; 77 | 78 | var result = await getData(currentPage, pageSize); 79 | // 是否可以加载更多 80 | if (result.isNotEmpty) { 81 | currentPage++; 82 | canLoadMore.value = true; 83 | pageEmpty.value = false; 84 | refreshController.refreshCompleted(); 85 | } else { 86 | pageEmpty.value = true; 87 | refreshController.refreshFailed(); 88 | } 89 | // 赋值数据 90 | list.value = result; 91 | } catch (e) { 92 | handleError(e, showPageError: currentPage == 1); 93 | refreshController.refreshFailed(); 94 | } finally { 95 | loadding = false; 96 | pageLoadding.value = false; 97 | } 98 | } 99 | 100 | Future onLoading() async { 101 | try { 102 | if (loadding) return; 103 | loadding = true; 104 | pageError.value = false; 105 | pageEmpty.value = false; 106 | notLogin.value = false; 107 | pageLoadding.value = currentPage == 1; 108 | 109 | var result = await getData(currentPage, pageSize); 110 | // 是否可以加载更多 111 | if (result.isNotEmpty) { 112 | currentPage++; 113 | canLoadMore.value = true; 114 | pageEmpty.value = false; 115 | refreshController.loadComplete(); 116 | } else { 117 | canLoadMore.value = false; 118 | pageEmpty.value = currentPage == 1; 119 | refreshController.loadNoData(); 120 | } 121 | // 赋值数据 122 | for (var room in result) { 123 | list.addIf(!list.contains(room), room); 124 | } 125 | } catch (e) { 126 | handleError(e, showPageError: currentPage == 1); 127 | refreshController.loadFailed(); 128 | } finally { 129 | loadding = false; 130 | pageLoadding.value = false; 131 | } 132 | } 133 | 134 | Future> getData(int page, int pageSize) async { 135 | return []; 136 | } 137 | 138 | void scrollToTopOrRefresh() { 139 | if (scrollController.offset > 0) { 140 | scrollController.animateTo( 141 | 0, 142 | duration: const Duration(milliseconds: 200), 143 | curve: Curves.linear, 144 | ); 145 | } else { 146 | refreshController.requestRefresh(); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/common/index.dart: -------------------------------------------------------------------------------- 1 | library common; 2 | 3 | export '../core/index.dart'; 4 | export 'l10n/generated/l10n.dart'; 5 | export 'models/index.dart'; 6 | export 'services/index.dart'; 7 | export 'style/index.dart'; 8 | export 'utils/index.dart'; 9 | export 'widgets/index.dart'; 10 | 11 | export 'package:flutter/material.dart'; 12 | -------------------------------------------------------------------------------- /lib/common/l10n/generated/intl/messages_all.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that looks up messages for specific locales by 3 | // delegating to the appropriate library. 4 | 5 | // Ignore issues from commonly used lints in this file. 6 | // ignore_for_file:implementation_imports, file_names, unnecessary_new 7 | // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering 8 | // ignore_for_file:argument_type_not_assignable, invalid_assignment 9 | // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases 10 | // ignore_for_file:comment_references 11 | 12 | import 'dart:async'; 13 | 14 | import 'package:flutter/foundation.dart'; 15 | import 'package:intl/intl.dart'; 16 | import 'package:intl/message_lookup_by_library.dart'; 17 | import 'package:intl/src/intl_helpers.dart'; 18 | 19 | import 'messages_en.dart' as messages_en; 20 | import 'messages_zh_CN.dart' as messages_zh_cn; 21 | 22 | typedef Future LibraryLoader(); 23 | Map _deferredLibraries = { 24 | 'en': () => new SynchronousFuture(null), 25 | 'zh_CN': () => new SynchronousFuture(null), 26 | }; 27 | 28 | MessageLookupByLibrary? _findExact(String localeName) { 29 | switch (localeName) { 30 | case 'en': 31 | return messages_en.messages; 32 | case 'zh_CN': 33 | return messages_zh_cn.messages; 34 | default: 35 | return null; 36 | } 37 | } 38 | 39 | /// User programs should call this before using [localeName] for messages. 40 | Future initializeMessages(String localeName) { 41 | var availableLocale = Intl.verifiedLocale( 42 | localeName, (locale) => _deferredLibraries[locale] != null, 43 | onFailure: (_) => null); 44 | if (availableLocale == null) { 45 | return new SynchronousFuture(false); 46 | } 47 | var lib = _deferredLibraries[availableLocale]; 48 | lib == null ? new SynchronousFuture(false) : lib(); 49 | initializeInternalMessageLookup(() => new CompositeMessageLookup()); 50 | messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); 51 | return new SynchronousFuture(true); 52 | } 53 | 54 | bool _messagesExistFor(String locale) { 55 | try { 56 | return _findExact(locale) != null; 57 | } catch (e) { 58 | return false; 59 | } 60 | } 61 | 62 | MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { 63 | var actualLocale = 64 | Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); 65 | if (actualLocale == null) return null; 66 | return _findExact(actualLocale); 67 | } 68 | -------------------------------------------------------------------------------- /lib/common/l10n/intl_zh_CN.arb: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "纯粹直播", 3 | "app_legalese": "本项目是一个纯本地直播转码应用,不会收集任何用户隐私,应用程序直接请求直播官方接口,所有操作生成的数据由用户本地保留。", 4 | 5 | "cancel": "取消", 6 | "confirm": "确认", 7 | "update": "更新", 8 | "remove": "删除", 9 | "move_to_top": "移到顶部", 10 | 11 | "favorites_title": "关注", 12 | "empty_favorite_title": "无关注直播", 13 | "empty_favorite_subtitle": "请先关注其他直播间", 14 | "empty_favorite_offline_title": "无未开播直播间", 15 | "empty_favorite_offline_subtitle": "请先关注其他直播间", 16 | "empty_favorite_online_title": "无已开播直播间", 17 | "empty_favorite_online_subtitle": "请先关注其他直播间", 18 | "show_offline_rooms": "显示未直播的直播间", 19 | "hide_offline_rooms": "隐藏未直播的直播间", 20 | "room_info_content": "房间号: {roomid}\n平台: {platform}\n昵称: {nickname}\n标题: {title}\n状态: {livestatus}", 21 | "online_room_title": "已开播", 22 | "offline_room_title": "未开播", 23 | 24 | "popular_title": "热门", 25 | "empty_live_title": "未发现直播", 26 | "empty_live_subtitle": "请点击下方按钮切换平台", 27 | "switch_platform": "切换直播平台", 28 | 29 | "areas_title": "分区", 30 | "empty_areas_title": "未发现分区", 31 | "empty_areas_subtitle": "请点击下方按钮切换平台", 32 | "empty_areas_room_title": "未发现直播", 33 | "empty_areas_room_subtitle": "下滑/上滑刷新数据", 34 | "favorite_areas": "关注分区", 35 | 36 | "search_input_hint": "输入直播关键字", 37 | "only_living": "只搜索直播中", 38 | "empty_search_title": "未发现直播", 39 | "empty_search_subtitle": "请输入其他关键字搜索", 40 | 41 | "settings_title": "设置", 42 | "general": "通用", 43 | "video": "视频", 44 | "custom": "定制", 45 | "experiment": "实验", 46 | 47 | "change_theme_color": "主题颜色", 48 | "change_theme_color_subtitle": "切换软件的主题颜色", 49 | 50 | "change_theme_mode": "主题模式", 51 | "change_theme_mode_subtitle": "切换系统/亮色/暗色模式", 52 | 53 | "change_language": "切换语言", 54 | "change_language_subtitle": "切换软件的显示语言", 55 | 56 | "backup_recover": "备份与恢复", 57 | "backup_recover_subtitle": "创建备份与恢复", 58 | "create_backup" : "创建备份", 59 | "create_backup_subtitle" : "可用于恢复当前数据", 60 | "recover_backup" : "恢复备份", 61 | "recover_backup_subtitle" : "从备份文件中恢复", 62 | "auto_backup" : "自动备份", 63 | "backup_directory" : "备份目录", 64 | "create_backup_success": "创建备份成功", 65 | "create_backup_failed": "创建备份失败", 66 | "select_recover_file": "选择备份文件", 67 | "recover_backup_success": "恢复备份成功,请重启", 68 | "recover_backup_failed": "恢复备份失败", 69 | 70 | "enable_dynamic_color": "动态取色", 71 | "enable_dynamic_color_subtitle": "启用Monet壁纸动态取色", 72 | 73 | "enable_dense_favorites_mode": "紧凑模式", 74 | "enable_dense_favorites_mode_subtitle": "关注页面可显示更多直播间", 75 | 76 | "enable_background_play": "后台播放", 77 | "enable_background_play_subtitle": "当暂时切出APP时,允许后台播放", 78 | 79 | "enable_screen_keep_on": "屏幕常亮", 80 | "enable_screen_keep_on_subtitle": "当处于直播播放页,屏幕保持常亮", 81 | 82 | "enable_fullscreen_default": "自动全屏", 83 | "enable_fullscreen_default_subtitle": "当进入直播播放页,自动进入全屏", 84 | 85 | "enable_auto_check_update": "自动检查更新", 86 | "enable_auto_check_update_subtitle": "在每次进入软件时,自动检查更新", 87 | 88 | "float_overlay_ratio": "悬浮窗尺寸", 89 | "float_overlay_ratio_subtitle": "视频小窗播放时,悬浮窗横向相对比例", 90 | 91 | "prefer_platform": "首选直播平台", 92 | "prefer_platform_subtitle": "当进入热门/分区,首选的直播平台", 93 | 94 | "prefer_resolution": "首选清晰度", 95 | "prefer_resolution_subtitle": "当进入直播播放页,首选的视频清晰度", 96 | 97 | "auto_refresh_time": "定时刷新时间", 98 | "auto_refresh_time_subtitle": "定时刷新关注直播间状态", 99 | 100 | "about": "关于", 101 | "version": "版本", 102 | "what_is_new": "最新特性", 103 | "check_update": "检查更新", 104 | "new_version_info": "发现新版本: v{version}", 105 | "no_new_version_info": "已在使用最新版本", 106 | "license": "开源许可证", 107 | "project": "项目", 108 | "support_donate": "捐赠支持", 109 | "issue_feedback": "问题反馈", 110 | "develop_progress": "开发进度", 111 | "project_page": "项目主页", 112 | "project_alert" : "项目声明", 113 | "contact": "联系", 114 | "qq_group": "QQ群", 115 | "qq_group_num": "群号: {number}", 116 | "telegram": "Telegram", 117 | "email": "邮件", 118 | "github": "Github", 119 | 120 | "help": "帮助", 121 | 122 | "settings_timedclose_title": "定时关闭", 123 | "timedclose_time": "{time} 分钟", 124 | 125 | "settings_videofit_title": "比例设置", 126 | "videofit_contain": "默认比例", 127 | "videofit_fill": "填充屏幕", 128 | "videofit_cover": "居中裁剪", 129 | "videofit_fitwidth": "适应宽度", 130 | "videofit_fitheight": "适应高度", 131 | 132 | "settings_danmaku_title": "弹幕设置", 133 | "settings_danmaku_area": "弹幕区域", 134 | "settings_danmaku_opacity": "不透明度", 135 | "settings_danmaku_speed": "弹幕速度", 136 | "settings_danmaku_fontsize": "弹幕字号", 137 | "settings_danmaku_fontBorder": "描边宽度", 138 | "settings_danmaku_amount": "弹幕数量", 139 | 140 | "follow": "关注", 141 | "unfollow": "取消关注", 142 | "unfollow_message": "确定要取消关注{name}吗?", 143 | "followed": "已关注", 144 | "offline": "未直播", 145 | "info_is_offline": "{name}未开始直播.", 146 | "info_is_replay": "{name}轮播视频中.", 147 | 148 | "float_window_play": "小窗播放", 149 | "dlan_button_info": "DLNA投屏", 150 | "dlan_title": "DLNA投屏", 151 | "dlan_device_not_found": "未发现DLNA设备", 152 | 153 | "play_video_failed": "无法播放直播", 154 | "retry": "重试", 155 | "replay": "录播", 156 | 157 | 158 | "history": "历史记录", 159 | "empty_history": "无观看历史记录" 160 | } -------------------------------------------------------------------------------- /lib/common/models/index.dart: -------------------------------------------------------------------------------- 1 | library models; 2 | 3 | export 'live_room.dart'; 4 | export 'live_area.dart'; 5 | export './live_message.dart'; 6 | -------------------------------------------------------------------------------- /lib/common/models/live_area.dart: -------------------------------------------------------------------------------- 1 | class LiveArea { 2 | String platform = ''; 3 | String areaType = ''; 4 | String typeName = ''; 5 | String areaId = ''; 6 | String areaName = ''; 7 | String areaPic = ''; 8 | String shortName = ''; 9 | 10 | LiveArea(); 11 | 12 | LiveArea.fromJson(Map json) 13 | : platform = json['platform'] ?? '', 14 | areaType = json['areaType'] ?? '', 15 | typeName = json['typeName'] ?? '', 16 | areaId = json['areaId'] ?? '', 17 | areaName = json['areaName'] ?? '', 18 | areaPic = json['areaPic'] ?? '', 19 | shortName = json['shortName'] ?? ''; 20 | 21 | Map toJson() => { 22 | 'platform': platform, 23 | 'areaType': areaType, 24 | 'typeName': typeName, 25 | 'areaId': areaId, 26 | 'areaName': areaName, 27 | 'areaPic': areaPic, 28 | 'shortName': shortName, 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /lib/common/models/live_message.dart: -------------------------------------------------------------------------------- 1 | enum LiveMessageType { 2 | /// 聊天 3 | chat, 4 | 5 | /// 礼物,暂时不支持 6 | gift, 7 | 8 | /// 在线人数 9 | online, 10 | 11 | /// 醒目留言 12 | superChat, 13 | } 14 | 15 | class LiveMessage { 16 | /// 消息类型 17 | final LiveMessageType type; 18 | 19 | /// 用户名 20 | final String userName; 21 | 22 | /// 信息 23 | final String message; 24 | 25 | /// 数据 26 | /// 单Type=Online时,Data为人气值(long) 27 | final dynamic data; 28 | 29 | /// 弹幕颜色 30 | final LiveMessageColor color; 31 | LiveMessage({ 32 | required this.type, 33 | required this.userName, 34 | required this.message, 35 | this.data, 36 | required this.color, 37 | }); 38 | } 39 | 40 | class LiveMessageColor { 41 | final int r, g, b; 42 | LiveMessageColor(this.r, this.g, this.b); 43 | static LiveMessageColor get white => LiveMessageColor(255, 255, 255); 44 | static LiveMessageColor numberToColor(int intColor) { 45 | var obj = intColor.toRadixString(16); 46 | 47 | LiveMessageColor color = LiveMessageColor.white; 48 | if (obj.length == 4) { 49 | obj = "00$obj"; 50 | } 51 | if (obj.length == 6) { 52 | var R = int.parse(obj.substring(0, 2), radix: 16); 53 | var G = int.parse(obj.substring(2, 4), radix: 16); 54 | var B = int.parse(obj.substring(4, 6), radix: 16); 55 | 56 | color = LiveMessageColor(R, G, B); 57 | } 58 | if (obj.length == 8) { 59 | var R = int.parse(obj.substring(2, 4), radix: 16); 60 | var G = int.parse(obj.substring(4, 6), radix: 16); 61 | var B = int.parse(obj.substring(6, 8), radix: 16); 62 | //var A = int.parse(obj.substring(0, 2), radix: 16); 63 | color = LiveMessageColor(R, G, B); 64 | } 65 | 66 | return color; 67 | } 68 | 69 | @override 70 | String toString() { 71 | return "#${r.toRadixString(16).padLeft(2, '0')}${g.toRadixString(16).padLeft(2, '0')}${b.toRadixString(16).padLeft(2, '0')}"; 72 | } 73 | } 74 | 75 | class LiveSuperChatMessage { 76 | final String userName; 77 | final String face; 78 | final String message; 79 | final int price; 80 | final DateTime startTime; 81 | final DateTime endTime; 82 | final String backgroundColor; 83 | final String backgroundBottomColor; 84 | LiveSuperChatMessage({ 85 | required this.backgroundBottomColor, 86 | required this.backgroundColor, 87 | required this.endTime, 88 | required this.face, 89 | required this.message, 90 | required this.price, 91 | required this.startTime, 92 | required this.userName, 93 | }); 94 | } 95 | -------------------------------------------------------------------------------- /lib/common/models/live_room.dart: -------------------------------------------------------------------------------- 1 | enum LiveStatus { live, offline, replay, unknown } 2 | 3 | enum Platforms { huya, bilibili, douyu, unknown } 4 | 5 | class LiveRoom { 6 | String roomId; 7 | String userId = ''; 8 | String link = ''; 9 | String title = ''; 10 | String nick = ''; 11 | String avatar = ''; 12 | String cover = ''; 13 | String area = ''; 14 | String watching = ''; 15 | String followers = ''; 16 | String platform = 'UNKNOWN'; 17 | LiveStatus liveStatus = LiveStatus.unknown; 18 | 19 | LiveRoom(this.roomId); 20 | 21 | LiveRoom.fromJson(Map json) 22 | : roomId = json['roomId'] ?? '', 23 | userId = json['userId'] ?? '', 24 | title = json['title'] ?? '', 25 | link = json['link'] ?? '', 26 | nick = json['nick'] ?? '', 27 | avatar = json['avatar'] ?? '', 28 | cover = json['cover'] ?? '', 29 | area = json['area'] ?? '', 30 | watching = json['watching'] ?? '', 31 | followers = json['followers'] ?? '', 32 | platform = json['platform'] ?? '', 33 | liveStatus = LiveStatus.values[json['liveStatus']]; 34 | 35 | Map toJson() => { 36 | 'roomId': roomId, 37 | 'userId': userId, 38 | 'title': title, 39 | 'nick': nick, 40 | 'avatar': avatar, 41 | 'cover': cover, 42 | 'area': area, 43 | 'watching': watching, 44 | 'followers': followers, 45 | 'platform': platform, 46 | 'liveStatus': liveStatus.index 47 | }; 48 | 49 | @override 50 | bool operator ==(covariant LiveRoom other) => 51 | platform == other.platform && roomId == other.roomId; 52 | 53 | @override 54 | int get hashCode => int.parse(roomId); 55 | } 56 | -------------------------------------------------------------------------------- /lib/common/services/index.dart: -------------------------------------------------------------------------------- 1 | library services; 2 | 3 | export './settings_service.dart'; 4 | -------------------------------------------------------------------------------- /lib/common/style/index.dart: -------------------------------------------------------------------------------- 1 | library style; 2 | 3 | export './theme.dart'; 4 | -------------------------------------------------------------------------------- /lib/common/style/theme.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | class MyTheme { 6 | Color? primaryColor; 7 | ColorScheme? colorScheme; 8 | String? fontFamily; 9 | 10 | MyTheme({ 11 | this.primaryColor, 12 | this.colorScheme, 13 | }) : assert(colorScheme == null || primaryColor == null); 14 | 15 | get lightThemeData { 16 | if (Platform.isWindows) { 17 | fontFamily = 'PingFang'; 18 | } 19 | return ThemeData( 20 | useMaterial3: true, 21 | colorSchemeSeed: primaryColor, 22 | colorScheme: colorScheme, 23 | brightness: Brightness.light, 24 | fontFamily: fontFamily, 25 | ); 26 | } 27 | 28 | get darkThemeData { 29 | if (Platform.isWindows) { 30 | fontFamily = 'PingFang'; 31 | } 32 | return ThemeData( 33 | useMaterial3: true, 34 | colorSchemeSeed: primaryColor, 35 | colorScheme: colorScheme?.copyWith( 36 | error: const Color.fromARGB(255, 255, 99, 71), 37 | ), 38 | brightness: Brightness.dark, 39 | fontFamily: fontFamily, 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/common/utils/cache_manager.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: implementation_imports 2 | import 'package:path/path.dart' as p; 3 | import 'package:file/local.dart'; 4 | import 'package:path_provider/path_provider.dart'; 5 | import 'package:flutter_cache_manager/flutter_cache_manager.dart'; 6 | import 'package:flutter_cache_manager/src/storage/file_system/file_system_io.dart'; 7 | 8 | class CustomCacheManager { 9 | static const key = 'customCacheKey'; 10 | 11 | static CacheManager instance = CacheManager( 12 | Config( 13 | key, 14 | stalePeriod: const Duration(days: 7), 15 | maxNrOfCacheObjects: 20, 16 | repo: JsonCacheInfoRepository(databaseName: key), 17 | fileSystem: IOFileSystem(key), 18 | fileService: HttpFileService(), 19 | ), 20 | ); 21 | 22 | static Future cacheSize() async { 23 | var baseDir = await getTemporaryDirectory(); 24 | var path = p.join(baseDir.path, key); 25 | 26 | var fs = const LocalFileSystem(); 27 | var directory = fs.directory((path)); 28 | return (await directory.stat()).size / 8 / 1000; 29 | } 30 | 31 | static Future clearCache() async { 32 | var baseDir = await getTemporaryDirectory(); 33 | var path = p.join(baseDir.path, key); 34 | 35 | var fs = const LocalFileSystem(); 36 | var directory = fs.directory((path)); 37 | await directory.delete(recursive: true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/common/utils/index.dart: -------------------------------------------------------------------------------- 1 | library utils; 2 | 3 | export './text_util.dart'; 4 | export './pref_util.dart'; 5 | export './version_util.dart'; 6 | export './cache_manager.dart'; 7 | export './snackbar_util.dart'; 8 | export './js_engine.dart'; 9 | -------------------------------------------------------------------------------- /lib/common/utils/js_engine.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_js/flutter_js.dart'; 3 | 4 | class JsEngine { 5 | static JavascriptRuntime? _jsRuntime; 6 | static JavascriptRuntime get jsRuntime => _jsRuntime!; 7 | 8 | static void init() { 9 | _jsRuntime ??= getJavascriptRuntime(); 10 | jsRuntime.enableHandlePromises(); 11 | loadPackages(); 12 | } 13 | 14 | static Future loadPackages() async { 15 | final cryptojs = await rootBundle.loadString('assets/crypto-js.js'); 16 | jsRuntime.evaluate(cryptojs); 17 | } 18 | 19 | static JsEvalResult evaluate(String code) { 20 | return jsRuntime.evaluate(code); 21 | } 22 | 23 | static Future evaluateAsync(String code) { 24 | return jsRuntime.evaluateAsync(code); 25 | } 26 | 27 | static dynamic onMessage(String channelName, dynamic Function(dynamic) fn) { 28 | return jsRuntime.onMessage(channelName, (args) => null); 29 | } 30 | 31 | static dynamic sendMessage({ 32 | required String channelName, 33 | required List args, 34 | String? uuid, 35 | }) { 36 | return jsRuntime.sendMessage(channelName: channelName, args: args); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/common/utils/pref_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | ///This is the new util class for the shared preferences. 4 | /// 5 | ///And the old `storage.dart` will be deprecated. 6 | class PrefUtil { 7 | static late SharedPreferences prefs; 8 | 9 | static dynamic getAnyPref(String key) { 10 | return prefs.get(key); 11 | } 12 | 13 | static void setAnyPref(String key, dynamic value) { 14 | if (value is String) { 15 | prefs.setString(key, value); 16 | } else if (value is int) { 17 | prefs.setInt(key, value); 18 | } else if (value is bool) { 19 | prefs.setBool(key, value); 20 | } else if (value is double) { 21 | prefs.setDouble(key, value); 22 | } else if (value is List) { 23 | prefs.setStringList(key, value); 24 | } 25 | } 26 | 27 | static bool? getBool(String key) { 28 | return prefs.getBool(key); 29 | } 30 | 31 | static Future setBool(String key, bool value) { 32 | return prefs.setBool(key, value); 33 | } 34 | 35 | static int? getInt(String key) { 36 | return prefs.getInt(key); 37 | } 38 | 39 | static Future setInt(String key, int value) { 40 | return prefs.setInt(key, value); 41 | } 42 | 43 | static String? getString(String key) { 44 | return prefs.getString(key); 45 | } 46 | 47 | static Future setString(String key, String value) { 48 | return prefs.setString(key, value); 49 | } 50 | 51 | static double? getDouble(String key) { 52 | return prefs.getDouble(key); 53 | } 54 | 55 | static Future setDouble(String key, double value) { 56 | return prefs.setDouble(key, value); 57 | } 58 | 59 | static List? getStringList(String key) { 60 | return prefs.getStringList(key); 61 | } 62 | 63 | static Future setStringList(String key, List value) { 64 | return prefs.setStringList(key, value); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/common/utils/snackbar_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | class SnackBarUtil { 4 | static void success(String text) { 5 | Get.snackbar( 6 | 'Success', 7 | text, 8 | duration: const Duration(seconds: 2), 9 | backgroundColor: Get.theme.colorScheme.surfaceVariant, 10 | colorText: Get.theme.colorScheme.onSurfaceVariant, 11 | snackPosition: SnackPosition.BOTTOM, 12 | ); 13 | } 14 | 15 | static void error(String text) { 16 | Get.snackbar( 17 | 'Error', 18 | text, 19 | duration: const Duration(seconds: 2), 20 | backgroundColor: Get.theme.colorScheme.errorContainer, 21 | colorText: Get.theme.colorScheme.onErrorContainer, 22 | snackPosition: SnackPosition.BOTTOM, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/common/utils/text_util.dart: -------------------------------------------------------------------------------- 1 | String readableCount(String info) { 2 | try { 3 | int count = int.parse(info); 4 | if (count > 10000) { 5 | return '${(count / 10000).toStringAsFixed(1)}万'; 6 | } 7 | } catch (e) { 8 | return info; 9 | } 10 | return info; 11 | } 12 | -------------------------------------------------------------------------------- /lib/common/utils/version_util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:http/http.dart' as http; 3 | 4 | class VersionUtil { 5 | static const String version = '1.1.0'; 6 | static const String projectUrl = 'https://github.com/Jackiu1997/pure_live'; 7 | static const String releaseUrl = 8 | 'https://api.github.com/repos/Jackiu1997/pure_live/releases'; 9 | static const String issuesUrl = 10 | 'https://github.com/Jackiu1997/pure_live/issues'; 11 | static const String kanbanUrl = 12 | 'https://jackiu-notes.notion.site/50bc0d3d377445eea029c6e3d4195671?v=663125e639b047cea5e69d8264926b8b'; 13 | 14 | static const String githubUrl = 'https://github.com/Jackiu1997'; 15 | static const String email = 'jackiu1997@gmail.com'; 16 | static const String emailUrl = 17 | 'mailto:jackiu1997@gmail.com?subject=PureLive Feedback'; 18 | static const String telegramGroup = 't.me/pure_live_channel'; 19 | static const String telegramGroupUrl = 'https://t.me/pure_live_channel'; 20 | 21 | static String latestVersion = version; 22 | static String latestUpdateLog = ''; 23 | 24 | static Future checkUpdate() async { 25 | try { 26 | var response = await http.get(Uri.parse(releaseUrl)); 27 | var latest = (await jsonDecode(response.body))[0]; 28 | latestVersion = latest['tag_name'].replaceAll('v', ''); 29 | latestUpdateLog = latest['body']; 30 | } catch (e) { 31 | latestUpdateLog = e.toString(); 32 | } 33 | } 34 | 35 | static bool hasNewVersion() { 36 | List latestVersions = latestVersion.split('-')[0].split('.'); 37 | List versions = version.split('-')[0].split('.'); 38 | for (int i = 0; i < latestVersions.length; i++) { 39 | if (int.parse(latestVersions[i]) > int.parse(versions[i])) { 40 | return true; 41 | } else if (int.parse(latestVersions[i]) < int.parse(versions[i])) { 42 | return false; 43 | } 44 | } 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/common/widgets/custom_icons.dart: -------------------------------------------------------------------------------- 1 | /// Flutter icons CustomIcons 2 | /// Copyright (C) 2023 by original authors @ fluttericon.com, fontello.com 3 | /// This font was generated by FlutterIcon.com, which is derived from Fontello. 4 | /// 5 | /// To use this font, place it in your fonts/ directory and include the 6 | /// following in your pubspec.yaml 7 | /// 8 | /// flutter: 9 | /// fonts: 10 | /// - family: CustomIcons 11 | /// fonts: 12 | /// - asset: fonts/CustomIcons.ttf 13 | /// 14 | /// 15 | /// * Font Awesome 5, Copyright (C) 2016 by Dave Gandy 16 | /// Author: Dave Gandy 17 | /// License: SIL (https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt) 18 | /// Homepage: http://fortawesome.github.com/Font-Awesome/ 19 | /// * Font Awesome 4, Copyright (C) 2016 by Dave Gandy 20 | /// Author: Dave Gandy 21 | /// License: SIL () 22 | /// Homepage: http://fortawesome.github.com/Font-Awesome/ 23 | /// 24 | // ignore_for_file: constant_identifier_names 25 | 26 | import 'package:flutter/widgets.dart'; 27 | 28 | class CustomIcons { 29 | CustomIcons._(); 30 | 31 | static const _kFontFam = 'CustomIcons'; 32 | static const String? _kFontPkg = null; 33 | 34 | static const IconData danmaku_close = 35 | IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); 36 | static const IconData danmaku_open = 37 | IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); 38 | static const IconData danmaku_setting = 39 | IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); 40 | static const IconData popular = 41 | IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); 42 | static const IconData search = 43 | IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); 44 | static const IconData qq_1 = 45 | IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); 46 | static const IconData float_window = 47 | IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); 48 | static const IconData cast = 49 | IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); 50 | static const IconData github_circled = 51 | IconData(0xf09b, fontFamily: _kFontFam, fontPackage: _kFontPkg); 52 | static const IconData mail_squared = 53 | IconData(0xf199, fontFamily: _kFontFam, fontPackage: _kFontPkg); 54 | static const IconData wechat = 55 | IconData(0xf1d7, fontFamily: _kFontFam, fontPackage: _kFontPkg); 56 | static const IconData telegram = 57 | IconData(0xf2c6, fontFamily: _kFontFam, fontPackage: _kFontPkg); 58 | static const IconData alipay = 59 | IconData(0xf642, fontFamily: _kFontFam, fontPackage: _kFontPkg); 60 | } 61 | -------------------------------------------------------------------------------- /lib/common/widgets/empty_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class EmptyView extends StatelessWidget { 4 | const EmptyView({ 5 | Key? key, 6 | required this.icon, 7 | required this.title, 8 | required this.subtitle, 9 | }) : super(key: key); 10 | 11 | final IconData icon; 12 | final String title; 13 | final String subtitle; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | final color = Theme.of(context).disabledColor; 18 | return Center( 19 | child: Column( 20 | crossAxisAlignment: CrossAxisAlignment.center, 21 | mainAxisSize: MainAxisSize.min, 22 | mainAxisAlignment: MainAxisAlignment.center, 23 | children: [ 24 | Icon(icon, size: 144, color: color), 25 | const SizedBox(height: 24), 26 | Text.rich( 27 | TextSpan(children: [ 28 | TextSpan( 29 | text: "$title\n", 30 | style: Theme.of(context) 31 | .textTheme 32 | .headlineMedium 33 | ?.copyWith(color: color)), 34 | TextSpan( 35 | text: "\n$subtitle", 36 | style: Theme.of(context) 37 | .textTheme 38 | .titleSmall 39 | ?.copyWith(color: color)), 40 | ]), 41 | textAlign: TextAlign.center, 42 | ), 43 | const SizedBox(height: 32), 44 | ], 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/common/widgets/index.dart: -------------------------------------------------------------------------------- 1 | library widgets; 2 | 3 | export './room_card.dart'; 4 | export './empty_view.dart'; 5 | export './custom_icons.dart'; 6 | export './menu_button.dart'; 7 | export './search_button.dart'; 8 | export './section_listtile.dart'; 9 | -------------------------------------------------------------------------------- /lib/common/widgets/menu_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | import '../../routes/app_pages.dart'; 5 | 6 | class MenuButton extends StatelessWidget { 7 | const MenuButton({Key? key}) : super(key: key); 8 | 9 | final menuRoutes = const [ 10 | AppPages.settings, 11 | AppPages.about, 12 | AppPages.contact, 13 | AppPages.history, 14 | ]; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return PopupMenuButton( 19 | tooltip: 'menu', 20 | shape: RoundedRectangleBorder( 21 | borderRadius: BorderRadius.circular(8), 22 | ), 23 | offset: const Offset(12, 0), 24 | position: PopupMenuPosition.under, 25 | icon: const Icon(Icons.menu_rounded), 26 | onSelected: (int index) => Get.toNamed(menuRoutes[index]), 27 | itemBuilder: (context) => [ 28 | PopupMenuItem( 29 | value: 0, 30 | padding: const EdgeInsets.symmetric(horizontal: 12), 31 | child: MenuListTile( 32 | leading: const Icon(Icons.settings_rounded), 33 | text: S.of(context).settings_title, 34 | ), 35 | ), 36 | PopupMenuItem( 37 | value: 1, 38 | padding: const EdgeInsets.symmetric(horizontal: 12), 39 | child: MenuListTile( 40 | leading: const Icon(Icons.info_rounded), 41 | text: S.of(context).about, 42 | ), 43 | ), 44 | PopupMenuItem( 45 | value: 2, 46 | padding: const EdgeInsets.symmetric(horizontal: 12), 47 | child: MenuListTile( 48 | leading: const Icon(Icons.contact_support), 49 | text: S.of(context).contact, 50 | ), 51 | ),PopupMenuItem( 52 | value: 3, 53 | padding: const EdgeInsets.symmetric(horizontal: 12), 54 | child: MenuListTile( 55 | leading: const Icon(Icons.history), 56 | text: S.of(context).history, 57 | ), 58 | ), 59 | ], 60 | ); 61 | } 62 | } 63 | 64 | class MenuListTile extends StatelessWidget { 65 | final Widget? leading; 66 | final String text; 67 | final Widget? trailing; 68 | 69 | const MenuListTile({ 70 | Key? key, 71 | required this.leading, 72 | required this.text, 73 | this.trailing, 74 | }) : super(key: key); 75 | 76 | @override 77 | Widget build(BuildContext context) { 78 | return Row( 79 | children: [ 80 | if (leading != null) ...[ 81 | leading!, 82 | const SizedBox(width: 12), 83 | ], 84 | Text( 85 | text, 86 | style: Theme.of(context).textTheme.labelMedium, 87 | ), 88 | if (trailing != null) ...[ 89 | const SizedBox(width: 24), 90 | trailing!, 91 | ], 92 | ], 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/common/widgets/search_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | import '../../routes/app_pages.dart'; 5 | 6 | class SearchButton extends StatelessWidget { 7 | const SearchButton({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return IconButton( 12 | onPressed: () => Get.toNamed(AppPages.search), 13 | icon: const Icon(CustomIcons.search), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/common/widgets/section_listtile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CupertinoSwitchListTile extends StatelessWidget { 5 | const CupertinoSwitchListTile({ 6 | Key? key, 7 | required this.value, 8 | required this.onChanged, 9 | this.leading, 10 | this.title, 11 | this.subtitle, 12 | this.activeColor, 13 | }) : super(key: key); 14 | 15 | final Widget? leading; 16 | final Widget? title; 17 | final Widget? subtitle; 18 | final Color? activeColor; 19 | final bool value; 20 | final void Function(bool)? onChanged; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return ListTile( 25 | leading: leading, 26 | title: title, 27 | subtitle: subtitle, 28 | onTap: () { 29 | if (onChanged != null) onChanged!(!value); 30 | }, 31 | trailing: CupertinoSwitch( 32 | value: value, 33 | activeColor: activeColor, 34 | onChanged: onChanged, 35 | ), 36 | ); 37 | } 38 | } 39 | 40 | class SectionTitle extends StatelessWidget { 41 | final String title; 42 | 43 | const SectionTitle({ 44 | required this.title, 45 | Key? key, 46 | }) : super(key: key); 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | return ListTile( 51 | contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), 52 | title: Text( 53 | title, 54 | style: Theme.of(context).textTheme.headlineSmall?.copyWith( 55 | color: Theme.of(context).colorScheme.primary, 56 | fontWeight: FontWeight.w500, 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/core/common/binary_writer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | class BinaryWriter { 4 | List buffer; 5 | int position = 0; 6 | BinaryWriter(this.buffer); 7 | int get length => buffer.length; 8 | 9 | void writeBytes(List list) { 10 | buffer.addAll(list); 11 | position += list.length; 12 | } 13 | 14 | void writeInt(int value, int len, {Endian endian = Endian.big}) { 15 | var b = Uint8List(len).buffer; 16 | var bytes = ByteData.view(b); 17 | if (len == 1) { 18 | //写入byte 19 | bytes.setUint8(0, value.toUnsigned(8)); 20 | } 21 | if (len == 2) { 22 | bytes.setInt16(0, value, endian); 23 | } 24 | if (len == 4) { 25 | bytes.setInt32(0, value, endian); 26 | } 27 | if (len == 8) { 28 | bytes.setInt64(0, value, endian); 29 | } 30 | 31 | buffer.addAll(bytes.buffer.asUint8List()); 32 | position += len; 33 | } 34 | 35 | void writeDouble(double value, int len, {Endian endian = Endian.big}) { 36 | var b = Uint8List(len).buffer; 37 | var bytes = ByteData.view(b); 38 | 39 | if (len == 4) { 40 | bytes.setFloat32(0, value, endian); 41 | } 42 | if (len == 8) { 43 | bytes.setFloat64(0, value, endian); 44 | } 45 | 46 | buffer.addAll(bytes.buffer.asUint8List()); 47 | position += len; 48 | } 49 | } 50 | 51 | class BinaryReader { 52 | Uint8List buffer; 53 | int position = 0; 54 | BinaryReader(this.buffer); 55 | int get length => buffer.length; 56 | 57 | /// 从当前流中读取下一个字节,并使流的当前位置提升 1 个字节 58 | /// 返回下一个字节(0-255) 59 | int read() { 60 | var byte = buffer[position]; 61 | position += 1; 62 | return byte; 63 | } 64 | 65 | /// 从当前流中读取指定长度的字节整数,并使流的当前位置提升指定长度。 66 | /// [len] 指定长度 67 | /// len=1为int8,2为int16,4为int32,8为int64。dart中统一为int类型 68 | /// 返回整数 69 | int readInt(int len, {Endian endian = Endian.big}) { 70 | var result = 0; 71 | // if (len == 1) { 72 | // result = buffer[position]; 73 | // position += len; 74 | // return result; 75 | // } 76 | var bytes = 77 | Uint8List.fromList(buffer.getRange(position, position + len).toList()); 78 | var byteBuffer = bytes.buffer; 79 | var data = ByteData.view(byteBuffer); 80 | if (len == 1) { 81 | result = data.getUint8(0); 82 | } 83 | if (len == 2) { 84 | result = data.getInt16(0, endian); 85 | } 86 | if (len == 4) { 87 | result = data.getInt32(0, endian); 88 | } 89 | if (len == 8) { 90 | result = data.getInt64(0, endian); 91 | } 92 | position += len; 93 | return result; 94 | } 95 | 96 | /// 读取字节 97 | /// int长度=1 98 | int readByte({Endian endian = Endian.big}) { 99 | return readInt(1, endian: endian); 100 | } 101 | 102 | /// 读取 103 | /// int长度=2 104 | int readShort({Endian endian = Endian.big}) { 105 | return readInt(2, endian: endian); 106 | } 107 | 108 | /// 读取字节 109 | /// int长度=4 110 | int readInt32({Endian endian = Endian.big}) { 111 | return readInt(4, endian: endian); 112 | } 113 | 114 | /// 读取字节 115 | /// int长度=8 116 | int readLong({Endian endian = Endian.big}) { 117 | return readInt(8, endian: endian); 118 | } 119 | 120 | /// 从当前流中读取指定长度的字节数组,并使流的当前位置提升指定长度。 121 | /// [len] 指定长度 122 | /// 返回字节数组 123 | Uint8List readBytes(int len) { 124 | var bytes = 125 | Uint8List.fromList(buffer.getRange(position, position + len).toList()); 126 | position += len; 127 | return bytes; 128 | } 129 | 130 | /// 从当前流中读取指定长度的字节浮点数,并使流的当前位置提升指定长度。 131 | /// [len] 指定长度 132 | /// len=4为float,8为double。dart中统一为double类型 133 | /// 返回浮点数 134 | double readFloat(int len, {Endian endian = Endian.big}) { 135 | var result = 0.0; 136 | var bytes = 137 | Uint8List.fromList(buffer.getRange(position, position + len).toList()); 138 | var byteBuffer = bytes.buffer; 139 | var data = ByteData.view(byteBuffer); 140 | if (len == 4) { 141 | result = data.getFloat32(0, endian); 142 | } 143 | if (len == 8) { 144 | result = data.getFloat64(0, endian); 145 | } 146 | position += len; 147 | return result; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/core/common/websocket_utils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:web_socket_channel/io.dart'; 4 | 5 | enum SocketStatus { 6 | connected, 7 | failed, 8 | closed, 9 | } 10 | 11 | class WebScoketUtils { 12 | SocketStatus status = SocketStatus.closed; 13 | 14 | /// 链接 15 | final String url; 16 | 17 | /// 心跳时间 18 | final int heartBeatTime; 19 | 20 | /// 接收到信息 21 | final Function(dynamic)? onMessage; 22 | 23 | /// 连接关闭 24 | final Function(String msg)? onClose; 25 | 26 | /// 尝试重连 27 | final Function()? onReconnect; 28 | 29 | /// 准备就绪 30 | final Function()? onReady; 31 | 32 | /// 心跳 33 | final Function()? onHeartBeat; 34 | 35 | /// 请求头 36 | Map? headers; 37 | WebScoketUtils({ 38 | required this.url, 39 | required this.heartBeatTime, 40 | this.onMessage, 41 | this.onClose, 42 | this.onReconnect, 43 | this.onReady, 44 | this.onHeartBeat, 45 | this.headers, 46 | }); 47 | IOWebSocketChannel? webSocket; 48 | Timer? heartBeatTimer; 49 | 50 | /// 重连次数 51 | int reconnectTime = 0; 52 | Timer? reconnectTimer; 53 | 54 | /// 最大重连次数 55 | int maxReconnectTime = 5; 56 | 57 | StreamSubscription? streamSubscription; 58 | 59 | void connect() async { 60 | close(); 61 | try { 62 | webSocket = IOWebSocketChannel.connect( 63 | url, 64 | connectTimeout: const Duration(seconds: 10), 65 | headers: headers, 66 | ); 67 | 68 | await webSocket?.ready; 69 | reday(); 70 | } catch (e) { 71 | onError(e, e); 72 | } 73 | } 74 | 75 | /// 连接完成 76 | void reday() { 77 | status = SocketStatus.connected; 78 | 79 | streamSubscription = webSocket?.stream.listen( 80 | (data) => receiveMessage(data), 81 | onError: (e, s) => onError(e, s), 82 | onDone: onDone, 83 | ); 84 | 85 | onReady?.call(); 86 | initHeartBeat(); 87 | } 88 | 89 | void initHeartBeat() { 90 | heartBeatTimer = Timer.periodic( 91 | Duration(milliseconds: heartBeatTime), 92 | (timer) { 93 | onHeartBeat?.call(); 94 | }, 95 | ); 96 | } 97 | 98 | void receiveMessage(dynamic data) { 99 | //接受到一条信息才算重连成功 100 | reconnectTime = 0; 101 | onMessage?.call(data); 102 | } 103 | 104 | void onError(e, s) { 105 | status = SocketStatus.failed; 106 | onClose?.call(e.toString()); 107 | } 108 | 109 | void onDone() { 110 | if (status == SocketStatus.closed) { 111 | return; 112 | } 113 | onReconnect?.call(); 114 | reconnect(); 115 | } 116 | 117 | void sendMessage(dynamic message) { 118 | if (status == SocketStatus.connected) { 119 | webSocket?.sink.add(message); 120 | } 121 | } 122 | 123 | void close() { 124 | status = SocketStatus.closed; 125 | 126 | streamSubscription?.cancel(); 127 | 128 | reconnectTimer?.cancel(); 129 | reconnectTimer = null; 130 | 131 | webSocket?.sink.close(); 132 | 133 | heartBeatTimer?.cancel(); 134 | heartBeatTimer = null; 135 | } 136 | 137 | void reconnect() { 138 | status = SocketStatus.closed; 139 | if (reconnectTime < maxReconnectTime) { 140 | reconnectTime++; 141 | reconnectTimer ??= Timer.periodic(const Duration(seconds: 5), (timer) { 142 | connect(); 143 | }); 144 | } else { 145 | onClose?.call("重连超过最大次数,与服务器断开连接"); 146 | reconnectTimer?.cancel(); 147 | reconnectTimer = null; 148 | close(); 149 | return; 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /lib/core/index.dart: -------------------------------------------------------------------------------- 1 | library api; 2 | 3 | export 'sites.dart'; 4 | -------------------------------------------------------------------------------- /lib/core/interface/live_danmaku.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:pure_live/common/models/index.dart'; 4 | 5 | class LiveDanmaku { 6 | Function(LiveMessage msg)? onMessage; 7 | Function(String msg)? onClose; 8 | Function()? onReady; 9 | 10 | /// 心跳时间 11 | int heartbeatTime = 0; 12 | 13 | /// 发生心跳 14 | void heartbeat() {} 15 | 16 | /// 开始接收信息 17 | Future start(dynamic args) { 18 | return Future.value(); 19 | } 20 | 21 | /// 停止接收信息 22 | Future stop() { 23 | return Future.value(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/core/interface/live_site.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/models/index.dart'; 2 | 3 | import '../interface/live_danmaku.dart'; 4 | 5 | class LiveSite { 6 | /// 站点唯一ID 7 | String id = ""; 8 | 9 | /// 站点名称 10 | String name = ""; 11 | 12 | /// 站点名称 13 | LiveDanmaku getDanmaku() => LiveDanmaku(); 14 | 15 | /// 获取直播间所有清晰度的url 16 | /// @param room 17 | Future>> getLiveStream(LiveRoom room) { 18 | return Future(() => {}); 19 | } 20 | 21 | /// 获取单个直播间信息 22 | /// @param room 23 | /// @return room 24 | Future getRoomInfo(LiveRoom room) { 25 | return Future(() => LiveRoom('')); 26 | } 27 | 28 | /// 根据分页获取推荐直播间 29 | /// @param page 页数 30 | /// @param size 每页大小 31 | /// @return 32 | Future> getRecommend({ 33 | int page = 0, 34 | int size = 20, 35 | }) { 36 | return Future(() => []); 37 | } 38 | 39 | /// 获取bilibili所有分类 40 | /// @return 41 | Future>> getAreaList() { 42 | return Future(() => []); 43 | } 44 | 45 | /// 获取b站分区房间 46 | /// @param area 分类id 47 | /// @param page 请求页数 48 | /// @param size 49 | /// @return 50 | Future> getAreaRooms( 51 | LiveArea area, { 52 | int page = 1, 53 | int size = 20, 54 | }) { 55 | return Future(() => []); 56 | } 57 | 58 | /// 搜索 59 | /// @param keyWords 搜索关键字 60 | /// @return 61 | Future> search(String keyWords) { 62 | return Future(() => []); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/core/sites.dart: -------------------------------------------------------------------------------- 1 | import 'interface/live_site.dart'; 2 | import 'site/bilibili_site.dart'; 3 | import 'site/douyu_site.dart'; 4 | import 'site/huya_site.dart'; 5 | 6 | class Sites { 7 | static List supportSites = [ 8 | Site( 9 | id: "bilibili", 10 | name: "哔哩", 11 | liveSite: BilibiliSite(), 12 | ), 13 | Site( 14 | id: "douyu", 15 | name: "斗鱼", 16 | liveSite: DouyuSite(), 17 | ), 18 | Site( 19 | id: "huya", 20 | name: "虎牙", 21 | liveSite: HuyaSite(), 22 | ), 23 | ]; 24 | 25 | static Site of(String id) { 26 | return supportSites.firstWhere((e) => id == e.id); 27 | } 28 | } 29 | 30 | class Site { 31 | final String id; 32 | final String name; 33 | final LiveSite liveSite; 34 | Site({ 35 | required this.id, 36 | required this.name, 37 | required this.liveSite, 38 | }); 39 | } 40 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dart_vlc/dart_vlc.dart'; 4 | import 'package:dynamic_color/dynamic_color.dart'; 5 | import 'package:flutter_localizations/flutter_localizations.dart'; 6 | import 'package:get/get.dart'; 7 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 8 | import 'package:pure_live/common/index.dart'; 9 | import 'package:pure_live/modules/areas/areas_controller.dart'; 10 | import 'package:pure_live/modules/favorite/favorite_controller.dart'; 11 | import 'package:pure_live/modules/popular/popular_controller.dart'; 12 | import 'package:pure_live/routes/app_pages.dart'; 13 | import 'package:shared_preferences/shared_preferences.dart'; 14 | import 'package:window_manager/window_manager.dart'; 15 | 16 | void main() async { 17 | WidgetsFlutterBinding.ensureInitialized(); 18 | JsEngine.init(); 19 | PrefUtil.prefs = await SharedPreferences.getInstance(); 20 | if (Platform.isWindows) { 21 | DartVLC.initialize(); 22 | await windowManager.ensureInitialized(); 23 | } 24 | initService(); 25 | 26 | runApp(MyApp()); 27 | } 28 | 29 | void initService() { 30 | Get.put(SettingsService()); 31 | Get.put(FavoriteController()); 32 | Get.put(PopularController()); 33 | Get.put(AreasController()); 34 | } 35 | 36 | class MyApp extends StatelessWidget { 37 | MyApp({Key? key}) : super(key: key); 38 | 39 | final settings = Get.find(); 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | return DynamicColorBuilder( 44 | builder: (lightDynamic, darkDynamic) { 45 | return Obx(() { 46 | var themeColor = 47 | SettingsService.themeColors[settings.themeColorName]!; 48 | // 主题颜色设定/Monet取色 49 | var lightTheme = MyTheme(primaryColor: themeColor).lightThemeData; 50 | var darkTheme = MyTheme(primaryColor: themeColor).darkThemeData; 51 | if (settings.enableDynamicTheme.value) { 52 | lightTheme = MyTheme(colorScheme: lightDynamic).lightThemeData; 53 | darkTheme = MyTheme(colorScheme: darkDynamic).darkThemeData; 54 | } 55 | 56 | return GetMaterialApp( 57 | title: 'PureLive', 58 | themeMode: 59 | SettingsService.themeModes[settings.themeModeName.value]!, 60 | theme: lightTheme, 61 | darkTheme: darkTheme, 62 | locale: SettingsService.languages[settings.languageName.value]!, 63 | supportedLocales: S.delegate.supportedLocales, 64 | localizationsDelegates: const [ 65 | S.delegate, 66 | RefreshLocalizations.delegate, 67 | GlobalMaterialLocalizations.delegate, 68 | GlobalWidgetsLocalizations.delegate, 69 | GlobalCupertinoLocalizations.delegate, 70 | ], 71 | initialRoute: AppPages.initial, 72 | getPages: AppPages.routes, 73 | ); 74 | }); 75 | }, 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/modules/about/about_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:pure_live/routes/app_pages.dart'; 4 | import 'package:url_launcher/url_launcher.dart'; 5 | 6 | import 'widgets/version_dialog.dart'; 7 | 8 | class AboutPage extends StatefulWidget { 9 | const AboutPage({Key? key}) : super(key: key); 10 | 11 | @override 12 | State createState() => _AboutPageState(); 13 | } 14 | 15 | class _AboutPageState extends State { 16 | final SettingsService settings = Get.find(); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: AppBar(), 22 | body: ListView( 23 | physics: const BouncingScrollPhysics(), 24 | children: [ 25 | SectionTitle(title: S.of(context).about), 26 | ListTile( 27 | title: Text(S.of(context).what_is_new), 28 | onTap: showNewFeaturesDialog, 29 | ), 30 | ListTile( 31 | title: Text(S.of(context).check_update), 32 | onTap: () => showCheckUpdateDialog(context), 33 | ), 34 | ListTile( 35 | title: Text(S.of(context).version), 36 | subtitle: const Text(VersionUtil.version), 37 | ), 38 | ListTile( 39 | title: Text(S.of(context).license), 40 | onTap: showLicenseDialog, 41 | ), 42 | SectionTitle(title: S.of(context).project), 43 | ListTile( 44 | title: Text(S.of(context).support_donate), 45 | onTap: () => Get.toNamed(AppPages.donate), 46 | ), 47 | ListTile( 48 | title: Text(S.of(context).issue_feedback), 49 | onTap: () { 50 | launchUrl( 51 | Uri.parse(VersionUtil.issuesUrl), 52 | mode: LaunchMode.externalApplication, 53 | ); 54 | }, 55 | ), 56 | ListTile( 57 | title: Text(S.of(context).develop_progress), 58 | onTap: () { 59 | launchUrl( 60 | Uri.parse(VersionUtil.kanbanUrl), 61 | mode: LaunchMode.externalApplication, 62 | ); 63 | }, 64 | ), 65 | ListTile( 66 | title: Text(S.of(context).project_page), 67 | subtitle: const Text(VersionUtil.projectUrl), 68 | onTap: () { 69 | launchUrl( 70 | Uri.parse(VersionUtil.projectUrl), 71 | mode: LaunchMode.externalApplication, 72 | ); 73 | }, 74 | ), 75 | ListTile( 76 | title: Text(S.of(context).project_alert), 77 | subtitle: Padding( 78 | padding: const EdgeInsets.symmetric(vertical: 12), 79 | child: Text(S.of(context).app_legalese), 80 | ), 81 | ), 82 | ], 83 | ), 84 | ); 85 | } 86 | 87 | void showCheckUpdateDialog(BuildContext context) { 88 | showDialog( 89 | context: context, 90 | builder: (context) => VersionUtil.hasNewVersion() 91 | ? const NewVersionDialog() 92 | : const NoNewVersionDialog(), 93 | ); 94 | } 95 | 96 | void showLicenseDialog() { 97 | showLicensePage( 98 | context: context, 99 | applicationName: S.of(context).app_name, 100 | applicationVersion: VersionUtil.version, 101 | applicationIcon: SizedBox( 102 | width: 60, 103 | child: Center(child: Image.asset('assets/icons/icon.png')), 104 | ), 105 | ); 106 | } 107 | 108 | void showNewFeaturesDialog() { 109 | showDialog( 110 | context: context, 111 | builder: (context) => AlertDialog( 112 | title: Text(S.of(context).what_is_new), 113 | content: Column( 114 | crossAxisAlignment: CrossAxisAlignment.start, 115 | mainAxisSize: MainAxisSize.min, 116 | children: [ 117 | Text('Version ${VersionUtil.latestVersion}'), 118 | const SizedBox(height: 20), 119 | Text( 120 | VersionUtil.latestUpdateLog, 121 | style: Theme.of(context).textTheme.bodySmall, 122 | ), 123 | const SizedBox(height: 10), 124 | ], 125 | ), 126 | ), 127 | ); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/modules/about/donate_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | class DonatePage extends StatelessWidget { 5 | const DonatePage({Key? key}) : super(key: key); 6 | 7 | final widgets = const [AlipayItem(), WechatItem()]; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return LayoutBuilder(builder: (context, constraint) { 12 | final width = constraint.maxWidth; 13 | final crossAxisCount = width > 640 ? 2 : 1; 14 | return Scaffold( 15 | appBar: AppBar(title: Text(S.of(context).support_donate)), 16 | body: MasonryGridView.count( 17 | physics: const BouncingScrollPhysics(), 18 | crossAxisCount: crossAxisCount, 19 | itemCount: 2, 20 | itemBuilder: (BuildContext context, int index) => widgets[index], 21 | ), 22 | ); 23 | }); 24 | } 25 | } 26 | 27 | class AlipayItem extends StatelessWidget { 28 | const AlipayItem({Key? key}) : super(key: key); 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Column( 33 | mainAxisSize: MainAxisSize.min, 34 | children: [ 35 | const SectionTitle(title: 'Alipay'), 36 | Container( 37 | alignment: Alignment.center, 38 | padding: const EdgeInsets.all(12), 39 | child: Image.asset( 40 | 'assets/images/alipay.jpg', 41 | fit: BoxFit.contain, 42 | ), 43 | ), 44 | ], 45 | ); 46 | } 47 | } 48 | 49 | class WechatItem extends StatelessWidget { 50 | const WechatItem({Key? key}) : super(key: key); 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return Column( 55 | mainAxisSize: MainAxisSize.min, 56 | children: [ 57 | const SectionTitle(title: 'Wechat'), 58 | Container( 59 | alignment: Alignment.center, 60 | padding: const EdgeInsets.all(12), 61 | child: Image.asset( 62 | 'assets/images/wechat.png', 63 | fit: BoxFit.contain, 64 | ), 65 | ), 66 | ], 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/modules/about/widgets/version_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/index.dart'; 2 | import 'package:url_launcher/url_launcher.dart'; 3 | 4 | class NoNewVersionDialog extends StatelessWidget { 5 | const NoNewVersionDialog({ 6 | Key? key, 7 | }) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return AlertDialog( 12 | title: Text(S.of(context).check_update), 13 | content: Text(S.of(context).no_new_version_info), 14 | actions: [ 15 | TextButton( 16 | child: Text(S.of(context).confirm), 17 | onPressed: () { 18 | Navigator.pop(context); 19 | }, 20 | ), 21 | ], 22 | ); 23 | } 24 | } 25 | 26 | class NewVersionDialog extends StatelessWidget { 27 | const NewVersionDialog({Key? key, this.entry}) : super(key: key); 28 | 29 | final OverlayEntry? entry; 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return AlertDialog( 34 | title: Text(S.of(context).check_update), 35 | content: Column( 36 | crossAxisAlignment: CrossAxisAlignment.start, 37 | mainAxisSize: MainAxisSize.min, 38 | children: [ 39 | Text(S.of(context).new_version_info(VersionUtil.latestVersion)), 40 | const SizedBox(height: 20), 41 | Text( 42 | VersionUtil.latestUpdateLog, 43 | style: Theme.of(context).textTheme.bodySmall, 44 | ), 45 | const SizedBox(height: 10), 46 | TextButton( 47 | onPressed: () { 48 | if (entry != null) { 49 | entry!.remove(); 50 | } else { 51 | Navigator.pop(context); 52 | } 53 | launchUrl( 54 | Uri.parse('https://wwrg.lanzouy.com/b047m4fyh'), 55 | mode: LaunchMode.externalApplication, 56 | ); 57 | }, 58 | child: const Text('国内下载:蓝奏云(3344)'), 59 | ) 60 | ], 61 | ), 62 | actions: [ 63 | TextButton( 64 | child: Text(S.of(context).cancel), 65 | onPressed: () { 66 | if (entry != null) { 67 | entry!.remove(); 68 | } else { 69 | Navigator.pop(context); 70 | } 71 | }, 72 | ), 73 | ElevatedButton( 74 | child: Text(S.of(context).update), 75 | onPressed: () { 76 | if (entry != null) { 77 | entry!.remove(); 78 | } else { 79 | Navigator.pop(context); 80 | } 81 | launchUrl( 82 | Uri.parse('https://github.com/Jackiu1997/pure_live/releases'), 83 | mode: LaunchMode.externalApplication, 84 | ); 85 | }, 86 | ), 87 | ], 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/modules/area_rooms/area_rooms_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/base/base_controller.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | class AreaRoomsController extends BaseListController { 5 | AreaRoomsController(this.area); 6 | 7 | final LiveArea area; 8 | 9 | @override 10 | Future> getData(int page, int pageSize) async { 11 | return await Sites.of(area.platform) 12 | .liveSite 13 | .getAreaRooms(area, page: page, size: pageSize); 14 | } 15 | 16 | @override 17 | void onInit() { 18 | super.onInit(); 19 | scrollController.addListener(() { 20 | final pos = scrollController.position; 21 | if (pos.maxScrollExtent - pos.pixels < 100) { 22 | onLoading(); 23 | } 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/modules/areas/areas_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | class AreasController extends GetxController 5 | with GetSingleTickerProviderStateMixin { 6 | late TabController tabController; 7 | 8 | AreasController() { 9 | final preferPlatform = Get.find().preferPlatform.value; 10 | final index = Sites.supportSites.indexWhere((e) => e.id == preferPlatform); 11 | tabController = TabController( 12 | initialIndex: index == -1 ? 0 : index, 13 | length: Sites.supportSites.length, 14 | vsync: this, 15 | ); 16 | } 17 | 18 | Map data = {}; 19 | 20 | @override 21 | void onInit() async { 22 | for (var site in Sites.supportSites) { 23 | var areas = await site.liveSite.getAreaList(); 24 | var lables = areas.map((e) => e.first.typeName).toList(); 25 | data[site.id] = { 26 | 'labels': lables, 27 | 'areas': areas, 28 | }; 29 | } 30 | super.onInit(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/modules/areas/areas_grid_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:pure_live/modules/areas/widgets/area_card.dart'; 4 | 5 | class AreaGridView extends StatefulWidget { 6 | const AreaGridView({Key? key, required this.labels, required this.areas}) 7 | : super(key: key); 8 | 9 | final List labels; 10 | final List> areas; 11 | 12 | @override 13 | State createState() => _AreaGridViewState(); 14 | } 15 | 16 | class _AreaGridViewState extends State 17 | with SingleTickerProviderStateMixin { 18 | late TabController tabController = 19 | TabController(length: widget.labels.length, vsync: this); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Column( 24 | children: [ 25 | TabBar( 26 | controller: tabController, 27 | isScrollable: true, 28 | indicatorSize: TabBarIndicatorSize.label, 29 | tabs: widget.labels.map((e) => Tab(text: e)).toList(), 30 | ), 31 | Expanded( 32 | child: TabBarView( 33 | controller: tabController, 34 | children: 35 | widget.areas.map((e) => buildAreasView(e)).toList(), 36 | ), 37 | ), 38 | ], 39 | ); 40 | } 41 | 42 | Widget buildAreasView(List area) { 43 | return LayoutBuilder(builder: (context, constraint) { 44 | final width = constraint.maxWidth; 45 | final crossAxisCount = 46 | width > 1280 ? 9 : (width > 960 ? 7 : (width > 640 ? 5 : 3)); 47 | return widget.areas.isNotEmpty 48 | ? MasonryGridView.count( 49 | padding: const EdgeInsets.all(5), 50 | controller: ScrollController(), 51 | crossAxisCount: crossAxisCount, 52 | itemCount: area.length, 53 | itemBuilder: (context, index) => AreaCard(area: area[index]), 54 | ) 55 | : EmptyView( 56 | icon: Icons.area_chart_outlined, 57 | title: S.of(context).empty_areas_title, 58 | subtitle: S.of(context).empty_areas_subtitle, 59 | ); 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/modules/areas/areas_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | import 'areas_controller.dart'; 5 | import 'areas_grid_view.dart'; 6 | import 'favorite_areas_page.dart'; 7 | 8 | class AreasPage extends GetView { 9 | const AreasPage({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return LayoutBuilder(builder: (context, constraint) { 14 | bool showAction = constraint.maxWidth <= 680; 15 | return Scaffold( 16 | appBar: AppBar( 17 | centerTitle: true, 18 | scrolledUnderElevation: 0, 19 | leading: showAction ? const MenuButton() : null, 20 | actions: showAction ? [const SearchButton()] : null, 21 | title: TabBar( 22 | controller: controller.tabController, 23 | isScrollable: true, 24 | labelStyle: 25 | const TextStyle(fontSize: 18, fontWeight: FontWeight.w600), 26 | labelPadding: const EdgeInsets.symmetric(horizontal: 12), 27 | indicatorSize: TabBarIndicatorSize.label, 28 | tabs: Sites.supportSites.map((e) => Tab(text: e.name)).toList(), 29 | ), 30 | ), 31 | body: TabBarView( 32 | controller: controller.tabController, 33 | children: Sites.supportSites 34 | .map((e) => AreaGridView( 35 | labels: controller.data[e.id]?['labels'] ?? [], 36 | areas: controller.data[e.id]?['areas'] ?? [], 37 | )) 38 | .toList(), 39 | ), 40 | floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, 41 | floatingActionButton: FloatingActionButton( 42 | onPressed: () => Get.to(() => const FavoriteAreasPage()), 43 | child: const Icon(Icons.favorite_rounded), 44 | ), 45 | ); 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/modules/areas/favorite_areas_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:pure_live/common/index.dart'; 4 | import 'package:pure_live/modules/areas/widgets/area_card.dart'; 5 | 6 | class FavoriteAreasPage extends GetView { 7 | const FavoriteAreasPage({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return LayoutBuilder(builder: (context, constraint) { 12 | final width = constraint.maxWidth; 13 | final crossAxisCount = 14 | width > 1280 ? 9 : (width > 960 ? 7 : (width > 640 ? 5 : 3)); 15 | return Scaffold( 16 | appBar: AppBar(title: Text(S.of(context).favorite_areas)), 17 | body: Obx( 18 | () => controller.favoriteAreas.isNotEmpty 19 | ? MasonryGridView.count( 20 | padding: const EdgeInsets.all(5), 21 | crossAxisCount: crossAxisCount, 22 | itemCount: controller.favoriteAreas.length, 23 | itemBuilder: (context, index) => 24 | AreaCard(area: controller.favoriteAreas[index])) 25 | : EmptyView( 26 | icon: Icons.area_chart_outlined, 27 | title: S.of(context).empty_areas_title, 28 | subtitle: '', 29 | ), 30 | ), 31 | ); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/modules/areas/widgets/area_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:pure_live/routes/app_pages.dart'; 4 | 5 | class AreaCard extends StatelessWidget { 6 | const AreaCard({ 7 | Key? key, 8 | required this.area, 9 | }) : super(key: key); 10 | 11 | final LiveArea area; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Card( 16 | margin: const EdgeInsets.all(7.5), 17 | shape: RoundedRectangleBorder( 18 | borderRadius: BorderRadius.circular(15.0), 19 | ), 20 | child: InkWell( 21 | borderRadius: BorderRadius.circular(15.0), 22 | onTap: () => AppPages.toAreaRooms(area), 23 | child: Column( 24 | mainAxisSize: MainAxisSize.min, 25 | children: [ 26 | AspectRatio( 27 | aspectRatio: 1, 28 | child: Card( 29 | margin: const EdgeInsets.all(0), 30 | shape: RoundedRectangleBorder( 31 | borderRadius: BorderRadius.circular(15.0), 32 | ), 33 | clipBehavior: Clip.antiAlias, 34 | color: Colors.white, 35 | elevation: 0, 36 | child: CachedNetworkImage( 37 | imageUrl: area.areaPic, 38 | cacheManager: CustomCacheManager.instance, 39 | fit: BoxFit.fill, 40 | errorWidget: (context, error, stackTrace) => const Center( 41 | child: Text( 42 | 'Cover\nNot Found', 43 | textAlign: TextAlign.center, 44 | style: TextStyle(fontWeight: FontWeight.w500), 45 | ), 46 | ), 47 | ), 48 | ), 49 | ), 50 | ListTile( 51 | dense: true, 52 | contentPadding: const EdgeInsets.symmetric(horizontal: 10), 53 | title: Text( 54 | area.areaName, 55 | maxLines: 1, 56 | overflow: TextOverflow.clip, 57 | style: const TextStyle(fontWeight: FontWeight.w500), 58 | ), 59 | subtitle: Row( 60 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 61 | children: [ 62 | Text( 63 | area.typeName, 64 | style: const TextStyle( 65 | fontWeight: FontWeight.bold, 66 | fontSize: 10, 67 | ), 68 | ), 69 | Text( 70 | area.platform.toUpperCase(), 71 | style: const TextStyle( 72 | fontWeight: FontWeight.bold, 73 | fontSize: 10, 74 | ), 75 | ), 76 | ], 77 | ), 78 | ) 79 | ], 80 | ), 81 | ), 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/modules/backup/backup_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:date_format/date_format.dart' hide S; 4 | import 'package:file_picker/file_picker.dart'; 5 | import 'package:get/get.dart'; 6 | import 'package:permission_handler/permission_handler.dart'; 7 | import 'package:pure_live/common/index.dart'; 8 | 9 | class BackupPage extends StatefulWidget { 10 | const BackupPage({Key? key}) : super(key: key); 11 | 12 | @override 13 | State createState() => _BackupPageState(); 14 | } 15 | 16 | class _BackupPageState extends State { 17 | final settings = Get.find(); 18 | late String backupDirectory = settings.backupDirectory.value; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | appBar: AppBar(), 24 | body: ListView( 25 | physics: const BouncingScrollPhysics(), 26 | children: [ 27 | SectionTitle(title: S.of(context).backup_recover), 28 | ListTile( 29 | title: Text(S.of(context).create_backup), 30 | subtitle: Text(S.of(context).create_backup_subtitle), 31 | onTap: () => createBackup(), 32 | ), 33 | ListTile( 34 | title: Text(S.of(context).recover_backup), 35 | subtitle: Text(S.of(context).recover_backup_subtitle), 36 | onTap: () => recoverBackup(), 37 | ), 38 | SectionTitle(title: S.of(context).auto_backup), 39 | ListTile( 40 | title: Text(S.of(context).backup_directory), 41 | subtitle: Text(backupDirectory), 42 | onTap: () => selectBackupDirectory(), 43 | ), 44 | ], 45 | ), 46 | ); 47 | } 48 | 49 | Future requestStoragePermission() async { 50 | if (await Permission.manageExternalStorage.isDenied) { 51 | final status = Permission.manageExternalStorage.request(); 52 | return status.isGranted; 53 | } 54 | return true; 55 | } 56 | 57 | void createBackup() async { 58 | if (Platform.isAndroid || Platform.isIOS) { 59 | final granted = await requestStoragePermission(); 60 | if (!granted) { 61 | SnackBarUtil.error('请先授予读写文件权限'); 62 | return; 63 | } 64 | } 65 | 66 | String? selectedDirectory = await FilePicker.platform.getDirectoryPath( 67 | initialDirectory: backupDirectory.isEmpty ? '/' : backupDirectory, 68 | ); 69 | if (selectedDirectory == null) return; 70 | 71 | final dateStr = formatDate( 72 | DateTime.now(), 73 | [yyyy, '-', mm, '-', dd, 'T', HH, '_', nn, '_', ss], 74 | ); 75 | final file = File('$selectedDirectory/purelive_$dateStr.txt'); 76 | if (settings.backup(file)) { 77 | SnackBarUtil.success(S.of(Get.context!).create_backup_success); 78 | // 首次同步备份目录 79 | if (settings.backupDirectory.isEmpty) { 80 | settings.backupDirectory.value = selectedDirectory; 81 | setState(() => backupDirectory = selectedDirectory); 82 | } 83 | } else { 84 | SnackBarUtil.error(S.of(Get.context!).create_backup_failed); 85 | } 86 | } 87 | 88 | void recoverBackup() async { 89 | FilePickerResult? result = await FilePicker.platform.pickFiles( 90 | dialogTitle: S.of(context).select_recover_file, 91 | type: FileType.custom, 92 | allowedExtensions: ['txt'], 93 | ); 94 | if (result == null || result.files.single.path == null) return; 95 | 96 | final file = File(result.files.single.path!); 97 | if (settings.recover(file)) { 98 | SnackBarUtil.success(S.of(Get.context!).recover_backup_success); 99 | } else { 100 | SnackBarUtil.error(S.of(Get.context!).recover_backup_failed); 101 | } 102 | } 103 | 104 | void selectBackupDirectory() async { 105 | String? selectedDirectory = await FilePicker.platform.getDirectoryPath(); 106 | if (selectedDirectory == null) return; 107 | 108 | settings.backupDirectory.value = selectedDirectory; 109 | setState(() => backupDirectory = selectedDirectory); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/modules/contact/contact_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:url_launcher/url_launcher.dart'; 4 | 5 | class ContactPage extends StatefulWidget { 6 | const ContactPage({Key? key}) : super(key: key); 7 | 8 | @override 9 | State createState() => _ContactPageState(); 10 | } 11 | 12 | class _ContactPageState extends State { 13 | void clipboard(String text) { 14 | Clipboard.setData(ClipboardData(text: text)) 15 | .then((value) => SnackBarUtil.success('已复制到剪贴板')); 16 | } 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: AppBar(), 22 | body: ListView( 23 | physics: const BouncingScrollPhysics(), 24 | children: [ 25 | SectionTitle(title: S.of(context).contact), 26 | ListTile( 27 | leading: const Icon(CustomIcons.telegram, size: 32), 28 | title: Text(S.of(context).telegram), 29 | subtitle: const Text(VersionUtil.telegramGroup), 30 | onLongPress: () => clipboard(VersionUtil.telegramGroup), 31 | onTap: () { 32 | launchUrl( 33 | Uri.parse(VersionUtil.telegramGroupUrl), 34 | mode: LaunchMode.externalApplication, 35 | ); 36 | }, 37 | ), 38 | ListTile( 39 | leading: const Icon(CustomIcons.mail_squared, size: 34), 40 | title: Text(S.of(context).email), 41 | subtitle: const Text(VersionUtil.email), 42 | onLongPress: () => clipboard(VersionUtil.email), 43 | onTap: () { 44 | launchUrl( 45 | Uri.parse(VersionUtil.emailUrl), 46 | mode: LaunchMode.externalApplication, 47 | ); 48 | }, 49 | ), 50 | ListTile( 51 | leading: const Icon(CustomIcons.github_circled, size: 32), 52 | title: Text(S.of(context).github), 53 | subtitle: const Text(VersionUtil.githubUrl), 54 | onTap: () { 55 | launchUrl( 56 | Uri.parse(VersionUtil.githubUrl), 57 | mode: LaunchMode.externalApplication, 58 | ); 59 | }, 60 | ), 61 | ], 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/modules/favorite/favorite_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:get/get.dart'; 4 | import 'package:pure_live/common/index.dart'; 5 | 6 | class FavoriteController extends GetxController 7 | with GetSingleTickerProviderStateMixin { 8 | final SettingsService settings = Get.find(); 9 | late TabController tabController; 10 | 11 | FavoriteController() { 12 | tabController = TabController(length: 2, vsync: this); 13 | } 14 | 15 | @override 16 | void onInit() { 17 | super.onInit(); 18 | // 初始化关注页 19 | syncRooms(); 20 | 21 | // 监听settings rooms变化 22 | settings.favoriteRooms.listen((rooms) => syncRooms()); 23 | 24 | // 定时自动刷新 25 | onRefresh(); 26 | Timer.periodic( 27 | Duration(seconds: settings.autoRefreshTime.value), 28 | (timer) => onRefresh(), 29 | ); 30 | } 31 | 32 | final onlineRooms = [].obs; 33 | final offlineRooms = [].obs; 34 | 35 | void syncRooms() { 36 | onlineRooms.clear(); 37 | onlineRooms.addAll(settings.favoriteRooms 38 | .where((room) => room.liveStatus == LiveStatus.live)); 39 | 40 | offlineRooms.clear(); 41 | offlineRooms.addAll(settings.favoriteRooms 42 | .where((room) => room.liveStatus != LiveStatus.live)); 43 | } 44 | 45 | Future onRefresh() async { 46 | for (final room in settings.favoriteRooms) { 47 | try { 48 | var newRoom = await Sites.of(room.platform).liveSite.getRoomInfo(room); 49 | settings.updateRoom(newRoom); 50 | } catch (e) { 51 | return false; 52 | } 53 | } 54 | syncRooms(); 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/modules/history/history_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 4 | import 'package:pure_live/common/index.dart'; 5 | 6 | class HistoryPage extends GetView { 7 | HistoryPage({Key? key}) : super(key: key); 8 | 9 | final refreshController = RefreshController(); 10 | 11 | Future onRefresh() async { 12 | bool result = true; 13 | final SettingsService settings = Get.find(); 14 | 15 | for (final room in settings.historyRooms) { 16 | try { 17 | var newRoom = await Sites.of(room.platform).liveSite.getRoomInfo(room); 18 | settings.updateRoomInHistory(newRoom); 19 | } catch (e) { 20 | result = false; 21 | } 22 | } 23 | 24 | if (result) { 25 | refreshController.refreshCompleted(); 26 | } else { 27 | refreshController.refreshFailed(); 28 | } 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Scaffold( 34 | appBar: AppBar( 35 | centerTitle: true, 36 | scrolledUnderElevation: 0, 37 | title: Text('${S.of(context).history}(20)'), 38 | ), 39 | body: Obx(() { 40 | final SettingsService settings = Get.find(); 41 | const dense = true; 42 | final rooms = settings.historyRooms.reversed.toList(); 43 | return LayoutBuilder(builder: (context, constraint) { 44 | final width = constraint.maxWidth; 45 | int crossAxisCount = 46 | width > 1280 ? 4 : (width > 960 ? 3 : (width > 640 ? 2 : 1)); 47 | if (dense) { 48 | crossAxisCount = 49 | width > 1280 ? 5 : (width > 960 ? 4 : (width > 640 ? 3 : 2)); 50 | } 51 | return SmartRefresher( 52 | enablePullDown: true, 53 | physics: const BouncingScrollPhysics(), 54 | header: const WaterDropHeader(), 55 | controller: refreshController, 56 | onRefresh: onRefresh, 57 | child: rooms.isEmpty 58 | ? EmptyView( 59 | icon: Icons.history_rounded, 60 | title: S.of(context).empty_history, 61 | subtitle: '', 62 | ) 63 | : MasonryGridView.count( 64 | padding: const EdgeInsets.all(5), 65 | controller: ScrollController(), 66 | crossAxisCount: crossAxisCount, 67 | itemCount: rooms.length, 68 | itemBuilder: (context, index) => 69 | RoomCard(room: rooms[index], dense: dense), 70 | ), 71 | ); 72 | }); 73 | }), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/modules/home/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/services.dart'; 4 | import 'package:get/get.dart'; 5 | import 'package:pure_live/common/index.dart'; 6 | import 'package:pure_live/modules/areas/areas_page.dart'; 7 | import 'package:pure_live/modules/favorite/favorite_page.dart'; 8 | import 'package:pure_live/modules/home/mobile_view.dart'; 9 | import 'package:pure_live/modules/home/tablet_view.dart'; 10 | import 'package:pure_live/modules/about/widgets/version_dialog.dart'; 11 | import 'package:pure_live/modules/popular/popular_page.dart'; 12 | import '../search/search_page.dart'; 13 | 14 | class HomePage extends StatefulWidget { 15 | const HomePage({Key? key}) : super(key: key); 16 | 17 | @override 18 | State createState() => _HomePageState(); 19 | } 20 | 21 | class _HomePageState extends State 22 | with AutomaticKeepAliveClientMixin { 23 | @override 24 | void initState() { 25 | super.initState(); 26 | // check update overlay ui 27 | WidgetsBinding.instance.addPostFrameCallback( 28 | (timeStamp) async { 29 | // Android statusbar and navigationbar 30 | if (Platform.isAndroid) { 31 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( 32 | statusBarColor: Colors.transparent, 33 | systemNavigationBarColor: 34 | Theme.of(context).navigationBarTheme.backgroundColor, 35 | )); 36 | SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); 37 | } 38 | 39 | await VersionUtil.checkUpdate(); 40 | if (Get.find().enableAutoCheckUpdate.value && 41 | VersionUtil.hasNewVersion()) { 42 | late OverlayEntry entry; 43 | entry = OverlayEntry( 44 | builder: (context) => Container( 45 | alignment: Alignment.center, 46 | color: Colors.black54, 47 | child: NewVersionDialog(entry: entry), 48 | ), 49 | ); 50 | Overlay.of(Get.context!).insert(entry); 51 | } 52 | }, 53 | ); 54 | } 55 | 56 | int _selectedIndex = 0; 57 | final List bodys = const [ 58 | FavoritePage(), 59 | PopularPage(), 60 | AreasPage(), 61 | SearchPage(), 62 | ]; 63 | 64 | void onDestinationSelected(int index) { 65 | setState(() => _selectedIndex = index); 66 | } 67 | 68 | @override 69 | Widget build(BuildContext context) { 70 | super.build(context); 71 | return LayoutBuilder( 72 | builder: (context, constraint) => constraint.maxWidth <= 680 73 | ? HomeMobileView( 74 | body: bodys[_selectedIndex], 75 | index: _selectedIndex, 76 | onDestinationSelected: onDestinationSelected, 77 | ) 78 | : HomeTabletView( 79 | body: bodys[_selectedIndex], 80 | index: _selectedIndex, 81 | onDestinationSelected: onDestinationSelected, 82 | ), 83 | ); 84 | } 85 | 86 | @override 87 | bool get wantKeepAlive => true; 88 | } 89 | -------------------------------------------------------------------------------- /lib/modules/home/mobile_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/index.dart'; 2 | 3 | class HomeMobileView extends StatelessWidget { 4 | final Widget body; 5 | final int index; 6 | final void Function(int) onDestinationSelected; 7 | 8 | const HomeMobileView({ 9 | Key? key, 10 | required this.body, 11 | required this.index, 12 | required this.onDestinationSelected, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | bottomNavigationBar: NavigationBar( 19 | destinations: [ 20 | NavigationDestination( 21 | icon: const Icon(Icons.favorite_rounded), 22 | label: S.of(context).favorites_title, 23 | ), 24 | NavigationDestination( 25 | icon: const Icon(CustomIcons.popular), 26 | label: S.of(context).popular_title, 27 | ), 28 | NavigationDestination( 29 | icon: const Icon(Icons.area_chart_rounded), 30 | label: S.of(context).areas_title, 31 | ), 32 | ], 33 | selectedIndex: index, 34 | onDestinationSelected: onDestinationSelected, 35 | ), 36 | body: body, 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/modules/home/tablet_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:pure_live/modules/search/search_controller.dart'; 4 | 5 | class HomeTabletView extends StatelessWidget { 6 | final Widget body; 7 | final int index; 8 | final void Function(int) onDestinationSelected; 9 | 10 | const HomeTabletView({ 11 | Key? key, 12 | required this.body, 13 | required this.index, 14 | required this.onDestinationSelected, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | body: SafeArea( 21 | child: Row( 22 | children: [ 23 | NavigationRail( 24 | groupAlignment: 0.9, 25 | labelType: NavigationRailLabelType.all, 26 | leading: Column( 27 | mainAxisSize: MainAxisSize.min, 28 | children: [ 29 | const Padding( 30 | padding: EdgeInsets.all(12), 31 | child: MenuButton(), 32 | ), 33 | FloatingActionButton( 34 | heroTag: 'search', 35 | elevation: 0, 36 | onPressed: () { 37 | Get.put(SearchController()); 38 | onDestinationSelected(3); 39 | }, 40 | child: const Icon(CustomIcons.search), 41 | ), 42 | ], 43 | ), 44 | destinations: [ 45 | NavigationRailDestination( 46 | icon: const Icon(Icons.favorite_rounded), 47 | label: Text(S.of(context).favorites_title), 48 | ), 49 | NavigationRailDestination( 50 | icon: const Icon(CustomIcons.popular), 51 | label: Text(S.of(context).popular_title), 52 | ), 53 | NavigationRailDestination( 54 | icon: const Icon(Icons.area_chart_rounded), 55 | label: Text(S.of(context).areas_title), 56 | ), 57 | ], 58 | selectedIndex: index > 2 ? 0 : index, 59 | onDestinationSelected: onDestinationSelected, 60 | ), 61 | const VerticalDivider(width: 1), 62 | Expanded(child: body), 63 | ], 64 | ), 65 | ), 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/modules/live_play/live_play_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:get/get.dart'; 5 | import 'package:pure_live/common/index.dart'; 6 | import 'package:pure_live/core/interface/live_danmaku.dart'; 7 | 8 | import 'widgets/video_player/video_controller.dart'; 9 | 10 | class LivePlayController extends GetxController { 11 | LivePlayController(this.room); 12 | 13 | final LiveRoom room; 14 | late final Site site = Sites.of(room.platform); 15 | late final LiveDanmaku liveDanmaku = site.liveSite.getDanmaku(); 16 | 17 | final settings = Get.find(); 18 | 19 | final messages = [].obs; 20 | 21 | // 控制唯一子组件 22 | VideoController? videoController; 23 | final playerKey = GlobalKey(); 24 | final danmakuViewKey = GlobalKey(); 25 | 26 | final success = false.obs; 27 | Map> liveStream = {}; 28 | String selectedResolution = ''; 29 | String selectedStreamUrl = ''; 30 | 31 | @override 32 | void onClose() { 33 | super.onClose(); 34 | videoController?.dispose(); 35 | liveDanmaku.stop(); 36 | } 37 | 38 | @override 39 | void onInit() { 40 | super.onInit(); 41 | site.liveSite.getLiveStream(room).then((value) { 42 | liveStream = value; 43 | setPreferResolution(); 44 | 45 | // add delay to avoid hero animation lag 46 | int delay = (Platform.isWindows || Platform.isLinux) ? 500 : 0; 47 | Timer(Duration(milliseconds: delay), () { 48 | videoController = VideoController( 49 | playerKey: playerKey, 50 | room: room, 51 | datasourceType: 'network', 52 | datasource: selectedStreamUrl, 53 | allowBackgroundPlay: settings.enableBackgroundPlay.value, 54 | allowScreenKeepOn: settings.enableScreenKeepOn.value, 55 | fullScreenByDefault: settings.enableFullScreenDefault.value, 56 | autoPlay: true, 57 | ); 58 | success.value = true; 59 | }); 60 | }).then((value) => settings.addRoomToHistory(room)); 61 | 62 | // start danmaku server 63 | liveDanmaku.start(int.parse( 64 | room.userId.isEmpty ? room.roomId : room.userId, 65 | )); 66 | liveDanmaku.onMessage = (msg) { 67 | if (msg.type == LiveMessageType.chat) { 68 | messages.add(msg); 69 | videoController?.sendDanmaku(msg); 70 | } 71 | }; 72 | } 73 | 74 | void setResolution(String name, String url) { 75 | selectedResolution = name; 76 | selectedStreamUrl = url; 77 | videoController?.setDataSource(selectedStreamUrl); 78 | update(); 79 | } 80 | 81 | void setPreferResolution() { 82 | if (liveStream.isEmpty || liveStream.values.first.isEmpty) return; 83 | 84 | for (var key in liveStream.keys) { 85 | if (settings.preferResolution.contains(key)) { 86 | selectedResolution = key; 87 | selectedStreamUrl = liveStream[key]!.first; 88 | return; 89 | } 90 | } 91 | // 原画选择缺陷 92 | if (settings.preferResolution.value == '原画') { 93 | for (var key in liveStream.keys) { 94 | if (key.contains('原画')) { 95 | selectedResolution = key; 96 | selectedStreamUrl = liveStream[key]!.first; 97 | return; 98 | } 99 | } 100 | } 101 | // 蓝光8M/4M选择缺陷 102 | if (settings.preferResolution.contains('蓝光')) { 103 | for (var key in liveStream.keys) { 104 | if (key.contains('蓝光')) { 105 | selectedResolution = key; 106 | selectedStreamUrl = liveStream[key]!.first; 107 | return; 108 | } 109 | } 110 | } 111 | // 偏好选择失败,选择最低清晰度 112 | selectedResolution = liveStream.keys.last; 113 | selectedStreamUrl = liveStream.values.last.first; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/modules/live_play/widgets/danmaku_list_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/rendering.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:pure_live/common/index.dart'; 4 | import 'package:pure_live/modules/live_play/live_play_controller.dart'; 5 | 6 | class DanmakuListView extends StatefulWidget { 7 | final LiveRoom room; 8 | 9 | const DanmakuListView({Key? key, required this.room}) : super(key: key); 10 | 11 | @override 12 | State createState() => DanmakuListViewState(); 13 | } 14 | 15 | class DanmakuListViewState extends State 16 | with AutomaticKeepAliveClientMixin { 17 | final ScrollController _scrollController = ScrollController(); 18 | bool _scrollHappen = false; 19 | 20 | LivePlayController get controller => Get.find(); 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | controller.messages.listen((p0) { 26 | _scrollToBottom(); 27 | setState(() {}); 28 | }); 29 | } 30 | 31 | @override 32 | void dispose() { 33 | _scrollController.dispose(); 34 | super.dispose(); 35 | } 36 | 37 | void _scrollToBottom() { 38 | if (_scrollHappen) return; 39 | _scrollController.animateTo( 40 | _scrollController.position.maxScrollExtent, 41 | duration: const Duration(milliseconds: 200), 42 | curve: Curves.linearToEaseOut, 43 | ); 44 | } 45 | 46 | bool _userScrollAction(UserScrollNotification notification) { 47 | if (notification.direction == ScrollDirection.forward) { 48 | setState(() => _scrollHappen = true); 49 | } else if (notification.direction == ScrollDirection.reverse) { 50 | final pos = _scrollController.position; 51 | if (pos.maxScrollExtent - pos.pixels <= 100) { 52 | setState(() => _scrollHappen = false); 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | super.build(context); 61 | return Stack( 62 | children: [ 63 | NotificationListener( 64 | onNotification: _userScrollAction, 65 | child: ListView.builder( 66 | controller: _scrollController, 67 | itemCount: controller.messages.length, 68 | shrinkWrap: true, 69 | itemBuilder: (context, index) { 70 | final danmaku = controller.messages[index]; 71 | return Container( 72 | margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 3), 73 | alignment: Alignment.centerLeft, 74 | child: Container( 75 | padding: 76 | const EdgeInsets.symmetric(horizontal: 10, vertical: 6), 77 | decoration: BoxDecoration( 78 | color: Theme.of(context) 79 | .colorScheme 80 | .onBackground 81 | .withOpacity(0.04), 82 | borderRadius: BorderRadius.circular(12), 83 | ), 84 | child: Text.rich( 85 | TextSpan( 86 | children: [ 87 | TextSpan( 88 | text: "${danmaku.userName}: ", 89 | style: const TextStyle( 90 | fontSize: 14, 91 | fontWeight: FontWeight.w300, 92 | ), 93 | ), 94 | TextSpan( 95 | text: danmaku.message, 96 | style: const TextStyle(fontSize: 14), 97 | ), 98 | ], 99 | ), 100 | ), 101 | ), 102 | ); 103 | }, 104 | ), 105 | ), 106 | if (_scrollHappen) 107 | Positioned( 108 | left: 12, 109 | bottom: 12, 110 | child: ElevatedButton.icon( 111 | icon: const Icon(Icons.arrow_downward_rounded), 112 | label: const Text('回到底部'), 113 | onPressed: () { 114 | setState(() => _scrollHappen = false); 115 | _scrollToBottom(); 116 | }, 117 | ), 118 | ) 119 | ], 120 | ); 121 | } 122 | 123 | @override 124 | bool get wantKeepAlive => true; 125 | } 126 | -------------------------------------------------------------------------------- /lib/modules/live_play/widgets/index.dart: -------------------------------------------------------------------------------- 1 | library widgets; 2 | 3 | export './video_player/video_controller.dart'; 4 | export './video_player/video_player.dart'; 5 | export './danmaku_list_view.dart'; 6 | export './live_dlna_dialog.dart'; 7 | -------------------------------------------------------------------------------- /lib/modules/live_play/widgets/live_dlna_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dlna_dart/dlna.dart'; 4 | import 'package:pure_live/common/index.dart'; 5 | 6 | class LiveDlnaPage extends StatefulWidget { 7 | final String datasource; 8 | 9 | const LiveDlnaPage({Key? key, required this.datasource}) : super(key: key); 10 | 11 | @override 12 | State createState() => _LiveDlnaPageState(); 13 | } 14 | 15 | class _LiveDlnaPageState extends State { 16 | final Map _deviceList = {}; 17 | final DLNAManager searcher = DLNAManager(); 18 | late final Timer stopSearchTimer; 19 | String selectDeviceKey = ''; 20 | bool isSearching = true; 21 | 22 | DLNADevice? get device => _deviceList[selectDeviceKey]; 23 | 24 | @override 25 | void initState() { 26 | stopSearchTimer = Timer(const Duration(seconds: 20), () { 27 | setState(() => isSearching = false); 28 | searcher.stop(); 29 | }); 30 | startSearch(); 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | super.dispose(); 37 | searcher.stop(); 38 | stopSearchTimer.cancel(); 39 | } 40 | 41 | void startSearch() async { 42 | // clear old devices 43 | isSearching = true; 44 | selectDeviceKey = ''; 45 | _deviceList.clear(); 46 | setState(() {}); 47 | // start search server 48 | final m = await searcher.start(); 49 | m.devices.stream.listen((deviceList) { 50 | deviceList.forEach((key, value) { 51 | _deviceList[key] = value; 52 | }); 53 | setState(() {}); 54 | }); 55 | // close the server, the closed server can be start by call searcher.start() 56 | } 57 | 58 | void selectDevice(String key) { 59 | if (selectDeviceKey.isNotEmpty) device?.pause(); 60 | 61 | selectDeviceKey = key; 62 | device?.setUrl(widget.datasource); 63 | device?.play(); 64 | setState(() {}); 65 | } 66 | 67 | @override 68 | Widget build(BuildContext context) { 69 | Widget cur; 70 | if (isSearching && _deviceList.isEmpty) { 71 | cur = const Center(child: CircularProgressIndicator()); 72 | } else if (_deviceList.isEmpty) { 73 | cur = Center( 74 | child: Text( 75 | S.of(context).dlan_device_not_found, 76 | style: Theme.of(context).textTheme.bodyLarge, 77 | ), 78 | ); 79 | } else { 80 | cur = ListView( 81 | children: _deviceList.keys 82 | .map((key) => ListTile( 83 | contentPadding: const EdgeInsets.all(2), 84 | title: Text(_deviceList[key]!.info.friendlyName), 85 | subtitle: Text(key), 86 | onTap: () => selectDevice(key), 87 | )) 88 | .toList(), 89 | ); 90 | } 91 | 92 | return AlertDialog( 93 | title: Row( 94 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 95 | children: [ 96 | Text(S.of(context).dlan_title), 97 | IconButton( 98 | onPressed: startSearch, 99 | icon: const Icon(Icons.refresh_rounded), 100 | ), 101 | ], 102 | ), 103 | content: SizedBox( 104 | height: 200, 105 | width: 200, 106 | child: cur, 107 | ), 108 | ); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /lib/modules/live_play/widgets/video_player/danmaku_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/index.dart'; 2 | import 'package:bordered_text/bordered_text.dart'; 3 | 4 | class DanmakuText extends StatelessWidget { 5 | final String text; 6 | final TextAlign textAlign; 7 | final Color color; 8 | final double fontSize; 9 | final double strokeWidth; 10 | 11 | const DanmakuText( 12 | this.text, { 13 | this.textAlign = TextAlign.left, 14 | this.color = Colors.white, 15 | this.fontSize = 16, 16 | this.strokeWidth = 2.0, 17 | Key? key, 18 | }) : super(key: key); 19 | 20 | Color get borderColor { 21 | var brightness = 22 | ((color.red * 299) + (color.green * 587) + (color.blue * 114)) / 1000; 23 | return brightness > 70 ? Colors.black54 : Colors.white54; 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return BorderedText( 29 | strokeWidth: strokeWidth, 30 | strokeCap: StrokeCap.round, 31 | strokeJoin: StrokeJoin.round, 32 | strokeColor: borderColor, 33 | child: Text( 34 | text, 35 | softWrap: false, 36 | textAlign: textAlign, 37 | style: TextStyle( 38 | fontSize: fontSize, 39 | color: color, 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/modules/live_play/widgets/video_player/video_player.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:better_player/better_player.dart'; 4 | import 'package:dart_vlc/dart_vlc.dart'; 5 | import 'package:get/get.dart'; 6 | import 'package:pure_live/common/index.dart'; 7 | import 'package:pure_live/modules/live_play/widgets/video_player/video_controller.dart'; 8 | import 'package:pure_live/modules/live_play/widgets/video_player/video_controller_panel.dart'; 9 | 10 | class VideoPlayer extends StatefulWidget { 11 | final VideoController controller; 12 | 13 | const VideoPlayer({ 14 | Key? key, 15 | required this.controller, 16 | }) : super(key: key); 17 | 18 | @override 19 | State createState() => _VideoPlayerState(); 20 | } 21 | 22 | class _VideoPlayerState extends State { 23 | @override 24 | void initState() { 25 | super.initState(); 26 | } 27 | 28 | @override 29 | void didChangeDependencies() { 30 | super.didChangeDependencies(); 31 | } 32 | 33 | Widget _buildVideoFrame() { 34 | if (Platform.isWindows || Platform.isLinux) { 35 | return Obx(() => Video( 36 | key: widget.controller.playerKey, 37 | player: widget.controller.desktopController, 38 | scale: 1.0, // default 39 | showControls: false, // default 40 | fit: widget.controller.videoFit.value, 41 | )); 42 | } else { 43 | return BetterPlayer( 44 | key: widget.controller.playerKey, 45 | controller: widget.controller.mobileController!, 46 | ); 47 | } 48 | } 49 | 50 | Widget _buildVideoPanel() { 51 | return VideoControllerPanel( 52 | key: Key("${widget.controller.hashCode}_danmaku"), 53 | controller: widget.controller, 54 | ); 55 | } 56 | 57 | Widget _buildPlayer() { 58 | return Stack( 59 | children: [ 60 | _buildVideoFrame(), 61 | _buildVideoPanel(), 62 | ], 63 | ); 64 | } 65 | 66 | @override 67 | Widget build(BuildContext context) { 68 | return _buildPlayer(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/modules/popular/popular_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:pure_live/common/services/settings_service.dart'; 4 | import 'package:pure_live/modules/popular/popular_grid_controller.dart'; 5 | 6 | import '../../core/sites.dart'; 7 | 8 | class PopularController extends GetxController 9 | with GetSingleTickerProviderStateMixin { 10 | late TabController tabController; 11 | int index = 0; 12 | 13 | PopularController() { 14 | final preferPlatform = Get.find().preferPlatform.value; 15 | final pIndex = Sites.supportSites.indexWhere((e) => e.id == preferPlatform); 16 | tabController = TabController( 17 | initialIndex: pIndex == -1 ? 0 : pIndex, 18 | length: Sites.supportSites.length, 19 | vsync: this, 20 | ); 21 | index = pIndex == -1 ? 0 : pIndex; 22 | 23 | tabController.animation?.addListener(() { 24 | var currentIndex = (tabController.animation?.value ?? 0).round(); 25 | if (index == currentIndex) { 26 | return; 27 | } 28 | 29 | index = currentIndex; 30 | var controller = 31 | Get.find(tag: Sites.supportSites[index].id); 32 | 33 | if (controller.list.isEmpty && !controller.pageEmpty.value) { 34 | controller.onRefresh(); 35 | } 36 | }); 37 | } 38 | 39 | @override 40 | void onInit() { 41 | for (var site in Sites.supportSites) { 42 | Get.put( 43 | PopularGridController(site), 44 | tag: site.id, 45 | ); 46 | } 47 | super.onInit(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/modules/popular/popular_grid_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/base/base_controller.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | class PopularGridController extends BaseListController { 5 | final Site site; 6 | 7 | PopularGridController( 8 | this.site, 9 | ); 10 | 11 | @override 12 | Future> getData(int page, int pageSize) async { 13 | return await site.liveSite.getRecommend(page: page, size: pageSize); 14 | } 15 | 16 | void clear() { 17 | pageEmpty.value = false; 18 | list.clear(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/modules/popular/popular_grid_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 5 | 6 | import 'package:get/get.dart'; 7 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 8 | import 'package:pure_live/common/index.dart'; 9 | import 'package:pure_live/modules/popular/popular_grid_controller.dart'; 10 | 11 | class PopularGridView extends StatefulWidget { 12 | final String tag; 13 | 14 | const PopularGridView(this.tag, {Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _PopularGridViewState(); 18 | } 19 | 20 | class _PopularGridViewState extends State { 21 | PopularGridController get controller => 22 | Get.find(tag: widget.tag); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return LayoutBuilder( 27 | builder: (context, constraint) { 28 | final width = constraint.maxWidth; 29 | final crossAxisCount = 30 | width > 1280 ? 5 : (width > 960 ? 4 : (width > 640 ? 3 : 2)); 31 | return Listener( 32 | onPointerSignal: (event) { 33 | if (event is PointerScrollEvent && 34 | event.scrollDelta.direction >= 0 && 35 | event.scrollDelta.direction <= pi) { 36 | final pos = controller.scrollController.position; 37 | if (pos.maxScrollExtent - pos.pixels < 40) { 38 | controller.onLoading(); 39 | } 40 | } 41 | }, 42 | child: Obx(() => SmartRefresher( 43 | enablePullDown: true, 44 | enablePullUp: true, 45 | header: const WaterDropHeader(), 46 | footer: const ClassicFooter(), 47 | controller: controller.refreshController, 48 | onRefresh: controller.onRefresh, 49 | onLoading: controller.onLoading, 50 | child: controller.list.isNotEmpty 51 | ? MasonryGridView.count( 52 | padding: const EdgeInsets.all(5), 53 | controller: controller.scrollController, 54 | crossAxisCount: crossAxisCount, 55 | itemCount: controller.list.length, 56 | itemBuilder: (context, index) => RoomCard( 57 | room: controller.list[index], 58 | dense: true, 59 | ), 60 | ) 61 | : EmptyView( 62 | icon: Icons.live_tv_rounded, 63 | title: S.of(context).empty_live_title, 64 | subtitle: S.of(context).empty_live_subtitle, 65 | ), 66 | )), 67 | ); 68 | }, 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/modules/popular/popular_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:pure_live/core/sites.dart'; 4 | import 'package:pure_live/common/widgets/index.dart'; 5 | import 'package:pure_live/modules/popular/popular_controller.dart'; 6 | 7 | import 'popular_grid_view.dart'; 8 | 9 | class PopularPage extends GetView { 10 | const PopularPage({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return LayoutBuilder(builder: (context, constraint) { 15 | bool showAction = constraint.maxWidth <= 680; 16 | return Scaffold( 17 | appBar: AppBar( 18 | centerTitle: true, 19 | scrolledUnderElevation: 0, 20 | leading: showAction ? const MenuButton() : null, 21 | actions: showAction ? [const SearchButton()] : null, 22 | title: TabBar( 23 | controller: controller.tabController, 24 | isScrollable: true, 25 | labelStyle: 26 | const TextStyle(fontSize: 18, fontWeight: FontWeight.w600), 27 | labelPadding: const EdgeInsets.symmetric(horizontal: 12), 28 | indicatorSize: TabBarIndicatorSize.label, 29 | tabs: Sites.supportSites.map((e) => Tab(text: e.name)).toList(), 30 | ), 31 | ), 32 | body: TabBarView( 33 | controller: controller.tabController, 34 | children: 35 | Sites.supportSites.map((e) => PopularGridView(e.id)).toList(), 36 | ), 37 | ); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/modules/search/search_binding.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import 'search_controller.dart'; 4 | 5 | class SearchBinding extends Bindings { 6 | @override 7 | void dependencies() { 8 | Get.lazyPut( 9 | SearchController.new, 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/modules/search/search_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:get/get.dart'; 6 | 7 | import '../../core/sites.dart'; 8 | import 'search_list_controller.dart'; 9 | 10 | class SearchController extends GetxController 11 | with GetSingleTickerProviderStateMixin { 12 | late TabController tabController; 13 | int index = 0; 14 | 15 | SearchController() { 16 | tabController = TabController( 17 | length: Sites.supportSites.length, 18 | vsync: this, 19 | ); 20 | tabController.animation?.addListener(() { 21 | var currentIndex = (tabController.animation?.value ?? 0).round(); 22 | if (index == currentIndex) { 23 | return; 24 | } 25 | 26 | index = currentIndex; 27 | var controller = 28 | Get.find(tag: Sites.supportSites[index].id); 29 | 30 | if (controller.list.isEmpty && 31 | !controller.pageEmpty.value && 32 | controller.keyword.isNotEmpty) { 33 | controller.onRefresh(); 34 | } 35 | }); 36 | } 37 | 38 | StreamSubscription? streamSubscription; 39 | 40 | TextEditingController searchController = TextEditingController(); 41 | 42 | @override 43 | void onInit() { 44 | for (var site in Sites.supportSites) { 45 | Get.put( 46 | SearchListController(site), 47 | tag: site.id, 48 | ); 49 | } 50 | 51 | super.onInit(); 52 | } 53 | 54 | void doSearch() { 55 | if (searchController.text.isEmpty) { 56 | return; 57 | } 58 | for (var site in Sites.supportSites) { 59 | var controller = Get.find(tag: site.id); 60 | controller.clear(); 61 | controller.keyword = searchController.text; 62 | } 63 | var controller = 64 | Get.find(tag: Sites.supportSites[index].id); 65 | controller.onRefresh(); 66 | } 67 | 68 | @override 69 | void onClose() { 70 | streamSubscription?.cancel(); 71 | super.onClose(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/modules/search/search_list_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:pure_live/common/base/base_controller.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | 4 | class SearchListController extends BaseListController { 5 | String keyword = ""; 6 | final Site site; 7 | SearchListController( 8 | this.site, 9 | ); 10 | 11 | @override 12 | Future onRefresh() async { 13 | if (keyword.isEmpty) return; 14 | return await super.onRefresh(); 15 | } 16 | 17 | @override 18 | Future> getData(int page, int pageSize) async { 19 | return await site.liveSite.search(keyword); 20 | } 21 | 22 | void clear() { 23 | pageEmpty.value = false; 24 | list.clear(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/modules/search/search_list_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 3 | 4 | import 'package:get/get.dart'; 5 | import 'package:pure_live/common/index.dart'; 6 | import 'package:pure_live/modules/search/search_list_controller.dart'; 7 | import 'package:pure_live/routes/app_pages.dart'; 8 | 9 | class SearchListView extends StatelessWidget { 10 | final String tag; 11 | 12 | const SearchListView(this.tag, {Key? key}) : super(key: key); 13 | 14 | SearchListController get controller => 15 | Get.find(tag: tag); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return LayoutBuilder(builder: (context, constraint) { 20 | final width = constraint.maxWidth; 21 | final crossAxisCount = 22 | width > 1280 ? 4 : (width > 960 ? 3 : (width > 640 ? 2 : 1)); 23 | return Obx(() => controller.list.isNotEmpty 24 | ? MasonryGridView.count( 25 | padding: const EdgeInsets.all(8), 26 | physics: const BouncingScrollPhysics(), 27 | controller: controller.scrollController, 28 | crossAxisCount: crossAxisCount, 29 | itemCount: controller.list.length, 30 | itemBuilder: (context, index) { 31 | final room = controller.list[index]; 32 | return OwnerCard(room: room); 33 | }) 34 | : EmptyView( 35 | icon: Icons.live_tv_rounded, 36 | title: S.of(context).empty_search_title, 37 | subtitle: S.of(context).empty_search_subtitle, 38 | )); 39 | }); 40 | } 41 | } 42 | 43 | class OwnerCard extends StatefulWidget { 44 | const OwnerCard({Key? key, required this.room}) : super(key: key); 45 | 46 | final LiveRoom room; 47 | 48 | @override 49 | State createState() => _OwnerCardState(); 50 | } 51 | 52 | class _OwnerCardState extends State { 53 | SettingsService settings = Get.find(); 54 | 55 | void _onTap(BuildContext context) async { 56 | AppPages.toLivePlay(widget.room); 57 | } 58 | 59 | late bool isFavorite = settings.isFavorite(widget.room); 60 | 61 | @override 62 | Widget build(BuildContext context) { 63 | return Card( 64 | child: ListTile( 65 | onTap: () => _onTap(context), 66 | leading: CircleAvatar( 67 | foregroundImage: widget.room.avatar.isNotEmpty 68 | ? CachedNetworkImageProvider(widget.room.avatar) 69 | : null, 70 | radius: 20, 71 | backgroundColor: Theme.of(context).disabledColor, 72 | ), 73 | title: Text( 74 | widget.room.nick, 75 | maxLines: 1, 76 | style: const TextStyle(fontWeight: FontWeight.w600), 77 | ), 78 | subtitle: Text( 79 | "${widget.room.platform} - ${widget.room.area}", 80 | maxLines: 1, 81 | style: const TextStyle(fontWeight: FontWeight.w500), 82 | ), 83 | trailing: FilledButton.tonal( 84 | onPressed: () { 85 | setState(() => isFavorite = !isFavorite); 86 | if (isFavorite) { 87 | settings.addRoom(widget.room); 88 | } else { 89 | settings.removeRoom(widget.room); 90 | } 91 | }, 92 | style: isFavorite 93 | ? null 94 | : FilledButton.styleFrom( 95 | backgroundColor: Theme.of(context).colorScheme.surface), 96 | child: Text( 97 | isFavorite ? S.of(context).unfollow : S.of(context).follow, 98 | ), 99 | ), 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/modules/search/search_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:pure_live/core/sites.dart'; 4 | import 'package:pure_live/common/l10n/generated/l10n.dart'; 5 | import 'package:pure_live/modules/search/search_controller.dart'; 6 | 7 | import 'search_list_view.dart'; 8 | 9 | class SearchPage extends GetView { 10 | const SearchPage({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar( 16 | automaticallyImplyLeading: false, 17 | title: TextField( 18 | controller: controller.searchController, 19 | autofocus: true, 20 | decoration: InputDecoration( 21 | hintText: S.of(context).search_input_hint, 22 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(24)), 23 | contentPadding: const EdgeInsets.symmetric(horizontal: 12.0), 24 | prefixIcon: IconButton( 25 | onPressed: Get.back, 26 | icon: const Icon(Icons.arrow_back), 27 | ), 28 | suffixIcon: IconButton( 29 | onPressed: controller.doSearch, 30 | icon: const Icon(Icons.search), 31 | ), 32 | ), 33 | onSubmitted: (e) { 34 | controller.doSearch(); 35 | }, 36 | ), 37 | bottom: TabBar( 38 | controller: controller.tabController, 39 | padding: EdgeInsets.zero, 40 | tabs: Sites.supportSites.map((e) => Tab(text: e.name)).toList(), 41 | isScrollable: false, 42 | indicatorSize: TabBarIndicatorSize.label, 43 | ), 44 | ), 45 | body: TabBarView( 46 | controller: controller.tabController, 47 | children: Sites.supportSites.map((e) => SearchListView(e.id)).toList(), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/modules/settings/settings_binding.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/services/settings_service.dart'; 3 | 4 | class SettingsBinding extends Bindings { 5 | @override 6 | void dependencies() { 7 | Get.lazyPut( 8 | SettingsService.new, 9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/routes/app_pages.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | import 'package:pure_live/common/index.dart'; 3 | import 'package:pure_live/modules/about/about_page.dart'; 4 | import 'package:pure_live/modules/about/donate_page.dart'; 5 | import 'package:pure_live/modules/area_rooms/area_rooms_controller.dart'; 6 | import 'package:pure_live/modules/area_rooms/area_rooms_page.dart'; 7 | import 'package:pure_live/modules/areas/areas_page.dart'; 8 | import 'package:pure_live/modules/backup/backup_page.dart'; 9 | import 'package:pure_live/modules/contact/contact_page.dart'; 10 | import 'package:pure_live/modules/favorite/favorite_page.dart'; 11 | import 'package:pure_live/modules/home/home_page.dart'; 12 | import 'package:pure_live/modules/live_play/live_play_controller.dart'; 13 | import 'package:pure_live/modules/live_play/live_play_page.dart'; 14 | import 'package:pure_live/modules/popular/popular_page.dart'; 15 | import 'package:pure_live/modules/settings/settings_binding.dart'; 16 | import 'package:pure_live/modules/settings/settings_page.dart'; 17 | import 'package:pure_live/modules/search/search_binding.dart'; 18 | import 'package:pure_live/modules/search/search_page.dart'; 19 | import 'package:pure_live/modules/history/history_page.dart'; 20 | 21 | 22 | class AppPages { 23 | AppPages._(); 24 | 25 | static const initial = '/home'; 26 | static const favorite = '/favorite'; 27 | static const popular = '/popular'; 28 | static const areas = '/areas'; 29 | 30 | static const areaRooms = '/area_rooms'; 31 | static const livePlay = '/live_play'; 32 | 33 | static const search = '/search'; 34 | static const settings = '/settings'; 35 | static const contact = '/contact'; 36 | static const backup = '/backup'; 37 | static const about = '/about'; 38 | static const history = '/history'; 39 | static const donate = '/donate'; 40 | 41 | static toAreaRooms(LiveArea area) { 42 | Get.toNamed(areaRooms, arguments: area); 43 | } 44 | 45 | static toLivePlay(LiveRoom room) { 46 | Get.toNamed(livePlay, arguments: room); 47 | } 48 | 49 | static final routes = [ 50 | GetPage( 51 | name: initial, 52 | page: HomePage.new, 53 | ), 54 | GetPage( 55 | name: favorite, 56 | page: FavoritePage.new, 57 | ), 58 | GetPage( 59 | name: popular, 60 | page: PopularPage.new, 61 | ), 62 | GetPage( 63 | name: areas, 64 | page: AreasPage.new, 65 | ), 66 | GetPage( 67 | name: settings, 68 | page: SettingsPage.new, 69 | binding: SettingsBinding(), 70 | ), 71 | GetPage( 72 | name: history, 73 | page: HistoryPage.new, 74 | ), 75 | GetPage( 76 | name: search, 77 | page: SearchPage.new, 78 | binding: SearchBinding(), 79 | ), 80 | GetPage( 81 | name: contact, 82 | page: ContactPage.new, 83 | ), 84 | GetPage( 85 | name: backup, 86 | page: BackupPage.new, 87 | ), 88 | GetPage( 89 | name: about, 90 | page: AboutPage.new, 91 | ), 92 | GetPage( 93 | name: donate, 94 | page: DonatePage.new, 95 | ), 96 | GetPage( 97 | name: areaRooms, 98 | page: AreasRoomPage.new, 99 | binding: BindingsBuilder.put( 100 | () => AreaRoomsController(Get.arguments), 101 | ), 102 | ), 103 | GetPage( 104 | name: livePlay, 105 | page: LivePlayPage.new, 106 | binding: BindingsBuilder.put( 107 | () => LivePlayController(Get.arguments), 108 | ), 109 | ), 110 | ]; 111 | } 112 | -------------------------------------------------------------------------------- /screenshots/areas_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/areas_page.jpg -------------------------------------------------------------------------------- /screenshots/desktop_favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/desktop_favorite.png -------------------------------------------------------------------------------- /screenshots/desktop_live_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/desktop_live_play.png -------------------------------------------------------------------------------- /screenshots/desktop_popular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/desktop_popular.png -------------------------------------------------------------------------------- /screenshots/favorite_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/favorite_page.jpg -------------------------------------------------------------------------------- /screenshots/live_play_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/live_play_page.jpg -------------------------------------------------------------------------------- /screenshots/popular_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/popular_page.jpg -------------------------------------------------------------------------------- /screenshots/search_page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/screenshots/search_page.jpg -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:pure_live/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(pure_live LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "pure_live") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | void RegisterPlugins(flutter::PluginRegistry* registry) { 20 | BatteryPlusWindowsPluginRegisterWithRegistrar( 21 | registry->GetRegistrarForPlugin("BatteryPlusWindowsPlugin")); 22 | DartVlcPluginRegisterWithRegistrar( 23 | registry->GetRegistrarForPlugin("DartVlcPlugin")); 24 | DynamicColorPluginCApiRegisterWithRegistrar( 25 | registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); 26 | FlutterJsPluginRegisterWithRegistrar( 27 | registry->GetRegistrarForPlugin("FlutterJsPlugin")); 28 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 29 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 30 | ScreenBrightnessWindowsPluginRegisterWithRegistrar( 31 | registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin")); 32 | ScreenRetrieverPluginRegisterWithRegistrar( 33 | registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); 34 | UrlLauncherWindowsRegisterWithRegistrar( 35 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 36 | WindowManagerPluginRegisterWithRegistrar( 37 | registry->GetRegistrarForPlugin("WindowManagerPlugin")); 38 | } 39 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | battery_plus 7 | dart_vlc 8 | dynamic_color 9 | flutter_js 10 | permission_handler_windows 11 | screen_brightness_windows 12 | screen_retriever 13 | url_launcher_windows 14 | window_manager 15 | ) 16 | 17 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 18 | ) 19 | 20 | set(PLUGIN_BUNDLED_LIBRARIES) 21 | 22 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 24 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 26 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 27 | endforeach(plugin) 28 | 29 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 30 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 31 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 32 | endforeach(ffi_plugin) 33 | -------------------------------------------------------------------------------- /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_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /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", "com.mystyle" "\0" 93 | VALUE "FileDescription", "pure_live" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "pure_live" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.mystyle. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "pure_live.exe" "\0" 98 | VALUE "ProductName", "pure_live" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"PureLive", 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/Jackiu1997/pure_live/e226afe20c7a174311d9ee6aa2ea5c66fa212810/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------