diff --git a/circle_app/assets/images/circle/circle_selected_bg.png b/circle_app/assets/images/circle/circle_selected_bg.png new file mode 100644 index 0000000..d7d5695 Binary files /dev/null and b/circle_app/assets/images/circle/circle_selected_bg.png differ diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart index ff290b6..4b90d5e 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart @@ -102,7 +102,7 @@ class TIMInputTextField extends StatefulWidget { required this.conversationID, required this.conversationType, this.initText, - required this.isBlack, + required this.isBlack, required this.hintText, this.scrollController, this.morePanelConfig, @@ -140,6 +140,17 @@ class _InputTextFieldState extends TIMUIKitState { String hintText = '用心聊天更容易获得回复哦~'; + List urlList = [ + 'https://iquanpai.com', + 'https://cdtszn.net', + 'https://ikuayou.com', + 'https://leyuan666.com', + 'https://kuayou666.com', + 'https://cdts666.com', + 'https://quanpai666.com', + 'https://xidi.iquanpai.com' + ]; + Map memberInfoMap = {}; late TextEditingController textEditingController; @@ -274,12 +285,11 @@ class _InputTextFieldState extends TIMUIKitState { } Future checkImStatus() async { + List pressionStr = + '微信、QQ、加Q、+V、地球号、绿泡泡、公众号、网站、app、视频、手机号、id、企鹅、门槛、收费、加群'.split('、'); - List< - String> pressionStr = '微信、QQ、加Q、+V、地球号、绿泡泡、公众号、网站、app、视频、手机号、id、企鹅、门槛、收费、加群' - .split('、'); - - if (textEditingController.text.isNotEmpty && (userInfoBean?.wx_num?.isEmpty ?? true)) { + if (textEditingController.text.isNotEmpty && + (userInfoBean?.wx_num?.isEmpty ?? true)) { bool isContain = false; String sendText = textEditingController.text.toUpperCase(); for (String text in pressionStr) { @@ -290,25 +300,22 @@ class _InputTextFieldState extends TIMUIKitState { if (isContain) { await showAddWxPicker( userInfoBean!.wx_num!.isNotEmpty ?? false, - isHidden: - userInfoBean!.wx_num!.isNotEmpty ?? false, + isHidden: userInfoBean!.wx_num!.isNotEmpty ?? false, isWxHidden: userInfoBean!.hide_wx_num == 1, ); imStatusOK = false; return imStatusOK; } - } - - var data = - await DioManager.instance.get(url: Api.imstate); + var data = await DioManager.instance.get(url: Api.imstate); int code = data['code']; if (code == 200) { try { - var result = - await DioManager.instance.get(url: Api.adImstate + widget.conversationID.split('_').last,); + var result = await DioManager.instance.get( + url: Api.adImstate + widget.conversationID.split('_').last, + ); if (result['code'] == 21201) { Get.bottomSheet( Scaffold( @@ -320,9 +327,7 @@ class _InputTextFieldState extends TIMUIKitState { imStatusOK = false; return false; } - } catch (e) { - - } + } catch (e) {} imStatusOK = true; } else { @@ -383,7 +388,7 @@ class _InputTextFieldState extends TIMUIKitState { child: Text( "是否解除拉黑", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( @@ -446,14 +451,16 @@ class _InputTextFieldState extends TIMUIKitState { onTap: () async { Get.back(); var data = await DioManager.instance.post( - url: '${Api.setBlock + widget.conversationID.split('_').last}/block', params: {'status': '0'}); + url: + '${Api.setBlock + widget.conversationID.split('_').last}/block', + params: {'status': '0'}); var bean = BaseResponse.fromJson( data, - (jsonData) => jsonData, + (jsonData) => jsonData, ); if (bean.isSuccess()) { final FriendshipServices _friendshipServices = - serviceLocator(); + serviceLocator(); isBlack = false; } showOKToast(bean.msg); @@ -505,7 +512,6 @@ class _InputTextFieldState extends TIMUIKitState { return; } - if (isSending) return; isSending = true; bool isOK = await checkImStatus(); @@ -515,7 +521,6 @@ class _InputTextFieldState extends TIMUIKitState { return; } - lastText = ""; String text = textEditingController.text.trim(); final convType = widget.conversationType; @@ -523,7 +528,9 @@ class _InputTextFieldState extends TIMUIKitState { if (text.isEmpty) { if (hintText.contains('用心聊天更容易获得回复哦~')) { showOKToast('请输入消息内容后发送'); - Future.delayed(Duration(seconds: 1), () {isSending = false;}); + Future.delayed(Duration(seconds: 1), () { + isSending = false; + }); return; } else { if ((widget.currentConversation.lastMessage?.customElem ?? null) != @@ -555,7 +562,9 @@ class _InputTextFieldState extends TIMUIKitState { showOKToast('请输入消息内容后发送'); } } - Future.delayed(Duration(seconds: 1), () {isSending = false;}); + Future.delayed(Duration(seconds: 1), () { + isSending = false; + }); return; } } @@ -570,8 +579,6 @@ class _InputTextFieldState extends TIMUIKitState { atUserIDList: getUserIdFromMemberInfoMap()), context); } else if (memberInfoMap.isNotEmpty) { - - widget.model.sendTextAtMessage( text: text, convType: widget.conversationType, @@ -580,47 +587,65 @@ class _InputTextFieldState extends TIMUIKitState { } else { bool isOK = await loadIsShowSendGiftDialogData(); if (!isOK) { - Future.delayed(Duration(seconds: 1), () {isSending = false;}); + Future.delayed(Duration(seconds: 1), () { + isSending = false; + }); return; } - var data = await DioManager.instance - .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); + + + + bool isContain = false; + urlList.forEach((element) { + if (text.contains(element)) { + isContain = true; + } + }); List words = []; - if (data['data']['code'] == 10000) { - words = data['data']['words']; - if (words.isNotEmpty) { - for (int i = 0; i < words.length; i++) { - text = text.replaceAll(words[i], '*'); + + + if (!isContain) { + var data = await DioManager.instance + .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); + if (data['data']['code'] == 10000) { + words = data['data']['words']; + if (words.isNotEmpty) { + for (int i = 0; i < words.length; i++) { + text = text.replaceAll(words[i], '*'); + } } } + if (words.isNotEmpty) { + textEditingController.text = text; + showOKToast('含违规词汇,无法发送'); + Future.delayed(Duration(seconds: 1), () { + isSending = false; + }); + return; + } } - Future.delayed(Duration(seconds: 1), () {isSending = false;}); - if (words.isEmpty) { - try { - var msgResult = await MessageUtils.handleMessageError( - widget.model.sendTextMessage( - text: text, - convID: widget.conversationID, - convType: convType), - context); - addChatRecord(text, msgResult!.data!.msgID ?? '', msgResult!.data!.timestamp.toString() ?? ''); - } catch (e) { - } - } else { - showOKToast('含违规词汇,无法发送'); - return; + if (words.isEmpty) { + try { + var msgResult = await MessageUtils.handleMessageError( + widget.model.sendTextMessage( + text: text, + convID: widget.conversationID, + convType: convType), + context); + addChatRecord(text, msgResult!.data!.msgID ?? '', + msgResult!.data!.timestamp.toString() ?? ''); + } catch (e) {} } } textEditingController.clear(); currentCursor = null; lastText = ""; memberInfoMap = {}; - + isSending = false; goDownBottom(); _handleSendEditStatus("", false); - } else { showOKToast('请输入消息内容'); isSending = false; @@ -629,10 +654,16 @@ class _InputTextFieldState extends TIMUIKitState { loadIsShowSendGiftDialogData() async { V2TimConversation con = Get.arguments; - var data = await DioManager.instance.get(url: Api.isShow_give_gift + widget.conversationID.split('_').last); + var data = await DioManager.instance + .get(url: Api.isShow_give_gift + widget.conversationID.split('_').last); if (data['code'] == 200) { if (data['data']) { - Get.bottomSheet(SendGiftDialog(accid: widget.conversationID,title: data['msg'],), isScrollControlled: true, + Get.bottomSheet( + SendGiftDialog( + accid: widget.conversationID, + title: data['msg'], + ), + isScrollControlled: true, enableDrag: false); return false; } @@ -660,10 +691,9 @@ class _InputTextFieldState extends TIMUIKitState { setState(() {}); } - addChatRecord(String msgContent,String msgId,String sendTime) async { + addChatRecord(String msgContent, String msgId, String sendTime) async { String str = DateTime.now().toString().split('.').first; - var data = - await DioManager.instance.post(url: Api.chatRecord, params: { + var data = await DioManager.instance.post(url: Api.chatRecord, params: { "content": msgContent, "msgId": msgId, "sendTime": str, @@ -1024,22 +1054,20 @@ class _InputTextFieldState extends TIMUIKitState { if (null == commentBlackEvent) { commentBlackEvent = EventBusManager.on().listen((event) { - if (event.userId == widget.currentConversation.userID!) { - isBlack = event.isBlack; - } - }); + if (event.userId == widget.currentConversation.userID!) { + isBlack = event.isBlack; + } + }); } getBlack(); - } StreamSubscription? commentBlackEvent = null; bool isBlack = false; bool isSending = false; getBlack() async { - isBlack = widget.isBlack!; - EventBusManager.fire(CommentBlackMoreEvent()); - + isBlack = widget.isBlack!; + EventBusManager.fire(CommentBlackMoreEvent()); } @override diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart index db12e6d..62f7884 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart @@ -1141,7 +1141,7 @@ class _TIMTextFieldLayoutNarrowState } if (!isVip) { - showOKToast(plate== 0 ? '开通会员之后才能发送语音' : '开通会员之后才能发送图片'); + showOKToast(plate== 5 ? '开通会员之后才能发送语音' : '开通会员之后才能发送图片'); Get.bottomSheet( Scaffold( backgroundColor: Colors.transparent, diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index 8d213d4..c6b6f59 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -55,14 +55,20 @@ class CircleLogic extends GetxController { bool isNewPeopleMore = true; + bool isLoadFail = false; + bool isNewPeopleRed = false; + bool isNearLoad = true; + int flush = 0; bool isMore = true; int myVip = -1; bool isShowCircle = true; String cityName = ""; + Map recommendCircleFriendData = {}; + List openCallOutIdList = []; List bannerList = []; List genderList @@ -107,6 +113,7 @@ class CircleLogic extends GetxController { @override void onInit() { super.onInit(); + loadRecommendCircleFriendData(); loadCircleListData(); loadCirclePeopleData(); initGerder(); @@ -375,6 +382,7 @@ class CircleLogic extends GetxController { 'flush': flush, "orientations": orientations }); + isNearLoad = false; var bean = BaseResponse.fromJson( data, (data) => VicinityBean.fromJson(data)); @@ -481,6 +489,7 @@ class CircleLogic extends GetxController { } getNewPeopleListData() async { + isLoadFail = false; List genders = []; new_genderList.forEach((element) { if (element.isSelect) { @@ -535,12 +544,36 @@ class CircleLogic extends GetxController { isNewPeopleMore = false; } update(); + } else if (data['code'] == 404) { + isLoadFail = true; + update(); } else { isNewPeopleMore = false; } } + + void loadRecommendCircleFriendData() async { + var data = await DioManager.instance.get( + url: Api.chatRecommendFriend, + ); + + if (data['code'] == 200) { + List dataList = data['data']; + if (dataList.isNotEmpty) { + recommendCircleFriendData = data['data'][0]; + } + update(); + } else { + + if ((data['code'] == 21201 || data['code'] == 21202) && recommendCircleFriendData.isNotEmpty) { + showOKToast(data['msg']); + showVipDialog(); + } + } + } + void onRefresh() async { pageIndex = 1; newPeopleList.clear(); diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart index 35a0823..c7c6b2a 100644 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ b/circle_app/lib/app/circle/widgets/discover.dart @@ -50,6 +50,8 @@ class _DiscoverState extends State List list = []; List giftList = []; bool isMore = true; + + bool loadFail = false; int index = 1; List tagList = []; @@ -207,15 +209,6 @@ class _DiscoverState extends State } catch (e) {} } - loadGiftListData() async { - // var result = await DioManager.instance.get(url: Api.giftList); - // if (result['code'] == 10000) { - // giftList = result['data']; - // await loadData(); - // setState(() {}); - // } - } - loadData() async { var data = await DioManager.instance.post(url: Api.findPage, params: { 'page': index, @@ -266,11 +259,18 @@ class _DiscoverState extends State if (mounted) { setState(() {}); } + } else { + loadFail = true; + isMore = false; + setState(() { + + }); } } void refreshData() { index = 1; + loadFail = false; loadData(); } @@ -294,9 +294,11 @@ class _DiscoverState extends State }); return list.isEmpty - ? isMore + ? loadFail ? noResultWidget(tip: '',callBack: () { + refreshData(); + }) : isMore ? loaddingWidget(true) - : noResultWidget(tip: '已解锁联系方式的圈友会展示在这里哦~') + : noResultWidget(tip: '已解锁联系方式的圈友会展示在这里哦~') : Stack( fit: StackFit.expand, children: [ @@ -305,7 +307,9 @@ class _DiscoverState extends State onPointerDown: getPointDownListenerInHorizontal(), onPointerUp: getPointUpListenerInHorizontal(), child: SmartRefresher( - footer: DiyLoadFooter(noDataText: '只展示一些精选过的圈友哦~',), + footer: DiyLoadFooter( + noDataText: '只展示一些精选过的圈友哦~', + ), onRefresh: refreshData, controller: refreshController, onLoading: _onLoading, @@ -319,7 +323,8 @@ class _DiscoverState extends State onLineStr = user.online_flag!; if (user.distance != null) { if (user.distance! < 100) { - onLineStr = '${user.online_flag!}· ${user.distance!.toInt()}km'; + onLineStr = + '${user.online_flag!}· ${user.distance!.toInt()}km'; } } } else { @@ -330,429 +335,16 @@ class _DiscoverState extends State } } - return Container( - height: screenHeight, - width: Get.width, - margin: EdgeInsets.only( - top: 5.sp, left: 16.sp, right: 16.sp), - child: Stack( - children: [ - Container( - clipBehavior: Clip.hardEdge, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.25), - borderRadius: BorderRadius.circular(10.sp), - // border: GradientBoxBorder( - // gradient: - // AppColor.mainVerLinearGradient, - // width: 1.sp, - // ), - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage( - // getCircleImage('open_vip_bg'), - // )) - ), - height: screenHeight, - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - // clipBehavior: Clip.hardEdge, - child: Container( - // padding: EdgeInsets.all(2.sp), - child: PageView.builder( - //当页面选中后回调此方法 - //参数[index]是当前滑动到的页面角标索引 从0开始 - onPageChanged: (int index) { - print("当前的页面是 $index"); - // currentPage = index; - }, - //值为flase时 显示第一个页面 然后从左向右开始滑动 - //值为true时 显示最后一个页面 然后从右向左开始滑动 - reverse: false, - //滑动到页面底部无回弹效果 - physics: BouncingScrollPhysics(), - //纵向滑动切换 - scrollDirection: Axis.horizontal, - //页面控制器 - // controller: pageController, - //所有的子Widget - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: user.userId.toString()); - // List imgList = []; - // user.images!.forEach((element) { - // imgList.add(element); - // }); - // - // Get.toNamed(AppRoutes.Swiper, - // arguments: { - // 'imaglist': imgList, - // 'index': index, - // 'userId':user.userId.toString() - // - // }); - }, - child: CachedNetworkImage( - imageUrl: user.images![index], - fit: BoxFit.cover, - // width: Get.width, - height: screenHeight, - )); - },itemCount: user.images!.length,) - - // Swiper( - // autoplay: false, - // loop: user.images!.length == 1 - // ? false - // : true, - // itemBuilder: - // (BuildContext context, int index) { - // // print(index); - - // }, - // itemCount: user.images!.length, - // ), - )), - ), - Positioned( - left: 5.sp, - top: 10.sp, - child: Container( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (onLineStr.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: - const Color(0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - onLineStr, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - ), - ), - if (onLineStr!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_cities!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: const Color( - 0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - "你们都来过${user.both_cities!.first}", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - )), - if (user.both_cities!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_interests!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: const Color( - 0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - "你们有共同的圈子:${user.both_interests!.first['title']}", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - )), - ], - ), - )), - Positioned( - right: 16.sp, - top: 16.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: user.userId!.toString()); - }, - child: Container( - width: 73.sp, - height: 25.sp, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(12.5.sp)), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '查看主页', - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - ), - ), - ), - Image( - width: 15.sp, - image: AssetImage( - getDisCoverImage("right_icon")), - // width: 44.sp, - ), - ], - ), - ), - )), - - Positioned( - left: 6.sp, - bottom: 6.sp, - child: Container( - width: Get.width - 32.sp, - padding: EdgeInsets.only(right: 0.sp), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (user.contact!.isNotEmpty) - wxStatusWidget( - !user.contact!.contains('*'), - user.contact!, - user.userId.toString(), - user.contactType!, - user.avatarUrl!, () { - loadSignDiscoverData( - user.userId.toString()); - }), - SizedBox( - height: 15.sp, - ), - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 18.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - Container( - margin: - EdgeInsets.only(left: 5.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 9.sp), - gradient: - const LinearGradient( - begin: Alignment( - 0.25, 0.5), - end: Alignment( - 0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - user!.gender ?? 0, - user!.age ?? 0, - user!.role ?? 0, - user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: UserTagWidget(user.mark!), - ), - ], - ), - Container( - width: Get.width - 120.sp, - margin: EdgeInsets.only( - top: 15.sp, bottom: 15.sp), - child: Text( - user.signature! ?? '', - overflow: TextOverflow.ellipsis, - maxLines: - (user.signature! ?? '').length > - 15 - ? 2 - : 1, - style: TextStyle( - fontSize: 16.sp, - color: const Color(0XFFF7FAFA)), - ), - ), - Container( - width: Get.width - 110.sp, - height: 35.sp, - child: tagItem(user.interests!), - ), - ], - ), - )), - Positioned( - bottom: 5.sp, - right: 15.sp, - child: Container( - child: Column( - children: [ - GestureDetector( - onTap: () async { - showGiftPannel(user.imAccid!.toString()); - }, - child: Image.asset( - getMsgImage('gift'), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - pushChatPage( - user.userId.toString(), - user.imAccid!.toString(), - user.nickname!); - }, - child: Image.asset( - getCircleImage( - 'chat_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - setLike(user.userId!.toString(), - user.is_follow!, () { - list[index]['is_follow'] = - !user.is_follow!; - setState(() {}); - }); - }, - child: Image.asset( - getCircleImage( - user.is_follow! - ? 'like_icon' - : 'nor_like_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 20.sp, - ), - GestureDetector( - onTap: () { - _showReportDialog(context, - user.userId!.toString(), index); - }, - child: Image.asset( - getCircleImage( - 'no_look_icon', - ), - width: 50.sp, - ), - ) - ], - ), - )) - ], - )); + return FeaturedItem(info: list[index], index: index, screenHeight: screenHeight, sendNoLookData: () { + sendNoLookData(user.userId!.toString(),index); + },setLike: () { + setLike(user.userId!.toString(), + user.is_follow!, () { + list[index]['is_follow'] = + !user.is_follow!; + setState(() {}); + }); + }, loadSignDiscoverData: loadSignDiscoverData, showGiftPannel: showGiftPannel); }, itemCount: list.length, physics: BouncingScrollPhysics(), @@ -850,14 +442,14 @@ class _DiscoverState extends State } loadWxNumData() async { - loadWXEditStatus() async { - var data = - await DioManager.instance.get(url: Api.checkWxNumState,); + var data = await DioManager.instance.get( + url: Api.checkWxNumState, + ); if (data['code'] == 200) { var data = await DioManager.instance.get(url: Api.getUserInfo); - if (data['code'] != 4000) { + if (data['code'] != 4000) { if (data['data']['user']['wxNum'] == null) { showAddWxPicker(false); } else if (data['data']['user']['wxNum'].toString().isEmpty) { @@ -868,8 +460,6 @@ class _DiscoverState extends State // wxStatusInfo['${data['code']}'] = data['msg']; } } - - } void sendNoLookData(String userId, int index) async { @@ -1032,7 +622,7 @@ class _DiscoverState extends State Get.bottomSheet( ChatGiftPannel( accid: accId, - isShowVip:false, + isShowVip: false, ), isScrollControlled: false, enableDrag: false, @@ -1040,6 +630,656 @@ class _DiscoverState extends State } } +class FeaturedItem extends StatefulWidget { + var info; + int index; + double screenHeight; + Function sendNoLookData; + Function setLike; + Function loadSignDiscoverData; + Function showGiftPannel; + FeaturedItem( + {super.key, + required this.info, + required this.index, + required this.screenHeight,required this.sendNoLookData,required this.setLike,required this.loadSignDiscoverData,required this.showGiftPannel}); + + @override + State createState() => _FeaturedItemState(); +} + +class _FeaturedItemState extends State { + int currentIndex = 0; + + PageController pageController = PageController(); + @override + Widget build(BuildContext context) { + var info = widget.info; + int index = widget.index; + var user = Users.fromJson(info); + double screenHeight = widget.screenHeight; + String onLineStr = ''; + if (user.online_flag?.isNotEmpty ?? false) { + onLineStr = user.online_flag!; + if (user.distance != null) { + if (user.distance! < 100) { + onLineStr = '${user.online_flag!}· ${user.distance!.toInt()}km'; + } + } + } else { + if (user.distance != null) { + if ((user.distance! ?? 10) < 100) { + onLineStr = '${user.distance!.toInt()}km'; + } + } + } + + + List pointWidget = []; + int count = 0; + + for (var item in user.images!) { + pointWidget.add( Expanded( + child: Container( + margin: EdgeInsets.only( + right: user.images!.indexOf(item) == + user.images!.last + ? 0 + : 4.sp), + decoration: BoxDecoration( + color: currentIndex == count + ? Colors.white + : Colors.white.withOpacity(0.25), + borderRadius: BorderRadius.circular(2.sp), + ), + ))); + count = count + 1; + } + + + return Container( + height: screenHeight, + width: Get.width, + margin: EdgeInsets.only(top: 5.sp, left: 16.sp, right: 16.sp), + child: Stack( + children: [ + Container( + clipBehavior: Clip.hardEdge, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.25), + borderRadius: BorderRadius.circular(10.sp), + // border: GradientBoxBorder( + // gradient: + // AppColor.mainVerLinearGradient, + // width: 1.sp, + // ), + // image: DecorationImage( + // fit: BoxFit.fill, + // image: AssetImage( + // getCircleImage('open_vip_bg'), + // )) + ), + height: screenHeight, + width: Get.width, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + // clipBehavior: Clip.hardEdge, + child: Container( + // padding: EdgeInsets.all(2.sp), + child: PageView.builder( + controller: pageController, + //当页面选中后回调此方法 + //参数[index]是当前滑动到的页面角标索引 从0开始 + onPageChanged: (int index) { + print("当前的页面是 $index"); + currentIndex = index; + setState(() { + + }); + }, + //值为flase时 显示第一个页面 然后从左向右开始滑动 + //值为true时 显示最后一个页面 然后从右向左开始滑动 + reverse: false, + //滑动到页面底部无回弹效果 + physics: BouncingScrollPhysics(), + //纵向滑动切换 + scrollDirection: Axis.horizontal, + //页面控制器 + // controller: pageController, + //所有的子Widget + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTapDown: (TapDownDetails details) { + if (details.localPosition.dx < + (Get.width - 10.sp) * 0.5) { + pageController.animateToPage(currentIndex - 1 >= 0 ? currentIndex -1 : user.images!.length - 1,duration: Duration(milliseconds: currentIndex - 1 >= 0 ? 200 : 10),curve: Curves.ease); + } else { + pageController.animateToPage(currentIndex+1 >= user.images!.length ? 0 : currentIndex+1,duration: Duration(milliseconds: currentIndex+1 >= user.images!.length ? 10 : 200),curve: Curves.ease); + } + }, + child: CachedNetworkImage( + imageUrl: user.images![index], + fit: BoxFit.cover, + // width: Get.width, + height: screenHeight, + )); + }, + itemCount: user.images!.length, + ) + + // Swiper( + // autoplay: false, + // loop: user.images!.length == 1 + // ? false + // : true, + // itemBuilder: + // (BuildContext context, int index) { + // // print(index); + + // }, + // itemCount: user.images!.length, + // ), + )), + ), + if (user.images!.length > 1) + Positioned( + top: 4.sp, + child: Container( + height: 4.sp, + margin: EdgeInsets.only(left: 10.sp, right: 10.sp), + width: Get.width - 30.sp, + child: Row( + children: pointWidget, + ), + )), + Positioned( + left: 5.sp, + top: 15.sp, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (onLineStr.isNotEmpty) + Container( + height: 24.sp, + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.35), + borderRadius: BorderRadius.circular(12.sp)), + child: Row( + children: [ + Container( + width: 6.sp, + height: 6.sp, + margin: EdgeInsets.only(right: 4.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3.sp), + color: AppColor.mainColor, + ), + ), + // if (logic.online) + Text( + onLineStr, + style: TextStyle( + color: Colors.white, fontSize: 16.sp), + ), + ], + ), + ), + if (onLineStr!.isNotEmpty) + SizedBox( + height: 8.sp, + ), + if (user.both_cities!.isNotEmpty) + Container( + height: 24.sp, + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.35), + borderRadius: BorderRadius.circular(12.sp)), + child: Row( + children: [ + Container( + width: 6.sp, + height: 6.sp, + margin: EdgeInsets.only(right: 4.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3.sp), + color: AppColor.mainColor, + ), + ), + // if (logic.online) + Text( + "你们都来过${user.both_cities!.first}", + style: TextStyle( + color: Colors.white, fontSize: 16.sp), + ), + ], + )), + if (user.both_cities!.isNotEmpty) + SizedBox( + height: 8.sp, + ), + if (user.both_interests!.isNotEmpty) + Container( + height: 24.sp, + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.35), + borderRadius: BorderRadius.circular(12.sp)), + child: Row( + children: [ + Container( + width: 6.sp, + height: 6.sp, + margin: EdgeInsets.only(right: 4.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3.sp), + color: AppColor.mainColor, + ), + ), + // if (logic.online) + Text( + "你们有共同的圈子:${user.both_interests!.first['title']}", + style: TextStyle( + color: Colors.white, fontSize: 16.sp), + ), + ], + )), + ], + ), + )), + Positioned( + right: 16.sp, + top: 15.sp, + child: GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: user.userId!.toString()); + }, + child: Container( + width: 73.sp, + height: 24.sp, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.35), + borderRadius: BorderRadius.circular(12.5.sp)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 5.sp), + child: Text( + '查看主页', + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + ), + ), + ), + Image( + width: 15.sp, + image: AssetImage(getDisCoverImage("right_icon")), + // width: 44.sp, + ), + ], + ), + ), + )), + Positioned( + left: 6.sp, + bottom: 6.sp, + child: Container( + width: Get.width - 32.sp, + padding: EdgeInsets.only(right: 0.sp), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (user.contact!.isNotEmpty) + wxStatusWidget( + !user.contact!.contains('*'), + user.contact!, + user.userId.toString(), + user.contactType!, + user.avatarUrl!, () { + widget.loadSignDiscoverData(user.userId.toString()); + }), + SizedBox( + height: 15.sp, + ), + Row( + children: [ + Text( + user.nickname ?? '', + style: TextStyle( + fontSize: 18.sp, + color: Color(0XFFF7FAFA), + fontWeight: FontWeight.bold), + ), + Container( + margin: EdgeInsets.only(left: 5.sp), + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent(user!.gender ?? 0, user!.age ?? 0, + user!.role ?? 0, user!.orientation ?? 0), + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ), + Container( + margin: EdgeInsets.only( + left: 4.sp, + ), + child: UserTagWidget(user.mark!), + ), + ], + ), + Container( + width: Get.width - 120.sp, + margin: EdgeInsets.only(top: 15.sp, bottom: 15.sp), + child: Text( + user.signature! ?? '', + overflow: TextOverflow.ellipsis, + maxLines: (user.signature! ?? '').length > 15 ? 2 : 1, + style: TextStyle( + fontSize: 16.sp, color: const Color(0XFFF7FAFA)), + ), + ), + Container( + width: Get.width - 110.sp, + height: 35.sp, + child: tagItem(user.interests!), + ), + ], + ), + )), + Positioned( + bottom: 5.sp, + right: 15.sp, + child: Container( + child: Column( + children: [ + GestureDetector( + onTap: () async { + widget.showGiftPannel(user.imAccid!.toString()); + }, + child: Image.asset( + getMsgImage('gift'), + width: 50.sp, + ), + ), + SizedBox( + height: 25.sp, + ), + GestureDetector( + onTap: () { + pushChatPage(user.userId.toString(), + user.imAccid!.toString(), user.nickname!); + }, + child: Image.asset( + getCircleImage( + 'chat_icon', + ), + width: 50.sp, + ), + ), + SizedBox( + height: 25.sp, + ), + GestureDetector( + onTap: () { + widget.setLike(); + }, + child: Image.asset( + getCircleImage( + user.is_follow! ? 'like_icon' : 'nor_like_icon', + ), + width: 50.sp, + ), + ), + SizedBox( + height: 20.sp, + ), + GestureDetector( + onTap: () { + _showReportDialog( + context, user.userId!.toString(), index); + }, + child: Image.asset( + getCircleImage( + 'no_look_icon', + ), + width: 50.sp, + ), + ) + ], + ), + )) + ], + )); + } + + + tagItem(List item) { + return Container( + width: Get.width, + margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp), + // color: Colors.red, + // height: 45.sp, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: item.length, + itemBuilder: (context, index) { + return tagWidget(item[index]['title'], item[index]['id']); + }), + ); + } + + tagWidget(String tagName, int id) { + return GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.Signal_circle_list, arguments: id); + }, + child: Container( + margin: EdgeInsets.only(right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + ), + color: const Color(0xFF392D53), + ), + child: Container( + margin: EdgeInsets.all(0.2.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + color: const Color(0xFF392D53), + ), + child: Padding( + padding: EdgeInsets.only( + top: 2.sp, + bottom: 2.sp, + left: 10.sp, + right: 10.sp, + ), + child: Center( + child: Text( + tagName, + style: const TextStyle( + fontSize: 11.0, + color: Colors.white, + ), + ), + ), + ), + ), + ), + ); + } + + void _showReportDialog( + BuildContext context, String userId, int currentIndex) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 277.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const LinearGradient( + colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.all(1.sp), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 24.sp), + child: Column( + children: [ + Center( + child: Text( + "温馨提示", + style: + TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), + Container( + margin: EdgeInsets.only(top: 14.sp), + alignment: Alignment.center, + child: Image( + image: AssetImage(getCircleImage("no_look_icon_h")), + width: 70.sp, + height: 70.sp, + ), + ), + Container( + margin: EdgeInsets.only( + top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + "您确认对TA不感兴趣吗?确认之后在这个板块就看不见TA了。", + textAlign: TextAlign.center, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Container( + margin: EdgeInsets.only(top: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0x26FFFFFF), + Color(0x26FFFFFF), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 27.sp, + right: 27.sp), + child: const Text( + "再考虑考虑", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ), + SizedBox(width: 24.sp), + GestureDetector( + onTap: () { + Get.back(); + widget.sendNoLookData(); + }, + child: Container( + margin: EdgeInsets.only(top: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: const Text( + "确定", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } +} + class DiscoverDataRefresh { String userId; DiscoverDataRefresh(this.userId); @@ -1110,10 +1350,10 @@ class Users { this.bgPicUrl, this.birthday, this.blacklist, - this.mark, - this.contact, - this.contactType, - this.online_flag, + this.mark, + this.contact, + this.contactType, + this.online_flag, this.city, this.both_interests, this.distance, diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart index ab1fc95..d643f12 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -683,10 +683,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ///至尊喊话 vipDynamicItem(Lists lists) { - Text descText = Text( + Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, - style: TextStyle(color: Colors.white, fontSize: 17.sp), - maxLines: 2, + style: TextStyle(color: Colors.white, fontSize: 14.sp), + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + widget.logic.openCallOutIdList.add(lists.id); + setState(() { + + }); + }, ); // List urlList = bean.lastJoinUsers; @@ -991,10 +996,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ///普通图文喊话 normalDynamicItem(Lists lists) { - Text descText = Text( + Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, - style: TextStyle(color: Colors.white, fontSize: 17.sp), - // maxLines: 2, + style: TextStyle(color: Colors.white, fontSize: 14.sp), + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + widget.logic.openCallOutIdList.add(lists.id); + setState(() { + + }); + }, ); double picHeight = 0.0; @@ -1035,7 +1045,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien return Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, - height: 120.sp + contentHeight(lists.content!) + picHeight, + // height: 120.sp + contentHeight(lists.content!) + picHeight, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -1255,7 +1265,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Container( height: 30.sp, padding: EdgeInsets.only(left: 5.sp, right: 10.sp,), - margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 10.sp), + margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 10.sp,bottom: 10.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000)), diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart index 59950d7..2db9711 100644 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -24,7 +24,9 @@ import 'package:shared_preferences/shared_preferences.dart'; import '../../../common/Widgets/base_tip_widget.dart'; import '../../../common/Widgets/tag_widget.dart'; import '../../../common/colors/app_color.dart'; +import '../../../network/api.dart'; import '../../circle_list/logic.dart'; +import '../../msg/recommend_circle_friend_item.dart'; class LikeView extends StatefulWidget { LikeView({super.key, required this.changeCallback}); @@ -41,6 +43,7 @@ class _LikeViewState extends State bool get wantKeepAlive => true; final ScrollController scrollController = ScrollController(); final RefreshController refreshController = RefreshController(); + CircleLogic logic = Get.find(); // ListLogic? listsLg; @@ -253,12 +256,15 @@ class _LikeViewState extends State url: "/up-service/callout/${bean.id}/chat", ); if (data["code"] == 200) { - pushChatPage(data['data']['account_id'].toString().split("_").last, + pushChatPage(data['data']['account_id'] + .toString() + .split("_") + .last, data['data']['account_id'], bean.user!.nickname!); await Future.delayed(Duration(seconds: 1)); SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); + await SharedPreferences.getInstance(); // SharedPreferencesHelper.getInstance().then((sharedPreferences) { int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; @@ -357,7 +363,7 @@ class _LikeViewState extends State decoration: BoxDecoration( color: AppColor.bgColor, borderRadius: - BorderRadius.circular(5.sp)), + BorderRadius.circular(5.sp)), child: Text( ' 展开更早发布的喊话 ↓ ', style: TextStyle( @@ -385,16 +391,16 @@ class _LikeViewState extends State decoration: BoxDecoration( border: GradientBoxBorder( gradient: - AppColor.mainVerLinearGradient, + AppColor.mainVerLinearGradient, width: 1.sp, ), borderRadius: - BorderRadius.circular(5.sp)), + BorderRadius.circular(5.sp)), child: Column( crossAxisAlignment: - CrossAxisAlignment.center, + CrossAxisAlignment.center, mainAxisAlignment: - MainAxisAlignment.center, + MainAxisAlignment.center, children: [ Text( ' 展开更早发布的喊话 ↓ ', @@ -429,32 +435,32 @@ class _LikeViewState extends State } else { return Container( margin: - EdgeInsets.only(top: recomandMore ? 0 : 10.sp), + EdgeInsets.only(top: recomandMore ? 0 : 10.sp), child: recomandMore ? loaddingWidget(recomandMore) : GestureDetector( - onTap: () { - widget.changeCallback(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getLoginImage('start_bg'), - width: 180.sp, - ), - Text( - '查看更多圈子', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ) - ], - ), + onTap: () { + widget.changeCallback(); + }, + child: Container( + margin: EdgeInsets.only(bottom: 10.sp), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getLoginImage('start_bg'), + width: 180.sp, ), - )); + Text( + '查看更多圈子', + style: TextStyle( + color: Colors.white, + fontSize: 18.sp), + ) + ], + ), + ), + )); } }), ), @@ -524,7 +530,7 @@ class _LikeViewState extends State margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), child: Container( margin: - EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), + EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), alignment: Alignment.center, child: SingleChildScrollView( child: Text( @@ -576,7 +582,7 @@ class _LikeViewState extends State // pushOtherPeopleHomePage(element.id.toString()); }, child: - circleWidget(element.avatar!, element.id.toString(), width: 24), + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -647,7 +653,7 @@ class _LikeViewState extends State alignment: Alignment.center, children: [ Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), padding: EdgeInsets.only(left: 15.sp, right: 15.sp), alignment: Alignment.center, height: 28.sp, @@ -660,7 +666,8 @@ class _LikeViewState extends State bottomLeft: Radius.circular(12.sp))), child: Text( (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + '...' + ? (lists.user!.city ?? '外星').substring(0, 4) + + '...' : (lists.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 15.sp), )) @@ -698,73 +705,73 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + Row( + children: [ + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8.sp, + ), + UserTagWidget(lists.user!.mark!), + // lists.user?.vip != null && + // lists.user!.vip == 0 + // ? Container() + // : Image.asset( + // getCircleImage(lists.user!.vip == 1 + // ? 'vip' + // : 'year_vip'), + // width: 36.sp, + // ) + ], ), SizedBox( - width: 8.sp, + height: 4.sp, ), - UserTagWidget(lists.user!.mark!), - // lists.user?.vip != null && - // lists.user!.vip == 0 - // ? Container() - // : Image.asset( - // getCircleImage(lists.user!.vip == 1 - // ? 'vip' - // : 'year_vip'), - // width: 36.sp, - // ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender ?? 0, + lists.user!.age ?? 0, + lists.user!.role ?? 0, + lists.user!.orientation ?? 0), + // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ) + ], + ), ], ), - ], - ), - )), + )), ], ), ), @@ -778,52 +785,52 @@ class _LikeViewState extends State margin: EdgeInsets.only(top: 5.sp), child: picHeight == 140.sp ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId':lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), + itemCount: lists.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: 0.7 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, arguments: { + 'imaglist': imgList, + 'index': currentIndex, + 'userId': lists.user!.id.toString() + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + // placeholder: (context, url) => + // SizedBox( + // width: 30.sp, + // height: 30.sp, + // child: CircularProgressIndicator( + // color: Color(0xFF07FAFB), + // strokeWidth: 2.sp, + // ), + // ), + errorWidget: (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + }), ), Container( height: 30.sp, @@ -836,29 +843,29 @@ class _LikeViewState extends State children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), GestureDetector( onTap: () { pushMsgPage( @@ -924,7 +931,7 @@ class _LikeViewState extends State child: GestureDetector( onTap: () {}, child: - circleWidget(element.avatar!, element.id.toString(), width: 24), + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -966,7 +973,7 @@ class _LikeViewState extends State alignment: Alignment.center, children: [ Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), padding: EdgeInsets.only(left: 15.sp, right: 15.sp), alignment: Alignment.center, height: 28.sp, @@ -980,10 +987,10 @@ class _LikeViewState extends State child: Text( (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0, 4) + - '...' + '...' : (lists.user!.city ?? '外星'), style: - TextStyle(color: Colors.white, fontSize: 15.sp), + TextStyle(color: Colors.white, fontSize: 15.sp), )) ], ), @@ -1018,63 +1025,64 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + padding: EdgeInsets.only( + left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + Row( + children: [ + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8.sp, + ), + UserTagWidget(lists.user!.mark!), + ], ), SizedBox( - width: 8.sp, + height: 4.sp, ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender ?? 0, + lists.user!.age ?? 0, + lists.user!.role ?? 0, + lists.user!.orientation ?? 0), + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ) + ], + ), ], ), - ], - ), - )), + )), ], ), ), @@ -1085,69 +1093,70 @@ class _LikeViewState extends State ), picHeight > 0 ? Container( - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: - VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: - const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: - 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - if (album.type == 2) { - return ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: VideoItemWidget(album.url!)); - } - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId':lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: - (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) + height: picHeight, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 140.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: + VideoItemWidget(lists.album![0].url!)) + : GridView.builder( + itemCount: lists.album!.length, + physics: + const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: + 0.7 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + if (album.type == 2) { + return ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: VideoItemWidget(album.url!)); + } + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, + arguments: { + 'imaglist': imgList, + 'index': currentIndex, + 'userId': + lists.user!.id.toString() + }); + }, + child: ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + // placeholder: (context, url) => + // SizedBox( + // width: 30.sp, + // height: 30.sp, + // child: CircularProgressIndicator( + // color: Color(0xFF07FAFB), + // strokeWidth: 2.sp, + // ), + // ), + errorWidget: + (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + })) : Container(), Container( height: 30.sp, @@ -1156,7 +1165,7 @@ class _LikeViewState extends State right: 10.sp, ), margin: - EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), + EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000)), @@ -1164,29 +1173,29 @@ class _LikeViewState extends State children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), GestureDetector( onTap: () async { pushMsgPage( @@ -1218,74 +1227,85 @@ class _LikeViewState extends State tipItem() { bool showTitle = lists.isEmpty; - return Container( - margin: EdgeInsets.only(top: showTitle ? 20.sp : 0, bottom: 10.sp), - // height: 30.sp, - child: Column( - children: [ - if (showTitle) - Container( - margin: EdgeInsets.only(bottom: 8.sp), - child: Image.asset( - getBaseImage('no_result'), - width: 200.sp, + return GetBuilder(builder: (logic) { + return Container( + margin: EdgeInsets.only(top: showTitle ? 10.sp : 0, bottom: 10.sp), + // height: 30.sp, + child: Column( + children: [ + if (showTitle) + logic.recommendCircleFriendData.isNotEmpty + ? RecommendCircleFriendItem( + false, + recommendCircleFriendData: logic.recommendCircleFriendData, + getDataCallBack: () { + logic.loadRecommendCircleFriendData(); + }) + : Container(), + if (showTitle) + Container( + margin: EdgeInsets.only(bottom: 8.sp), + child: Image.asset( + getBaseImage('no_result'), + width: 200.sp, + ), ), - ), - if (showTitle) - Text( - '还没有您喜欢的圈友发布喊话哦~', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - Container( - margin: EdgeInsets.only(top: 20.sp), - padding: EdgeInsets.only(left: 30.sp, right: 30.sp), - child: Row( - children: [ - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 8.sp), - height: 2.sp, - width: 2.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(1.sp)), - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '喊话推荐', - style: TextStyle(color: Colors.white, fontSize: 17.sp), + if (showTitle) + Text( + '还没有您喜欢的圈友发布喊话哦~', + style: TextStyle(color: Colors.white, fontSize: 16.sp), + ), + Container( + margin: EdgeInsets.only(top: 20.sp), + padding: EdgeInsets.only(left: 30.sp, right: 30.sp), + child: Row( + children: [ + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + Container( + margin: EdgeInsets.only(left: 8.sp, right: 8.sp), + height: 2.sp, + width: 2.sp, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(1.sp)), ), - ), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 8.sp), - height: 2.sp, - width: 2.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(1.sp)), - ), - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - ], - ), - ) - ], - ), - ); + ShaderMask( + shaderCallback: (Rect bounds) { + return const LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [Color(0xff71F3F2), Color(0xffF657FF)], + ).createShader(Offset.zero & bounds.size); + }, + child: Text( + '喊话推荐', + style: TextStyle(color: Colors.white, fontSize: 17.sp), + ), + ), + Container( + margin: EdgeInsets.only(left: 8.sp, right: 8.sp), + height: 2.sp, + width: 2.sp, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(1.sp)), + ), + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + ], + ), + ) + ], + ), + ); + }); } circleInfoItem(var bean, Lists list, int index) { @@ -1333,41 +1353,41 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only( - left: 8.sp, - top: 12.sp, - ), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + padding: EdgeInsets.only( + left: 8.sp, + top: 12.sp, ), - SizedBox( - height: 4.sp, + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + bean['title'], + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + height: 4.sp, + ), + Text( + // "view_total" -> 21 + '${convertToTenThousand(bean['view_total'])}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['view_total'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), + )), Container( margin: EdgeInsets.only(right: 8.sp), child: GestureDetector( - //加入圈子 + //加入圈子 onTap: () async { CircleLogic cLogic = Get.find(); if (bean['is_join']) { @@ -1401,8 +1421,6 @@ class _LikeViewState extends State element.interest = element.interest!; } }); - - } if (Get.isRegistered()) { LikeLogic likeLogic = Get.find(); @@ -1424,7 +1442,7 @@ class _LikeViewState extends State Text( !bean['is_join'] ? '申请加入' : '分享有奖', style: - TextStyle(color: Colors.white, fontSize: 12.sp), + TextStyle(color: Colors.white, fontSize: 12.sp), ) ], )), @@ -1502,7 +1520,7 @@ class _LikeViewState extends State child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( diff --git a/circle_app/lib/app/circle/widgets/new_people.dart b/circle_app/lib/app/circle/widgets/new_people.dart index 69b476f..55223e0 100644 --- a/circle_app/lib/app/circle/widgets/new_people.dart +++ b/circle_app/lib/app/circle/widgets/new_people.dart @@ -73,7 +73,9 @@ class _NewPeopleState extends State { }, ), ) - : loaddingWidget(logic.isNewPeopleMore,tip: '过段时间再来欢迎新人吧~'); + : logic.isLoadFail ? noResultWidget(tip: '', callBack: () { + logic.onLoading(); + }) : loaddingWidget(logic.isNewPeopleMore,tip: '过段时间再来欢迎新人吧~'); }); } } diff --git a/circle_app/lib/app/circle/widgets/vicinity.dart b/circle_app/lib/app/circle/widgets/vicinity.dart index fd5cec8..fa4c363 100644 --- a/circle_app/lib/app/circle/widgets/vicinity.dart +++ b/circle_app/lib/app/circle/widgets/vicinity.dart @@ -41,17 +41,13 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin super.initState(); widget.logic.getNearByList(); sub = EventBusManager.on().listen((event) { - // if (widget.logic.myVip > 0) { + try { _scrollController.animateTo(0, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - // } - }); + } catch (e) { - // _scrollController.addListener(() { - // if (maxOff > 0 && widget.logic.myVip == 0 && _scrollController.offset >= maxOff) { - // _scrollController.jumpTo(maxOff); - // } - // }); + } + }); } @override @@ -92,17 +88,19 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin // Positioned( // bottom: 0, // child: showVipView()) - Positioned(top: 10.sp,left: 10.sp,child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.WorldCallOut); - }, - child: Image.asset( - getMsgImage('hu_icon'), - width: 30.sp, - ), - ),) + // Positioned(top: 10.sp,left: 10.sp,child: GestureDetector( + // onTap: () { + // Get.toNamed(AppRoutes.WorldCallOut); + // }, + // child: Image.asset( + // getMsgImage('hu_icon'), + // width: 30.sp, + // ), + // ),) ], - ) : loaddingWidget(true); + ) : widget.logic.isNearLoad ? loaddingWidget(true) : noResultWidget(tip: '',callBack: () { + _onLoading(); + }); } Widget bannerView(CircleLogic controller) { diff --git a/circle_app/lib/app/circle_list/logic.dart b/circle_app/lib/app/circle_list/logic.dart index 237b1c2..2769ba7 100644 --- a/circle_app/lib/app/circle_list/logic.dart +++ b/circle_app/lib/app/circle_list/logic.dart @@ -31,11 +31,14 @@ class LikeLogic extends GetxController { List hasNewList = []; List categoriesList = []; + List openCallOutIdList = []; bool isNewPeople = false; bool isLoadNewData = false; + bool isLoadFial = false; + Data? homeData; @override void onInit() async { @@ -55,6 +58,7 @@ class LikeLogic extends GetxController { } loadMyInfo() async { + isLoadFial = false; var data = await DioManager.instance.get(url: Api.getUserMine); var bean = BaseResponse.fromJson( data, (data) => MineResponseBean.fromJson(data)); @@ -65,6 +69,9 @@ class LikeLogic extends GetxController { isLoadNewData = true; update(); } + } else if (bean.code == 404) { + isLoadFial = true; + update(); } } @@ -72,6 +79,7 @@ class LikeLogic extends GetxController { loadInviteData(); loadCircleListData(); loadMyCircleData(); + loadCircleTypeData(); } loadInviteData() async { diff --git a/circle_app/lib/app/circle_list/view.dart b/circle_app/lib/app/circle_list/view.dart index 7b9672c..09b1a5a 100644 --- a/circle_app/lib/app/circle_list/view.dart +++ b/circle_app/lib/app/circle_list/view.dart @@ -108,7 +108,10 @@ class _CircleListPageState extends State logic.update(); } - return logic.isLoad + return logic.isLoadFial ? noResultWidget(tip:'',callBack: () { + logic.loadMyInfo(); + logic.loadData(); + }) : logic.isLoad ? loaddingWidget(true) : Container( width: Get.width, @@ -628,7 +631,7 @@ class _CircleListPageState extends State )); } - leftItem(String text, bool isSelcted, bool isUnread, int index) { + leftItem(String text, bool isSelcted, bool isUnread, int index) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -667,10 +670,19 @@ class _CircleListPageState extends State child: Container( width: 65.sp, height: 65.sp, - color: isSelcted ? Colors.white.withOpacity(0.3) : Colors.transparent, + // color: isSelcted ? Colors.white.withOpacity(0.3) : Colors.transparent, child: Stack( alignment: Alignment.center, children: [ + if (isSelcted) + OverflowBox( + minWidth: 0.0, + maxWidth: double.infinity, + minHeight: 0.0, + maxHeight: double.infinity, + child: Image.asset(getCircleImage('circle_selected_bg'),width: 65.sp,), + ), + if (text.isEmpty && index == -1) topCicleStatusItem( isSelcted, diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index f73e9f2..f02e848 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -86,6 +86,12 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { void onInit() async { super.onInit(); unreadSIze.value = '0'; + tabs.add(CirclePage()); + tabs.add(CircleListPage()); + tabs.add(WorldCallOutPage()); + tabs.add(MsgPage()); + tabs.add(MinefragmentPage()); + loadEnvTypeData(); // 设置网络变化监听 connectListener(); @@ -94,11 +100,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { setFirstData(); loadMyInfoData(); - tabs.add(CirclePage()); - tabs.add(CircleListPage()); - tabs.add(World_call_outPage()); - tabs.add(MsgPage()); - tabs.add(MinefragmentPage()); + sub = EventBusManager.on().listen((event) { getUnreadSize(); @@ -115,6 +117,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } + + void addMsgListener() { msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: ( msgID, @@ -319,6 +323,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { super.onReady(); FlutterNativeSplash.remove(); + updateIndex(1); final logic = Get.find(); logic.loadCirclePeopleData(); @@ -353,6 +358,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { loginIM( data['data']['account_id'].toString(), data['data']['user_sig']); accountId = data['data']['account_id'].toString(); + } else { + getIMData(); } } } diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart index 2cc0565..09a8311 100644 --- a/circle_app/lib/app/home/view.dart +++ b/circle_app/lib/app/home/view.dart @@ -116,7 +116,7 @@ class _HomePageState extends State children: [ const CirclePage(), CircleListPage(), - World_call_outPage(), + WorldCallOutPage(), MsgPage(), MinefragmentPage() ], diff --git a/circle_app/lib/app/minefragment/logic.dart b/circle_app/lib/app/minefragment/logic.dart index 9281a65..7be0d70 100644 --- a/circle_app/lib/app/minefragment/logic.dart +++ b/circle_app/lib/app/minefragment/logic.dart @@ -92,11 +92,11 @@ class MinefragmentLogic extends GetxController { int likeMeCount = sharedPreferences.getInt(SharedPreferencesHelper.LIKEMECOUNT)??0; int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; sharedPreferences.setString(SharedPreferencesHelper.PHOTO, bean.data.phone); - like_me_count_new = likeMeCount - like_me_count; + like_me_count_new = like_me_count - likeMeCount; print("***************"); print("$likeMeCount-$like_me_count=$like_me_count_new"); - recent_visit_count_new = recentVisitCount - recent_visit_count; + recent_visit_count_new = recent_visit_count - recentVisitCount; // like_me_count_new = recentVisitCount.toInt() - bean.data.likeMeCount.toInt(); diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index 443b433..3d2a610 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -488,7 +488,7 @@ class _TIMConversationState extends TIMUIKitState { itemBuilder: (context, index) { if (index == filteredConversationList.length) { return recommendCircleFriendData.isNotEmpty - ? RecommendCircleFriendItem(recommendCircleFriendData: recommendCircleFriendData,getDataCallBack: () { + ? RecommendCircleFriendItem(true,recommendCircleFriendData: recommendCircleFriendData,getDataCallBack: () { loadRecommendCircleFriendData(); }) : Container(); diff --git a/circle_app/lib/app/msg/recommend_circle_friend_item.dart b/circle_app/lib/app/msg/recommend_circle_friend_item.dart index 94bfdb7..8e0578d 100644 --- a/circle_app/lib/app/msg/recommend_circle_friend_item.dart +++ b/circle_app/lib/app/msg/recommend_circle_friend_item.dart @@ -11,9 +11,10 @@ import '../../util/util.dart'; import '../circle/widgets/discover.dart'; class RecommendCircleFriendItem extends StatefulWidget { - RecommendCircleFriendItem({super.key,required this.recommendCircleFriendData,required this.getDataCallBack}); + RecommendCircleFriendItem(this.isShowTopLine,{super.key,required this.recommendCircleFriendData,required this.getDataCallBack,}); var recommendCircleFriendData; Function getDataCallBack; + bool isShowTopLine; @override _RecommendCircleFriendItemState createState() => _RecommendCircleFriendItemState(); @@ -56,6 +57,7 @@ class _RecommendCircleFriendItemState extends State { return Container( padding: EdgeInsets.only(left: 15.sp, right: 15.sp), child: Column(children: [ + if (widget.isShowTopLine) Container( margin: EdgeInsets.only(top: 20.sp), child: Row( @@ -82,7 +84,7 @@ class _RecommendCircleFriendItemState extends State { ), ), Container( - margin: EdgeInsets.only(top: 16.sp), + margin: EdgeInsets.only(top: widget.isShowTopLine ? 16.sp : 0), child: Row( children: [ Image.asset( diff --git a/circle_app/lib/app/my_circle/view.dart b/circle_app/lib/app/my_circle/view.dart index df35637..07b9996 100644 --- a/circle_app/lib/app/my_circle/view.dart +++ b/circle_app/lib/app/my_circle/view.dart @@ -493,7 +493,7 @@ class _My_circlePageState extends State alignment: Alignment.topLeft, child: Text( msg, - textAlign: TextAlign.center, + textAlign: TextAlign.left, style: TextStyle( color: Color(0xCCF7FAFA), fontSize: 16.sp), ), diff --git a/circle_app/lib/app/signal_circle_list/logic.dart b/circle_app/lib/app/signal_circle_list/logic.dart index e4cf8e1..67ed8e2 100644 --- a/circle_app/lib/app/signal_circle_list/logic.dart +++ b/circle_app/lib/app/signal_circle_list/logic.dart @@ -8,7 +8,7 @@ import 'state.dart'; class Signal_circle_listLogic extends GetxController { final Signal_circle_listState state = Signal_circle_listState(); - + List openCallOutIdList = []; Circle? circle; @override diff --git a/circle_app/lib/app/splash/logic.dart b/circle_app/lib/app/splash/logic.dart index 325b699..a9763ca 100644 --- a/circle_app/lib/app/splash/logic.dart +++ b/circle_app/lib/app/splash/logic.dart @@ -94,7 +94,14 @@ class SplashLogic extends GetxController { await Future.delayed(Duration(seconds: 5)); onInit(); } else { - pushLoginPage(); + SharedPreferencesHelper sp = + await SharedPreferencesHelper.getInstance(); + String token = sp.getString(SharedPreferencesHelper.AUTHORIZATION); + if (token.isNotEmpty) { + Get.offNamed(AppRoutes.Home); + } else { + pushLoginPage(); + } } // Get.toNamed(AppRoutes.Home); diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart index 8603d9d..093cfa2 100644 --- a/circle_app/lib/app/userinfo/logic.dart +++ b/circle_app/lib/app/userinfo/logic.dart @@ -48,9 +48,14 @@ class UserinfoLogic extends GetxController { List recevigiftList = []; + List openCallOutIdList = []; + Map toUser = {}; int unLockWxNum = 0; + int likeMeCount = 0; + int imageUrgeCount = 0; + final startTime = DateTime.now(); SharedPreferences? sharedPreferences; @override @@ -174,6 +179,8 @@ class UserinfoLogic extends GetxController { isLikeFoMsg = "${bean.data.likeMeCount}位圈友感兴趣,其中${bean.data.imageUrgeCount}位已催您更新"; + likeMeCount = bean.data.likeMeCount; + imageUrgeCount = bean.data.imageUrgeCount; userInfoBean = bean.data.user; unLockWxNum = userInfoBean!.contact!.contains('*') ? 0 : 1; isVip = userInfoBean?.vip ?? 0; @@ -350,6 +357,8 @@ class UserinfoLogic extends GetxController { } catch (e) {} update(); + } else if (bean.code == 21201 || bean.code == 21202) { + showVipDialog(); } showOKToast(bean.msg); } diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index ce30bb1..f0a69bd 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -245,7 +245,25 @@ class MyTabbedScreenState extends State ], ), ) - : Container() + :Container( + alignment: Alignment.centerLeft, + // width: 200.sp, + // color: Colors.red, + margin: EdgeInsets.only(left: 5.sp, bottom: 5.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + userWxStatusWidget( + !logic.userInfoBean!.contact!.contains('*'), + logic.userInfoBean!.contact!, + logic.userId.toString(), + logic.userInfoBean!.contactType!, + logic.userInfoBean!.avatar!, () { + logic.fetchUserInfo( + "${Api.getUserInfoTA + logic.userId}/home"); + }), + ], + )) : Container()) : MyAppBar( centerTitle: logic.userInfoBean != null @@ -273,13 +291,7 @@ class MyTabbedScreenState extends State toolbarHeight: 0, foregroundColor: Colors.transparent, backgroundColor: Colors.transparent, - expandedHeight: 352.sp + - (logic.userInfoBean != null - ? logic.userInfoBean!.contact!.isNotEmpty && - logic.userId.toString().isNotEmpty - ? 42.sp - : 0 - : 0), + expandedHeight: 352.sp, // bottom: PreferredSize( // preferredSize: Size(Get.width, 40), // child: titleTab(logic), @@ -561,30 +573,30 @@ class MyTabbedScreenState extends State ? Container() : _buildInterestsListView(interests), ), - if (!logic.isMe) - logic.userInfoBean != null - ? logic.userInfoBean!.contact!.isNotEmpty - ? Container( - alignment: Alignment.centerLeft, - // width: 200.sp, - // color: Colors.red, - margin: EdgeInsets.only(left: 5.sp, bottom: 5.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - wxStatusWidget( - !logic.userInfoBean!.contact!.contains('*'), - logic.userInfoBean!.contact!, - logic.userId.toString(), - logic.userInfoBean!.contactType!, - logic.userInfoBean!.avatar!, () { - logic.fetchUserInfo( - "${Api.getUserInfoTA + logic.userId}/home"); - }), - ], - )) - : Container() - : Container(), + // if (!logic.isMe) + // logic.userInfoBean != null + // ? logic.userInfoBean!.contact!.isNotEmpty + // ? Container( + // alignment: Alignment.centerLeft, + // // width: 200.sp, + // // color: Colors.red, + // margin: EdgeInsets.only(left: 5.sp, bottom: 5.sp), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // wxStatusWidget( + // !logic.userInfoBean!.contact!.contains('*'), + // logic.userInfoBean!.contact!, + // logic.userId.toString(), + // logic.userInfoBean!.contactType!, + // logic.userInfoBean!.avatar!, () { + // logic.fetchUserInfo( + // "${Api.getUserInfoTA + logic.userId}/home"); + // }), + // ], + // )) + // : Container() + // : Container(), if (logic.userInfoBean != null && logic.giftList.isNotEmpty) GestureDetector( onTap: () async { @@ -950,9 +962,26 @@ class MyTabbedScreenState extends State if (controller.isMe) Container( margin: EdgeInsets.only(top: 18.sp, bottom: 14.sp), - child: Text( - controller.isLikeFoMsg, - style: const TextStyle(color: Colors.white30), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + controller.likeMeCount.toString(), + style: TextStyle(color:AppColor.mainColor), + ), + Text( + '位圈友感兴趣,其中', + style: const TextStyle(color: Colors.white30), + ), + Text( + controller.imageUrgeCount.toString(), + style: TextStyle(color:AppColor.mainColor), + ), + Text( + '位已催您更新', + style: const TextStyle(color: Colors.white30), + ), + ], ), ), controller.state.imaglist.isEmpty && !controller.isMe diff --git a/circle_app/lib/app/userinfo/widgets/home_call_out.dart b/circle_app/lib/app/userinfo/widgets/home_call_out.dart index cefddee..e0724ef 100644 --- a/circle_app/lib/app/userinfo/widgets/home_call_out.dart +++ b/circle_app/lib/app/userinfo/widgets/home_call_out.dart @@ -12,6 +12,8 @@ import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get.dart'; +import '../../../common/Widgets/text_more.dart'; +import '../logic.dart'; import '../view.dart'; class HomeCallOutView extends StatefulWidget { @@ -32,6 +34,7 @@ class _HomeCallOutViewState extends State HomeCallOutLogic? listsLg; ScrollController scrollController = ScrollController(); + UserinfoLogic logic = Get.find(); bool isEnd = false; var sub; @@ -128,10 +131,15 @@ class _HomeCallOutViewState extends State ///至尊喊话 vipDynamicItem(Lists lists) { - Text descText = Text( + Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, style: TextStyle(color: Colors.white, fontSize: 14.sp), - maxLines: 2, + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + logic.openCallOutIdList.add(lists.id); + setState(() { + + }); + }, ); double picHeight = 0.0; @@ -154,9 +162,9 @@ class _HomeCallOutViewState extends State } } double titleHeight = textWidth(lists.interest!['title']); - double widgetHeight = 115.sp + - contentHeight(lists.content!) + - (picHeight > 0 ? picHeight + 5 : 0); + // double widgetHeight = 115.sp + + // contentHeight(lists.content!) + + // (picHeight > 0 ? picHeight + 5 : 0); return Column( children: [ @@ -171,7 +179,7 @@ class _HomeCallOutViewState extends State Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, - height: widgetHeight, + // height: widgetHeight, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -205,10 +213,11 @@ class _HomeCallOutViewState extends State ), ), Container( - height: widgetHeight, + // height: widgetHeight, width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), + padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp,bottom: 12.sp), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: 72.sp, @@ -358,9 +367,10 @@ class _HomeCallOutViewState extends State ); }), ), + if (widget.userId.isEmpty) Container( width: Get.width, - margin: EdgeInsets.only(top: 4.sp), + margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), alignment: Alignment.centerLeft, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -379,7 +389,7 @@ class _HomeCallOutViewState extends State }, child: Image.asset( getCircleImage('delete'), - width: 14.sp, + width: 20.sp, )) ], )) @@ -393,10 +403,15 @@ class _HomeCallOutViewState extends State ///普通图文喊话 normalDynamicItem(Lists lists) { - Text descText = Text( + Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, style: TextStyle(color: Colors.white, fontSize: 14.sp), - // maxLines: 2, + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + logic.openCallOutIdList.add(lists.id); + setState(() { + + }); + }, ); double picHeight = 0.0; @@ -434,9 +449,9 @@ class _HomeCallOutViewState extends State Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, - height: picHeight > 0 - ? 105.sp + contentHeight(lists.content!) + picHeight - : 100.sp + contentHeight(lists.content!), + // height: picHeight > 0 + // ? 105.sp + contentHeight(lists.content!) + picHeight + // : 100.sp + contentHeight(lists.content!), decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -630,9 +645,10 @@ class _HomeCallOutViewState extends State ); })) : Container(), + if (widget.userId.isEmpty) Container( width: Get.width, - margin: EdgeInsets.only(top: 4.sp), + margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), alignment: Alignment.centerLeft, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -651,7 +667,7 @@ class _HomeCallOutViewState extends State }, child: Image.asset( getCircleImage('delete'), - width: 14.sp, + width: 20.sp, )) ], )) diff --git a/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart b/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart index 9653442..361a1bd 100644 --- a/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart +++ b/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart @@ -130,12 +130,18 @@ class _VisitorsFollowItemState extends State { GestureDetector( onTap: () { VisitorlistLogic logic = Get.find(); - List idList = []; - widget.users.forEach((element) { - var user = UserListItem.fromJson(element).user; - idList.add(user.id.toString()); - }); - logic.sendAllLike(idList); + if (logic.isVip > 0) { + List idList = []; + widget.users.forEach((element) { + var user = UserListItem.fromJson(element).user; + idList.add(user.id.toString()); + }); + logic.sendAllLike(idList); + } else { + showOKToast('开通会员可以一键喜欢哦~'); + showOepnVipDialog(); + } + }, child: Container( margin: EdgeInsets.only(left: 50.sp,right: 50.sp,top: 10.sp), diff --git a/circle_app/lib/app/world_call_out/logic.dart b/circle_app/lib/app/world_call_out/logic.dart index e155b6b..62e7835 100644 --- a/circle_app/lib/app/world_call_out/logic.dart +++ b/circle_app/lib/app/world_call_out/logic.dart @@ -2,6 +2,7 @@ import 'package:circle_app/app/world_call_out/world_data.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../network/api.dart'; import '../../network/dio_manager.dart'; @@ -13,6 +14,7 @@ import '../select_circle/logic.dart'; class World_call_outLogic extends GetxController { ScrollController scrollController = ScrollController(); TextEditingController inputController = TextEditingController(); + final RefreshController refreshController = RefreshController(); FocusNode focusNode = FocusNode(); List genderList = []; String myUserId = ''; @@ -24,6 +26,7 @@ class World_call_outLogic extends GetxController { int total = 0; bool isMore = true; + bool loadFail = false; bool showEmojiPanel = false; bool showKeyboard = false; @@ -54,6 +57,7 @@ class World_call_outLogic extends GetxController { } void initGerder() async { + genderList.clear(); var data1 = await DioManager.instance.get(url: Api.getCircleList, params: {}); var bean1 = BaseResponse.fromJson( @@ -96,6 +100,7 @@ class World_call_outLogic extends GetxController { } void loadData() async { + loadFail = false; Map params = {'page': index, 'pageSize': 20}; List wantMeet = []; @@ -119,17 +124,22 @@ class World_call_outLogic extends GetxController { isLoad = false; if (index == 1) { lists = tempLists; + } else { lists.addAll(tempLists); - - scrollController.jumpTo(scrollController.offset + 20); + refreshController.loadComplete(); + // scrollController.jumpTo(scrollController.offset + 20); } index++; } else { isMore = false; + refreshController.refreshCompleted(); } + update(); + } else if (bean1.code == 404) { + loadFail = true; update(); } } diff --git a/circle_app/lib/app/world_call_out/view.dart b/circle_app/lib/app/world_call_out/view.dart index 1a02688..77b2d76 100644 --- a/circle_app/lib/app/world_call_out/view.dart +++ b/circle_app/lib/app/world_call_out/view.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:gradient_borders/box_borders/gradient_box_border.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../common/Widgets/circle_share.dart'; import '../../common/Widgets/tag_widget.dart'; @@ -17,14 +18,14 @@ import '../../router/app_routers.dart'; import '../circle/widgets/video_item.dart'; import 'logic.dart'; -class World_call_outPage extends StatefulWidget { - World_call_outPage({Key? key}) : super(key: key); +class WorldCallOutPage extends StatefulWidget { + WorldCallOutPage({Key? key}) : super(key: key); @override - State createState() => _World_call_outPageState(); + State createState() => _WorldCallOutPageState(); } -class _World_call_outPageState extends State +class _WorldCallOutPageState extends State with WidgetsBindingObserver { String zeroWidthSpace = '\ufeff'; @@ -145,11 +146,17 @@ class _World_call_outPageState extends State logic.update(); // logic.sendTextMessage(); }, - child: RefreshIndicator( - onRefresh: () async { - logic.loadMore(); - }, - child: logic.lists.isEmpty + child: + SmartRefresher( + controller: logic.refreshController, + onLoading: () { + logic.loadMore(); + }, + enablePullUp: true, + child:logic.loadFail ? noResultWidget(tip: '',callBack: () { + logic.initGerder(); + logic.loadData(); + }) : logic.lists.isEmpty ? !logic.isMore ? noResultWidget() : loaddingWidget(true) diff --git a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart b/circle_app/lib/common/Widgets/RechargeScreenDialog.dart index 3b3f62a..6be9887 100644 --- a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart +++ b/circle_app/lib/common/Widgets/RechargeScreenDialog.dart @@ -343,7 +343,7 @@ class _RechargeScreenDialogState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - '充值金额仅限APP使用,充值遇到问题?', + '充值遇到问题?', style: TextStyle( color: const Color(0xFFB7BECC), fontSize: 10.0.sp), ), diff --git a/circle_app/lib/common/Widgets/base_tip_widget.dart b/circle_app/lib/common/Widgets/base_tip_widget.dart index f2f8059..5c4e1a1 100644 --- a/circle_app/lib/common/Widgets/base_tip_widget.dart +++ b/circle_app/lib/common/Widgets/base_tip_widget.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:circle_app/common/Widgets/add_wx_tip.dart'; +import 'package:circle_app/common/colors/app_color.dart'; import 'package:circle_app/util/paymentUtil.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; @@ -32,7 +33,8 @@ joiinCircileTipWdiget(String cicleId, String pirce, String oldPrice, children: [ Container( width: 339.sp, - height: 400.sp, + height: Platform.isIOS ? 380.sp :420.sp , + decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -73,13 +75,13 @@ joiinCircileTipWdiget(String cicleId, String pirce, String oldPrice, color: const Color.fromRGBO(247, 250, 250, 0.8), fontSize: 14.sp)), )), - Platform.isIOS + Platform.isIOS ? Container( height: 1, width: 1, ) : Positioned( - bottom: 108.sp, + bottom: 128.sp, child: Container( margin: EdgeInsets.only(top: 24.0.sp), child: Row( @@ -161,35 +163,41 @@ joiinCircileTipWdiget(String cicleId, String pirce, String oldPrice, ), ), Positioned( - bottom: 18.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (Platform.isIOS) { - IOSPayment.instance.iosPay(iosItem, cicleId, 1); - } else { - unlockingPayment(cicleId, myCallback); + bottom: 8.sp, + child: Column( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (Platform.isIOS) { + IOSPayment.instance.iosPay(iosItem, cicleId, 1); + } else { + unlockingPayment(cicleId, myCallback); - } - }, - child: Container( - width: 168.sp, - height: 42.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [Color(0xff0AFCFF), Color(0xffD739EA)])), - child: Text( - '立即解锁', - style: TextStyle(color: Colors.white, fontSize: 16.sp), + } + }, + child: Container( + width: 168.sp, + height: 42.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: const LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [Color(0xff0AFCFF), Color(0xffD739EA)])), + child: Text( + '立即解锁', + style: TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), ), - ), + SizedBox(height: 10.sp,), + Text('一次解锁 · 永久有效',style: TextStyle(color: AppColor.mainColor,fontSize: 15.sp),) + ], )), Positioned( - bottom: 72.sp, + bottom: 90.sp, child: Row( children: [ Text( diff --git a/circle_app/lib/common/Widgets/today_people_dialog.dart b/circle_app/lib/common/Widgets/today_people_dialog.dart index 647e7c7..723ee71 100644 --- a/circle_app/lib/common/Widgets/today_people_dialog.dart +++ b/circle_app/lib/common/Widgets/today_people_dialog.dart @@ -5,9 +5,11 @@ import 'package:get/get.dart'; import 'package:gradient_borders/gradient_borders.dart'; import '../../app/circle/widgets/discover.dart'; +import '../../app/userinfo/logic.dart'; import '../../network/api.dart'; import '../../network/dio_manager.dart'; import '../../router/app_routers.dart'; +import '../../util/SharedPreferencesHelper.dart'; import '../../util/util.dart'; import '../colors/app_color.dart'; import 'dart:math' as math; @@ -26,20 +28,40 @@ class _TodayPeopleDialogState extends State { List chatImIdList = []; bool isLoad = true; - + List imgList = []; @override void initState() { // TODO: implement initState super.initState(); + fetchMyAlbum(Api.getMyAlbum); + // loadRecommendCircleFriendData(); + } + + + Future fetchMyAlbum(String url) async { + var myAlbumData = await DioManager.instance.get(url: url); + var myAlbumBean = BaseResponse.fromJson( + myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); + + if (myAlbumBean.isSuccess()) { + imgList.addAll(myAlbumBean.data.lists); + } loadRecommendCircleFriendData(); } + + + void loadRecommendCircleFriendData() async { var data = await DioManager.instance.get( url: Api.chatRecommendFriend, ); if (data['code'] == 200) { + SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); + if (await sp.isShowMatch() && imgList.isEmpty) { + showOKToast('上传真实头像和形象照后更容易匹配到想认识的人哦~'); + } isLoad = false; List dataList = data['data']; if (dataList.isNotEmpty) { @@ -47,6 +69,8 @@ class _TodayPeopleDialogState extends State { if (mounted) { setState(() {}); } + } else { + Get.back(); } } else { if (widget.isShow) { diff --git a/circle_app/lib/common/const.dart b/circle_app/lib/common/const.dart index 3a06efd..7957589 100644 --- a/circle_app/lib/common/const.dart +++ b/circle_app/lib/common/const.dart @@ -19,6 +19,72 @@ const bgAssetImage = DecorationImage( const bgBoxDecoration = BoxDecoration(image: bgAssetImage); +userWxStatusWidget(bool isUnclock,String wx,String userId,int type,String avatarUrl,Function callBack,{bool isSelf = false}) { + double textWidth = boundingTextSize(Get.context!, wx, TextStyle(color: Colors.white, fontSize: 12.sp)).width; + return GestureDetector( + onTap: () async { + if (!isUnclock) { + + var result = await DioManager().post(url: Api.unlockStatus,params: {'targetUserId':userId}); + if (result['code'] == 200) { + int price = result['data']['unlockPrice']; + int residueUnlockNum = result['data']['residueUnlockNum']; + if (price > 0 && (residueUnlockNum == -1 || residueUnlockNum > 0)) { + Get.bottomSheet(UnlockWxTip(userId, avatarUrl,false),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { + callBack(); + }}); + } else if (price > 0) { + Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { + callBack(); + }}); + } else { + var result = await DioManager().post(url: Api.unlockWx,params: {'targetUserId':userId}); + if (result['code'] == 200) { + showOKToast('已成功解锁TA的联系方式,快去和TA私聊呗~'); + callBack(); + } else { + Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { + callBack(); + }}); + } + } + } + } else { + if (!isSelf) { + // Clipboard.setData(ClipboardData(text: wx)); + // showToast('联系方式复制成功'); + } else { + showAddWxPicker(wx.isNotEmpty).then((value) { + if (value != null) { + callBack(); + } + }); + } + + } + + }, + child: Container( + height: 26.sp, + width: (isUnclock ? 32.sp : 43.sp) + textWidth, + padding: EdgeInsets.only(left: 5.sp,right: 5.sp), + decoration: BoxDecoration( + color: Color(0x66000000), + borderRadius: BorderRadius.circular(4.sp) + ), + child: Row( + children: [ + Image.asset(getMineImage(type == 1 ? 'phone_icon' : type == 3 ? 'qq' : 'wx'),width: 14.sp,), + SizedBox(width: 2.sp,), + Text(wx,style: TextStyle(color: Colors.white,fontSize: 12.sp),), + if (!isUnclock) + Image.asset(getDisCoverImage('unclock_icon'),width: 16.sp,) + ], + ), + ), + ); +} + wxStatusWidget(bool isUnclock,String wx,String userId,int type,String avatarUrl,Function callBack,{bool isSelf = false}) { double textWidth = boundingTextSize(Get.context!, wx, TextStyle(color: Colors.white, fontSize: 14.sp)).width; return GestureDetector( diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index 495a3c1..60a228b 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -371,6 +371,10 @@ class _MyAppState extends State with WidgetsBindingObserver { duration: const Duration(seconds: 2), child: GetMaterialApp( title: '微乐园', + theme: ThemeData( + splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 + highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 + ), initialBinding: SplashBinding(), getPages: AppPages.routes, @@ -379,7 +383,7 @@ class _MyAppState extends State with WidgetsBindingObserver { GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, - + RefreshLocalizations.delegate, /// iOS一定要设置,不然报错 ], locale: const Locale('zh', 'CN'), diff --git a/circle_app/lib/network/dio_manager.dart b/circle_app/lib/network/dio_manager.dart index 8138029..e74ecd5 100644 --- a/circle_app/lib/network/dio_manager.dart +++ b/circle_app/lib/network/dio_manager.dart @@ -42,8 +42,8 @@ class DioManager { _dio ??= Dio(BaseOptions( // baseUrl2 baseUrl: - Api.baseUrl2, - // Api.baseUrl, + // Api.baseUrl2, + Api.baseUrl, // type == 1 ? Api.baseUrl2 : Api.baseUrl1, // 连接服务器超时时间,单位是毫秒 diff --git a/circle_app/lib/util/SharedPreferencesHelper.dart b/circle_app/lib/util/SharedPreferencesHelper.dart index c72b8f9..adb3e13 100644 --- a/circle_app/lib/util/SharedPreferencesHelper.dart +++ b/circle_app/lib/util/SharedPreferencesHelper.dart @@ -21,6 +21,8 @@ class SharedPreferencesHelper { static const msgTip = 'msgTip'; + static const FirstMatch = 'FirstMatch'; + static SharedPreferencesHelper? _instance; static SharedPreferences? _preferences; @@ -81,6 +83,27 @@ class SharedPreferencesHelper { } + Future isShowMatch() async { + String time = await preferences!.getString(FirstMatch) ?? ''; + if (time.isNotEmpty) { + DateTime dateTime = DateTime.parse(time); + bool isShow = !isSameDay(dateTime,DateTime.now()); + if (isShow) { + preferences!.setString(FirstMatch, DateTime.now().toString()); + } + return isShow; + } else { + preferences!.setString(FirstMatch, DateTime.now().toString()); + } + return true; + } + + bool isSameDay(DateTime time1, DateTime time2) { + return time1.year == time2.year && + time1.month == time2.month && + time1.day == time2.day; + } + bool? getBool(String key) { final prefs = preferences; return prefs?.getBool(key); diff --git a/circle_app/lib/util/paymentUtil.dart b/circle_app/lib/util/paymentUtil.dart index e3f21f7..14fcc35 100644 --- a/circle_app/lib/util/paymentUtil.dart +++ b/circle_app/lib/util/paymentUtil.dart @@ -74,7 +74,7 @@ class IOSPayment { List purchaseDetailsList) async { for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { if (purchaseDetails.status == PurchaseStatus.pending) { - SmartDialog.showLoading(msg: '正在处理'); + SmartDialog.showLoading(msg: '请稍等片刻'); } else { if (purchaseDetails.status == PurchaseStatus.error) { showOKToast('支付发生错误'); diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart index e3fd526..f446a11 100644 --- a/circle_app/lib/util/util.dart +++ b/circle_app/lib/util/util.dart @@ -35,6 +35,7 @@ import '../app/home/logic.dart'; import '../app/select_circle/logic.dart'; import '../common/Widgets/open_vip_tip/view.dart'; import '../common/Widgets/wx_edit_dialog.dart'; +import '../common/colors/app_color.dart'; import '../network/dio_manager.dart'; import 'SharedPreferencesHelper.dart'; @@ -108,7 +109,7 @@ loaddingWidget(bool isMore,{String tip = '--到底了--'}) { ); } -noResultWidget({String tip = '正在等待被填充~'}) { +noResultWidget({String tip = '正在等待被填充~',Function? callBack, String action = '重新加载'}) { return Container( width: Get.width, child: Column( @@ -121,10 +122,31 @@ noResultWidget({String tip = '正在等待被填充~'}) { SizedBox( height: 8.sp, ), + if (callBack == null || tip.isNotEmpty) Text( tip, style: TextStyle(color: Color(0xffdbdbdb), fontSize: 15.sp), ), + if (callBack != null) + GestureDetector( + onTap: () { + callBack(); + }, + child: Container( + margin: EdgeInsets.only(top: 10.sp), + height: 42.sp, + width: 160.sp, + alignment: Alignment.center, + // padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.sp), + gradient: AppColor.mainVerLinearGradient), + child: Text( + action, + style: TextStyle(color: Colors.white, fontSize: 14.sp), + ), + ), + ) ], ), ); diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index d549189..ac73e4b 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: app_settings - sha256: e6a34735d4ddb24ca9c5fd7e965ec65c8b611cbd3a329152c294f9e9f4bacb33 + sha256: "2ec421f375d747916c4c0193933567074ea60c4f01c4a68642f07fef1002524e" url: "https://pub.dev" source: hosted - version: "4.3.1" + version: "4.0.4" archive: dependency: transitive description: @@ -630,14 +630,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.3" - flutter_install_app: - dependency: "direct main" - description: - name: flutter_install_app - sha256: "9b117006d17c900e671c26bcbc9b15c7b8efd15d6f9b4442ad5d576de20fab53" - url: "https://pub.dev" - source: hosted - version: "1.3.0" flutter_intl: dependency: "direct main" description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 3da8b9a..ba071ee 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -90,7 +90,7 @@ dependencies: fluwx: ^3.8.1+1 event_bus: ^2.0.0 #安装apk - flutter_install_app: 1.3.0 +# flutter_install_app: 1.3.0 #闪屏页 flutter_native_splash: 2.2.16 #腾讯离线推送 @@ -112,7 +112,7 @@ dependencies: #边框渐变 gradient_borders: ^1.0.0 #系统设置 安卓4.3.1 苹果4.0.4 - app_settings: 4.3.1 + app_settings: 4.0.4 #百度定位插件 flutter_bmflocation: ^3.6.0