diff --git a/lib/common/widgets/list_sheet.dart b/lib/common/widgets/list_sheet.dart index 8bd36d894..37a29850d 100644 --- a/lib/common/widgets/list_sheet.dart +++ b/lib/common/widgets/list_sheet.dart @@ -37,7 +37,7 @@ class ListSheet { aid: aid, currentCid: currentCid, changeFucCall: changeFucCall, - onClose: SmartDialog.dismiss, + // onClose: SmartDialog.dismiss, )); } } @@ -50,7 +50,7 @@ class ListSheetContent extends StatefulWidget { this.aid, required this.currentCid, required this.changeFucCall, - required this.onClose, + // required this.onClose, }); final dynamic episodes; @@ -58,7 +58,7 @@ class ListSheetContent extends StatefulWidget { final int? aid; final int currentCid; final Function changeFucCall; - final Function() onClose; + // final Function() onClose; @override State createState() => _ListSheetContentState(); @@ -112,7 +112,8 @@ class _ListSheetContentState extends State { } } SmartDialog.showToast('切换到:$title'); - widget.onClose(); + // widget.onClose(); + Get.back(); if (episode.runtimeType.toString() == "EpisodeItem") { widget.changeFucCall(episode.bvid, episode.cid, episode.aid); } else { @@ -218,7 +219,7 @@ class _ListSheetContentState extends State { IconButton( tooltip: '关闭', icon: const Icon(Icons.close), - onPressed: widget.onClose, + onPressed: Get.back, ), ], ), diff --git a/lib/common/widgets/overlay_pop.dart b/lib/common/widgets/overlay_pop.dart index 54605990b..7a478861a 100644 --- a/lib/common/widgets/overlay_pop.dart +++ b/lib/common/widgets/overlay_pop.dart @@ -10,10 +10,9 @@ import '../constants.dart'; import 'network_img_layer.dart'; class OverlayPop extends StatelessWidget { - const OverlayPop({super.key, this.videoItem, this.closeFn}); + const OverlayPop({super.key, this.videoItem}); final dynamic videoItem; - final Function? closeFn; @override Widget build(BuildContext context) { @@ -55,7 +54,7 @@ class OverlayPop extends StatelessWidget { style: ButtonStyle( padding: WidgetStateProperty.all(EdgeInsets.zero), ), - onPressed: () => closeFn!(), + onPressed: Get.back, icon: const Icon( Icons.close, size: 18, diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index d3150272a..3e78a77ba 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -98,12 +98,7 @@ class VideoCardH extends StatelessWidget { useSystem: true, alignment: Alignment.center, builder: (BuildContext context) { - return OverlayPop( - videoItem: videoItem, - closeFn: () { - SmartDialog.dismiss(); - }, - ); + return OverlayPop(videoItem: videoItem); }, ); }, diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 8bd4a646f..cfcd89d76 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -174,12 +174,7 @@ class VideoCardV extends StatelessWidget { useSystem: true, alignment: Alignment.center, builder: (BuildContext context) { - return OverlayPop( - videoItem: videoItem, - closeFn: () { - SmartDialog.dismiss(); - }, - ); + return OverlayPop(videoItem: videoItem); }, ); }, diff --git a/lib/pages/dynamics/widgets/video_panel.dart b/lib/pages/dynamics/widgets/video_panel.dart index bc1fa1180..e3a7e3495 100644 --- a/lib/pages/dynamics/widgets/video_panel.dart +++ b/lib/pages/dynamics/widgets/video_panel.dart @@ -95,12 +95,7 @@ Widget videoSeasonWidget(item, context, type, source, {floor = 1}) { useSystem: true, alignment: Alignment.center, builder: (BuildContext context) { - return OverlayPop( - videoItem: content, - closeFn: () { - SmartDialog.dismiss(); - }, - ); + return OverlayPop(videoItem: content); }, ); }, diff --git a/lib/pages/live/widgets/live_item.dart b/lib/pages/live/widgets/live_item.dart index 86df5ca52..861951839 100644 --- a/lib/pages/live/widgets/live_item.dart +++ b/lib/pages/live/widgets/live_item.dart @@ -62,12 +62,7 @@ class LiveCardV extends StatelessWidget { useSystem: true, alignment: Alignment.center, builder: (BuildContext context) { - return OverlayPop( - videoItem: liveItem, - closeFn: () { - SmartDialog.dismiss(); - }, - ); + return OverlayPop(videoItem: liveItem); }, ); }, diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index 4e7195f52..2b6701529 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -161,7 +161,7 @@ class _HeaderControlState extends State { key: const Key('onlyPlayAudio'), icon: Icons.hourglass_top_outlined, onTap: () { - SmartDialog.dismiss(); + Get.back(); scheduleExit(); }, text: "定时关闭", @@ -171,10 +171,10 @@ class _HeaderControlState extends State { ActionRowLineItem( icon: Icons.watch_later_outlined, onTap: () async { + Get.back(); final res = await UserHttp.toViewLater( bvid: widget.videoDetailCtr!.bvid); SmartDialog.showToast(res['msg']); - SmartDialog.dismiss(); }, text: "稍后看", selectStatus: false, @@ -184,9 +184,10 @@ class _HeaderControlState extends State { key: const Key('continuePlayInBackground'), icon: Icons.refresh_outlined, onTap: () { - widget.controller!.setContinuePlayInBackground(null); + Get.back(); + widget.videoDetailCtr!.queryVideoUrl(); }, - text: "重载视频", + text: "刷新", selectStatus: false, ), ]), @@ -198,14 +199,15 @@ class _HeaderControlState extends State { children: [ Obx( () => ActionRowLineItem( - key: const Key('flipX'), - icon: Icons.flip, + key: const Key('continuePlayInBackground'), + icon: MdiIcons.locationExit, onTap: () { - widget.controller!.flipX.value = - !widget.controller!.flipX.value; + widget.controller! + .setContinuePlayInBackground(null); }, - text: "镜像翻转", - selectStatus: widget.controller!.flipX.value, + text: "后台续播", + selectStatus: + widget.controller!.continuePlayInBackground.value, ), ), const SizedBox(width: 8), @@ -221,20 +223,19 @@ class _HeaderControlState extends State { ), ), const SizedBox(width: 8), - // const SizedBox(width: 10), Obx( () => ActionRowLineItem( - key: const Key('continuePlayInBackground'), - icon: MdiIcons.locationExit, + key: const Key('flipX'), + icon: Icons.flip, onTap: () { - widget.controller! - .setContinuePlayInBackground(null); + widget.controller!.flipX.value = + !widget.controller!.flipX.value; }, - text: "后台续播", - selectStatus: - widget.controller!.continuePlayInBackground.value, + text: "镜像", + selectStatus: widget.controller!.flipX.value, ), ), + // const SizedBox(width: 10), ], ), ), @@ -516,7 +517,7 @@ class _HeaderControlState extends State { style: subTitleStyle, ), onTap: () async { - SmartDialog.dismiss(); + Get.back(); String? result = await showDialog( context: context, builder: (context) { @@ -601,7 +602,7 @@ class _HeaderControlState extends State { isSending = false; // 发送结束,更新状态 }); if (res['status']) { - SmartDialog.dismiss(); + Get.back(); SmartDialog.showToast('发送成功'); // 发送成功,自动预览该弹幕,避免重新请求 // TODO: 暂停状态下预览弹幕仍会移动与计时,可考虑添加到dmSegList或其他方式实现 @@ -666,7 +667,7 @@ class _HeaderControlState extends State { shutdownTimerService.scheduledExitInMinutes = choice; shutdownTimerService.startShutdownTimer(); - SmartDialog.dismiss(); + Get.back(); }, contentPadding: const EdgeInsets.only(), dense: true, @@ -841,7 +842,7 @@ class _HeaderControlState extends State { .description; setting.put( SettingBoxKey.defaultVideoQa, quality); - SmartDialog.dismiss(); + Get.back(); SmartDialog.showToast( "默认画质由:$oldQualityDesc 变为:${VideoQualityCode.fromCode(quality)!.description}"); widget.videoDetailCtr!.updatePlayer(); @@ -920,7 +921,7 @@ class _HeaderControlState extends State { AudioQuality.values.last.code))! .description; setting.put(SettingBoxKey.defaultAudioQa, quality); - SmartDialog.dismiss(); + Get.back(); SmartDialog.showToast( "默认音质由:$oldQualityDesc 变为:${AudioQualityCode.fromCode(quality)!.description}"); widget.videoDetailCtr!.updatePlayer(); @@ -999,7 +1000,7 @@ class _HeaderControlState extends State { widget.videoDetailCtr!.currentDecodeFormats = VideoDecodeFormatsCode.fromString(i)!; widget.videoDetailCtr!.updatePlayer(); - SmartDialog.dismiss(); + Get.back(); }, dense: true, contentPadding: @@ -1115,7 +1116,7 @@ class _HeaderControlState extends State { ), onPressed: () { // 弹出对话框 - SmartDialog.dismiss(); + Get.back(); showDialog( context: context, useSafeArea: true, @@ -1454,7 +1455,7 @@ class _HeaderControlState extends State { ListTile( onTap: () { widget.controller!.setPlayRepeat(i); - SmartDialog.dismiss(); + Get.back(); }, dense: true, contentPadding: diff --git a/lib/services/shutdown_timer_service.dart b/lib/services/shutdown_timer_service.dart index 2ecc17db4..9bb80f20b 100644 --- a/lib/services/shutdown_timer_service.dart +++ b/lib/services/shutdown_timer_service.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:PiliPalaX/plugin/pl_player/index.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; class ShutdownTimerService with WidgetsBindingObserver { static final ShutdownTimerService _instance = @@ -60,7 +61,7 @@ class ShutdownTimerService with WidgetsBindingObserver { child: const Text('确认'), onPressed: () { cancelShutdownTimer(); - SmartDialog.dismiss(); + Get.back(); }, ), ], @@ -81,7 +82,7 @@ class ShutdownTimerService with WidgetsBindingObserver { // Start the 10-second timer to auto close the dialog _autoCloseDialogTimer?.cancel(); _autoCloseDialogTimer = Timer(const Duration(seconds: 10), () { - SmartDialog.dismiss(); // Close the dialog + Get.back(); _executeShutdown(); }); return AlertDialog( @@ -91,16 +92,15 @@ class ShutdownTimerService with WidgetsBindingObserver { TextButton( child: const Text('取消关闭'), onPressed: () { - _autoCloseDialogTimer?.cancel(); // Cancel the auto-close timer - cancelShutdownTimer(); // Cancel the shutdown timer - SmartDialog.dismiss(); // Close the dialog + Get.back(); + _autoCloseDialogTimer?.cancel(); + cancelShutdownTimer(); }, ), ], ); }, ).then((_) { - // Cleanup when the dialog is dismissed _autoCloseDialogTimer?.cancel(); }); }