diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 03e52a213..0967e7a59 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -156,16 +156,18 @@ abstract class ReplyController extends CommonController { .then( (value) { // TODO: data cast - if (value != null && value['data'] is ReplyInfo) { + if (value != null && value['data'] != null) { savedReplies[key] = null; - MainListReply response = - (loadingState.value as Success?)?.response ?? MainListReply(); - if (oid != null) { - response.replies.insert(0, value['data']); - } else { - response.replies[index].replies.add(value['data']); + if (value['data'] is ReplyInfo) { + MainListReply response = + (loadingState.value as Success?)?.response ?? MainListReply(); + if (oid != null) { + response.replies.insert(0, value['data']); + } else { + response.replies[index].replies.add(value['data']); + } + loadingState.value = LoadingState.success(response); } - loadingState.value = LoadingState.success(response); } }, ); diff --git a/lib/pages/video/detail/reply_new/reply_page.dart b/lib/pages/video/detail/reply_new/reply_page.dart index efa30b1ae..c4b4b4120 100644 --- a/lib/pages/video/detail/reply_new/reply_page.dart +++ b/lib/pages/video/detail/reply_new/reply_page.dart @@ -349,35 +349,38 @@ class _ReplyPageState extends State selected: !snapshot.data!, ), ), - const SizedBox(width: 20), - ToolbarIconButton( - tooltip: '图片', - selected: false, - icon: const Icon(Icons.image, size: 22), - onPressed: () async { - List pickedFiles = await _imagePicker.pickMultiImage( - limit: 9, - imageQuality: 100, - ); - if (pickedFiles.isNotEmpty) { - for (int i = 0; i < pickedFiles.length; i++) { - if (_pathList.length == 9) { - SmartDialog.showToast('最多选择9张图片'); - if (i != 0) { - _pathStream.add(_pathList); - } - break; - } else { - _pathList.add(pickedFiles[i].path); - if (i == pickedFiles.length - 1) { - SmartDialog.dismiss(); - _pathStream.add(_pathList); + if (widget.root == 0) ...[ + const SizedBox(width: 20), + ToolbarIconButton( + tooltip: '图片', + selected: false, + icon: const Icon(Icons.image, size: 22), + onPressed: () async { + List pickedFiles = + await _imagePicker.pickMultiImage( + limit: 9, + imageQuality: 100, + ); + if (pickedFiles.isNotEmpty) { + for (int i = 0; i < pickedFiles.length; i++) { + if (_pathList.length == 9) { + SmartDialog.showToast('最多选择9张图片'); + if (i != 0) { + _pathStream.add(_pathList); + } + break; + } else { + _pathList.add(pickedFiles[i].path); + if (i == pickedFiles.length - 1) { + SmartDialog.dismiss(); + _pathStream.add(_pathList); + } } } } - } - }, - ), + }, + ), + ], const Spacer(), StreamBuilder( initialData: _enablePublish, diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 55390435e..66fd64bfe 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -255,16 +255,18 @@ class _VideoReplyReplyPanelState extends State { ) .then((value) { // 完成评论,数据添加 // TODO: data cast - if (value != null && value['data'] is ReplyInfo) { + if (value != null && value['data'] != null) { _savedReplies[key] = null; - List list = - _videoReplyReplyController.loadingState.value is Success - ? (_videoReplyReplyController.loadingState.value as Success) - .response - : []; - list.add(value['data']); - _videoReplyReplyController.loadingState.value = - LoadingState.success(list); + if (value['data'] is ReplyInfo) { + List list = + _videoReplyReplyController.loadingState.value is Success + ? (_videoReplyReplyController.loadingState.value as Success) + .response + : []; + list.add(value['data']); + _videoReplyReplyController.loadingState.value = + LoadingState.success(list); + } } }); }