mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
chore: code clean up
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -282,7 +282,7 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
}).toList();
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,7 +572,7 @@ class VideoDetailController extends GetxController
|
||||
return result;
|
||||
}
|
||||
final List<VideoItem> allVideosList = data.dash!.video!;
|
||||
// print("allVideosList:${allVideosList}");
|
||||
// debugPrint("allVideosList:${allVideosList}");
|
||||
// 当前可播放的最高质量视频
|
||||
int currentHighVideoQa = allVideosList.first.quality!.code;
|
||||
// 预设的画质为null,则当前可用的最高质量
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:math';
|
||||
|
||||
import 'package:PiliPalaX/grpc/grpc_repo.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/http/member.dart';
|
||||
import 'package:PiliPalaX/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -24,8 +23,6 @@ import 'package:PiliPalaX/utils/feed_back.dart';
|
||||
import 'package:PiliPalaX/utils/id_utils.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:PiliPalaX/pages/member/controller.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../../http/search.dart';
|
||||
import '../../../../models/model_hot_video_item.dart';
|
||||
@@ -180,7 +177,6 @@ class VideoIntroController extends GetxController
|
||||
Future queryUserStat() async {
|
||||
var result = await UserHttp.userStat(mid: videoDetail.value.owner!.mid!);
|
||||
if (result['status']) {
|
||||
print(result['data']);
|
||||
userStat.value = result['data'];
|
||||
userStat.refresh();
|
||||
}
|
||||
@@ -288,7 +284,6 @@ class VideoIntroController extends GetxController
|
||||
void coinVideo(int coin) async {
|
||||
var res = await VideoHttp.coinVideo(bvid: bvid, multiply: coin);
|
||||
if (res['status']) {
|
||||
print(res);
|
||||
SmartDialog.showToast('投币成功');
|
||||
hasCoin.value = true;
|
||||
videoDetail.value.stat!.coin = videoDetail.value.stat!.coin! + coin;
|
||||
@@ -393,7 +388,7 @@ class VideoIntroController extends GetxController
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore: avoid_print
|
||||
print(e);
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
var result = await VideoHttp.favVideo(
|
||||
|
||||
@@ -115,14 +115,14 @@ class VideoInfo extends StatefulWidget {
|
||||
final Function showEpisodes;
|
||||
|
||||
const VideoInfo({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.loadingStatus = false,
|
||||
this.videoDetail,
|
||||
this.heroTag,
|
||||
required this.showAiBottomSheet,
|
||||
required this.showIntroDetail,
|
||||
required this.showEpisodes,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
State<VideoInfo> createState() => _VideoInfoState();
|
||||
@@ -300,10 +300,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
const SizedBox(height: 0),
|
||||
Obx(
|
||||
() => Text(
|
||||
Utils.numFormat(videoIntroController
|
||||
.userStat.value['follower']),
|
||||
semanticsLabel:
|
||||
"${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝",
|
||||
'${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: t.colorScheme.outline,
|
||||
|
||||
@@ -17,7 +17,7 @@ class ActionItem extends StatefulWidget {
|
||||
final Function? callBack;
|
||||
|
||||
const ActionItem({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.icon,
|
||||
this.selectIcon,
|
||||
this.onTap,
|
||||
@@ -29,7 +29,7 @@ class ActionItem extends StatefulWidget {
|
||||
this.hasOneThree = false,
|
||||
this.callBack,
|
||||
required this.semanticsLabel,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
State<ActionItem> createState() => ActionItemState();
|
||||
|
||||
@@ -11,7 +11,7 @@ class ActionRowItem extends StatelessWidget {
|
||||
final Function? onLongPress;
|
||||
|
||||
const ActionRowItem({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.icon,
|
||||
this.selectIcon,
|
||||
this.onTap,
|
||||
@@ -19,7 +19,7 @@ class ActionRowItem extends StatelessWidget {
|
||||
this.text,
|
||||
this.selectStatus = false,
|
||||
this.onLongPress,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -6,8 +6,6 @@ import 'package:PiliPalaX/http/member.dart';
|
||||
import 'package:PiliPalaX/models/member/tags.dart';
|
||||
import 'package:PiliPalaX/utils/feed_back.dart';
|
||||
|
||||
import '../../../../../utils/utils.dart';
|
||||
|
||||
class GroupPanel extends StatefulWidget {
|
||||
final int? mid;
|
||||
final List? tags;
|
||||
|
||||
@@ -12,7 +12,7 @@ class MenuRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.only(top: 9, bottom: 9, left: 12),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -84,7 +84,7 @@ class MenuRow extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: selectStatus
|
||||
? Theme.of(context).colorScheme.onBackground
|
||||
? Theme.of(context).colorScheme.onSurface
|
||||
: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -770,7 +770,7 @@ InlineSpan buildContent(
|
||||
0;
|
||||
isValid = seek * 1000 <= duration;
|
||||
} catch (e) {
|
||||
print('failed to validate: $e');
|
||||
debugPrint('failed to validate: $e');
|
||||
}
|
||||
spanChildren.add(
|
||||
TextSpan(
|
||||
|
||||
@@ -155,7 +155,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -43,7 +43,7 @@ import '../../../services/shutdown_timer_service.dart';
|
||||
import 'widgets/header_control.dart';
|
||||
|
||||
class VideoDetailPage extends StatefulWidget {
|
||||
const VideoDetailPage({Key? key}) : super(key: key);
|
||||
const VideoDetailPage({super.key});
|
||||
|
||||
@override
|
||||
State<VideoDetailPage> createState() => _VideoDetailPageState();
|
||||
@@ -355,7 +355,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
}
|
||||
super.didPopNext();
|
||||
videoDetailController.isFirstTime = false;
|
||||
final bool autoplay = autoPlayEnable;
|
||||
// final bool autoplay = autoPlayEnable;
|
||||
videoDetailController.autoPlay.value =
|
||||
!videoDetailController.isShowCover.value;
|
||||
if (videoDetailController.videoUrl != null) {
|
||||
@@ -372,11 +372,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
videoIntroController.isPaused = false;
|
||||
// if (autoplay) {
|
||||
// // await Future.delayed(const Duration(milliseconds: 300));
|
||||
// print(plPlayerController);
|
||||
// debugPrint(plPlayerController);
|
||||
// if (plPlayerController?.buffered.value == Duration.zero) {
|
||||
// _bufferedListener = plPlayerController?.buffered.listen((p0) {
|
||||
// print("p0");
|
||||
// print(p0);
|
||||
// debugPrint("p0");
|
||||
// debugPrint(p0);
|
||||
// if (p0 > Duration.zero) {
|
||||
// _bufferedListener!.cancel();
|
||||
// plPlayerController?.seekTo(videoDetailController.defaultST);
|
||||
@@ -463,7 +463,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
() {
|
||||
double videoHeight = context.width * 9 / 16;
|
||||
final double videoWidth = context.width;
|
||||
// print(videoDetailController.tabCtr.index);
|
||||
// debugPrint(videoDetailController.tabCtr.index);
|
||||
if (enableVerticalExpand &&
|
||||
plPlayerController?.direction.value == 'vertical') {
|
||||
videoHeight = context.width;
|
||||
|
||||
@@ -10,9 +10,9 @@ class AiDetail extends StatelessWidget {
|
||||
final ModelResult? modelResult;
|
||||
|
||||
const AiDetail({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.modelResult,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -6,12 +6,12 @@ class ScrollAppBar extends StatelessWidget {
|
||||
final Function callback;
|
||||
final PlayerStatus playerStatus;
|
||||
|
||||
const ScrollAppBar(
|
||||
this.scrollVal,
|
||||
this.callback,
|
||||
this.playerStatus,
|
||||
Key? key,
|
||||
) : super(key: key);
|
||||
const ScrollAppBar({
|
||||
super.key,
|
||||
required this.scrollVal,
|
||||
required this.callback,
|
||||
required this.playerStatus,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -29,7 +29,7 @@ class ScrollAppBar extends StatelessWidget {
|
||||
opacity: scrollDistance / (videoHeight - kToolbarHeight),
|
||||
child: Container(
|
||||
height: statusBarHeight + kToolbarHeight,
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: EdgeInsets.only(top: statusBarHeight),
|
||||
child: AppBar(
|
||||
primary: false,
|
||||
|
||||
@@ -167,9 +167,9 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
// scale: 0.75,
|
||||
// child: Switch(
|
||||
// thumbIcon: WidgetStateProperty.resolveWith<Icon?>(
|
||||
// (Set<MaterialState> states) {
|
||||
// (Set<WidgetState> states) {
|
||||
// if (states.isNotEmpty &&
|
||||
// states.first == MaterialState.selected) {
|
||||
// states.first == WidgetState.selected) {
|
||||
// return const Icon(Icons.done);
|
||||
// }
|
||||
// return null; // All other states will use the default thumbIcon.
|
||||
@@ -1328,7 +1328,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _ = widget.controller!;
|
||||
final plPlayerController = widget.controller!;
|
||||
// final bool isLandscape =
|
||||
// MediaQuery.of(context).orientation == Orientation.landscape;
|
||||
|
||||
@@ -1475,20 +1475,22 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
height: 34,
|
||||
child: Obx(
|
||||
() => IconButton(
|
||||
tooltip: "${_.isOpenDanmu.value ? '关闭' : '开启'}弹幕",
|
||||
tooltip:
|
||||
"${plPlayerController.isOpenDanmu.value ? '关闭' : '开启'}弹幕",
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () {
|
||||
_.isOpenDanmu.value = !_.isOpenDanmu.value;
|
||||
setting.put(
|
||||
SettingBoxKey.enableShowDanmaku, _.isOpenDanmu.value);
|
||||
plPlayerController.isOpenDanmu.value =
|
||||
!plPlayerController.isOpenDanmu.value;
|
||||
setting.put(SettingBoxKey.enableShowDanmaku,
|
||||
plPlayerController.isOpenDanmu.value);
|
||||
SmartDialog.showToast(
|
||||
"已${_.isOpenDanmu.value ? '开启' : '关闭'}弹幕",
|
||||
"已${plPlayerController.isOpenDanmu.value ? '开启' : '关闭'}弹幕",
|
||||
displayTime: const Duration(seconds: 1));
|
||||
},
|
||||
icon: Icon(
|
||||
_.isOpenDanmu.value
|
||||
plPlayerController.isOpenDanmu.value
|
||||
? Icons.subtitles_outlined
|
||||
: Icons.subtitles_off_outlined,
|
||||
size: 19,
|
||||
@@ -1514,7 +1516,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
bool enableBackgroundPlay = setting.get(
|
||||
SettingBoxKey.enableBackgroundPlay,
|
||||
defaultValue: false);
|
||||
if (!enableBackgroundPlay) {
|
||||
if (!enableBackgroundPlay && context.mounted) {
|
||||
// SmartDialog.showToast('建议开启【后台播放】功能\n避免画中画没有暂停按钮');
|
||||
// await Future.delayed(const Duration(seconds: 2), () {
|
||||
// });
|
||||
@@ -1551,7 +1553,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
}),
|
||||
),
|
||||
onPressed: () async {
|
||||
_.setBackgroundPlay(true);
|
||||
plPlayerController
|
||||
.setBackgroundPlay(true);
|
||||
SmartDialog.showToast("请重新载入本页面刷新");
|
||||
// Get.back();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user