Repository: xiaoyaocz/dart_simple_live
Branch: master
Commit: ba828e6783b1
Files: 436
Total size: 2.6 MB
Directory structure:
gitextract_y43zef6r/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug.yml
│ │ ├── config.yml
│ │ └── feature.yml
│ └── workflows/
│ ├── publish_app_dev.yaml
│ ├── publish_app_release.yml
│ ├── publish_tv_app_dev.yaml
│ └── publish_tv_app_release.yaml
├── .gitignore
├── .vscode/
│ └── settings.json
├── LICENSE
├── README.md
├── assets/
│ ├── app_version.json
│ ├── play_config.json
│ └── tv_app_version.json
├── simple_live_app/
│ ├── .fvmrc
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── android/
│ │ ├── .gitignore
│ │ ├── app/
│ │ │ ├── build.gradle.kts
│ │ │ ├── proguard-rules.pro
│ │ │ └── src/
│ │ │ ├── debug/
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── kotlin/
│ │ │ │ │ └── com/
│ │ │ │ │ └── xycz/
│ │ │ │ │ └── simple_live/
│ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── res/
│ │ │ │ ├── drawable/
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable-v21/
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── values/
│ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── values-night/
│ │ │ │ │ └── styles.xml
│ │ │ │ └── xml/
│ │ │ │ └── network_security_config.xml
│ │ │ └── profile/
│ │ │ └── AndroidManifest.xml
│ │ ├── build/
│ │ │ └── reports/
│ │ │ └── problems/
│ │ │ └── problems-report.html
│ │ ├── build.gradle.kts
│ │ ├── gradle/
│ │ │ └── wrapper/
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradle.properties
│ │ └── settings.gradle.kts
│ ├── assets/
│ │ ├── lotties/
│ │ │ ├── empty.json
│ │ │ ├── error.json
│ │ │ └── loadding.json
│ │ └── statement.txt
│ ├── distribute_options.yaml
│ ├── ios/
│ │ ├── .gitignore
│ │ ├── Flutter/
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Podfile
│ │ ├── Runner/
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchImage.imageset/
│ │ │ │ ├── Contents.json
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── Runner-Bridging-Header.h
│ │ ├── 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
│ ├── lib/
│ │ ├── app/
│ │ │ ├── app_style.dart
│ │ │ ├── constant.dart
│ │ │ ├── controller/
│ │ │ │ ├── app_settings_controller.dart
│ │ │ │ └── base_controller.dart
│ │ │ ├── custom_throttle.dart
│ │ │ ├── event_bus.dart
│ │ │ ├── log.dart
│ │ │ ├── sites.dart
│ │ │ ├── utils/
│ │ │ │ ├── archive.dart
│ │ │ │ ├── document.dart
│ │ │ │ └── listen_fourth_button.dart
│ │ │ └── utils.dart
│ │ ├── main.dart
│ │ ├── models/
│ │ │ ├── account/
│ │ │ │ └── bilibili_user_info_page.dart
│ │ │ ├── db/
│ │ │ │ ├── follow_user.dart
│ │ │ │ ├── follow_user.g.dart
│ │ │ │ ├── follow_user_tag.dart
│ │ │ │ ├── follow_user_tag.g.dart
│ │ │ │ ├── history.dart
│ │ │ │ └── history.g.dart
│ │ │ ├── follow_user_item.dart
│ │ │ ├── sync_client_info_model.dart
│ │ │ └── version_model.dart
│ │ ├── modules/
│ │ │ ├── category/
│ │ │ │ ├── category_controller.dart
│ │ │ │ ├── category_list_controller.dart
│ │ │ │ ├── category_list_view.dart
│ │ │ │ ├── category_page.dart
│ │ │ │ └── detail/
│ │ │ │ ├── category_detail_controller.dart
│ │ │ │ └── category_detail_page.dart
│ │ │ ├── follow_user/
│ │ │ │ ├── follow_user_controller.dart
│ │ │ │ └── follow_user_page.dart
│ │ │ ├── home/
│ │ │ │ ├── home_controller.dart
│ │ │ │ ├── home_list_controller.dart
│ │ │ │ ├── home_list_view.dart
│ │ │ │ └── home_page.dart
│ │ │ ├── indexed/
│ │ │ │ ├── indexed_controller.dart
│ │ │ │ └── indexed_page.dart
│ │ │ ├── live_room/
│ │ │ │ ├── live_room_controller.dart
│ │ │ │ ├── live_room_page.dart
│ │ │ │ └── player/
│ │ │ │ ├── player_controller.dart
│ │ │ │ └── player_controls.dart
│ │ │ ├── mine/
│ │ │ │ ├── account/
│ │ │ │ │ ├── account_controller.dart
│ │ │ │ │ ├── account_page.dart
│ │ │ │ │ └── bilibili/
│ │ │ │ │ ├── qr_login_controller.dart
│ │ │ │ │ ├── qr_login_page.dart
│ │ │ │ │ ├── web_login_controller.dart
│ │ │ │ │ └── web_login_page.dart
│ │ │ │ ├── history/
│ │ │ │ │ ├── history_controller.dart
│ │ │ │ │ └── history_page.dart
│ │ │ │ ├── mine_page.dart
│ │ │ │ └── parse/
│ │ │ │ ├── parse_controller.dart
│ │ │ │ └── parse_page.dart
│ │ │ ├── other/
│ │ │ │ └── debug_log_page.dart
│ │ │ ├── search/
│ │ │ │ ├── douyin/
│ │ │ │ │ ├── douyin_search_controller.dart
│ │ │ │ │ └── douyin_search_view.dart
│ │ │ │ ├── search_controller.dart
│ │ │ │ ├── search_list_controller.dart
│ │ │ │ ├── search_list_view.dart
│ │ │ │ └── search_page.dart
│ │ │ ├── settings/
│ │ │ │ ├── appstyle_setting_page.dart
│ │ │ │ ├── auto_exit_settings_page.dart
│ │ │ │ ├── danmu_settings_page.dart
│ │ │ │ ├── danmu_shield/
│ │ │ │ │ ├── danmu_shield_controller.dart
│ │ │ │ │ └── danmu_shield_page.dart
│ │ │ │ ├── follow_settings_page.dart
│ │ │ │ ├── indexed_settings/
│ │ │ │ │ ├── indexed_settings_controller.dart
│ │ │ │ │ └── indexed_settings_page.dart
│ │ │ │ ├── other/
│ │ │ │ │ ├── other_settings_controller.dart
│ │ │ │ │ └── other_settings_page.dart
│ │ │ │ └── play_settings_page.dart
│ │ │ └── sync/
│ │ │ ├── local_sync/
│ │ │ │ ├── device/
│ │ │ │ │ ├── sync_device_controller.dart
│ │ │ │ │ └── sync_device_page.dart
│ │ │ │ ├── local_sync_controller.dart
│ │ │ │ ├── local_sync_page.dart
│ │ │ │ └── scan_qr/
│ │ │ │ ├── sync_scan_qr_controller.dart
│ │ │ │ └── sync_scan_qr_page.dart
│ │ │ ├── remote_sync/
│ │ │ │ ├── room/
│ │ │ │ │ ├── remote_sync_room_controller.dart
│ │ │ │ │ └── remote_sync_room_page.dart
│ │ │ │ └── webdav/
│ │ │ │ ├── remote_sync_webdav_config_page.dart
│ │ │ │ ├── remote_sync_webdav_controller.dart
│ │ │ │ ├── remote_sync_webdav_page.dart
│ │ │ │ └── webdav_client.dart
│ │ │ └── sync_page.dart
│ │ ├── requests/
│ │ │ ├── custom_log_interceptor.dart
│ │ │ ├── http_client.dart
│ │ │ ├── http_error.dart
│ │ │ └── sync_client_request.dart
│ │ ├── routes/
│ │ │ ├── app_navigation.dart
│ │ │ ├── app_pages.dart
│ │ │ └── route_path.dart
│ │ ├── services/
│ │ │ ├── bilibili_account_service.dart
│ │ │ ├── db_service.dart
│ │ │ ├── douyin_account_service.dart
│ │ │ ├── follow_service.dart
│ │ │ ├── local_storage_service.dart
│ │ │ ├── signalr_service.dart
│ │ │ └── sync_service.dart
│ │ └── widgets/
│ │ ├── desktop_refresh_button.dart
│ │ ├── filter_button.dart
│ │ ├── follow_user_item.dart
│ │ ├── keep_alive_wrapper.dart
│ │ ├── live_room_card.dart
│ │ ├── net_image.dart
│ │ ├── none_border_circular_textfield.dart
│ │ ├── page_grid_view.dart
│ │ ├── page_list_view.dart
│ │ ├── rectangular_indicator.dart
│ │ ├── settings/
│ │ │ ├── settings_action.dart
│ │ │ ├── settings_card.dart
│ │ │ ├── settings_menu.dart
│ │ │ ├── settings_number.dart
│ │ │ └── settings_switch.dart
│ │ ├── shadow_card.dart
│ │ ├── status/
│ │ │ ├── app_empty_widget.dart
│ │ │ ├── app_error_widget.dart
│ │ │ └── app_loadding_widget.dart
│ │ └── superchat_card.dart
│ ├── linux/
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── flutter/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── generated_plugin_registrant.cc
│ │ │ ├── generated_plugin_registrant.h
│ │ │ └── generated_plugins.cmake
│ │ ├── packaging/
│ │ │ └── deb/
│ │ │ └── make_config.yaml
│ │ └── runner/
│ │ ├── CMakeLists.txt
│ │ ├── main.cc
│ │ ├── my_application.cc
│ │ └── my_application.h
│ ├── macos/
│ │ ├── .gitignore
│ │ ├── Flutter/
│ │ │ ├── Flutter-Debug.xcconfig
│ │ │ ├── Flutter-Release.xcconfig
│ │ │ └── GeneratedPluginRegistrant.swift
│ │ ├── Podfile
│ │ ├── Runner/
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj/
│ │ │ │ └── MainMenu.xib
│ │ │ ├── Configs/
│ │ │ │ ├── AppInfo.xcconfig
│ │ │ │ ├── Debug.xcconfig
│ │ │ │ ├── Release.xcconfig
│ │ │ │ └── Warnings.xcconfig
│ │ │ ├── DebugProfile.entitlements
│ │ │ ├── Info.plist
│ │ │ ├── MainFlutterWindow.swift
│ │ │ └── Release.entitlements
│ │ ├── Runner.xcodeproj/
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace/
│ │ │ │ └── xcshareddata/
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcshareddata/
│ │ │ └── xcschemes/
│ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace/
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ └── IDEWorkspaceChecks.plist
│ │ ├── RunnerTests/
│ │ │ └── RunnerTests.swift
│ │ └── packaging/
│ │ └── dmg/
│ │ └── make_config.yaml
│ ├── pubspec.yaml
│ ├── test/
│ │ └── widget_test.dart
│ └── windows/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter/
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── packaging/
│ │ └── msix/
│ │ └── make_config.yaml
│ └── runner/
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── simple_live_console/
│ ├── .gitignore
│ ├── .vscode/
│ │ └── launch.json
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── bin/
│ │ └── simple_live_console.dart
│ ├── pubspec.yaml
│ └── test/
│ └── all_live_console_test.dart
├── simple_live_core/
│ ├── .gitignore
│ ├── .vscode/
│ │ └── launch.json
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── example/
│ │ └── simple_live_core_example.dart
│ ├── lib/
│ │ ├── simple_live_core.dart
│ │ └── src/
│ │ ├── bilibili_site.dart
│ │ ├── common/
│ │ │ ├── binary_writer.dart
│ │ │ ├── convert_helper.dart
│ │ │ ├── core_error.dart
│ │ │ ├── core_log.dart
│ │ │ ├── custom_interceptor.dart
│ │ │ ├── http_client.dart
│ │ │ └── web_socket_util.dart
│ │ ├── danmaku/
│ │ │ ├── bilibili_danmaku.dart
│ │ │ ├── douyin_danmaku.dart
│ │ │ ├── douyu_danmaku.dart
│ │ │ ├── huya_danmaku.dart
│ │ │ └── proto/
│ │ │ ├── douyin.pb.dart
│ │ │ ├── douyin.pbenum.dart
│ │ │ ├── douyin.pbjson.dart
│ │ │ └── douyin.proto
│ │ ├── douyin_site.dart
│ │ ├── douyu_site.dart
│ │ ├── huya_site.dart
│ │ ├── interface/
│ │ │ ├── live_danmaku.dart
│ │ │ └── live_site.dart
│ │ ├── model/
│ │ │ ├── live_anchor_item.dart
│ │ │ ├── live_category.dart
│ │ │ ├── live_category_result.dart
│ │ │ ├── live_message.dart
│ │ │ ├── live_play_quality.dart
│ │ │ ├── live_play_url.dart
│ │ │ ├── live_room_detail.dart
│ │ │ ├── live_room_item.dart
│ │ │ ├── live_search_result.dart
│ │ │ └── tars/
│ │ │ ├── get_cdn_token_ex_req.dart
│ │ │ ├── get_cdn_token_ex_resp.dart
│ │ │ ├── get_cdn_token_req.dart
│ │ │ ├── get_cdn_token_resp.dart
│ │ │ ├── huya_danmaku.dart
│ │ │ ├── huya_user_id.dart
│ │ │ └── tar2dart.dart
│ │ └── scripts/
│ │ ├── douyin_sign.dart
│ │ └── douyu_sign.dart
│ ├── packages/
│ │ └── tars_dart/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── analysis_options.yaml
│ │ ├── lib/
│ │ │ └── tars/
│ │ │ ├── codec/
│ │ │ │ ├── tars_decode_exception.dart
│ │ │ │ ├── tars_deep_copyable.dart
│ │ │ │ ├── tars_displayer.dart
│ │ │ │ ├── tars_encode_exception.dart
│ │ │ │ ├── tars_input_stream.dart
│ │ │ │ ├── tars_output_stream.dart
│ │ │ │ └── tars_struct.dart
│ │ │ ├── net/
│ │ │ │ └── base_tars_http.dart
│ │ │ └── tup/
│ │ │ ├── basic_class_type_util.dart
│ │ │ ├── const.dart
│ │ │ ├── object_create_exception.dart
│ │ │ ├── request_packet.dart
│ │ │ ├── tars_uni_packet.dart
│ │ │ ├── tup_response.dart
│ │ │ ├── tup_result_exception.dart
│ │ │ ├── uni_attribute.dart
│ │ │ ├── uni_packet.dart
│ │ │ └── write_buffer.dart
│ │ └── pubspec.yaml
│ ├── pubspec.yaml
│ └── test/
│ └── simple_live_core_test.dart
└── simple_live_tv_app/
├── .fvmrc
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android/
│ ├── .gitignore
│ ├── app/
│ │ ├── build.gradle.kts
│ │ ├── proguard-rules.pro
│ │ └── src/
│ │ ├── debug/
│ │ │ └── AndroidManifest.xml
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin/
│ │ │ │ └── com/
│ │ │ │ └── xycz/
│ │ │ │ └── simple_live_tv/
│ │ │ │ └── MainActivity.kt
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ └── launch_background.xml
│ │ │ ├── drawable-v21/
│ │ │ │ └── launch_background.xml
│ │ │ ├── mipmap-anydpi-v26/
│ │ │ │ └── ic_banner.xml
│ │ │ ├── values/
│ │ │ │ ├── ic_banner_background.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-night/
│ │ │ │ └── styles.xml
│ │ │ └── xml/
│ │ │ └── network_security_config.xml
│ │ └── profile/
│ │ └── AndroidManifest.xml
│ ├── build.gradle.kts
│ ├── gradle/
│ │ └── wrapper/
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle.kts
├── assets/
│ ├── lotties/
│ │ ├── empty.json
│ │ ├── error.json
│ │ └── loadding.json
│ └── statement.txt
├── lib/
│ ├── app/
│ │ ├── app_error.dart
│ │ ├── app_focus_node.dart
│ │ ├── app_style.dart
│ │ ├── base_focus_model.dart
│ │ ├── constant.dart
│ │ ├── controller/
│ │ │ ├── app_settings_controller.dart
│ │ │ └── base_controller.dart
│ │ ├── event_bus.dart
│ │ ├── log.dart
│ │ ├── sites.dart
│ │ └── utils.dart
│ ├── main.dart
│ ├── models/
│ │ ├── account/
│ │ │ └── bilibili_user_info_page.dart
│ │ ├── db/
│ │ │ ├── follow_user.dart
│ │ │ ├── follow_user.g.dart
│ │ │ ├── history.dart
│ │ │ └── history.g.dart
│ │ ├── follow_user_item.dart
│ │ └── version_model.dart
│ ├── modules/
│ │ ├── account/
│ │ │ └── bilibili/
│ │ │ ├── qr_login_controller.dart
│ │ │ └── qr_login_page.dart
│ │ ├── agreement/
│ │ │ └── agreement_page.dart
│ │ ├── category/
│ │ │ ├── category_controller.dart
│ │ │ ├── category_page.dart
│ │ │ └── detail/
│ │ │ ├── category_detail_controller.dart
│ │ │ └── category_detail_page.dart
│ │ ├── follow_user/
│ │ │ └── follow_user_page.dart
│ │ ├── history/
│ │ │ ├── history_controller.dart
│ │ │ └── history_page.dart
│ │ ├── home/
│ │ │ ├── home_controller.dart
│ │ │ └── home_page.dart
│ │ ├── hot_live/
│ │ │ ├── hot_live_controller.dart
│ │ │ └── hot_live_page.dart
│ │ ├── live_room/
│ │ │ ├── live_room_controller.dart
│ │ │ ├── live_room_page.dart
│ │ │ └── player/
│ │ │ ├── player_controller.dart
│ │ │ └── player_controls.dart
│ │ ├── search/
│ │ │ ├── anchor/
│ │ │ │ ├── search_anchor_controller.dart
│ │ │ │ └── search_anchor_page.dart
│ │ │ └── room/
│ │ │ ├── search_room_controller.dart
│ │ │ └── search_room_page.dart
│ │ ├── settings/
│ │ │ ├── settings_controller.dart
│ │ │ └── settings_page.dart
│ │ └── sync/
│ │ ├── sync_controller.dart
│ │ └── sync_page.dart
│ ├── requests/
│ │ ├── common_request.dart
│ │ ├── custom_log_interceptor.dart
│ │ ├── http_client.dart
│ │ └── http_error.dart
│ ├── routes/
│ │ ├── app_navigation.dart
│ │ ├── app_pages.dart
│ │ └── route_path.dart
│ ├── services/
│ │ ├── bilibili_account_service.dart
│ │ ├── db_service.dart
│ │ ├── follow_user_service.dart
│ │ ├── local_storage_service.dart
│ │ ├── signalr_service.dart
│ │ └── sync_service.dart
│ └── widgets/
│ ├── app_scaffold.dart
│ ├── button/
│ │ ├── highlight_button.dart
│ │ ├── highlight_list_tile.dart
│ │ └── home_big_button.dart
│ ├── card/
│ │ ├── anchor_card.dart
│ │ └── live_room_card.dart
│ ├── highlight_widget.dart
│ ├── keep_alive_wrapper.dart
│ ├── net_image.dart
│ ├── page_grid_view.dart
│ ├── rectangular_indicator.dart
│ ├── settings_item_widget.dart
│ └── status/
│ ├── app_empty_widget.dart
│ ├── app_error_widget.dart
│ └── app_loadding_widget.dart
├── pubspec.yaml
├── 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
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug.yml
================================================
name: BUG报告
title: "[BUG] 请填写简短易读的标题"
description: "使用过程中遇到了BUG"
assignees: xiaoyaocz
labels:
- "bug"
body:
- type: checkboxes
id: terms
attributes:
label: 非重复的Issue
description: 先去Issues列表中查找下是否存在相似的Issue,如果有了就不要重复发了
options:
- label: 已确认没有相似的Issue
required: true
- type: textarea
id: description
validations:
required: true
attributes:
label: BUG内容
description: 请详细描述你遇到的问题
- type: textarea
id: steps
validations:
required: true
attributes:
label: 重现步骤
render: plain text
description: 请详细描述重现步骤
placeholder: |
1. xxxx
2. xxxx
3. xxxx
- type: textarea
id: screenshots
attributes:
label: 截图或视频
description: 请上传BUG截图、或视频
- type: textarea
id: logs
attributes:
label: 日志
description: 请上传日志文件
placeholder: |
可以在[其他设置]-[开启日志记录]后获取日志文件
- type: input
id: version
attributes:
label: 版本号
description: 请填写你使用的APP版本号
placeholder: ex. 1.0.1
validations:
required: true
- type: dropdown
id: release-type
validations:
required: true
attributes:
label: 使用版本
description: 使用的是什么版本,从哪里下载的
options:
- 正式版(Releases)
- 开发版(Actions)
default: 0
- type: dropdown
id: platform
validations:
required: true
attributes:
label: 运行平台
description: 选择你当前运行应用的平台
multiple: false
options:
- Windows
- macOS
- Linux
- Android
- iOS
- Android TV
- type: input
id: os-version
attributes:
label: 操作系统信息
description: 请填写你的操作系统信息版本
placeholder: ex. Windows 10 21H1 / MIUI 15 Android 12
validations:
required: true
- type: input
id: device
attributes:
label: 设备信息
description: 请填写你的设备信息
placeholder: ex. PC / iPhone 12 Pro Max
validations:
required: true
- type: textarea
id: remark
attributes:
label: 备注
description: 其他信息
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
================================================
FILE: .github/ISSUE_TEMPLATE/feature.yml
================================================
name: 功能请求
title: "[Feature] 请填写简短易读的标题"
description: "请求开发新的功能/优化某项功能"
assignees: xiaoyaocz
labels:
- "enhancement"
body:
- type: markdown
attributes:
value: |
你的Issue大概率会搁置很久,除非是那种我能随手解决的。
暂时不会添加新的平台支持(因为我自己用不上)。如果你有开发能力,建议的自行开发后提交个PR。
- type: checkboxes
id: terms
attributes:
label: 非重复的Issue
description: 先去Issues列表中查找下是否存在相似的Issue,如果有了就不要重复发了
options:
- label: 已确认没有相似的Issue
required: true
- type: textarea
id: description
validations:
required: true
attributes:
label: 功能描述
description: 请填写功能描述,如果你有多个建议、请求,请分开提交Issue
- type: checkboxes
id: platform
attributes:
label: 平台
description: 这个功能针对什么平台
options:
- label: Android
- label: iOS
- label: MacOS
- label: Windows
- label: Linux
- label: Android TV
- type: textarea
id: additional
attributes:
label: 附加信息
description: 可以附加相关截图、视频或链接(好让我知道要我抄哪个APP)
================================================
FILE: .github/workflows/publish_app_dev.yaml
================================================
name: app-build-action-dev
on:
workflow_dispatch:
push:
tags:
- "dev_v*"
jobs:
# 打包Android、iOS、Mac
build-mac-ios-android:
runs-on: macos-latest
permissions:
contents: write
steps:
# 签出代码
- uses: actions/checkout@v4
with:
ref: dev
# APK签名设置
- name: Download Android keystore
id: android_keystore
uses: timheuer/base64-to-file@v1.2
with:
fileName: keystore.jks
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > simple_live_app/android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> simple_live_app/android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> simple_live_app/android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> simple_live_app/android/key.properties
# 设置JAVA环境
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
# 设置Flutter
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
# 打开MAC Desktop支持
- name: Enable Flutter Desktop
run: flutter config --enable-macos-desktop
# 更新Flutter的packages
- name: Restore packages
run: |
cd simple_live_app
flutter pub get
# 安装appdmg npm install -g appdmg
- name: Install appdmg
run: npm install -g appdmg
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# 打包APK
- name: Build APK
run: |
cd simple_live_app
flutter build apk --release --split-per-abi
#上传Artifacts
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v4
with:
name: android
path: |
simple_live_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
#打包iOS
- name: Build IPA
run: |
cd simple_live_app
flutter build ios --release --no-codesign
#创建未签名ipa
- name: Create IPA
run: |
cd simple_live_app
mkdir build/ios/iphoneos/Payload
cp -R build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/Runner.app
cd build/ios/iphoneos/
zip -q -r ios_no_sign.ipa Payload
cd ../../..
# 上传IPA至Artifacts
- name: Upload IPA to Artifacts
uses: actions/upload-artifact@v4
with:
name: ios
path: |
simple_live_app/build/ios/iphoneos/ios_no_sign.ipa
# 打包MAC
- name: Build MacOS
run: |
cd simple_live_app
flutter_distributor package --platform macos --targets dmg,zip --skip-clean
# 上传MAC至Artifacts
- name: Upload MacOS to Artifacts
uses: actions/upload-artifact@v4
with:
name: mac
path: |
simple_live_app/build/dist/*/*.dmg
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 This job's status is ${{ job.status }}."
# 打包Linux
build-linux:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# 签出代码
- uses: actions/checkout@v4
with:
ref: dev
# 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
# 安装依赖
- name: Update apt-get
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libasound2-dev libmpv-dev mpv
# 打开Linux Desktop支持
- name: Enable Flutter Desktop
run: flutter config --enable-linux-desktop
# 更新Flutter的packages
- name: Restore Packages
run: |
cd simple_live_app
flutter pub get
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# build Linux ZIP\DMG
- name: Build Linux
run: |
cd simple_live_app
flutter_distributor package --platform linux --targets deb,zip --skip-clean
# 上传Linux包至Artifacts
- name: Upload Linux APP to Artifacts
uses: actions/upload-artifact@v4
with:
name: linux
path: |
simple_live_app/build/dist/*/*.deb
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 Linux job's status is ${{ job.status }}."
# 打包Windows
build-windows:
runs-on: windows-latest
permissions:
contents: write
steps:
# 签出代码
- uses: actions/checkout@v4
with:
ref: dev
# 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
- name: Enable Flutter Desktop
run: flutter config --enable-windows-desktop
- name: Restore Packages
run: |
cd simple_live_app
flutter pub get
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# build Windows ZIP\MSIX
- name: Build Windows
run: |
cd simple_live_app
flutter_distributor package --platform windows --targets msix,zip --skip-clean
# 上传Windows至Artifacts
- name: Upload Windows APP to Artifacts
uses: actions/upload-artifact@v4
with:
name: windows
path: |
simple_live_app/build/dist/*/*.msix
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 Windows job's status is ${{ job.status }}."
================================================
FILE: .github/workflows/publish_app_release.yml
================================================
name: app-build-action
#推送Tag时触发
on:
push:
tags:
- "v*"
jobs:
build-mac-ios-android:
runs-on: macos-latest
permissions:
contents: write
steps:
#签出代码
- uses: actions/checkout@v4
with:
ref: master
#APK签名设置
- name: Download Android keystore
id: android_keystore
uses: timheuer/base64-to-file@v1.2
with:
fileName: keystore.jks
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > simple_live_app/android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> simple_live_app/android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> simple_live_app/android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> simple_live_app/android/key.properties
#设置JAVA环境
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
#设置Flutter
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
# 打开MAC Desktop支持
- name: Enable Flutter Desktop
run: flutter config --enable-macos-desktop
#更新Flutter的packages
- name: Restore packages
run: |
cd simple_live_app
flutter pub get
# 安装appdmg npm install -g appdmg
- name: Install appdmg
run: npm install -g appdmg
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
#打包APK
- name: Build APK
run: |
cd simple_live_app
flutter build apk --release --split-per-abi
#上传APK至Artifacts
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v4
with:
name: android
path: |
simple_live_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
#打包iOS
- name: Build IPA
run: |
cd simple_live_app
flutter build ios --release --no-codesign
#创建未签名ipa
- name: Create IPA
run: |
cd simple_live_app
mkdir build/ios/iphoneos/Payload
cp -R build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/Runner.app
cd build/ios/iphoneos/
zip -q -r ios_no_sign.ipa Payload
cd ../../..
#上传IPA至Artifacts
- name: Upload IPA to Artifacts
uses: actions/upload-artifact@v4
with:
name: ios
path: |
simple_live_app/build/ios/iphoneos/ios_no_sign.ipa
# 打包MAC
- name: Build MacOS
run: |
cd simple_live_app
flutter_distributor package --platform macos --targets dmg,zip --skip-clean
# 上传MAC至Artifacts
- name: Upload MacOS to Artifacts
uses: actions/upload-artifact@v4
with:
name: mac
path: |
simple_live_app/build/dist/*/*.dmg
simple_live_app/build/dist/*/*.zip
#获取版本信息(自动从 Git Tag 提取)
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Echo version
run: echo "${{ steps.version.outputs.VERSION }}"
#上传至Release
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
name: "${{ steps.version.outputs.VERSION }}"
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
token: ${{ secrets.TOKEN }}
files: |
simple_live_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
simple_live_app/build/ios/iphoneos/ios_no_sign.ipa
simple_live_app/build/dist/*/*.dmg
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 This job's status is ${{ job.status }}."
# 打包Linux
build-linux:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# 签出代码
- uses: actions/checkout@v4
with:
ref: master
# 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
# 安装依赖
- name: Update apt-get
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libasound2-dev libmpv-dev mpv
# 打开Linux Desktop支持
- name: Enable Flutter Desktop
run: flutter config --enable-linux-desktop
# 更新Flutter的packages
- name: Restore Packages
run: |
cd simple_live_app
flutter pub get
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# build Linux ZIP\DMG
- name: Build Linux
run: |
cd simple_live_app
flutter_distributor package --platform linux --targets deb,zip --skip-clean
# 上传Linux包至Artifacts
- name: Upload Linux APP to Artifacts
uses: actions/upload-artifact@v4
with:
name: linux
path: |
simple_live_app/build/dist/*/*.deb
simple_live_app/build/dist/*/*.zip
#获取版本信息(自动从 Git Tag 提取)
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Echo version
run: echo "${{ steps.version.outputs.VERSION }}"
#上传至Release
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
name: "${{ steps.version.outputs.VERSION }}"
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
token: ${{ secrets.TOKEN }}
files: |
simple_live_app/build/dist/*/*.deb
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 Linux job's status is ${{ job.status }}."
# 打包Windows
build-windows:
runs-on: windows-latest
permissions:
contents: write
steps:
# 签出代码
- uses: actions/checkout@v4
with:
ref: master
# 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
- name: Enable Flutter Desktop
run: flutter config --enable-windows-desktop
- name: Restore Packages
run: |
cd simple_live_app
flutter pub get
# 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# build Windows ZIP\MSIX
- name: Build Windows
run: |
cd simple_live_app
flutter_distributor package --platform windows --targets msix,zip --skip-clean
# 上传Windows至Artifacts
- name: Upload Windows APP to Artifacts
uses: actions/upload-artifact@v4
with:
name: windows
path: |
simple_live_app/build/dist/*/*.msix
simple_live_app/build/dist/*/*.zip
#获取版本信息(自动从 Git Tag 提取)
- name: Get version from tag
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Echo version
run: echo "${{ steps.version.outputs.VERSION }}"
#上传至Release
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
name: "${{ steps.version.outputs.VERSION }}"
generate_release_notes: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
token: ${{ secrets.TOKEN }}
files: |
simple_live_app/build/dist/*/*.msix
simple_live_app/build/dist/*/*.zip
#完成
- run: echo "🍏 Windows job's status is ${{ job.status }}."
================================================
FILE: .github/workflows/publish_tv_app_dev.yaml
================================================
name: app-build-action
#推送Tag时触发
on:
push:
tags:
- "dev_tv_v*"
jobs:
build-tv:
runs-on: macos-latest
permissions:
contents: write
steps:
#签出代码
- uses: actions/checkout@v4
with:
ref: dev
#APK签名设置
- name: Download Android keystore
id: android_tv_keystore
uses: timheuer/base64-to-file@v1.2
with:
fileName: keystore.jks
encodedString: ${{ secrets.TV_KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_tv_keystore.outputs.filePath }}" > simple_live_tv_app/android/key.properties
echo "storePassword=${{ secrets.TV_STORE_PASSWORD }}" >> simple_live_tv_app/android/key.properties
echo "keyPassword=${{ secrets.TV_KEY_PASSWORD }}" >> simple_live_tv_app/android/key.properties
echo "keyAlias=${{ secrets.TV_KEY_ALIAS }}" >> simple_live_tv_app/android/key.properties
# 设置JAVA环境
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
#设置Flutter
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
#更新Flutter的packages
- name: Restore packages
run: |
cd simple_live_tv_app
flutter pub get
#打包APK
- name: Build APK
run: |
cd simple_live_tv_app
flutter build apk --release --split-per-abi
#上传APK至Artifacts
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v4
with:
name: android_tv
path: |
simple_live_tv_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
#完成
- run: echo "🍏 This job's status is ${{ job.status }}."
================================================
FILE: .github/workflows/publish_tv_app_release.yaml
================================================
name: app-build-action
#推送Tag时触发
on:
push:
tags:
- "tv_*"
jobs:
build-tv:
runs-on: macos-latest
permissions:
contents: write
steps:
#签出代码
- uses: actions/checkout@v4
with:
ref: master
#APK签名设置
- name: Download Android keystore
id: android_tv_keystore
uses: timheuer/base64-to-file@v1.2
with:
fileName: keystore.jks
encodedString: ${{ secrets.TV_KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_tv_keystore.outputs.filePath }}" > simple_live_tv_app/android/key.properties
echo "storePassword=${{ secrets.TV_STORE_PASSWORD }}" >> simple_live_tv_app/android/key.properties
echo "keyPassword=${{ secrets.TV_KEY_PASSWORD }}" >> simple_live_tv_app/android/key.properties
echo "keyAlias=${{ secrets.TV_KEY_ALIAS }}" >> simple_live_tv_app/android/key.properties
# 设置JAVA环境
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
#设置Flutter
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: "3.38.x"
cache: true
#更新Flutter的packages
- name: Restore packages
run: |
cd simple_live_tv_app
flutter pub get
#打包APK
- name: Build APK
run: |
cd simple_live_tv_app
flutter build apk --release --split-per-abi
#上传APK至Artifacts
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v4
with:
name: android_tv
path: |
simple_live_tv_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
#读取版本信息
- name: Read version
id: version
uses: juliangruber/read-file-action@v1
with:
path: assets/tv_app_version.json
- name: Echo version
run: echo "${{ fromJson(steps.version.outputs.content).version }}"
- name: Echo version content
run: echo "${{ fromJson(steps.version.outputs.content).version_desc }}"
#上传至Release
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
name: "${{ fromJson(steps.version.outputs.content).version }}"
body: "# Android TV \n${{ fromJson(steps.version.outputs.content).version_desc }}"
prerelease: ${{ fromJson(steps.version.outputs.content).prerelease }}
token: ${{ secrets.TOKEN }}
files: |
simple_live_tv_app/build/app/outputs/flutter-apk/app-x86_64-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
simple_live_tv_app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
#完成
- run: echo "🍏 This job's status is ${{ job.status }}."
================================================
FILE: .gitignore
================================================
simple_live_app/.vscode/settings.json
simple_live_tv_app/.vscode/settings.json
# macOS Spotlight Search index file
*.DS_Store
================================================
FILE: .vscode/settings.json
================================================
{
"cmake.ignoreCMakeListsMissing": true
}
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C) 2023-2025 xiaoyaocz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Simple Live Copyright (C) 2023-2025 xiaoyaocz
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
> ### ⚠ 本项目不提供Release安装包,请自行编译后运行测试。
Simple Live
简简单单的看直播


## 支持直播平台:
- 虎牙直播
- 斗鱼直播
- 哔哩哔哩直播
- 抖音直播
## APP支持平台
- [x] Android
- [x] iOS
- [x] Windows `BETA`
- [x] MacOS `BETA`
- [x] Linux `BETA`
- [x] Android TV `BETA`
## 项目结构
- `simple_live_core` 项目核心库,实现获取各个网站的信息及弹幕。
- `simple_live_console` 基于simple_live_core的控制台程序。
- `simple_live_app` 基于核心库实现的Flutter APP客户端。
- `simple_live_tv_app` 基于核心库实现的Flutter Android TV客户端。
## 环境
Flutter : `3.38`
## 参考及引用
[AllLive](https://github.com/xiaoyaocz/AllLive) `本项目的C#版,有兴趣可以看看`
[dart_tars_protocol](https://github.com/xiaoyaocz/dart_tars_protocol.git)
[wbt5/real-url](https://github.com/wbt5/real-url)
[lovelyyoshino/Bilibili-Live-API](https://github.com/lovelyyoshino/Bilibili-Live-API/blob/master/API.WebSocket.md)
[IsoaSFlus/danmaku](https://github.com/IsoaSFlus/danmaku)
[BacooTang/huya-danmu](https://github.com/BacooTang/huya-danmu)
[TarsCloud/Tars](https://github.com/TarsCloud/Tars)
[YunzhiYike/douyin-live](https://github.com/YunzhiYike/douyin-live)
[5ime/Tiktok_Signature](https://github.com/5ime/Tiktok_Signature)
## 声明
本项目的所有功能都是基于互联网上公开的资料开发,无任何破解、逆向工程等行为。
本项目仅用于学习交流编程技术,严禁将本项目用于商业目的。如有任何商业行为,均与本项目无关。
如果本项目存在侵犯您的合法权益的情况,请及时与开发者联系,开发者将会及时删除有关内容。
## Star History
================================================
FILE: assets/app_version.json
================================================
{
"version": "1.11.1",
"version_num": 11101,
"version_desc": "- 版本更新",
"prerelease": false,
"download_url": "https://github.com/xiaoyaocz/dart_simple_live/releases"
}
================================================
FILE: assets/play_config.json
================================================
{
"huya": {
"user_agent": "HYSDK(Windows, 30000002)_APP(pc_exe&6080100&official)_SDK(trans&2.23.0.4969)"
}
}
================================================
FILE: assets/tv_app_version.json
================================================
{
"version": "1.3.5",
"version_num": 10305,
"version_desc": "- 修复虎牙播放中断 #723 @SlotSun\n- 修复哔哩哔哩加载失败",
"prerelease":true,
"download_url": "https://github.com/xiaoyaocz/dart_simple_live/releases"
}
================================================
FILE: simple_live_app/.fvmrc
================================================
{
"flutter": "3.38.3"
}
================================================
FILE: simple_live_app/.gitignore
================================================
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
/ios/Podfile.lock
pubspec.lock
.fvm/
/android/app/.cxx
================================================
FILE: simple_live_app/.metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "19074d12f7eaf6a8180cd4036a430c1d76de904e"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
- platform: linux
create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
================================================
FILE: simple_live_app/README.md
================================================
# simple_live_app
基于核心库实现的Flutter APP客户端。
## TODO
- [ ] 支持桌面平台
- [ ] iOS播放问题
- [ ] 全屏、非全屏弹幕样式分离
- [ ] 重写直播间
================================================
FILE: simple_live_app/analysis_options.yaml
================================================
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
================================================
FILE: simple_live_app/android/.gitignore
================================================
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
.cxx/
# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
================================================
FILE: simple_live_app/android/app/build.gradle.kts
================================================
import java.util.Properties
import java.io.FileInputStream
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.xycz.simple_live"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.xycz.simple_live"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String
isV1SigningEnabled = true
isV2SigningEnabled = true
}
}
buildTypes {
release {
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
// Default file with automatically generated optimization rules.
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
flutter {
source = "../.."
}
================================================
FILE: simple_live_app/android/app/proguard-rules.pro
================================================
#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class de.prosiebensat1digital.** { *; }
-dontwarn io.flutter.embedding.**
-ignorewarnings
================================================
FILE: simple_live_app/android/app/src/debug/AndroidManifest.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/AndroidManifest.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/kotlin/com/xycz/simple_live/MainActivity.kt
================================================
package com.xycz.simple_live
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()
================================================
FILE: simple_live_app/android/app/src/main/res/drawable/launch_background.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/drawable-v21/launch_background.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/values/ic_launcher_background.xml
================================================
#FFFFFF
================================================
FILE: simple_live_app/android/app/src/main/res/values/styles.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/values-night/styles.xml
================================================
================================================
FILE: simple_live_app/android/app/src/main/res/xml/network_security_config.xml
================================================
================================================
FILE: simple_live_app/android/app/src/profile/AndroidManifest.xml
================================================
================================================
FILE: simple_live_app/android/build/reports/problems/problems-report.html
================================================
Gradle Configuration Cache
Loading...
================================================
FILE: simple_live_app/android/build.gradle.kts
================================================
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean") {
delete(rootProject.layout.buildDirectory)
}
================================================
FILE: simple_live_app/android/gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
================================================
FILE: simple_live_app/android/gradle.properties
================================================
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
================================================
FILE: simple_live_app/android/settings.gradle.kts
================================================
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.1" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
}
include(":app")
================================================
FILE: simple_live_app/assets/lotties/empty.json
================================================
{"v":"4.7.0","fr":25,"ip":0,"op":50,"w":120,"h":120,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"ruoi","ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.967]},"o":{"x":[0.167],"y":[0.033]},"n":["0p833_0p967_0p167_0p033"],"t":35,"s":[100],"e":[0]},{"t":49}]},"r":{"a":0,"k":0},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0,"y":0},"n":"0p833_0p833_0_0","t":0,"s":[57.361,61.016,0],"e":[57.699,41.796,0],"to":[-4.67500305175781,-4.12800598144531,0],"ti":[-13.9099960327148,5.27300262451172,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":10.219,"s":[57.699,41.796,0],"e":[79.084,33.982,0],"to":[12.8159942626953,-4.85800170898438,0],"ti":[-4.54498291015625,3.73400115966797,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19.445,"s":[79.084,33.982,0],"e":[59.691,9.121,0],"to":[6.61601257324219,-5.43799591064453,0],"ti":[20.0290069580078,1.20700073242188,0]},{"t":35}]},"a":{"a":0,"k":[60.531,10.945,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.994,0],[0,-0.994],[0.995,0],[0,0.994]],"o":[[0.995,0],[0,0.994],[-0.994,0],[0,-0.994]],"v":[[-0.001,-1.801],[1.801,-0.001],[-0.001,1.801],[-1.801,-0.001]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.4235294117647059,0.4235294117647059,0.4235294117647059,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[62.4,13.144],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group"},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.422,0],[0,-1.422],[1.421,0],[0,1.422]],"o":[[1.421,0],[0,1.422],[-1.422,0],[0,-1.422]],"v":[[0.001,-2.574],[2.574,0],[0.001,2.574],[-2.574,0]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"st","c":{"a":0,"k":[0.4235294117647059,0.4235294117647059,0.4235294117647059,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":0.7},"lc":1,"lj":1,"ml":10,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"a":0,"k":[1,1,1,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[64.145,9.606],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"ix":2,"mn":"ADBE Vector Group"},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.996,0],[0,-1.996],[1.996,0],[0,1.996]],"o":[[1.996,0],[0,1.996],[-1.996,0],[0,-1.996]],"v":[[0,-3.614],[3.614,0],[0,3.614],[-3.614,0]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"st","c":{"a":0,"k":[0.4235294117647059,0.4235294117647059,0.4235294117647059,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":0.7},"lc":1,"lj":1,"ml":10,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"a":0,"k":[1,1,1,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[57.957,10.552],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":3,"cix":2,"ix":3,"mn":"ADBE Vector Group"},{"ty":"tr","p":{"a":0,"k":[60.531,10.941],"ix":2},"a":{"a":0,"k":[60.531,10.941],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"ruoi","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}],"ip":0,"op":50,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 2","ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.967]},"o":{"x":[0.167],"y":[0.033]},"n":["0p833_0p967_0p167_0p033"],"t":35,"s":[100],"e":[0]},{"t":49}]},"r":{"a":0,"k":0},"p":{"a":0,"k":[-0.75,-0.75,0]},"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-13.91,5.273],[-4.545,3.734],[20.029,1.207]],"o":[[-4.675,-4.128],[12.816,-4.858],[6.616,-5.438],[0,0]],"v":[[-7.383,24.76],[-7.046,5.54],[14.34,-2.273],[-3.178,-24.76]],"c":false}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"st","c":{"a":0,"k":[0.34901960784313724,0.3686274509803922,0.4,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":1},"lc":2,"lj":2,"d":[{"n":"d","nm":"dash","v":{"a":0,"k":2.028}},{"n":"g","nm":"gap","v":{"a":0,"k":2.028}},{"n":"o","nm":"offset","v":{"a":0,"k":0}}],"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"tr","p":{"a":0,"k":[67.87,37.631],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group"},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.953]},"o":{"x":[0.167],"y":[0.033]},"n":["0p833_0p953_0p167_0p033"],"t":0,"s":[0],"e":[100]},{"t":35}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim"}],"ip":0,"op":50,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":3,"ty":4,"nm":"im_emptyBox Outlines","ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[60,60,0]},"a":{"a":0,"k":[60,60,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-0.001,-16.607],[-32.143,-0.002],[-0.001,16.607],[32.144,-0.002]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.8,0.82,0.851,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[60,55.75],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 7","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group"},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[12.856,-23.249],[0,-16.605],[-12.857,-23.249],[-45,-6.641],[-32.144,0.001],[-45,6.645],[-12.857,23.249],[0,16.609],[12.856,23.249],[45,6.645],[32.143,0.001],[45,-6.641]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.9372549019607843,0.9372549019607843,0.9372549019607843,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[60,55.748],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 8","np":2,"cix":2,"ix":2,"mn":"ADBE Vector Group"},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-16.072,24.171],[16.072,11.312],[16.072,-24.171],[-16.072,-24.171]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.9529411764705882,0.9529411764705882,0.9529411764705882,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[76.072,83.33],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 9","np":2,"cix":2,"ix":3,"mn":"ADBE Vector Group"},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-32.143,-24.171],[-32.143,11.311],[-0.001,24.171],[32.144,11.311],[32.144,-24.171]],"c":true}},"nm":"Path 1","mn":"ADBE Vector Shape - Group"},{"ty":"fl","c":{"a":0,"k":[0.8,0.82,0.851,1]},"o":{"a":0,"k":100},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"a":0,"k":[60,83.33],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 10","np":2,"cix":2,"ix":4,"mn":"ADBE Vector Group"},{"ty":"tr","p":{"a":0,"k":[60,60.186],"ix":2},"a":{"a":0,"k":[60,60.186],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"box","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group"}],"ip":0,"op":50,"st":0,"bm":0,"sr":1}]}
================================================
FILE: simple_live_app/assets/lotties/error.json
================================================
{"v":"5.8.1","fr":29.9700012207031,"ip":0,"op":301.000012259981,"w":1080,"h":900,"nm":"Composition 1","ddd":0,"assets":[{"id":"comp_0","nm":"Nuage","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Calque de forme 11","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[54,54],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Tracé d'ellipse 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-22,-239],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 12","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[544.675,315.475,0],"ix":2,"l":2},"a":{"a":0,"k":[-54.5,-226.5,0],"ix":1,"l":2},"s":{"a":0,"k":[80,80,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[31,31],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Tracé d'ellipse 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-54.5,-226.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Calque de forme 10","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[31,31],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Tracé d'ellipse 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-54.5,-226.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Calque de forme 9","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[100,20],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":20,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-26,-216],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]},{"id":"comp_1","nm":"éolienne","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Hélices","refId":"comp_2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.137],"y":[1]},"o":{"x":[0.567],"y":[0]},"t":1,"s":[0]},{"t":300.00001221925,"s":[1440]}],"ix":10},"p":{"a":0,"k":[800,440,0],"ix":2,"l":2},"a":{"a":0,"k":[800,440,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Socle eolienne","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[264.75,-95],[257,-95],[242,252],[288,251]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]},{"id":"comp_2","nm":"Hélices","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Calque de forme 11","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-239.6,"ix":10},"p":{"a":0,"k":[803,442,0],"ix":2,"l":2},"a":{"a":0,"k":[263,-98,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[310,-98],[284,-92],[263,-96],[439,10],[423,-17]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 10","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-122.747,"ix":10},"p":{"a":0,"k":[803,442,0],"ix":2,"l":2},"a":{"a":0,"k":[263,-98,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[310,-98],[284,-92],[263,-96],[439,10],[423,-17]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Calque de forme 9","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[803,442,0],"ix":2,"l":2},"a":{"a":0,"k":[263,-98,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[310,-98],[284,-92],[263,-96],[439,10],[423,-17]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Calque de forme 8","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[800.5,439.5,0],"ix":2,"l":2},"a":{"a":0,"k":[266.5,-94.5,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[27,27],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Tracé d'ellipse 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[266.5,-94.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]},{"id":"comp_3","nm":"plot base","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Calque de forme 8","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[541,387.5,0],"ix":2,"l":2},"a":{"a":0,"k":[1,-152.5,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[13,-223],[-13,-223],[-52,-82],[54,-82]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.9019607843137255,0.3764705882352941,0.27058823529411763,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 7","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,502,0],"ix":2,"l":2},"a":{"a":0,"k":[0,-38,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[58,-56],[-59,-56],[-70,-20],[70,-20]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.9019607843137255,0.3764705882352941,0.27058823529411763,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Calque de forme 5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[539.75,606.25,0],"ix":2,"l":2},"a":{"a":0,"k":[-0.25,66.25,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[256.5,28.5],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.7647058823529411,0.3215686274509804,0.23137254901960785,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-0.25,66.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Calque de forme 6","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,572,0],"ix":2,"l":2},"a":{"a":0,"k":[0,32,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[78,3],[-76,3],[-93,60],[93,61]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.9019607843137255,0.3764705882352941,0.27058823529411763,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]},{"id":"comp_4","nm":"Tree","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Calque de forme 10","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-171.5,-79.5],[-152.5,-45]],"c":false},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.850980451995,0.84313731474,0.84313731474,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":7,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Contour 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 9","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-154.5,-23.5],[-137.5,-48.5]],"c":false},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.850980451995,0.84313731474,0.84313731474,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":7,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Contour 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Calque de forme 7","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[386,620,0],"ix":2,"l":2},"a":{"a":0,"k":[-154,80,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-154,256],[-154,-96]],"c":false},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.850980392157,0.844306078144,0.844306078144,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Contour 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Calque de forme 8","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[384,475,0],"ix":2,"l":2},"a":{"a":0,"k":[-156,-65,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[96,222],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":62,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.949019667682,0.949019667682,0.949019667682,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-156,-65],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]},{"id":"comp_5","nm":"ground","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Calque de forme 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[515,795.5,0],"ix":2,"l":2},"a":{"a":0,"k":[-273.5,78,0],"ix":1,"l":2},"s":{"a":0,"k":[662,317,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[59,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":2371,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.133333333333,0.145098039216,0.235294132607,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-273.5,78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[817,795.5,0],"ix":2,"l":2},"a":{"a":0,"k":[-273.5,78,0],"ix":1,"l":2},"s":{"a":0,"k":[78,317,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[59,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":2371,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.133333333333,0.145098039216,0.235294132607,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-273.5,78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Calque de forme 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[752,795.5,0],"ix":2,"l":2},"a":{"a":0,"k":[-273.5,78,0],"ix":1,"l":2},"s":{"a":0,"k":[89,317,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[59,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":2371,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.133333333333,0.145098039216,0.235294132607,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-273.5,78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Calque de forme 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[270,795.5,0],"ix":2,"l":2},"a":{"a":0,"k":[-273.5,78,0],"ix":1,"l":2},"s":{"a":0,"k":[102,317,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[59,2],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":2371,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.133333333333,0.145098039216,0.235294132607,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-273.5,78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Nuage","refId":"comp_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":51,"s":[100]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":234,"s":[100]},{"t":299.00001217852,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.284,"y":1},"o":{"x":0.387,"y":0},"t":0,"s":[704,380,0],"to":[-36.667,0,0],"ti":[36.667,0,0]},{"t":299.00001217852,"s":[484,380,0]}],"ix":2,"l":2},"a":{"a":0,"k":[514,308,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Calque de forme 7","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.5,-0.5],[0,0.5],[0,-1],[0,-0.5],[0,0],[0.5,-0.5],[0,0],[0.5,-0.5],[-0.5,-0.5]],"o":[[-19,-5],[-34,-13],[-18.5,1.5],[-17,10.5],[0,0],[17,-19.5],[6.5,-4],[-3.5,-13],[11.5,-19.5]],"v":[[263.5,176],[242.5,196],[218,213],[209.5,232.5],[215,254.5],[297,253.5],[289.5,225],[294,210],[271.5,204]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.83137254902,0.821591725069,0.821591725069,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"éolienne","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[804,796,0],"ix":2,"l":2},"a":{"a":0,"k":[804,796,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":0,"nm":"plot base","refId":"comp_3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":7.368,"s":[6]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14.736,"s":[-5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22.264,"s":[4]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":29.633,"s":[-2]},{"t":37.0000015070409,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[540,792,0],"to":[0,-2.667,0],"ti":[0,2,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":7.368,"s":[540,776,0],"to":[0,-2,0],"ti":[0,-1.333,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":14.736,"s":[540,780,0],"to":[0,1.333,0],"ti":[0,-1.333,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":22.264,"s":[540,784,0],"to":[0,1.333,0],"ti":[0,-2,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":29.633,"s":[540,788,0],"to":[0,2,0],"ti":[0,-1.333,0]},{"t":37.0000015070409,"s":[540,796,0]}],"ix":2,"l":2},"a":{"a":0,"k":[540,616,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":0,"nm":"éolienne","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[670,796,0],"ix":2,"l":2},"a":{"a":0,"k":[804,796,0],"ix":1,"l":2},"s":{"a":0,"k":[63,63,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":0,"nm":"Tree","refId":"comp_4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,790,0],"ix":2,"l":2},"a":{"a":0,"k":[384,790,0],"ix":1,"l":2},"s":{"a":0,"k":[82,82,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":7,"ty":0,"nm":"Tree","refId":"comp_4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":8,"ty":4,"nm":"Arbuste","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[68,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.5,-0.5],[0,0.5],[0,-1],[0,-0.5],[0,0],[0.5,-0.5],[0,0],[0.5,-0.5],[-0.5,-0.5]],"o":[[-19,-5],[-34,-13],[-18.5,1.5],[-17,10.5],[0,0],[17,-19.5],[6.5,-4],[-3.5,-13],[11.5,-19.5]],"v":[[263.5,176],[242.5,196],[218,213],[209.5,232.5],[215,254.5],[297,253.5],[289.5,225],[294,210],[271.5,204]],"c":true},"ix":2},"nm":"Tracé 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.901960784314,0.901960784314,0.901960784314,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Forme 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":9,"ty":0,"nm":"ground","refId":"comp_5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":10,"ty":0,"nm":"Nuage","refId":"comp_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":51,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":234,"s":[100]},{"t":299.00001217852,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[193,606,0],"to":[56.5,0,0],"ti":[-56.5,0,0]},{"t":299.00001217852,"s":[532,606,0]}],"ix":2,"l":2},"a":{"a":0,"k":[514,308,0],"ix":1,"l":2},"s":{"a":0,"k":[60,60,100],"ix":6,"l":2}},"ao":0,"w":1080,"h":900,"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":11,"ty":4,"nm":"Calque de forme 6","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[572,712,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[784,628],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Tracé rectangulaire 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.909803921569,0.909803921569,0.909803921569,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-36,-234],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":12,"ty":4,"nm":"Calque de forme 5","tt":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,716,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[728,728],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Tracé d'ellipse 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.976470588235,0.976470588235,0.976470588235,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fond 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[8,-140],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transformer "}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":630.000025660426,"st":0,"bm":0},{"ddd":0,"ind":14,"ty":1,"nm":"Blanc uni 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"sw":1080,"sh":900,"ip":0,"op":630.000025660426,"st":0,"bm":0}],"markers":[]}
================================================
FILE: simple_live_app/assets/lotties/loadding.json
================================================
{
"v": "5.5.8",
"fr": 50,
"ip": 0,
"op": 147,
"w": 800,
"h": 600,
"nm": "Paperplane",
"ddd": 0,
"assets": [
{
"id": "comp_0",
"layers": [
{
"ddd": 0,
"ind": 1,
"ty": 4,
"nm": "planete Outlines - Group 4",
"sr": 1,
"ks": {
"o": {
"a": 1,
"k": [
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"t": 0,
"s": [
0
]
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"t": 38,
"s": [
50
]
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"t": 88,
"s": [
50
]
},
{
"t": 120,
"s": [
0
]
}
],
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 1,
"k": [
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 0,
"s": [
468.336,
323.378,
0
],
"to": [
-29,
0,
0
],
"ti": [
29,
0,
0
]
},
{
"t": 102,
"s": [
294.336,
323.378,
0
]
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
453.672,
304.756,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50,
100
],
"ix": 6
}
},
"ao": 0,
"shapes": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
6.742,
0
],
[
0.741,
-0.14
],
[
0,
0.074
],
[
13.484,
0
],
[
1.669,
-0.361
],
[
19.79,
0
],
[
3.317,
-19.082
],
[
2.691,
0
],
[
0,
-13.484
],
[
-0.048,
-0.629
],
[
2.405,
0
],
[
0,
-6.742
],
[
-6.742,
0
],
[
0,
0
],
[
0,
6.743
]
],
"o": [
[
-0.781,
0
],
[
0.001,
-0.074
],
[
0,
-13.484
],
[
-1.778,
0
],
[
-3.594,
-18.742
],
[
-20.03,
0
],
[
-2.421,
-0.804
],
[
-13.485,
0
],
[
0,
0.642
],
[
-1.89,
-1.199
],
[
-6.742,
0
],
[
0,
6.743
],
[
0,
0
],
[
6.742,
0
],
[
0,
-6.742
]
],
"v": [
[
75.134,
16.175
],
[
72.85,
16.396
],
[
72.856,
16.175
],
[
48.44,
-8.241
],
[
43.262,
-7.685
],
[
3.406,
-40.591
],
[
-36.571,
-6.995
],
[
-44.269,
-8.241
],
[
-68.685,
16.175
],
[
-68.604,
18.079
],
[
-75.133,
16.175
],
[
-87.341,
28.383
],
[
-75.133,
40.592
],
[
75.134,
40.592
],
[
87.342,
28.383
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.815686334348,
0.823529471603,
0.827451040231,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
453.672,
304.756
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "Group 4",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
}
],
"ip": 0,
"op": 151,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 2,
"ty": 4,
"nm": "Merged Shape Layer",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 1,
"k": [
{
"i": {
"x": [
0.667
],
"y": [
1
]
},
"o": {
"x": [
0.547
],
"y": [
0
]
},
"t": 0,
"s": [
0
]
},
{
"i": {
"x": [
0.845
],
"y": [
1
]
},
"o": {
"x": [
0.333
],
"y": [
0
]
},
"t": 77,
"s": [
35
]
},
{
"t": 150,
"s": [
0
]
}
],
"ix": 10
},
"p": {
"a": 1,
"k": [
{
"i": {
"x": 0.667,
"y": 1
},
"o": {
"x": 0.333,
"y": 0
},
"t": 0,
"s": [
390.319,
298.2,
0
],
"to": [
0,
-2.583,
0
],
"ti": [
0,
0,
0
]
},
{
"i": {
"x": 0.667,
"y": 1
},
"o": {
"x": 0.333,
"y": 0
},
"t": 44,
"s": [
390.319,
282.7,
0
],
"to": [
0,
0,
0
],
"ti": [
0,
0,
0
]
},
{
"i": {
"x": 0.667,
"y": 1
},
"o": {
"x": 0.333,
"y": 0
},
"t": 110,
"s": [
390.319,
319.25,
0
],
"to": [
0,
0,
0
],
"ti": [
0,
0,
0
]
},
{
"t": 150,
"s": [
390.319,
298.2,
0
]
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
664.319,
256.2,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"shapes": [
{
"ty": "gr",
"it": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"o": [
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"v": [
[
18.967,
-3.189
],
[
-18.967,
19.935
],
[
-0.949,
-19.935
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.223528981209,
0.192156970501,
0.674510002136,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
236.879,
292.737
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "Group 1",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
633.939,
275.369
],
"ix": 2
},
"a": {
"a": 0,
"k": [
236.879,
292.737
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "planete Outlines - Group 1",
"np": 1,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
},
{
"ty": "gr",
"it": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"o": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"v": [
[
-98.335,
64.79
],
[
-105.619,
4.984
],
[
105.619,
-64.79
],
[
-80.316,
24.919
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.278430998325,
0.294117987156,
0.847059011459,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
316.247,
247.882
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "Group 2",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
673.623,
252.941
],
"ix": 2
},
"a": {
"a": 0,
"k": [
316.247,
247.882
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "planete Outlines - Group 2",
"np": 1,
"cix": 2,
"bm": 0,
"ix": 2,
"mn": "ADBE Vector Group",
"hd": false
},
{
"ty": "gr",
"it": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"o": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"v": [
[
-133.812,
-42.171
],
[
133.812,
-75.141
],
[
5.765,
75.141
],
[
-61.708,
18.402
],
[
124.227,
-71.307
],
[
-87.011,
-1.534
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.365000009537,
0.407999992371,
0.976000010967,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
297.638,
254.4
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "Group 3",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
664.319,
256.2
],
"ix": 2
},
"a": {
"a": 0,
"k": [
297.638,
254.4
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "planete Outlines - Group 3",
"np": 1,
"cix": 2,
"bm": 0,
"ix": 3,
"mn": "ADBE Vector Group",
"hd": false
}
],
"ip": 0,
"op": 151,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 3,
"ty": 4,
"nm": "planete Outlines - Group 5",
"sr": 1,
"ks": {
"o": {
"a": 1,
"k": [
{
"i": {
"x": [
0.667
],
"y": [
1
]
},
"o": {
"x": [
0.333
],
"y": [
0
]
},
"t": 0,
"s": [
0
]
},
{
"i": {
"x": [
0.667
],
"y": [
1
]
},
"o": {
"x": [
0.333
],
"y": [
0
]
},
"t": 45,
"s": [
100
]
},
{
"i": {
"x": [
0.667
],
"y": [
1
]
},
"o": {
"x": [
0.333
],
"y": [
0
]
},
"t": 102,
"s": [
100
]
},
{
"t": 150,
"s": [
0
]
}
],
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 1,
"k": [
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 0,
"s": [
327.38,
267.583,
0
],
"to": [
25.833,
0,
0
],
"ti": [
-25.833,
0,
0
]
},
{
"t": 150,
"s": [
482.38,
267.583,
0
]
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
171.76,
193.166,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50,
100
],
"ix": 6
}
},
"ao": 0,
"shapes": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
13.485,
0
],
[
4.38,
-4.171
],
[
21.913,
0
],
[
3.575,
-18.765
],
[
1.851,
0
],
[
0,
-13.484
],
[
-0.011,
-0.291
],
[
1.599,
0
],
[
0,
-6.743
],
[
-6.742,
0
],
[
0,
0
],
[
0,
13.485
]
],
"o": [
[
-6.526,
0
],
[
-0.793,
-21.719
],
[
-19.806,
0
],
[
-1.734,
-0.391
],
[
-13.485,
0
],
[
0,
0.293
],
[
-1.4,
-0.559
],
[
-6.742,
0
],
[
0,
6.742
],
[
0,
0
],
[
13.485,
0
],
[
0,
-13.484
]
],
"v": [
[
59.669,
-8.242
],
[
42.84,
-1.506
],
[
2.287,
-40.592
],
[
-37.576,
-7.638
],
[
-42.962,
-8.242
],
[
-67.378,
16.174
],
[
-67.356,
17.049
],
[
-71.878,
16.174
],
[
-84.086,
28.383
],
[
-71.878,
40.591
],
[
59.669,
40.591
],
[
84.086,
16.174
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.816000007181,
0.823999980852,
0.827000038297,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
171.76,
193.166
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 3
},
"r": {
"a": 0,
"k": 0,
"ix": 6
},
"o": {
"a": 0,
"k": 100,
"ix": 7
},
"sk": {
"a": 0,
"k": 0,
"ix": 4
},
"sa": {
"a": 0,
"k": 0,
"ix": 5
},
"nm": "Transform"
}
],
"nm": "Group 5",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
}
],
"ip": 0,
"op": 151,
"st": 0,
"bm": 0
}
]
}
],
"layers": [
{
"ddd": 0,
"ind": 1,
"ty": 0,
"nm": "Pre-comp 1",
"refId": "comp_0",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
406,
306,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
400,
300,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
179,
179,
100
],
"ix": 6
}
},
"ao": 0,
"w": 800,
"h": 600,
"ip": 0,
"op": 147,
"st": 0,
"bm": 0
}
],
"markers": []
}
================================================
FILE: simple_live_app/assets/statement.txt
================================================
在使用本软件之前,请您仔细阅读以下内容,并确保您充分理解并同意以下条款:
1、本软件为开源软件,您可以免费获取并使用该软件。
2、本软件完全基于您个人意愿使用,您应该对自己的使用行为和所有结果承担全部责任。
3、本软件仅供学习交流、科研等非商业性质的用途,严禁将本软件用于商业目的。如有任何商业行为,均与本软件无关。
4、本软件并不保证与所有操作系统或硬件设备兼容。本软件作者或贡献者不对因使用本软件而产生的任何技术或安全问题承担责任。
5、本软件作者或贡献者不承担因使用本软件而造成的任何直接、间接、特殊或后果性的损失或损害的责任,包括但不限于财产损失、商业利润损失、信息或数据丢失或损坏等。
6、本软件使用者应遵守国家相关法律法规和使用规范,不得利用本软件从事任何违法违规行为。如因使用本软件而导致的违法行为,使用者应承担相应的法律责任。
7、本软件不会收集、存储、使用任何用户的个人信息,包括但不限于姓名、地址、电子邮件地址、电话号码等。在使用本软件过程中,不会进行任何形式的个人信息采集。如用户提供任何个人信息,将被视为用户已自愿提供,并且用户将自行承担由此产生的所有法律责任。
8、本软件作者或贡献者保留随时修改、增加、删除本免责声明中的内容而不另行通知的权利。
9、如果本软件存在侵犯您的合法权益的情况,请及时与作者联系,作者将会及时删除有关内容。
如您不同意本免责声明中的任何内容,请勿使用本软件。使用本软件即代表您已完全理解并同意上述内容。
================================================
FILE: simple_live_app/distribute_options.yaml
================================================
output: build/dist/
================================================
FILE: simple_live_app/ios/.gitignore
================================================
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
================================================
FILE: simple_live_app/ios/Flutter/AppFrameworkInfo.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
App
CFBundleIdentifier
io.flutter.flutter.app
CFBundleInfoDictionaryVersion
6.0
CFBundleName
App
CFBundlePackageType
FMWK
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1.0
MinimumOSVersion
13.0
================================================
FILE: simple_live_app/ios/Flutter/Debug.xcconfig
================================================
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
================================================
FILE: simple_live_app/ios/Flutter/Release.xcconfig
================================================
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
================================================
FILE: simple_live_app/ios/Podfile
================================================
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
#'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
#'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
#'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
end
end
================================================
FILE: simple_live_app/ios/Runner/AppDelegate.swift
================================================
import UIKit
import Flutter
@main
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}
}
================================================
FILE: simple_live_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images": [
{
"size": "20x20",
"idiom": "iphone",
"filename": "icon-20@2x.png",
"scale": "2x"
},
{
"size": "20x20",
"idiom": "iphone",
"filename": "icon-20@3x.png",
"scale": "3x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "icon-29.png",
"scale": "1x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "icon-29@2x.png",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "icon-29@3x.png",
"scale": "3x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "icon-40@2x.png",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "icon-40@3x.png",
"scale": "3x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "icon-60@2x.png",
"scale": "2x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "icon-60@3x.png",
"scale": "3x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "icon-20-ipad.png",
"scale": "1x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "icon-20@2x-ipad.png",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "icon-29-ipad.png",
"scale": "1x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "icon-29@2x-ipad.png",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "icon-40.png",
"scale": "1x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "icon-40@2x.png",
"scale": "2x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "icon-76.png",
"scale": "1x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "icon-76@2x.png",
"scale": "2x"
},
{
"size": "83.5x83.5",
"idiom": "ipad",
"filename": "icon-83.5@2x.png",
"scale": "2x"
},
{
"size": "1024x1024",
"idiom": "ios-marketing",
"filename": "icon-1024.png",
"scale": "1x"
}
],
"info": {
"version": 1,
"author": "icon.wuruihong.com"
}
}
================================================
FILE: simple_live_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: simple_live_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
================================================
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
================================================
FILE: simple_live_app/ios/Runner/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: simple_live_app/ios/Runner/Base.lproj/Main.storyboard
================================================
================================================
FILE: simple_live_app/ios/Runner/Info.plist
================================================
CADisableMinimumFrameDurationOnPhone
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
Simple Live
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
simple_live_app
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleSignature
????
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS
NSAppTransportSecurity
NSAllowsArbitraryLoads
UIApplicationSupportsIndirectInputEvents
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIViewControllerBasedStatusBarAppearance
UIBackgroundModes
audio
NSPhotoLibraryUsageDescription
保存图片至相册
UISupportsDocumentBrowser
io.flutter.embedded_views_preview
NSCameraUsageDescription
用于扫描二维码
UIApplicationSceneManifest
UIApplicationSupportsMultipleScenes
UISceneConfigurations
UIWindowSceneSessionRoleApplication
UISceneClassName UIWindowScene
UISceneDelegateClassName FlutterSceneDelegate
UISceneConfigurationName flutter
UISceneStoryboardFile Main
================================================
FILE: simple_live_app/ios/Runner/Runner-Bridging-Header.h
================================================
#import "GeneratedPluginRegistrant.h"
================================================
FILE: simple_live_app/ios/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
73C9599770D417F3E7B681E2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60E92DDDD814CB6531C03BCD /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0874FB99E210639E7D21C1F0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
2778CC04696D7C0E532931A0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
60E92DDDD814CB6531C03BCD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6C36D91D13E89663DBB13E51 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
73C9599770D417F3E7B681E2 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
65B8FB167D986F3BCF168FB6 /* Frameworks */ = {
isa = PBXGroup;
children = (
60E92DDDD814CB6531C03BCD /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
FD158AC2F4211953A42B4A25 /* Pods */,
65B8FB167D986F3BCF168FB6 /* Frameworks */,
);
sourceTree = "";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "";
};
FD158AC2F4211953A42B4A25 /* Pods */ = {
isa = PBXGroup;
children = (
2778CC04696D7C0E532931A0 /* Pods-Runner.debug.xcconfig */,
6C36D91D13E89663DBB13E51 /* Pods-Runner.release.xcconfig */,
0874FB99E210639E7D21C1F0 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
EEC3C9B6719E92514BD4D205 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
6D32CBFCD866586D78A69BE1 /* [CP] Embed Pods Frameworks */,
92FA5F4E31AA12D8C9AA408A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
6D32CBFCD866586D78A69BE1 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
92FA5F4E31AA12D8C9AA408A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
EEC3C9B6719E92514BD4D205 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 9R87RMF9C9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.xycz.simple-live";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 9R87RMF9C9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.xycz.simple-live";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 9R87RMF9C9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.xycz.simple-live";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
================================================
FILE: simple_live_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: simple_live_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: simple_live_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: simple_live_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
================================================
FILE: simple_live_app/ios/Runner.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: simple_live_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: simple_live_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: simple_live_app/lib/app/app_style.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
class AppColors {
static ColorScheme lightColorScheme = ColorScheme.fromSeed(
// primarySwatch: Colors.blue,
seedColor: const Color(0xff3498db),
brightness: Brightness.light,
);
static ColorScheme darkColorScheme = ColorScheme.fromSeed(
seedColor: const Color(0xff3498db),
brightness: Brightness.dark,
);
static const Color black333 = Color(0xFF333333);
}
class AppStyle {
static ThemeData lightTheme = ThemeData(
colorScheme: AppColors.lightColorScheme,
useMaterial3: true,
fontFamily: Platform.isWindows ? "Microsoft YaHei" : null,
visualDensity: VisualDensity.standard,
appBarTheme: AppBarTheme(
//elevation: 0,
centerTitle: true,
titleTextStyle: const TextStyle(
fontSize: 16,
color: AppColors.black333,
),
foregroundColor: AppColors.black333,
systemOverlayStyle: SystemUiOverlayStyle.dark.copyWith(
systemNavigationBarColor: Colors.transparent,
),
),
// radioTheme: RadioThemeData(
// fillColor: MaterialStateProperty.all(AppColors.lightColorScheme.primary),
// ),
// checkboxTheme: CheckboxThemeData(
// fillColor: MaterialStateProperty.all(AppColors.lightColorScheme.primary),
// ),
// tabBarTheme: TabBarTheme(
// labelColor: AppColors.lightColorScheme.primary,
// unselectedLabelColor: Colors.white70,
// indicatorSize: TabBarIndicatorSize.tab,
// indicator: RectangularIndicator(
// color: Colors.white.withOpacity(.8),
// topLeftRadius: 24,
// bottomLeftRadius: 24,
// topRightRadius: 24,
// bottomRightRadius: 24,
// verticalPadding: 8,
// horizontalPadding: 0,
// ),
// ),
);
static ThemeData darkTheme = ThemeData.dark().copyWith(
colorScheme: AppColors.darkColorScheme,
visualDensity: VisualDensity.standard,
textTheme: ThemeData.dark().textTheme.apply(
fontFamily: Platform.isWindows ? "Microsoft YaHei" : null,
),
primaryTextTheme: ThemeData().textTheme.apply(
fontFamily: Platform.isWindows ? "Microsoft YaHei" : null,
),
appBarTheme: AppBarTheme(
//elevation: 0,
centerTitle: true,
titleTextStyle: const TextStyle(
fontSize: 16,
color: Colors.white,
),
foregroundColor: Colors.white,
systemOverlayStyle: SystemUiOverlayStyle.light.copyWith(
systemNavigationBarColor: Colors.transparent,
),
),
// radioTheme: RadioThemeData(
// fillColor: MaterialStateProperty.all(AppColors.darkColorScheme.primary),
// ),
// checkboxTheme: CheckboxThemeData(
// fillColor: MaterialStateProperty.all(AppColors.darkColorScheme.primary),
// ),
// tabBarTheme: TabBarTheme(
// labelColor: AppColors.darkColorScheme.primary,
// unselectedLabelColor: Colors.white70,
// indicator: RectangularIndicator(
// color: Colors.white.withAlpha(50),
// topLeftRadius: 24,
// bottomLeftRadius: 24,
// topRightRadius: 24,
// bottomRightRadius: 24,
// verticalPadding: 8,
// horizontalPadding: 0,
// ),
// ),
);
static const vGap4 = SizedBox(
height: 4,
);
static const vGap8 = SizedBox(
height: 8,
);
static const vGap12 = SizedBox(
height: 12,
);
static const vGap24 = SizedBox(
height: 24,
);
static const vGap32 = SizedBox(
height: 32,
);
static const vGap48 = SizedBox(
height: 48,
);
static const hGap4 = SizedBox(
width: 4,
);
static const hGap8 = SizedBox(
width: 8,
);
static const hGap12 = SizedBox(
width: 12,
);
static const hGap16 = SizedBox(
width: 16,
);
static const hGap24 = SizedBox(
width: 24,
);
static const hGap32 = SizedBox(
width: 32,
);
static const hGap48 = SizedBox(
width: 48,
);
static const edgeInsetsH4 = EdgeInsets.symmetric(horizontal: 4);
static const edgeInsetsH8 = EdgeInsets.symmetric(horizontal: 8);
static const edgeInsetsH12 = EdgeInsets.symmetric(horizontal: 12);
static const edgeInsetsH16 = EdgeInsets.symmetric(horizontal: 16);
static const edgeInsetsH20 = EdgeInsets.symmetric(horizontal: 20);
static const edgeInsetsH24 = EdgeInsets.symmetric(horizontal: 24);
static const edgeInsetsV4 = EdgeInsets.symmetric(vertical: 4);
static const edgeInsetsV8 = EdgeInsets.symmetric(vertical: 8);
static const edgeInsetsV12 = EdgeInsets.symmetric(vertical: 12);
static const edgeInsetsV24 = EdgeInsets.symmetric(vertical: 24);
static const edgeInsetsA4 = EdgeInsets.all(4);
static const edgeInsetsA8 = EdgeInsets.all(8);
static const edgeInsetsA12 = EdgeInsets.all(12);
static const edgeInsetsA16 = EdgeInsets.all(16);
static const edgeInsetsA20 = EdgeInsets.all(20);
static const edgeInsetsA24 = EdgeInsets.all(24);
static const edgeInsetsR4 = EdgeInsets.only(right: 4);
static const edgeInsetsR8 = EdgeInsets.only(right: 8);
static const edgeInsetsR12 = EdgeInsets.only(right: 12);
static const edgeInsetsR16 = EdgeInsets.only(right: 16);
static const edgeInsetsR20 = EdgeInsets.only(right: 20);
static const edgeInsetsR24 = EdgeInsets.only(right: 24);
static const edgeInsetsL4 = EdgeInsets.only(left: 4);
static const edgeInsetsL8 = EdgeInsets.only(left: 8);
static const edgeInsetsL12 = EdgeInsets.only(left: 12);
static const edgeInsetsL16 = EdgeInsets.only(left: 16);
static const edgeInsetsL20 = EdgeInsets.only(left: 20);
static const edgeInsetsL24 = EdgeInsets.only(left: 24);
static const edgeInsetsT4 = EdgeInsets.only(top: 4);
static const edgeInsetsT8 = EdgeInsets.only(top: 8);
static const edgeInsetsT12 = EdgeInsets.only(top: 12);
static const edgeInsetsT24 = EdgeInsets.only(top: 24);
static const edgeInsetsB4 = EdgeInsets.only(bottom: 4);
static const edgeInsetsB8 = EdgeInsets.only(bottom: 8);
static const edgeInsetsB12 = EdgeInsets.only(bottom: 12);
static const edgeInsetsB24 = EdgeInsets.only(bottom: 24);
static BorderRadius radius4 = BorderRadius.circular(4);
static BorderRadius radius8 = BorderRadius.circular(8);
static BorderRadius radius12 = BorderRadius.circular(12);
static BorderRadius radius24 = BorderRadius.circular(24);
static BorderRadius radius32 = BorderRadius.circular(32);
static BorderRadius radius48 = BorderRadius.circular(48);
/// 顶部状态栏的高度
static double get statusBarHeight => MediaQuery.of(Get.context!).padding.top;
/// 底部导航条的高度
static double get bottomBarHeight =>
MediaQuery.of(Get.context!).padding.bottom;
static Divider get divider => Divider(
height: 1,
thickness: 1,
indent: 16,
endIndent: 16,
color: Colors.grey.withAlpha(25),
);
}
================================================
FILE: simple_live_app/lib/app/constant.dart
================================================
import 'package:flutter/material.dart';
import 'package:remixicon/remixicon.dart';
class Constant {
static const String kUpdateFollow = "UpdateFollow";
static const String kUpdateHistory = "UpdateHistory";
static final Map allHomePages = {
"recommend": HomePageItem(
iconData: Remix.home_smile_line,
title: "首页",
index: 0,
),
"follow": HomePageItem(
iconData: Remix.heart_line,
title: "关注",
index: 1,
),
"category": HomePageItem(
iconData: Remix.apps_line,
title: "分类",
index: 2,
),
"user": HomePageItem(
iconData: Remix.user_smile_line,
title: "我的",
index: 3,
),
};
static const String kBiliBili = "bilibili";
static const String kDouyu = "douyu";
static const String kHuya = "huya";
static const String kDouyin = "douyin";
}
class HomePageItem {
final IconData iconData;
final String title;
final int index;
HomePageItem({
required this.iconData,
required this.title,
required this.index,
});
}
================================================
FILE: simple_live_app/lib/app/controller/app_settings_controller.dart
================================================
import 'dart:io';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/services/local_storage_service.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class AppSettingsController extends GetxController {
static AppSettingsController get instance =>
Get.find();
/// 缩放模式
var scaleMode = 0.obs;
var themeMode = 0.obs;
var firstRun = false;
@override
void onInit() {
themeMode.value = LocalStorageService.instance
.getValue(LocalStorageService.kThemeMode, 0);
firstRun = LocalStorageService.instance
.getValue(LocalStorageService.kFirstRun, true);
danmuSize.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuSize, 16.0);
danmuOpacity.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuOpacity, 1.0);
danmuArea.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuArea, 0.8);
danmuSpeed.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuSpeed, 10.0);
danmuEnable.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuEnable, true);
danmuStrokeWidth.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuStrokeWidth, 2.0);
danmuTopMargin.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuTopMargin, 0.0);
danmuBottomMargin.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuBottomMargin, 0.0);
danmuFontWeight.value = LocalStorageService.instance
.getValue(LocalStorageService.kDanmuFontWeight, 4);
hardwareDecode.value = LocalStorageService.instance
.getValue(LocalStorageService.kHardwareDecode, true);
chatTextSize.value = LocalStorageService.instance
.getValue(LocalStorageService.kChatTextSize, 14.0);
chatTextGap.value = LocalStorageService.instance
.getValue(LocalStorageService.kChatTextGap, 4.0);
chatBubbleStyle.value = LocalStorageService.instance.getValue(
LocalStorageService.kChatBubbleStyle,
false,
);
qualityLevel.value = LocalStorageService.instance
.getValue(LocalStorageService.kQualityLevel, 1);
qualityLevelCellular.value = LocalStorageService.instance
.getValue(LocalStorageService.kQualityLevelCellular, 1);
autoExitEnable.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoExitEnable, false);
autoExitDuration.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoExitDuration, 60);
roomAutoExitDuration.value = LocalStorageService.instance
.getValue(LocalStorageService.kRoomAutoExitDuration, 60);
playerCompatMode.value = LocalStorageService.instance
.getValue(LocalStorageService.kPlayerCompatMode, false);
playerAutoPause.value = LocalStorageService.instance
.getValue(LocalStorageService.kPlayerAutoPause, false);
playerForceHttps.value = LocalStorageService.instance
.getValue(LocalStorageService.kPlayerForceHttps, false);
autoFullScreen.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoFullScreen, false);
// ignore: invalid_use_of_protected_member
shieldList.value = LocalStorageService.instance.shieldBox.values.toSet();
scaleMode.value = LocalStorageService.instance.getValue(
LocalStorageService.kPlayerScaleMode,
0,
);
playerVolume.value = LocalStorageService.instance.getValue(
LocalStorageService.kPlayerVolume,
100.0,
);
pipHideDanmu.value = LocalStorageService.instance
.getValue(LocalStorageService.kPIPHideDanmu, true);
styleColor.value = LocalStorageService.instance
.getValue(LocalStorageService.kStyleColor, 0xff3498db);
isDynamic.value = LocalStorageService.instance
.getValue(LocalStorageService.kIsDynamic, false);
bilibiliLoginTip.value = LocalStorageService.instance
.getValue(LocalStorageService.kBilibiliLoginTip, true);
playerBufferSize.value = LocalStorageService.instance
.getValue(LocalStorageService.kPlayerBufferSize, 32);
logEnable.value = LocalStorageService.instance
.getValue(LocalStorageService.kLogEnable, false);
if (logEnable.value) {
Log.initWriter();
}
customPlayerOutput.value = LocalStorageService.instance
.getValue(LocalStorageService.kCustomPlayerOutput, false);
videoOutputDriver.value = LocalStorageService.instance.getValue(
LocalStorageService.kVideoOutputDriver,
Platform.isAndroid ? "gpu" : "libmpv",
);
audioOutputDriver.value = LocalStorageService.instance.getValue(
LocalStorageService.kAudioOutputDriver,
Platform.isAndroid
? "audiotrack"
: Platform.isLinux
? "pulse"
: Platform.isWindows
? "wasapi"
: Platform.isIOS
? "audiounit"
: Platform.isMacOS
? "coreaudio"
: "sdl",
);
videoHardwareDecoder.value = LocalStorageService.instance.getValue(
LocalStorageService.kVideoHardwareDecoder,
Platform.isAndroid ? "auto-safe" : "auto",
);
autoUpdateFollowEnable.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoUpdateFollowEnable, true);
autoUpdateFollowDuration.value = LocalStorageService.instance
.getValue(LocalStorageService.kUpdateFollowDuration, 10);
updateFollowThreadCount.value = LocalStorageService.instance
.getValue(LocalStorageService.kUpdateFollowThreadCount, 0); // 默认 0 = 自动
initSiteSort();
initHomeSort();
super.onInit();
}
void initSiteSort() {
var sort = LocalStorageService.instance
.getValue(
LocalStorageService.kSiteSort,
Sites.allSites.keys.join(","),
)
.split(",");
//如果数量与allSites的数量不一致,将缺失的添加上
if (sort.length != Sites.allSites.length) {
var keys = Sites.allSites.keys.toList();
for (var i = 0; i < keys.length; i++) {
if (!sort.contains(keys[i])) {
sort.add(keys[i]);
}
}
}
siteSort.value = sort;
}
void initHomeSort() {
var sort = LocalStorageService.instance
.getValue(
LocalStorageService.kHomeSort,
Constant.allHomePages.keys.join(","),
)
.split(",");
//如果数量与allSites的数量不一致,将缺失的添加上
if (sort.length != Constant.allHomePages.length) {
var keys = Constant.allHomePages.keys.toList();
for (var i = 0; i < keys.length; i++) {
if (!sort.contains(keys[i])) {
sort.add(keys[i]);
}
}
}
homeSort.value = sort;
}
void setNoFirstRun() {
LocalStorageService.instance.setValue(LocalStorageService.kFirstRun, false);
}
void changeTheme() {
Get.dialog(
RadioGroup(
groupValue: themeMode.value,
onChanged: (e) {
Get.back();
setTheme(e ?? 0);
},
child: const SimpleDialog(
title: Text("设置主题"),
children: [
RadioListTile(
title: Text("跟随系统"),
value: 0,
),
RadioListTile(
title: Text("浅色模式"),
value: 1,
),
RadioListTile(
title: Text("深色模式"),
value: 2,
),
],
),
),
);
}
void setTheme(int i) {
themeMode.value = i;
var mode = ThemeMode.values[i];
LocalStorageService.instance.setValue(LocalStorageService.kThemeMode, i);
Get.changeThemeMode(mode);
}
var hardwareDecode = true.obs;
void setHardwareDecode(bool e) {
hardwareDecode.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kHardwareDecode, e);
}
var chatTextSize = 14.0.obs;
void setChatTextSize(double e) {
chatTextSize.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kChatTextSize, e);
}
var chatTextGap = 4.0.obs;
void setChatTextGap(double e) {
chatTextGap.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kChatTextGap, e);
}
var chatBubbleStyle = false.obs;
void setChatBubbleStyle(bool e) {
chatBubbleStyle.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kChatBubbleStyle, e);
}
var danmuSize = 16.0.obs;
void setDanmuSize(double e) {
danmuSize.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kDanmuSize, e);
}
var danmuSpeed = 10.0.obs;
void setDanmuSpeed(double e) {
danmuSpeed.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kDanmuSpeed, e);
}
var danmuArea = 0.8.obs;
void setDanmuArea(double e) {
danmuArea.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kDanmuArea, e);
}
var danmuOpacity = 1.0.obs;
void setDanmuOpacity(double e) {
danmuOpacity.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kDanmuOpacity, e);
}
var danmuEnable = true.obs;
void setDanmuEnable(bool e) {
danmuEnable.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kDanmuEnable, e);
}
var danmuStrokeWidth = 2.0.obs;
void setDanmuStrokeWidth(double e) {
danmuStrokeWidth.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kDanmuStrokeWidth, e);
}
var danmuFontWeight = 4.obs;
void setDanmuFontWeight(int e) {
danmuFontWeight.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kDanmuFontWeight, e);
}
var qualityLevel = 1.obs;
void setQualityLevel(int level) {
qualityLevel.value = level;
LocalStorageService.instance
.setValue(LocalStorageService.kQualityLevel, level);
}
var qualityLevelCellular = 1.obs;
void setQualityLevelCellular(int level) {
qualityLevelCellular.value = level;
LocalStorageService.instance
.setValue(LocalStorageService.kQualityLevelCellular, level);
}
var autoExitEnable = false.obs;
void setAutoExitEnable(bool e) {
autoExitEnable.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoExitEnable, e);
}
var autoExitDuration = 60.obs;
void setAutoExitDuration(int e) {
autoExitDuration.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoExitDuration, e);
}
var roomAutoExitDuration = 60.obs;
void setRoomAutoExitDuration(int e) {
roomAutoExitDuration.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kRoomAutoExitDuration, e);
}
var playerCompatMode = false.obs;
void setPlayerCompatMode(bool e) {
playerCompatMode.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kPlayerCompatMode, e);
}
var playerBufferSize = 32.obs;
void setPlayerBufferSize(int e) {
playerBufferSize.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kPlayerBufferSize, e);
}
var playerAutoPause = false.obs;
void setPlayerAutoPause(bool e) {
playerAutoPause.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kPlayerAutoPause, e);
}
var autoFullScreen = false.obs;
void setAutoFullScreen(bool e) {
autoFullScreen.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoFullScreen, e);
}
var playershowSuperChat = true.obs;
void setPlayerShowSuperChat(bool e) {
playershowSuperChat.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kPlayerShowSuperChat, e);
}
RxSet shieldList = {}.obs;
void addShieldList(String e) {
shieldList.add(e);
LocalStorageService.instance.shieldBox.put(e, e);
}
void removeShieldList(String e) {
shieldList.remove(e);
LocalStorageService.instance.shieldBox.delete(e);
}
Future clearShieldList() async {
shieldList.clear();
await LocalStorageService.instance.shieldBox.clear();
}
void setScaleMode(int value) {
scaleMode.value = value;
LocalStorageService.instance.setValue(
LocalStorageService.kPlayerScaleMode,
value,
);
}
RxList siteSort = RxList();
void setSiteSort(List e) {
siteSort.value = e;
LocalStorageService.instance.setValue(
LocalStorageService.kSiteSort,
siteSort.join(","),
);
}
RxList homeSort = RxList();
void setHomeSort(List e) {
homeSort.value = e;
LocalStorageService.instance.setValue(
LocalStorageService.kHomeSort,
homeSort.join(","),
);
}
Rx playerVolume = 100.0.obs;
void setPlayerVolume(double value) {
playerVolume.value = value;
LocalStorageService.instance.setValue(
LocalStorageService.kPlayerVolume,
value,
);
}
var pipHideDanmu = true.obs;
void setPIPHideDanmu(bool e) {
pipHideDanmu.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kPIPHideDanmu, e);
}
var styleColor = 0xff3498db.obs;
void setStyleColor(int e) {
styleColor.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kStyleColor, e);
}
var isDynamic = false.obs;
void setIsDynamic(bool e) {
isDynamic.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kIsDynamic, e);
}
var danmuTopMargin = 0.0.obs;
void setDanmuTopMargin(double e) {
danmuTopMargin.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kDanmuTopMargin, e);
}
var danmuBottomMargin = 0.0.obs;
void setDanmuBottomMargin(double e) {
danmuBottomMargin.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kDanmuBottomMargin, e);
}
var bilibiliLoginTip = true.obs;
void setBiliBiliLoginTip(bool e) {
bilibiliLoginTip.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kBilibiliLoginTip, e);
}
var logEnable = false.obs;
void setLogEnable(bool e) {
logEnable.value = e;
LocalStorageService.instance.setValue(LocalStorageService.kLogEnable, e);
}
var customPlayerOutput = false.obs;
void setCustomPlayerOutput(bool e) {
customPlayerOutput.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kCustomPlayerOutput, e);
}
var videoOutputDriver = "".obs;
void setVideoOutputDriver(String e) {
videoOutputDriver.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kVideoOutputDriver, e);
}
var audioOutputDriver = "".obs;
void setAudioOutputDriver(String e) {
audioOutputDriver.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAudioOutputDriver, e);
}
var videoHardwareDecoder = "".obs;
void setVideoHardwareDecoder(String e) {
videoHardwareDecoder.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kVideoHardwareDecoder, e);
}
var autoUpdateFollowEnable = false.obs;
void setAutoUpdateFollowEnable(bool e) {
autoUpdateFollowEnable.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoUpdateFollowEnable, e);
}
var autoUpdateFollowDuration = 10.obs;
void setAutoUpdateFollowDuration(int e) {
autoUpdateFollowDuration.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kUpdateFollowDuration, e);
}
var updateFollowThreadCount = 4.obs;
void setUpdateFollowThreadCount(int e) {
updateFollowThreadCount.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kUpdateFollowThreadCount, e);
}
var playerForceHttps = false.obs;
void setPlayerForceHttps(bool e) {
playerForceHttps.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kPlayerForceHttps, e);
}
}
================================================
FILE: simple_live_app/lib/app/controller/base_controller.dart
================================================
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
class BaseController extends GetxController {
/// 加载中,更新页面
var pageLoadding = false.obs;
/// 加载中,不会更新页面
var loadding = false;
/// 空白页面
var pageEmpty = false.obs;
/// 页面错误
var pageError = false.obs;
/// 未登录
var notLogin = false.obs;
/// 错误信息
var errorMsg = "".obs;
/// 显示错误
/// * [msg] 错误信息
/// * [showPageError] 显示页面错误
/// * 只在第一页加载错误时showPageError=true,后续页加载错误时使用Toast弹出通知
void handleError(Object exception, {bool showPageError = false}) {
Log.e(exception.toString(), StackTrace.current);
var msg = exceptionToString(exception);
if (showPageError) {
pageError.value = true;
errorMsg.value = msg;
} else {
SmartDialog.showToast(exceptionToString(msg));
}
}
String exceptionToString(Object exception) {
return exception.toString().replaceAll("Exception:", "");
}
void onLogin() {}
void onLogout() {}
}
class BasePageController extends BaseController {
final ScrollController scrollController = ScrollController();
final EasyRefreshController easyRefreshController = EasyRefreshController();
int currentPage = 1;
int count = 0;
int maxPage = 0;
int pageSize = 24;
var canLoadMore = false.obs;
var list = [].obs;
Future refreshData() async {
currentPage = 1;
list.value = [];
await loadData();
}
Future loadData() async {
try {
if (loadding) return;
loadding = true;
pageError.value = false;
pageEmpty.value = false;
notLogin.value = false;
pageLoadding.value = currentPage == 1;
var result = await getData(currentPage, pageSize);
//是否可以加载更多
if (result.isNotEmpty) {
currentPage++;
canLoadMore.value = true;
pageEmpty.value = false;
} else {
canLoadMore.value = false;
if (currentPage == 1) {
pageEmpty.value = true;
}
}
// 赋值数据
if (currentPage == 1) {
list.value = result;
} else {
list.addAll(result);
}
} catch (e) {
handleError(e, showPageError: currentPage == 1);
} finally {
loadding = false;
pageLoadding.value = false;
}
}
Future> getData(int page, int pageSize) async {
return [];
}
void scrollToTopOrRefresh() {
if (scrollController.offset > 0) {
scrollController.animateTo(
0,
duration: const Duration(milliseconds: 200),
curve: Curves.linear,
);
} else {
easyRefreshController.callRefresh();
}
}
}
================================================
FILE: simple_live_app/lib/app/custom_throttle.dart
================================================
/// 这个类的目的是简化 throttle 的操作,以便更好的理解代码
/// 主要作用:节流,如果在很短时间内都会调用同一个方法,除了第一个方法有用以外
/// 剩下的方法将会被舍弃,在 [eachDelayMilli] 时间后,才会允许下一次调用
/// 会保存一个方法,在最后还会调用一次,和普通的 throttle 不太一样
class DelayedThrottle {
bool isInvoking = false;
int eachDelayMilli;
Future Function()? storeFunc;
DelayedThrottle(this.eachDelayMilli);
void invoke(Future Function() longCostFunc) {
if (isInvoking) {
storeFunc = longCostFunc;
return;
}
storeFunc = null;
isInvoking = true;
longCostFunc().then((value) {
Future.delayed(Duration(milliseconds: eachDelayMilli), () {
isInvoking = false;
if (storeFunc != null) {
invoke(storeFunc!);
}
});
});
}
}
================================================
FILE: simple_live_app/lib/app/event_bus.dart
================================================
import 'dart:async';
import 'package:simple_live_app/app/log.dart';
/// 全局事件
class EventBus {
/// 点击了底部导航
static const String kBottomNavigationBarClicked =
"BottomNavigationBarClicked";
static EventBus? _instance;
static EventBus get instance {
_instance ??= EventBus();
return _instance!;
}
final Map _streams = {};
/// 触发事件
void emit(String name, T data) {
if (!_streams.containsKey(name)) {
_streams.addAll({name: StreamController.broadcast()});
}
Log.d("Emit Event:$name\r\n$data");
_streams[name]!.add(data);
}
/// 监听事件
StreamSubscription listen(String name, Function(dynamic)? onData) {
if (!_streams.containsKey(name)) {
_streams.addAll({name: StreamController.broadcast()});
}
return _streams[name]!.stream.listen(onData);
}
}
================================================
FILE: simple_live_app/lib/app/log.dart
================================================
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:logger/logger.dart';
import 'package:path_provider/path_provider.dart';
import 'package:simple_live_app/app/utils.dart';
class Log {
static LogFileWriter? logFileWriter;
static void initWriter() {
logFileWriter = LogFileWriter();
}
static void disposeWriter() {
logFileWriter?.close();
logFileWriter = null;
}
static void writeLog(content, [Level level = Level.info]) {
logFileWriter
?.write("[${level.name.toUpperCase()}] $_currentTime:$content");
}
static RxList debugLogs = [].obs;
static void addDebugLog(String content, Color? color) {
if (kReleaseMode) {
return;
}
if (content.contains("请求响应")) {
content = content.split("\n").join('\n💡 ');
}
try {
debugLogs.insert(0, DebugLogModel(DateTime.now(), content, color: color));
} catch (e) {
if (kDebugMode) {
print(e);
}
}
}
static Logger logger = Logger(
printer: PrettyPrinter(
methodCount: 0,
errorMethodCount: 8,
lineLength: 120,
colors: true,
printEmojis: true,
dateTimeFormat: DateTimeFormat.none,
),
);
static void d(String message, [bool writeFile = true]) {
addDebugLog(message, Colors.orange);
logger.d("${DateTime.now().toString()}\n$message");
if (writeFile) {
writeLog(message, Level.debug);
}
}
static void i(String message, [bool writeFile = true]) {
addDebugLog(message, Colors.blue);
logger.i("${DateTime.now().toString()}\n$message");
if (writeFile) {
logFileWriter?.write("[INFO] $_currentTime:$message");
writeLog(message, Level.info);
}
}
static void e(String message, StackTrace stackTrace,
[bool writeFile = true]) {
addDebugLog('$message\r\n\r\n$stackTrace', Colors.red);
logger.e("${DateTime.now().toString()}\n$message", stackTrace: stackTrace);
if (writeFile) {
writeLog("$message\n$stackTrace", Level.error);
}
}
static void w(String message, [bool writeFile = true]) {
addDebugLog(message, Colors.pink);
logger.w("${DateTime.now().toString()}\n$message");
if (writeFile) {
writeLog(message, Level.warning);
}
}
static void logPrint(dynamic obj, [bool writeFile = true]) {
addDebugLog(obj.toString(), Colors.red);
if (writeFile) {
writeLog(obj, Level.info);
}
//logger.e(obj.toString(), obj, obj?.stackTrace);
if (kDebugMode) {
print(obj);
}
}
static String get _currentTime => Utils.timeFormat.format(DateTime.now());
}
class LogFileWriter {
late String fileName;
LogFileWriter() {
var dt = DateFormat("yyyy-MM-dd HH-mm-ss").format(DateTime.now());
fileName = "$dt.log";
initFile();
}
IOSink? fileWriter;
void initFile() async {
var supportDir = await getApplicationSupportDirectory();
var logDir = Directory("${supportDir.path}/log");
if (!await logDir.exists()) {
await logDir.create();
}
var logFile = File("${logDir.path}/$fileName");
fileWriter = logFile.openWrite(mode: FileMode.append);
writeSystemInfo();
}
void write(String content) {
fileWriter?.write(content);
fileWriter?.write("\r\n");
}
Future close() async {
await fileWriter?.close();
}
void writeSystemInfo() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
write("System Info:");
write("Current Time: ${DateTime.now()}");
write("Platform: ${Platform.operatingSystem}");
write("Version: ${Platform.operatingSystemVersion}");
write("Local: ${Platform.localeName}");
write(
"App Version: ${Utils.packageInfo.version}+${Utils.packageInfo.buildNumber}");
if (Platform.isAndroid) {
write((await deviceInfo.androidInfo).data.toString());
} else if (Platform.isIOS) {
write((await deviceInfo.iosInfo).data.toString());
} else if (Platform.isLinux) {
write((await deviceInfo.linuxInfo).data.toString());
} else if (Platform.isMacOS) {
write((await deviceInfo.macOsInfo).data.toString());
} else if (Platform.isWindows) {
write((await deviceInfo.windowsInfo).data.toString());
}
write("End System Info");
}
}
class DebugLogModel {
final String content;
final DateTime datetime;
final Color? color;
DebugLogModel(this.datetime, this.content, {this.color});
}
================================================
FILE: simple_live_app/lib/app/sites.dart
================================================
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_core/simple_live_core.dart';
class Sites {
static final Map allSites = {
Constant.kBiliBili: Site(
id: Constant.kBiliBili,
logo: "assets/images/bilibili_2.png",
name: "哔哩哔哩",
liveSite: BiliBiliSite(),
),
Constant.kDouyu: Site(
id: Constant.kDouyu,
logo: "assets/images/douyu.png",
name: "斗鱼直播",
liveSite: DouyuSite(),
),
Constant.kHuya: Site(
id: Constant.kHuya,
logo: "assets/images/huya.png",
name: "虎牙直播",
liveSite: HuyaSite(),
),
Constant.kDouyin: Site(
id: Constant.kDouyin,
logo: "assets/images/douyin.png",
name: "抖音直播",
liveSite: DouyinSite(),
),
};
static List get supportSites {
return AppSettingsController.instance.siteSort
.map((key) => allSites[key]!)
.toList();
}
}
class Site {
final String id;
final String name;
final String logo;
final LiveSite liveSite;
Site({
required this.id,
required this.liveSite,
required this.logo,
required this.name,
});
}
================================================
FILE: simple_live_app/lib/app/utils/archive.dart
================================================
import 'dart:convert';
import 'dart:io';
import 'package:archive/archive_io.dart';
import 'package:path/path.dart';
extension ArchiveExt on Archive {
addDirectoryToArchive(String dirPath, String parentPath) {
final dir = Directory(dirPath);
final entities = dir.listSync(recursive: false);
for (final entity in entities) {
final relativePath = relative(entity.path, from: parentPath);
if (entity is File) {
final data = entity.readAsBytesSync();
final archiveFile = ArchiveFile(relativePath, data.length, data);
addFile(archiveFile);
} else if (entity is Directory) {
addDirectoryToArchive(entity.path, parentPath);
}
}
}
add(String name, T raw) {
final data = json.encode(raw);
addFile(
// 这样会出现问题 不清楚原因
ArchiveFile.string(name, data)
//ArchiveFile(name, data.length, data),
);
}
}
================================================
FILE: simple_live_app/lib/app/utils/document.dart
================================================
import 'dart:io';
import 'package:simple_live_app/app/log.dart';
// 扩展 Directory 类,添加清空文件夹的功能并验证是否为文件夹
extension DirectoryCleaner on Directory {
Future clear() async {
// 首先判断是否为文件夹
if (await exists() && await FileSystemEntity.isDirectory(path)) {
// 列出文件夹中的所有文件和子文件夹
List files = listSync();
// 遍历文件列表并删除每个文件或子文件夹
for (FileSystemEntity file in files) {
if (file is File) {
await file.delete();
Log.i('删除文件: ${file.path}');
} else if (file is Directory) {
await Directory(file.path).delete(recursive: true);
Log.i('删除文件夹: ${file.path}');
}
}
Log.i('文件夹清空完成');
} else {
Log.i('$path 不是一个有效的文件夹');
}
}
// 阻塞主线程
void clearSync() {
if ( existsSync() && FileSystemEntity.isDirectorySync(path)) {
List files = listSync();
for (FileSystemEntity file in files) {
if (file is File) {
file.deleteSync();
Log.i('删除文件: ${file.path}');
} else if (file is Directory) {
Directory(file.path).deleteSync(recursive: true);
Log.i('删除文件夹: ${file.path}');
}
}
Log.i('文件夹清空完成');
} else {
Log.i('$path 不是一个有效的文件夹');
}
}
}
================================================
FILE: simple_live_app/lib/app/utils/listen_fourth_button.dart
================================================
import 'package:flutter/gestures.dart';
/// 鼠标侧键点击手势识别器
/// - https://github.com/flutter/flutter/issues/115641
/// - https://github.com/witnet/my-wit-wallet/pull/261
class FourthButtonTapGestureRecognizer extends BaseTapGestureRecognizer {
GestureTapDownCallback? onTapDown;
@override
void handleTapDown({required PointerDownEvent down}) {
final TapDownDetails details = TapDownDetails(
globalPosition: down.position,
localPosition: down.localPosition,
kind: getKindForPointer(down.pointer),
);
switch (down.buttons) {
case 8:
if (onTapDown != null) {
invokeCallback('onTapDown', () => onTapDown!(details));
}
break;
default:
}
}
@override
void handleTapCancel(
{required PointerDownEvent down,
PointerCancelEvent? cancel,
required String reason}) {}
@override
void handleTapUp(
{required PointerDownEvent down, required PointerUpEvent up}) {}
}
================================================
FILE: simple_live_app/lib/app/utils.dart
================================================
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:intl/intl.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/log.dart';
typedef TextValidate = bool Function(String text);
class Utils {
static late PackageInfo packageInfo;
static DateFormat dateFormat = DateFormat("MM-dd HH:mm");
static DateFormat dateFormatWithYear = DateFormat("yyyy-MM-dd HH:mm");
static DateFormat timeFormat = DateFormat("HH:mm:ss");
/// 处理时间
static String parseTime(DateTime? dt) {
if (dt == null) {
return "";
}
var dtNow = DateTime.now();
if (dt.year == dtNow.year &&
dt.month == dtNow.month &&
dt.day == dtNow.day) {
return "${dt.hour.toString().padLeft(2, '0')}:${dt.minute.toString().padLeft(2, '0')}";
}
if (dt.year == dtNow.year) {
return dateFormat.format(dt);
}
return dateFormatWithYear.format(dt);
}
/// 提示弹窗
/// - `content` 内容
/// - `title` 弹窗标题
/// - `confirm` 确认按钮内容,留空为确定
/// - `cancel` 取消按钮内容,留空为取消
static Future showAlertDialog(
String content, {
String title = '',
String confirm = '',
String cancel = '',
bool selectable = false,
List? actions,
}) async {
var result = await Get.dialog(
AlertDialog(
title: Text(title),
content: Container(
constraints: const BoxConstraints(
maxHeight: 400,
),
child: SingleChildScrollView(
child: Padding(
padding: AppStyle.edgeInsetsV12,
child: selectable ? SelectableText(content) : Text(content),
),
),
),
actions: [
...?actions,
TextButton(
onPressed: (() => Get.back(result: false)),
child: Text(cancel.isEmpty ? "取消" : cancel),
),
TextButton(
onPressed: (() => Get.back(result: true)),
child: Text(confirm.isEmpty ? "确定" : confirm),
),
],
),
);
return result ?? false;
}
/// 提示弹窗
/// - `content` 内容
/// - `title` 弹窗标题
/// - `confirm` 确认按钮内容,留空为确定
static Future showMessageDialog(String content,
{String title = '', String confirm = '', bool selectable = false}) async {
var result = await Get.dialog(
AlertDialog(
title: Text(title),
content: Padding(
padding: AppStyle.edgeInsetsV12,
child: selectable ? SelectableText(content) : Text(content),
),
actions: [
TextButton(
onPressed: (() => Get.back(result: true)),
child: Text(confirm.isEmpty ? "确定" : confirm),
),
],
),
);
return result ?? false;
}
static void showRightDialog({
required String title,
Function()? onDismiss,
required Widget child,
double width = 320,
bool useSystem = false,
}) {
SmartDialog.show(
alignment: Alignment.topRight,
animationBuilder: (controller, child, animationParam) {
//从右到左
return SlideTransition(
position: Tween(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(controller.view),
child: child,
);
},
useSystem: useSystem,
maskColor: Colors.transparent,
animationTime: const Duration(milliseconds: 200),
builder: (context) => Container(
width: width + MediaQuery.of(context).padding.right,
padding: EdgeInsets.only(right: MediaQuery.of(context).padding.right),
decoration: BoxDecoration(
color: Get.theme.cardColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(4),
bottomLeft: Radius.circular(4),
),
),
child: SafeArea(
left: false,
right: false,
child: MediaQuery(
data: const MediaQueryData(padding: EdgeInsets.zero),
child: Column(
children: [
ListTile(
visualDensity: VisualDensity.compact,
contentPadding: EdgeInsets.zero,
leading: IconButton(
onPressed: () {
SmartDialog.dismiss(status: SmartStatus.allCustom).then(
(value) => onDismiss?.call(),
);
},
icon: const Icon(Icons.arrow_back),
),
title: Text(
title,
style: Get.textTheme.titleMedium,
),
),
Divider(
height: 1,
color: Colors.grey.withAlpha(25),
),
Expanded(
child: child,
),
],
),
),
),
),
);
}
static void hideRightDialog() {
SmartDialog.dismiss(status: SmartStatus.allCustom);
}
static Future showBottomSheet({
required String title,
required Widget child,
double maxWidth = 600,
}) async {
var result = await showModalBottomSheet(
context: Get.context!,
constraints: BoxConstraints(
maxWidth: maxWidth,
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
builder: (_) => Column(
children: [
ListTile(
contentPadding: const EdgeInsets.only(
left: 12,
),
title: Text(title),
trailing: IconButton(
onPressed: Get.back,
icon: const Icon(Remix.close_line),
),
),
Expanded(
child: child,
),
],
),
);
return result;
}
/// 文本编辑的弹窗
/// - `content` 编辑框默认的内容
/// - `title` 弹窗标题
/// - `confirm` 确认按钮内容
/// - `cancel` 取消按钮内容
static Future showEditTextDialog(
String content, {
String title = '',
String? hintText,
String confirm = '',
String cancel = '',
TextValidate? validate,
}) async {
final TextEditingController textEditingController =
TextEditingController(text: content);
var result = await Get.dialog(
AlertDialog(
title: Text(title),
content: Padding(
padding: AppStyle.edgeInsetsT12,
child: TextField(
controller: textEditingController,
decoration: InputDecoration(
border: const OutlineInputBorder(),
//prefixText: title,
contentPadding: AppStyle.edgeInsetsA12,
hintText: hintText ?? title,
),
// style: TextStyle(
// height: 1.0,
// color: Get.isDarkMode ? Colors.white : Colors.black),
autofocus: true,
),
),
actions: [
TextButton(
onPressed: Get.back,
child: const Text("取消"),
),
TextButton(
onPressed: () {
if (validate != null && !validate(textEditingController.text)) {
return;
}
Get.back(result: textEditingController.text);
},
child: const Text("确定"),
),
],
),
// barrierColor:
// Get.isDarkMode ? Colors.grey.withOpacity(.3) : Colors.black38,
);
return result;
}
static Future showOptionDialog(
List contents,
T value, {
String title = '',
}) async {
var result = await Get.dialog(
RadioGroup(
groupValue: value,
onChanged: (e) {
Get.back(result: e);
},
child: SimpleDialog(
title: Text(title),
children: contents
.map(
(e) => RadioListTile(
title: Text(e.toString()),
value: e,
),
)
.toList(),
),
),
);
return result;
}
/// 多段指引用户内容的弹窗
/// - `content` 内容:可滚动
/// - `title` 顶部弹窗标题
/// - `actions` 底部按钮
static Future showInformationHelpDialog({
required List content,
Widget? title,
List? actions,
}) async {
var result = await Get.dialog(
AlertDialog(
title: title ?? const Text("帮助"),
scrollable: true,
content: SingleChildScrollView(child: ListBody(children: content)),
actions: actions ??
[
TextButton(
onPressed: Get.back,
child: const Text("确定"),
),
],
),
);
return result;
}
static Future showStatement() async {
var text = await rootBundle.loadString("assets/statement.txt");
var result = await showAlertDialog(
text,
selectable: true,
title: "免责声明",
confirm: "已阅读并同意",
cancel: "退出",
);
if (!result) {
exit(0);
}
}
static Future showMapOptionDialog(
Map contents,
T value, {
String title = '',
}) async {
var result = await Get.dialog(
RadioGroup(
groupValue: value,
onChanged: (e) {
Get.back(result: e);
},
child: SimpleDialog(
title: Text(title),
children: contents.keys
.map(
(e) => RadioListTile(
title: Text((contents[e] ?? '-').tr),
value: e,
),
)
.toList(),
),
),
);
return result;
}
static int parseVersion(String version) {
var sp = version.split('.');
var num = "";
for (var item in sp) {
num = num + item.padLeft(2, '0');
}
return int.parse(num);
}
static String onlineToString(int num) {
if (num >= 10000) {
return "${(num / 10000.0).toStringAsFixed(1)}万";
}
return num.toString();
}
/// 检查相册权限
static Future checkPhotoPermission() async {
try {
if (!Platform.isIOS) {
return true;
}
var status = await Permission.photos.status;
if (status == PermissionStatus.granted) {
return true;
}
status = await Permission.photos.request();
if (status.isGranted) {
return true;
} else {
SmartDialog.showToast(
"请授予相册访问权限",
);
return false;
}
} catch (e) {
return false;
}
}
static final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
/// 检查文件权限
static Future checkStorgePermission() async {
try {
if (!Platform.isAndroid) {
return true;
}
Permission permission = Permission.storage;
var androidIndo = await deviceInfo.androidInfo;
if (androidIndo.version.sdkInt >= 33) {
permission = Permission.manageExternalStorage;
}
var status = await permission.status;
if (status == PermissionStatus.granted) {
return true;
}
status = await permission.request();
if (status.isGranted) {
return true;
} else {
SmartDialog.showToast(
"请授予文件访问权限",
);
return false;
}
} catch (e) {
return false;
}
}
///16进制颜色转换
static Color convertHexColor(String hexColor) {
hexColor = hexColor.replaceAll("#", "");
if (hexColor.length == 4) {
hexColor = "00$hexColor";
}
if (hexColor.length == 6) {
var R = int.parse(hexColor.substring(0, 2), radix: 16);
var G = int.parse(hexColor.substring(2, 4), radix: 16);
var B = int.parse(hexColor.substring(4, 6), radix: 16);
return Color.fromARGB(255, R, G, B);
}
if (hexColor.length == 8) {
var A = int.parse(hexColor.substring(0, 2), radix: 16);
var R = int.parse(hexColor.substring(2, 4), radix: 16);
var G = int.parse(hexColor.substring(4, 6), radix: 16);
var B = int.parse(hexColor.substring(6, 8), radix: 16);
return Color.fromARGB(A, R, G, B);
}
return Colors.white;
}
/// 复制内容到剪贴板
static void copyToClipboard(String text) async {
try {
await Clipboard.setData(ClipboardData(text: text));
SmartDialog.showToast("已复制到剪贴板");
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("复制到剪贴板失败: $e");
}
}
/// 获取剪贴板内容
static Future getClipboard() async {
try {
var content = await Clipboard.getData(Clipboard.kTextPlain);
if (content == null) {
SmartDialog.showToast("无法读取剪贴板内容");
return null;
}
return content.text;
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("读取剪切板内容失败:$e");
}
return null;
}
static bool isRegexFormat(String keyword) {
return keyword.startsWith('/') &&
keyword.endsWith('/') &&
keyword.length > 2;
}
static String removeRegexFormat(String keyword) {
return keyword.substring(1, keyword.length - 1);
}
static String parseFileSize(int size) {
if (size < 1024) {
return "$size B";
}
if (size < 1024 * 1024) {
return "${(size / 1024).toStringAsFixed(2)} KB";
}
if (size < 1024 * 1024 * 1024) {
return "${(size / 1024 / 1024).toStringAsFixed(2)} MB";
}
return "${(size / 1024 / 1024 / 1024).toStringAsFixed(2)} GB";
}
}
================================================
FILE: simple_live_app/lib/main.dart
================================================
import 'dart:async';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:logger/logger.dart';
import 'package:media_kit/media_kit.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/app/utils/listen_fourth_button.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/models/db/follow_user_tag.dart';
import 'package:simple_live_app/models/db/history.dart';
import 'package:simple_live_app/modules/other/debug_log_page.dart';
import 'package:simple_live_app/routes/app_pages.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/douyin_account_service.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/services/local_storage_service.dart';
import 'package:simple_live_app/services/sync_service.dart';
import 'package:simple_live_app/widgets/status/app_loadding_widget.dart';
import 'package:simple_live_core/simple_live_core.dart';
import 'package:window_manager/window_manager.dart';
import 'package:path/path.dart' as p;
import 'package:dynamic_color/dynamic_color.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await migrateData();
await initWindow();
MediaKit.ensureInitialized();
await Hive.initFlutter(
(!Platform.isAndroid && !Platform.isIOS)
? (await getApplicationSupportDirectory()).path
: null,
);
//初始化服务
await initServices();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
//设置状态栏为透明
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark,
systemNavigationBarColor: Colors.transparent,
);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
runApp(const MyApp());
}
/// 将Hive数据迁移到Application Support
Future migrateData() async {
if (Platform.isAndroid || Platform.isIOS) {
return;
}
var hiveFileList = [
"followuser",
//旧版本写错成hostiry了
"hostiry",
"followusertag",
"localstorage",
"danmushield",
];
try {
var newDir = await getApplicationSupportDirectory();
var hiveFile = File(p.join(newDir.path, "followuser.hive"));
if (await hiveFile.exists()) {
return;
}
var oldDir = await getApplicationDocumentsDirectory();
for (var element in hiveFileList) {
var oldFile = File(p.join(oldDir.path, "$element.hive"));
if (await oldFile.exists()) {
var fileName = "$element.hive";
if (element == "hostiry") {
fileName = "history.hive";
}
await oldFile.copy(p.join(newDir.path, fileName));
await oldFile.delete();
}
var lockFile = File(p.join(oldDir.path, "$element.lock"));
if (await lockFile.exists()) {
await lockFile.delete();
}
}
} catch (e) {
Log.logPrint(e);
}
}
Future initWindow() async {
if (!(Platform.isMacOS || Platform.isWindows || Platform.isLinux)) {
return;
}
await windowManager.ensureInitialized();
WindowOptions windowOptions = const WindowOptions(
minimumSize: Size(280, 280),
center: true,
title: "Simple Live",
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
}
Future initServices() async {
Hive.registerAdapter(FollowUserAdapter());
Hive.registerAdapter(HistoryAdapter());
Hive.registerAdapter(FollowUserTagAdapter());
//包信息
Utils.packageInfo = await PackageInfo.fromPlatform();
//本地存储
Log.d("Init LocalStorage Service");
await Get.put(LocalStorageService()).init();
await Get.put(DBService()).init();
//初始化设置控制器
Get.put(AppSettingsController());
Get.put(BiliBiliAccountService());
Get.put(DouyinAccountService());
Get.put(SyncService());
Get.put(FollowService());
initCoreLog();
}
void initCoreLog() {
//日志信息
CoreLog.enableLog =
!kReleaseMode || AppSettingsController.instance.logEnable.value;
CoreLog.requestLogType = RequestLogType.short;
CoreLog.onPrintLog = (level, msg) {
switch (level) {
case Level.debug:
Log.d(msg);
break;
case Level.error:
Log.e(msg, StackTrace.current);
break;
case Level.info:
Log.i(msg);
break;
case Level.warning:
Log.w(msg);
break;
default:
Log.logPrint(msg);
}
};
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
bool isDynamicColor = AppSettingsController.instance.isDynamic.value;
Color styleColor = Color(AppSettingsController.instance.styleColor.value);
return DynamicColorBuilder(
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
ColorScheme? lightColorScheme;
ColorScheme? darkColorScheme;
if (lightDynamic != null && darkDynamic != null && isDynamicColor) {
lightColorScheme = lightDynamic;
darkColorScheme = darkDynamic;
} else {
lightColorScheme = ColorScheme.fromSeed(
seedColor: styleColor,
brightness: Brightness.light,
);
darkColorScheme = ColorScheme.fromSeed(
seedColor: styleColor, brightness: Brightness.dark);
}
return GetMaterialApp(
title: "Simple Live",
theme: AppStyle.lightTheme.copyWith(colorScheme: lightColorScheme),
darkTheme: AppStyle.darkTheme.copyWith(colorScheme: darkColorScheme),
themeMode:
ThemeMode.values[Get.find().themeMode.value],
initialRoute: RoutePath.kIndex,
getPages: AppPages.routes,
//国际化
locale: const Locale("zh", "CN"),
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [Locale("zh", "CN")],
logWriterCallback: (text, {bool? isError}) {
Log.addDebugLog(text, (isError ?? false) ? Colors.red : Colors.grey);
Log.writeLog(text, (isError ?? false) ? Level.error : Level.info);
},
// 升级后Android页面过渡动画似乎有BUG
defaultTransition: Platform.isAndroid ? Transition.cupertino : null,
//debugShowCheckedModeBanner: false,
navigatorObservers: [FlutterSmartDialog.observer],
builder: FlutterSmartDialog.init(
loadingBuilder: ((msg) => const AppLoaddingWidget()),
//字体大小不跟随系统变化
builder: (context, child) {
// Fix for HyperOS windowed-mode Flutter bug:
// - Values > 50 indicate the bug (windowed mode on HyperOS)
// - Values == 0 are valid for fullscreen/immersive mode and must NOT be treated as abnormal
const fallbackPadding = EdgeInsets.only(top: 25, bottom: 35);
const maxNormalPadding = 50.0;
final mediaQueryData = MediaQuery.of(context);
final hasAbnormalPadding = mediaQueryData.viewPadding.top > maxNormalPadding;
final fixedMediaQueryData = hasAbnormalPadding
? mediaQueryData.copyWith(
viewPadding: fallbackPadding,
padding: fallbackPadding,
textScaler: const TextScaler.linear(1.0),
)
: mediaQueryData.copyWith(textScaler: const TextScaler.linear(1.0));
return MediaQuery(
data: fixedMediaQueryData,
child: Stack(
children: [
//侧键返回
RawGestureDetector(
excludeFromSemantics: true,
gestures: {
FourthButtonTapGestureRecognizer:
GestureRecognizerFactoryWithHandlers<
FourthButtonTapGestureRecognizer>(
() => FourthButtonTapGestureRecognizer(),
(FourthButtonTapGestureRecognizer instance) {
instance.onTapDown = (TapDownDetails details) async {
//如果处于全屏状态,退出全屏
if (!Platform.isAndroid && !Platform.isIOS) {
if (await windowManager.isFullScreen()) {
await windowManager.setFullScreen(false);
return;
}
}
Get.back();
};
},
),
},
child: KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: (KeyEvent event) async {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.escape) {
// ESC退出全屏
// 如果处于全屏状态,退出全屏
if (!Platform.isAndroid && !Platform.isIOS) {
if (await windowManager.isFullScreen()) {
await windowManager.setFullScreen(false);
return;
}
}
}
},
child: child!,
),
),
//查看DEBUG日志按钮
//只在Debug、Profile模式显示
Visibility(
visible: !kReleaseMode,
child: Positioned(
right: 12,
bottom: 100 + context.mediaQueryViewPadding.bottom,
child: Opacity(
opacity: 0.4,
child: ElevatedButton(
child: const Text("DEBUG LOG"),
onPressed: () {
Get.bottomSheet(
const DebugLogPage(),
);
},
),
),
),
),
],
),
);
},
),
);
}));
}
}
================================================
FILE: simple_live_app/lib/models/account/bilibili_user_info_page.dart
================================================
import 'dart:convert';
T? asT(dynamic value) {
if (value is T) {
return value;
}
return null;
}
class BiliBiliUserInfoModel {
BiliBiliUserInfoModel({
this.mid,
this.uname,
this.userid,
this.sign,
this.birthday,
this.sex,
this.nickFree,
this.rank,
});
factory BiliBiliUserInfoModel.fromJson(Map json) =>
BiliBiliUserInfoModel(
mid: asT(json['mid']),
uname: asT(json['uname']),
userid: asT(json['userid']),
sign: asT(json['sign']),
birthday: asT(json['birthday']),
sex: asT(json['sex']),
nickFree: asT(json['nick_free']),
rank: asT(json['rank']),
);
int? mid;
String? uname;
String? userid;
String? sign;
String? birthday;
String? sex;
bool? nickFree;
String? rank;
@override
String toString() {
return jsonEncode(this);
}
Map toJson() => {
'mid': mid,
'uname': uname,
'userid': userid,
'sign': sign,
'birthday': birthday,
'sex': sex,
'nick_free': nickFree,
'rank': rank,
};
}
================================================
FILE: simple_live_app/lib/models/db/follow_user.dart
================================================
import 'package:get/get.dart';
import 'package:hive/hive.dart';
part 'follow_user.g.dart';
@HiveType(typeId: 1)
class FollowUser {
FollowUser({
required this.id,
required this.roomId,
required this.siteId,
required this.userName,
required this.face,
required this.addTime,
this.tag = "全部"
});
///id=siteId_roomId
@HiveField(0)
String id;
@HiveField(1)
String roomId;
@HiveField(2)
String siteId;
@HiveField(3)
String userName;
@HiveField(4)
String face;
@HiveField(5)
DateTime addTime;
@HiveField(6)
String tag;
/// 直播状态
/// 0=未知(加载中) 1=未开播 2=直播中
Rx liveStatus = 0.obs;
/// 开播时间戳
String? liveStartTime;
factory FollowUser.fromJson(Map json) => FollowUser(
id: json['id'],
roomId: json['roomId'],
siteId: json['siteId'],
userName: json['userName'],
face: json['face'],
addTime: DateTime.parse(json['addTime']),
tag: json["tag"]??"全部",
);
Map toJson() => {
'id': id,
'roomId': roomId,
'siteId': siteId,
'userName': userName,
'face': face,
'addTime': addTime.toString(),
'tag':tag,
};
}
================================================
FILE: simple_live_app/lib/models/db/follow_user.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'follow_user.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class FollowUserAdapter extends TypeAdapter {
@override
final int typeId = 1;
@override
FollowUser read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return FollowUser(
id: fields[0] as String,
roomId: fields[1] as String,
siteId: fields[2] as String,
userName: fields[3] as String,
face: fields[4] as String,
addTime: fields[5] as DateTime,
tag: fields[6] ?? "全部",
);
}
@override
void write(BinaryWriter writer, FollowUser obj) {
writer
..writeByte(7)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.roomId)
..writeByte(2)
..write(obj.siteId)
..writeByte(3)
..write(obj.userName)
..writeByte(4)
..write(obj.face)
..writeByte(5)
..write(obj.addTime)
..writeByte(6)
..write(obj.tag);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is FollowUserAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: simple_live_app/lib/models/db/follow_user_tag.dart
================================================
import 'package:hive/hive.dart';
part 'follow_user_tag.g.dart';
@HiveType(typeId: 3)
class FollowUserTag {
@HiveField(1)
String id;
// 用户自定义tag
@HiveField(2)
String tag;
// followUserId
@HiveField(3)
List userId;
FollowUserTag({
required this.id,
required this.tag,
required this.userId,
});
factory FollowUserTag.fromJson(Map json) {
return FollowUserTag(
id: json['id'],
tag: json['tag'],
userId: List.from(json['userId']),
);
}
Map toJson() {
return {
'id': id,
'tag': tag,
'userId': userId,
};
}
FollowUserTag copyWith({
String? id,
String? tag,
List? userId,
}) {
return FollowUserTag(
id: id ?? this.id,
tag: tag ?? this.tag,
userId: userId ?? this.userId,
);
}
}
================================================
FILE: simple_live_app/lib/models/db/follow_user_tag.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'follow_user_tag.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class FollowUserTagAdapter extends TypeAdapter {
@override
final int typeId = 3;
@override
FollowUserTag read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return FollowUserTag(
id: fields[1] as String,
tag: fields[2] as String,
userId: (fields[3] as List).cast(),
);
}
@override
void write(BinaryWriter writer, FollowUserTag obj) {
writer
..writeByte(3)
..writeByte(1)
..write(obj.id)
..writeByte(2)
..write(obj.tag)
..writeByte(3)
..write(obj.userId);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is FollowUserTagAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: simple_live_app/lib/models/db/history.dart
================================================
import 'package:hive/hive.dart';
part 'history.g.dart';
@HiveType(typeId: 2)
class History {
History({
required this.id,
required this.roomId,
required this.siteId,
required this.userName,
required this.face,
required this.updateTime,
});
///id=siteId_roomId
@HiveField(0)
String id;
@HiveField(1)
String roomId;
@HiveField(2)
String siteId;
@HiveField(3)
String userName;
@HiveField(4)
String face;
@HiveField(5)
DateTime updateTime;
factory History.fromJson(Map json) => History(
id: json["id"],
roomId: json["roomId"],
siteId: json["siteId"],
userName: json["userName"],
face: json["face"],
updateTime: DateTime.parse(json["updateTime"]),
);
Map toJson() => {
"id": id,
"roomId": roomId,
"siteId": siteId,
"userName": userName,
"face": face,
"updateTime": updateTime.toString(),
};
}
================================================
FILE: simple_live_app/lib/models/db/history.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'history.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class HistoryAdapter extends TypeAdapter {
@override
final int typeId = 2;
@override
History read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return History(
id: fields[0] as String,
roomId: fields[1] as String,
siteId: fields[2] as String,
userName: fields[3] as String,
face: fields[4] as String,
updateTime: fields[5] as DateTime,
);
}
@override
void write(BinaryWriter writer, History obj) {
writer
..writeByte(6)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.roomId)
..writeByte(2)
..write(obj.siteId)
..writeByte(3)
..write(obj.userName)
..writeByte(4)
..write(obj.face)
..writeByte(5)
..write(obj.updateTime);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is HistoryAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: simple_live_app/lib/models/follow_user_item.dart
================================================
================================================
FILE: simple_live_app/lib/models/sync_client_info_model.dart
================================================
import 'dart:convert';
T? asT(dynamic value) {
if (value is T) {
return value;
}
return null;
}
class SyncClientInfoModel {
SyncClientInfoModel({
required this.name,
required this.version,
required this.address,
required this.port,
required this.type,
});
factory SyncClientInfoModel.fromJson(Map json) =>
SyncClientInfoModel(
type: asT(json['type'])!,
name: asT(json['name'])!,
version: asT(json['version'])!,
address: asT(json['address'])!,
port: asT(json['port'])!,
);
String type;
String name;
String version;
String address;
int port;
@override
String toString() {
return jsonEncode(this);
}
Map toJson() => {
'name': name,
'version': version,
'address': address,
'port': port,
'type': type,
};
}
================================================
FILE: simple_live_app/lib/models/version_model.dart
================================================
import 'dart:convert';
T? asT(dynamic value) {
if (value is T) {
return value;
}
return null;
}
class VersionModel {
VersionModel({
required this.version,
required this.versionNum,
required this.versionDesc,
required this.downloadUrl,
});
factory VersionModel.fromJson(Map json) => VersionModel(
version: asT(json['version'])!,
versionNum: asT(json['version_num'])!,
versionDesc: asT(json['version_desc'])!,
downloadUrl: asT(json['download_url'])!,
);
String version;
int versionNum;
String versionDesc;
String downloadUrl;
@override
String toString() {
return jsonEncode(this);
}
Map toJson() => {
'version': version,
'version_num': versionNum,
'version_desc': versionDesc,
'download_url': downloadUrl,
};
}
================================================
FILE: simple_live_app/lib/modules/category/category_controller.dart
================================================
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/category/category_list_controller.dart';
class CategoryController extends GetxController
with GetSingleTickerProviderStateMixin {
late TabController tabController;
CategoryController() {
tabController =
TabController(length: Sites.supportSites.length, vsync: this);
}
StreamSubscription? streamSubscription;
@override
void onInit() {
streamSubscription = EventBus.instance.listen(
EventBus.kBottomNavigationBarClicked,
(index) {
if (index == 2) {
refreshOrScrollTop();
}
},
);
for (var site in Sites.supportSites) {
Get.put(CategoryListController(site), tag: site.id);
}
super.onInit();
}
void refreshOrScrollTop() {
var tabIndex = tabController.index;
BasePageController controller;
controller =
Get.find(tag: Sites.supportSites[tabIndex].id);
controller.scrollToTopOrRefresh();
}
@override
void onClose() {
streamSubscription?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/category/category_list_controller.dart
================================================
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_core/simple_live_core.dart';
class CategoryListController extends BasePageController {
final Site site;
CategoryListController(this.site);
@override
Future> getData(int page, int pageSize) async {
var result = await site.liveSite.getCategores();
return result.map((e) => AppLiveCategory.fromLiveCategory(e)).toList();
}
}
class AppLiveCategory extends LiveCategory {
var showAll = false.obs;
AppLiveCategory({
required super.id,
required super.name,
required super.children,
}) {
showAll.value = children.length < 19;
}
List get take15 => children.take(15).toList();
factory AppLiveCategory.fromLiveCategory(LiveCategory item) {
return AppLiveCategory(
children: item.children,
id: item.id,
name: item.name,
);
}
}
================================================
FILE: simple_live_app/lib/modules/category/category_list_view.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/category/category_list_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/net_image.dart';
import 'package:simple_live_app/widgets/shadow_card.dart';
import 'package:simple_live_core/simple_live_core.dart';
import 'package:sticky_headers/sticky_headers.dart';
class CategoryListView extends StatelessWidget {
final String tag;
const CategoryListView(this.tag, {Key? key}) : super(key: key);
CategoryListController get controller =>
Get.find(tag: tag);
@override
Widget build(BuildContext context) {
return KeepAliveWrapper(
child: Obx(
() => EasyRefresh(
firstRefresh: true,
controller: controller.easyRefreshController,
onRefresh: controller.refreshData,
header: MaterialHeader(
completeDuration: const Duration(milliseconds: 400),
),
child: ListView.builder(
padding: AppStyle.edgeInsetsA12,
itemCount: controller.list.length,
controller: controller.scrollController,
itemBuilder: (_, i) {
var item = controller.list[i];
return Column(
children: [
StickyHeader(
header: Container(
padding: AppStyle.edgeInsetsV8.copyWith(left: 4),
color: Theme.of(context).scaffoldBackgroundColor,
alignment: Alignment.centerLeft,
child: Text(
item.name,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
),
content: Obx(
() => GridView.count(
shrinkWrap: true,
padding: AppStyle.edgeInsetsV8,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: MediaQuery.of(context).size.width ~/ 80,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
children: item.showAll.value
? (item.children
.map(
(e) => buildSubCategory(e),
)
.toList())
: (item.take15
.map(
(e) => buildSubCategory(e),
)
.toList()
..add(buildShowMore(item))),
),
),
),
],
);
},
),
),
),
);
}
Widget buildSubCategory(LiveSubCategory item) {
return ShadowCard(
onTap: () {
AppNavigator.toCategoryDetail(site: controller.site, category: item);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
NetImage(
item.pic ?? "",
width: 40,
height: 40,
borderRadius: 8,
),
AppStyle.vGap4,
Text(
item.name,
maxLines: 1,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 12),
),
],
),
);
}
Widget buildShowMore(AppLiveCategory item) {
return ShadowCard(
onTap: () {
item.showAll.value = true;
},
child: const Center(
child: Text(
"显示全部",
maxLines: 1,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12),
),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/category/category_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/category/category_controller.dart';
import 'package:simple_live_app/modules/category/category_list_view.dart';
class CategoryPage extends GetView {
const CategoryPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 8,
title: TabBar(
controller: controller.tabController,
padding: EdgeInsets.zero,
tabAlignment: TabAlignment.center,
tabs: Sites.supportSites
.map(
(e) => Tab(
//text: e.name,
child: Row(
children: [
Image.asset(
e.logo,
width: 24,
),
AppStyle.hGap8,
Text(e.name),
],
),
),
)
.toList(),
labelPadding: AppStyle.edgeInsetsH20,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
),
),
body: TabBarView(
controller: controller.tabController,
children: Sites.supportSites
.map(
(e) => CategoryListView(
e.id,
),
)
.toList(),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/category/detail/category_detail_controller.dart
================================================
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_core/simple_live_core.dart';
class CategoryDetailController extends BasePageController {
final Site site;
final LiveSubCategory subCategory;
CategoryDetailController({
required this.site,
required this.subCategory,
});
@override
Future> getData(int page, int pageSize) async {
var result = await site.liveSite.getCategoryRooms(subCategory, page: page);
return result.items;
}
}
================================================
FILE: simple_live_app/lib/modules/category/detail/category_detail_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/category/detail/category_detail_controller.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/live_room_card.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
class CategoryDetailPage extends GetView {
const CategoryDetailPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var c = MediaQuery.of(context).size.width ~/ 200;
if (c < 2) {
c = 2;
}
return Scaffold(
appBar: AppBar(
title: Text(controller.subCategory.name),
),
body: KeepAliveWrapper(
child: PageGridView(
pageController: controller,
padding: AppStyle.edgeInsetsA12,
firstRefresh: true,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
crossAxisCount: c,
itemBuilder: (_, i) {
var item = controller.list[i];
return LiveRoomCard(controller.site, item);
},
),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/follow_user/follow_user_controller.dart
================================================
// ignore_for_file: invalid_use_of_protected_member
import 'dart:async';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/models/db/follow_user_tag.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/follow_service.dart';
class FollowUserController extends BasePageController {
StreamSubscription? onUpdatedIndexedStream;
StreamSubscription? onUpdatedListStream;
/// 0:全部 1:直播中 2:未直播
var filterMode = FollowUserTag(id: "0", tag: "全部", userId: []).obs;
RxList tagList = [
FollowUserTag(id: "0", tag: "全部", userId: []),
FollowUserTag(id: "1", tag: "直播中", userId: []),
FollowUserTag(id: "2", tag: "未开播", userId: []),
].obs;
// 用户自定义标签
RxList userTagList = [].obs;
@override
void onInit() {
onUpdatedIndexedStream = EventBus.instance.listen(
EventBus.kBottomNavigationBarClicked,
(index) {
if (index == 1) {
scrollToTopOrRefresh();
}
},
);
onUpdatedListStream =
FollowService.instance.updatedListStream.listen((event) {
filterData();
});
super.onInit();
}
@override
Future refreshData() async {
await FollowService.instance.loadData();
updateTagList();
super.refreshData();
}
@override
Future> getData(int page, int pageSize) async {
if (page > 1) {
return Future.value([]);
}
if (filterMode.value.tag == "全部") {
return FollowService.instance.followList.value;
} else if (filterMode.value.tag == "直播中") {
return FollowService.instance.liveList.value;
} else if (filterMode.value.tag == "未开播") {
return FollowService.instance.notLiveList.value;
} else {
FollowService.instance.filterDataByTag(filterMode.value);
return FollowService.instance.curTagFollowList.value;
}
}
void updateTagList() {
userTagList.assignAll(FollowService.instance.followTagList);
tagList.value = tagList.take(3).toList();
for (var i in userTagList) {
if (!tagList.contains(i)) {
tagList.add(i);
}
}
}
void filterData() {
if (filterMode.value.tag == "全部") {
list.assignAll(FollowService.instance.followList.value);
} else if (filterMode.value.tag == "直播中") {
list.assignAll(FollowService.instance.liveList.value);
} else if (filterMode.value.tag == "未开播") {
list.assignAll(FollowService.instance.notLiveList.value);
} else {
FollowService.instance.filterDataByTag(filterMode.value);
list.assignAll(FollowService.instance.curTagFollowList);
}
}
void setFilterMode(FollowUserTag tag) {
filterMode.value = tag;
filterData();
}
void removeItem(FollowUser item) async {
var result =
await Utils.showAlertDialog("确定要取消关注${item.userName}吗?", title: "取消关注");
if (!result) {
return;
}
// 取消关注同时删除标签内的 userId
if(item.tag != "全部"){
var tag = tagList.firstWhere((tag) => tag.tag == item.tag);
tag.userId.remove(item.id);
updateTag(tag);
}
await DBService.instance.followBox.delete(item.id);
refreshData();
}
void updateItem(FollowUser item){
FollowService.instance.addFollow(item);
}
// 修改item的标签
void setItemTag(FollowUser item, FollowUserTag targetTag) {
FollowUserTag tarTag = targetTag;
FollowUserTag curTag =
tagList.firstWhere((tag) => tag.tag == item.tag);
// 从当前标签(非全部)删除item 向目标标签(全部包含所有item == 非全部)添加item
curTag.userId.remove(item.id);
tarTag.userId.addIf(!tarTag.userId.contains(item.id), item.id);
// 数据库更新
item.tag = tarTag.tag;
updateTag(curTag);
updateTag(tarTag);
updateItem(item);
filterData();
}
Future removeTag(FollowUserTag tag) async {
// 将tag下的所有follow设置为全部
for(var i in tag.userId){
var follow = DBService.instance.followBox.get(i);
if(follow != null){
follow.tag = "全部";
updateItem(follow);
}
}
await FollowService.instance.delFollowUserTag(tag);
updateTagList();
Log.i('删除tag${tag.tag}');
}
void addTag(String tag) async {
FollowService.instance
.addFollowUserTag(tag)
.then((value) => updateTagList());
}
void updateTag(FollowUserTag followUserTag) {
if(followUserTag.tag == '全部'){
return;
}
FollowService.instance.updateFollowUserTag(followUserTag);
}
void updateTagName(FollowUserTag followUserTag, String newTagName) {
// 未操作
if (followUserTag.tag == newTagName) {
return;
}
// 避免重名
if (tagList.any((item) => item.tag == newTagName)) {
SmartDialog.showToast("标签名重复,修改失败");
return;
}
final FollowUserTag newTag = followUserTag.copyWith(tag: newTagName);
updateTag(newTag);
// update item's tag when update tagName
for(var i in newTag.userId){
var follow = DBService.instance.followBox.get(i);
if(follow != null){
follow.tag = newTagName;
updateItem(follow);
}
}
SmartDialog.showToast("标签名修改成功");
updateTagList();
}
// 调整标签顺序
void updateTagOrder(int oldIndex, int newIndex) {
if (newIndex > oldIndex) newIndex -= 1; // 处理索引调整
final item = userTagList.removeAt(oldIndex);
userTagList.insert(newIndex, item);
tagList.value = tagList.take(3).toList();
tagList.addAll(userTagList);
DBService.instance.updateFollowTagOrder(userTagList);
}
@override
void onClose() {
onUpdatedIndexedStream?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/follow_user/follow_user_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/models/db/follow_user_tag.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/filter_button.dart';
import 'package:simple_live_app/widgets/follow_user_item.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
class FollowUserPage extends GetView {
const FollowUserPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var count = MediaQuery.of(context).size.width ~/ 500;
if (count < 1) count = 1;
return Scaffold(
appBar: AppBar(
title: const Text("关注用户"),
actions: [
PopupMenuButton(
itemBuilder: (context) {
return const [
PopupMenuItem(
value: 0,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Remix.save_2_line),
AppStyle.hGap12,
Text("导出文件")
],
),
),
PopupMenuItem(
value: 1,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Remix.folder_open_line),
AppStyle.hGap12,
Text("导入文件")
],
),
),
PopupMenuItem(
value: 2,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Remix.text),
AppStyle.hGap12,
Text("导出文本"),
],
),
),
PopupMenuItem(
value: 3,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Remix.file_text_line),
AppStyle.hGap12,
Text("导入文本"),
],
),
),
PopupMenuItem(
value: 4,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Remix.price_tag_line),
AppStyle.hGap12,
Text("标签管理"),
],
),
),
];
},
onSelected: (value) {
if (value == 0) {
FollowService.instance.exportFile();
} else if (value == 1) {
FollowService.instance.inputFile();
} else if (value == 2) {
FollowService.instance.exportText();
} else if (value == 3) {
FollowService.instance.inputText();
} else if (value == 4) {
showTagsManager();
}
},
),
],
leading: Obx(
() => FollowService.instance.updating.value
? const IconButton(
onPressed: null,
icon: SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
),
),
)
: IconButton(
onPressed: () {
controller.refreshData();
},
icon: const Icon(Icons.refresh),
),
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: AppStyle.edgeInsetsL8,
child: Row(
children: [
Expanded(
child: Obx(
() => SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Wrap(
spacing: 12,
children: controller.tagList.map((option) {
return FilterButton(
text: option.tag,
selected: controller.filterMode.value == option,
onTap: () {
controller.setFilterMode(option);
},
);
}).toList()),
),
),
),
],
),
),
Expanded(
child: PageGridView(
crossAxisSpacing: 12,
crossAxisCount: count,
pageController: controller,
firstRefresh: true,
showPCRefreshButton: false,
itemBuilder: (_, i) {
var item = controller.list[i];
var site = Sites.allSites[item.siteId]!;
return FollowUserItem(
item: item,
onRemove: () {
controller.removeItem(item);
},
onTap: () {
AppNavigator.toLiveRoomDetail(
site: site, roomId: item.roomId);
},
onLongPress: () {
setFollowTagDialog(item);
},
);
},
),
),
],
),
);
}
void setFollowTagDialog(FollowUser item) {
/// 控制单选ui
List copiedList = [
controller.tagList.first,
...controller.tagList.skip(3),
];
Rx checkTag =
controller.tagList.indexOf(controller.filterMode.value) < 3
? copiedList.first.obs
: controller.filterMode.value.obs;
final ScrollController scrollController = ScrollController();
Get.dialog(
AlertDialog(
contentPadding: const EdgeInsets.all(16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 标题栏
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'设置标签',
style: TextStyle(
fontSize: 18,
),
),
IconButton(
icon: const Icon(
Icons.check,
),
onPressed: () {
controller.setItemTag(item, checkTag.value);
Get.back();
},
),
],
),
const Divider(),
Obx(
() {
int selectedIndex = copiedList.indexOf(checkTag.value);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (selectedIndex >= 0) {
scrollController.animateTo(
selectedIndex * 60.0, // 假设每项高度为 60
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
});
return SizedBox(
height: 300,
width: 300,
child: RadioGroup(
groupValue: checkTag.value,
onChanged: (value) {
checkTag.value = value!;
},
child: ListView.builder(
controller: scrollController,
itemCount: copiedList.length,
itemBuilder: (context, index) {
var tagItem = copiedList[index];
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey.shade300, width: 1.0),
),
),
child: RadioListTile(
title: Text(tagItem.tag),
value: tagItem,
),
);
},
),
),
);
},
),
],
),
),
);
}
void showTagsManager() {
Utils.showBottomSheet(
title: '标签管理',
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
AppStyle.divider,
ListTile(
title: const Text("添加标签"),
leading: const Icon(Icons.add),
onTap: () {
editTagDialog("添加标签");
},
),
AppStyle.divider,
// 列表内容
Expanded(
child: Obx(
() => ReorderableListView.builder(
itemCount: controller.userTagList.length,
itemBuilder: (context, index) {
// 偏移
FollowUserTag item = controller.userTagList[index];
return ListTile(
key: ValueKey(item.id),
title: GestureDetector(
child: Text(item.tag),
onLongPress: () {
{
editTagDialog("修改标签", followUserTag: item);
}
},
),
leading: IconButton(
icon: const Icon(Icons.delete),
onPressed: () {
controller.removeTag(item);
},
),
);
},
onReorder: (int oldIndex, int newIndex) {
controller.updateTagOrder(oldIndex, newIndex);
},
),
),
),
]),
);
}
void editTagDialog(String title, {FollowUserTag? followUserTag}) {
final TextEditingController tagEditController =
TextEditingController(text: followUserTag?.tag);
bool upMode = title == "添加标签" ? true : false;
Get.dialog(
AlertDialog(
contentPadding: const EdgeInsets.all(16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
content: SingleChildScrollView(
padding: EdgeInsets.only(
bottom: MediaQuery.of(Get.context!).viewInsets.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
),
),
TextField(
controller: tagEditController,
minLines: 1,
maxLines: 1,
decoration: InputDecoration(
border: const OutlineInputBorder(),
contentPadding: AppStyle.edgeInsetsA12,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withAlpha(51),
),
),
),
onSubmitted: (tag) {
upMode
? controller.addTag(tagEditController.text)
: controller.updateTagName(
followUserTag!, tagEditController.text);
Get.back();
},
),
Container(
margin: AppStyle.edgeInsetsB4,
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Get.back();
},
child: const Text('否'),
),
TextButton(
onPressed: () {
upMode
? controller.addTag(tagEditController.text)
: controller.updateTagName(
followUserTag!, tagEditController.text);
Get.back();
},
child: const Text('是'),
),
],
),
)
],
),
),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/home/home_controller.dart
================================================
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/home/home_list_controller.dart';
import 'package:simple_live_app/routes/route_path.dart';
class HomeController extends GetxController
with GetSingleTickerProviderStateMixin {
late TabController tabController;
HomeController() {
tabController =
TabController(length: Sites.supportSites.length, vsync: this);
}
StreamSubscription? streamSubscription;
@override
void onInit() {
streamSubscription = EventBus.instance.listen(
EventBus.kBottomNavigationBarClicked,
(index) {
if (index == 0) {
refreshOrScrollTop();
}
},
);
for (var site in Sites.supportSites) {
Get.put(HomeListController(site), tag: site.id);
}
super.onInit();
}
void refreshOrScrollTop() {
var tabIndex = tabController.index;
BasePageController controller;
controller =
Get.find(tag: Sites.supportSites[tabIndex].id);
controller.scrollToTopOrRefresh();
}
void toSearch() {
Get.toNamed(RoutePath.kSearch);
}
@override
void onClose() {
streamSubscription?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/home/home_list_controller.dart
================================================
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_core/simple_live_core.dart';
class HomeListController extends BasePageController {
final Site site;
HomeListController(this.site);
@override
Future> getData(int page, int pageSize) async {
var result = await site.liveSite.getRecommendRooms(page: page);
return result.items;
}
}
================================================
FILE: simple_live_app/lib/modules/home/home_list_view.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/home/home_list_controller.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/live_room_card.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
class HomeListView extends StatelessWidget {
final String tag;
const HomeListView(this.tag, {Key? key}) : super(key: key);
HomeListController get controller => Get.find(tag: tag);
@override
Widget build(BuildContext context) {
var c = MediaQuery.of(context).size.width ~/ 200;
if (c < 2) {
c = 2;
}
return KeepAliveWrapper(
child: PageGridView(
pageController: controller,
padding: AppStyle.edgeInsetsA12,
firstRefresh: true,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
crossAxisCount: c,
itemBuilder: (_, i) {
var item = controller.list[i];
return LiveRoomCard(controller.site, item);
},
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/home/home_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/home/home_controller.dart';
import 'package:simple_live_app/modules/home/home_list_view.dart';
class HomePage extends GetView {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 8,
title: TabBar(
controller: controller.tabController,
labelPadding: AppStyle.edgeInsetsH20,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
tabAlignment: TabAlignment.center,
tabs: Sites.supportSites
.map(
(e) => Tab(
//text: e.name,
child: Row(
children: [
Image.asset(
e.logo,
width: 24,
),
AppStyle.hGap8,
Text(e.name),
],
),
),
)
.toList(),
),
actions: [
IconButton(
onPressed: controller.toSearch,
icon: const Icon(Icons.search),
)
],
),
body: TabBarView(
controller: controller.tabController,
children: Sites.supportSites
.map(
(e) => HomeListView(
e.id,
),
)
.toList(),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/indexed/indexed_controller.dart
================================================
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/category/category_controller.dart';
import 'package:simple_live_app/modules/category/category_page.dart';
import 'package:simple_live_app/modules/home/home_controller.dart';
import 'package:simple_live_app/modules/home/home_page.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_page.dart';
import 'package:simple_live_app/modules/mine/mine_page.dart';
class IndexedController extends GetxController {
RxList items = RxList([]);
var index = 0.obs;
RxList pages = RxList([
const SizedBox(),
const SizedBox(),
const SizedBox(),
const SizedBox(),
]);
void setIndex(int i) {
if (pages[i] is SizedBox) {
switch (items[i].index) {
case 0:
Get.put(HomeController());
pages[i] = const HomePage();
break;
case 1:
Get.put(FollowUserController());
pages[i] = const FollowUserPage();
break;
case 2:
Get.put(CategoryController());
pages[i] = const CategoryPage();
break;
case 3:
pages[i] = const MinePage();
break;
default:
}
} else {
if (index.value == i) {
EventBus.instance
.emit(EventBus.kBottomNavigationBarClicked, items[i].index);
}
}
index.value = i;
}
@override
void onInit() {
Future.delayed(Duration.zero, showFirstRun);
items.value = AppSettingsController.instance.homeSort
.map((key) => Constant.allHomePages[key]!)
.toList();
setIndex(0);
super.onInit();
}
void showFirstRun() async {
var settingsController = Get.find();
if (settingsController.firstRun) {
settingsController.setNoFirstRun();
await Utils.showStatement();
}
}
}
================================================
FILE: simple_live_app/lib/modules/indexed/indexed_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'indexed_controller.dart';
class IndexedPage extends GetView {
const IndexedPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return OrientationBuilder(
builder: (context, orientation) {
return Scaffold(
body: Row(
children: [
Visibility(
visible: orientation == Orientation.landscape,
child: Obx(
() => NavigationRail(
selectedIndex: controller.index.value,
onDestinationSelected: controller.setIndex,
labelType: NavigationRailLabelType.none,
destinations: controller.items
.map(
(item) => NavigationRailDestination(
icon: Icon(item.iconData),
label: Text(item.title),
padding: AppStyle.edgeInsetsV8,
),
)
.toList(),
),
),
),
Expanded(
child: Obx(
() => Container(
decoration: BoxDecoration(
border: Border(
left: orientation == Orientation.landscape
? BorderSide(
color: Colors.grey.withAlpha(50),
width: 1,
)
: BorderSide.none,
),
),
child: IndexedStack(
index: controller.index.value,
children: controller.pages,
),
),
),
),
],
),
bottomNavigationBar: Visibility(
visible: orientation == Orientation.portrait,
child: Obx(
() => NavigationBar(
selectedIndex: controller.index.value,
onDestinationSelected: controller.setIndex,
height: 56,
labelBehavior: NavigationDestinationLabelBehavior.alwaysHide,
destinations: controller.items
.map(
(item) => NavigationDestination(
icon: Icon(item.iconData),
label: item.title,
),
)
.toList(),
),
),
),
);
},
);
}
}
================================================
FILE: simple_live_app/lib/modules/live_room/live_room_controller.dart
================================================
import 'dart:async';
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:share_plus/share_plus.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/models/db/history.dart';
import 'package:simple_live_app/modules/live_room/player/player_controller.dart';
import 'package:simple_live_app/modules/settings/danmu_settings_page.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/desktop_refresh_button.dart';
import 'package:simple_live_app/widgets/follow_user_item.dart';
import 'package:simple_live_core/simple_live_core.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class LiveRoomController extends PlayerController with WidgetsBindingObserver {
final Site pSite;
final String pRoomId;
late LiveDanmaku liveDanmaku;
LiveRoomController({
required this.pSite,
required this.pRoomId,
}) {
rxSite = pSite.obs;
rxRoomId = pRoomId.obs;
liveDanmaku = site.liveSite.getDanmaku();
// 抖音应该默认是竖屏的
if (site.id == "douyin") {
isVertical.value = true;
}
}
late Rx rxSite;
Site get site => rxSite.value;
late Rx rxRoomId;
String get roomId => rxRoomId.value;
Rx detail = Rx(null);
var online = 0.obs;
var followed = false.obs;
var liveStatus = false.obs;
RxList superChats = RxList();
/// 滚动控制
final ScrollController scrollController = ScrollController();
/// 聊天信息
RxList messages = RxList();
/// 清晰度数据
RxList qualites = RxList();
/// 当前清晰度
var currentQuality = -1;
var currentQualityInfo = "".obs;
/// 线路数据
RxList playUrls = RxList();
Map? playHeaders;
/// 当前线路
var currentLineIndex = -1;
var currentLineInfo = "".obs;
/// 退出倒计时
var countdown = 60.obs;
Timer? autoExitTimer;
/// 设置的自动关闭时间(分钟)
var autoExitMinutes = 60.obs;
///是否延迟自动关闭
var delayAutoExit = false.obs;
/// 是否启用自动关闭
var autoExitEnable = false.obs;
/// 是否禁用自动滚动聊天栏
/// - 当用户向上滚动聊天栏时,不再自动滚动
var disableAutoScroll = false.obs;
/// 是否处于后台
var isBackground = false;
/// 直播间加载失败
var loadError = false.obs;
Error? error;
// 开播时长状态变量
var liveDuration = "00:00:00".obs;
Timer? _liveDurationTimer;
@override
void onInit() {
WidgetsBinding.instance.addObserver(this);
if (FollowService.instance.followList.isEmpty) {
FollowService.instance.loadData();
}
initAutoExit();
showDanmakuState.value = AppSettingsController.instance.danmuEnable.value;
followed.value = DBService.instance.getFollowExist("${site.id}_$roomId");
loadData();
scrollController.addListener(scrollListener);
super.onInit();
}
void scrollListener() {
if (scrollController.position.userScrollDirection ==
ScrollDirection.forward) {
disableAutoScroll.value = true;
}
}
/// 初始化自动关闭倒计时
void initAutoExit() {
if (AppSettingsController.instance.autoExitEnable.value) {
autoExitEnable.value = true;
autoExitMinutes.value =
AppSettingsController.instance.autoExitDuration.value;
setAutoExit();
} else {
autoExitMinutes.value =
AppSettingsController.instance.roomAutoExitDuration.value;
}
}
void setAutoExit() {
if (!autoExitEnable.value) {
autoExitTimer?.cancel();
return;
}
autoExitTimer?.cancel();
countdown.value = autoExitMinutes.value * 60;
autoExitTimer = Timer.periodic(const Duration(seconds: 1), (timer) async {
countdown.value -= 1;
if (countdown.value <= 0) {
timer = Timer(const Duration(seconds: 10), () async {
await WakelockPlus.disable();
exit(0);
});
autoExitTimer?.cancel();
var delay = await Utils.showAlertDialog("定时关闭已到时,是否延迟关闭?",
title: "延迟关闭", confirm: "延迟", cancel: "关闭", selectable: true);
if (delay) {
timer.cancel();
delayAutoExit.value = true;
showAutoExitSheet();
setAutoExit();
} else {
delayAutoExit.value = false;
await WakelockPlus.disable();
exit(0);
}
}
});
}
// 弹窗逻辑
void refreshRoom() {
//messages.clear();
superChats.clear();
liveDanmaku.stop();
loadData();
}
/// 聊天栏始终滚动到底部
void chatScrollToBottom() {
if (scrollController.hasClients) {
// 如果手动上拉过,就不自动滚动到底部
if (disableAutoScroll.value) {
return;
}
scrollController.jumpTo(scrollController.position.maxScrollExtent);
}
}
/// 初始化弹幕接收事件
void initDanmau() {
liveDanmaku.onMessage = onWSMessage;
liveDanmaku.onClose = onWSClose;
liveDanmaku.onReady = onWSReady;
}
/// 接收到WebSocket信息
void onWSMessage(LiveMessage msg) {
if (msg.type == LiveMessageType.chat) {
if (messages.length > 200 && !disableAutoScroll.value) {
messages.removeAt(0);
}
// 关键词屏蔽检查
for (var keyword in AppSettingsController.instance.shieldList) {
Pattern? pattern;
if (Utils.isRegexFormat(keyword)) {
String removedSlash = Utils.removeRegexFormat(keyword);
try {
pattern = RegExp(removedSlash);
} catch (e) {
// should avoid this during add keyword
Log.d("关键词:$keyword 正则格式错误");
}
} else {
pattern = keyword;
}
if (pattern != null && msg.message.contains(pattern)) {
Log.d("关键词:$keyword\n已屏蔽消息内容:${msg.message}");
return;
}
}
messages.add(msg);
WidgetsBinding.instance.addPostFrameCallback(
(_) => chatScrollToBottom(),
);
if (!liveStatus.value || isBackground) {
return;
}
addDanmaku([
DanmakuContentItem(
msg.message,
color: Color.fromARGB(
255,
msg.color.r,
msg.color.g,
msg.color.b,
),
),
]);
} else if (msg.type == LiveMessageType.online) {
online.value = msg.data;
} else if (msg.type == LiveMessageType.superChat) {
superChats.add(msg.data);
}
}
/// 添加一条系统消息
void addSysMsg(String msg) {
messages.add(
LiveMessage(
type: LiveMessageType.chat,
userName: "LiveSysMessage",
message: msg,
color: LiveMessageColor.white,
),
);
}
/// 接收到WebSocket关闭信息
void onWSClose(String msg) {
addSysMsg(msg);
}
/// WebSocket准备就绪
void onWSReady() {
addSysMsg("弹幕服务器连接正常");
}
/// 加载直播间信息
void loadData() async {
try {
SmartDialog.showLoading(msg: "");
loadError.value = false;
error = null;
update();
addSysMsg("正在读取直播间信息");
detail.value = await site.liveSite.getRoomDetail(roomId: roomId);
if (site.id == Constant.kDouyin) {
// 1.6.0之前收藏的WebRid
// 1.6.0收藏的RoomID
// 1.6.0之后改回WebRid
if (detail.value!.roomId != roomId) {
var oldId = roomId;
rxRoomId.value = detail.value!.roomId;
if (followed.value) {
// 更新关注列表
DBService.instance.deleteFollow("${site.id}_$oldId");
DBService.instance.addFollow(
FollowUser(
id: "${site.id}_$roomId",
roomId: roomId,
siteId: site.id,
userName: detail.value!.userName,
face: detail.value!.userAvatar,
addTime: DateTime.now(),
),
);
} else {
followed.value =
DBService.instance.getFollowExist("${site.id}_$roomId");
}
}
}
getSuperChatMessage();
addHistory();
// 确认房间关注状态
followed.value = DBService.instance.getFollowExist("${site.id}_$roomId");
online.value = detail.value!.online;
liveStatus.value = detail.value!.status || detail.value!.isRecord;
if (liveStatus.value) {
getPlayQualites();
}
if (detail.value!.isRecord) {
addSysMsg("当前主播未开播,正在轮播录像");
}
addSysMsg("开始连接弹幕服务器");
initDanmau();
liveDanmaku.start(detail.value?.danmakuData);
startLiveDurationTimer(); // 启动开播时长定时器
} catch (e) {
Log.logPrint(e);
//SmartDialog.showToast(e.toString());
loadError.value = true;
error = e as Error;
} finally {
SmartDialog.dismiss(status: SmartStatus.loading);
}
}
/// 初始化播放器
void getPlayQualites() async {
qualites.clear();
currentQuality = -1;
try {
var playQualites =
await site.liveSite.getPlayQualites(detail: detail.value!);
if (playQualites.isEmpty) {
SmartDialog.showToast("无法读取播放清晰度");
return;
}
qualites.value = playQualites;
var qualityLevel = await getQualityLevel();
if (qualityLevel == 2) {
//最高
currentQuality = 0;
} else if (qualityLevel == 0) {
//最低
currentQuality = playQualites.length - 1;
} else {
//中间值
int middle = (playQualites.length / 2).floor();
currentQuality = middle;
}
getPlayUrl();
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("无法读取播放清晰度");
}
}
Future getQualityLevel() async {
var qualityLevel = AppSettingsController.instance.qualityLevel.value;
try {
var connectivityResult = await (Connectivity().checkConnectivity());
if (connectivityResult.first == ConnectivityResult.mobile) {
qualityLevel =
AppSettingsController.instance.qualityLevelCellular.value;
}
} catch (e) {
Log.logPrint(e);
}
return qualityLevel;
}
void getPlayUrl() async {
playUrls.clear();
currentQualityInfo.value = qualites[currentQuality].quality;
currentLineInfo.value = "";
currentLineIndex = -1;
var playUrl = await site.liveSite
.getPlayUrls(detail: detail.value!, quality: qualites[currentQuality]);
if (playUrl.urls.isEmpty) {
SmartDialog.showToast("无法读取播放地址");
return;
}
playUrls.value = playUrl.urls;
playHeaders = playUrl.headers;
currentLineIndex = 0;
currentLineInfo.value = "线路${currentLineIndex + 1}";
//重置错误次数
mediaErrorRetryCount = 0;
initPlaylist();
}
void changePlayLine(int index) {
currentLineIndex = index;
//重置错误次数
mediaErrorRetryCount = 0;
setPlayer();
}
void initPlaylist() async {
currentLineInfo.value = "线路${currentLineIndex + 1}";
errorMsg.value = "";
final mediaList = playUrls.map((url) {
var finalUrl = url;
if (AppSettingsController.instance.playerForceHttps.value) {
finalUrl = finalUrl.replaceAll("http://", "https://");
}
return Media(finalUrl, httpHeaders: playHeaders);
}).toList();
// 初始化播放器并设置 ao 参数
await initializePlayer();
await player.open(Playlist(mediaList));
}
void setPlayer() async {
currentLineInfo.value = "线路${currentLineIndex + 1}";
errorMsg.value = "";
await player.jump(currentLineIndex);
}
@override
void mediaEnd() async {
super.mediaEnd();
if (mediaErrorRetryCount < 2) {
Log.d("播放结束,尝试第${mediaErrorRetryCount + 1}次刷新");
if (mediaErrorRetryCount == 1) {
//延迟一秒再刷新
await Future.delayed(const Duration(seconds: 1));
}
mediaErrorRetryCount += 1;
//刷新一次
setPlayer();
return;
}
Log.d("播放结束");
// 遍历线路,如果全部链接都断开就是直播结束了
if (playUrls.length - 1 == currentLineIndex) {
liveStatus.value = false;
} else {
changePlayLine(currentLineIndex + 1);
//setPlayer();
}
}
int mediaErrorRetryCount = 0;
@override
void mediaError(String error) async {
super.mediaEnd();
if (mediaErrorRetryCount < 2) {
Log.d("播放失败,尝试第${mediaErrorRetryCount + 1}次刷新");
if (mediaErrorRetryCount == 1) {
//延迟一秒再刷新
await Future.delayed(const Duration(seconds: 1));
}
mediaErrorRetryCount += 1;
//刷新一次
setPlayer();
return;
}
if (playUrls.length - 1 == currentLineIndex) {
errorMsg.value = "播放失败";
SmartDialog.showToast("播放失败:$error");
} else {
//currentLineIndex += 1;
//setPlayer();
changePlayLine(currentLineIndex + 1);
}
}
/// 读取SC
void getSuperChatMessage() async {
try {
var sc =
await site.liveSite.getSuperChatMessage(roomId: detail.value!.roomId);
superChats.addAll(sc);
} catch (e) {
Log.logPrint(e);
addSysMsg("SC读取失败");
}
}
/// 移除掉已到期的SC
void removeSuperChats() async {
var now = DateTime.now().millisecondsSinceEpoch;
superChats.value = superChats
.where((x) => x.endTime.millisecondsSinceEpoch > now)
.toList();
}
/// 添加历史记录
void addHistory() {
if (detail.value == null) {
return;
}
var id = "${site.id}_$roomId";
var history = DBService.instance.getHistory(id);
if (history != null) {
history.updateTime = DateTime.now();
}
history ??= History(
id: id,
roomId: roomId,
siteId: site.id,
userName: detail.value?.userName ?? "",
face: detail.value?.userAvatar ?? "",
updateTime: DateTime.now(),
);
DBService.instance.addOrUpdateHistory(history);
}
/// 关注用户
void followUser() {
if (detail.value == null) {
return;
}
var id = "${site.id}_$roomId";
DBService.instance.addFollow(
FollowUser(
id: id,
roomId: roomId,
siteId: site.id,
userName: detail.value?.userName ?? "",
face: detail.value?.userAvatar ?? "",
addTime: DateTime.now(),
),
);
followed.value = true;
EventBus.instance.emit(Constant.kUpdateFollow, id);
}
/// 取消关注用户
void removeFollowUser() async {
if (detail.value == null) {
return;
}
if (!await Utils.showAlertDialog("确定要取消关注该用户吗?", title: "取消关注")) {
return;
}
var id = "${site.id}_$roomId";
DBService.instance.deleteFollow(id);
followed.value = false;
EventBus.instance.emit(Constant.kUpdateFollow, id);
}
void share() {
if (detail.value == null) {
return;
}
SharePlus.instance.share(ShareParams(uri: Uri.parse(detail.value!.url)));
}
void copyUrl() {
if (detail.value == null) {
return;
}
Utils.copyToClipboard(detail.value!.url);
SmartDialog.showToast("已复制直播间链接");
}
/// 复制新生成的直播流
void copyPlayUrl() async {
// 未开播不复制
if (!liveStatus.value) {
return;
}
var playUrl = await site.liveSite
.getPlayUrls(detail: detail.value!, quality: qualites[currentQuality]);
if (playUrl.urls.isEmpty) {
SmartDialog.showToast("无法读取播放地址");
return;
}
Utils.copyToClipboard(playUrl.urls.first);
SmartDialog.showToast("已复制播放直链");
}
/// 底部打开播放器设置
void showDanmuSettingsSheet() {
Utils.showBottomSheet(
title: "弹幕设置",
child: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
DanmuSettingsView(
danmakuController: danmakuController,
onTapDanmuShield: () {
Get.back();
showDanmuShield();
},
),
],
),
);
}
void showVolumeSlider(BuildContext targetContext) {
SmartDialog.showAttach(
targetContext: targetContext,
alignment: Alignment.topCenter,
displayTime: const Duration(seconds: 3),
maskColor: const Color(0x00000000),
builder: (context) {
return Container(
decoration: BoxDecoration(
borderRadius: AppStyle.radius12,
color: Theme.of(context).cardColor,
),
padding: AppStyle.edgeInsetsA4,
child: Obx(
() => SizedBox(
width: 200,
child: Slider(
min: 0,
max: 100,
value: AppSettingsController.instance.playerVolume.value,
onChanged: (newValue) {
player.setVolume(newValue);
AppSettingsController.instance.setPlayerVolume(newValue);
},
),
),
),
);
},
);
}
void showQualitySheet() {
Utils.showBottomSheet(
title: "切换清晰度",
child: RadioGroup(
groupValue: currentQuality,
onChanged: (e) {
Get.back();
currentQuality = e ?? 0;
getPlayUrl();
},
child: ListView.builder(
itemCount: qualites.length,
itemBuilder: (_, i) {
var item = qualites[i];
return RadioListTile(
value: i,
title: Text(item.quality),
);
},
),
),
);
}
void showPlayUrlsSheet() {
Utils.showBottomSheet(
title: "切换线路",
child: RadioGroup(
groupValue: currentLineIndex,
onChanged: (e) {
Get.back();
//currentLineIndex = i;
//setPlayer();
changePlayLine(e ?? 0);
},
child: ListView.builder(
itemCount: playUrls.length,
itemBuilder: (_, i) {
return RadioListTile(
value: i,
title: Text("线路${i + 1}"),
secondary: Text(
playUrls[i].contains(".flv") ? "FLV" : "HLS",
),
);
},
),
),
);
}
void showPlayerSettingsSheet() {
Utils.showBottomSheet(
title: "画面尺寸",
child: Obx(
() => RadioGroup(
groupValue: AppSettingsController.instance.scaleMode.value,
onChanged: (e) {
AppSettingsController.instance.setScaleMode(e ?? 0);
updateScaleMode();
},
child: ListView(
padding: AppStyle.edgeInsetsV12,
children: const [
RadioListTile(
value: 0,
title: Text("适应"),
visualDensity: VisualDensity.compact,
),
RadioListTile(
value: 1,
title: Text("拉伸"),
visualDensity: VisualDensity.compact,
),
RadioListTile(
value: 2,
title: Text("铺满"),
visualDensity: VisualDensity.compact,
),
RadioListTile(
value: 3,
title: Text("16:9"),
visualDensity: VisualDensity.compact,
),
RadioListTile(
value: 4,
title: Text("4:3"),
visualDensity: VisualDensity.compact,
),
],
),
),
),
);
}
void showDanmuShield() {
TextEditingController keywordController = TextEditingController();
void addKeyword() {
if (keywordController.text.isEmpty) {
SmartDialog.showToast("请输入关键词");
return;
}
AppSettingsController.instance
.addShieldList(keywordController.text.trim());
keywordController.text = "";
}
Utils.showBottomSheet(
title: "关键词屏蔽",
child: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
TextField(
controller: keywordController,
decoration: InputDecoration(
contentPadding: AppStyle.edgeInsetsH12,
border: const OutlineInputBorder(),
hintText: "请输入关键词",
suffixIcon: TextButton.icon(
onPressed: addKeyword,
icon: const Icon(Icons.add),
label: const Text("添加"),
),
),
onSubmitted: (e) {
addKeyword();
},
),
AppStyle.vGap12,
Obx(
() => Text(
"已添加${AppSettingsController.instance.shieldList.length}个关键词(点击移除)",
style: Get.textTheme.titleSmall,
),
),
AppStyle.vGap12,
Obx(
() => Wrap(
runSpacing: 12,
spacing: 12,
children: AppSettingsController.instance.shieldList
.map(
(item) => InkWell(
borderRadius: AppStyle.radius24,
onTap: () {
AppSettingsController.instance.removeShieldList(item);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: AppStyle.radius24,
),
padding: AppStyle.edgeInsetsH12.copyWith(
top: 4,
bottom: 4,
),
child: Text(
item,
style: Get.textTheme.bodyMedium,
),
),
),
)
.toList(),
),
),
],
),
);
}
void showFollowUserSheet() {
Utils.showBottomSheet(
title: "关注列表",
child: Obx(
() => Stack(
children: [
RefreshIndicator(
onRefresh: FollowService.instance.loadData,
child: ListView.builder(
itemCount: FollowService.instance.liveList.length,
itemBuilder: (_, i) {
var item = FollowService.instance.liveList[i];
return Obx(
() => FollowUserItem(
item: item,
playing: rxSite.value.id == item.siteId &&
rxRoomId.value == item.roomId,
onTap: () {
Get.back();
resetRoom(
Sites.allSites[item.siteId]!,
item.roomId,
);
},
),
);
},
),
),
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS)
Positioned(
right: 12,
bottom: 12,
child: Obx(
() => DesktopRefreshButton(
refreshing: FollowService.instance.updating.value,
onPressed: FollowService.instance.loadData,
),
),
),
],
),
),
);
}
void showAutoExitSheet() {
if (AppSettingsController.instance.autoExitEnable.value &&
!delayAutoExit.value) {
SmartDialog.showToast("已设置了全局定时关闭");
return;
}
Utils.showBottomSheet(
title: "定时关闭",
child: ListView(
children: [
Obx(
() => SwitchListTile(
title: Text(
"启用定时关闭",
style: Get.textTheme.titleMedium,
),
value: autoExitEnable.value,
onChanged: (e) {
autoExitEnable.value = e;
setAutoExit();
//controller.setAutoExitEnable(e);
},
),
),
Obx(
() => ListTile(
enabled: autoExitEnable.value,
title: Text(
"自动关闭时间:${autoExitMinutes.value ~/ 60}小时${autoExitMinutes.value % 60}分钟",
style: Get.textTheme.titleMedium,
),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
var value = await showTimePicker(
context: Get.context!,
initialTime: TimeOfDay(
hour: autoExitMinutes.value ~/ 60,
minute: autoExitMinutes.value % 60,
),
initialEntryMode: TimePickerEntryMode.inputOnly,
builder: (_, child) {
return MediaQuery(
data: Get.mediaQuery.copyWith(
alwaysUse24HourFormat: true,
),
child: child!,
);
},
);
if (value == null || (value.hour == 0 && value.minute == 0)) {
return;
}
var duration =
Duration(hours: value.hour, minutes: value.minute);
autoExitMinutes.value = duration.inMinutes;
AppSettingsController.instance
.setRoomAutoExitDuration(autoExitMinutes.value);
//setAutoExitDuration(duration.inMinutes);
setAutoExit();
},
),
),
],
),
);
}
void openNaviteAPP() async {
var naviteUrl = "";
var webUrl = "";
if (site.id == Constant.kBiliBili) {
naviteUrl = "bilibili://live/${detail.value?.roomId}";
webUrl = "https://live.bilibili.com/${detail.value?.roomId}";
} else if (site.id == Constant.kDouyin) {
var args = detail.value?.danmakuData as DouyinDanmakuArgs;
naviteUrl = "snssdk1128://webcast_room?room_id=${args.roomId}";
webUrl = "https://live.douyin.com/${args.webRid}";
} else if (site.id == Constant.kHuya) {
var args = detail.value?.danmakuData as HuyaDanmakuArgs;
naviteUrl =
"yykiwi://homepage/index.html?banneraction=https%3A%2F%2Fdiy-front.cdn.huya.com%2Fzt%2Ffrontpage%2Fcc%2Fupdate.html%3Fhyaction%3Dlive%26channelid%3D${args.subSid}%26subid%3D${args.subSid}%26liveuid%3D${args.subSid}%26screentype%3D1%26sourcetype%3D0%26fromapp%3Dhuya_wap%252Fclick%252Fopen_app_guide%26&fromapp=huya_wap/click/open_app_guide";
webUrl = "https://www.huya.com/${detail.value?.roomId}";
} else if (site.id == Constant.kDouyu) {
naviteUrl =
"douyulink://?type=90001&schemeUrl=douyuapp%3A%2F%2Froom%3FliveType%3D0%26rid%3D${detail.value?.roomId}";
webUrl = "https://www.douyu.com/${detail.value?.roomId}";
}
try {
await launchUrlString(naviteUrl, mode: LaunchMode.externalApplication);
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("无法打开APP,将使用浏览器打开");
await launchUrlString(webUrl, mode: LaunchMode.externalApplication);
}
}
void resetRoom(Site site, String roomId) async {
if (this.site == site && this.roomId == roomId) {
return;
}
rxSite.value = site;
rxRoomId.value = roomId;
// 清除全部消息
liveDanmaku.stop();
messages.clear();
superChats.clear();
danmakuController?.clear();
// 重新设置LiveDanmaku
liveDanmaku = site.liveSite.getDanmaku();
// 停止播放
await player.stop();
// 刷新信息
loadData();
}
void copyErrorDetail() {
Utils.copyToClipboard('''直播平台:${rxSite.value.name}
房间号:${rxRoomId.value}
错误信息:
${error?.toString()}
----------------
${error?.stackTrace}''');
SmartDialog.showToast("已复制错误信息");
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
if (state == AppLifecycleState.paused) {
Log.d("进入后台");
//进入后台,关闭弹幕
danmakuController?.clear();
isBackground = true;
} else
//返回前台
if (state == AppLifecycleState.resumed) {
Log.d("返回前台");
isBackground = false;
}
}
// 用于启动开播时长计算和更新的函数
void startLiveDurationTimer() {
// 如果不是直播状态或者 showTime 为空,则不启动定时器
if (!(detail.value?.status ?? false) || detail.value?.showTime == null) {
liveDuration.value = "00:00:00"; // 未开播时显示 00:00:00
_liveDurationTimer?.cancel();
return;
}
try {
int startTimeStamp = int.parse(detail.value!.showTime!);
// 取消之前的定时器
_liveDurationTimer?.cancel();
// 创建新的定时器,每秒更新一次
_liveDurationTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
int currentTimeStamp = DateTime.now().millisecondsSinceEpoch ~/ 1000;
int durationInSeconds = currentTimeStamp - startTimeStamp;
int hours = durationInSeconds ~/ 3600;
int minutes = (durationInSeconds % 3600) ~/ 60;
int seconds = durationInSeconds % 60;
String formattedDuration =
'${hours.toString().padLeft(2, '0')}:${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
liveDuration.value = formattedDuration;
});
} catch (e) {
liveDuration.value = "--:--:--"; // 错误时显示 --:--:--
}
}
@override
void onClose() {
WidgetsBinding.instance.removeObserver(this);
scrollController.removeListener(scrollListener);
autoExitTimer?.cancel();
liveDanmaku.stop();
danmakuController = null;
_liveDurationTimer?.cancel(); // 页面关闭时取消定时器
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/live_room/live_room_page.dart
================================================
import 'dart:io';
import 'package:floating/floating.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/live_room/live_room_controller.dart';
import 'package:simple_live_app/modules/live_room/player/player_controls.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/desktop_refresh_button.dart';
import 'package:simple_live_app/widgets/follow_user_item.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/net_image.dart';
import 'package:simple_live_app/widgets/settings/settings_action.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_number.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
import 'package:simple_live_app/widgets/superchat_card.dart';
import 'package:simple_live_core/simple_live_core.dart';
class LiveRoomPage extends GetView {
const LiveRoomPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final page = Obx(
() {
if (controller.loadError.value) {
return Scaffold(
appBar: AppBar(
title: const Text("直播间加载失败"),
),
body: Padding(
padding: AppStyle.edgeInsetsA12,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
LottieBuilder.asset(
'assets/lotties/error.json',
height: 140,
repeat: false,
),
const Text(
"直播间加载失败",
textAlign: TextAlign.center,
),
AppStyle.vGap4,
Text(
controller.error?.toString() ?? "未知错误",
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
AppStyle.vGap4,
Text(
"${controller.rxSite.value.id} - ${controller.rxRoomId.value}",
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton.icon(
onPressed: controller.copyErrorDetail,
icon: const Icon(Remix.file_copy_line),
label: const Text("复制信息"),
),
TextButton.icon(
onPressed: controller.refreshRoom,
icon: const Icon(Remix.refresh_line),
label: const Text("刷新"),
),
],
)
],
),
),
);
}
if (controller.fullScreenState.value) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (e, r) {
controller.exitFull();
},
child: Scaffold(
body: buildMediaPlayer(),
),
);
} else {
return buildPageUI();
}
},
);
if (!Platform.isAndroid) {
return page;
}
return PiPSwitcher(
floating: controller.pip,
childWhenDisabled: page,
childWhenEnabled: buildMediaPlayer(),
);
}
Widget buildPageUI() {
return OrientationBuilder(
builder: (context, orientation) {
return Scaffold(
appBar: AppBar(
title: Obx(
() => Text(controller.detail.value?.title ?? "直播间"),
),
actions: buildAppbarActions(context),
),
body: orientation == Orientation.portrait
? buildPhoneUI(context)
: buildTabletUI(context),
);
},
);
}
Widget buildPhoneUI(BuildContext context) {
return Column(
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: buildMediaPlayer(),
),
buildUserProfile(context),
buildMessageArea(),
buildBottomActions(context),
],
);
}
Widget buildTabletUI(BuildContext context) {
return Column(
children: [
Expanded(
child: Row(
children: [
Expanded(
child: buildMediaPlayer(),
),
SizedBox(
width: 300,
child: Column(
children: [
buildUserProfile(context),
buildMessageArea(),
],
),
),
],
),
),
Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
border: Border(
top: BorderSide(
color: Colors.grey.withAlpha(25),
),
),
),
padding: AppStyle.edgeInsetsV4.copyWith(
bottom: AppStyle.bottomBarHeight + 4,
),
child: Row(
children: [
TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.refreshRoom,
icon: const Icon(Remix.refresh_line),
label: const Text("刷新"),
),
AppStyle.hGap4,
Obx(
() => controller.followed.value
? TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.removeFollowUser,
icon: const Icon(Remix.heart_fill),
label: const Text("取消关注"),
)
: TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.followUser,
icon: const Icon(Remix.heart_line),
label: const Text("关注"),
),
),
const Expanded(child: Center()),
TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.share,
icon: const Icon(Remix.share_line),
label: const Text("分享"),
),
TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.copyUrl,
icon: const Icon(Remix.file_copy_line),
label: const Text("复制链接"),
),
TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.copyPlayUrl,
icon: const Icon(Remix.file_copy_line),
label: const Text("复制播放直链"),
),
],
),
),
],
);
}
Widget buildMediaPlayer() {
var boxFit = BoxFit.contain;
double? aspectRatio;
if (AppSettingsController.instance.scaleMode.value == 0) {
boxFit = BoxFit.contain;
} else if (AppSettingsController.instance.scaleMode.value == 1) {
boxFit = BoxFit.fill;
} else if (AppSettingsController.instance.scaleMode.value == 2) {
boxFit = BoxFit.cover;
} else if (AppSettingsController.instance.scaleMode.value == 3) {
boxFit = BoxFit.contain;
aspectRatio = 16 / 9;
} else if (AppSettingsController.instance.scaleMode.value == 4) {
boxFit = BoxFit.contain;
aspectRatio = 4 / 3;
}
return Stack(
children: [
Video(
key: controller.globalPlayerKey,
controller: controller.videoController,
pauseUponEnteringBackgroundMode:
AppSettingsController.instance.playerAutoPause.value,
resumeUponEnteringForegroundMode:
AppSettingsController.instance.playerAutoPause.value,
controls: (state) {
return playerControls(state, controller);
},
aspectRatio: aspectRatio,
fit: boxFit,
// 自己实现
wakelock: false,
),
Obx(
() => Visibility(
visible: !controller.liveStatus.value,
child: const Center(
child: Text(
"未开播",
style: TextStyle(fontSize: 16, color: Colors.white),
),
),
),
),
],
);
}
Widget buildUserProfile(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
border: Border(
top: BorderSide(
color: Colors.grey.withAlpha(25),
),
bottom: BorderSide(
color: Colors.grey.withAlpha(25),
),
),
),
padding: AppStyle.edgeInsetsA8.copyWith(
left: 12,
right: 12,
),
child: Obx(
() => Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.withAlpha(50)),
borderRadius: AppStyle.radius24,
),
child: NetImage(
controller.detail.value?.userAvatar ?? "",
width: 48,
height: 48,
borderRadius: 24,
),
),
AppStyle.hGap12,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
controller.detail.value?.userName ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
AppStyle.vGap4,
Row(
children: [
Image.asset(
controller.site.logo,
width: 20,
),
AppStyle.hGap4,
Text(
controller.site.name,
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
],
),
],
),
),
AppStyle.hGap12,
Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Remix.fire_fill,
size: 20,
color: Colors.orange,
),
AppStyle.hGap4,
Text(
Utils.onlineToString(
controller.detail.value?.online ?? 0,
),
style: const TextStyle(fontSize: 14),
),
],
),
],
),
),
);
}
Widget buildBottomActions(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
border: Border(
top: BorderSide(
color: Colors.grey.withAlpha(25),
),
),
),
padding: EdgeInsets.only(bottom: AppStyle.bottomBarHeight),
child: Row(
children: [
Expanded(
child: Obx(
() => controller.followed.value
? TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.removeFollowUser,
icon: const Icon(Remix.heart_fill),
label: const Text("取消关注"),
)
: TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.followUser,
icon: const Icon(Remix.heart_line),
label: const Text("关注"),
),
),
),
Expanded(
child: TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.refreshRoom,
icon: const Icon(Remix.refresh_line),
label: const Text("刷新"),
),
),
Expanded(
child: TextButton.icon(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 14),
),
onPressed: controller.share,
icon: const Icon(Remix.share_line),
label: const Text("分享"),
),
),
],
),
);
}
Widget buildMessageArea() {
return Expanded(
child: DefaultTabController(
length: controller.site.id == Constant.kBiliBili ? 4 : 3,
child: Column(
children: [
TabBar(
indicatorSize: TabBarIndicatorSize.tab,
labelPadding: EdgeInsets.zero,
indicatorWeight: 1.0,
tabs: [
const Tab(
text: "聊天",
),
if (controller.site.id == Constant.kBiliBili)
Tab(
child: Obx(
() => Text(
controller.superChats.isNotEmpty
? "SC(${controller.superChats.length})"
: "SC",
),
),
),
const Tab(
text: "关注",
),
const Tab(
text: "设置",
),
],
),
Expanded(
child: TabBarView(
children: [
Obx(
() => Stack(
children: [
ListView.separated(
controller: controller.scrollController,
separatorBuilder: (_, i) => Obx(
() => SizedBox(
// *2与原来的EdgeInsets.symmetric(vertical: )做兼容
height: AppSettingsController
.instance.chatTextGap.value *
2,
),
),
padding: AppStyle.edgeInsetsA12,
itemCount: controller.messages.length,
itemBuilder: (_, i) {
var item = controller.messages[i];
return buildMessageItem(item);
},
),
Visibility(
visible: controller.disableAutoScroll.value,
child: Positioned(
right: 12,
bottom: 12,
child: ElevatedButton.icon(
onPressed: () {
controller.disableAutoScroll.value = false;
controller.chatScrollToBottom();
},
icon: const Icon(Icons.expand_more),
label: const Text("最新"),
),
),
),
],
),
),
if (controller.site.id == Constant.kBiliBili)
buildSuperChats(),
buildFollowList(),
buildSettings(),
],
),
),
],
),
),
);
}
Widget buildMessageItem(LiveMessage message) {
if (message.userName == "LiveSysMessage") {
return Obx(
() => Text(
message.message,
style: TextStyle(
color: Colors.grey,
fontSize: AppSettingsController.instance.chatTextSize.value,
),
),
);
}
return Obx(
() => AppSettingsController.instance.chatBubbleStyle.value
? Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey.withAlpha(25),
//borderRadius: AppStyle.radius8,
borderRadius: const BorderRadius.only(
topRight: Radius.circular(12),
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
),
padding:
AppStyle.edgeInsetsA4.copyWith(left: 12, right: 12),
child: Text.rich(
TextSpan(
text: "${message.userName}:",
style: TextStyle(
color: Colors.grey,
fontSize:
AppSettingsController.instance.chatTextSize.value,
),
children: [
TextSpan(
text: message.message,
style: TextStyle(
color: Get.isDarkMode
? Colors.white
: AppColors.black333,
),
)
],
),
),
),
),
],
)
: Text.rich(
TextSpan(
text: "${message.userName}:",
style: TextStyle(
color: Colors.grey,
fontSize: AppSettingsController.instance.chatTextSize.value,
),
children: [
TextSpan(
text: message.message,
style: TextStyle(
color: Get.isDarkMode ? Colors.white : AppColors.black333,
),
)
],
),
),
);
}
Widget buildSuperChats() {
return KeepAliveWrapper(
child: Obx(
() => ListView.separated(
padding: AppStyle.edgeInsetsA12,
itemCount: controller.superChats.length,
separatorBuilder: (_, i) => AppStyle.vGap12,
itemBuilder: (_, i) {
var item = controller.superChats[i];
return SuperChatCard(
item,
onExpire: () {
controller.removeSuperChats();
},
);
},
),
),
);
}
Widget buildSettings() {
return ListView(
padding: AppStyle.edgeInsetsA12,
children: [
Obx(
() => Visibility(
visible: controller.autoExitEnable.value,
child: ListTile(
leading: const Icon(Icons.timer_outlined),
visualDensity: VisualDensity.compact,
title: Text("${parseDuration(controller.countdown.value)}后自动关闭"),
),
),
),
Padding(
padding: AppStyle.edgeInsetsA12,
child: Text(
"聊天区",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => SettingsNumber(
title: "文字大小",
value:
AppSettingsController.instance.chatTextSize.value.toInt(),
min: 8,
max: 36,
onChanged: (e) {
AppSettingsController.instance
.setChatTextSize(e.toDouble());
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "上下间隔",
value:
AppSettingsController.instance.chatTextGap.value.toInt(),
min: 0,
max: 12,
onChanged: (e) {
AppSettingsController.instance.setChatTextGap(e.toDouble());
},
),
),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "气泡样式",
value: AppSettingsController.instance.chatBubbleStyle.value,
onChanged: (e) {
AppSettingsController.instance.setChatBubbleStyle(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "播放器中显示SC",
value:
AppSettingsController.instance.playershowSuperChat.value,
onChanged: (e) {
AppSettingsController.instance.setPlayerShowSuperChat(e);
},
),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12,
child: Text(
"更多设置",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SettingsAction(
title: "关键词屏蔽",
onTap: controller.showDanmuShield,
),
AppStyle.divider,
SettingsAction(
title: "弹幕设置",
onTap: controller.showDanmuSettingsSheet,
),
AppStyle.divider,
SettingsAction(
title: "定时关闭",
onTap: controller.showAutoExitSheet,
),
AppStyle.divider,
SettingsAction(
title: "画面尺寸",
onTap: controller.showPlayerSettingsSheet,
),
],
),
),
],
);
}
Widget buildFollowList() {
return Obx(
() => Stack(
children: [
RefreshIndicator(
onRefresh: FollowService.instance.loadData,
child: ListView.builder(
itemCount: FollowService.instance.liveList.length,
itemBuilder: (_, i) {
var item = FollowService.instance.liveList[i];
return Obx(
() => FollowUserItem(
item: item,
playing: controller.rxSite.value.id == item.siteId &&
controller.rxRoomId.value == item.roomId,
onTap: () {
controller.resetRoom(
Sites.allSites[item.siteId]!,
item.roomId,
);
},
),
);
},
),
),
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS)
Positioned(
right: 12,
bottom: 12,
child: Obx(
() => DesktopRefreshButton(
refreshing: FollowService.instance.updating.value,
onPressed: FollowService.instance.loadData,
),
),
),
],
),
);
}
List buildAppbarActions(BuildContext context) {
return [
IconButton(
onPressed: () {
showMore();
},
icon: const Icon(Icons.more_horiz),
),
];
}
void showMore() {
showModalBottomSheet(
context: Get.context!,
constraints: const BoxConstraints(
maxWidth: 600,
),
isScrollControlled: true,
builder: (_) => Container(
padding: EdgeInsets.only(
bottom: AppStyle.bottomBarHeight,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.refresh),
title: const Text("刷新"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.refreshRoom();
},
),
ListTile(
leading: const Icon(Icons.play_circle_outline),
trailing: const Icon(Icons.chevron_right),
title: const Text("切换清晰度"),
onTap: () {
Get.back();
controller.showQualitySheet();
},
),
ListTile(
leading: const Icon(Icons.switch_video_outlined),
title: const Text("切换线路"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.showPlayUrlsSheet();
},
),
ListTile(
leading: const Icon(Icons.aspect_ratio_outlined),
title: const Text("画面尺寸"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.showPlayerSettingsSheet();
},
),
ListTile(
leading: const Icon(Icons.camera_alt_outlined),
title: const Text("截图"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.saveScreenshot();
},
),
Visibility(
visible: Platform.isAndroid,
child: ListTile(
leading: const Icon(Icons.picture_in_picture),
title: const Text("小窗播放"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.enablePIP();
},
),
),
ListTile(
leading: const Icon(Icons.timer_outlined),
title: const Text("定时关闭"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.showAutoExitSheet();
},
),
ListTile(
leading: const Icon(Icons.share_sharp),
title: const Text("分享直播间"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.share();
},
),
ListTile(
leading: const Icon(Icons.copy),
title: const Text("复制链接"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.copyUrl();
},
),
ListTile(
leading: const Icon(Icons.open_in_new),
title: const Text("APP中打开"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.openNaviteAPP();
},
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),
title: const Text("播放信息"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
controller.showDebugInfo();
},
),
],
),
),
);
}
String parseDuration(int sec) {
// 转为时分秒
var h = sec ~/ 3600;
var m = (sec % 3600) ~/ 60;
var s = sec % 60;
if (h > 0) {
return "${h.toString().padLeft(2, '0')}小时${m.toString().padLeft(2, '0')}分钟${s.toString().padLeft(2, '0')}秒";
}
if (m > 0) {
return "${m.toString().padLeft(2, '0')}分钟${s.toString().padLeft(2, '0')}秒";
}
return "${s.toString().padLeft(2, '0')}秒";
}
}
================================================
FILE: simple_live_app/lib/modules/live_room/player/player_controller.dart
================================================
import 'dart:async';
import 'dart:io';
import 'package:auto_orientation_v2/auto_orientation_v2.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:file_picker/file_picker.dart';
import 'package:floating/floating.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:image_gallery_saver_plus/image_gallery_saver_plus.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:volume_controller/volume_controller.dart';
import 'package:screen_brightness/screen_brightness.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/custom_throttle.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:window_manager/window_manager.dart';
mixin PlayerMixin {
GlobalKey globalPlayerKey = GlobalKey();
GlobalKey globalDanmuKey = GlobalKey();
/// 播放器实例
late final player = Player(
configuration: PlayerConfiguration(
title: "Simple Live Player",
logLevel: AppSettingsController.instance.logEnable.value
? MPVLogLevel.info
: MPVLogLevel.error,
),
);
/// 初始化播放器并设置 ao 参数
Future initializePlayer() async {
var pp = player.platform as NativePlayer;
// 设置音频输出驱动
if (AppSettingsController.instance.customPlayerOutput.value) {
if (player.platform is NativePlayer) {
await (player.platform as dynamic).setProperty(
'ao',
AppSettingsController.instance.audioOutputDriver.value,
);
}
}
// media_kit 仓库更新导致的问题,临时解决办法
if(Platform.isAndroid){
await pp.setProperty('force-seekable', 'yes');
}
}
/// 视频控制器
late final videoController = VideoController(
player,
configuration: AppSettingsController.instance.customPlayerOutput.value
? VideoControllerConfiguration(
vo: AppSettingsController.instance.videoOutputDriver.value,
hwdec: AppSettingsController.instance.videoHardwareDecoder.value,
)
: AppSettingsController.instance.playerCompatMode.value
? const VideoControllerConfiguration(
vo: 'mediacodec_embed',
hwdec: 'mediacodec',
)
: VideoControllerConfiguration(
enableHardwareAcceleration:
AppSettingsController.instance.hardwareDecode.value,
androidAttachSurfaceAfterVideoParameters: false,
),
);
}
mixin PlayerStateMixin on PlayerMixin {
///音量控制条计时器
Timer? hidevolumeTimer;
/// 是否进入桌面端小窗
RxBool smallWindowState = false.obs;
/// 是否显示弹幕
RxBool showDanmakuState = false.obs;
/// 是否显示控制器
RxBool showControlsState = false.obs;
/// 是否显示设置窗口
RxBool showSettingState = false.obs;
/// 是否显示弹幕设置窗口
RxBool showDanmakuSettingState = false.obs;
/// 是否处于锁定控制器状态
RxBool lockControlsState = false.obs;
/// 是否处于全屏状态
RxBool fullScreenState = false.obs;
/// 显示手势Tip
RxBool showGestureTip = false.obs;
/// 手势Tip文本
RxString gestureTipText = "".obs;
/// 显示提示底部Tip
RxBool showBottomTip = false.obs;
/// 提示底部Tip文本
RxString bottomTipText = "".obs;
/// 自动隐藏控制器计时器
Timer? hideControlsTimer;
/// 自动隐藏提示计时器
Timer? hideSeekTipTimer;
/// 是否为竖屏直播间
var isVertical = false.obs;
Widget? danmakuView;
var showQualites = false.obs;
var showLines = false.obs;
/// 隐藏控制器
void hideControls() {
showControlsState.value = false;
hideControlsTimer?.cancel();
}
void setLockState() {
lockControlsState.value = !lockControlsState.value;
if (lockControlsState.value) {
showControlsState.value = false;
} else {
showControlsState.value = true;
}
}
/// 显示控制器
void showControls() {
showControlsState.value = true;
resetHideControlsTimer();
}
/// 开始隐藏控制器计时
/// - 当点击控制器上时功能时需要重新计时
void resetHideControlsTimer() {
hideControlsTimer?.cancel();
hideControlsTimer = Timer(
const Duration(
seconds: 5,
),
hideControls,
);
}
void updateScaleMode() {
var boxFit = BoxFit.contain;
double? aspectRatio;
if (player.state.width != null && player.state.height != null) {
aspectRatio = player.state.width! / player.state.height!;
}
if (AppSettingsController.instance.scaleMode.value == 0) {
boxFit = BoxFit.contain;
} else if (AppSettingsController.instance.scaleMode.value == 1) {
boxFit = BoxFit.fill;
} else if (AppSettingsController.instance.scaleMode.value == 2) {
boxFit = BoxFit.cover;
} else if (AppSettingsController.instance.scaleMode.value == 3) {
boxFit = BoxFit.contain;
aspectRatio = 16 / 9;
} else if (AppSettingsController.instance.scaleMode.value == 4) {
boxFit = BoxFit.contain;
aspectRatio = 4 / 3;
}
globalPlayerKey.currentState?.update(
aspectRatio: aspectRatio,
fit: boxFit,
);
}
}
mixin PlayerDanmakuMixin on PlayerStateMixin {
/// 弹幕控制器
DanmakuController? danmakuController;
void initDanmakuController(DanmakuController e) {
danmakuController = e;
// danmakuController?.updateOption(
// DanmakuOption(
// fontSize: AppSettingsController.instance.danmuSize.value,
// area: AppSettingsController.instance.danmuArea.value,
// duration: AppSettingsController.instance.danmuSpeed.value,
// opacity: AppSettingsController.instance.danmuOpacity.value,
// strokeWidth: AppSettingsController.instance.danmuStrokeWidth.value,
// fontWeight: FontWeight
// .values[AppSettingsController.instance.danmuFontWeight.value],
// ),
// );
}
void updateDanmuOption(DanmakuOption? option) {
if (danmakuController == null || option == null) return;
danmakuController!.updateOption(option);
}
void disposeDanmakuController() {
danmakuController?.clear();
}
void addDanmaku(List items) {
if (!showDanmakuState.value) {
return;
}
for (var item in items) {
danmakuController?.addDanmaku(item);
}
}
}
mixin PlayerSystemMixin on PlayerMixin, PlayerStateMixin, PlayerDanmakuMixin {
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
final pip = Floating();
StreamSubscription? _pipSubscription;
//final VolumeController volumeController = VolumeController();
/// 初始化一些系统状态
void initSystem() async {
if (Platform.isAndroid || Platform.isIOS) {
VolumeController.instance.showSystemUI = false;
}
// 屏幕常亮
//WakelockPlus.enable();
// 开始隐藏计时
resetHideControlsTimer();
// 进入全屏模式
if (AppSettingsController.instance.autoFullScreen.value) {
enterFullScreen();
}
}
/// 释放一些系统状态
Future resetSystem() async {
_pipSubscription?.cancel();
//pip.dispose();
await SystemChrome.setEnabledSystemUIMode(
SystemUiMode.edgeToEdge,
overlays: SystemUiOverlay.values,
);
await setPortraitOrientation();
if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
// 亮度重置,桌面平台可能会报错,暂时不处理桌面平台的亮度
try {
await ScreenBrightness.instance.resetApplicationScreenBrightness();
} catch (e) {
Log.logPrint(e);
}
}
await WakelockPlus.disable();
}
/// 进入全屏
void enterFullScreen() {
fullScreenState.value = true;
if (Platform.isAndroid || Platform.isIOS) {
//全屏
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
if (!isVertical.value) {
//横屏
setLandscapeOrientation();
}
} else {
windowManager.setFullScreen(true);
}
//danmakuController?.clear();
}
/// 退出全屏
void exitFull() {
if (Platform.isAndroid || Platform.isIOS) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge,
overlays: SystemUiOverlay.values);
setPortraitOrientation();
} else {
windowManager.setFullScreen(false);
}
fullScreenState.value = false;
//danmakuController?.clear();
}
Size? _lastWindowSize;
Offset? _lastWindowPosition;
///小窗模式()
void enterSmallWindow() async {
if (!(Platform.isAndroid || Platform.isIOS)) {
fullScreenState.value = true;
smallWindowState.value = true;
// 读取窗口大小
_lastWindowSize = await windowManager.getSize();
_lastWindowPosition = await windowManager.getPosition();
windowManager.setTitleBarStyle(TitleBarStyle.hidden);
// 获取视频窗口大小
var width = player.state.width ?? 16;
var height = player.state.height ?? 9;
// 横屏还是竖屏
if (height > width) {
var aspectRatio = width / height;
windowManager.setSize(Size(400, 400 / aspectRatio));
} else {
var aspectRatio = height / width;
windowManager.setSize(Size(280 / aspectRatio, 280));
}
windowManager.setAlwaysOnTop(true);
}
}
///退出小窗模式()
void exitSmallWindow() {
if (!(Platform.isAndroid || Platform.isIOS)) {
fullScreenState.value = false;
smallWindowState.value = false;
windowManager.setTitleBarStyle(TitleBarStyle.normal);
windowManager.setSize(_lastWindowSize!);
windowManager.setPosition(_lastWindowPosition!);
windowManager.setAlwaysOnTop(false);
//windowManager.setAlignment(Alignment.center);
}
}
/// 设置横屏
Future setLandscapeOrientation() async {
if (await beforeIOS16()) {
AutoOrientation.landscapeAutoMode();
} else {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
}
}
/// 设置竖屏
Future setPortraitOrientation() async {
if (await beforeIOS16()) {
AutoOrientation.portraitAutoMode();
} else {
await SystemChrome.setPreferredOrientations(DeviceOrientation.values);
}
}
/// 是否是IOS16以下
Future beforeIOS16() async {
if (Platform.isIOS) {
var info = await deviceInfo.iosInfo;
var version = info.systemVersion;
var versionInt = int.tryParse(version.split('.').first) ?? 0;
return versionInt < 16;
} else {
return false;
}
}
Future saveScreenshot() async {
try {
SmartDialog.showLoading(msg: "正在保存截图");
//检查相册权限,仅iOS需要
var permission = await Utils.checkPhotoPermission();
if (!permission) {
SmartDialog.showToast("没有相册权限");
SmartDialog.dismiss(status: SmartStatus.loading);
return;
}
var imageData = await player.screenshot();
if (imageData == null) {
SmartDialog.showToast("截图失败,数据为空");
SmartDialog.dismiss(status: SmartStatus.loading);
return;
}
if (Platform.isIOS || Platform.isAndroid) {
await ImageGallerySaverPlus.saveImage(
imageData,
);
SmartDialog.showToast("已保存截图至相册");
} else {
//选择保存文件夹
var path = await FilePicker.platform.saveFile(
allowedExtensions: ["jpg"],
type: FileType.image,
fileName: "${DateTime.now().millisecondsSinceEpoch}.jpg",
);
if (path == null) {
SmartDialog.showToast("取消保存");
SmartDialog.dismiss(status: SmartStatus.loading);
return;
}
var file = File(path);
await file.writeAsBytes(imageData);
SmartDialog.showToast("已保存截图至${file.path}");
}
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("截图失败");
} finally {
SmartDialog.dismiss(status: SmartStatus.loading);
}
}
/// 开启小窗播放前弹幕状态
bool danmakuStateBeforePIP = false;
Future enablePIP() async {
if (!Platform.isAndroid) {
return;
}
if (await pip.isPipAvailable == false) {
SmartDialog.showToast("设备不支持小窗播放");
return;
}
danmakuStateBeforePIP = showDanmakuState.value;
//关闭并清除弹幕
if (AppSettingsController.instance.pipHideDanmu.value &&
danmakuStateBeforePIP) {
showDanmakuState.value = false;
}
danmakuController?.clear();
//关闭控制器
showControlsState.value = false;
//监听事件
var width = player.state.width ?? 0;
var height = player.state.height ?? 0;
Rational ratio = const Rational.landscape();
if (height > width) {
ratio = const Rational.vertical();
} else {
ratio = const Rational.landscape();
}
await pip.enable(
ImmediatePiP(
aspectRatio: ratio,
),
);
_pipSubscription ??= pip.pipStatusStream.listen((event) {
if (event == PiPStatus.disabled) {
danmakuController?.clear();
showDanmakuState.value = danmakuStateBeforePIP;
}
Log.w(event.toString());
});
}
}
mixin PlayerGestureControlMixin
on PlayerStateMixin, PlayerMixin, PlayerSystemMixin {
/// 单击显示/隐藏控制器
void onTap() {
if (showControlsState.value) {
hideControls();
} else {
showControls();
}
}
//桌面端操控
void onEnter(PointerEnterEvent event) {
if (!showControlsState.value) {
showControls();
}
}
void onExit(PointerExitEvent event) {
if (showControlsState.value) {
hideControls();
}
}
void onHover(PointerHoverEvent event, BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final targetPosition = screenHeight * 0.25; // 计算屏幕顶部25%的位置
if (event.position.dy <= targetPosition ||
event.position.dy >= targetPosition * 3) {
if (!showControlsState.value) {
showControls();
}
}
}
/// 双击全屏/退出全屏
void onDoubleTap(TapDownDetails details) {
if (lockControlsState.value) {
return;
}
if (fullScreenState.value) {
exitFull();
} else {
enterFullScreen();
}
}
bool verticalDragging = false;
bool leftVerticalDrag = false;
var _currentVolume = 0.0;
var _currentBrightness = 1.0;
var verStartPosition = 0.0;
DelayedThrottle? throttle;
/// 竖向手势开始
void onVerticalDragStart(DragStartDetails details) async {
if (lockControlsState.value && fullScreenState.value) {
return;
}
final dy = details.globalPosition.dy;
// 开始位置必须是中间2/4的位置
if (dy < Get.height * 0.25 || dy > Get.height * 0.75) {
return;
}
verStartPosition = dy;
leftVerticalDrag = details.globalPosition.dx < Get.width / 2;
throttle = DelayedThrottle(200);
verticalDragging = true;
if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
showGestureTip.value = true;
}
if (Platform.isAndroid || Platform.isIOS) {
_currentVolume = await VolumeController.instance.getVolume();
}
if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
_currentBrightness = await ScreenBrightness.instance.application;
}
}
/// 竖向手势更新
void onVerticalDragUpdate(DragUpdateDetails e) async {
if (lockControlsState.value && fullScreenState.value) {
return;
}
if (verticalDragging == false) return;
if (!Platform.isAndroid && !Platform.isIOS) {
return;
}
//String text = "";
//double value = 0.0;
Log.logPrint("$verStartPosition/${e.globalPosition.dy}");
if (leftVerticalDrag) {
setGestureBrightness(e.globalPosition.dy);
} else {
setGestureVolume(e.globalPosition.dy);
}
}
int lastVolume = -1; // it's ok to be -1
void setGestureVolume(double dy) {
double value = 0.0;
double seek;
if (dy > verStartPosition) {
value = ((dy - verStartPosition) / (Get.height * 0.5));
seek = _currentVolume - value;
if (seek < 0) {
seek = 0;
}
} else {
value = ((dy - verStartPosition) / (Get.height * 0.5));
seek = value.abs() + _currentVolume;
if (seek > 1) {
seek = 1;
}
}
int volume = _convertVolume((seek * 100).round());
if (volume == lastVolume) {
return;
}
lastVolume = volume;
// update UI outside throttle to make it more fluent
gestureTipText.value = "音量 $volume%";
throttle?.invoke(() async => await _realSetVolume(volume));
}
// 0 to 100, 5 step each
int _convertVolume(int volume) {
return (volume / 5).round() * 5;
}
Future _realSetVolume(int volume) async {
Log.logPrint(volume);
VolumeController.instance.setVolume(volume / 100);
}
void setGestureBrightness(double dy) {
double value = 0.0;
if (dy > verStartPosition) {
value = ((dy - verStartPosition) / (Get.height * 0.5));
var seek = _currentBrightness - value;
if (seek < 0) {
seek = 0;
}
ScreenBrightness.instance.setApplicationScreenBrightness(seek);
gestureTipText.value = "亮度 ${(seek * 100).toInt()}%";
Log.logPrint(value);
} else {
value = ((dy - verStartPosition) / (Get.height * 0.5));
var seek = value.abs() + _currentBrightness;
if (seek > 1) {
seek = 1;
}
ScreenBrightness.instance.setApplicationScreenBrightness(seek);
gestureTipText.value = "亮度 ${(seek * 100).toInt()}%";
Log.logPrint(value);
}
}
/// 竖向手势完成
void onVerticalDragEnd(DragEndDetails details) async {
if (lockControlsState.value && fullScreenState.value) {
return;
}
throttle = null;
verticalDragging = false;
leftVerticalDrag = false;
showGestureTip.value = false;
}
}
class PlayerController extends BaseController
with
PlayerMixin,
PlayerStateMixin,
PlayerDanmakuMixin,
PlayerSystemMixin,
PlayerGestureControlMixin {
@override
void onInit() {
initSystem();
initStream();
//设置音量
player.setVolume(AppSettingsController.instance.playerVolume.value);
super.onInit();
}
StreamSubscription? _errorSubscription;
StreamSubscription? _completedSubscription;
StreamSubscription? _widthSubscription;
StreamSubscription? _heightSubscription;
StreamSubscription? _logSubscription;
StreamSubscription? _playingSubscription;
void initStream() {
_errorSubscription = player.stream.error.listen((event) {
Log.d("播放器错误:$event");
// 跳过无音频输出的错误
// Could not open/initialize audio device -> no sound.
if (event.contains('no sound.')) {
return;
}
//SmartDialog.showToast(event);
mediaError(event);
});
_playingSubscription = player.stream.playing.listen((event) {
if (event) {
WakelockPlus.enable();
Log.d("Playing");
}
});
_completedSubscription = player.stream.completed.listen((event) {
if (event) {
mediaEnd();
}
});
_logSubscription = player.stream.log.listen((event) {
Log.d("播放器日志:$event");
});
_widthSubscription = player.stream.width.listen((event) {
Log.d(
'width:$event W:${(player.state.width)} H:${(player.state.height)}');
isVertical.value =
(player.state.height ?? 9) > (player.state.width ?? 16);
});
_heightSubscription = player.stream.height.listen((event) {
Log.d(
'height:$event W:${(player.state.width)} H:${(player.state.height)}');
isVertical.value =
(player.state.height ?? 9) > (player.state.width ?? 16);
});
}
void disposeStream() {
_errorSubscription?.cancel();
_completedSubscription?.cancel();
_widthSubscription?.cancel();
_heightSubscription?.cancel();
_logSubscription?.cancel();
_pipSubscription?.cancel();
_playingSubscription?.cancel();
}
void mediaEnd() {
WakelockPlus.disable();
}
void mediaError(String error) {
WakelockPlus.disable();
}
void showDebugInfo() {
Utils.showBottomSheet(
title: "播放信息",
child: ListView(
children: [
ListTile(
title: const Text("Resolution"),
subtitle: Text('${player.state.width}x${player.state.height}'),
onTap: () {
Clipboard.setData(
ClipboardData(
text:
"Resolution\n${player.state.width}x${player.state.height}",
),
);
},
),
ListTile(
title: const Text("VideoParams"),
subtitle: Text(player.state.videoParams.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "VideoParams\n${player.state.videoParams}",
),
);
},
),
ListTile(
title: const Text("AudioParams"),
subtitle: Text(player.state.audioParams.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "AudioParams\n${player.state.audioParams}",
),
);
},
),
ListTile(
title: const Text("Media"),
subtitle: Text(player.state.playlist.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "Media\n${player.state.playlist}",
),
);
},
),
ListTile(
title: const Text("AudioTrack"),
subtitle: Text(player.state.track.audio.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "AudioTrack\n${player.state.track.audio}",
),
);
},
),
ListTile(
title: const Text("VideoTrack"),
subtitle: Text(player.state.track.video.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "VideoTrack\n${player.state.track.audio}",
),
);
},
),
ListTile(
title: const Text("AudioBitrate"),
subtitle: Text(player.state.audioBitrate.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "AudioBitrate\n${player.state.audioBitrate}",
),
);
},
),
ListTile(
title: const Text("Volume"),
subtitle: Text(player.state.volume.toString()),
onTap: () {
Clipboard.setData(
ClipboardData(
text: "Volume\n${player.state.volume}",
),
);
},
),
],
),
);
}
@override
void onClose() async {
Log.w("播放器关闭");
if (smallWindowState.value) {
exitSmallWindow();
}
disposeStream();
disposeDanmakuController();
await resetSystem();
await player.dispose();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/live_room/player/player_controls.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/live_room/live_room_controller.dart';
import 'package:simple_live_app/modules/settings/danmu_settings_page.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/desktop_refresh_button.dart';
import 'package:simple_live_app/widgets/follow_user_item.dart';
import 'package:window_manager/window_manager.dart';
import 'package:simple_live_app/widgets/superchat_card.dart';
import 'dart:async';
import 'package:simple_live_core/simple_live_core.dart';
Widget playerControls(
VideoState videoState,
LiveRoomController controller,
) {
return Obx(() {
if (controller.fullScreenState.value) {
return buildFullControls(
videoState,
controller,
);
}
return buildControls(
videoState.context.orientation == Orientation.portrait,
videoState,
controller,
);
});
}
Widget buildFullControls(
VideoState videoState,
LiveRoomController controller,
) {
var padding = MediaQuery.of(videoState.context).padding;
GlobalKey volumeButtonkey = GlobalKey();
return DragToMoveArea(
child: Stack(
children: [
Container(),
buildDanmuView(videoState, controller),
// 左下角SC显示
Obx(
() => Visibility(
visible: AppSettingsController.instance.playershowSuperChat.value &&
((!Platform.isAndroid && !Platform.isIOS) ||
controller.fullScreenState.value),
child: Positioned(
left: 24,
bottom: 24,
child: PlayerSuperChatOverlay(controller: controller),
),
),
),
Center(
child: // 中间
StreamBuilder(
stream: videoState.widget.controller.player.stream.buffering,
initialData: videoState.widget.controller.player.state.buffering,
builder: (_, s) => Visibility(
visible: s.data ?? false,
child: const Center(
child: CircularProgressIndicator(),
),
),
),
),
Positioned.fill(
child: GestureDetector(
onTap: controller.onTap,
onDoubleTapDown: controller.onDoubleTap,
onLongPress: () {
if (controller.lockControlsState.value) {
return;
}
showFollowUser(controller);
},
onVerticalDragStart: controller.onVerticalDragStart,
onVerticalDragUpdate: controller.onVerticalDragUpdate,
onVerticalDragEnd: controller.onVerticalDragEnd,
child: MouseRegion(
onHover: (PointerHoverEvent event) {
controller.onHover(event, videoState.context);
},
child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.transparent,
// child: Visibility(
// //拖拽区域
// visible: controller.smallWindowState.value,
// child: DragToMoveArea(
// child: Container(
// width: double.infinity,
// height: double.infinity,
// color: Colors.transparent,
// )),
// ),
),
),
),
),
// 顶部
Obx(
() => AnimatedPositioned(
left: 0,
right: 0,
top: (controller.showControlsState.value &&
!controller.lockControlsState.value)
? 0
: -(48 + padding.top),
duration: const Duration(milliseconds: 200),
child: Container(
height: 48 + padding.top,
padding: EdgeInsets.only(
left: padding.left + 12,
right: padding.right + 12,
top: padding.top,
),
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Colors.transparent,
Colors.black87,
],
),
),
child: Row(
children: [
IconButton(
onPressed: () {
if (controller.smallWindowState.value) {
controller.exitSmallWindow();
} else {
controller.exitFull();
}
},
icon: const Icon(
Icons.arrow_back,
color: Colors.white,
size: 24,
),
),
AppStyle.hGap12,
Expanded(
child: Text(
"${controller.detail.value?.title} - ${controller.detail.value?.userName}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 16),
),
),
AppStyle.hGap12,
IconButton(
onPressed: () {
controller.saveScreenshot();
},
icon: const Icon(
Icons.camera_alt_outlined,
color: Colors.white,
size: 24,
),
),
IconButton(
onPressed: () {
showFollowUser(controller);
},
icon: const Icon(
Remix.play_list_2_line,
color: Colors.white,
size: 24,
),
),
Visibility(
visible: Platform.isAndroid,
child: IconButton(
onPressed: () {
controller.enablePIP();
},
icon: const Icon(
Icons.picture_in_picture,
color: Colors.white,
size: 24,
),
),
),
IconButton(
onPressed: () {
showPlayerSettings(controller);
},
icon: const Icon(
Icons.more_horiz,
color: Colors.white,
size: 24,
),
),
],
),
),
),
),
// 底部
Obx(
() => AnimatedPositioned(
left: 0,
right: 0,
bottom: (controller.showControlsState.value &&
!controller.lockControlsState.value)
? 0
: -(80 + padding.bottom),
duration: const Duration(milliseconds: 200),
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black87,
],
),
),
padding: EdgeInsets.only(
left: padding.left + 12,
right: padding.right + 12,
bottom: padding.bottom,
),
child: Row(
children: [
IconButton(
onPressed: () {
controller.refreshRoom();
},
icon: const Icon(
Remix.refresh_line,
color: Colors.white,
),
),
Offstage(
offstage: controller.showDanmakuState.value,
child: IconButton(
onPressed: () => controller.showDanmakuState.value =
!controller.showDanmakuState.value,
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_open.png'),
size: 24,
color: Colors.white,
),
),
),
Offstage(
offstage: !controller.showDanmakuState.value,
child: IconButton(
onPressed: () => controller.showDanmakuState.value =
!controller.showDanmakuState.value,
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_close.png'),
size: 24,
color: Colors.white,
),
),
),
IconButton(
onPressed: () {
showDanmakuSettings(controller);
},
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_setting.png'),
size: 24,
color: Colors.white,
),
),
Obx(
() => Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
controller.liveDuration.value,
style:
const TextStyle(fontSize: 14, color: Colors.white),
),
),
),
const Expanded(child: Center()),
Visibility(
visible: !Platform.isAndroid && !Platform.isIOS,
child: IconButton(
key: volumeButtonkey,
onPressed: () {
controller
.showVolumeSlider(volumeButtonkey.currentContext!);
},
icon: const Icon(
Icons.volume_down,
size: 24,
color: Colors.white,
),
),
),
TextButton(
onPressed: () {
showQualitesInfo(controller);
},
child: Obx(
() => Text(
controller.currentQualityInfo.value,
style:
const TextStyle(color: Colors.white, fontSize: 15),
),
),
),
TextButton(
onPressed: () {
showLinesInfo(controller);
},
child: Text(
controller.currentLineInfo.value,
style: const TextStyle(color: Colors.white, fontSize: 15),
),
),
IconButton(
onPressed: () {
if (controller.smallWindowState.value) {
controller.exitSmallWindow();
} else {
controller.exitFull();
}
},
icon: const Icon(
Remix.fullscreen_exit_fill,
color: Colors.white,
),
),
],
),
),
),
),
// 右侧锁定
Obx(
() => AnimatedPositioned(
top: 0,
bottom: 0,
right: controller.showControlsState.value
? padding.right + 12
: -(64 + padding.right),
duration: const Duration(milliseconds: 200),
child: buildLockButton(controller),
),
),
// 左侧锁定
Obx(
() => AnimatedPositioned(
top: 0,
bottom: 0,
left: controller.showControlsState.value
? padding.left + 12
: -(64 + padding.right),
duration: const Duration(milliseconds: 200),
child: buildLockButton(controller),
),
),
Obx(
() => Offstage(
offstage: !controller.showGestureTip.value,
child: Center(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey.shade900,
borderRadius: BorderRadius.circular(12),
),
child: Text(
controller.gestureTipText.value,
style: const TextStyle(fontSize: 18, color: Colors.white),
),
),
),
),
),
],
),
);
}
Widget buildLockButton(LiveRoomController controller) {
return Center(
child: InkWell(
onTap: () {
controller.setLockState();
},
child: Container(
decoration: BoxDecoration(
color: Colors.black45,
borderRadius: AppStyle.radius8,
),
width: 40,
height: 40,
child: Center(
child: Icon(
controller.lockControlsState.value
? Icons.lock_outline_rounded
: Icons.lock_open_outlined,
color: Colors.white,
size: 20,
),
),
),
),
);
}
Widget buildControls(
bool isPortrait,
VideoState videoState,
LiveRoomController controller,
) {
GlobalKey volumeButtonkey = GlobalKey();
return Stack(
children: [
Container(),
buildDanmuView(videoState, controller),
// 左下角SC显示
Obx(
() => Visibility(
visible: AppSettingsController.instance.playershowSuperChat.value &&
((!Platform.isAndroid && !Platform.isIOS) ||
controller.fullScreenState.value),
child: Positioned(
left: 24,
bottom: 24,
child: PlayerSuperChatOverlay(controller: controller),
),
),
),
// 中间
Center(
child: StreamBuilder(
stream: videoState.widget.controller.player.stream.buffering,
initialData: videoState.widget.controller.player.state.buffering,
builder: (_, s) => Visibility(
visible: s.data ?? false,
child: const Center(
child: CircularProgressIndicator(),
),
),
),
),
Positioned.fill(
child: GestureDetector(
onTap: controller.onTap,
onDoubleTapDown: controller.onDoubleTap,
onVerticalDragStart: controller.onVerticalDragStart,
onVerticalDragUpdate: controller.onVerticalDragUpdate,
onVerticalDragEnd: controller.onVerticalDragEnd,
//onLongPress: controller.showDebugInfo,
child: MouseRegion(
onEnter: controller.onEnter,
child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.transparent,
),
),
),
),
Obx(
() => AnimatedPositioned(
left: 0,
right: 0,
bottom: controller.showControlsState.value ? 0 : -48,
duration: const Duration(milliseconds: 200),
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black87,
],
),
),
child: Row(
children: [
IconButton(
onPressed: () {
controller.refreshRoom();
},
icon: const Icon(
Remix.refresh_line,
color: Colors.white,
),
),
Offstage(
offstage: controller.showDanmakuState.value,
child: IconButton(
onPressed: () => controller.showDanmakuState.value =
!controller.showDanmakuState.value,
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_open.png'),
size: 24,
color: Colors.white,
),
),
),
Offstage(
offstage: !controller.showDanmakuState.value,
child: IconButton(
onPressed: () => controller.showDanmakuState.value =
!controller.showDanmakuState.value,
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_close.png'),
size: 24,
color: Colors.white,
),
),
),
IconButton(
onPressed: () {
controller.showDanmuSettingsSheet();
},
icon: const ImageIcon(
AssetImage('assets/icons/icon_danmaku_setting.png'),
size: 24,
color: Colors.white,
),
),
Obx(
() => Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
controller.liveDuration.value,
style: const TextStyle(fontSize: 14, color: Colors.white),
),
),
),
const Expanded(child: Center()),
Visibility(
visible: !Platform.isAndroid && !Platform.isIOS,
child: IconButton(
key: volumeButtonkey,
onPressed: () {
controller.showVolumeSlider(
volumeButtonkey.currentContext!,
);
},
icon: const Icon(
Icons.volume_down,
size: 24,
color: Colors.white,
),
),
),
Offstage(
offstage: isPortrait,
child: TextButton(
onPressed: () {
controller.showQualitySheet();
},
child: Obx(
() => Text(
controller.currentQualityInfo.value,
style:
const TextStyle(color: Colors.white, fontSize: 15),
),
),
),
),
Offstage(
offstage: isPortrait,
child: TextButton(
onPressed: () {
controller.showPlayUrlsSheet();
},
child: Text(
controller.currentLineInfo.value,
style: const TextStyle(color: Colors.white, fontSize: 15),
),
),
),
Visibility(
visible: !Platform.isAndroid && !Platform.isIOS,
child: IconButton(
onPressed: () {
controller.enterSmallWindow();
},
icon: const Icon(
Icons.picture_in_picture,
color: Colors.white,
size: 24,
),
),
),
IconButton(
onPressed: () {
controller.enterFullScreen();
},
icon: const Icon(
Remix.fullscreen_line,
color: Colors.white,
),
),
],
),
),
),
),
Obx(
() => Offstage(
offstage: !controller.showGestureTip.value,
child: Center(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey.shade900,
borderRadius: BorderRadius.circular(12),
),
child: Text(
controller.gestureTipText.value,
style: const TextStyle(fontSize: 18, color: Colors.white),
),
),
),
),
),
],
);
}
Widget buildDanmuView(VideoState videoState, LiveRoomController controller) {
var padding = MediaQuery.of(videoState.context).padding;
controller.danmakuView ??= DanmakuScreen(
key: controller.globalDanmuKey,
createdController: controller.initDanmakuController,
option: DanmakuOption(
fontSize: AppSettingsController.instance.danmuSize.value,
area: AppSettingsController.instance.danmuArea.value,
duration: AppSettingsController.instance.danmuSpeed.value.toInt(),
opacity: AppSettingsController.instance.danmuOpacity.value,
//strokeWidth: AppSettingsController.instance.danmuStrokeWidth.value,
fontWeight: AppSettingsController.instance.danmuFontWeight.value,
),
);
return Positioned.fill(
top: padding.top,
bottom: padding.bottom,
child: Obx(
() => Offstage(
offstage: !controller.showDanmakuState.value,
child: Padding(
padding: controller.fullScreenState.value
? EdgeInsets.only(
top: AppSettingsController.instance.danmuTopMargin.value,
bottom:
AppSettingsController.instance.danmuBottomMargin.value,
)
: EdgeInsets.zero,
child: controller.danmakuView!,
),
),
),
);
}
void showLinesInfo(LiveRoomController controller) {
if (controller.isVertical.value) {
controller.showPlayUrlsSheet();
return;
}
Utils.showRightDialog(
title: "线路",
useSystem: true,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: controller.playUrls.length,
itemBuilder: (_, i) {
return ListTile(
selected: controller.currentLineIndex == i,
title: Text.rich(
TextSpan(
text: "线路${i + 1}",
children: [
WidgetSpan(
child: Container(
decoration: BoxDecoration(
borderRadius: AppStyle.radius4,
border: Border.all(
color: Colors.grey,
),
),
padding: AppStyle.edgeInsetsH4,
margin: AppStyle.edgeInsetsL8,
child: Text(
controller.playUrls[i].contains(".flv") ? "FLV" : "HLS",
style: const TextStyle(
fontSize: 12,
),
),
)),
],
),
style: const TextStyle(fontSize: 14),
),
minLeadingWidth: 16,
onTap: () {
Utils.hideRightDialog();
//controller.currentLineIndex = i;
//controller.setPlayer();
controller.changePlayLine(i);
},
);
},
),
);
}
void showQualitesInfo(LiveRoomController controller) {
if (controller.isVertical.value) {
controller.showQualitySheet();
return;
}
Utils.showRightDialog(
title: "清晰度",
useSystem: true,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: controller.qualites.length,
itemBuilder: (_, i) {
var item = controller.qualites[i];
return ListTile(
selected: controller.currentQuality == i,
title: Text(
item.quality,
style: const TextStyle(fontSize: 14),
),
minLeadingWidth: 16,
onTap: () {
Utils.hideRightDialog();
controller.currentQuality = i;
controller.getPlayUrl();
},
);
},
),
);
}
void showDanmakuSettings(LiveRoomController controller) {
if (controller.isVertical.value) {
controller.showDanmuSettingsSheet();
return;
}
Utils.showRightDialog(
title: "弹幕设置",
width: 400,
useSystem: true,
child: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
DanmuSettingsView(
danmakuController: controller.danmakuController,
),
],
),
);
}
void showPlayerSettings(LiveRoomController controller) {
if (controller.isVertical.value) {
controller.showPlayerSettingsSheet();
return;
}
Utils.showRightDialog(
title: "设置",
width: 320,
useSystem: true,
child: Obx(
() => RadioGroup(
groupValue: AppSettingsController.instance.scaleMode.value,
onChanged: (e) {
AppSettingsController.instance.setScaleMode(e ?? 0);
controller.updateScaleMode();
},
child: ListView(
padding: AppStyle.edgeInsetsV12,
children: [
Padding(
padding: AppStyle.edgeInsetsH16,
child: Text(
"画面尺寸",
style: Get.textTheme.titleMedium,
),
),
const RadioListTile(
value: 0,
contentPadding: AppStyle.edgeInsetsH4,
title: Text("适应"),
visualDensity: VisualDensity.compact,
),
const RadioListTile(
value: 1,
contentPadding: AppStyle.edgeInsetsH4,
title: Text("拉伸"),
visualDensity: VisualDensity.compact,
),
const RadioListTile(
value: 2,
contentPadding: AppStyle.edgeInsetsH4,
title: Text("铺满"),
visualDensity: VisualDensity.compact,
),
const RadioListTile(
value: 3,
contentPadding: AppStyle.edgeInsetsH4,
title: Text("16:9"),
visualDensity: VisualDensity.compact,
),
const RadioListTile(
value: 4,
contentPadding: AppStyle.edgeInsetsH4,
title: Text("4:3"),
visualDensity: VisualDensity.compact,
),
],
),
),
),
);
}
void showFollowUser(LiveRoomController controller) {
if (controller.isVertical.value) {
controller.showFollowUserSheet();
return;
}
Utils.showRightDialog(
title: "关注列表",
width: 400,
useSystem: true,
child: Obx(
() => Stack(
children: [
RefreshIndicator(
onRefresh: FollowService.instance.loadData,
child: ListView.builder(
itemCount: FollowService.instance.liveList.length,
itemBuilder: (_, i) {
var item = FollowService.instance.liveList[i];
return Obx(
() => FollowUserItem(
item: item,
playing: controller.rxSite.value.id == item.siteId &&
controller.rxRoomId.value == item.roomId,
onTap: () {
Utils.hideRightDialog();
controller.resetRoom(
Sites.allSites[item.siteId]!,
item.roomId,
);
},
),
);
},
),
),
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS)
Positioned(
right: 12,
bottom: 12,
child: Obx(
() => DesktopRefreshButton(
refreshing: FollowService.instance.updating.value,
onPressed: FollowService.instance.loadData,
),
),
),
],
),
),
);
}
class PlayerSuperChatCard extends StatefulWidget {
final LiveSuperChatMessage message;
final VoidCallback onExpire;
final int duration;
const PlayerSuperChatCard(
{required this.message,
required this.onExpire,
required this.duration,
Key? key})
: super(key: key);
@override
State createState() => _PlayerSuperChatCardState();
}
class _PlayerSuperChatCardState extends State {
late Timer timer;
late int countdown;
@override
void initState() {
super.initState();
countdown = widget.duration;
timer = Timer.periodic(const Duration(seconds: 1), (t) {
if (countdown <= 1) {
widget.onExpire();
timer.cancel();
return;
}
setState(() {
countdown -= 1;
});
});
}
@override
void dispose() {
timer.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Opacity(
opacity: 0.65,
child: SuperChatCard(
widget.message,
onExpire: () {},
customCountdown: countdown,
),
);
}
}
class LocalDisplaySC {
final LiveSuperChatMessage sc;
final DateTime expireAt;
final int duration;
LocalDisplaySC(this.sc, this.expireAt, this.duration);
}
class PlayerSuperChatOverlay extends StatefulWidget {
final LiveRoomController controller;
const PlayerSuperChatOverlay({required this.controller, Key? key})
: super(key: key);
@override
State createState() => _PlayerSuperChatOverlayState();
}
class _PlayerSuperChatOverlayState extends State {
final List _displayed = [];
final Map _timers = {};
late Worker _worker;
void _addSC(LiveSuperChatMessage sc, {int? customSeconds}) {
if (_displayed.any((e) => e.sc == sc)) return;
int showSeconds = customSeconds ?? 15;
final expireAt = DateTime.now().add(Duration(seconds: showSeconds));
final localSC = LocalDisplaySC(sc, expireAt, showSeconds);
_displayed.add(localSC);
_timers[localSC] = Timer(Duration(seconds: showSeconds), () {
setState(() {
_displayed.remove(localSC);
_timers.remove(localSC)?.cancel();
});
});
setState(() {});
}
@override
void initState() {
super.initState();
// 首次进房时同步已有SC
final now = DateTime.now().millisecondsSinceEpoch;
for (var sc in widget.controller.superChats) {
int remain = (sc.endTime.millisecondsSinceEpoch - now) ~/ 1000;
if (remain > 0) {
_addSC(sc, customSeconds: remain < 15 ? remain : 15);
}
}
// 监听SC列表变化
_worker =
ever>(widget.controller.superChats, (list) {
// 新增
for (var sc in list) {
if (!_displayed.any((e) => e.sc == sc)) {
_addSC(sc);
}
}
// 移除
_displayed.removeWhere((e) => !list.contains(e.sc));
setState(() {});
});
}
@override
void dispose() {
_worker.dispose();
for (var t in _timers.values) {
t.cancel();
}
super.dispose();
}
@override
Widget build(BuildContext context) {
final sorted = _displayed.toList()
..sort((a, b) => a.sc.endTime.compareTo(b.sc.endTime));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
for (var localSC in sorted)
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: SizedBox(
width: 240,
child: PlayerSuperChatCard(
message: localSC.sc,
onExpire: () {},
duration: localSC.duration,
),
),
),
],
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/account_controller.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/douyin_account_service.dart';
import 'package:simple_live_core/simple_live_core.dart';
class AccountController extends GetxController {
void bilibiliTap() async {
if (BiliBiliAccountService.instance.logined.value) {
var result = await Utils.showAlertDialog("确定要退出哔哩哔哩账号吗?", title: "退出登录");
if (result) {
BiliBiliAccountService.instance.logout();
}
} else {
//AppNavigator.toBiliBiliLogin();
bilibiliLogin();
}
}
void bilibiliLogin() {
Utils.showBottomSheet(
title: "登录哔哩哔哩",
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Visibility(
visible: Platform.isAndroid || Platform.isIOS,
child: ListTile(
leading: const Icon(Icons.account_circle_outlined),
title: const Text("Web登录"),
subtitle: const Text("填写用户名密码登录"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
Get.toNamed(RoutePath.kBiliBiliWebLogin);
},
),
),
ListTile(
leading: const Icon(Icons.qr_code),
title: const Text("扫码登录"),
subtitle: const Text("使用哔哩哔哩APP扫描二维码登录"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
Get.toNamed(RoutePath.kBiliBiliQRLogin);
},
),
ListTile(
leading: const Icon(Icons.edit_outlined),
title: const Text("Cookie登录"),
subtitle: const Text("手动输入Cookie登录"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.back();
doBiliBiliCookieLogin();
},
),
],
),
);
}
void doBiliBiliCookieLogin() async {
var cookie = await Utils.showEditTextDialog(
"",
title: "请输入Cookie",
hintText: "请输入Cookie",
);
if (cookie == null || cookie.isEmpty) {
return;
}
BiliBiliAccountService.instance.setCookie(cookie);
await BiliBiliAccountService.instance.loadUserInfo();
}
void douyinTap() async {
if (DouyinAccountService.instance.hasCookie.value) {
var result = await Utils.showAlertDialog("确定要清除自定义 ttwid 吗?", title: "清除配置");
if (result) {
DouyinAccountService.instance.clearCookie();
SmartDialog.showToast("已清除自定义 ttwid,将使用默认 ttwid");
}
} else {
doDouyinCookieConfig();
}
}
void doDouyinCookieConfig() {
// 初始化文本框时,只显示 ttwid 的值部分
var savedCookie = DouyinAccountService.instance.cookie;
var displayText = savedCookie;
if (savedCookie.startsWith('ttwid=')) {
displayText = savedCookie.substring(6); // 去掉 "ttwid="
}
var controller = TextEditingController(text: displayText);
Get.dialog(
AlertDialog(
title: const Text("配置抖音 ttwid"),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"默认已内置有效的 ttwid,可观看所有画质(包括蓝光)。\n如有需要可自定义配置。",
style: TextStyle(fontSize: 12, color: Colors.grey),
),
const SizedBox(height: 12),
TextField(
controller: controller,
maxLines: 3,
decoration: const InputDecoration(
hintText: "请粘贴 ttwid 值(留空则使用默认值)",
border: OutlineInputBorder(),
),
),
const SizedBox(height: 8),
TextButton.icon(
onPressed: () {
// 提取 ttwid 的值部分(去掉 "ttwid=" 前缀)
var defaultValue = DouyinSite.kDefaultCookie;
if (defaultValue.startsWith('ttwid=')) {
defaultValue = defaultValue.substring(6); // 去掉 "ttwid="
}
controller.text = defaultValue;
},
icon: const Icon(Icons.restore),
label: const Text("恢复默认 ttwid"),
),
],
),
),
actions: [
TextButton(
onPressed: () => Get.back(),
child: const Text("取消"),
),
TextButton(
onPressed: () {
var input = controller.text.trim();
Get.back();
if (input.isEmpty) {
DouyinAccountService.instance.clearCookie();
SmartDialog.showToast("已清除自定义 Cookie,将使用默认 ttwid");
} else {
// 如果用户只输入了 ttwid 值,自动添加 "ttwid=" 前缀
var cookie = input;
if (!input.startsWith('ttwid=')) {
cookie = 'ttwid=$input';
}
DouyinAccountService.instance.setCookie(cookie);
SmartDialog.showToast("ttwid 已保存");
}
},
child: const Text("确定"),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/account_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/mine/account/account_controller.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/douyin_account_service.dart';
class AccountPage extends GetView {
const AccountPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("账号管理"),
),
body: ListView(
children: [
const Padding(
padding: AppStyle.edgeInsetsA12,
child: Text(
"哔哩哔哩账号需要登录才能看高清晰度的直播。",
textAlign: TextAlign.center,
),
),
Obx(
() => ListTile(
leading: Image.asset(
'assets/images/bilibili_2.png',
width: 36,
height: 36,
),
title: const Text("哔哩哔哩"),
subtitle: Text(BiliBiliAccountService.instance.name.value),
trailing: BiliBiliAccountService.instance.logined.value
? const Icon(Icons.logout)
: const Icon(Icons.chevron_right),
onTap: controller.bilibiliTap,
),
),
ListTile(
leading: Image.asset(
'assets/images/douyu.png',
width: 36,
height: 36,
),
title: const Text("斗鱼直播"),
subtitle: const Text("无需登录"),
enabled: false,
trailing: const Icon(Icons.chevron_right),
),
ListTile(
leading: Image.asset(
'assets/images/huya.png',
width: 36,
height: 36,
),
title: const Text("虎牙直播"),
subtitle: const Text("无需登录"),
enabled: false,
trailing: const Icon(Icons.chevron_right),
),
Obx(
() => ListTile(
leading: Image.asset(
'assets/images/douyin.png',
width: 36,
height: 36,
),
title: const Text("抖音直播"),
subtitle: Text(DouyinAccountService.instance.hasCookie.value
? "已自定义(${DouyinAccountService.instance.cookie.length} 字符)"
: "使用默认 ttwid"),
trailing: DouyinAccountService.instance.hasCookie.value
? const Icon(Icons.delete_outline)
: const Icon(Icons.chevron_right),
onTap: controller.douyinTap,
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/bilibili/qr_login_controller.dart
================================================
import 'dart:async';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/requests/http_client.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
enum QRStatus {
loading,
unscanned,
scanned,
expired,
failed,
}
class BiliBiliQRLoginController extends GetxController {
@override
void onInit() {
loadQRCode();
super.onInit();
}
Timer? timer;
var qrcodeUrl = "".obs;
var qrcodeKey = "";
/// 二维码状态
/// - [0] 加载中
/// - [1] 未扫描
/// - [2] 已扫描,待确认
/// - [3] 二维码已经失效
/// - [4] 登录失败
Rx qrStatus = QRStatus.loading.obs;
void loadQRCode() async {
try {
qrStatus.value = QRStatus.loading;
var result = await HttpClient.instance.getJson(
"https://passport.bilibili.com/x/passport-login/web/qrcode/generate",
);
if (result["code"] != 0) {
throw result["message"];
}
qrcodeKey = result["data"]["qrcode_key"];
qrcodeUrl.value = result["data"]["url"];
qrStatus.value = QRStatus.unscanned;
startPoll();
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast(e.toString());
qrStatus.value = QRStatus.failed;
}
}
void startPoll() {
timer = Timer.periodic(
const Duration(seconds: 3),
(timer) {
pollQRStatus();
},
);
}
void pollQRStatus() async {
try {
var response = await HttpClient.instance.get(
"https://passport.bilibili.com/x/passport-login/web/qrcode/poll",
queryParameters: {
"qrcode_key": qrcodeKey,
},
);
if (response.data["code"] != 0) {
throw response.data["message"];
}
var data = response.data["data"];
var code = data["code"];
if (code == 0) {
var cookies = [];
response.headers["set-cookie"]?.forEach((element) {
var cookie = element.split(";")[0];
cookies.add(cookie);
});
if (cookies.isNotEmpty) {
var cookieStr = cookies.join(";");
Log.i(cookieStr);
BiliBiliAccountService.instance.setCookie(cookieStr);
await BiliBiliAccountService.instance.loadUserInfo();
Get.back();
}
} else if (code == 86038) {
qrStatus.value = QRStatus.expired;
qrcodeKey = "";
timer?.cancel();
} else if (code == 86090) {
qrStatus.value = QRStatus.scanned;
}
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast(e.toString());
}
}
@override
void onClose() {
timer?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/bilibili/qr_login_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/mine/account/bilibili/qr_login_controller.dart';
class BiliBiliQRLoginPage extends GetView {
const BiliBiliQRLoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("哔哩哔哩账号登录")),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Obx(
() {
if (controller.qrStatus.value == QRStatus.loading) {
return const CircularProgressIndicator();
}
if (controller.qrStatus.value == QRStatus.failed) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("二维码加载失败"),
TextButton(
onPressed: controller.loadQRCode,
child: const Text("重试"),
),
],
);
}
if (controller.qrStatus.value == QRStatus.failed) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("二维码已失效"),
TextButton(
onPressed: controller.loadQRCode,
child: const Text("刷新二维码"),
),
],
);
}
return Column(
children: [
ClipRRect(
borderRadius: AppStyle.radius12,
child: QrImageView(
data: controller.qrcodeUrl.value,
version: QrVersions.auto,
backgroundColor: Colors.white,
size: 200.0,
padding: AppStyle.edgeInsetsA12,
),
),
AppStyle.vGap8,
Visibility(
visible: controller.qrStatus.value == QRStatus.scanned,
child: const Text("已扫描,请在手机上确认登录"),
),
],
);
},
),
),
const Padding(
padding: AppStyle.edgeInsetsA24,
child: Text(
"请使用哔哩哔哩手机客户端扫描二维码登录",
textAlign: TextAlign.center,
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/bilibili/web_login_controller.dart
================================================
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
class BiliBiliWebLoginController extends BaseController {
InAppWebViewController? webViewController;
final CookieManager cookieManager = CookieManager.instance();
void onWebViewCreated(InAppWebViewController controller) {
webViewController = controller;
webViewController!.loadUrl(
urlRequest: URLRequest(
url: WebUri("https://passport.bilibili.com/login"),
),
);
}
void toQRLogin() async {
await Get.toNamed(RoutePath.kBiliBiliQRLogin);
Get.back();
}
void onLoadStop(InAppWebViewController controller, Uri? uri) async {
if (uri == null) {
return;
}
if (uri.host == "m.bilibili.com") {
logined();
}
}
Future logined() async {
try {
var cookies =
await cookieManager.getCookies(url: WebUri("https://bilibili.com"));
if (cookies.isEmpty) {
return false;
}
var cookieStr = cookies.map((e) => "${e.name}=${e.value}").join(";");
Log.i(cookieStr);
BiliBiliAccountService.instance.setCookie(cookieStr);
await BiliBiliAccountService.instance.loadUserInfo();
Get.back();
return true;
} catch (e) {
return false;
}
}
}
================================================
FILE: simple_live_app/lib/modules/mine/account/bilibili/web_login_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/modules/mine/account/bilibili/web_login_controller.dart';
class BiliBiliWebLoginPage extends GetView {
const BiliBiliWebLoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("哔哩哔哩账号登录"),
actions: [
TextButton.icon(
onPressed: controller.toQRLogin,
icon: const Icon(Icons.qr_code),
label: const Text("二维码登录"),
),
],
),
body: InAppWebView(
onWebViewCreated: controller.onWebViewCreated,
onLoadStop: controller.onLoadStop,
initialSettings: InAppWebViewSettings(
userAgent:
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/118.0.0.0",
useShouldOverrideUrlLoading: true,
),
shouldOverrideUrlLoading: (webController, navigationAction) async {
var uri = navigationAction.request.url;
if (uri == null) {
return NavigationActionPolicy.ALLOW;
}
if (uri.host == "m.bilibili.com" || uri.host == "www.bilibili.com") {
await controller.logined();
return NavigationActionPolicy.CANCEL;
}
return NavigationActionPolicy.ALLOW;
},
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/history/history_controller.dart
================================================
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/history.dart';
import 'package:simple_live_app/services/db_service.dart';
class HistoryController extends BasePageController {
@override
Future> getData(int page, int pageSize) {
if (page > 1) {
return Future.value([]);
}
return Future.value(DBService.instance.getHistores());
}
void clean() async {
var result = await Utils.showAlertDialog("确定要清空观看记录吗?", title: "清空观看记录");
if (!result) {
return;
}
await DBService.instance.historyBox.clear();
refreshData();
}
void removeItem(History item) async {
await DBService.instance.historyBox.delete(item.id);
refreshData();
}
}
================================================
FILE: simple_live_app/lib/modules/mine/history/history_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/mine/history/history_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/widgets/net_image.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
class HistoryPage extends GetView {
const HistoryPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var rowCount = MediaQuery.of(context).size.width ~/ 500;
if (rowCount < 1) rowCount = 1;
return Scaffold(
appBar: AppBar(
title: const Text("观看记录"),
actions: [
TextButton.icon(
onPressed: controller.clean,
icon: const Icon(Icons.delete_outline),
label: const Text("清空"),
),
],
),
body: PageGridView(
crossAxisSpacing: 12,
crossAxisCount: rowCount,
pageController: controller,
firstRefresh: true,
itemBuilder: (_, i) {
var item = controller.list[i];
var site = Sites.allSites[item.siteId]!;
return Dismissible(
key: ValueKey(item.id),
direction: DismissDirection.endToStart,
background: Container(
color: Colors.red,
padding: AppStyle.edgeInsetsA12,
alignment: Alignment.centerRight,
child: const Icon(
Icons.delete,
color: Colors.white,
),
),
confirmDismiss: (direction) async {
return await Utils.showAlertDialog("确定要删除此记录吗?", title: "删除记录");
},
onDismissed: (_) {
controller.removeItem(item);
},
child: ListTile(
leading: NetImage(
item.face,
width: 48,
height: 48,
borderRadius: 24,
),
title: Text(item.userName),
subtitle: Row(
children: [
Expanded(
child: Row(
children: [
Image.asset(
site.logo,
width: 20,
),
AppStyle.hGap4,
Text(
site.name,
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
],
),
),
Text(
Utils.parseTime(item.updateTime),
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
],
),
onTap: () {
AppNavigator.toLiveRoomDetail(site: site, roomId: item.roomId);
},
onLongPress: () async {
var result =
await Utils.showAlertDialog("确定要删除此记录吗?", title: "删除记录");
if (!result) {
return;
}
controller.removeItem(item);
},
),
);
},
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/mine_page.dart
================================================
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/signalr_service.dart';
import 'package:url_launcher/url_launcher_string.dart';
class MinePage extends StatelessWidget {
const MinePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AnnotatedRegion(
value: Get.isDarkMode
? SystemUiOverlayStyle.light.copyWith(
systemNavigationBarColor: Colors.transparent,
)
: SystemUiOverlayStyle.dark.copyWith(
systemNavigationBarColor: Colors.transparent,
),
child: SafeArea(
child: ListView(
padding: AppStyle.edgeInsetsA4,
children: [
AppStyle.vGap12,
ListTile(
leading: Image.asset(
'assets/images/logo.png',
width: 56,
height: 56,
),
title: const Text(
"Simple Live",
style: TextStyle(height: 1.0),
),
subtitle: const Text("简简单单看直播"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Get.dialog(AboutDialog(
applicationIcon: Image.asset(
'assets/images/logo.png',
width: 48,
height: 48,
),
applicationName: "Simple Live",
applicationVersion: "简简单单看直播",
applicationLegalese: "Ver ${Utils.packageInfo.version}",
));
},
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
_buildCard(
context,
children: [
ListTile(
leading: const Icon(Remix.history_line),
title: const Text("观看记录"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kHistory);
},
),
],
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
ListTile(
leading: const Icon(Remix.account_circle_line),
title: const Text("账号管理"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsAccount);
},
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
ListTile(
leading: const Icon(Icons.devices),
title: const Text("数据同步"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSync);
},
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
ListTile(
leading: const Icon(Remix.link),
title: const Text("链接解析"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kTools);
},
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
_buildCard(
context,
children: [
ListTile(
leading: const Icon(Remix.moon_line),
title: const Text("外观设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kAppstyleSetting);
},
),
ListTile(
leading: const Icon(Remix.home_2_line),
title: const Text("主页设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsIndexed);
},
),
ListTile(
leading: const Icon(Remix.play_circle_line),
title: const Text("直播设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsPlay);
},
),
ListTile(
leading: const Icon(Remix.text),
title: const Text("弹幕设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsDanmu);
},
),
ListTile(
leading: const Icon(Remix.heart_line),
title: const Text("关注设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsFollow);
},
),
ListTile(
leading: const Icon(Remix.timer_2_line),
title: const Text("定时关闭"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsAutoExit);
},
),
ListTile(
leading: const Icon(Remix.apps_line),
title: const Text("其他设置"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
Get.toNamed(RoutePath.kSettingsOther);
},
),
if (kDebugMode)
ListTile(
leading: const Icon(Remix.apps_line),
title: const Text("测试"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () async {
SignalRService signalRService = SignalRService();
await signalRService.connect();
//Get.toNamed(RoutePath.kTest);
var room = await signalRService.createRoom();
Log.logPrint(room);
},
),
],
),
Divider(
indent: 12,
endIndent: 12,
color: Colors.grey.withAlpha(25),
),
_buildCard(
context,
children: [
const ListTile(
leading: Icon(Remix.error_warning_line),
title: Text("免责声明"),
trailing: Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: Utils.showStatement,
),
ListTile(
leading: const Icon(Remix.github_line),
title: const Text("开源主页"),
trailing: const Icon(
Icons.chevron_right,
color: Colors.grey,
),
onTap: () {
launchUrlString(
"https://github.com/xiaoyaocz/dart_simple_live",
mode: LaunchMode.externalApplication,
);
},
),
],
),
],
),
),
);
}
Widget _buildCard(BuildContext context, {required List children}) {
return Theme(
data: Theme.of(context).copyWith(
listTileTheme: ListTileThemeData(
shape: RoundedRectangleBorder(borderRadius: AppStyle.radius8),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/mine/parse/parse_controller.dart
================================================
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
class ParseController extends GetxController {
final TextEditingController roomJumpToController = TextEditingController();
final TextEditingController getUrlController = TextEditingController();
void jumpToRoom(String e) async {
if (e.isEmpty) {
SmartDialog.showToast("链接不能为空");
return;
}
// 隐藏键盘
FocusManager.instance.primaryFocus?.unfocus();
var parseResult = await parse(e);
if (parseResult.isEmpty && parseResult.first == "") {
SmartDialog.showToast("无法解析此链接");
return;
}
// 延迟200ms跳转,等待键盘隐藏
Future.delayed(const Duration(milliseconds: 200), () {
Site site = parseResult[1];
AppNavigator.toLiveRoomDetail(site: site, roomId: parseResult.first);
});
}
void getPlayUrl(String e) async {
if (e.isEmpty) {
SmartDialog.showToast("链接不能为空");
return;
}
var parseResult = await parse(e);
if (parseResult.isEmpty && parseResult.first == "") {
SmartDialog.showToast("无法解析此链接");
return;
}
Site site = parseResult[1];
try {
SmartDialog.showLoading(msg: "");
var detail = await site.liveSite.getRoomDetail(roomId: parseResult.first);
var qualites = await site.liveSite.getPlayQualites(detail: detail);
SmartDialog.dismiss(status: SmartStatus.loading);
if (qualites.isEmpty) {
SmartDialog.showToast("读取直链失败,无法读取清晰度");
return;
}
var result = await Get.dialog(SimpleDialog(
title: const Text("选择清晰度"),
children: qualites
.map(
(e) => ListTile(
title: Text(
e.quality,
textAlign: TextAlign.center,
),
onTap: () {
Get.back(result: e);
},
),
)
.toList(),
));
if (result == null) {
return;
}
SmartDialog.showLoading(msg: "");
var playUrl =
await site.liveSite.getPlayUrls(detail: detail, quality: result);
SmartDialog.dismiss(status: SmartStatus.loading);
await Get.dialog(SimpleDialog(
title: const Text("选择线路"),
children: playUrl.urls
.map(
(e) => ListTile(
title: Text(
"线路${playUrl.urls.indexOf(e) + 1}",
),
subtitle: Text(
e,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
onTap: () {
Clipboard.setData(ClipboardData(text: e));
Get.back();
SmartDialog.showToast("已复制直链");
},
),
)
.toList(),
));
} catch (e) {
SmartDialog.showToast("读取直链失败");
} finally {
SmartDialog.dismiss(status: SmartStatus.loading);
}
}
Future parse(String url) async {
var id = "";
if (url.contains("bilibili.com")) {
var regExp = RegExp(r"bilibili\.com/([\d|\w]+)");
id = regExp.firstMatch(url)?.group(1) ?? "";
return [id, Sites.allSites[Constant.kBiliBili]!];
}
if (url.contains("b23.tv")) {
var btvReg = RegExp(r"https?:\/\/b23.tv\/[0-9a-z-A-Z]+");
var u = btvReg.firstMatch(url)?.group(0) ?? "";
var location = await getLocation(u);
return await parse(location);
}
if (url.contains("douyu.com")) {
var regExp = RegExp(r"douyu\.com/([\d|\w]+)");
// 适配 topic_url
if(url.contains("topic")){
regExp = RegExp(r"[?&]rid=([\d]+)");
}
id = regExp.firstMatch(url)?.group(1) ?? "";
return [id, Sites.allSites[Constant.kDouyu]!];
}
if (url.contains("huya.com")) {
var regExp = RegExp(r"huya\.com/([\d|\w]+)");
id = regExp.firstMatch(url)?.group(1) ?? "";
return [id, Sites.allSites[Constant.kHuya]!];
}
if (url.contains("live.douyin.com")) {
var regExp = RegExp(r"live\.douyin\.com/([\d|\w]+)");
id = regExp.firstMatch(url)?.group(1) ?? "";
return [id, Sites.allSites[Constant.kDouyin]!];
}
if (url.contains("webcast.amemv.com")) {
var regExp = RegExp(r"reflow/(\d+)");
id = regExp.firstMatch(url)?.group(1) ?? "";
return [id, Sites.allSites[Constant.kDouyin]!];
}
if (url.contains("v.douyin.com")) {
var regExp = RegExp(r"http.?://v.douyin.com/[\d\w]+/");
var u = regExp.firstMatch(url)?.group(0) ?? "";
var location = await getLocation(u);
return await parse(location);
}
return [];
}
Future getLocation(String url) async {
try {
if (url.isEmpty) return "";
await Dio().get(
url,
options: Options(
followRedirects: false,
),
);
} on DioException catch (e) {
if (e.response!.statusCode == 302) {
var redirectUrl = e.response!.headers.value("Location");
if (redirectUrl != null) {
return redirectUrl;
}
}
} catch (e) {
Log.logPrint(e);
}
return "";
}
}
================================================
FILE: simple_live_app/lib/modules/mine/parse/parse_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/mine/parse/parse_controller.dart';
class ParsePage extends GetView {
const ParsePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("链接解析"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
buildCard(
context: context,
child: ExpansionTile(
title: const Text("直播间跳转"),
childrenPadding: AppStyle.edgeInsetsH12,
initiallyExpanded: true,
children: [
TextField(
minLines: 3,
maxLines: 3,
controller: controller.roomJumpToController,
textInputAction: TextInputAction.go,
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "输入或粘贴哔哩哔哩直播/虎牙直播/斗鱼直播/抖音直播的链接",
contentPadding: AppStyle.edgeInsetsA12,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withAlpha(50),
),
),
),
onSubmitted: controller.jumpToRoom,
),
Container(
margin: AppStyle.edgeInsetsB4,
width: double.infinity,
child: TextButton.icon(
onPressed: () {
controller
.jumpToRoom(controller.roomJumpToController.text);
},
icon: const Icon(Remix.play_circle_line),
label: const Text("链接跳转"),
),
),
],
),
),
buildCard(
context: context,
child: ExpansionTile(
title: const Text("获取直链"),
childrenPadding: AppStyle.edgeInsetsH12,
initiallyExpanded: true,
children: [
TextField(
minLines: 3,
maxLines: 3,
controller: controller.getUrlController,
textInputAction: TextInputAction.go,
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "输入或粘贴哔哩哔哩直播/虎牙直播/斗鱼直播/抖音直播的链接",
contentPadding: AppStyle.edgeInsetsA12,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withAlpha(50),
),
),
),
onSubmitted: controller.getPlayUrl,
),
Container(
margin: AppStyle.edgeInsetsB4,
width: double.infinity,
child: TextButton.icon(
onPressed: () {
controller.getPlayUrl(controller.getUrlController.text);
},
icon: const Icon(Remix.link),
label: const Text("获取直链"),
),
),
],
),
),
const Padding(
padding: AppStyle.edgeInsetsV12,
child: SelectableText('''支持以下类型的链接解析:
哔哩哔哩:
https://live.bilibili.com/xxxxx
https://b23.tv/xxxxx
虎牙直播:
https://www.huya.com/xxxxx
斗鱼直播:
https://www.douyu.com/xxxxx
https://www.douyu.com/topic/xxx?rid=xxx
抖音直播:
https://v.douyin.com/xxxxx
https://live.douyin.com/xxxxx
https://webcast.amemv.com/webcast/reflow/xxxxx
''', style: TextStyle(color: Colors.grey)),
),
],
),
);
}
Widget buildCard({required BuildContext context, required Widget child}) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: AppStyle.radius8,
boxShadow: Get.isDarkMode
? []
: [
BoxShadow(
blurRadius: 8,
color: Colors.grey.withAlpha(50),
)
],
),
margin: AppStyle.edgeInsetsB12,
child: Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent,
),
child: child,
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/other/debug_log_page.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/log.dart';
class DebugLogPage extends StatelessWidget {
const DebugLogPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Log"),
actions: [
IconButton(
onPressed: () async {
var msg = Log.debugLogs
.map((x) => "${x.datetime}\r\n${x.content}")
.join('\r\n\r\n');
var dir = await getApplicationDocumentsDirectory();
var logFile = File(
'${dir.path}/${DateTime.now().millisecondsSinceEpoch}.log');
await logFile.writeAsString(msg);
SharePlus.instance.share(ShareParams(
files: [XFile(logFile.path)],
));
},
icon: const Icon(Icons.save),
),
IconButton(
onPressed: () {
Log.debugLogs.clear();
},
icon: const Icon(Icons.clear_all),
),
],
),
body: Obx(
() => ListView.separated(
itemCount: Log.debugLogs.length,
separatorBuilder: (_, i) => const Divider(),
padding: AppStyle.edgeInsetsA12,
itemBuilder: (_, i) {
var item = Log.debugLogs[i];
return SelectableText(
"${item.datetime.toString()}\r\n${item.content}",
style: TextStyle(
color: item.color,
fontSize: 12,
),
);
},
),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/search/douyin/douyin_search_controller.dart
================================================
import 'dart:io';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_core/simple_live_core.dart';
import 'package:url_launcher/url_launcher_string.dart';
class DouyinSearchController extends BaseController {
InAppWebViewController? webViewController;
void onWebViewCreated(InAppWebViewController controller) {
webViewController = controller;
}
RxList list = [].obs;
String keyword = "";
/// 搜索模式,0=直播间,1=主播
var searchMode = 0.obs;
final Site site;
DouyinSearchController(
this.site,
);
var searchUrl = "https://www.douyin.com/search/dnf?type=live";
void reloadWebView() {
if (keyword.isEmpty) {
return;
}
searchUrl =
"https://www.douyin.com/search/${Uri.encodeComponent(keyword)}?type=live";
if (Platform.isAndroid || Platform.isIOS) {
webViewController!.loadUrl(
urlRequest: URLRequest(
url: WebUri(searchUrl),
),
);
}
}
void onLoadStop(InAppWebViewController controller, Uri? uri) async {
pageLoadding.value = false;
}
void onLoadStart(InAppWebViewController controller, Uri? uri) async {
pageLoadding.value = true;
}
Future onCreateWindow(InAppWebViewController controller,
CreateWindowAction createWindowAction) async {
if (createWindowAction.request.url?.host == "live.douyin.com") {
{
var regExp = RegExp(r"live\.douyin\.com/([\d|\w]+)");
var id = regExp
.firstMatch(createWindowAction.request.url.toString())
?.group(1) ??
"";
AppNavigator.toLiveRoomDetail(site: site, roomId: id);
return false;
}
}
return false;
}
void openBrowser() {
launchUrlString(searchUrl);
Get.offAndToNamed(RoutePath.kTools);
}
}
================================================
FILE: simple_live_app/lib/modules/search/douyin/douyin_search_view.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/search/douyin/douyin_search_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/status/app_loadding_widget.dart';
class DouyinSearchView extends StatelessWidget {
const DouyinSearchView({Key? key}) : super(key: key);
DouyinSearchController get controller => Get.find();
@override
Widget build(BuildContext context) {
var roomRowCount = MediaQuery.of(context).size.width ~/ 200;
if (roomRowCount < 2) roomRowCount = 2;
var userRowCount = MediaQuery.of(context).size.width ~/ 500;
if (userRowCount < 1) userRowCount = 1;
return KeepAliveWrapper(
child: Stack(
children: [
SizedBox(
width: double.infinity,
height: double.infinity,
child: Center(
child: Padding(
padding: AppStyle.edgeInsetsA12,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
"暂不支持抖音搜索,请打开浏览器搜索,然后复制直播间链接进行解析",
textAlign: TextAlign.center,
),
TextButton.icon(
onPressed: controller.openBrowser,
icon: const Icon(Icons.open_in_browser),
label: const Text("打开浏览器"),
),
],
),
),
),
),
if (Platform.isAndroid || Platform.isIOS)
InAppWebView(
onWebViewCreated: controller.onWebViewCreated,
onLoadStop: controller.onLoadStop,
onLoadStart: controller.onLoadStart,
initialSettings: InAppWebViewSettings(
useOnLoadResource: true,
userAgent:
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/118.0.0.0",
useShouldOverrideUrlLoading: true,
),
onCreateWindow: controller.onCreateWindow,
shouldOverrideUrlLoading:
(webController, navigationAction) async {
var uri = navigationAction.request.url;
if (uri == null) {
return NavigationActionPolicy.ALLOW;
}
if (uri.host == "live.douyin.com") {
var regExp = RegExp(r"live\.douyin\.com/([\d|\w]+)");
var id = regExp.firstMatch(uri.toString())?.group(1) ?? "";
AppNavigator.toLiveRoomDetail(
site: controller.site, roomId: id);
return NavigationActionPolicy.CANCEL;
}
return NavigationActionPolicy.ALLOW;
},
),
Obx(
() => Visibility(
visible: controller.pageLoadding.value,
child: const AppLoaddingWidget(),
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/search/search_controller.dart
================================================
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/search/search_list_controller.dart';
class AppSearchController extends GetxController
with GetSingleTickerProviderStateMixin {
late TabController tabController;
int index = 0;
var searchMode = 0.obs;
AppSearchController() {
tabController =
TabController(length: Sites.supportSites.length, vsync: this);
tabController.animation?.addListener(() {
var currentIndex = (tabController.animation?.value ?? 0).round();
if (index == currentIndex) {
return;
}
index = currentIndex;
// if (Sites.supportSites[index].id == Constant.kDouyin) {
// return;
// }
var controller =
Get.find(tag: Sites.supportSites[index].id);
if (controller.list.isEmpty &&
!controller.pageEmpty.value &&
controller.keyword.isNotEmpty) {
controller.refreshData();
}
});
}
StreamSubscription? streamSubscription;
TextEditingController searchController = TextEditingController();
@override
void onInit() {
for (var site in Sites.supportSites) {
// if (site.id == Constant.kDouyin) {
// Get.put(DouyinSearchController(site));
// } else {
Get.put(
SearchListController(site),
tag: site.id,
);
//}
}
super.onInit();
}
void doSearch() {
if (searchController.text.isEmpty) {
return;
}
for (var site in Sites.supportSites) {
// if (site.id == Constant.kDouyin) {
// var controller = Get.find();
// controller.keyword = searchController.text;
// controller.searchMode.value = searchMode.value;
// controller.reloadWebView();
// } else {
var controller = Get.find(tag: site.id);
controller.clear();
controller.keyword = searchController.text;
controller.searchMode.value = searchMode.value;
//}
}
// if (Sites.supportSites[index].id != Constant.kDouyin) {
var controller =
Get.find(tag: Sites.supportSites[index].id);
controller.refreshData();
//}
}
@override
void onClose() {
streamSubscription?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/search/search_list_controller.dart
================================================
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/sites.dart';
class SearchListController extends BasePageController {
String keyword = "";
/// 搜索模式,0=直播间,1=主播
var searchMode = 0.obs;
final Site site;
SearchListController(
this.site,
);
@override
Future refreshData() async {
if (keyword.isEmpty) {
return;
}
return await super.refreshData();
}
@override
Future getData(int page, int pageSize) async {
if (keyword.isEmpty) {
return [];
}
if (searchMode.value == 1) {
// 搜索主播
var result = await site.liveSite.searchAnchors(keyword, page: page);
return result.items;
}
var result = await site.liveSite.searchRooms(keyword, page: page);
return result.items;
}
void clear() {
pageEmpty.value = false;
list.clear();
}
}
================================================
FILE: simple_live_app/lib/modules/search/search_list_view.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/search/search_list_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/live_room_card.dart';
import 'package:simple_live_app/widgets/net_image.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
import 'package:simple_live_core/simple_live_core.dart';
class SearchListView extends StatelessWidget {
final String tag;
const SearchListView(this.tag, {Key? key}) : super(key: key);
SearchListController get controller =>
Get.find(tag: tag);
@override
Widget build(BuildContext context) {
var roomRowCount = MediaQuery.of(context).size.width ~/ 200;
if (roomRowCount < 2) roomRowCount = 2;
var userRowCount = MediaQuery.of(context).size.width ~/ 500;
if (userRowCount < 1) userRowCount = 1;
return KeepAliveWrapper(
child: Obx(
() => controller.searchMode.value == 0
? PageGridView(
pageController: controller,
padding: AppStyle.edgeInsetsA12,
firstRefresh: false,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
crossAxisCount: roomRowCount,
showPageLoadding: true,
itemBuilder: (_, i) {
var item = controller.list[i] as LiveRoomItem;
return LiveRoomCard(controller.site, item);
},
)
: PageGridView(
crossAxisSpacing: 12,
crossAxisCount: userRowCount,
pageController: controller,
firstRefresh: true,
itemBuilder: (_, i) {
var item = controller.list[i] as LiveAnchorItem;
return ListTile(
leading: NetImage(
item.avatar,
width: 48,
height: 48,
borderRadius: 24,
),
title: Text(item.userName),
subtitle: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: item.liveStatus ? Colors.green : Colors.grey,
borderRadius: AppStyle.radius12,
),
),
AppStyle.hGap4,
Text(
item.liveStatus ? "直播中" : "未开播",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: item.liveStatus ? null : Colors.grey,
),
),
],
),
onTap: () {
AppNavigator.toLiveRoomDetail(
site: controller.site, roomId: item.roomId);
},
);
},
),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/search/search_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/search/search_controller.dart';
import 'package:simple_live_app/modules/search/search_list_view.dart';
class SearchPage extends GetView {
const SearchPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: TextField(
controller: controller.searchController,
autofocus: true,
decoration: InputDecoration(
hintText: "搜点什么吧",
border: OutlineInputBorder(
borderRadius: AppStyle.radius24,
),
contentPadding: AppStyle.edgeInsetsH12,
prefixIcon: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
onPressed: Get.back,
icon: const Icon(Icons.arrow_back),
),
Obx(
() => DropdownButton(
underline: const SizedBox(),
items: const [
DropdownMenuItem(
value: 0,
child: Text("房间"),
),
DropdownMenuItem(
value: 1,
child: Text("主播"),
),
],
value: controller.searchMode.value,
onChanged: (e) {
controller.searchMode.value = e ?? 0;
controller.doSearch();
},
),
),
AppStyle.hGap8,
],
),
suffixIcon: IconButton(
onPressed: controller.doSearch,
icon: const Icon(Icons.search),
),
),
onSubmitted: (e) {
controller.doSearch();
},
),
bottom: TabBar(
controller: controller.tabController,
padding: EdgeInsets.zero,
tabAlignment: TabAlignment.center,
tabs: Sites.supportSites
.map(
(e) => Tab(
//text: e.name,
child: Row(
children: [
Image.asset(
e.logo,
width: 24,
),
AppStyle.hGap8,
Text(e.name),
],
),
),
)
.toList(),
labelPadding: AppStyle.edgeInsetsH20,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
),
),
body: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: controller.tabController,
children: Sites.supportSites
.map((e) => SearchListView(
e.id,
)
// (e) => e.id == Constant.kDouyin
// ? const DouyinSearchView()
// : SearchListView(
// e.id,
// ),
)
.toList(),
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/appstyle_setting_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
class AppstyleSettingPage extends GetView {
const AppstyleSettingPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("外观设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
child: Text(
"显示主题",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => RadioGroup(
groupValue: controller.themeMode.value,
onChanged: (e) {
controller.setTheme(e ?? 0);
},
child: const Column(
mainAxisSize: MainAxisSize.min,
children: [
RadioListTile(
title: Text(
"跟随系统",
),
visualDensity: VisualDensity.compact,
value: 0,
contentPadding: AppStyle.edgeInsetsH12,
),
RadioListTile(
title: Text(
"浅色模式",
),
visualDensity: VisualDensity.compact,
value: 1,
contentPadding: AppStyle.edgeInsetsH12,
),
RadioListTile(
title: Text(
"深色模式",
),
visualDensity: VisualDensity.compact,
value: 2,
contentPadding: AppStyle.edgeInsetsH12,
),
],
),
),
),
),
AppStyle.vGap12,
Padding(
padding: AppStyle.edgeInsetsA12,
child: Text(
"主题颜色",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => Column(
mainAxisSize: MainAxisSize.min,
children: [
SettingsSwitch(
value: controller.isDynamic.value,
title: "动态取色",
onChanged: (e) {
controller.setIsDynamic(e);
Get.forceAppUpdate();
},
),
if (!controller.isDynamic.value) AppStyle.divider,
if (!controller.isDynamic.value)
Padding(
padding: AppStyle.edgeInsetsA12,
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
const Color(0xffEF5350),
const Color(0xff3498db),
const Color(0xffF06292),
const Color(0xff9575CD),
const Color(0xff26C6DA),
const Color(0xff26A69A),
const Color(0xffFFF176),
const Color(0xffFF9800),
]
.map(
(e) => GestureDetector(
onTap: () {
controller.setStyleColor(e.toARGB32());
Get.forceAppUpdate();
},
child: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: e,
borderRadius: AppStyle.radius4,
border: Border.all(
color: Colors.grey.withAlpha(50),
width: 1,
),
),
child: Obx(
() => Center(
child: Icon(
Icons.check,
color: controller.styleColor.value ==
e.toARGB32()
? Colors.white
: Colors.transparent,
),
),
),
),
),
)
.toList(),
),
),
],
),
),
),
],
),
);
}
}
// extension ColorExt on Color {
// static int _floatToInt8(double x) {
// return (x * 255.0).round() & 0xff;
// }
// int get v =>
// _floatToInt8(a) << 24 |
// _floatToInt8(r) << 16 |
// _floatToInt8(g) << 8 |
// _floatToInt8(b) << 0;
// }
================================================
FILE: simple_live_app/lib/modules/settings/auto_exit_settings_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_action.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
class AutoExitSettingsPage extends GetView {
const AutoExitSettingsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("定时关闭设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
SettingsCard(
child: Column(
children: [
Obx(
() => SettingsSwitch(
value: controller.autoExitEnable.value,
title: "启用定时关闭",
onChanged: (e) {
controller.setAutoExitEnable(e);
},
),
),
Obx(
() => Visibility(
visible: controller.autoExitEnable.value,
child: AppStyle.divider,
),
),
Obx(
() => Visibility(
visible: controller.autoExitEnable.value,
child: SettingsAction(
title: "自动关闭时间",
value:
"${controller.autoExitDuration.value ~/ 60}小时${controller.autoExitDuration.value % 60}分钟",
subtitle: "从进入直播间开始倒计时",
onTap: () {
setTimer(context);
},
),
),
),
],
),
),
],
),
);
}
void setTimer(BuildContext context) async {
var value = await showTimePicker(
context: context,
initialTime: TimeOfDay(
hour: controller.autoExitDuration.value ~/ 60,
minute: controller.autoExitDuration.value % 60,
),
initialEntryMode: TimePickerEntryMode.inputOnly,
builder: (_, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat: true,
),
child: child!,
);
},
);
if (value == null || (value.hour == 0 && value.minute == 0)) {
return;
}
var duration = Duration(hours: value.hour, minutes: value.minute);
controller.setAutoExitDuration(duration.inMinutes);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/danmu_settings_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/widgets/settings/settings_action.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_number.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
class DanmuSettingsPage extends StatelessWidget {
const DanmuSettingsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("弹幕设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: const [
DanmuSettingsView(),
],
),
);
}
}
class DanmuSettingsView extends GetView {
final Function()? onTapDanmuShield;
final DanmakuController? danmakuController;
const DanmuSettingsView({
this.onTapDanmuShield,
this.danmakuController,
super.key,
});
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
child: Text(
"弹幕屏蔽",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SettingsAction(
title: "关键词屏蔽",
onTap: onTapDanmuShield ??
() => Get.toNamed(RoutePath.kSettingsDanmuShield),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"弹幕设置",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => SettingsSwitch(
title: "默认开关",
value: controller.danmuEnable.value,
onChanged: (e) {
controller.setDanmuEnable(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "显示区域",
value: (controller.danmuArea.value * 100).toInt(),
min: 10,
max: 100,
step: 10,
unit: "%",
onChanged: (e) {
controller.setDanmuArea(e / 100.0);
updateDanmuOption(
danmakuController?.option.copyWith(area: e / 100.0),
);
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "不透明度",
value: (controller.danmuOpacity.value * 100).toInt(),
min: 10,
max: 100,
step: 10,
unit: "%",
onChanged: (e) {
controller.setDanmuOpacity(e / 100.0);
updateDanmuOption(
danmakuController?.option.copyWith(opacity: e / 100.0),
);
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "字体大小",
value: controller.danmuSize.toInt(),
min: 8,
max: 48,
onChanged: (e) {
controller.setDanmuSize(e.toDouble());
updateDanmuOption(
danmakuController?.option
.copyWith(fontSize: e.toDouble()),
);
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "字体粗细",
value: controller.danmuFontWeight.value,
min: 1,
max: 9,
step: 1,
displayValue: [
"极细",
"很细",
"细",
"正常",
"小粗",
"偏粗",
"粗",
"很粗",
"极粗"
][controller.danmuFontWeight.value - 1]
.toString(),
onChanged: (e) {
controller.setDanmuFontWeight(e);
updateDanmuOption(
danmakuController?.option.copyWith(
fontWeight: e,
),
);
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "滚动速度",
subtitle: "弹幕持续时间(秒),越小速度越快",
value: controller.danmuSpeed.toInt(),
min: 4,
max: 20,
onChanged: (e) {
controller.setDanmuSpeed(e.toDouble());
updateDanmuOption(
danmakuController?.option.copyWith(duration: e.toInt()),
);
},
),
),
// AppStyle.divider,
// Obx(
// () => SettingsNumber(
// title: "字体描边",
// value: controller.danmuStrokeWidth.toInt(),
// min: 0,
// max: 10,
// onChanged: (e) {
// controller.setDanmuStrokeWidth(e.toDouble());
// updateDanmuOption(
// danmakuController?.option
// .copyWith(strokeWidth: e.toDouble()),
// );
// },
// ),
// ),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "顶部边距",
subtitle: "曲面屏显示不全可设置此选项",
value: controller.danmuTopMargin.toInt(),
min: 0,
max: 48,
step: 4,
onChanged: (e) {
controller.setDanmuTopMargin(e.toDouble());
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "底部边距",
subtitle: "曲面屏显示不全可设置此选项",
value: controller.danmuBottomMargin.toInt(),
min: 0,
max: 48,
step: 4,
onChanged: (e) {
controller.setDanmuBottomMargin(e.toDouble());
},
),
),
],
),
),
],
);
}
void updateDanmuOption(DanmakuOption? option) {
if (danmakuController == null || option == null) return;
danmakuController!.updateOption(option);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/danmu_shield/danmu_shield_controller.dart
================================================
import 'package:flutter/widgets.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
class DanmuShieldController extends BaseController {
final TextEditingController textEditingController = TextEditingController();
final AppSettingsController settingsController =
Get.find();
void add() {
if (textEditingController.text.isEmpty) {
SmartDialog.showToast("请输入关键词");
return;
}
settingsController.addShieldList(textEditingController.text.trim());
textEditingController.text = "";
}
void remove(String item) {
settingsController.removeShieldList(item);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/danmu_shield/danmu_shield_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/settings/danmu_shield/danmu_shield_controller.dart';
class DanmuShieldPage extends GetView {
const DanmuShieldPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("弹幕屏蔽"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
TextField(
controller: controller.textEditingController,
decoration: InputDecoration(
contentPadding: AppStyle.edgeInsetsH12,
border: const OutlineInputBorder(),
hintText: "请输入关键词或正则表达式",
suffixIcon: TextButton.icon(
onPressed: controller.add,
icon: const Icon(Icons.add),
label: const Text("添加"),
),
),
onSubmitted: (e) {
controller.add();
},
),
AppStyle.vGap4,
Text(
'以"/"开头和结尾将视作正则表达式, 如"/\\d+/"表示屏蔽所有数字',
style: Get.textTheme.bodySmall,
),
AppStyle.vGap12,
Obx(
() => Text(
"已添加${controller.settingsController.shieldList.length}个关键词(点击移除)",
style: Get.textTheme.titleSmall,
),
),
AppStyle.vGap12,
Obx(
() => Wrap(
runSpacing: 12,
spacing: 12,
children: controller.settingsController.shieldList
.map(
(item) => InkWell(
borderRadius: AppStyle.radius24,
onTap: () {
controller.remove(item);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: AppStyle.radius24,
),
padding: AppStyle.edgeInsetsH12.copyWith(
top: 4,
bottom: 4,
),
child: Text(
item,
style: Get.textTheme.bodyMedium,
),
),
),
)
.toList(),
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/follow_settings_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/settings/settings_action.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
import 'dart:io';
class FollowSettingsPage extends GetView {
const FollowSettingsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("关注设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
SettingsCard(
child: Column(
children: [
Obx(
() => SettingsSwitch(
value: controller.autoUpdateFollowEnable.value,
title: "自动更新关注直播状态",
onChanged: (e) {
controller.setAutoUpdateFollowEnable(e);
FollowService.instance.initTimer();
},
),
),
Obx(
() => Visibility(
visible: controller.autoUpdateFollowEnable.value,
child: AppStyle.divider,
),
),
Obx(
() => Visibility(
visible: controller.autoUpdateFollowEnable.value,
child: SettingsAction(
title: "自动更新间隔",
value:
"${controller.autoUpdateFollowDuration.value ~/ 60}小时${controller.autoUpdateFollowDuration.value % 60}分钟",
onTap: () {
setTimer(context);
},
),
),
),
AppStyle.divider,
Obx(
() {
var threadCount = controller.updateFollowThreadCount.value;
var displayValue = threadCount == 0
? "自动 (根据 CPU 核心数)"
: "$threadCount";
return SettingsAction(
title: "更新并发数",
subtitle: "0 = 自动根据 CPU 核心数优化(推荐),或手动设置 1-20",
value: displayValue,
onTap: () {
showConcurrencyDialog();
},
);
},
),
],
),
),
],
),
);
}
void setTimer(BuildContext context) async {
var value = await showTimePicker(
context: context,
initialTime: TimeOfDay(
hour: controller.autoUpdateFollowDuration.value ~/ 60,
minute: controller.autoUpdateFollowDuration.value % 60,
),
initialEntryMode: TimePickerEntryMode.inputOnly,
builder: (_, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat: true,
),
child: child!,
);
},
);
if (value == null || (value.hour == 0 && value.minute == 0)) {
return;
}
var duration = Duration(hours: value.hour, minutes: value.minute);
controller.setAutoUpdateFollowDuration(duration.inMinutes);
FollowService.instance.initTimer();
}
void showConcurrencyDialog() {
var currentValue = controller.updateFollowThreadCount.value;
var cpuCount = Platform.numberOfProcessors;
var autoValue = (cpuCount * 2.5).round().clamp(4, 20);
Get.dialog(
AlertDialog(
title: const Text("设置更新并发数"),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"CPU 核心数: $cpuCount",
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
Text(
"自动推荐值: $autoValue",
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
const SizedBox(height: 16),
const Text(
"选择并发数:",
style: TextStyle(fontSize: 14),
),
const SizedBox(height: 8),
// 快捷选项
Wrap(
spacing: 8,
runSpacing: 8,
children: [
_buildQuickOption(0, "自动 ($autoValue)", currentValue),
_buildQuickOption(4, "4", currentValue),
_buildQuickOption(8, "8", currentValue),
_buildQuickOption(12, "12", currentValue),
_buildQuickOption(16, "16", currentValue),
_buildQuickOption(20, "20", currentValue),
],
),
const SizedBox(height: 16),
// 自定义输入
TextField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: "自定义 (1-20)",
border: OutlineInputBorder(),
hintText: "输入 1-20 之间的数字",
),
onSubmitted: (value) {
var num = int.tryParse(value);
if (num != null && num >= 0 && num <= 20) {
controller.setUpdateFollowThreadCount(num);
Get.back();
}
},
),
],
),
actions: [
TextButton(
onPressed: () => Get.back(),
child: const Text("取消"),
),
],
),
);
}
Widget _buildQuickOption(int value, String label, int currentValue) {
var isSelected = currentValue == value;
return ChoiceChip(
label: Text(label),
selected: isSelected,
onSelected: (selected) {
if (selected) {
controller.setUpdateFollowThreadCount(value);
Get.back();
}
},
);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/indexed_settings/indexed_settings_controller.dart
================================================
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
class IndexedSettingsController extends GetxController {
RxList siteSort = RxList();
RxList homeSort = RxList();
@override
void onInit() {
siteSort = AppSettingsController.instance.siteSort;
homeSort = AppSettingsController.instance.homeSort;
super.onInit();
}
void updateSiteSort(int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final String item = siteSort.removeAt(oldIndex);
siteSort.insert(newIndex, item);
// ignore: invalid_use_of_protected_member
AppSettingsController.instance.setSiteSort(siteSort.value);
}
void updateHomeSort(int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final String item = homeSort.removeAt(oldIndex);
homeSort.insert(newIndex, item);
// ignore: invalid_use_of_protected_member
AppSettingsController.instance.setHomeSort(homeSort.value);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/indexed_settings/indexed_settings_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/settings/indexed_settings/indexed_settings_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
class IndexedSettingsPage extends GetView {
const IndexedSettingsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("主页设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
child: Text(
"主页排序 (长按拖动排序,重启后生效)",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => ReorderableListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
onReorder: controller.updateHomeSort,
children: controller.homeSort.map(
(key) {
var e = Constant.allHomePages[key]!;
return ListTile(
key: ValueKey(e.title),
title: Text(e.title),
visualDensity: VisualDensity.compact,
leading: Icon(e.iconData),
trailing: const Icon(Icons.drag_handle),
);
},
).toList(),
),
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"平台排序 (长按拖动排序,重启后生效)",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => ReorderableListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
onReorder: controller.updateSiteSort,
children: controller.siteSort.map(
(key) {
var e = Sites.allSites[key]!;
return ListTile(
key: ValueKey(e.id),
visualDensity: VisualDensity.compact,
title: Text(e.name),
leading: Image.asset(
e.logo,
width: 24,
height: 24,
),
trailing: const Icon(Icons.drag_handle),
);
},
).toList(),
),
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/other/other_settings_controller.dart
================================================
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:path/path.dart' as p;
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/services/local_storage_service.dart';
class OtherSettingsController extends BaseController {
RxList logFiles = [].obs;
var videoOutputDrivers = {
"gpu": "gpu",
"gpu-next": "gpu-next",
"xv": "xv (X11 only)",
"x11": "x11 (X11 only)",
"vdpau": "vdpau (X11 only)",
"direct3d": "direct3d (Windows only)",
"sdl": "sdl",
"dmabuf-wayland": "dmabuf-wayland",
"vaapi": "vaapi",
"null": "null",
"libmpv": "libmpv",
"mediacodec_embed": "mediacodec_embed (Android only)",
};
var audioOutputDrivers = {
"null": "null (No audio output)",
"pulse": "pulse (Linux, uses PulseAudio)",
"pipewire": "pipewire (Linux, via Pulse compatibility or native)",
"alsa": "alsa (Linux only)",
"oss": "oss (Linux only)",
"jack": "jack (Linux/macOS, low-latency audio)",
"directsound": "directsound (Windows only)",
"wasapi": "wasapi (Windows only)",
"winmm": "winmm (Windows only, legacy API)",
"audiounit": "audiounit (iOS only)",
"coreaudio": "coreaudio (macOS only)",
"opensles": "opensles (Android only)",
"audiotrack": "audiotrack (Android only)",
"aaudio": "aaudio (Android only)",
"pcm": "pcm (Cross-platform)",
"sdl": "sdl (Cross-platform, via SDL library)",
"openal": "openal (Cross-platform, OpenAL backend)",
"libao": "libao (Cross-platform, uses libao library)",
"auto": "auto (Not available)"
};
var hardwareDecoder = {
"no": "no",
"auto": "auto",
"auto-safe": "auto-safe",
"yes": "yes",
"auto-copy": "auto-copy",
"d3d11va": "d3d11va",
"d3d11va-copy": "d3d11va-copy",
"videotoolbox": "videotoolbox",
"videotoolbox-copy": "videotoolbox-copy",
"vaapi": "vaapi",
"vaapi-copy": "vaapi-copy",
"nvdec": "nvdec",
"nvdec-copy": "nvdec-copy",
"drm": "drm",
"drm-copy": "drm-copy",
"vulkan": "vulkan",
"vulkan-copy": "vulkan-copy",
"dxva2": "dxva2",
"dxva2-copy": "dxva2-copy",
"vdpau": "vdpau",
"vdpau-copy": "vdpau-copy",
"mediacodec": "mediacodec",
"mediacodec-copy": "mediacodec-copy",
"cuda": "cuda",
"cuda-copy": "cuda-copy",
"crystalhd": "crystalhd",
"rkmpp": "rkmpp"
};
@override
void onInit() {
loadLogFiles();
super.onInit();
}
void setLogEnable(e) {
AppSettingsController.instance.setLogEnable(e);
if (e) {
Log.initWriter();
Future.delayed(const Duration(milliseconds: 100), () {
loadLogFiles();
});
} else {
Log.disposeWriter();
}
}
void loadLogFiles() async {
var supportDir = await getApplicationSupportDirectory();
var logDir = Directory("${supportDir.path}/log");
if (!await logDir.exists()) {
await logDir.create();
}
logFiles.clear();
await logDir.list().forEach((element) {
var file = element as File;
var name = p.basename(file.path);
var time = file.lastModifiedSync();
var size = file.lengthSync();
logFiles.add(LogFileModel(name, file.path, time, size));
});
//logFiles 名称倒序
logFiles.sort((a, b) => b.time.compareTo(a.time));
}
void cleanLog() async {
if (AppSettingsController.instance.logEnable.value) {
SmartDialog.showToast("请先关闭日志记录");
return;
}
var supportDir = await getApplicationSupportDirectory();
var logDir = Directory("${supportDir.path}/log");
if (await logDir.exists()) {
await logDir.delete(recursive: true);
}
loadLogFiles();
}
void shareLogFile(LogFileModel item) {
SharePlus.instance.share(ShareParams(
files: [XFile(item.path)],
));
}
void saveLogFile(LogFileModel item) async {
var filePath = await FilePicker.platform.saveFile(
allowedExtensions: ['log'],
type: FileType.custom,
fileName: item.name,
bytes: Uint8List(0),
);
if (filePath != null) {
var file = File(item.path);
await file.copy(filePath);
SmartDialog.showToast("保存成功");
}
}
void exportConfig() async {
try {
// 组装数据
var data = {
"type": "simple_live",
"platform": Platform.operatingSystem,
"version": 1,
"time": DateTime.now().millisecondsSinceEpoch,
"config": LocalStorageService.instance.settingsBox.toMap(),
"shield": LocalStorageService.instance.shieldBox.toMap(),
};
var bytes = Uint8List.fromList(utf8.encode(jsonEncode(data)));
// FilePicker 直接写入
var inlineSave = Platform.isAndroid || Platform.isIOS || kIsWeb;
var path = await FilePicker.platform.saveFile(
allowedExtensions: ['json'],
type: FileType.custom,
fileName: "simple_live_config.json",
bytes: inlineSave ? bytes : null,
);
if (path == null && !kIsWeb) {
SmartDialog.showToast("保存取消");
return;
}
// 桌面平台需要手动写入
if (!inlineSave && path != null) {
await File(path).writeAsBytes(bytes);
}
SmartDialog.showToast("保存成功");
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("导出失败:$e");
}
}
void importConfig() async {
try {
var file = await FilePicker.platform.pickFiles(
allowedExtensions: ['json'],
type: FileType.custom,
);
if (file == null) {
return;
}
var filePath = file.files.single.path!;
var data = jsonDecode(await File(filePath).readAsString());
if (data["type"] != "simple_live") {
SmartDialog.showToast("不支持的配置文件");
return;
}
// 检查platform
if (data["platform"] != Platform.operatingSystem &&
!await Utils.showAlertDialog("导入配置文件平台不匹配,是否继续导入?", title: "平台不匹配")) {
return;
}
LocalStorageService.instance.settingsBox.clear();
LocalStorageService.instance.shieldBox.clear();
LocalStorageService.instance.settingsBox.putAll(data["config"]);
LocalStorageService.instance.shieldBox
.putAll(data["shield"].cast());
SmartDialog.showToast("导入成功,重启生效");
} catch (e) {
Log.logPrint(e);
SmartDialog.showToast("导入失败:$e");
}
}
void resetDefaultConfig() {
Utils.showAlertDialog("是否重置所有配置为默认值?").then((value) {
if (value) {
LocalStorageService.instance.settingsBox.clear();
LocalStorageService.instance.shieldBox.clear();
SmartDialog.showToast("重置成功,重启生效");
}
});
}
}
class LogFileModel {
late String name;
late String path;
late DateTime time;
late int size;
LogFileModel(this.name, this.path, this.time, this.size);
}
================================================
FILE: simple_live_app/lib/modules/settings/other/other_settings_page.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/settings/other/other_settings_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_menu.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
import 'package:url_launcher/url_launcher_string.dart';
class OtherSettingsPage extends GetView {
const OtherSettingsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("其他设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
SettingsCard(
child: Padding(
padding: AppStyle.edgeInsetsA4,
child: Row(
children: [
Expanded(
child: TextButton.icon(
onPressed: controller.exportConfig,
label: const Text("导出配置"),
icon: const Icon(Remix.export_line),
),
),
Expanded(
child: TextButton.icon(
onPressed: controller.importConfig,
label: const Text("导入配置"),
icon: const Icon(Remix.import_line),
),
),
Expanded(
child: TextButton.icon(
onPressed: controller.resetDefaultConfig,
label: const Text("重置配置"),
icon: const Icon(Remix.restart_line),
),
),
],
),
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"播放器高级设置",
style: Get.textTheme.titleSmall,
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
child: Text.rich(
TextSpan(
text: "请勿随意修改以下设置,除非你知道自己在做什么。\n在修改以下设置前,你应该先查阅",
children: [
WidgetSpan(
child: GestureDetector(
onTap: () {
launchUrlString(
"https://mpv.io/manual/stable/#video-output-drivers");
},
child: const Text(
"MPV的文档",
style: TextStyle(
color: Colors.blue,
fontSize: 12,
decoration: TextDecoration.underline,
),
),
),
),
],
),
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
),
SettingsCard(
child: Column(
children: [
Obx(
() => SettingsSwitch(
value:
AppSettingsController.instance.customPlayerOutput.value,
title: "自定义输出驱动与硬件加速",
onChanged: (e) {
AppSettingsController.instance.setCustomPlayerOutput(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsMenu(
title: "视频输出驱动(--vo)",
value:
AppSettingsController.instance.videoOutputDriver.value,
valueMap: controller.videoOutputDrivers,
onChanged: (e) {
AppSettingsController.instance.setVideoOutputDriver(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsMenu(
title: "音频输出驱动(--ao)",
value:
AppSettingsController.instance.audioOutputDriver.value,
valueMap: controller.audioOutputDrivers,
onChanged: (e) {
AppSettingsController.instance.setAudioOutputDriver(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsMenu(
title: "硬件解码器(--hwdec)",
value: AppSettingsController
.instance.videoHardwareDecoder.value,
valueMap: controller.hardwareDecoder,
onChanged: (e) {
AppSettingsController.instance.setVideoHardwareDecoder(e);
},
),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"日志记录",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
children: [
Obx(
() => SettingsSwitch(
value: AppSettingsController.instance.logEnable.value,
title: "开启日志记录",
subtitle: "开启后将记录调试日志,可以将日志文件提供给开发者用于排查问题",
onChanged: controller.setLogEnable,
),
),
],
),
),
ListTile(
contentPadding: AppStyle.edgeInsetsL12,
visualDensity: VisualDensity.compact,
title: Text(
"日志列表",
style: Get.textTheme.titleSmall,
),
trailing: TextButton.icon(
onPressed: () {
controller.cleanLog();
},
label: const Text("清空日志"),
icon: const Icon(Icons.clear_all),
),
),
SettingsCard(
child: SizedBox(
height: 300,
child: Obx(
() => ListView.separated(
itemCount: controller.logFiles.length,
separatorBuilder: (context, index) => AppStyle.divider,
itemBuilder: (context, index) {
var item = controller.logFiles[index];
return ListTile(
visualDensity: VisualDensity.compact,
contentPadding: AppStyle.edgeInsetsL12.copyWith(right: 4),
title: Text(item.name),
subtitle: Text(Utils.parseFileSize(item.size)),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (!Platform.isLinux)
IconButton(
onPressed: () {
controller.shareLogFile(item);
},
icon: const Icon(Icons.share),
),
IconButton(
onPressed: () {
controller.saveLogFile(item);
},
icon: const Icon(Icons.save),
),
],
),
);
},
),
),
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/settings/play_settings_page.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
import 'package:simple_live_app/widgets/settings/settings_menu.dart';
import 'package:simple_live_app/widgets/settings/settings_number.dart';
import 'package:simple_live_app/widgets/settings/settings_switch.dart';
class PlaySettingsPage extends GetView {
const PlaySettingsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("直播间设置"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
child: Text(
"播放器",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => SettingsSwitch(
title: "硬件解码",
value: controller.hardwareDecode.value,
subtitle: "播放失败可尝试关闭此选项",
onChanged: (e) {
controller.setHardwareDecode(e);
},
),
),
if (Platform.isAndroid) AppStyle.divider,
Obx(
() => Visibility(
visible: Platform.isAndroid,
child: SettingsSwitch(
title: "兼容模式",
subtitle: "若播放卡顿可尝试打开此选项",
value: controller.playerCompatMode.value,
onChanged: (e) {
controller.setPlayerCompatMode(e);
},
),
),
),
// AppStyle.divider,
// Obx(
// () => SettingsNumber(
// title: "缓冲区大小",
// subtitle: "若播放卡顿可尝试调高此选项",
// value: controller.playerBufferSize.value,
// min: 32,
// max: 1024,
// step: 4,
// unit: "MB",
// onChanged: (e) {
// controller.setPlayerBufferSize(e);
// },
// ),
// ),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "进入后台自动暂停",
value: controller.playerAutoPause.value,
onChanged: (e) {
controller.setPlayerAutoPause(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsMenu(
title: "画面尺寸",
value: controller.scaleMode.value,
valueMap: const {
0: "适应",
1: "拉伸",
2: "铺满",
3: "16:9",
4: "4:3",
},
onChanged: (e) {
controller.setScaleMode(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "使用HTTPS链接",
subtitle: "将http链接替换为https",
value: controller.playerForceHttps.value,
onChanged: (e) {
controller.setPlayerForceHttps(e);
},
),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"直播间",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => SettingsSwitch(
title: "进入直播间自动全屏",
value: controller.autoFullScreen.value,
onChanged: (e) {
controller.setAutoFullScreen(e);
},
),
),
AppStyle.divider,
Obx(
() => Visibility(
visible: Platform.isAndroid,
child: SettingsSwitch(
title: "进入小窗隐藏弹幕",
value: controller.pipHideDanmu.value,
onChanged: (e) {
controller.setPIPHideDanmu(e);
},
),
),
),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "播放器中显示SC",
value: controller.playershowSuperChat.value,
onChanged: (e) {
controller.setPlayerShowSuperChat(e);
},
),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"清晰度",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
children: [
Obx(
() => SettingsMenu(
title: "默认清晰度",
value: controller.qualityLevel.value,
valueMap: const {
0: "最低",
1: "中等",
2: "最高",
},
onChanged: (e) {
controller.setQualityLevel(e);
},
),
),
AppStyle.divider,
Obx(
() => SettingsMenu(
title: "数据网络清晰度",
value: controller.qualityLevelCellular.value,
valueMap: const {
0: "最低",
1: "中等",
2: "最高",
},
onChanged: (e) {
controller.setQualityLevelCellular(e);
},
),
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 24),
child: Text(
"聊天区",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Obx(
() => SettingsNumber(
title: "文字大小",
value: controller.chatTextSize.value.toInt(),
min: 8,
max: 36,
onChanged: (e) {
controller.setChatTextSize(e.toDouble());
},
),
),
AppStyle.divider,
Obx(
() => SettingsNumber(
title: "上下间隔",
value: controller.chatTextGap.value.toInt(),
min: 0,
max: 12,
onChanged: (e) {
controller.setChatTextGap(e.toDouble());
},
),
),
AppStyle.divider,
Obx(
() => SettingsSwitch(
title: "气泡样式",
value: controller.chatBubbleStyle.value,
onChanged: (e) {
controller.setChatBubbleStyle(e);
},
),
),
],
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/device/sync_device_controller.dart
================================================
import 'dart:convert';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/sync_client_info_model.dart';
import 'package:simple_live_app/requests/sync_client_request.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/sync_service.dart';
class SyncDeviceController extends BaseController {
final SyncClinet client;
final SyncClientInfoModel info;
SyncDeviceController({required this.client, required this.info});
SyncClientRequest request = SyncClientRequest();
Future showOverlayDialog() async {
var overlay = await Utils.showAlertDialog(
"是否覆盖远端数据?",
title: "数据覆盖",
confirm: "覆盖",
cancel: "不覆盖",
);
return overlay;
}
void syncFollowAndTag() async {
try {
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "同步中...");
var users = DBService.instance.getFollowList();
var tags = DBService.instance.getFollowTagList();
var data = json.encode(users.map((e) => e.toJson()).toList());
var dataT = json.encode(tags.map((e) => e.toJson()).toList());
await request.syncFollow(client, data, overlay: overlay);
// 标签和关注必须同时同步
await request.syncTag(client, dataT, overlay: overlay);
SmartDialog.showToast("已同步关注列表和标签");
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncHistory() async {
try {
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "同步中...");
var histores = DBService.instance.getHistores();
var data = json.encode(histores.map((e) => e.toJson()).toList());
await request.syncHistory(client, data, overlay: overlay);
SmartDialog.showToast("已同步历史记录");
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncBlockedWord() async {
try {
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "同步中...");
var shieldList = AppSettingsController.instance.shieldList;
var data = json.encode(shieldList.toList());
await request.syncBlockedWord(client, data, overlay: overlay);
SmartDialog.showToast("已同步屏蔽词");
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncBiliAccount() async {
try {
if (!BiliBiliAccountService.instance.logined.value) {
SmartDialog.showToast("未登录哔哩哔哩");
return;
}
SmartDialog.showLoading(msg: "同步中...");
await request.syncBiliAccount(
client, BiliBiliAccountService.instance.cookie);
SmartDialog.showToast("已同步哔哩哔哩账号");
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/device/sync_device_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/sync/local_sync/device/sync_device_controller.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
class SyncDevicePage extends GetView {
const SyncDevicePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("同步"),
),
body: ListView(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
children: [
SettingsCard(
child: ListTile(
leading: buildIcon(),
title: Text(controller.info.name),
subtitle: Text(
"${controller.info.type.toUpperCase()} ${controller.info.address}"),
),
),
AppStyle.vGap12,
SettingsCard(
child: Column(
children: [
ListTile(
leading: const Icon(Remix.heart_line),
title: const Text("同步关注列表"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncFollowAndTag();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Icons.history),
title: const Text("同步观看记录"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncHistory();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Remix.shield_keyhole_line),
title: const Text("同步弹幕屏蔽词"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncBlockedWord();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Remix.account_circle_line),
title: const Text("同步哔哩哔哩账号"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncBiliAccount();
},
),
],
),
),
],
),
);
}
Widget buildIcon() {
var icon = controller.info.type.toLowerCase();
if (icon == "android") {
return const Icon(Remix.android_line);
} else if (icon == "ios") {
return const Icon(Remix.apple_line);
} else if (icon == "tv") {
return const Icon(Remix.tv_2_line);
} else if (icon == "windows") {
return const Icon(Remix.microsoft_fill);
} else if (icon == "macos") {
return const Icon(Remix.mac_line);
} else if (icon == "linux") {
return const Icon(Remix.ubuntu_line);
} else {
return const Icon(Remix.device_line);
}
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/local_sync_controller.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/requests/sync_client_request.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/sync_service.dart';
class LocalSyncController extends BaseController {
final String? address;
LocalSyncController(this.address);
@override
void onInit() {
SyncService.instance.refreshClients();
Future.delayed(Duration.zero, initConnect);
super.onInit();
}
void initConnect() {
if (address != null && address!.isNotEmpty) {
addressController.text = address!;
connect();
}
}
TextEditingController addressController = TextEditingController();
SyncClientRequest request = SyncClientRequest();
void connect() async {
var address = addressController.text;
if (address.isEmpty) {
SmartDialog.showToast("请输入地址");
return;
}
if (address.startsWith('http')) {
var uri = Uri.tryParse(address);
if (uri != null) {
address = uri.host;
}
} else if (address.contains(':')) {
var parts = address.split(":");
address = parts.first;
}
var client = SyncClinet(
id: 'manual',
address: address,
port: SyncService.httpPort,
name: "手动输入",
type: Platform.operatingSystem,
);
connectClient(client);
}
void connectClient(SyncClinet client) async {
try {
SmartDialog.showLoading(msg: "连接中...");
var info = await request.getClientInfo(client);
AppNavigator.toSyncDevice(client, info);
} catch (e) {
SmartDialog.showToast("连接失败:$e");
} finally {
SmartDialog.dismiss();
}
}
void toScanQr() async {
var result = await Get.toNamed(RoutePath.kSyncScan);
if (result == null || result.isEmpty) {
return;
}
var addressList = (result as String).split(";");
if (addressList.length >= 2) {
//弹窗选择
showPickerAddress(addressList);
} else {
addressController.text = result;
//connect();
}
}
void showPickerAddress(List addressList) {
SmartDialog.showToast("扫描到多个地址,请选择一个连接");
Utils.showBottomSheet(
title: '请选择地址',
child: ListView.builder(
itemBuilder: (_, i) {
return ListTile(
title: Text(addressList[i]),
onTap: () {
Get.back();
addressController.text = addressList[i];
// connect();
},
);
},
itemCount: addressList.length,
),
);
}
void showInfo() {
Utils.showBottomSheet(
title: "本机信息",
child: Column(
children: [
Visibility(
visible: SyncService.instance.httpRunning.value,
child: GestureDetector(
onTap: () {
Get.back();
},
child: QrImageView(
data: SyncService.instance.ipAddress.value,
version: QrVersions.auto,
backgroundColor: Colors.white,
padding: AppStyle.edgeInsetsA12,
size: 200,
),
),
),
AppStyle.vGap24,
Visibility(
visible: SyncService.instance.httpRunning.value,
child: Text(
'服务已启动:${SyncService.instance.ipAddress.value.split(';').map((e) => '$e:${SyncService.httpPort}').join(';')}',
textAlign: TextAlign.center,
),
),
Visibility(
visible: !SyncService.instance.httpRunning.value,
child: Text(
'HTTP服务未启动:${SyncService.instance.httpErrorMsg},请尝试重启应用',
textAlign: TextAlign.center,
),
),
AppStyle.vGap12,
Visibility(
visible: SyncService.instance.httpRunning.value,
child: const Text(
"请使用其他Simple Live客户端扫描上方二维码\n建立连接后可选择需要同步的数据",
textAlign: TextAlign.center,
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/local_sync_page.dart
================================================
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/sync/local_sync/local_sync_controller.dart';
import 'package:simple_live_app/services/sync_service.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
class LocalSyncPage extends GetView {
const LocalSyncPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('局域网数据同步'),
actions: [
TextButton.icon(
onPressed: controller.showInfo,
icon: const Icon(Icons.qr_code),
label: const Text("信息"),
),
],
),
body: ListView(
padding: AppStyle.edgeInsetsA12,
children: [
SettingsCard(
child: Padding(
padding: AppStyle.edgeInsetsA12,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: controller.addressController,
onSubmitted: (e) {
controller.connect();
},
decoration: InputDecoration(
labelText: '客户端地址',
hintText: '请输入地址或扫码自动填写',
contentPadding: AppStyle.edgeInsetsH12,
border: const OutlineInputBorder(),
suffixIcon: Visibility(
visible: Platform.isAndroid || Platform.isIOS,
child: TextButton.icon(
onPressed: controller.toScanQr,
icon: const Icon(Remix.qr_scan_line),
label: const Text("扫一扫"),
),
),
),
),
AppStyle.vGap12,
ElevatedButton(
onPressed: () {
controller.connect();
},
child: const Text("连接"),
),
],
),
),
),
AppStyle.vGap12,
ListTile(
title: Obx(
() => Text(
"已发现设备(${SyncService.instance.scanClients.length})",
style: Get.textTheme.titleSmall,
),
),
visualDensity: VisualDensity.compact,
contentPadding: AppStyle.edgeInsetsH12,
trailing: IconButton(
visualDensity: VisualDensity.compact,
onPressed: () {
SyncService.instance.refreshClients();
},
icon: const Icon(Icons.refresh),
),
),
SettingsCard(
child: Obx(
() => ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, int index) =>
AppStyle.divider,
itemCount: SyncService.instance.scanClients.length,
itemBuilder: (BuildContext context, int index) {
var client = SyncService.instance.scanClients[index];
return ListTile(
title: Text(client.name),
subtitle: Text(client.address),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.connectClient(client);
},
);
},
),
),
),
AppStyle.vGap12,
const Text(
"如果无法扫描到设备,请手动输入地址",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
);
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/scan_qr/sync_scan_qr_controller.dart
================================================
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/routes/route_path.dart';
class SyncScanQRControlelr extends BaseController {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
QRViewController? qrController;
StreamSubscription? barcodeStreamSubscription;
bool pause = false;
void onQRViewCreated(QRViewController controller) {
qrController = controller;
barcodeStreamSubscription =
qrController!.scannedDataStream.listen((scanData) async {
Log.d(scanData.toString());
if (pause) {
return;
}
pause = true;
// 扫码成功后暂停摄像头
await controller.pauseCamera();
var code = scanData.code ?? "";
// 处理扫码结果
if (code.isEmpty) {
pause = false;
await controller.resumeCamera();
return;
}
// 如果是5位字符串,为房间号
if (code.length == 5) {
Get.offAndToNamed(RoutePath.kRemoteSyncRoom, arguments: code);
return;
} else {
var addressList = code.split(";");
if (addressList.length >= 2) {
//弹窗选择
showPickerAddress(addressList);
} else {
Get.back(result: code);
}
}
});
}
void showPickerAddress(List addressList) async {
SmartDialog.showToast("扫描到多个地址,请选择一个连接");
var address = await Utils.showBottomSheet(
title: '请选择地址',
child: ListView.builder(
itemBuilder: (_, i) {
return ListTile(
title: Text(addressList[i]),
onTap: () {
Get.back(result: addressList[i]);
},
);
},
itemCount: addressList.length,
),
);
if (address != null && address.isNotEmpty) {
Get.back(result: address);
}
}
@override
void onClose() {
barcodeStreamSubscription?.cancel();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/sync/local_sync/scan_qr/sync_scan_qr_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart';
import 'package:simple_live_app/modules/sync/local_sync/scan_qr/sync_scan_qr_controller.dart';
class SyncScanQRPage extends GetView {
const SyncScanQRPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('扫描二维码'),
actions: [
IconButton(
onPressed: () {
controller.qrController?.toggleFlash();
},
icon: const Icon(Icons.flash_on),
),
// 反转摄像头
IconButton(
onPressed: () {
controller.qrController?.flipCamera();
},
icon: const Icon(Icons.flip_camera_android),
),
],
),
body: Stack(
children: [
QRView(
key: controller.qrKey,
onQRViewCreated: controller.onQRViewCreated,
),
const ScanRectangle(),
],
),
);
}
}
class ScanRectangle extends StatefulWidget {
const ScanRectangle({super.key});
@override
State createState() => _ScanRectangleState();
}
class _ScanRectangleState extends State
with SingleTickerProviderStateMixin {
late AnimationController animeController;
late Animation animation;
@override
void initState() {
animeController =
AnimationController(duration: const Duration(seconds: 2), vsync: this);
animeController.addStatusListener((status) {
if (status == AnimationStatus.completed) {
animeController.reverse();
} else if (status == AnimationStatus.dismissed) {
animeController.forward();
}
});
animation = Tween(
begin: const Offset(0, 0),
end: const Offset(0, 1),
).animate(animeController);
animeController.forward();
super.initState();
}
@override
Widget build(BuildContext context) {
return Center(
child: Container(
height: 240,
width: 240,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey.withAlpha(50),
width: 2,
),
),
child: SlideTransition(
position: animation,
child: Container(
height: 240,
width: 240,
decoration: const BoxDecoration(
border: Border(
top: BorderSide(
width: 2,
color: Colors.green,
),
),
),
),
),
),
);
}
@override
void dispose() {
animeController.dispose();
super.dispose();
}
}
================================================
FILE: simple_live_app/lib/modules/sync/remote_sync/room/remote_sync_room_controller.dart
================================================
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/constant.dart';
import 'package:simple_live_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/models/db/history.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/signalr_service.dart';
class RemoteSyncRoomController extends BaseController {
final String roomId;
final SignalRService signalR = SignalRService();
RemoteSyncRoomController(this.roomId) {
if (roomId.isNotEmpty) {
currentRoomId.value = roomId;
}
}
StreamSubscription? _roomDestroyedSubscription;
StreamSubscription? _roomUserUpdatedSubscription;
StreamSubscription? _onFavoriteSubscription;
StreamSubscription? _onHistorySubscription;
StreamSubscription? _onShieldWordSubscription;
StreamSubscription? _onBiliAccountSubscription;
var currentRoomId = "--".obs;
RxList roomUsers = [].obs;
Timer? _timer;
var countDown = 600.obs;
@override
void onInit() {
connect();
super.onInit();
}
void connect() async {
listenSignalR();
await signalR.connect();
if (signalR.state == SignalRConnectionState.connected) {
if (roomId.isEmpty) {
createRoom();
} else {
joinRoom(roomId);
}
}
}
void createRoom() async {
try {
var resp = await signalR.createRoom();
if (resp.isSuccess) {
currentRoomId.value = resp.data!;
_startTimer();
} else {
SmartDialog.showToast(resp.message);
Get.back();
}
} catch (e) {
SmartDialog.showToast("创建房间失败");
Get.back();
}
}
void _startTimer() {
// 倒计时5分钟,自动关闭页面
countDown.value = 600;
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
countDown--;
if (countDown <= 0) {
timer.cancel();
Get.back();
}
});
}
void joinRoom(String roomId) async {
try {
var resp = await signalR.joinRoom(roomId);
if (!resp.isSuccess) {
SmartDialog.showToast(resp.message);
Get.back();
}
} catch (e) {
SmartDialog.showToast("加入房间失败");
Get.back();
}
}
void listenSignalR() {
_roomDestroyedSubscription = signalR.onRoomDestroyedStream.listen((roomId) {
SmartDialog.showToast("房间已被销毁");
Get.back();
});
_roomUserUpdatedSubscription = signalR.onRoomUserUpdatedStream.listen(
(roomUsers) {
this.roomUsers.assignAll(roomUsers);
},
);
_onFavoriteSubscription = signalR.onFavoriteStream.listen((data) {
onReceiveFavorite(data.$1, data.$2);
});
_onHistorySubscription = signalR.onHistoryStream.listen((data) {
onReceiveHistory(data.$1, data.$2);
});
_onShieldWordSubscription = signalR.onShieldWordStream.listen((data) {
onReceiveShieldWord(data.$1, data.$2);
});
_onBiliAccountSubscription = signalR.onBiliAccountStream.listen((data) {
onReceiveBiliAccount(data.$1, data.$2);
});
}
void onReceiveFavorite(bool overlay, String data) async {
try {
var jsonBody = json.decode(data);
if (overlay) {
await DBService.instance.followBox.clear();
}
for (var item in jsonBody) {
var user = FollowUser.fromJson(item);
await DBService.instance.followBox.put(user.id, user);
}
SmartDialog.showToast('已同步关注用户列表');
EventBus.instance.emit(Constant.kUpdateFollow, 0);
SmartDialog.showToast("已同步关注列表");
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
}
}
void onReceiveHistory(bool overlay, String data) async {
try {
var jsonBody = json.decode(data);
if (overlay) {
await DBService.instance.historyBox.clear();
}
for (var item in jsonBody) {
var history = History.fromJson(item);
if (DBService.instance.historyBox.containsKey(history.id)) {
var old = DBService.instance.historyBox.get(history.id);
//如果本地的更新时间比较新,就不更新
if (old!.updateTime.isAfter(history.updateTime)) {
continue;
}
}
await DBService.instance.addOrUpdateHistory(history);
}
SmartDialog.showToast('已同步历史记录');
EventBus.instance.emit(Constant.kUpdateHistory, 0);
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
}
}
void onReceiveShieldWord(bool overlay, String data) async {
try {
var jsonBody = json.decode(data);
if (overlay) {
AppSettingsController.instance.clearShieldList();
}
for (var item in jsonBody) {
// add to Hive
AppSettingsController.instance.addShieldList(item);
}
SmartDialog.showToast('已同步屏蔽词');
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
}
}
void onReceiveBiliAccount(bool overlay, String data) async {
try {
var jsonBody = json.decode(data);
var cookie = jsonBody['cookie'];
BiliBiliAccountService.instance.setCookie(cookie);
BiliBiliAccountService.instance.loadUserInfo();
SmartDialog.showToast('已同步哔哩哔哩账号');
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
}
}
Future showOverlayDialog() async {
var overlay = await Utils.showAlertDialog(
"是否覆盖远端数据?",
title: "数据覆盖",
confirm: "覆盖",
cancel: "不覆盖",
);
return overlay;
}
void syncFollow() async {
try {
if (roomUsers.length <= 1) {
SmartDialog.showToast("无设备连接");
return;
}
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "发送中...");
var users = DBService.instance.getFollowList();
var data = json.encode(users.map((e) => e.toJson()).toList());
var resp = await signalR.sendContent(
roomName: currentRoomId.value,
action: "SendFavorite",
overlay: overlay,
content: data,
);
if (resp.isSuccess) {
SmartDialog.showToast("已发送关注列表");
} else {
SmartDialog.showToast("发送失败:${resp.message}");
}
} catch (e) {
SmartDialog.showToast("发送失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncHistory() async {
try {
if (roomUsers.length <= 1) {
SmartDialog.showToast("无设备连接");
return;
}
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "发送中...");
var histores = DBService.instance.getHistores();
var data = json.encode(histores.map((e) => e.toJson()).toList());
var resp = await signalR.sendContent(
roomName: currentRoomId.value,
action: "SendHistory",
overlay: overlay,
content: data,
);
if (resp.isSuccess) {
SmartDialog.showToast("已发送历史记录");
} else {
SmartDialog.showToast("发送失败:${resp.message}");
}
} catch (e) {
SmartDialog.showToast("发送失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncBlockedWord() async {
try {
if (roomUsers.length <= 1) {
SmartDialog.showToast("无设备连接");
return;
}
var overlay = await showOverlayDialog();
SmartDialog.showLoading(msg: "发送中...");
var shieldList = AppSettingsController.instance.shieldList;
var data = json.encode(shieldList.toList());
var resp = await signalR.sendContent(
roomName: currentRoomId.value,
action: "SendShieldWord",
overlay: overlay,
content: data,
);
if (resp.isSuccess) {
SmartDialog.showToast("已发送屏蔽词");
} else {
SmartDialog.showToast("发送失败:${resp.message}");
}
} catch (e) {
SmartDialog.showToast("发送失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void syncBiliAccount() async {
try {
if (roomUsers.length <= 1) {
SmartDialog.showToast("无设备连接");
return;
}
if (!BiliBiliAccountService.instance.logined.value) {
SmartDialog.showToast("未登录哔哩哔哩");
return;
}
SmartDialog.showLoading(msg: "发送中...");
var resp = await signalR.sendContent(
roomName: currentRoomId.value,
action: "SendBiliAccount",
overlay: true,
content: json.encode({
"cookie": BiliBiliAccountService.instance.cookie,
}),
);
if (resp.isSuccess) {
SmartDialog.showToast("已发送哔哩哔哩账号");
} else {
SmartDialog.showToast("发送失败:${resp.message}");
}
} catch (e) {
SmartDialog.showToast("同步失败:$e");
Log.logPrint(e);
} finally {
SmartDialog.dismiss();
}
}
void showQRInfo() {
Utils.showBottomSheet(
title: "房间信息",
child: Column(
children: [
QrImageView(
data: currentRoomId.value,
version: QrVersions.auto,
backgroundColor: Colors.white,
padding: AppStyle.edgeInsetsA12,
size: 200,
),
AppStyle.vGap24,
Text(
currentRoomId.value,
textAlign: TextAlign.center,
style: Get.textTheme.titleLarge,
),
const Text(
"请使用其他Simple Live客户端扫描上方二维码\n建立连接后可选择需要同步的数据",
textAlign: TextAlign.center,
),
],
),
);
}
@override
void onClose() {
_timer?.cancel();
_roomDestroyedSubscription?.cancel();
_roomUserUpdatedSubscription?.cancel();
_onFavoriteSubscription?.cancel();
_onHistorySubscription?.cancel();
_onShieldWordSubscription?.cancel();
_onBiliAccountSubscription?.cancel();
signalR.dispose();
super.onClose();
}
}
================================================
FILE: simple_live_app/lib/modules/sync/remote_sync/room/remote_sync_room_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/sync/remote_sync/room/remote_sync_room_controller.dart';
import 'package:simple_live_app/services/signalr_service.dart';
import 'package:simple_live_app/widgets/settings/settings_card.dart';
class RemoteSyncRoomPage extends GetView {
const RemoteSyncRoomPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("数据同步"),
actions: [
Padding(
padding: AppStyle.edgeInsetsH12,
child: StreamBuilder(
stream: controller.signalR.stateStream,
builder: (context, snapshot) {
if (snapshot.hasData) {
switch (snapshot.data) {
case SignalRConnectionState.connected:
return Row(
children: [
Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
),
AppStyle.hGap8,
const Text(
'已连接',
style: TextStyle(
fontSize: 14,
),
),
],
);
case SignalRConnectionState.disconnected:
return Row(
children: [
Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
AppStyle.hGap8,
const Text(
'断开连接',
style: TextStyle(
fontSize: 14,
),
),
],
);
default:
return const Row(
children: [
SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
),
),
Text(
'连接中',
style: TextStyle(
fontSize: 14,
),
),
],
);
}
}
return const SizedBox();
},
),
),
],
),
body: ListView(
padding: AppStyle.edgeInsetsA12.copyWith(top: 0),
children: [
Visibility(
visible: controller.roomId.isEmpty,
child: SettingsCard(
child: ListTile(
visualDensity: VisualDensity.compact,
leading: const Icon(Remix.timer_line),
title: Obx(
() => Text(
"${controller.countDown.value}秒后房间将会自动关闭",
style: const TextStyle(fontSize: 14),
),
),
),
),
),
Padding(
padding: AppStyle.edgeInsetsA12,
child: Text(
"房间号",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => ListTile(
contentPadding: AppStyle.edgeInsetsL12,
title: SelectableText(
controller.currentRoomId.value,
style: Theme.of(context).textTheme.titleLarge,
),
trailing: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: const Icon(
Icons.copy,
size: 20,
),
onPressed: () {
Utils.copyToClipboard(controller.currentRoomId.value);
},
),
IconButton(
icon: const Icon(
Icons.qr_code,
size: 20,
),
onPressed: () {
controller.showQRInfo();
},
),
AppStyle.hGap4,
],
),
),
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 12),
child: Text(
"同步数据至其他设备",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Remix.heart_line),
title: const Text("发送关注列表"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncFollow();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Icons.history),
title: const Text("发送观看记录"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncHistory();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Remix.shield_keyhole_line),
title: const Text("发送弹幕屏蔽词"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncBlockedWord();
},
),
AppStyle.divider,
ListTile(
leading: const Icon(Remix.account_circle_line),
title: const Text("发送哔哩哔哩账号"),
trailing: const Icon(Icons.chevron_right),
onTap: () {
controller.syncBiliAccount();
},
),
],
),
),
Padding(
padding: AppStyle.edgeInsetsA12.copyWith(top: 12),
child: Text(
"已连接设备",
style: Get.textTheme.titleSmall,
),
),
SettingsCard(
child: Obx(
() => ListView.separated(
padding: EdgeInsets.zero,
itemCount: controller.roomUsers.length,
shrinkWrap: true,
separatorBuilder: (context, index) => AppStyle.divider,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
var user = controller.roomUsers[index];
return ListTile(
visualDensity: VisualDensity.compact,
leading: SizedBox(
width: 48,
height: 48,
child: Center(
child: buildIcon(user.platform),
),
),
title: Text.rich(
TextSpan(
text: user.shortId,
style: const TextStyle(fontSize: 16),
children: user.isCreator!
? [
WidgetSpan(
child: Container(
margin: AppStyle.edgeInsetsL4,
padding: AppStyle.edgeInsetsH4,
decoration: BoxDecoration(
border: Border.all(color: Colors.blue),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
"创建者",
style: TextStyle(
color: Colors.blue,
fontSize: 12,
),
),
),
),
]
: null,
),
),
subtitle: Text("${user.app} - v${user.version}"),
trailing: Visibility(
visible: controller.signalR.hubConnection?.connectionId ==
user.connectionId,
child: const Text(
"本机",
),
),
);
},
),
),
)
],
),
);
}
Widget buildIcon(String platform) {
if (platform == "android") {
return const Icon(Remix.android_line);
} else if (platform == "ios") {
return const Icon(Remix.apple_line);
} else if (platform == "tv") {
return const Icon(Remix.tv_2_line);
} else if (platform == "windows") {
return const Icon(Remix.microsoft_fill);
} else if (platform == "xbox") {
return const Icon(Remix.xbox_line);
} else if (platform == "macos") {
return const Icon(Remix.mac_line);
} else if (platform == "linux") {
return const Icon(Remix.ubuntu_line);
} else {
return const Icon(Remix.device_line);
}
}
}
================================================
FILE: simple_live_app/lib/modules/sync/remote_sync/webdav/remote_sync_webdav_config_page.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/modules/sync/remote_sync/webdav/remote_sync_webdav_controller.dart';
import 'package:simple_live_app/widgets/none_border_circular_textfield.dart';
class RemoteSyncWebDAVConfigPage extends StatefulWidget {
const RemoteSyncWebDAVConfigPage({super.key});
@override
State createState() =>
_RemoteSyncWebDAVConfigPageState();
}
class _RemoteSyncWebDAVConfigPageState
extends State