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