@@ -12,18 +12,21 @@ class ForumPostComposeSheet extends StatefulWidget {
1212 final String forumId;
1313 final String ? initialContent;
1414 final bool isReply;
15+ final String ? postId;
1516
1617 const ForumPostComposeSheet ({
1718 super .key,
1819 required this .forumId,
1920 this .initialContent,
2021 this .isReply = false ,
22+ this .postId,
2123 });
2224 static Future <bool ?> show (
2325 BuildContext context, {
2426 required String forumId,
2527 String ? initialContent,
2628 bool isReply = false ,
29+ String ? postId,
2730 }) {
2831 return showDialog <bool >(
2932 context: context,
@@ -34,6 +37,7 @@ class ForumPostComposeSheet extends StatefulWidget {
3437 forumId: forumId,
3538 initialContent: initialContent,
3639 isReply: isReply,
40+ postId: postId,
3741 ),
3842 );
3943 }
@@ -330,11 +334,24 @@ class _ForumPostComposeSheetState extends State<ForumPostComposeSheet> {
330334
331335 setState (() => _isSubmitting = true );
332336 try {
333- final success = await TfApiClient .instance.sendPost (
334- uid, password, fid,
335- _titleController.text.trim (),
336- _contentController.text.trim (),
337- );
337+ final bool success;
338+ if (widget.isReply) {
339+ final pid = int .tryParse (widget.postId ?? '' );
340+ if (pid == null ) {
341+ Navigator .pop (context, false );
342+ return ;
343+ }
344+ success = await TfApiClient .instance.addComment (
345+ uid, password, fid, pid,
346+ _contentController.text.trim (),
347+ );
348+ } else {
349+ success = await TfApiClient .instance.sendPost (
350+ uid, password, fid,
351+ _titleController.text.trim (),
352+ _contentController.text.trim (),
353+ );
354+ }
338355 if (! mounted) return ;
339356 setState (() => _isSubmitting = false );
340357 if (success) {
0 commit comments