opt: reply panel

This commit is contained in:
bggRGjQaUbCoE
2024-10-14 08:49:11 +08:00
parent e24f214051
commit e4ae8961e4
3 changed files with 50 additions and 43 deletions

View File

@@ -156,8 +156,9 @@ abstract class ReplyController extends CommonController {
.then( .then(
(value) { (value) {
// TODO: data cast // TODO: data cast
if (value != null && value['data'] is ReplyInfo) { if (value != null && value['data'] != null) {
savedReplies[key] = null; savedReplies[key] = null;
if (value['data'] is ReplyInfo) {
MainListReply response = MainListReply response =
(loadingState.value as Success?)?.response ?? MainListReply(); (loadingState.value as Success?)?.response ?? MainListReply();
if (oid != null) { if (oid != null) {
@@ -167,6 +168,7 @@ abstract class ReplyController extends CommonController {
} }
loadingState.value = LoadingState.success(response); loadingState.value = LoadingState.success(response);
} }
}
}, },
); );
} }

View File

@@ -349,13 +349,15 @@ class _ReplyPageState extends State<ReplyPage>
selected: !snapshot.data!, selected: !snapshot.data!,
), ),
), ),
if (widget.root == 0) ...[
const SizedBox(width: 20), const SizedBox(width: 20),
ToolbarIconButton( ToolbarIconButton(
tooltip: '图片', tooltip: '图片',
selected: false, selected: false,
icon: const Icon(Icons.image, size: 22), icon: const Icon(Icons.image, size: 22),
onPressed: () async { onPressed: () async {
List<XFile> pickedFiles = await _imagePicker.pickMultiImage( List<XFile> pickedFiles =
await _imagePicker.pickMultiImage(
limit: 9, limit: 9,
imageQuality: 100, imageQuality: 100,
); );
@@ -378,6 +380,7 @@ class _ReplyPageState extends State<ReplyPage>
} }
}, },
), ),
],
const Spacer(), const Spacer(),
StreamBuilder( StreamBuilder(
initialData: _enablePublish, initialData: _enablePublish,

View File

@@ -255,8 +255,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
) )
.then((value) { .then((value) {
// 完成评论,数据添加 // TODO: data cast // 完成评论,数据添加 // TODO: data cast
if (value != null && value['data'] is ReplyInfo) { if (value != null && value['data'] != null) {
_savedReplies[key] = null; _savedReplies[key] = null;
if (value['data'] is ReplyInfo) {
List<ReplyInfo> list = List<ReplyInfo> list =
_videoReplyReplyController.loadingState.value is Success _videoReplyReplyController.loadingState.value is Success
? (_videoReplyReplyController.loadingState.value as Success) ? (_videoReplyReplyController.loadingState.value as Success)
@@ -266,6 +267,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
_videoReplyReplyController.loadingState.value = _videoReplyReplyController.loadingState.value =
LoadingState.success(list); LoadingState.success(list);
} }
}
}); });
} }