Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

feat: take screenshot

ErBW_s773bf27b436c
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 37a7503e..0d71e0f3 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -1,60 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
+<dict>
+ <key>NSPhotoLibraryAddUsageDescription</key>
+ <string></string>
+ <key>CADisableMinimumFrameDurationOnPhone</key>
+ <true/>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleDisplayName</key>
+ <string>Kazumi</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>kazumi</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>$(FLUTTER_BUILD_NAME)</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>$(FLUTTER_BUILD_NUMBER)</string>
+ <key>LSApplicationQueriesSchemes</key>
+ <array>
+ <string>vlc-x-callback</string>
+ </array>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSAppTransportSecurity</key>
<dict>
- <key>CADisableMinimumFrameDurationOnPhone</key>
+ <key>NSAllowsArbitraryLoads</key>
<true/>
- <key>CFBundleDevelopmentRegion</key>
- <string>$(DEVELOPMENT_LANGUAGE)</string>
- <key>CFBundleDisplayName</key>
- <string>Kazumi</string>
- <key>CFBundleExecutable</key>
- <string>$(EXECUTABLE_NAME)</string>
- <key>CFBundleIdentifier</key>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>kazumi</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>$(FLUTTER_BUILD_NAME)</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>$(FLUTTER_BUILD_NUMBER)</string>
- <key>LSApplicationQueriesSchemes</key>
- <array>
- <string>vlc-x-callback</string>
- </array>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>NSAppTransportSecurity</key>
- <dict>
- <key>NSAllowsArbitraryLoads</key>
- <true/>
- </dict>
- <key>UIApplicationSupportsIndirectInputEvents</key>
- <true/>
- <key>UILaunchStoryboardName</key>
- <string>LaunchScreen</string>
- <key>UIMainStoryboardFile</key>
- <string>Main</string>
- <key>UISupportedInterfaceOrientations</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
- </array>
- <key>UISupportedInterfaceOrientations~ipad</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
- </array>
- <key>UIStatusBarHidden</key>
- <false/>
</dict>
+ <key>UIApplicationSupportsIndirectInputEvents</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UIStatusBarHidden</key>
+ <false/>
+</dict>
</plist>
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 86bb96c4..623cdc00 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -31,6 +31,7 @@ import 'package:kazumi/bean/appbar/drag_to_move_bar.dart' as dtb;
import 'package:kazumi/pages/settings/danmaku/danmaku_settings_window.dart';
import 'package:kazumi/utils/constants.dart';
import 'package:kazumi/pages/player/episode_comments_sheet.dart';
+import 'package:saver_gallery/saver_gallery.dart';
class PlayerItem extends StatefulWidget {
const PlayerItem(
@@ -679,6 +680,20 @@ class _PlayerItemState extends State<PlayerItem>
} catch (_) {}
}
+ Future<void> _handleScreenshot() async {
+ try {
+ Uint8List? screenshot = await playerController.mediaPlayer.screenshot(format: 'image/png');
+ final result = await SaverGallery.saveImage(screenshot!, fileName: DateTime.timestamp().toString(), skipIfExists: true);
+ if (result.isSuccess) {
+ SmartDialog.showToast('截图保存到相簿成功');
+ } else {
+ SmartDialog.showToast('截图保存失败:${result.errorMessage}');
+ }
+ } catch (_) {
+ SmartDialog.showToast('截图失败');
+ }
+ }
+
@override
void onWindowRestore() {
danmakuController.onClear();
@@ -1296,19 +1311,34 @@ class _PlayerItemState extends State<PlayerItem>
bottom: 0,
child: SlideTransition(
position: _leftOffsetAnimation,
- child: IconButton(
- icon: Icon(
- lockPanel
- ? Icons.lock_outline
- : Icons.lock_open,
- color: Colors.white,
+ child: Column(children: [
+ const Spacer(),
+ (lockPanel)
+ ? Container()
+ : IconButton(
+ icon: const Icon(
+ Icons.photo_camera_outlined,
+ color: Colors.white,
+ ),
+ onPressed: () {
+ _handleScreenshot();
+ },
+ ),
+ IconButton(
+ icon: Icon(
+ lockPanel
+ ? Icons.lock_outline
+ : Icons.lock_open,
+ color: Colors.white,
+ ),
+ onPressed: () {
+ setState(() {
+ lockPanel = !lockPanel;
+ });
+ },
),
- onPressed: () {
- setState(() {
- lockPanel = !lockPanel;
- });
- },
- ),
+ const Spacer(),
+ ]),
),
),
diff --git a/pubspec.lock b/pubspec.lock
index 82e0f1b7..23948616 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1011,6 +1011,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
+ saver_gallery:
+ dependency: "direct main"
+ description:
+ name: saver_gallery
+ sha256: bf59475e50b73d666630bed7a5fdb621fed92d637f64e3c61ce81653ec6a833c
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.0.1"
screen_brightness_android:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 3170c5e9..ba0c6f20 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -75,6 +75,7 @@ dependencies:
flutter_rating_bar: ^4.0.1
scrollview_observer: ^1.22.0
styled_text: ^8.1.0
+ saver_gallery: ^4.0.0
webview_windows:
git:
url: https://github.com/Predidit/flutter-webview-windows.git