|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
@ -42,11 +44,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
var commentFocus = FocusNode(); |
|
|
|
|
String parenId = "0"; |
|
|
|
|
String hintText = S.current.liuxianinjingcaidepinglunba; |
|
|
|
|
List<MemberCommentList> memberList = []; |
|
|
|
|
final GlobalKey inputKey = GlobalKey(); |
|
|
|
|
final TextEditingController commentTextController = TextEditingController(); |
|
|
|
|
int commentTotal = 0; |
|
|
|
|
double commentHeight = 60.h; |
|
|
|
|
CourseDetails course; |
|
|
|
|
List<Chapter> chapterList = []; |
|
|
|
|
bool isShowImg = true; |
|
|
|
@ -149,6 +149,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Scaffold( |
|
|
|
|
body: Container( |
|
|
|
|
child:Column( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Column( |
|
|
|
@ -309,13 +312,16 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
CommentList( |
|
|
|
|
commentKey, |
|
|
|
|
course?.likes ?? course?.likes?? 0, |
|
|
|
|
course?.id ?? course?.id ??"", |
|
|
|
|
widget.arguments["id"], |
|
|
|
|
isKeyBoardShow, |
|
|
|
|
_reply, |
|
|
|
|
_delCommentTips, |
|
|
|
|
12.sp, |
|
|
|
|
requestApiFinish: (total){setState(() { |
|
|
|
|
commentTotal = total; |
|
|
|
|
});}, |
|
|
|
|
), |
|
|
|
|
if (memberList == null || memberList.length == 0) |
|
|
|
|
if (commentTotal == 0) |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
@ -332,6 +338,10 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
flex: 1,), |
|
|
|
|
/// 富文本评论的输入框 |
|
|
|
|
InputComment( |
|
|
|
|
inputKey, |
|
|
|
@ -347,7 +357,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -517,25 +526,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contentHeight() { |
|
|
|
|
double contentHeight = MediaQuery |
|
|
|
|
.of(context) |
|
|
|
|
.size |
|
|
|
|
.height - |
|
|
|
|
kToolbarHeight - |
|
|
|
|
MediaQuery |
|
|
|
|
.of(context) |
|
|
|
|
.padding |
|
|
|
|
.top - |
|
|
|
|
160.h; |
|
|
|
|
if ((contentHeight - 60.h) > (128.h * memberList.length)) { |
|
|
|
|
commentHeight = contentHeight - (128.h * memberList.length); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///给文章/活动点赞 |
|
|
|
|
_queryInformationLikes() async { |
|
|
|
|
BaseData baseData = await apiService.informationLikes("1455102859841372160"); |
|
|
|
|
BaseData baseData = await apiService.informationLikes(widget.arguments["id"]); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
commentKey.currentState.setState(() {}); |
|
|
|
|
setState(() { |
|
|
|
@ -555,7 +548,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
BaseData baseData = await apiService.memberComment({ |
|
|
|
|
"content": content, |
|
|
|
|
"parentId": parenId, |
|
|
|
|
"relationalId":course.id, |
|
|
|
|
"relationalId":widget.arguments["id"], |
|
|
|
|
"relationalType": 1 |
|
|
|
|
}).catchError((error) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
@ -563,32 +556,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
|
|
|
|
|
state.queryMemberCommentList(); |
|
|
|
|
commentTextController.text = ""; |
|
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
|
_queryMemberCommentList(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///评论列表 |
|
|
|
|
_queryMemberCommentList() async { |
|
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
|
if (apiService == null) |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: sharedPreferences.getString("token"), |
|
|
|
|
showLoading: false, |
|
|
|
|
); |
|
|
|
|
BaseData<PageInfo<MemberCommentList>> baseData = |
|
|
|
|
await apiService.memberCommentList({ |
|
|
|
|
"pageNum": 1, |
|
|
|
|
"pageSize": 100, |
|
|
|
|
"relationalId":course.id, |
|
|
|
|
"relationalType": 1, |
|
|
|
|
}).catchError((error) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
commentTotal = baseData.data.size; |
|
|
|
|
memberList = baseData.data.list; |
|
|
|
|
contentHeight(); |
|
|
|
|
if (mounted) setState(() {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|