Browse Source

消息推送,首页更改,社群专栏更改

ff_new
w-R 3 years ago
parent
commit
0247ab84f3
  1. 31
      lib/community/community_child_page.dart
  2. 53
      lib/community/community_details.dart
  3. 94
      lib/community/community_view/community_dynamic.dart
  4. 45
      lib/community/headlines/headlines_collection.dart
  5. 10
      lib/community/headlines/headlines_column_details.dart
  6. 134
      lib/home/home_page.dart
  7. 59
      lib/home/home_view/featured_acticvity.dart
  8. 2
      lib/home/home_view/quick_order.dart
  9. 35
      lib/home/home_view/shortcut_operation.dart
  10. 5
      lib/home/points_mall_view/points_goods_title.dart
  11. 16
      lib/login/login_page.dart
  12. 2
      lib/main.dart
  13. 529
      lib/message/system_details.dart
  14. 144
      lib/message/system_message.dart
  15. 69
      lib/mine/mine_page.dart
  16. 53
      lib/mine/mine_view/mine_item.dart
  17. 8
      lib/mine/mine_view/mine_view.dart
  18. 15
      lib/mine/mine_wallet_page.dart
  19. 34
      lib/mine/release_page.dart
  20. 2
      lib/order/order_view/order_commodity.dart
  21. 102
      lib/retrofit/data/article.dart
  22. 129
      lib/retrofit/data/message.dart
  23. 29
      lib/retrofit/data/msg_stats.dart
  24. 17
      lib/retrofit/retrofit_api.dart
  25. 24
      lib/retrofit/retrofit_api.g.dart
  26. 2
      lib/settlement/settlement_view/settlement_order_commodity.dart
  27. 2
      lib/store/store_order.dart
  28. 2
      lib/store/store_view/store_info.dart
  29. 3
      lib/view_widget/item_input_widget.dart
  30. 8
      lib/view_widget/request_permission.dart

31
lib/community/community_child_page.dart

@ -1,6 +1,9 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
@ -27,7 +30,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
int pageNum = 0;
String userId;
List<ComunityComment> comments = [];
List<Article> articles = [];
@override
void initState() {
@ -67,11 +70,25 @@ class _CommunityChildPage extends State<CommunityChildPage> {
refreshController.loadComplete();
if (baseData.isSuccess) {
if (pageNum == 1) {
comments.clear();
articles.clear();
}
comments.addAll(baseData.data.list);
baseData.data.list.forEach((element) {
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.liked = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
article.createTime = element.createTime;
article.updateUser = element.memberInfo?.mid;
article.viewers = element?.viewers;
article.likes = element?.likes;
article.comments = element?.comments;
articles.add(article);
});
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime));
print("comments: ${comments.length}");
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
@ -103,7 +120,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
comments[position],
articles[position],
0,
userId: userId,
isList: true,
@ -117,14 +134,14 @@ class _CommunityChildPage extends State<CommunityChildPage> {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],
"businessId": articles[position].id,
"userId": userId,
},
);
},
);
},
itemCount: comments.length,
itemCount: articles.length,
),
);
},

53
lib/community/community_details.dart

@ -30,7 +30,7 @@ class CommunityDetails extends StatefulWidget {
class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObserver {
double height = 0;
double commentHeight = 60.h;
ComunityComment comunity;
// ComunityComment comunity;
String parenId = "0";
final GlobalKey commentKey = GlobalKey();
final ScrollController scrollController = ScrollController();
@ -43,6 +43,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
bool isKeyBoardShow = false;
int commentTotal = 0;
Article article;
String businessId;
@override
void didChangeMetrics() {
@ -72,15 +74,16 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
@override
void initState() {
super.initState();
comunity = widget.arguments["comment"];
// comunity = widget.arguments["comment"];
businessId = widget.arguments["businessId"];
WidgetsBinding.instance.addObserver(this);
_queryMemberCommentList();
queryDetails();
queryDetails(businessId);
}
///
queryDetails() async {
queryDetails(id) async {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
@ -88,11 +91,15 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
context: context,
token: value.getString("token"),
);
BaseData<Article> baseData = await apiService.informationInfo(comunity.id)
BaseData<Article> baseData = await apiService.informationInfo(id)
.catchError((onError) {
debugPrint(onError.toString());
});
if (baseData != null && baseData.isSuccess) {}
if (baseData != null && baseData.isSuccess) {
setState(() {
article = baseData.data;
});
}
}
@override
@ -114,13 +121,14 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
physics: BouncingScrollPhysics(),
child: Column(
children: [
if(article != null)
CommunityDynamic(
comunity,
article,
0,
exitFull: () {
setState(() {});
},
userId:widget.arguments["userId"],
userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"],
itemCount: 3,
isDetails: true,
heightFun: (height) {
@ -136,9 +144,9 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
),
CommentList(
commentKey,
comunity?.likes ?? comunity?.likes.toString() ?? 0,
comunity.id,
1,
article?.likes ?? 0,
businessId,
4,
isKeyBoardShow,
_reply,
_delCommentTips,
@ -154,8 +162,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
margin: EdgeInsets.only(top: 40),
padding: EdgeInsets.all(22.h),
child: Text(
S
.of(context)
S.of(context)
.zanwupinglun,
style: TextStyle(
fontSize: 12,
@ -180,7 +187,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
_toComment,
_queryMemberComment,
_queryInformationLikes,
isLike: comunity.selfLike,
isLike: article?.liked ?? false,
),
],
),
@ -190,15 +197,15 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
////
_queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes(comunity.id).catchError((onError) {});
BaseData baseData = await apiService.informationLikes(businessId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
commentKey.currentState.setState(() {});
setState(() {
if (comunity.selfLike ?? false)
comunity.likes -= 1;
if (article?.liked ?? false)
article?.likes -= 1;
else
comunity.likes += 1;
comunity.selfLike = !comunity.selfLike ?? false;
article?.likes += 1;
article?.liked = !(article.liked ?? false);
});
} else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -210,8 +217,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
BaseData baseData = await apiService.memberComment({
"content": content,
"parentId": parenId,
"relationalId": comunity.id,
"relationalType":1
"relationalId": businessId,
"relationalType":4
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState;
@ -295,8 +302,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId": comunity.id,
"relationalType":1,
"relationalId": businessId,
"relationalType":4,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size;

94
lib/community/community_view/community_dynamic.dart

@ -1,10 +1,11 @@
import 'dart:convert';
import 'dart:ui';
import 'package:chewie/chewie.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:chewie/src/chewie_progress_colors.dart' as chewie;
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -13,8 +14,6 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:photo_view/photo_view.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:video_player/video_player.dart';
@ -29,11 +28,11 @@ class CommunityDynamic extends StatefulWidget {
final Function removalDynamic;
final Function exitFull;
final bool isList;
final ComunityComment comment;
final Article article;
final String userId;
CommunityDynamic(
this.comment,
this.article,
this.commentType, {
Key key,
this.itemCount = 9,
@ -78,15 +77,18 @@ class _CommunityDynamic extends State<CommunityDynamic> {
String filePath;
initVideo() async {
if (widget.comment.subjectInfo.type == "video" &&
widget.comment.subjectInfo.video.isNotEmpty) {
if(widget?.article?.content == null)
return;
var cnt = jsonDecode(widget.article.content);
if (cnt["type"] == "video" &&
cnt["video"] != null) {
if (widget.isList) {
videoPlayerController = VideoPlayerController.network(
widget.comment.subjectInfo.video,
cnt["video"],
)..initialize().then((value) {});
} else {
videoPlayerController = VideoPlayerController.network(
widget.comment.subjectInfo.video,
cnt["video"],
)..initialize().then((value) {
chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController,
@ -172,13 +174,17 @@ class _CommunityDynamic extends State<CommunityDynamic> {
children: [
GestureDetector(
onTap: (){
if(widget?.article?.authorHeadImg == ""){
SmartDialog.showToast("用户暂未设置头像", alignment: Alignment.center);
return;
}
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen(
images:[widget?.comment?.memberInfo?.avatar ?? ""],//list
images:[widget?.article?.authorHeadImg ?? ""],//list
index: 0,//index
), ), );
), ));
},
child: MImage(
widget?.comment?.memberInfo?.avatar ?? "",
widget?.article?.authorHeadImg ?? "",
width: 44,
height: 44,
isCircle: true,
@ -195,7 +201,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget?.comment?.memberInfo?.nickname ?? "",
widget?.article?.authorName ?? "",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
@ -203,7 +209,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
),
Text(
widget?.comment?.createTime ?? "",
widget?.article?.createTime ?? "",
style: TextStyle(
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
@ -215,14 +221,14 @@ class _CommunityDynamic extends State<CommunityDynamic> {
],
),
),
if (widget?.comment?.memberInfo?.mid != widget.userId ?? "")
if (widget?.article?.updateUser != widget.userId ?? "")
GestureDetector(
onTap: () {
setState(() {
if (widget.commentType == 0) {
widget.comment.selfFollow =
!(widget.comment.selfFollow ?? false);
_vipFollow(widget.comment.memberInfo?.mid,widget.comment.selfFollow ?? false);
widget.article.liked =
!(widget.article.liked ?? false);
_vipFollow(widget.article.updateUser,widget.article.liked ?? false);
} else {
showDeleteDialog();
}
@ -235,21 +241,21 @@ class _CommunityDynamic extends State<CommunityDynamic> {
alignment: Alignment.center,
child: RoundButton(
height: 25.h,
backgroup: (widget.comment.selfFollow ?? false)
backgroup: (widget?.article?.liked ?? false)
? Color(0xFFE6E6E6)
: Color(0xFF32A060),
textColor: (widget.comment.selfFollow ?? false)
textColor: (widget?.article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
text: (widget.comment.selfFollow ?? false)
text: (widget?.article?.liked ?? false)
? "已关注"
: "关注",
radius: 20,
icons: Icon(
(widget.comment.selfFollow ?? false)
(widget?.article?.liked ?? false)
? Icons.check
: Icons.add,
color: (widget.comment.selfFollow ?? false)
color: (widget?.article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
size: 15,
@ -267,7 +273,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
height: 12.h,
),
Text(
widget.comment.subject ?? "",
widget?.article?.mainTitle ?? "",
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -276,7 +282,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
fontSize: 15.sp,
),
),
buildMedia(widget.comment.subjectInfo),
buildMedia(widget?.article?.content),
if (!widget.isDetails)
SizedBox(
height: 12.h,
@ -287,8 +293,8 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconText(
(widget.comment != null)
? "${widget.comment.viewers}"
(widget.article != null)
? "${widget.article.viewers}"
: "",
space: 4.w,
leftImage: "assets/svg/liulanliang.svg",
@ -298,7 +304,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
),
IconText(
"${widget.comment.comments ?? 0}",
"${widget.article.comments ?? 0}",
space: 4.w,
leftImage: "assets/svg/pinglun.svg",
iconSize: 16,
@ -309,7 +315,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
GestureDetector(
onTap: () {},
child: IconText(
"${widget.comment.likes ?? 0}",
"${widget.article.likes ?? 0}",
space: 4.w,
leftImage: "assets/svg/xihuan.svg",
iconSize: 16,
@ -332,24 +338,25 @@ class _CommunityDynamic extends State<CommunityDynamic> {
}
///
Widget buildMedia(SubjectInfo subjectInfo) {
if (subjectInfo == null) {
Widget buildMedia(String subjectInfo) {
if (subjectInfo == null || !subjectInfo.startsWith("{")) {
return Container();
}
var cnt = jsonDecode(subjectInfo);
Widget itemWidget = Container();
if (subjectInfo.type == "image" && subjectInfo.images.length > 0) {
if (subjectInfo.images.length == 1) {
if (cnt["type"] == "image"&& cnt["images"] != null && cnt["images"].length > 0) {
if (cnt["images"].length == 1) {
itemWidget = Container(
child: InkWell(
onTap: () {
// ImagePickers.previewImages(subjectInfo.images,0);
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen(
images:subjectInfo.images,//list
images:cnt["images"],//list
index: 0,//index
), ), );
},
child: MImage(
subjectInfo.images[0],
cnt["images"][0],
fit: BoxFit.cover,
radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width / 1.5,
@ -361,8 +368,8 @@ class _CommunityDynamic extends State<CommunityDynamic> {
} else {
itemWidget = GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: (subjectInfo.images.length == 2 ||
subjectInfo.images.length == 4)
crossAxisCount: (cnt["images"].length == 2 ||
cnt["images"].length == 4)
? 2
: 3,
crossAxisSpacing: 12.w,
@ -378,12 +385,12 @@ class _CommunityDynamic extends State<CommunityDynamic> {
onTap: () {
// ImagePickers.previewImages(subjectInfo.images, position);
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen(
images:subjectInfo.images,//list
images:cnt["images"],//list
index: position,//index
), ), );
},
child: MImage(
subjectInfo.images[position],
cnt["images"][position],
fit: BoxFit.cover,
aspectRatio: 1,
radius: BorderRadius.circular(1),
@ -393,17 +400,18 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
);
},
itemCount: subjectInfo.images.length,
itemCount: cnt["images"].length,
);
}
} else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) {
}
else if (cnt["type"] == "video" && cnt["video"]!= null && cnt["video"].isNotEmpty) {
itemWidget = videoWidget(
MediaQuery.of(context).size.width - 32,
videoPlayerController != null
? (MediaQuery.of(context).size.width - 32) /
videoPlayerController.value.aspectRatio
: MediaQuery.of(context).size.width / 2,
!widget.isList ? subjectInfo.video : widget.comment.coverImg,
!widget.isList ? cnt["video"] : widget.article.coverImg,
);
}
return Column(
@ -551,7 +559,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
fontWeight: FontWeight.bold,
),
onTap: () {
_deleteDynamic(widget.comment.id);
_deleteDynamic(widget.article.id);
Navigator.of(context).pop();
},
),

45
lib/community/headlines/headlines_collection.dart

@ -37,7 +37,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
@override
Widget build(BuildContext context) {
return Container(
height: 60.h,
height: 100.h,
margin: EdgeInsets.only(top:10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
@ -61,7 +61,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
Widget headlinesCollectionItem(HeadlinesList headlines) {
return Container(
width: 225.w,
height:60.h,
height:100.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
@ -85,7 +85,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
child: MImage(
headlines?.coverImg ?? "",
width: 225.w,
height: 60.h,
height: 100.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
@ -97,12 +97,9 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
),
),
Container(
padding: EdgeInsets.only(left:12.w,right: 12.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Row(
padding: EdgeInsets.only(left:12.w,right: 12.w,bottom: 8),
alignment: Alignment.bottomLeft,
child: Row(
children: [
Container(
margin: EdgeInsets.only(right:4),
@ -112,7 +109,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
color: Color(0xFF32A060),
color: Color(0xFF007EFF),
),
child: Text(
"专栏",
@ -133,33 +130,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
color: Colors.white,
),
),),
],)),
// Row(
// children: [
// Expanded(child:Text(
// "更新3篇",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// )),
// Text(
// "查看专栏",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// SizedBox(width: 2),
// Image.asset(
// "assets/image/t_right.png",
// width: 14,
// height: 14,
// ),
// ],),
],),
],)
),
],
),

10
lib/community/headlines/headlines_column_details.dart

@ -142,6 +142,10 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
Stack(
children: [
Positioned(
child: Container(
color: Colors.black,
child:Opacity(
opacity:0.75,
child: MImage(
headlinesListDetails?.bannerImg ?? "",
width: double.infinity,
@ -149,7 +153,9 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
)
)
)
),
Container(
margin: EdgeInsets.only(
@ -194,7 +200,7 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
color: Color(0xFF32A060),
color: Color(0xFF007EFF),
),
child: Text(
"专栏",

134
lib/home/home_page.dart

@ -21,14 +21,17 @@ import 'package:huixiang/retrofit/data/founder.dart';
import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/invite_success_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/new_people_reward.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -42,7 +45,8 @@ class HomePage extends StatefulWidget {
final List<InterviewCouponList> interviewCouponList;
final List<NewUserCouponList> newUserCouponList;
HomePage(this.changeTab, {this.invite,this.interviewCouponList,this.newUserCouponList});
HomePage(this.changeTab,
{this.invite, this.interviewCouponList, this.newUserCouponList});
@override
State<StatefulWidget> createState() {
@ -63,21 +67,21 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
}
});
if((widget.invite??"") != "" || widget.interviewCouponList != null
&& widget.interviewCouponList.length > 0)
showInvite = true;
if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null &&
widget.interviewCouponList.length > 0) showInvite = true;
if(widget.newUserCouponList != null && widget.newUserCouponList.length > 0)
if (widget.newUserCouponList != null && widget.newUserCouponList.length > 0)
showNew = true;
}
///
inviteShowAlertDialog(invite,InterviewCouponList interviewCouponList) {
inviteShowAlertDialog(invite, InterviewCouponList interviewCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return InviteSuccessDialog(invite,interviewCouponList);
return InviteSuccessDialog(invite, interviewCouponList);
},
);
}
@ -114,6 +118,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
List<Goods> gooods = [];
Founder founder;
bool isSigned = false;
int totalMsg = 0;
queryHome() async {
EasyLoading.show(status: S.of(context).zhengzaijiazai);
@ -231,16 +236,43 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
refreshController.refreshFailed();
}
EasyLoading.dismiss();
if(showInvite){
inviteShowAlertDialog(widget.invite,widget.interviewCouponList[0]);
if (showInvite) {
inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
showInvite = false;
}
if(showNew){
if (showNew) {
newShowAlertDialog(widget.newUserCouponList);
showNew = false;
}
}
queryMsgStats() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
baseData.data.forEach((element) {
totalMsg += element.number;
});
});
refreshController.loadComplete();
refreshController.refreshCompleted();
}
EasyLoading.dismiss();
}
_onRefresh(){
queryHome();
queryMsgStats();
}
@override
void dispose() {
super.dispose();
@ -259,17 +291,55 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
leading: false,
actions: [
Container(
margin: EdgeInsets.only(right: 12.w),
height: 24,
alignment: Alignment.center,
margin: EdgeInsets.only(
right: 12.w,
),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/system_msg_page');
},
child: SvgPicture.asset(
child: Container(
height: 24,
alignment:Alignment.center,
child:Stack(
children: [
SvgPicture.asset(
"assets/svg/tixing.svg",
width: 24,
height: 24,
),
if(totalMsg != 0)
Container(
width:36,
alignment: Alignment.topRight,
child:Container(
width:22,
height:14,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
width: 1,
color: Colors.white,
style: BorderStyle.solid,
),
color:Color(0xFFFF441A),
),
child:RoundButton(
text:totalMsg.toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:8.sp,
radius: 100,
)
),
)
],
),
)
)
),
Container(
margin: EdgeInsets.only(right: 16.w),
@ -300,7 +370,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: FutureBuilder(
future: queryHome(),
future: _onRefresh(),
builder: (context, snapshot) {
return Column(
children: [
@ -308,14 +378,16 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
HomeBanner(bannerData, controller),
///
ShortcutOperation((){
ShortcutOperation(() {
widget.changeTab(1);
}),
///
SignView(isSigned,(value){setState(() {
SignView(isSigned, (value) {
setState(() {
isSigned = value;
});}),
});
}),
// ///
// HotArticle(articles),
@ -330,12 +402,16 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
// CouponView(),
///
HomeIntegralStore(gooods),
SizedBox(
height: 28,
),
///
FeaturedActivity(),
///
HomeIntegralStore(gooods),
///Tab
PointsGoodsTitle(
gooodsCategorys,
@ -400,7 +476,12 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
String tableId = uri.queryParameters["tableId"];
String tenantCode = uri.queryParameters["tenantCode"];
String shopId = uri.queryParameters["shopId"];
if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") {
if (tableId != null &&
tableId != "" &&
tenantCode != null &&
tenantCode != "" &&
shopId != null &&
shopId != "") {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
@ -412,8 +493,23 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
);
}
} else {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.png",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await Permission.camera.request();
}
},
heightRatioWithWidth: 0.82,
);
});
}
}
_toDetails(index) async {

59
lib/home/home_view/featured_acticvity.dart

@ -78,9 +78,9 @@ class _FeaturedActivity extends State<FeaturedActivity> {
child: stackItem(18.sp, activityList[0]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h,
height: 125.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(6),
color: Colors.red,
image: DecorationImage(
image: NetworkImage(
@ -106,9 +106,9 @@ class _FeaturedActivity extends State<FeaturedActivity> {
child: stackItem(12.sp, activityList[1]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h / 2,
height:125.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(6),
color: Colors.green,
image: DecorationImage(
image: NetworkImage(
@ -122,28 +122,28 @@ class _FeaturedActivity extends State<FeaturedActivity> {
SizedBox(
height: 5,
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/web_page',
arguments: {"activityId": activityList[2].id});
},
child: Container(
child: stackItem(12.sp, activityList[2]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h / 2,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.blue,
image: DecorationImage(
image: NetworkImage(
activityList[2].coverImg,
),
fit: BoxFit.fill,
),
),
),
),
// GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed('/router/web_page',
// arguments: {"activityId": activityList[2].id});
// },
// child: Container(
// child: stackItem(12.sp, activityList[2]),
// margin: EdgeInsets.symmetric(horizontal: 5.w),
// width: (MediaQuery.of(context).size.width - 42) / 2,
// height: 190.h / 2,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(4),
// color: Colors.blue,
// image: DecorationImage(
// image: NetworkImage(
// activityList[2].coverImg,
// ),
// fit: BoxFit.fill,
// ),
// ),
// ),
// ),
],
),
),
@ -160,7 +160,10 @@ class _FeaturedActivity extends State<FeaturedActivity> {
Widget stackItem(double textSize, Activity activity) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color.fromARGB(80, 0, 0, 0),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -176,7 +179,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
maxLines: 1,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: textSize,
fontSize: 14.sp,
color: Colors.white,
),
),
@ -195,7 +198,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
),
),
Container(
width: 58.w,
width: 48.w,
margin: EdgeInsets.only(left: 8, bottom: 8),
padding: EdgeInsets.symmetric(
vertical: 4.h,

2
lib/home/home_view/quick_order.dart

@ -160,7 +160,7 @@ class _QuickOrder extends State<QuickOrder> {
children: [
ItemTitle(
text: "店铺推荐",
imgPath: "assets/image/icon_points_mall.png",
imgPath: "assets/image/icon_shop.png",
),
Container(
height: 170,

35
lib/home/home_view/shortcut_operation.dart

@ -46,7 +46,18 @@ class _ShortcutOperation extends State<ShortcutOperation> {
},
child: Container(
width: 106,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(4),
),
margin: EdgeInsets.only(right:10),
padding: EdgeInsets.only(top: 8,bottom: 8),
child: Column(
@ -84,7 +95,18 @@ class _ShortcutOperation extends State<ShortcutOperation> {
},
child: Container(
width: 106,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(4),
),
margin: EdgeInsets.only(right:10),
padding: EdgeInsets.only(top: 8,bottom: 8),
child: Column(
@ -99,7 +121,7 @@ class _ShortcutOperation extends State<ShortcutOperation> {
),
SizedBox(height: 5),
Text(
"充值送会员!",
"会员享有赠送",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
@ -122,7 +144,18 @@ class _ShortcutOperation extends State<ShortcutOperation> {
},
child:Container(
width: 106,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(4),
),
padding: EdgeInsets.only(top: 8,bottom: 8),
child: Column(
children: [

5
lib/home/points_mall_view/points_goods_title.dart

@ -3,6 +3,7 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:huixiang/view_widget/my_tab.dart';
class PointsGoodsTitle extends StatefulWidget {
@ -41,6 +42,10 @@ class _PointsGoodsTitle extends State<PointsGoodsTitle> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ItemTitle(
text: S.of(context).jifenshangcheng,
imgPath: "assets/image/icon_points_mall.png",
),
// ItemTitle(
// text: S.of(context).jifenshangcheng,
// imgPath: "assets/image/icon_points_mall.png",

16
lib/login/login_page.dart

@ -512,20 +512,16 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
Container(
height: MediaQuery.of(context).size.height * 0.78,
margin: EdgeInsets.only(top: 56.h),
alignment: Alignment.topCenter,
child:Image.asset(
"assets/image/icon_login_logo.png",
width: 91.w,
height: 91.h,
),
SizedBox(
height: 0.596.sh,
),
],
),
)
],
),
),

2
lib/main.dart

@ -330,5 +330,5 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/photo_view_gallery_screen': (context, {arguments}) =>
PhotoViewGalleryScreen(),
'/router/system_details': (context, {arguments}) =>
SystemDetails(),
SystemDetails(arguments:arguments),
};

529
lib/message/system_details.dart

@ -1,22 +1,31 @@
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/article.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/comment_menu.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:huixiang/web/web_view/comment_list.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();
@ -25,10 +34,22 @@ class SystemDetails extends StatefulWidget {
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();
@override
void initState() {
super.initState();
msgType = widget.arguments["msgType"];
SharedPreferences.getInstance().then((value) {
apiService =
@ -37,8 +58,6 @@ class _SystemDetails extends State<SystemDetails> {
});
}
int pageNum = 1;
List<Message> messages = [];
_refresh() {
pageNum = 1;
@ -51,7 +70,7 @@ class _SystemDetails extends State<SystemDetails> {
"pageSize": 10,
"searchKey": "",
"state": "",
"typed": ""
"typed": msgType
}).catchError((onError) {
_refreshController.loadFailed();
_refreshController.refreshFailed();
@ -75,6 +94,46 @@ class _SystemDetails extends State<SystemDetails> {
}
}
///
_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[0].relational),
parenId = messageRelational["mid"].toString();
hintText = S.of(context).huifu_("${messageRelational["nickname"]}");
}
///
_queryMemberComment(String content) async {
BaseData baseData = await apiService.memberComment({
"content": content,
"parentId": parenId,
"relationalId": messages[0].mid,
"relationalType":4
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
// CommentListState state = commentKey.currentState;
// state.queryMemberCommentList();
commentTextController.text = "";
FocusScope.of(context).unfocus();
Navigator.of(context).pop();
SmartDialog.showToast("发布成功", alignment: Alignment.center);
}
else{
SmartDialog.showToast("发布失败", alignment: Alignment.center);
}
}
RefreshController _refreshController = RefreshController();
@override
@ -83,13 +142,11 @@ class _SystemDetails extends State<SystemDetails> {
appBar: MyAppBar(
background: Colors.white,
leadingColor: Colors.black,
// title: "订单通知",
// title: "充值消息",
title: "点赞",
title: (msgType == 2) ?"订单通知":(msgType == 3) ?"充值消息":(msgType == 4) ?"关注":(msgType == 5) ?"点赞":"评论",
titleSize: 18.sp,
titleColor: Colors.black,
),
body: SmartRefresher(
body:SmartRefresher(
enablePullDown: true,
enablePullUp: true,
header: MyHeader(),
@ -97,7 +154,7 @@ class _SystemDetails extends State<SystemDetails> {
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus mode) {
return MyFooter(mode);
return (messages.length == 0)?Container():MyFooter(mode);
},
),
controller: _refreshController,
@ -105,23 +162,29 @@ class _SystemDetails extends State<SystemDetails> {
onLoading: () {
queryMessage();
},
child: Container(
child:
Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child:
Container(
child: Column(
children: [
if(msgType == 2)
orderMessage(),
// rechargeMessage(),
// fabulousMessage(),
// commentMessage(),
// followMessage(),
if(msgType == 3)
rechargeMessage(),
if(msgType == 5)
fabulousMessage(),
if(msgType == 6)
commentMessage(),
if(msgType == 4)
followMessage(),
],
),
),
),
),
),
);
}
@ -410,10 +473,13 @@ class _SystemDetails extends State<SystemDetails> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
// if (messages[position].typed == 2) {
// Navigator.of(context)
// .pushNamed('/router/exchange_order_details');
// }
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"businessId":jsonDecode(messages[position].relational)["businessId"].toString(),
"mid":messages[position].mid
},
);
},
child: fabulousMessageItem(messages[position]),
);
@ -423,26 +489,27 @@ class _SystemDetails extends State<SystemDetails> {
);
}
Widget fabulousMessageItem(Message message) {
var messageRelational = jsonDecode(message.relational);
return Container(
child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/c_z.png",
width: 44.w,
height: 44.h,
),
// MImage(
// "",
// width: 44,
// height: 44,
// isCircle: true,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// Image.asset(
// "assets/image/c_z.png",
// width: 44.w,
// height: 44.h,
// ),
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,
@ -451,7 +518,7 @@ class _SystemDetails extends State<SystemDetails> {
Row(
children: [
Text(
"张五",
messageRelational["nickname"],
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 14.sp,
@ -483,30 +550,30 @@ class _SystemDetails extends State<SystemDetails> {
padding:EdgeInsets.all(5),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
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",
// 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(
@ -557,10 +624,13 @@ class _SystemDetails extends State<SystemDetails> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
// if (messages[position].typed == 2) {
// Navigator.of(context)
// .pushNamed('/router/exchange_order_details');
// }
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"businessId":jsonDecode(messages[position].relational)["businessId"].toString(),
"mid":messages[position].mid
},
);
},
child: commentMessageItem(messages[position]),
);
@ -570,26 +640,22 @@ class _SystemDetails extends State<SystemDetails> {
);
}
Widget commentMessageItem(Message message) {
var messageRelational = jsonDecode(message.relational);
return Container(
child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/c_z.png",
width: 44.w,
height: 44.h,
),
// MImage(
// "",
// width: 44,
// height: 44,
// isCircle: true,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
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,
@ -606,7 +672,7 @@ class _SystemDetails extends State<SystemDetails> {
Row(
children: [
Text(
"张五",
messageRelational["nickname"],
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 14.sp,
@ -633,8 +699,15 @@ class _SystemDetails extends State<SystemDetails> {
),
],
),),
Container(
height: 21.h,
GestureDetector(
onTap: (){
setState(() {
showDeleteDialog();
_reply(messageRelational);
});
},
child: Container(
height:22.h,
width: 40.w,
padding:EdgeInsets.only(left:2,right:2),
alignment: Alignment.center,
@ -655,51 +728,94 @@ class _SystemDetails extends State<SystemDetails> {
),
),
),
)
],
),
SizedBox(height:8.h,),
Text(
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Mess…",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
height: 1.3,
fontWeight: MyFontWeight.regular,
color: Color(0xFF1A1A1A),
),
),
SizedBox(height:12.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.start,
crossAxisAlignment: CrossAxisAlignment.center,
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",
// 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(
@ -763,26 +879,22 @@ class _SystemDetails extends State<SystemDetails> {
);
}
Widget followMessageItem(Message message) {
var messageRelational = jsonDecode(message.relational);
return Container(
child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/c_z.png",
width: 44.w,
height: 44.h,
),
// MImage(
// "",
// width: 44,
// height: 44,
// isCircle: true,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
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,
@ -799,7 +911,7 @@ class _SystemDetails extends State<SystemDetails> {
Row(
children: [
Text(
"张五",
messageRelational["nickname"],
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 14.sp,
@ -826,36 +938,74 @@ class _SystemDetails extends State<SystemDetails> {
),
],
),),
Container(
GestureDetector(
onTap: (){
setState(() {
_vipFollow(messageRelational["mid"].toString(),message?.followed ?? false);
});
},
child:
RoundButton(
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: Color(0xFF00A359),
),
child: Row(
children: [
Icon(Icons.add,
color:Colors.white,
size: 16,
),
Text(
"回关",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
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,
// ),
// ),
// ],
// ),
// )
),
],
),
@ -872,4 +1022,87 @@ class _SystemDetails extends State<SystemDetails> {
),
);
}
///
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),
),
),
),
),
],
),
),
);
},
);
}
}

144
lib/message/system_message.dart

@ -1,8 +1,10 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.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/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -24,6 +26,18 @@ class SystemMessagePage extends StatefulWidget {
class _SystemMessagePage extends State<SystemMessagePage> {
ApiService apiService;
int pageNum = 1;
List<Message> messages = [];
List<MsgStats> msgStats = [];
Map <String,int> msgNumber = {
"1":0,
"2":0,
"3":0,
"4":0,
"5":0,
"6":0,
};
int state = 0;
@override
void initState() {
@ -33,15 +47,14 @@ class _SystemMessagePage extends State<SystemMessagePage> {
apiService =
ApiService(Dio(), token: value.getString("token"), context: context);
queryMessage();
queryMsgStats();
});
}
int pageNum = 1;
List<Message> messages = [];
_refresh() {
pageNum = 1;
queryMessage();
queryMsgStats();
}
queryMessage() async {
@ -60,7 +73,13 @@ class _SystemMessagePage extends State<SystemMessagePage> {
if (pageNum == 1) {
messages.clear();
}
messages.addAll(baseData.data.list);
List<Message> message = [];
message.addAll(baseData.data.list);
message.forEach((element) {
if(element.typed==2 || element.typed==3){
messages.add(element);
}
});
_refreshController.loadComplete();
_refreshController.refreshCompleted();
if (mounted) setState(() {});
@ -75,6 +94,32 @@ class _SystemMessagePage extends State<SystemMessagePage> {
}
}
queryMsgStats() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
msgStats.clear();
msgStats = baseData.data;
msgStats.forEach((element) {
if(msgNumber.containsKey(element.name)){
msgNumber[element.name] = element.number;
}
});
});
_refreshController.loadComplete();
_refreshController.refreshCompleted();
}
EasyLoading.dismiss();
}
RefreshController _refreshController = RefreshController();
@override
@ -92,6 +137,9 @@ class _SystemMessagePage extends State<SystemMessagePage> {
alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () {
setState(() {
queryMsgStats();
});
},
child: Text(
"标为已读",
@ -113,13 +161,15 @@ class _SystemMessagePage extends State<SystemMessagePage> {
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus mode) {
return MyFooter(mode);
return (messages.length == 0)?Container():MyFooter(mode);
},
),
controller: _refreshController,
onRefresh: _refresh,
onLoading: () {
queryMessage();
setState(() {
_refresh();
});
},
child: Container(
child: SingleChildScrollView(
@ -146,7 +196,12 @@ class _SystemMessagePage extends State<SystemMessagePage> {
padding: EdgeInsets.only(top: 16.h,bottom: 16.h),
child: Row(
children: [
Expanded(child: Column(
Expanded(child: GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":5});
},
child:Column(
children: [
Stack(
children: [
@ -155,6 +210,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
width: 40,
height: 40,
),
if(msgNumber["5"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
@ -171,7 +227,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
color:Color(0xFFFF441A),
),
child:RoundButton(
text: "99+",
text:msgNumber["5"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
@ -183,12 +239,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
],
),
SizedBox(height: 6.h),
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details');
},
child:Text(
Text(
"点赞",
style: TextStyle(
fontSize: 14.sp,
@ -196,10 +247,17 @@ class _SystemMessagePage extends State<SystemMessagePage> {
color: Color(0xFF060606),
),
)
),
],
)),
Expanded(child:Column(
)
)
),
Expanded(child:
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":6});
},
child: Column(
children: [
Stack(
children: [
@ -208,6 +266,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
width: 40,
height: 40,
),
if(msgNumber["6"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
@ -224,7 +283,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
color:Color(0xFFFF441A),
),
child:RoundButton(
text: "99",
text: msgNumber["6"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
@ -245,8 +304,15 @@ class _SystemMessagePage extends State<SystemMessagePage> {
),
),
],
)
)),
Expanded(child:Column(
Expanded(child:
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":4});
},
child:Column(
children: [
Stack(
children: [
@ -255,6 +321,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
width: 40,
height: 40,
),
if(msgNumber["4"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
@ -271,7 +338,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
color:Color(0xFFFF441A),
),
child:RoundButton(
text: "1",
text: msgNumber["4"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
@ -292,7 +359,9 @@ class _SystemMessagePage extends State<SystemMessagePage> {
),
),
],
)),
)
)
),
],
),
);
@ -322,7 +391,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
)
: ListView.builder(
:ListView.builder(
padding: EdgeInsets.only(top: 16),
itemCount: messages.length,
shrinkWrap: true,
@ -330,12 +399,12 @@ class _SystemMessagePage extends State<SystemMessagePage> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
// if (messages[position].typed == 2) {
// Navigator.of(context)
// .pushNamed('/router/exchange_order_details');
// }
if(messages[position].typed == 2)
Navigator.of(context)
.pushNamed('/router/system_details');
.pushNamed('/router/system_details',arguments: {"msgType":2});
else if(messages[position].typed == 3)
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":3});
},
child: buildMessageItem(messages[position]),
);
@ -423,10 +492,11 @@ class _SystemMessagePage extends State<SystemMessagePage> {
color: Color(0xFF353535),
),
),),
if(msgNumber["2"].toString() != "0")
RoundButton(
width: 16,
height: 16,
text: "1",
text:msgNumber["2"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
@ -435,12 +505,30 @@ class _SystemMessagePage extends State<SystemMessagePage> {
),
],
):
Row(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
message.content,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF353535),
),
)),
if(msgNumber["3"].toString() != "0")
RoundButton(
width: 16,
height: 16,
text:msgNumber["3"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:10.sp,
radius: 100,
),
],
),
],
)),

69
lib/mine/mine_page.dart

@ -198,9 +198,6 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
},
),
/////
attention(),
/// VIP等级信息
MineVipView(
tag: "vip",
@ -214,6 +211,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
),
),
/////
attention(),
///
WalletCoupon(),
@ -311,7 +311,20 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
/////
Widget attention(){
return Container(
margin: EdgeInsets.only(left: 16,top: 10),
margin: EdgeInsets.only(left: 16,top: 10,right: 16),
padding: EdgeInsets.only(top: 16,bottom: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child:GestureDetector(
onTap:(){
Navigator.of(context).pushNamed(
@ -331,23 +344,23 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
S.of(context).guanzhu,
infoNumber != null ?infoNumber.follow.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(width: 5,),
SizedBox(height:4,),
Text(
infoNumber != null ?infoNumber.follow.toString() :"0",
S.of(context).guanzhu,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
@ -361,23 +374,23 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
S.of(context).fensi,
infoNumber != null ?infoNumber.fans.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(width: 5,),
SizedBox(height:4,),
Text(
infoNumber != null ?infoNumber.fans.toString() :"0",
S.of(context).fensi,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
@ -391,23 +404,23 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
"成就",
infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(width: 5,),
SizedBox(height:4,),
Text(
infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
"成就",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],

53
lib/mine/mine_view/mine_item.dart

@ -17,7 +17,7 @@ class _MineItem extends State<MineItem> {
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h),
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
// padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
@ -50,7 +50,7 @@ class _MineItem extends State<MineItem> {
// ),
// ),
Container(
padding: EdgeInsets.symmetric(vertical: 4.h),
padding: EdgeInsets.only(left: 16,top:16,bottom:4),
child: Text(
S.of(context).wodegongju,
style: TextStyle(
@ -60,7 +60,9 @@ class _MineItem extends State<MineItem> {
),
),
),
InkWell(
Row(
children: [
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -77,8 +79,8 @@ class _MineItem extends State<MineItem> {
S.of(context).wodedongtai,
"assets/image/dynamic.png",
),
),
InkWell(
),),
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -94,8 +96,8 @@ class _MineItem extends State<MineItem> {
S.of(context).duihuanlishi,
"assets/image/icon_mine_records_of_consumption.png",
),
),
InkWell(
),),
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -110,8 +112,8 @@ class _MineItem extends State<MineItem> {
S.of(context).wodekaquan,
"assets/image/icon_mine_card.png",
),
),
InkWell(
),),
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -126,8 +128,11 @@ class _MineItem extends State<MineItem> {
S.of(context).guanlidizhi,
"assets/image/icon_location_address.png",
),
),)
],
),
InkWell(
Padding(padding:EdgeInsets.only(left:24),
child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/qr_share', arguments: {});
},
@ -135,7 +140,8 @@ class _MineItem extends State<MineItem> {
S.of(context).tuiguangma,
"assets/image/icon_mine_promotion_code.png",
),
),
),)
// mineItem(
// S.of(context).bangzhuyufankui,
// "assets/image/icon_mine_feedback.png",
@ -150,34 +156,31 @@ class _MineItem extends State<MineItem> {
return Container(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 6.h),
child: Row(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
icon,
width: 28.w,
height: 28.h,
width: 32.w,
height: 32.w,
),
SizedBox(
width: 8.w,
height: 2.h,
),
Expanded(
flex: 1,
child: Text(
Text(
text,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
fontSize: 12.sp,
color: Color(0xFF353535),
),
),
),
Icon(
Icons.keyboard_arrow_right,
size: 20,
color: Colors.black,
)
// Icon(
// Icons.keyboard_arrow_right,
// size: 20,
// color: Colors.black,
// )
],
),
);

8
lib/mine/mine_view/mine_view.dart

@ -42,8 +42,8 @@ class _MineView extends State<MineView> {
padding: EdgeInsets.all(8.h),
child: Image.asset(
"assets/image/icon_scan_qr_code.png",
width: 24.w,
height: 24.h,
width:32.w,
height: 32.h,
),
),
),
@ -56,8 +56,8 @@ class _MineView extends State<MineView> {
margin: EdgeInsets.only(right: 12.w),
child: Image.asset(
"assets/image/icon_mine_setting.png",
width: 24.w,
height: 24.h,
width: 32.w,
height: 32.h,
),
),
),

15
lib/mine/mine_wallet_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.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:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -57,7 +58,8 @@ class _MineWalletPage extends State<MineWalletPage> {
}
queryUserBalance() async {
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {});
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
mBalance = double.tryParse(userInfo.money);
@ -168,7 +170,14 @@ class _MineWalletPage extends State<MineWalletPage> {
),
Container(
margin: EdgeInsets.only(top: 14.h),
child: ListView.builder(
child: (userBills == null || userBills.length == 0)
? NoDataView(
isShowBtn: false,
text: "目前暂未记录哦",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
)
: ListView.builder(
itemCount: userBills != null ? userBills.length : 0,
shrinkWrap: true,
padding: EdgeInsets.only(bottom: 20.h),
@ -200,7 +209,7 @@ class _MineWalletPage extends State<MineWalletPage> {
Expanded(
flex: 1,
child: Container(
height: 34.h,
// height: 34.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

34
lib/mine/release_page.dart

@ -1,8 +1,11 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
@ -26,7 +29,7 @@ class _ReleasePage extends State<ReleasePage> {
int pageNum = 0;
String userId;
List<ComunityComment> comments = [];
List<Article> articles = [];
@override
void initState() {
@ -66,10 +69,24 @@ class _ReleasePage extends State<ReleasePage> {
refreshController.loadComplete();
if (baseData.isSuccess) {
if (pageNum == 1) {
comments.clear();
articles.clear();
}
comments.addAll(baseData.data.list);
print("comments: ${comments.length}");
baseData.data.list.forEach((element) {
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.liked = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
article.createTime = element.createTime;
article.updateUser = element.memberInfo?.mid;
article.viewers = element?.viewers;
article.likes = element?.likes;
article.comments = element?.comments;
articles.add(article);
});
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
@ -109,8 +126,9 @@ class _ReleasePage extends State<ReleasePage> {
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
comments[position],
1,exitFull: (){setState(() {
articles[position],
1,
exitFull: (){setState(() {
_onRefresh();
});},
removalDynamic: () {
@ -121,13 +139,13 @@ class _ReleasePage extends State<ReleasePage> {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],"userId":userId,
"businessId": articles[position].id,"userId":userId,
},
);
},
);
},
itemCount: comments.length,
itemCount: articles.length,
)),
);
},

2
lib/order/order_view/order_commodity.dart

@ -169,7 +169,7 @@ class _OrderCommodity extends State<OrderCommodity> {
margin: EdgeInsets.only(
left: 16.w,
),
height: 44.h,
// height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

102
lib/retrofit/data/article.dart

@ -14,7 +14,7 @@ class Article {
dynamic _viceTitle;
String _content;
String _coverImg;
Author _author;
dynamic _author;
int _type;
String _startTime;
String _categoryId;
@ -26,6 +26,8 @@ class Article {
bool _liked;
int _viewers;
int _comments;
String _authorName;
String _authorHeadImg;
bool isFollow;
dynamic _storeName;
@ -39,7 +41,7 @@ class Article {
dynamic get viceTitle => _viceTitle;
String get content => _content;
String get coverImg => _coverImg;
Author get author => _author;
dynamic get author => _author;
int get type => _type;
String get startTime => _startTime;
String get categoryId => _categoryId;
@ -51,8 +53,14 @@ class Article {
bool get liked => _liked;
int get viewers => _viewers;
int get comments => _comments;
String get authorName => _authorName;
String get authorHeadImg => _authorHeadImg;
dynamic get storeName => _storeName;
set id(String value) {
_id = value;
}
set likes(int value) {
_likes = value;
}
@ -69,6 +77,14 @@ class Article {
_comments = value;
}
set authorName(String value) {
_authorName = value;
}
set authorHeadImg(String value) {
_authorHeadImg = value;
}
Article({
String id,
String createTime,
@ -90,6 +106,9 @@ class Article {
bool isHot,
int viewers,
int comments,
String authorName,
String authorHeadImg,
dynamic storeName}){
_id = id;
_createTime = createTime;
@ -113,6 +132,8 @@ class Article {
_liked = liked;
_viewers = viewers;
_comments = comments;
_authorName = authorName;
_authorHeadImg = authorHeadImg;
_storeName = storeName;
}
@ -127,7 +148,7 @@ class Article {
_viceTitle = json["viceTitle"];
_content = json["content"];
_coverImg = json["coverImg"];
_author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"]));
_author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null;
_type = json["type"];
_startTime = json["startTime"];
_categoryId = json["categoryId"];
@ -139,6 +160,8 @@ class Article {
_liked = json["liked"];
_viewers = json["viewers"];
_comments = json["comments"];
_authorName = json["authorName"];
_authorHeadImg = json["authorHeadImg"];
_storeName = json["storeName"];
}
@ -166,8 +189,81 @@ class Article {
map["liked"] = _liked;
map["viewers"] = _viewers;
map["comments"] = _comments;
map["authorName"] = _authorName;
map["authorHeadImg"] = _authorHeadImg;
map["storeName"] = _storeName;
return map;
}
set createTime(String value) {
_createTime = value;
}
set createUser(dynamic value) {
_createUser = value;
}
set updateTime(String value) {
_updateTime = value;
}
set updateUser(dynamic value) {
_updateUser = value;
}
set storeId(String value) {
_storeId = value;
}
set mainTitle(String value) {
_mainTitle = value;
}
set viceTitle(dynamic value) {
_viceTitle = value;
}
set content(String value) {
_content = value;
}
set coverImg(String value) {
_coverImg = value;
}
set author(dynamic value) {
_author = value;
}
set type(int value) {
_type = value;
}
set startTime(String value) {
_startTime = value;
}
set categoryId(String value) {
_categoryId = value;
}
set endTime(String value) {
_endTime = value;
}
set state(int value) {
_state = value;
}
set isDelete(int value) {
_isDelete = value;
}
set isHot(bool value) {
_isHot = value;
}
set storeName(dynamic value) {
_storeName = value;
}
}

129
lib/retrofit/data/message.dart

@ -1,44 +1,18 @@
/// id : "1420215467561189376"
/// createTime : "2021-07-28 10:58:26"
/// id : "1483062749750624256"
/// createTime : "2022-01-17 21:04:48"
/// createUser : "0"
/// updateTime : "2021-07-28 10:58:29"
/// updateTime : "2022-01-17 21:04:48"
/// updateUser : "0"
/// mid : "1406879717390286848"
/// title : "充值成功"
/// content : "你于2021-07-28 10:52:02充值0.01元,当前余额:0.08元。"
/// typed : 3
/// relational : ""
/// state : 1
/// mid : "1478548672881885184"
/// title : "粉丝关注"
/// content : "哈哈哈关注了你!"
/// typed : 4
/// relational : "{\"businessId\":1483062749356359680,\"mid\":1379254113602109440,\"avatar\":\"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg\",\"typed\":\"MEMBER\",\"nickname\":\"哈哈哈\",\"action\":\"FOLLOW\",\"receiveMid\":1478548672881885184}"
/// state : 0
/// isDelete : 0
/// followed : false
class Message {
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _title;
String _content;
int _typed;
String _relational;
int _state;
int _isDelete;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get title => _title;
String get content => _content;
int get typed => _typed;
String get relational => _relational;
int get state => _state;
int get isDelete => _isDelete;
Message({
String id,
String createTime,
@ -51,7 +25,8 @@ class Message {
int typed,
String relational,
int state,
int isDelete}){
int isDelete,
bool followed,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
@ -64,37 +39,67 @@ class Message {
_relational = relational;
_state = state;
_isDelete = isDelete;
_followed = followed;
}
Message.fromJson(dynamic json) {
_id = json["id"];
_createTime = json["createTime"];
_createUser = json["createUser"];
_updateTime = json["updateTime"];
_updateUser = json["updateUser"];
_mid = json["mid"];
_title = json["title"];
_content = json["content"];
_typed = json["typed"];
_relational = json["relational"];
_state = json["state"];
_isDelete = json["isDelete"];
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_mid = json['mid'];
_title = json['title'];
_content = json['content'];
_typed = json['typed'];
_relational = json['relational'];
_state = json['state'];
_isDelete = json['isDelete'];
_followed = json['followed'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _title;
String _content;
int _typed;
String _relational;
int _state;
int _isDelete;
bool _followed;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get title => _title;
String get content => _content;
int get typed => _typed;
String get relational => _relational;
int get state => _state;
int get isDelete => _isDelete;
bool get followed => _followed;
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["id"] = _id;
map["createTime"] = _createTime;
map["createUser"] = _createUser;
map["updateTime"] = _updateTime;
map["updateUser"] = _updateUser;
map["mid"] = _mid;
map["title"] = _title;
map["content"] = _content;
map["typed"] = _typed;
map["relational"] = _relational;
map["state"] = _state;
map["isDelete"] = _isDelete;
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['mid'] = _mid;
map['title'] = _title;
map['content'] = _content;
map['typed'] = _typed;
map['relational'] = _relational;
map['state'] = _state;
map['isDelete'] = _isDelete;
map['followed'] = _followed;
return map;
}

29
lib/retrofit/data/msg_stats.dart

@ -0,0 +1,29 @@
/// name : "4"
/// number : 8
class MsgStats {
MsgStats({
String name,
int number,}){
_name = name;
_number = number;
}
MsgStats.fromJson(dynamic json) {
_name = json['name'];
_number = json['number'];
}
String _name;
int _number;
String get name => _name;
int get number => _number;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['name'] = _name;
map['number'] = _number;
return map;
}
}

17
lib/retrofit/retrofit_api.dart

@ -36,6 +36,7 @@ import 'data/headlines_list_details.dart';
import 'data/logistics.dart';
import 'data/member_comment_list.dart';
import 'data/message.dart';
import 'data/msg_stats.dart';
import 'data/page.dart';
import 'data/rank.dart';
import 'data/second_card_list.dart';
@ -53,8 +54,8 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart';
// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
@ -62,12 +63,15 @@ part 'retrofit_api.g.dart';
// const base_url = "http://192.168.10.236:8766/app/"; ///
// const baseUrl = "http://192.168.10.236:8766/app/"; ///
// const base_url = "http://192.168.10.159:8766/app/"; ///
// const baseUrl = "http://192.168.10.159:8766/app/"; ///
// const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.142:8766/app/";///
const baseUrl = "http://192.168.10.142:8766/app/";///
// const base_url = "http://192.168.10.142:8766/app/";///
// const baseUrl = "http://192.168.10.142:8766/app/";///
@RestApi(baseUrl: baseUrl)
abstract class ApiService {
@ -345,6 +349,10 @@ abstract class ApiService {
@GET("/app-msg/{id}")
Future<BaseData> queryMsg(@Path("id") String id);
///App消息
@GET("/app-msg/stats")
Future<BaseData<List<MsgStats>>> stats();
////
@GET("/information/likes/{id}")
Future<BaseData> informationLikes(@Path("id") String id);
@ -396,7 +404,6 @@ abstract class ApiService {
@POST("/member/follow/list")
Future<BaseData<PageInfo<ListData>>> followList(@Body() Map<String, dynamic> map);
////
@PUT("/member/follow/{followId}")
Future<BaseData> follow(@Path("followId") String followId);

24
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.142:8766/app/';
baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/';
}
final Dio _dio;
@ -1032,6 +1032,28 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<List<MsgStats>>> stats() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/app-msg/stats',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<MsgStats>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<MsgStats>((i) => MsgStats.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<dynamic>> informationLikes(id) async {
ArgumentError.checkNotNull(id, 'id');

2
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -134,7 +134,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
margin: EdgeInsets.only(
left: 16.w,
),
height: 44.h,
// height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

2
lib/store/store_order.dart

@ -313,7 +313,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
],
),
),
top: 110.h,
top: 100.h,
bottom: 0,
left: 0,
right: 0,

2
lib/store/store_view/store_info.dart

@ -30,7 +30,7 @@ class _StoreInfoView extends State<StoreInfoView> {
top: 5.h,
bottom: 6.h,
),
height: 138.h,
height: 140.h,
padding: EdgeInsets.all(12.w),
decoration: BoxDecoration(
color: Colors.white,

3
lib/view_widget/item_input_widget.dart

@ -147,7 +147,8 @@ class ItemInputWidget extends StatelessWidget {
margin: EdgeInsets.only(left: 5, bottom: 12.h),
),
Container(
height: 0.035.sh,
// height: 0.035.sh,
margin: EdgeInsets.only(bottom:10.h),
child: TextField(
controller: controller,
style: style,

8
lib/view_widget/request_permission.dart

@ -37,7 +37,9 @@ class _RequestPermission extends State<RequestPermission> {
type: MaterialType.transparency,
child: Center(
child: Container(
width: widget.width ?? 0.7867.sw,
// width: widget.width ?? 0.7867.sw,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 24.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.white,
@ -50,8 +52,8 @@ class _RequestPermission extends State<RequestPermission> {
children: [
Image.asset(
widget.src,
width: 0.7867.sw * 0.6,
height: 0.7867.sw * 0.6 * 0.7,
// width: 0.7867.sw * 0.6,
// height: 0.7867.sw * 0.6 * 0.7,
fit: BoxFit.fill,
),
SizedBox(

Loading…
Cancel
Save