mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: reply ctr
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -12,7 +12,6 @@ class BangumiController extends CommonController {
|
||||
BangumiController({required this.tabType});
|
||||
final TabType tabType;
|
||||
|
||||
bool isLoadingMore = true;
|
||||
RxBool isLogin = false.obs;
|
||||
int? mid;
|
||||
dynamic userInfo;
|
||||
|
||||
@@ -18,20 +18,17 @@ import 'package:get/get_navigation/src/dialog/dialog_route.dart';
|
||||
|
||||
abstract class ReplyController extends CommonController {
|
||||
String nextOffset = '';
|
||||
bool isLoadingMore = false;
|
||||
RxInt count = (-1).obs;
|
||||
|
||||
ReplySortType sortType = ReplySortType.time;
|
||||
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||
RxString sortTypeLabel = ReplySortType.time.labels.obs;
|
||||
Rx<ReplySortType> sortType = ReplySortType.time.obs;
|
||||
|
||||
late final savedReplies = {};
|
||||
|
||||
late bool isLogin = GStorage.userInfo.get('userInfoCache') != null;
|
||||
late final bool isLogin = GStorage.userInfo.get('userInfoCache') != null;
|
||||
|
||||
CursorReply? cursor;
|
||||
late Mode mode = Mode.MAIN_LIST_HOT;
|
||||
bool hasUpTop = false;
|
||||
late bool hasUpTop = false;
|
||||
|
||||
late final banWordForReply = GStorage.banWordForReply;
|
||||
|
||||
@@ -44,10 +41,8 @@ abstract class ReplyController extends CommonController {
|
||||
GStorage.setting.put(SettingBoxKey.replySortType, 0);
|
||||
defaultReplySortIndex = 0;
|
||||
}
|
||||
sortType = ReplySortType.values[defaultReplySortIndex];
|
||||
sortTypeTitle.value = sortType.titles;
|
||||
sortTypeLabel.value = sortType.labels;
|
||||
if (sortType == ReplySortType.time) {
|
||||
sortType.value = ReplySortType.values[defaultReplySortIndex];
|
||||
if (sortType.value == ReplySortType.time) {
|
||||
mode = Mode.MAIN_LIST_TIME;
|
||||
}
|
||||
}
|
||||
@@ -119,18 +114,16 @@ abstract class ReplyController extends CommonController {
|
||||
queryBySort() {
|
||||
EasyThrottle.throttle('queryBySort', const Duration(seconds: 1), () {
|
||||
feedBack();
|
||||
switch (sortType) {
|
||||
switch (sortType.value) {
|
||||
case ReplySortType.time:
|
||||
sortType = ReplySortType.like;
|
||||
sortType.value = ReplySortType.like;
|
||||
mode = Mode.MAIN_LIST_HOT;
|
||||
break;
|
||||
case ReplySortType.like:
|
||||
sortType = ReplySortType.time;
|
||||
sortType.value = ReplySortType.time;
|
||||
mode = Mode.MAIN_LIST_TIME;
|
||||
break;
|
||||
}
|
||||
sortTypeTitle.value = sortType.titles;
|
||||
sortTypeLabel.value = sortType.labels;
|
||||
nextOffset = '';
|
||||
loadingState.value = LoadingState.loading();
|
||||
onRefresh();
|
||||
|
||||
@@ -54,7 +54,7 @@ class DynamicDetailController extends ReplyController {
|
||||
oid: oid!,
|
||||
nextOffset: nextOffset,
|
||||
type: type!,
|
||||
sort: sortType.index,
|
||||
sort: sortType.value.index,
|
||||
page: currentPage,
|
||||
banWordForReply: banWordForReply,
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate
|
||||
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -464,7 +465,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
label: Obx(() => Text(
|
||||
_dynamicDetailController.sortTypeLabel.value,
|
||||
_dynamicDetailController.sortType.value.label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
|
||||
@@ -64,7 +64,7 @@ class HtmlRenderController extends ReplyController {
|
||||
oid: oid.value,
|
||||
nextOffset: nextOffset,
|
||||
type: type,
|
||||
sort: sortType.index,
|
||||
sort: sortType.value.index,
|
||||
page: currentPage,
|
||||
banWordForReply: banWordForReply,
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/common/widgets/article_content.dart';
|
||||
import 'package:PiliPlus/common/widgets/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -517,7 +518,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
icon: const Icon(Icons.sort, size: 16),
|
||||
label: Obx(
|
||||
() => Text(
|
||||
_htmlRenderCtr.sortTypeLabel.value,
|
||||
_htmlRenderCtr.sortType.value.label,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1986,7 +1986,7 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.replySortType,
|
||||
leading: const Icon(Icons.whatshot_outlined),
|
||||
getSubtitle: () =>
|
||||
'当前优先展示「${ReplySortType.values[GStorage.defaultReplySort].titles}」',
|
||||
'当前优先展示「${ReplySortType.values[GStorage.defaultReplySort].title}」',
|
||||
onTap: (setState) async {
|
||||
int? result = await showDialog(
|
||||
context: Get.context!,
|
||||
@@ -1995,7 +1995,7 @@ List<SettingsModel> get extraSettings => [
|
||||
title: '评论展示',
|
||||
value: GStorage.defaultReplySort,
|
||||
values: ReplySortType.values.map((e) {
|
||||
return {'title': e.titles, 'value': e.index};
|
||||
return {'title': e.title, 'value': e.index};
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ class VideoReplyController extends ReplyController {
|
||||
oid: aid!,
|
||||
nextOffset: nextOffset,
|
||||
type: ReplyType.video.index,
|
||||
sort: sortType.index,
|
||||
sort: sortType.value.index,
|
||||
page: currentPage,
|
||||
banWordForReply: banWordForReply,
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/http_error.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -146,7 +147,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
'${_videoReplyController.sortTypeLabel.value}评论',
|
||||
_videoReplyController.sortType.value.title,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
),
|
||||
@@ -162,7 +163,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
),
|
||||
label: Obx(
|
||||
() => Text(
|
||||
_videoReplyController.sortTypeLabel.value,
|
||||
_videoReplyController.sortType.value.label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color:
|
||||
|
||||
Reference in New Issue
Block a user