From 5812b5cff14059734f17e495c66ecfa29e3fe252 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 21 Aug 2023 21:16:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A8=E6=80=81=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E3=80=81=E8=BD=AC=E5=8F=91=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/dynamics/deatil/view.dart | 17 +++-- .../dynamics/widgets/additional_panel.dart | 72 ++++++++++--------- 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/lib/pages/dynamics/deatil/view.dart b/lib/pages/dynamics/deatil/view.dart index 1d36f856..6a779ba3 100644 --- a/lib/pages/dynamics/deatil/view.dart +++ b/lib/pages/dynamics/deatil/view.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_debounce/easy_throttle.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:pilipala/common/skeleton/video_reply.dart'; @@ -40,7 +41,9 @@ class _DynamicDetailPageState extends State { } else { oid = Get.arguments['item'].modules.moduleDynamic.major.draw.id; } - type = Get.arguments['item'].basic!['comment_type']; + int commentType = Get.arguments['item'].basic!['comment_type'] ?? 11; + type = (commentType == 0) ? 11 : commentType; + action = Get.arguments.containsKey('action') ? Get.arguments['action'] : null; _dynamicDetailController = Get.put(DynamicDetailController(oid, type)); @@ -56,10 +59,9 @@ class _DynamicDetailPageState extends State { void _listen() async { if (scrollController.position.pixels >= scrollController.position.maxScrollExtent - 300) { - if (!_dynamicDetailController!.isLoadingMore) { - _dynamicDetailController!.isLoadingMore = true; - await _dynamicDetailController!.queryReplyList(reqType: 'onLoad'); - } + EasyThrottle.throttle('replylist', const Duration(seconds: 2), () { + _dynamicDetailController!.queryReplyList(reqType: 'onLoad'); + }); } if (scrollController.offset > 55 && !_visibleTitle) { @@ -242,6 +244,11 @@ class _DynamicDetailPageState extends State { replyReply: (replyItem) => replyReply(replyItem), replyType: ReplyType.values[type], + addReply: (replyItem) { + _dynamicDetailController! + .replyList[index].replies! + .add(replyItem); + }, ); } }, diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index b3d6e98e..e283fcf9 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -60,43 +60,47 @@ Widget addWidget(item, context, type, {floor = 1}) { ), ); case 'ADDITIONAL_TYPE_RESERVE': - return Padding( - padding: const EdgeInsets.only(top: 8), - child: InkWell( - onTap: () {}, - child: Container( - width: double.infinity, - padding: - const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10), - color: bgColor, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - dynamicProperty[type].title, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - const SizedBox(height: 1), - Text.rich( - TextSpan( - style: TextStyle( - color: Theme.of(context).colorScheme.outline, - fontSize: - Theme.of(context).textTheme.labelMedium!.fontSize), + return dynamicProperty[type].state != -1 + ? Padding( + padding: const EdgeInsets.only(top: 8), + child: InkWell( + onTap: () {}, + child: Container( + width: double.infinity, + padding: const EdgeInsets.only( + left: 12, top: 10, right: 12, bottom: 10), + color: bgColor, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - TextSpan(text: dynamicProperty[type].desc1['text']), - const TextSpan(text: ' '), - TextSpan(text: dynamicProperty[type].desc2['text']), + Text( + dynamicProperty[type].title, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 1), + Text.rich( + TextSpan( + style: TextStyle( + color: Theme.of(context).colorScheme.outline, + fontSize: Theme.of(context) + .textTheme + .labelMedium! + .fontSize), + children: [ + TextSpan(text: dynamicProperty[type].desc1['text']), + const TextSpan(text: ' '), + TextSpan(text: dynamicProperty[type].desc2['text']), + ], + ), + ) ], ), - ) - ], - ), - // TextButton(onPressed: () {}, child: Text('123')) - ), - ), - ); + // TextButton(onPressed: () {}, child: Text('123')) + ), + ), + ) + : const SizedBox(); case 'ADDITIONAL_TYPE_GOODS': return Padding( padding: const EdgeInsets.only(top: 6),