|
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter/rendering.dart'; |
|
|
|
|
import 'package:flutter_html/flutter_html.dart'; |
|
|
|
|
import 'package:flutter_html/image_render.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -49,7 +50,6 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
with WidgetsBindingObserver { |
|
|
|
|
ApiService apiService; |
|
|
|
|
RefreshController _refreshController; |
|
|
|
|
bool isLiked = false; |
|
|
|
|
int commentTotal = 0; |
|
|
|
|
var commentTextController = TextEditingController(); |
|
|
|
|
var commentFocus = FocusNode(); |
|
|
|
@ -97,19 +97,25 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
Activity activity; |
|
|
|
|
Article article; |
|
|
|
|
List<MemberCommentList> memberList = []; |
|
|
|
|
GlobalKey commentKey = GlobalKey(); |
|
|
|
|
ScrollController scrollController = ScrollController(); |
|
|
|
|
|
|
|
|
|
queryHtml() async { |
|
|
|
|
BaseData baseData = await apiService.informationInfo( |
|
|
|
|
widget.arguments["activityId"] ?? widget.arguments["articleId"]); |
|
|
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
if (widget.arguments.containsKey("activityId")) { |
|
|
|
|
activity = Activity.fromJson(baseData.data); |
|
|
|
|
} else if (widget.arguments.containsKey("articleId")) { |
|
|
|
|
article = Article.fromJson(baseData.data); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
queryHtml() async { //activityInfo |
|
|
|
|
if (widget.arguments["activityId"] != null) { |
|
|
|
|
BaseData<Activity> baseData = await apiService.activityInfo(widget.arguments["activityId"]); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
activity = baseData.data; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (widget.arguments["articleId"] != null) { |
|
|
|
|
BaseData<Article> baseData = await apiService.informationInfo(widget.arguments["articleId"]); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
article = baseData.data; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -177,7 +183,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
|
|
|
|
|
//评论列表 |
|
|
|
|
queryMemberCommentList() async { |
|
|
|
|
BaseData baseData = await apiService.memberCommentList({ |
|
|
|
|
BaseData<PageInfo<MemberCommentList>> baseData = await apiService.memberCommentList({ |
|
|
|
|
"pageNum": 1, |
|
|
|
|
"pageSize": 100, |
|
|
|
|
"relationalId": |
|
|
|
@ -187,12 +193,10 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
_refreshController.refreshFailed(); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
PageInfo pageInfo = PageInfo.fromJson(baseData.data); |
|
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
|
setState(() { |
|
|
|
|
commentTotal = pageInfo.size; |
|
|
|
|
memberList = |
|
|
|
|
pageInfo.list.map((e) => MemberCommentList.fromMap(e)).toList(); |
|
|
|
|
commentTotal = baseData.data.size; |
|
|
|
|
memberList = baseData.data.list; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -216,8 +220,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BaseData baseData = |
|
|
|
|
await apiService.commentLike(id).catchError((onError) {}); |
|
|
|
|
BaseData baseData = await apiService.commentLike(id).catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
memberList.forEach((element) { |
|
|
|
@ -233,31 +236,29 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/* else { |
|
|
|
|
if (baseData.msg == "您已点过赞") { |
|
|
|
|
setState(() { |
|
|
|
|
memberList.forEach((element) { |
|
|
|
|
if (element.id == id) { |
|
|
|
|
element.liked = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//给文章/活动点赞 |
|
|
|
|
queryInformationLikes() async { |
|
|
|
|
BaseData baseData = await apiService |
|
|
|
|
.informationLikes( |
|
|
|
|
widget.arguments["activityId"] ?? widget.arguments["articleId"]) |
|
|
|
|
.catchError((onError) {}); |
|
|
|
|
BaseData baseData = await apiService.informationLikes( |
|
|
|
|
widget.arguments["activityId"] ?? widget.arguments["articleId"]); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
isLiked = true; |
|
|
|
|
if (article != null) |
|
|
|
|
article.likes += 1; |
|
|
|
|
else if (activity != null) activity.likes += 1; |
|
|
|
|
if (article != null) { |
|
|
|
|
if (article.liked) { |
|
|
|
|
article.likes -= 1; |
|
|
|
|
} else { |
|
|
|
|
article.likes += 1; |
|
|
|
|
} |
|
|
|
|
article.liked = !article.liked; |
|
|
|
|
} else if (activity != null) { |
|
|
|
|
if (activity.liked) { |
|
|
|
|
activity.likes -= 1; |
|
|
|
|
} else { |
|
|
|
|
activity.likes += 1; |
|
|
|
|
} |
|
|
|
|
activity.liked = !activity.liked; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
@ -321,6 +322,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
parenId = "0"; |
|
|
|
|
}, |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
controller: scrollController, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -460,7 +462,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
Container( |
|
|
|
|
key: commentKey, |
|
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
@ -489,27 +492,42 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
ListView.builder( |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
|
itemCount: |
|
|
|
|
memberList != null ? memberList.length : 0, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return Material( |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
showPressMenu( |
|
|
|
|
memberList[position].createUser, |
|
|
|
|
memberList[position]); |
|
|
|
|
}, |
|
|
|
|
child: commentItem(memberList[position], |
|
|
|
|
position, memberList.length), |
|
|
|
|
if (memberList != null && memberList.length > 0) |
|
|
|
|
ListView.builder( |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
|
itemCount: |
|
|
|
|
memberList != null ? memberList.length : 0, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return Material( |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
showPressMenu( |
|
|
|
|
memberList[position].createUser, |
|
|
|
|
memberList[position]); |
|
|
|
|
}, |
|
|
|
|
child: commentItem(memberList[position], |
|
|
|
|
position, memberList.length), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 80.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child: Text( |
|
|
|
|
"暂无评论,快来评论吧", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Color(0xFFA0A0A0), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -622,7 +640,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
hintText: hintText, |
|
|
|
|
hintStyle: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xffCDCCCC), |
|
|
|
|
color: Color(0xFF868686), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -631,9 +649,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 20.w, right: 20.w), |
|
|
|
|
child: GestureDetector( |
|
|
|
|
if (isKeyBoardShow) |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
var commentText = commentTextController.text; |
|
|
|
|
if (commentText == "") { |
|
|
|
@ -641,35 +658,93 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
} |
|
|
|
|
queryMemberComment(commentText); |
|
|
|
|
}, |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).fasong, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Color(0XFF1A1A1A), |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).fasong, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Color(0XFF1A1A1A), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
if (isLiked) return; |
|
|
|
|
queryInformationLikes(); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
isLiked |
|
|
|
|
? "assets/image/icon_like.png" |
|
|
|
|
: "assets/image/icon_like_h.png", |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
width: 24, |
|
|
|
|
height: 24, |
|
|
|
|
if (!isKeyBoardShow) |
|
|
|
|
InkWell( |
|
|
|
|
onTap: toComment, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 10), |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/icon_comment.png", |
|
|
|
|
width: 24, |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (!isKeyBoardShow) |
|
|
|
|
LikeButton( |
|
|
|
|
padding: EdgeInsets.all(10), |
|
|
|
|
size: 24, |
|
|
|
|
circleSize: 24, |
|
|
|
|
circleColor: CircleColor( |
|
|
|
|
start: Color(0xff00ddff), |
|
|
|
|
end: Color(0xff0099cc), |
|
|
|
|
), |
|
|
|
|
bubblesColor: BubblesColor( |
|
|
|
|
dotPrimaryColor: Color(0xff33b5e5), |
|
|
|
|
dotSecondaryColor: Color(0xff0099cc), |
|
|
|
|
), |
|
|
|
|
bubblesSize: 24, |
|
|
|
|
likeBuilder: (bool isLiked) { |
|
|
|
|
return isLiked |
|
|
|
|
? Image.asset( |
|
|
|
|
"assets/image/icon_like.png", |
|
|
|
|
width: 24, |
|
|
|
|
height: 24, |
|
|
|
|
) |
|
|
|
|
: Image.asset( |
|
|
|
|
"assets/image/icon_like_h.png", |
|
|
|
|
width: 24, |
|
|
|
|
height: 24, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
isLiked: (activity != null |
|
|
|
|
? activity.liked |
|
|
|
|
: article != null |
|
|
|
|
? article.liked |
|
|
|
|
: false), |
|
|
|
|
onTap: (isLiked) async { |
|
|
|
|
await queryInformationLikes(); |
|
|
|
|
return (activity != null |
|
|
|
|
? activity.liked |
|
|
|
|
: article != null |
|
|
|
|
? article.liked |
|
|
|
|
: false); |
|
|
|
|
}, |
|
|
|
|
// likeCount: memberList.likes, |
|
|
|
|
countBuilder: (int count, bool isLiked, String text) { |
|
|
|
|
return Text( |
|
|
|
|
text, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF1A1A1A), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
toComment() { |
|
|
|
|
if (commentKey.currentContext == null) return; |
|
|
|
|
RenderBox firstRenderBox = commentKey.currentContext.findRenderObject(); |
|
|
|
|
Offset first = firstRenderBox.localToGlobal(Offset.zero); |
|
|
|
|
scrollController.animateTo(first.dy + scrollController.offset - (kToolbarHeight + MediaQuery.of(context).padding.top), duration: Duration(milliseconds: 100), curve: Curves.easeIn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
VideoPlayerController videoPlayerController; |
|
|
|
|
ChewieController chewieAudioController; |
|
|
|
|
Chewie chewies; |
|
|
|
@ -784,7 +859,6 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
|
|
|
|
|
alignment: Alignment.topRight, |
|
|
|
|
child: LikeButton( |
|
|
|
|
padding: EdgeInsets.all(10), |
|
|
|
|
size: 16, |
|
|
|
|
circleSize: 16, |
|
|
|
|
circleColor: CircleColor( |
|
|
|
|
start: Color(0xff00ddff), end: Color(0xff0099cc)), |
|
|
|
|