diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 70c1a496..5acb2ee0 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -36,7 +36,6 @@ class CommunityChildPageState extends State with AutomaticKe bool isRefresh = true; bool isLoadingData = false; ScrollController sc = ScrollController(); - List
articles = []; @override @@ -53,7 +52,7 @@ class CommunityChildPageState extends State with AutomaticKe } ///动态列表 - queryCommunity() async { + queryCommunity(String searchKey) async { if(!isRefresh){ isRefresh = true; return; @@ -76,45 +75,70 @@ class CommunityChildPageState extends State with AutomaticKe pageNum += 1; isLoadMore = false; } - else pageNum = 1; + else if(searchKey == null)pageNum = 1; BaseData> baseData = await apiService.trendList({ "mid":"", "onlyFollow": widget.typeStr == "关注" ? true : false, "onlyMe": false, - "pageNum": pageNum, + "pageNum": searchKey == null?pageNum:1, "pageSize": 10, - "searchKey": "" + "searchKey": searchKey??"" }).catchError((error) { - refreshController.refreshFailed(); - refreshController.loadFailed(); + if(searchKey == null) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } }); - - refreshController.refreshCompleted(); - refreshController.loadComplete(); + if(searchKey == null) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } if (baseData.isSuccess) { - if (pageNum == 1) { - articles.clear(); - } - baseData.data.list.forEach((element) { - var article = Article(); - article.id = element.id; - article.content = jsonEncode(element.subjectInfo); - article.mainTitle =element.subject; - article.followed = element.selfFollow; - article.authorHeadImg = element.memberInfo?.avatar; - article.authorName = element.memberInfo?.nickname; - article.location = element.location; - article.createTime = element.createTime; - article.author = 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}"); - if (int.tryParse(baseData.data.total) < (pageNum * 10)) { - refreshController.loadNoData(); + if(searchKey != null){ + if(baseData?.data?.list != null && baseData.data.list.isNotEmpty) + articles.forEach((element) { + if(element.id == searchKey){ + element.content = jsonEncode(baseData.data.list[0].subjectInfo); + element.mainTitle =baseData.data.list[0].subject; + element.followed = baseData.data.list[0].selfFollow; + element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar; + element.authorName = baseData.data.list[0].memberInfo?.nickname; + element.location = baseData.data.list[0].location; + element.createTime = baseData.data.list[0].createTime; + element.author = baseData.data.list[0].memberInfo?.mid; + element.viewers = baseData.data.list[0]?.viewers; + element.likes = baseData.data.list[0]?.likes; + element.comments = baseData.data.list[0]?.comments; + this.isRefresh = false; + setState(() { + }); + } + }); + }else{ + if (pageNum == 1) { + articles.clear(); + } + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.followed = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.location = element.location; + article.createTime = element.createTime; + article.author = 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}"); + if (int.tryParse(baseData.data.total) < (pageNum * 10)) { + refreshController.loadNoData(); + } } } @@ -125,7 +149,7 @@ class CommunityChildPageState extends State with AutomaticKe Widget build(BuildContext context) { super.build(context); return FutureBuilder( - future: queryCommunity(), + future: queryCommunity(null), builder: (context, position) { return SmartRefresher( controller: refreshController, @@ -172,7 +196,7 @@ class CommunityChildPageState extends State with AutomaticKe "userId": userId, }, ).then((value) { - queryDetails(articles[position].id); + queryCommunity(articles[position].id); // onRefresh(); // setState(() {}); }); @@ -187,32 +211,6 @@ class CommunityChildPageState extends State with AutomaticKe ); } - ///详情接口 - queryDetails(id) async { - SharedPreferences value = await SharedPreferences.getInstance(); - if (apiService == null) - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); - BaseData
baseData = await apiService.informationInfo(id) - .catchError((onError) { - debugPrint(onError.toString()); - }); - if (baseData != null && baseData.isSuccess) { - this.articles.forEach((element) { - if(element.id == id){ - isRefresh = false; - setState(() { - element.likes = baseData.data.likes; - element.viewers = baseData.data.viewers; - }); - } - }); - } - } - @override bool get wantKeepAlive => true; } diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index b46306b1..6c150478 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -30,6 +30,7 @@ class PersonalPage extends StatefulWidget { final Map arguments; PersonalPage({this.arguments}); + @override State createState() { return _PersonalPage(); @@ -47,10 +48,10 @@ class _PersonalPage extends State with WidgetsBindingObserver { MemberInfor memberInfor; String filePath; bool isLoadMore = false; + bool isRefresh = true; + bool isLoadingData = false; String memberId; - Map modifyInfo = { - "background": "" - }; + Map modifyInfo = {"background": ""}; @override void initState() { @@ -58,16 +59,17 @@ class _PersonalPage extends State with WidgetsBindingObserver { memberId = widget.arguments["memberId"]; WidgetsBinding.instance.addObserver(this); SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), - context: context, token: value.getString('token'), - showLoading: true), - _onRefresh(), - }); + apiService = ApiService(Dio(), + context: context, + token: value.getString('token'), + showLoading: true), + _onRefresh(), + }); } _onRefresh() async { - queryCommunity(); - queryMember(memberId); + queryCommunity(null); + queryMember(memberId); } ///查询会员信息 @@ -81,7 +83,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { ); } BaseData baseData = - await apiService.memberDetail(id).catchError((error) { + await apiService.memberDetail(id).catchError((error) { refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { @@ -89,72 +91,106 @@ class _PersonalPage extends State with WidgetsBindingObserver { memberInfor = baseData.data; }); refreshController.refreshCompleted(); - }else { + } else { refreshController.refreshFailed(); } } ///动态列表 - queryCommunity() async { + queryCommunity(String searchKey) async { + if(!isRefresh){ + isRefresh = true; + return; + } + if(isLoadingData){ + return; + } + isLoadingData = true; if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); userId = value.getString('userId'); apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), + Dio(), + context: context, + token: value.getString("token"), + showLoading: false ); } if(isLoadMore){ pageNum += 1; isLoadMore = false; } - else pageNum = 1; + else if(searchKey == null)pageNum = 1; BaseData> baseData = await apiService.trendList({ - "mid":memberId == "0" ? userId : memberId, + "mid": memberId == "0" ? userId : memberId, "onlyFollow": false, "onlyMe": true, - "pageNum": pageNum, + "pageNum": searchKey == null?pageNum:1, "pageSize": 10, - "searchKey": "" + "searchKey": searchKey??"" }).catchError((error) { - refreshController.refreshFailed(); - refreshController.loadFailed(); + if(searchKey == null) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } }); - if (baseData.isSuccess) { + if(searchKey == null) { refreshController.refreshCompleted(); refreshController.loadComplete(); - if (pageNum == 1) { - articles.clear(); + } + if (baseData.isSuccess) { + if(searchKey != null){ + if(baseData?.data?.list != null && baseData.data.list.isNotEmpty) + articles.forEach((element) { + if(element.id == searchKey){ + element.content = jsonEncode(baseData.data.list[0].subjectInfo); + element.mainTitle =baseData.data.list[0].subject; + element.followed = baseData.data.list[0].selfFollow; + element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar; + element.authorName = baseData.data.list[0].memberInfo?.nickname; + element.location = baseData.data.list[0].location; + element.createTime = baseData.data.list[0].createTime; + element.author = baseData.data.list[0].memberInfo?.mid; + element.viewers = baseData.data.list[0]?.viewers; + element.likes = baseData.data.list[0]?.likes; + element.comments = baseData.data.list[0]?.comments; + this.isRefresh = false; + setState(() { + }); + } + }); } - baseData.data.list.forEach((element) { - var article = Article(); - article.id = element.id; - article.content = jsonEncode(element.subjectInfo); - article.mainTitle = element.subject; - article.followed = element.selfFollow; - article.authorHeadImg = element.memberInfo?.avatar; - article.authorName = element.memberInfo?.nickname; - article.location = element.location; - article.createTime = element.createTime; - article.author = element.memberInfo?.mid; - article.viewers = element?.viewers; - article.likes = element?.likes; - article.comments = element?.comments; - articles.add(article); - }); - setState(() { - - }); - // print("comments: ${comments.length}"); - if (int.tryParse(baseData.data.total) < (pageNum * 10)) { - refreshController.loadNoData(); + else{ + if (pageNum == 1) { + articles.clear(); + } + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.followed = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.location = element.location; + article.createTime = element.createTime; + article.author = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); + setState(() { + }); + // comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); + // print("comments: ${comments.length}"); + if (int.tryParse(baseData.data.total) < (pageNum * 10)) { + refreshController.loadNoData(); + } } } - else{ - refreshController.refreshFailed(); - refreshController.loadFailed(); - } + + isLoadingData = false; } ///去编辑个人资料 @@ -165,7 +201,9 @@ class _PersonalPage extends State with WidgetsBindingObserver { .pushNamed('/router/login_page', arguments: {"login": "login"}); return; } - await Navigator.of(context).pushNamed('/router/user_info_page').then((value) { + await Navigator.of(context) + .pushNamed('/router/user_info_page') + .then((value) { _onRefresh(); setState(() {}); }); @@ -273,7 +311,9 @@ class _PersonalPage extends State with WidgetsBindingObserver { ///文件上传 fileUpload() async { if (filePath != null && filePath != "" && await File(filePath).exists()) { - BaseData baseData = await apiService.upload(File(filePath), 123123123,false).catchError((onError) {}); + BaseData baseData = await apiService + .upload(File(filePath), 123123123, false) + .catchError((onError) {}); if (baseData != null && baseData.isSuccess) { UploadResult uploadResult = baseData.data; modifyInfo["background"] = uploadResult.url; @@ -305,450 +345,446 @@ class _PersonalPage extends State with WidgetsBindingObserver { scrollController: scrollController, child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child:Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 248, - color: Color(0xFFFFFFFF), - // color: Colors.red, - child: - Stack( - // alignment: Alignment.bottomLeft, - children: [ - Positioned( - top:0, - left: 0, - bottom: 36, - right: 0, - child:Stack( - alignment: Alignment.bottomRight, - children: [ - Container( - color: Colors.black, - child: Opacity( - opacity: 0.9, - child: MImage( - memberInfor?.background ?? "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: - "assets/image/default_1.webp", - fadeSrc: - "assets/image/default_1.webp", - ))), - Container( - margin: EdgeInsets.only( - top: 50.h, left: 16.w, right: 16.w), - alignment: Alignment.topLeft, - decoration: BoxDecoration( - color: Colors.transparent, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.webp", - width: 24, - height: 24, - ), - onTap: () { - Navigator.of(context).pop(); - }, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 248, + color: Color(0xFFFFFFFF), + // color: Colors.red, + child: Stack( + // alignment: Alignment.bottomLeft, + children: [ + Positioned( + top: 0, + left: 0, + bottom: 36, + right: 0, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + color: Colors.black, + child: Opacity( + opacity: 0.9, + child: MImage( + memberInfor?.background ?? "", + width: double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ))), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + alignment: Alignment.topLeft, + decoration: BoxDecoration( + color: Colors.transparent, ), - ], - ), - ), - if(memberId == "0") - Positioned( - bottom: 9, - right: 16.w, - child:GestureDetector( - onTap: (){ - showImagePicker(); - }, - child:Container( - padding: EdgeInsets.only(left: 2, right: 2), - width: 59.w, - height: 23.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0x80000000), - ), - child: Text( - S.of(context).genghuanbeijing, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.webp", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, ), - ), + ], ), ), - ), - ], - ), - ), - homeInfo(), - ], - ), - ), - Container( - color: Color(0xFFFFFFFF), - child: - Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 86, top: 12, right: 16), - child: GestureDetector( - onTap: () { - setState(() { - isShrink = !isShrink; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - flex: 1, - child: Text( - memberId == "0" ? ((memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? "") - :"个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" :memberInfor?.signature ?? ""}", - overflow: isShrink - ? TextOverflow.visible - : TextOverflow.ellipsis, - maxLines: isShrink ? 10 : 2, - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF868686), - fontWeight: - MyFontWeight.regular, - height: 1.5), - )), - Icon( - (isShrink != null && !isShrink) - ? Icons.chevron_right - : Icons.keyboard_arrow_up, - color: Colors.black, - size: 18, - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(left: 16, right: 16), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null ? memberInfor.follow.toString() : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, - ), - Text( - S.of(context).guanzhu, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null ? memberInfor.fans.toString() : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, - ), - Text( - S.of(context).fensi, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.trendTotal??0).toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, + if (memberId == "0") + Positioned( + bottom: 9, + right: 16.w, + child: GestureDetector( + onTap: () { + showImagePicker(); + }, + child: Container( + padding: EdgeInsets.only(left: 2, right: 2), + width: 59.w, + height: 23.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0x80000000), ), - Text( - S.of(context).dongtai, + child: Text( + S.of(context).genghuanbeijing, + overflow: TextOverflow.ellipsis, style: TextStyle( - color: Color(0xFF353535), fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), ), ), - ], - )), - ), + ), + ), + ), + ], ), - Expanded( + ), + homeInfo(), + ], + ), + ), + Container( + color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 86, top: 12, right: 16), child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.gainLikeTotal ?? 0).toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, - ), - Text( - "获赞", + onTap: () { + setState(() { + isShrink = !isShrink; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: Text( + memberId == "0" + ? ((memberInfor?.signature == "") + ? "还未编辑个性签名~" + : memberInfor?.signature ?? "") + : "个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? ""}", + overflow: isShrink + ? TextOverflow.visible + : TextOverflow.ellipsis, + maxLines: isShrink ? 10 : 2, style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), + fontSize: 12.sp, + color: Color(0xFF868686), + fontWeight: MyFontWeight.regular, + height: 1.5), + )), + Icon( + (isShrink != null && !isShrink) + ? Icons.chevron_right + : Icons.keyboard_arrow_up, + color: Colors.black, + size: 18, + ), + ], + ), + )), + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.follow.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).guanzhu, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.fans.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.trendTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).dongtai, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.gainLikeTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + "获赞", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + ], ), - ], - ), - ), - Container( - margin: EdgeInsets.all(16), - height: 1.h, - color: Color(0xFFF7F7F7), + ), + Container( + margin: EdgeInsets.all(16), + height: 1.h, + color: Color(0xFFF7F7F7), + ), + Padding( + padding: EdgeInsets.only(left: 16), + child: Text( + memberId != "0" ? "TA的动态" : "我的动态", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )), + dynamicList(), + ], ), - Padding( - padding: EdgeInsets.only(left: 16), - child: Text( - memberId != "0" ? - "TA的动态": - "我的动态", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )), - dynamicList() - ], - ), - ), - ], - )), + ), + ], + )), ); } Widget homeInfo() { return Positioned( - top: 0, + top: 0, bottom: 0, left: 0, right: 0, child: Container( - padding: EdgeInsets.only( - left: 16, - right: 16, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - GestureDetector( - onTap: (){ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PhotoViewGalleryScreen( - images: [(memberInfor?.headimg ?? "").isEmpty? - "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":memberInfor?.headimg - ], //传入图片list - index: 0, //传入当前点击的图片的index - ), - )); - }, - child: MImage( - memberInfor?.headimg ?? "", - isCircle: true, - width: 66, - height: 66, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.webp", - fadeSrc: "assets/image/default_user.webp", - ), - ), - SizedBox(width: 10.w), - Text( - memberInfor?.nickname ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF353535), - ), + padding: EdgeInsets.only( + left: 16, + right: 16, ), - SizedBox(width: 4.w), - Image.asset( - "assets/image/vip_yk.webp", - width: 20, - height: 20, - ), - Spacer(), - if(memberId == "0") - GestureDetector( - onTap: () { - setState(() { - _toUserInfo(); - }); - }, - child: Container( - height: 23, - padding: EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Color(0xFF353535), - style: BorderStyle.solid, - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [ + (memberInfor?.headimg ?? "").isEmpty + ? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg" + : memberInfor?.headimg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: MImage( + memberInfor?.headimg ?? "", + isCircle: true, + width: 66, + height: 66, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.webp", + fadeSrc: "assets/image/default_user.webp", ), - child: Text( - S.of(context).bianjigerenziliao, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF353535), - ), + ), + SizedBox(width: 10.w), + Text( + memberInfor?.nickname ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), ), ), - ) - ], - ),)); + SizedBox(width: 4.w), + Image.asset( + "assets/image/vip_yk.webp", + width: 20, + height: 20, + ), + Spacer(), + if (memberId == "0") + GestureDetector( + onTap: () { + setState(() { + _toUserInfo(); + }); + }, + child: Container( + height: 23, + padding: + EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Color(0xFF353535), + style: BorderStyle.solid, + ), + ), + child: Text( + S.of(context).bianjigerenziliao, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + ) + ], + ), + )); } Widget dynamicList() { return Container( - child: (articles == null || articles.length == 0)? NoDataView( - src: "assets/image/dong_tai.webp", - isShowBtn: false, - text: "目前暂无发布动态,要把开心的事讲出来哦~", - fontSize: 16.sp, - margin: EdgeInsets.only(left: 60.w,right: 60.w), - ):ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return InkWell( - child: CommunityDynamic( - articles[position], - memberId == "0" ? 1 : 0, - exitFull: () { - setState(() { - _onRefresh(); - }); - }, - removalDynamic: () { - setState(() { - _onRefresh(); - }); + child: (articles == null || articles.length == 0) + ? NoDataView( + src: "assets/image/dong_tai.webp", + isShowBtn: false, + text: "目前暂无发布动态,要把开心的事讲出来哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(left: 60.w, right: 60.w), + ) + : ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return InkWell( + child: CommunityDynamic( + articles[position], + memberId == "0" ? 1 : 0, + exitFull: () { + // setState(() { + // _onRefresh(); + // }); + }, + removalDynamic: () { + setState(() { + _onRefresh(); + }); + }, + ), + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId": articles[position].id, + "userId": userId, + }, + ).then((value) { + queryCommunity(articles[position].id); + }); + }, + ); }, + itemCount: articles.length, ), - onTap: () { - Navigator.of(context).pushNamed( - '/router/community_details', - arguments: { - "businessId": articles[position].id, - "userId": userId, - }, - ).then((value) { - _onRefresh(); - }); - }, - ); - }, - itemCount: articles.length, - ), ); } } diff --git a/lib/order/order_view/order_info.dart b/lib/order/order_view/order_info.dart index 388ec949..af52f7ff 100644 --- a/lib/order/order_view/order_info.dart +++ b/lib/order/order_view/order_info.dart @@ -102,6 +102,7 @@ class _OrderInfoView extends State { color: Color(0xFF353535), ), ), + SizedBox(width:10.w), Expanded( child: Text( rightText, diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index f0213ce0..f9ae09c5 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -142,7 +142,7 @@ class _ShopGoods extends State { text: S.of(context).xuanguige, textColor: Colors.white, fontWeight: MyFontWeight.medium, - radius: 11, + radius: 3, backgroup: Color(0xFF32A060), fontSize: 11.sp, padding: EdgeInsets.symmetric(vertical: 5.h),