mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 20:14:51 +08:00
@@ -1,21 +1,10 @@
|
||||
import 'package:PiliPlus/models/common/later_view_type.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/pages/common/play_all_btn_mixin.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LaterBaseController extends GetxController {
|
||||
class LaterBaseController extends GetxController with PlayAllBtnMixin {
|
||||
RxBool enableMultiSelect = false.obs;
|
||||
RxInt checkedCount = 0.obs;
|
||||
|
||||
RxList<int> counts = List.filled(LaterViewType.values.length, -1).obs;
|
||||
|
||||
late double dx = 0;
|
||||
late final RxBool isPlayAll = Pref.enablePlayAll.obs;
|
||||
|
||||
void setIsPlayAll(bool isPlayAll) {
|
||||
if (this.isPlayAll.value == isPlayAll) return;
|
||||
this.isPlayAll.value = isPlayAll;
|
||||
GStorage.setting.put(SettingBoxKey.enablePlayAll, isPlayAll);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,31 +126,7 @@ class _LaterPageState extends State<LaterPage>
|
||||
padding: const .only(right: kFloatingActionButtonMargin),
|
||||
child: Obx(
|
||||
() => currCtr().loadingState.value.isSuccess
|
||||
? AnimatedSlide(
|
||||
offset: _baseCtr.isPlayAll.value
|
||||
? Offset.zero
|
||||
: const Offset(0.75, 0),
|
||||
duration: const Duration(milliseconds: 120),
|
||||
child: GestureDetector(
|
||||
onHorizontalDragDown: (details) =>
|
||||
_baseCtr.dx = details.localPosition.dx,
|
||||
onHorizontalDragStart: (details) =>
|
||||
_baseCtr.setIsPlayAll(
|
||||
details.localPosition.dx < _baseCtr.dx,
|
||||
),
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
if (_baseCtr.isPlayAll.value) {
|
||||
currCtr().toViewPlayAll();
|
||||
} else {
|
||||
_baseCtr.setIsPlayAll(true);
|
||||
}
|
||||
},
|
||||
label: const Text('播放全部'),
|
||||
icon: const Icon(Icons.playlist_play),
|
||||
),
|
||||
),
|
||||
)
|
||||
? _baseCtr.playAllBtn(currCtr().toViewPlayAll)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user