mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-29 06:50:12 +08:00
opt ui
opt video keyboard event opt code Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -49,7 +49,6 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:PiliPlus/utils/video_utils.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart' show Options;
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
@@ -1129,15 +1128,14 @@ class VideoDetailController extends GetxController
|
||||
_querySponsorBlock();
|
||||
}
|
||||
if (plPlayerController.cacheVideoQa == null) {
|
||||
await Connectivity().checkConnectivity().then((res) {
|
||||
plPlayerController
|
||||
..cacheVideoQa = res.contains(ConnectivityResult.wifi)
|
||||
? Pref.defaultVideoQa
|
||||
: Pref.defaultVideoQaCellular
|
||||
..cacheAudioQa = res.contains(ConnectivityResult.wifi)
|
||||
? Pref.defaultAudioQa
|
||||
: Pref.defaultAudioQaCellular;
|
||||
});
|
||||
final isWiFi = await Utils.isWiFi;
|
||||
plPlayerController
|
||||
..cacheVideoQa = isWiFi
|
||||
? Pref.defaultVideoQa
|
||||
: Pref.defaultVideoQaCellular
|
||||
..cacheAudioQa = isWiFi
|
||||
? Pref.defaultAudioQa
|
||||
: Pref.defaultAudioQaCellular;
|
||||
}
|
||||
|
||||
var result = await VideoHttp.videoUrl(
|
||||
|
||||
@@ -278,7 +278,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
children: [
|
||||
if (replyItem.replyControl.isUpTop) ...[
|
||||
const WidgetSpan(
|
||||
alignment: PlaceholderAlignment.top,
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: PBadge(
|
||||
text: 'TOP',
|
||||
size: PBadgeSize.small,
|
||||
|
||||
@@ -35,6 +35,7 @@ import 'package:PiliPlus/pages/video/reply/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/view.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_reply/view.dart';
|
||||
import 'package:PiliPlus/pages/video/view_point/view.dart';
|
||||
import 'package:PiliPlus/pages/video/widgets/focus.dart';
|
||||
import 'package:PiliPlus/pages/video/widgets/header_control.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
@@ -59,8 +60,7 @@ import 'package:floating/floating.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart'
|
||||
show SystemUiOverlayStyle, KeyDownEvent, LogicalKeyboardKey;
|
||||
import 'package:flutter/services.dart' show SystemUiOverlayStyle;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
@@ -1506,19 +1506,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
} else {
|
||||
child = autoChoose(childWhenDisabledAlmostSquare);
|
||||
}
|
||||
child = Focus(
|
||||
onKeyEvent: (node, event) {
|
||||
if (event is KeyDownEvent &&
|
||||
(event.logicalKey == LogicalKeyboardKey.arrowLeft ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowRight ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowUp ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowDown)) {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: child,
|
||||
);
|
||||
child = focus(child);
|
||||
return videoDetailController.plPlayerController.darkVideoPage
|
||||
? Theme(data: themeData, child: child)
|
||||
: child;
|
||||
|
||||
16
lib/pages/video/widgets/focus.dart
Normal file
16
lib/pages/video/widgets/focus.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show LogicalKeyboardKey;
|
||||
|
||||
Widget focus(Widget child) => Focus(
|
||||
onKeyEvent: (node, event) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.tab ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowLeft ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowRight ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowUp ||
|
||||
event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: child,
|
||||
);
|
||||
@@ -34,7 +34,6 @@ import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:PiliPlus/utils/video_utils.dart';
|
||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
@@ -678,18 +677,12 @@ class HeaderControlState extends TripleState<HeaderControl> {
|
||||
|
||||
// update
|
||||
if (!plPlayerController.tempPlayerConf) {
|
||||
final res = await Connectivity().checkConnectivity();
|
||||
if (res.contains(ConnectivityResult.wifi)) {
|
||||
setting.put(
|
||||
SettingBoxKey.defaultVideoQa,
|
||||
quality,
|
||||
);
|
||||
} else {
|
||||
setting.put(
|
||||
SettingBoxKey.defaultVideoQaCellular,
|
||||
quality,
|
||||
);
|
||||
}
|
||||
setting.put(
|
||||
await Utils.isWiFi
|
||||
? SettingBoxKey.defaultVideoQa
|
||||
: SettingBoxKey.defaultVideoQaCellular,
|
||||
quality,
|
||||
);
|
||||
}
|
||||
},
|
||||
// 可能包含会员解锁画质
|
||||
@@ -755,18 +748,12 @@ class HeaderControlState extends TripleState<HeaderControl> {
|
||||
|
||||
// update
|
||||
if (!plPlayerController.tempPlayerConf) {
|
||||
final res = await Connectivity().checkConnectivity();
|
||||
if (res.contains(ConnectivityResult.wifi)) {
|
||||
setting.put(
|
||||
SettingBoxKey.defaultAudioQa,
|
||||
quality,
|
||||
);
|
||||
} else {
|
||||
setting.put(
|
||||
SettingBoxKey.defaultAudioQaCellular,
|
||||
quality,
|
||||
);
|
||||
}
|
||||
setting.put(
|
||||
await Utils.isWiFi
|
||||
? SettingBoxKey.defaultAudioQa
|
||||
: SettingBoxKey.defaultAudioQaCellular,
|
||||
quality,
|
||||
);
|
||||
}
|
||||
},
|
||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
||||
|
||||
Reference in New Issue
Block a user