|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/message.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_footer.dart';
|
|
|
|
import 'package:huixiang/view_widget/no_data_view.dart';
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class SystemDetails extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
SystemDetails({this.arguments});
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _SystemDetails();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SystemDetails extends State<SystemDetails> {
|
|
|
|
ApiService apiService;
|
|
|
|
int pageNum = 1;
|
|
|
|
List<Message> messages = [];
|
|
|
|
int msgType = 0;
|
|
|
|
// String parenId = "0";
|
|
|
|
var commentFocus = FocusNode();
|
|
|
|
String hintText = S.current.liuxianinjingcaidepinglunba;
|
|
|
|
bool isKeyBoardShow = false;
|
|
|
|
final GlobalKey commentKey = GlobalKey();
|
|
|
|
final GlobalKey inputKey = GlobalKey();
|
|
|
|
final TextEditingController commentTextController = TextEditingController();
|
|
|
|
int indexMsg = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
msgType = widget.arguments["msgType"];
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
apiService =
|
|
|
|
ApiService(Dio(), token: value.getString("token"), context: context);
|
|
|
|
queryMessage();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_refresh() {
|
|
|
|
pageNum = 1;
|
|
|
|
queryMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
queryMessage() async {
|
|
|
|
BaseData<PageInfo<Message>> baseData = await apiService.msgList({
|
|
|
|
"pageNum": pageNum,
|
|
|
|
"pageSize": 10,
|
|
|
|
"searchKey": "",
|
|
|
|
"state": "",
|
|
|
|
"typed": msgType
|
|
|
|
}).catchError((onError) {
|
|
|
|
_refreshController.loadFailed();
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
});
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
if (pageNum == 1) {
|
|
|
|
messages.clear();
|
|
|
|
}
|
|
|
|
messages.addAll(baseData.data.list);
|
|
|
|
_refreshController.loadComplete();
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
if (mounted) setState(() {});
|
|
|
|
if (pageNum * 10 > int.tryParse(baseData.data.total)) {
|
|
|
|
_refreshController.loadNoData();
|
|
|
|
} else {
|
|
|
|
pageNum += 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_refreshController.loadFailed();
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///关注/取关会员
|
|
|
|
_vipFollow(followId,isFollow) async {
|
|
|
|
BaseData baseData = await apiService.follow(followId);
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
// widget.refresh();
|
|
|
|
queryMessage();
|
|
|
|
SmartDialog.showToast(isFollow?"取关成功":"关注成功", alignment: Alignment.center);
|
|
|
|
} else {
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///评论 回复
|
|
|
|
_reply(messageRelational) {
|
|
|
|
var messageRelational = jsonDecode(messages[indexMsg].relational);
|
|
|
|
messageRelational["additionId"].toString();
|
|
|
|
hintText = S.of(context).huifu_("${messageRelational["nickname"]}");
|
|
|
|
}
|
|
|
|
|
|
|
|
///动态发布评论
|
|
|
|
_queryMemberComment(String content) async {
|
|
|
|
var messageRelational = jsonDecode(messages[indexMsg].relational);
|
|
|
|
BaseData baseData = await apiService.memberComment({
|
|
|
|
"content": content,
|
|
|
|
"parentId": messageRelational["additionId"].toString(),
|
|
|
|
"relationalId":messageRelational["businessId"].toString(),
|
|
|
|
"relationalType":4
|
|
|
|
}).catchError((error) {});
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
commentTextController.text = "";
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
SmartDialog.showToast("发布成功", alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RefreshController _refreshController = RefreshController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppBar(
|
|
|
|
background: Colors.white,
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
title: (msgType == 2) ?"订单通知":(msgType == 3) ?"充值消息":(msgType == 4) ?"关注":(msgType == 5) ?"点赞":"评论",
|
|
|
|
titleSize: 18.sp,
|
|
|
|
titleColor: Colors.black,
|
|
|
|
),
|
|
|
|
body:SmartRefresher(
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: true,
|
|
|
|
header: MyHeader(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
footer: CustomFooter(
|
|
|
|
loadStyle: LoadStyle.ShowWhenLoading,
|
|
|
|
builder: (BuildContext context, LoadStatus mode) {
|
|
|
|
return (messages.length == 0)?Container():MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
controller: _refreshController,
|
|
|
|
onRefresh: _refresh,
|
|
|
|
onLoading: () {
|
|
|
|
queryMessage();
|
|
|
|
},
|
|
|
|
child:
|
|
|
|
Container(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child:
|
|
|
|
Container(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
if(msgType == 2)
|
|
|
|
orderMessage(),
|
|
|
|
if(msgType == 3)
|
|
|
|
rechargeMessage(),
|
|
|
|
if(msgType == 5)
|
|
|
|
fabulousMessage(),
|
|
|
|
if(msgType == 6)
|
|
|
|
commentMessage(),
|
|
|
|
if(msgType == 4)
|
|
|
|
followMessage(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///订单通知
|
|
|
|
Widget orderMessage(){
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(top:10.h,bottom:20.h,left: 20.w,right: 20.w),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(messages == null || messages.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src: "assets/image/icon_empty.png",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: S.of(context).haimeiyouxiaoxi,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120.h),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
itemCount: messages.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
// if (messages[position].typed == 2) {
|
|
|
|
// Navigator.of(context)
|
|
|
|
// .pushNamed('/router/exchange_order_details');
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: orderMessageItem(messages[position]),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
Widget orderMessageItem(Message message) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
|
|
|
child:
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
(message.typed == 1)
|
|
|
|
? "assets/image/icon_system_message.png"
|
|
|
|
: (message.typed == 2)
|
|
|
|
? "assets/image/icon_system_message.png"
|
|
|
|
: "assets/image/c_z.png",
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width:8.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
(message.typed == 1)
|
|
|
|
? S.of(context).xitongtongzhi
|
|
|
|
: (message.typed == 2)
|
|
|
|
? S.of(context).dingdanxiaoxi
|
|
|
|
: S.of(context).chongzhixiaoxi,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFF060606),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
message.updateTime,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(left:30.w, top:20.h),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Text(
|
|
|
|
message.content,
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Colors.black,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 14.h),
|
|
|
|
height: 1,
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0XFFF7F7F7),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///充值消息通知
|
|
|
|
Widget rechargeMessage(){
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(top:10.h,bottom:20.h,left: 20.w,right: 20.w),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(messages == null || messages.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src:"assets/image/icon_empty.png",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: S.of(context).haimeiyouxiaoxi,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120.h),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
itemCount: messages.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
// if (messages[position].typed == 2) {
|
|
|
|
// Navigator.of(context)
|
|
|
|
// .pushNamed('/router/exchange_order_details');
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: rechargeMessageItem(messages[position]),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
Widget rechargeMessageItem(Message message) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
|
|
|
child:
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
(message.typed == 1)
|
|
|
|
? "assets/image/icon_system_message.png"
|
|
|
|
: (message.typed == 2)
|
|
|
|
? "assets/image/icon_system_message.png"
|
|
|
|
: "assets/image/c_z.png",
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width:8.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
(message.typed == 1)
|
|
|
|
? S.of(context).xitongtongzhi
|
|
|
|
: (message.typed == 2)
|
|
|
|
? S.of(context).dingdanxiaoxi
|
|
|
|
: "充值通知",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFF060606),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
message.updateTime,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(left:30.w, top:20.h),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"充值成功",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:8.h,),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Text(
|
|
|
|
message.content,
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Colors.black,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 14.h),
|
|
|
|
height: 1,
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0XFFF7F7F7),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///点赞通知
|
|
|
|
Widget fabulousMessage(){
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(messages == null || messages.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src:"assets/image/icon_empty.png",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: S.of(context).haimeiyouxiaoxi,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120.h),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
itemCount: messages.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/community_details',
|
|
|
|
arguments: {
|
|
|
|
"businessId":jsonDecode(messages[position].relational)["businessId"].toString(),
|
|
|
|
"mid":messages[position].mid
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: fabulousMessageItem(messages[position]),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
Widget fabulousMessageItem(Message message) {
|
|
|
|
var messageRelational = jsonDecode(message.relational);
|
|
|
|
return Container(
|
|
|
|
child:
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
messageRelational["avatar"] ?? "",
|
|
|
|
width: 44,
|
|
|
|
height: 44,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(width: 8,),
|
|
|
|
Expanded(child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
messageRelational["nickname"] ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF1A1A1A))
|
|
|
|
),
|
|
|
|
SizedBox(width:8.w,),
|
|
|
|
Text(
|
|
|
|
"点赞了",
|
|
|
|
style:TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Text(
|
|
|
|
message.updateTime,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:12.h,),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
color:Color(0xFFF2F2F2),
|
|
|
|
padding:EdgeInsets.all(5),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
// Text(
|
|
|
|
// "我的评论:",
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// height: 1.3,
|
|
|
|
// fontWeight: MyFontWeight.regular,
|
|
|
|
// color: Color(0xFF1A1A1A),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
MImage(
|
|
|
|
messageRelational["nickname"] ,
|
|
|
|
width: 38,
|
|
|
|
height: 38,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.circular(2),
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(width:2.w),
|
|
|
|
Expanded(child:Text(
|
|
|
|
messageRelational["content"] ?? "",
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
height: 1.3,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF808080),
|
|
|
|
),
|
|
|
|
),)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.h,bottom:16.h),
|
|
|
|
height: 1.h,
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///评论通知
|
|
|
|
Widget commentMessage(){
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(messages == null || messages.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src:"assets/image/icon_empty.png",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: S.of(context).haimeiyouxiaoxi,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120.h),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
itemCount: messages.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/community_details',
|
|
|
|
arguments: {
|
|
|
|
"businessId":jsonDecode(messages[position].relational)["businessId"].toString(),
|
|
|
|
"mid":messages[position].mid
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: commentMessageItem(messages[position],position),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
Widget commentMessageItem(Message message,index) {
|
|
|
|
var messageRelational = jsonDecode(message.relational);
|
|
|
|
return Container(
|
|
|
|
child:
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
messageRelational["avatar"],
|
|
|
|
width: 44,
|
|
|
|
height: 44,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(width: 8,),
|
|
|
|
Expanded(child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
messageRelational["nickname"],
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF1A1A1A))
|
|
|
|
),
|
|
|
|
SizedBox(width:8.w,),
|
|
|
|
Text(
|
|
|
|
"评论了",
|
|
|
|
style:TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Text(
|
|
|
|
message.updateTime,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: (){
|
|
|
|
setState(() {
|
|
|
|
indexMsg = index;
|
|
|
|
showDeleteDialog();
|
|
|
|
_reply(messageRelational);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height:22.h,
|
|
|
|
width: 40.w,
|
|
|
|
padding:EdgeInsets.only(left:2,right:2),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(11),
|
|
|
|
border: Border.all(
|
|
|
|
width: 1,
|
|
|
|
color: Color(0xFF00A359),
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"回复",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF00A359),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height:8.h,),
|
|
|
|
// Text(
|
|
|
|
// messageRelational["content"],
|
|
|
|
// maxLines: 2,
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// height: 1.3,
|
|
|
|
// fontWeight: MyFontWeight.regular,
|
|
|
|
// color: Color(0xFF1A1A1A),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// SizedBox(height:12.h,),
|
|
|
|
// Container(
|
|
|
|
// width: double.infinity,
|
|
|
|
// color:Color(0xFFF2F2F2),
|
|
|
|
// padding:EdgeInsets.all(5),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// "我的评论:",
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// height: 1.3,
|
|
|
|
// fontWeight: MyFontWeight.regular,
|
|
|
|
// color: Color(0xFF1A1A1A),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// // MImage(
|
|
|
|
// // "",
|
|
|
|
// // width: 38,
|
|
|
|
// // height: 38,
|
|
|
|
// // isCircle: true,
|
|
|
|
// // fit: BoxFit.cover,
|
|
|
|
// // radius: BorderRadius.circular(2),
|
|
|
|
// // errorSrc: "assets/image/default_1.png",
|
|
|
|
// // fadeSrc: "assets/image/default_1.png",
|
|
|
|
// // ),
|
|
|
|
// SizedBox(width:2.w),
|
|
|
|
// Expanded(child:Text(
|
|
|
|
// "文本,是指书面语言的表现形式文本,文本,是指书面语言的表现形式文本。",
|
|
|
|
// maxLines: 2,
|
|
|
|
// overflow:TextOverflow.ellipsis,
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// height: 1.3,
|
|
|
|
// fontWeight: MyFontWeight.regular,
|
|
|
|
// color: Color(0xFF808080),
|
|
|
|
// ),
|
|
|
|
// ),)
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
color:Color(0xFFF2F2F2),
|
|
|
|
padding:EdgeInsets.all(5),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
// Text(
|
|
|
|
// "我的评论:",
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// height: 1.3,
|
|
|
|
// fontWeight: MyFontWeight.regular,
|
|
|
|
// color: Color(0xFF1A1A1A),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
MImage(
|
|
|
|
messageRelational["nickname"],
|
|
|
|
width: 38,
|
|
|
|
height: 38,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.circular(2),
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(width:2.w),
|
|
|
|
Expanded(child:Text(
|
|
|
|
messageRelational["content"],
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
height: 1.3,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF808080),
|
|
|
|
),
|
|
|
|
),)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.h,bottom:16.h),
|
|
|
|
height: 1.h,
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///关注通知
|
|
|
|
Widget followMessage(){
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(messages == null || messages.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src:"assets/image/icon_empty.png",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: S.of(context).haimeiyouxiaoxi,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120.h),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
itemCount: messages.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
// if (messages[position].typed == 2) {
|
|
|
|
// Navigator.of(context)
|
|
|
|
// .pushNamed('/router/exchange_order_details');
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: followMessageItem(messages[position]),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
Widget followMessageItem(Message message) {
|
|
|
|
var messageRelational = jsonDecode(message.relational);
|
|
|
|
if(message.relational.startsWith("{"))
|
|
|
|
return Container(
|
|
|
|
child:
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
MImage(
|
|
|
|
messageRelational["avatar"],
|
|
|
|
width: 44,
|
|
|
|
height: 44,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(width: 8,),
|
|
|
|
Expanded(child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
messageRelational["nickname"],
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF1A1A1A))
|
|
|
|
),
|
|
|
|
SizedBox(width:8.w,),
|
|
|
|
Text(
|
|
|
|
"关注了你",
|
|
|
|
style:TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Text(
|
|
|
|
message.updateTime,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFFA29E9E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: (){
|
|
|
|
setState(() {
|
|
|
|
_vipFollow(messageRelational["mid"].toString(),message?.followed ?? false);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child:
|
|
|
|
RoundButton(
|
|
|
|
height: 21.h,
|
|
|
|
width:56.w,
|
|
|
|
padding: EdgeInsets.all(2),
|
|
|
|
backgroup: (message?.followed ?? false)
|
|
|
|
? Color(0xFFE6E6E6)
|
|
|
|
: Color(0xFF32A060),
|
|
|
|
textColor: (message?.followed ?? false)
|
|
|
|
? Color(0xFF808080)
|
|
|
|
: Colors.white,
|
|
|
|
text: (message?.followed ?? false) ? "已关注" : "回关",
|
|
|
|
radius:20,
|
|
|
|
icons: Icon(
|
|
|
|
(message?.followed ?? false)
|
|
|
|
? Icons.check
|
|
|
|
: Icons.add,
|
|
|
|
color: (message?.followed?? false)
|
|
|
|
? Color(0xFF808080)
|
|
|
|
: Colors.white,
|
|
|
|
size: 12,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
// Container(
|
|
|
|
// height: 21.h,
|
|
|
|
// width:56.w,
|
|
|
|
// padding:EdgeInsets.only(left:5,right:5),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(11),
|
|
|
|
// border: Border.all(
|
|
|
|
// width: 1,
|
|
|
|
// color: Color(0xFF00A359),
|
|
|
|
// style: BorderStyle.solid,
|
|
|
|
// ),
|
|
|
|
// color: (message?.followed ?? false)
|
|
|
|
// ? Color(0xFFE6E6E6)
|
|
|
|
// : Color(0xFF32A060),
|
|
|
|
// ),
|
|
|
|
// child: Row(
|
|
|
|
// children: [
|
|
|
|
// Icon((message?.followed ?? false)
|
|
|
|
// ? Icons.check
|
|
|
|
// : Icons.add,
|
|
|
|
// color:(message?.followed?? false)
|
|
|
|
// ? Color(0xFF808080)
|
|
|
|
// : Colors.white,
|
|
|
|
// size: 16,
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// (message?.followed ?? false) ? "已关注" : "回关",
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 12.sp,
|
|
|
|
// fontWeight: MyFontWeight.medium,
|
|
|
|
// color:(message?.followed ?? false)
|
|
|
|
// ? Color(0xFF808080)
|
|
|
|
// : Colors.white,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height:8.h,),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.h,bottom:16.h),
|
|
|
|
height: 1.h,
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///动态弹窗
|
|
|
|
showDeleteDialog() {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return AlertDialog(
|
|
|
|
content: Container(
|
|
|
|
height: 150.h,
|
|
|
|
// padding: EdgeInsets.all(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
top: Radius.circular(8),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xffF2F2F2),
|
|
|
|
borderRadius: BorderRadius.circular(2.0),
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 4.w),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 8,
|
|
|
|
minLines: 1,
|
|
|
|
focusNode:commentFocus,
|
|
|
|
controller:commentTextController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: InputBorder.none,
|
|
|
|
hintText:hintText,
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (!isKeyBoardShow)
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
var commentText = commentTextController.text;
|
|
|
|
if (commentText.trim() == "") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_queryMemberComment(commentText);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|