Skip to content

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

feat: player animation switcher

Predidit837db925964f
diff --git a/lib/pages/player/smallest_player_item_panel.dart b/lib/pages/player/smallest_player_item_panel.dart
index 74375c1b..20c7fd4d 100644
--- a/lib/pages/player/smallest_player_item_panel.dart
+++ b/lib/pages/player/smallest_player_item_panel.dart
@@ -178,23 +178,40 @@ class _SmallestPlayerItemPanelState extends State<SmallestPlayerItemPanel> {
left: 0,
right: 0,
child: Visibility(
- visible: !playerController.lockPanel,
- child: SlideTransition(
- position: topOffsetAnimation,
- child: Container(
- height: 50,
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- Colors.black45,
- Colors.transparent,
- ],
+ visible: !playerController.lockPanel &&
+ (widget.disableAnimations
+ ? playerController.showVideoController
+ : true),
+ child: widget.disableAnimations
+ ? Container(
+ height: 50,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Colors.black45,
+ Colors.transparent,
+ ],
+ ),
+ ),
+ )
+ : SlideTransition(
+ position: topOffsetAnimation,
+ child: Container(
+ height: 50,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Colors.black45,
+ Colors.transparent,
+ ],
+ ),
+ ),
+ ),
),
- ),
- ),
- ),
),
),
@@ -205,23 +222,40 @@ class _SmallestPlayerItemPanelState extends State<SmallestPlayerItemPanel> {
left: 0,
right: 0,
child: Visibility(
- visible: !playerController.lockPanel,
- child: SlideTransition(
- position: bottomOffsetAnimation,
- child: Container(
- height: 50,
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- Colors.transparent,
- Colors.black45,
- ],
+ visible: !playerController.lockPanel &&
+ (widget.disableAnimations
+ ? playerController.showVideoController
+ : true),
+ child: widget.disableAnimations
+ ? Container(
+ height: 100,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Colors.transparent,
+ Colors.black45,
+ ],
+ ),
+ ),
+ )
+ : SlideTransition(
+ position: bottomOffsetAnimation,
+ child: Container(
+ height: 100,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Colors.transparent,
+ Colors.black45,
+ ],
+ ),
+ ),
+ ),
),
- ),
- ),
- ),
),
),
// 顶部进度条
diff --git a/lib/pages/settings/player_settings.dart b/lib/pages/settings/player_settings.dart
index 990ebbcc..3c0e9194 100644
--- a/lib/pages/settings/player_settings.dart
+++ b/lib/pages/settings/player_settings.dart
@@ -26,6 +26,7 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
late bool showPlayerError;
late bool privateMode;
late bool playerDebugMode;
+ late bool playerDisableAnimations;
final MenuController menuController = MenuController();
@override
@@ -46,6 +47,8 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
setting.get(SettingBoxKey.showPlayerError, defaultValue: true);
playerDebugMode =
setting.get(SettingBoxKey.playerDebugMode, defaultValue: false);
+ playerDisableAnimations =
+ setting.get(SettingBoxKey.playerDisableAnimations, defaultValue: false);
}
void onBackPressed(BuildContext context) {
@@ -143,6 +146,17 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
description: const Text('跳转到上次播放位置'),
initialValue: playResume,
),
+ SettingsTile.switchTile(
+ onToggle: (value) async {
+ playerDisableAnimations = value ?? !playerDisableAnimations;
+ await setting.put(SettingBoxKey.playerDisableAnimations,
+ playerDisableAnimations);
+ setState(() {});
+ },
+ title: const Text('禁用动画'),
+ description: const Text('禁用播放器内的过渡动画'),
+ initialValue: playerDisableAnimations,
+ ),
SettingsTile.switchTile(
onToggle: (value) async {
showPlayerError = value ?? !showPlayerError;
diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart
index 81998f69..20a0aed2 100644
--- a/lib/pages/video/video_page.dart
+++ b/lib/pages/video/video_page.dart
@@ -1,5 +1,4 @@
import 'dart:async';
-import 'dart:io';
import 'package:canvas_danmaku/models/danmaku_content_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
@@ -68,10 +67,8 @@ class _VideoPageState extends State<VideoPage>
// The first parameter is the video source URL and the second parameter is the video offset (start position)
late final StreamSubscription<(String, int)> _videoURLSubscription;
- // disable animation on linux to avoid fucked-up gtk shared openGL context issue.
- // damn gtk can't even handle opengl context on other thread correctly.
- // we can only disable animation to avoid falling into the gtk/flutter/mpv openGL context interoper hell.
- final bool disableAnimations = Platform.isLinux;
+ // disable animation.
+ late final bool disableAnimations;
@override
void initState() {
@@ -105,6 +102,8 @@ class _VideoPageState extends State<VideoPage>
videoPageController.historyOffset = 0;
videoPageController.showTabBody = true;
playResume = setting.get(SettingBoxKey.playResume, defaultValue: true);
+ disableAnimations =
+ setting.get(SettingBoxKey.playerDisableAnimations, defaultValue: false);
var progress = historyController.lastWatching(
videoPageController.bangumiItem,
videoPageController.currentPlugin.name);
diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart
index 5af313b6..11d845ab 100644
--- a/lib/utils/storage.dart
+++ b/lib/utils/storage.dart
@@ -252,5 +252,6 @@ class SettingBoxKey {
syncPlayEndPoint = 'syncPlayEndPoint',
androidEnableOpenSLES = 'androidEnableOpenSLES',
defaultSuperResolutionType = 'defaultSuperResolutionType',
- superResolutionWarn = 'superResolutionWarn';
+ superResolutionWarn = 'superResolutionWarn',
+ playerDisableAnimations = 'playerDisableAnimations';
}