mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
@@ -61,8 +61,7 @@ class ActionPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
onPressed: () =>
|
onPressed: () => PageUtils.pushDynDetail(item, isPush: true),
|
||||||
PageUtils.pushDynDetail(item, isPush: true, viewReply: true),
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
FontAwesomeIcons.comment,
|
FontAwesomeIcons.comment,
|
||||||
size: 16,
|
size: 16,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import 'package:PiliPlus/models/dynamics/result.dart';
|
|||||||
import 'package:PiliPlus/pages/common/dyn/common_dyn_controller.dart';
|
import 'package:PiliPlus/pages/common/dyn/common_dyn_controller.dart';
|
||||||
import 'package:PiliPlus/utils/id_utils.dart';
|
import 'package:PiliPlus/utils/id_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||||
import 'package:flutter/material.dart' show GlobalKey, Scrollable;
|
|
||||||
import 'package:flutter/scheduler.dart' show SchedulerBinding;
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class DynamicDetailController extends CommonDynController {
|
class DynamicDetailController extends CommonDynController {
|
||||||
@@ -19,18 +17,12 @@ class DynamicDetailController extends CommonDynController {
|
|||||||
@override
|
@override
|
||||||
dynamic get sourceId => replyType == 1 ? IdUtils.av2bv(oid) : oid;
|
dynamic get sourceId => replyType == 1 ? IdUtils.av2bv(oid) : oid;
|
||||||
|
|
||||||
GlobalKey? replyKey;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
final args = Get.arguments;
|
dynItem = Get.arguments['item'];
|
||||||
dynItem = args['item'];
|
var commentType = dynItem.basic?.commentType;
|
||||||
if (args['viewReply'] ?? false) {
|
var commentIdStr = dynItem.basic?.commentIdStr;
|
||||||
replyKey = GlobalKey();
|
|
||||||
}
|
|
||||||
final commentType = dynItem.basic?.commentType;
|
|
||||||
final commentIdStr = dynItem.basic?.commentIdStr;
|
|
||||||
if (commentType != null &&
|
if (commentType != null &&
|
||||||
commentType != 0 &&
|
commentType != 0 &&
|
||||||
commentIdStr != null &&
|
commentIdStr != null &&
|
||||||
@@ -51,17 +43,6 @@ class DynamicDetailController extends CommonDynController {
|
|||||||
void _init(String commentIdStr, int commentType) {
|
void _init(String commentIdStr, int commentType) {
|
||||||
oid = int.parse(commentIdStr);
|
oid = int.parse(commentIdStr);
|
||||||
replyType = commentType;
|
replyType = commentType;
|
||||||
queryData().whenComplete(() {
|
queryData();
|
||||||
if (replyKey != null && count.value > 0) {
|
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
|
||||||
if (replyKey?.currentContext != null) {
|
|
||||||
Scrollable.ensureVisible(
|
|
||||||
replyKey!.currentContext!,
|
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,10 +113,7 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
buildReplyHeader(theme),
|
buildReplyHeader(theme),
|
||||||
Obx(
|
Obx(() => replyList(theme, controller.loadingState.value)),
|
||||||
key: controller.replyKey,
|
|
||||||
() => replyList(theme, controller.loadingState.value),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -374,7 +374,6 @@ abstract final class PageUtils {
|
|||||||
static Future<void> pushDynDetail(
|
static Future<void> pushDynDetail(
|
||||||
DynamicItemModel item, {
|
DynamicItemModel item, {
|
||||||
bool isPush = false,
|
bool isPush = false,
|
||||||
bool viewReply = false,
|
|
||||||
}) async {
|
}) async {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
|
||||||
@@ -392,7 +391,6 @@ abstract final class PageUtils {
|
|||||||
'/dynamicDetail',
|
'/dynamicDetail',
|
||||||
arguments: {
|
arguments: {
|
||||||
'item': item,
|
'item': item,
|
||||||
'viewReply': viewReply,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user