refa player (#1848)

* tweak

* Reapply "opt: audio uri" (#1833)

This reverts commit 8e726f49b2.

* opt: player

* opt: player

* refa: create player

* refa: player

* opt: UaType

* fix: sb seek preview

* opt: setSub

* fix: screenshot

* opt: unnecessary final player state

* opt: player track

* opt FileSource constructor [skip ci]

* fixes

* fix: dispose player

* fix: quote

* update

* fix: multi ua & remove unused loop

* remove unneeded check [skip ci]

---------

Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2026-02-27 15:51:55 +08:00
committed by GitHub
parent 6782bee11a
commit 7276cde48a
39 changed files with 1063 additions and 1112 deletions

View File

@@ -21,13 +21,10 @@ enum _ShutdownType with EnumWithLabel {
const _ShutdownType(this.label);
}
final shutdownTimerService = ShutdownTimerService();
final shutdownTimerService = ShutdownTimerService._internal();
class ShutdownTimerService {
ShutdownTimerService._internal();
factory ShutdownTimerService() => _instance;
static final ShutdownTimerService _instance =
ShutdownTimerService._internal();
VoidCallback? onPause;
ValueGetter<bool>? isPlaying;
@@ -37,8 +34,8 @@ class ShutdownTimerService {
int _durationInMinutes = 0;
_ShutdownType _shutdownType = .pause;
bool? _isWaiting;
bool get isWaiting => _isWaiting ?? false;
bool _isWaiting = false;
bool get isWaiting => _isWaiting;
bool _waitUntilCompleted = false;
void _stopTimer() {
@@ -50,7 +47,7 @@ class ShutdownTimerService {
void reset([int durationInMinutes = 0]) {
_stopTimer();
_isWaiting = null;
_isWaiting = false;
_durationInMinutes = durationInMinutes;
}
@@ -100,7 +97,7 @@ class ShutdownTimerService {
void handleWaiting() {
switch (_shutdownType) {
case _ShutdownType.pause:
_isWaiting = null;
_isWaiting = false;
_durationInMinutes = 0;
SmartDialog.showToast('定时时间已到,已暂停');
case _ShutdownType.exit: