mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: reply2reply: query root
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -193,6 +193,17 @@ class GrpcRepo {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future replyInfo({
|
||||||
|
required int rpid,
|
||||||
|
}) async {
|
||||||
|
return await _request(() async {
|
||||||
|
final request = ReplyInfoReq()..rpid = Int64(rpid);
|
||||||
|
final response = await GrpcClient.instance.replyClient
|
||||||
|
.replyInfo(request, options: options);
|
||||||
|
return {'status': true, 'data': response.reply};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static Future mainList({
|
static Future mainList({
|
||||||
int type = 1,
|
int type = 1,
|
||||||
required int oid,
|
required int oid,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart';
|
import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||||
|
import 'package:PiliPalaX/grpc/grpc_repo.dart';
|
||||||
import 'package:PiliPalaX/http/loading_state.dart';
|
import 'package:PiliPalaX/http/loading_state.dart';
|
||||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -42,6 +43,8 @@ class VideoReplyReplyController extends CommonController
|
|||||||
AnimationController? controller;
|
AnimationController? controller;
|
||||||
Animation<Color?>? colorAnimation;
|
Animation<Color?>? colorAnimation;
|
||||||
|
|
||||||
|
ReplyInfo? firstFloor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -77,8 +80,21 @@ class VideoReplyReplyController extends CommonController
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future queryData([bool isRefresh = true]) {
|
Future queryData([bool isRefresh = true]) async {
|
||||||
if (['没有更多了', '还没有评论'].contains(noMore.value)) return Future.value();
|
if (['没有更多了', '还没有评论'].contains(noMore.value)) return Future.value();
|
||||||
|
if (!isDialogue &&
|
||||||
|
currentPage == 1 &&
|
||||||
|
!hasRoot &&
|
||||||
|
firstFloor == null &&
|
||||||
|
rpid != null) {
|
||||||
|
await GrpcRepo.replyInfo(
|
||||||
|
rpid: rpid!,
|
||||||
|
).then((res) {
|
||||||
|
if (res['status'] && (res['data']?.mid ?? -1) > 0) {
|
||||||
|
firstFloor = res['data'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return super.queryData(isRefresh);
|
return super.queryData(isRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
late final itemPositionsListener = ItemPositionsListener.create();
|
late final itemPositionsListener = ItemPositionsListener.create();
|
||||||
late final _key = GlobalKey<ScaffoldState>();
|
late final _key = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
ReplyInfo? get firstFloor =>
|
||||||
|
widget.firstFloor ?? _videoReplyReplyController.firstFloor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -75,7 +78,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget get _header => widget.firstFloor == null
|
Widget get _header => firstFloor == null
|
||||||
? _sortWidget
|
? _sortWidget
|
||||||
: ValueListenableBuilder<Iterable<ItemPosition>>(
|
: ValueListenableBuilder<Iterable<ItemPosition>>(
|
||||||
valueListenable: itemPositionsListener.itemPositions,
|
valueListenable: itemPositionsListener.itemPositions,
|
||||||
@@ -147,16 +150,16 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
return Obx(() => _buildBody(
|
return Obx(() => _buildBody(
|
||||||
_videoReplyReplyController.loadingState.value,
|
_videoReplyReplyController.loadingState.value,
|
||||||
index));
|
index));
|
||||||
} else if (widget.firstFloor != null) {
|
} else if (firstFloor != null) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return ReplyItemGrpc(
|
return ReplyItemGrpc(
|
||||||
replyItem: widget.firstFloor!,
|
replyItem: firstFloor!,
|
||||||
replyLevel: '2',
|
replyLevel: '2',
|
||||||
showReplyRow: false,
|
showReplyRow: false,
|
||||||
replyType: widget.replyType,
|
replyType: widget.replyType,
|
||||||
needDivider: false,
|
needDivider: false,
|
||||||
onReply: () {
|
onReply: () {
|
||||||
_onReply(widget.firstFloor!);
|
_onReply(firstFloor!);
|
||||||
},
|
},
|
||||||
upMid: _videoReplyReplyController.upMid,
|
upMid: _videoReplyReplyController.upMid,
|
||||||
);
|
);
|
||||||
@@ -390,7 +393,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
return (loadingState is Success ? loadingState.response.length : 0) + 1;
|
return (loadingState is Success ? loadingState.response.length : 0) + 1;
|
||||||
}
|
}
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
if (widget.firstFloor != null) {
|
if (firstFloor != null) {
|
||||||
itemCount = 2;
|
itemCount = 2;
|
||||||
}
|
}
|
||||||
if (loadingState is Success) {
|
if (loadingState is Success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user