From ad1cecc56db4dbbc88a0c822fb9e0a4767aa4d11 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Sat, 24 May 2025 14:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circle_app/android/app/build.gradle | 4 +- .../lib/circle_app/call_out_detail/view.dart | 8 +- ..._uikit_chat_history_message_list_item.dart | 4 +- circle_app/lib/circle_app/chat/view.dart | 6 +- .../lib/circle_app/circie_row/logic.dart | 3 + .../lib/circle_app/circie_row/view.dart | 30 ++ circle_app/lib/circle_app/circle/state.dart | 4 +- .../circle/widgets/info_list_view.dart | 194 +++++++------ .../circle_app/circle/widgets/like_view.dart | 8 +- .../circle/widgets/play_video_view.dart | 2 +- .../circle/widgets/video_play_widget.dart | 2 +- .../circle_list/widgets/all_circle_item.dart | 8 +- .../circle_list/widgets/more_video_item.dart | 5 +- .../widgets/right_circle_iten.dart | 273 +++++++++--------- circle_app/lib/circle_app/home/logic.dart | 5 +- circle_app/lib/circle_app/invite/share.dart | 5 +- circle_app/lib/circle_app/likelist/view.dart | 2 +- .../lib/circle_app/login/login/logic.dart | 6 +- .../lib/circle_app/minefragment/logic.dart | 2 +- circle_app/lib/circle_app/msg/logic.dart | 1 + circle_app/lib/circle_app/swiper/view.dart | 2 +- circle_app/lib/circle_app/userinfo/logic.dart | 6 +- .../lib/commons/widgets/circle_share.dart | 129 ++++++--- .../lib/commons/widgets/sign_in_dialog.dart | 5 +- circle_app/lib/commons/widgets/text_more.dart | 11 +- .../lib/commons/widgets/user_share.dart | 9 +- .../commons/widgets/video_share_dialog.dart | 9 +- circle_app/pubspec.lock | 2 +- circle_app/pubspec.yaml | 1 + 29 files changed, 422 insertions(+), 324 deletions(-) diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index 374cd03..af1bd08 100644 --- a/circle_app/android/app/build.gradle +++ b/circle_app/android/app/build.gradle @@ -71,8 +71,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion - versionCode 111 - versionName "2.6.1" + versionCode 115 + versionName "2.6.5" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/lib/circle_app/call_out_detail/view.dart b/circle_app/lib/circle_app/call_out_detail/view.dart index 2ea6ed6..b011345 100644 --- a/circle_app/lib/circle_app/call_out_detail/view.dart +++ b/circle_app/lib/circle_app/call_out_detail/view.dart @@ -451,7 +451,7 @@ class _Call_out_detailPageState extends State { Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -479,7 +479,7 @@ class _Call_out_detailPageState extends State { )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -991,7 +991,7 @@ class _Call_out_detailPageState extends State { Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -1019,7 +1019,7 @@ class _Call_out_detailPageState extends State { )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), diff --git a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart index 0e46769..7de2f8a 100644 --- a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart +++ b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart @@ -1309,7 +1309,7 @@ class _TIMUIKItHistoryMessageListItemState )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -1714,7 +1714,7 @@ class _TIMUIKItHistoryMessageListItemState )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), diff --git a/circle_app/lib/circle_app/chat/view.dart b/circle_app/lib/circle_app/chat/view.dart index 052d504..8d71fbb 100644 --- a/circle_app/lib/circle_app/chat/view.dart +++ b/circle_app/lib/circle_app/chat/view.dart @@ -266,18 +266,18 @@ class _ChatPageState extends State int count = 0; int otherCount = 0; currentRecordList?.forEach((element) { - if (element?.isSelf ?? false) { + if ((element?.isSelf ?? false) && (element?.status == MessageStatus.V2TIM_MSG_STATUS_SEND_SUCC || element?.status == 1)) { count++; } else { otherCount++; } }); - // if (count > 1 && otherCount > 0) { + if (count >= 3 && otherCount >= 3) { tipSendVipIdlList.add(con.userID); Get.bottomSheet(SendVipDialog(con.userID!), isScrollControlled: true); - // } + } } } }); diff --git a/circle_app/lib/circle_app/circie_row/logic.dart b/circle_app/lib/circle_app/circie_row/logic.dart index 9133acf..4c0a186 100644 --- a/circle_app/lib/circle_app/circie_row/logic.dart +++ b/circle_app/lib/circle_app/circie_row/logic.dart @@ -16,11 +16,13 @@ class Circie_rowLogic extends GetxController { List locationDataList = []; Position? position; var isLoad = true; + int chargeFreeNum = 0; @override void onInit() { // TODO: implement onInit super.onInit(); loadCircleManagerData(); + // loadCircleInfo(); // loadCircleUserData(); } @@ -54,6 +56,7 @@ class Circie_rowLogic extends GetxController { url: Api.queryRecommendInterestUser, params: params); if (result['code'] == 200) { + chargeFreeNum = result['data']['chargeFreeNum']; List dataList = result['data']['lists']; return dataList; } diff --git a/circle_app/lib/circle_app/circie_row/view.dart b/circle_app/lib/circle_app/circie_row/view.dart index 3f3f721..dd183ee 100644 --- a/circle_app/lib/circle_app/circie_row/view.dart +++ b/circle_app/lib/circle_app/circie_row/view.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:circle_app/circle_app/circle/widgets/discover.dart'; import 'package:circle_app/utils/cache_img.dart'; import 'package:flutter/material.dart'; @@ -6,6 +8,7 @@ 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 '../../commons/Widgets/base_tip_widget.dart'; import '../../commons/Widgets/my_app_bar.dart'; import '../../commons/Widgets/tag_widget.dart'; import '../../commons/colors/app_color.dart'; @@ -376,6 +379,7 @@ class _CircleUserInfoItemState extends State with AutomaticK final RefreshController refreshController = RefreshController(); int page = 1; bool isLoad = true; + int chargeFreeNum = 0; @override void initState() { // TODO: implement initState @@ -526,6 +530,32 @@ class _CircleUserInfoItemState extends State with AutomaticK GestureDetector( onTap: () { // if (item.imId.isNotEmpty) { + + // if (index > logic.chargeFreeNum && item) { + // + // } + + if (logic.circleInfo.is_limit && logic.circleInfo.amount > 0 && logic.chargeFreeNum <= index) { + showJoinCiclePiker(logic.circleInfo.id.toString(), logic.circleInfo.amount.toString(), + logic.circleInfo.oldAmount.toString(), 2, (payResult) { + logic.circleInfo.is_limit = false; + if (Get.isRegistered()) { + var logic1 = Get.find(); + for (var element in logic1.circle.lists) { + if (element.id == logic.circleInfo.id) { + element.is_limit = false; + element.isJoin = true; + } + } + logic.circleInfo.is_limit = false; + logic1.update(); + logic.update(); + } + Get.back(); + }, logic.circleInfo.ios_item); + return; + } + pushChatPage( userInfo['id'].toString(), userInfo['imId'].toString(), diff --git a/circle_app/lib/circle_app/circle/state.dart b/circle_app/lib/circle_app/circle/state.dart index aab1c4f..93da6c4 100644 --- a/circle_app/lib/circle_app/circle/state.dart +++ b/circle_app/lib/circle_app/circle/state.dart @@ -28,10 +28,11 @@ class Lists { String? at; Map? topInteractType; int? isInteract; + int? chargeFreeNum; String? interactedTypeEmote; Lists( - {this.album, this.chat, this.content, this.id, this.isQueen, this.user,this.interactedTypeEmote}); + {this.album, this.chat, this.content, this.id, this.isQueen, this.user,this.interactedTypeEmote,this.chargeFreeNum}); Lists.fromJson(Map json) { if (json['album'] != null) { @@ -44,6 +45,7 @@ class Lists { content = json['content']; id = json['id']; at = json['at'] ?? ''; + chargeFreeNum = json['chargeFreeNum'] ?? 0; isSystem = json['isSystem']; jumpInfo = json['jumpInfo'] != null ? new JumpInfo.fromJson(json['jumpInfo']) diff --git a/circle_app/lib/circle_app/circle/widgets/info_list_view.dart b/circle_app/lib/circle_app/circle/widgets/info_list_view.dart index 7efc18f..5c7e713 100644 --- a/circle_app/lib/circle_app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/info_list_view.dart @@ -68,6 +68,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien double widgetWidth = 0.0; Map interestAgentMap = {}; HomeLogic homeLogic = Get.find(); + int chargeFreeNum = 0; @override void dispose() { // TODO: implement dispose @@ -190,6 +191,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien params: {"page": callOutPage, "page_size": "8"}); if (data["code"] == 200) { List dataList = data["data"]["lists"] ?? []; + chargeFreeNum = data['data']['chargeFreeNum'] ?? 0; if (callOutPage == 1) { if (lists.isNotEmpty) { lists.clear(); @@ -272,11 +274,11 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } } - pushUserHome(String userId) async { + pushUserHome(String userId,bool islimit) async { if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && islimit) { Get.toNamed(Routes.UserInfoPage, arguments: userId,parameters: {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new','bean':jsonEncode({'id':widget.bean.id.toString(),'amount':widget.bean.amount.toString(),'oldAmount':widget.bean.oldAmount.toString(),'iosItem':widget.bean.ios_item})}); } else { Get.toNamed(Routes.UserInfoPage, arguments: userId,parameters: {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new',}); @@ -295,7 +297,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien return; } - if (widget.bean.is_limit&&widget.bean.amount>0) { + if (widget.bean.is_limit&&widget.bean.amount>0 && lists.indexOf(bean) >= chargeFreeNum) { showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ widget.bean.is_limit = false; if (Get.isRegistered()) { @@ -1017,13 +1019,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } ///至尊喊话 - vipDynamicItem(Lists lists) { - int type = (lists.topInteractType?['type'] ?? 1) - 1; - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, + vipDynamicItem(Lists list) { + int type = (list.topInteractType?['type'] ?? 1) - 1; + Widget descText = widget.logic.openCallOutIdList.contains(list.id) ? Text( + list.content!, style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == Routes.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); + ) : HideText(text: list.content!,maxWidth: Get.currentRoute == Routes.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(list.id); setState(() { }); @@ -1033,7 +1035,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // List urlList = bean.lastJoinUsers; List widgets = []; int index = 0; - for (var element in lists.chat!.users!) { + for (var element in list.chat!.users!) { widgets.add(Positioned( left: 12.sp * index, child: circleWidget(element.avatar!,element.id.toString(), width: 24), @@ -1042,7 +1044,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } if (widgets.isNotEmpty) { widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, + left: 12.sp * list.chat!.users!.length, child: Image.asset( getCircleImage('more'), width: 24.sp, @@ -1053,17 +1055,17 @@ class InfoListViewState extends State with AutomaticKeepAliveClien double ratio = 0; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; + if (list.album != null) { + if (list.album!.isNotEmpty) { + Album info = list.album!.first; if (info.type == 1) { double picWidth = (widgetWidth - 8.sp)/3 + 45; ratio = (widgetWidth - 8.sp - 24.sp) / 3 / picWidth; - if (lists.album!.length > 3) { + if (list.album!.length > 3) { picHeight = picWidth * 2; } else { - if (lists.album!.length == 1) { + if (list.album!.length == 1) { picHeight = 250; } else { picHeight = picWidth; @@ -1078,8 +1080,8 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Widget atWidget = Container(); List atList = []; - if (lists.at!.isNotEmpty) { - List infoList = jsonDecode(lists.at!); + if (list.at!.isNotEmpty) { + List infoList = jsonDecode(list.at!); infoList.forEach((element) { atList.add(GestureDetector( onTap: () { @@ -1145,7 +1147,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), child:Text( - (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0,4) + '...' :(lists.user!.city ?? '外星'), + (list.user!.city ?? '外星').length > 4 ? (list.user!.city ?? '外星').substring(0,4) + '...' :(list.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 15.sp), ), ) @@ -1168,11 +1170,11 @@ class InfoListViewState extends State with AutomaticKeepAliveClien var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); - if(lists.user?.id!.toString() == myUserId){ + if(list.user?.id!.toString() == myUserId){ Get.toNamed(Routes.UserInfoPage); return; } - pushUserHome(lists.user!.id!.toString()); + pushUserHome(list.user!.id!.toString(),lists.indexOf(list) >= chargeFreeNum); }, child: Stack( @@ -1184,7 +1186,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), ClipOval( child: CachedImg( - imageUrl:lists.user!.avatar_thumb!, + imageUrl:list.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover, @@ -1202,7 +1204,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Row( children: [ Text( - lists.user!.nickname!, + list.user!.nickname!, style: TextStyle( color: Colors.white, fontSize: 18.sp, @@ -1211,7 +1213,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien SizedBox( width: 8.sp, ), - UserTagWidget(lists.user!.mark!), + UserTagWidget(list.user!.mark!), ], ), SizedBox( @@ -1226,13 +1228,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien EdgeInsets.only(left: 6.sp, right: 6.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(9.sp), - gradient: sexBgGradient(lists.user!.gender ?? 0,)), + gradient: sexBgGradient(list.user!.gender ?? 0,)), child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), + getAgeCOntent(list.user!.gender??0, list.user!.age??0, + list.user!.role??0, list.user!.orientation??0), // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', style: TextStyle( - color: sexBgColor(lists.user!.gender ?? 0,), + color: sexBgColor(list.user!.gender ?? 0,), fontSize: 12.sp, ), ), @@ -1258,18 +1260,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: picHeight == 200.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!,lists.id!.toString(),lists.user!.id.toString())) + child: VideoItemWidget(list.album![0].url!,list.id!.toString(),list.user!.id.toString())) : picHeight == 250 ? GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new','bean':jsonEncode({'id':widget.bean.id.toString(),'amount':widget.bean.amount.toString(),'oldAmount':widget.bean.oldAmount.toString(),'iosItem':widget.bean.ios_item})}; // return; @@ -1282,19 +1284,19 @@ class InfoListViewState extends State with AutomaticKeepAliveClien arguments: { 'imaglist': imgList, 'index': 0, - 'userId':lists.user?.id!.toString() + 'userId':list.user?.id!.toString() },parameters: params); }, child: ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: CachedImg( - imageUrl: lists.album!.first.url!, + imageUrl: list.album!.first.url!, fit: BoxFit.cover, ), ), ) : GridView.builder( - itemCount: lists.album!.length, + itemCount: list.album!.length, physics: const NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -1304,18 +1306,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien childAspectRatio: ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; + Album album = list.album![currentIndex]; return GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } Map? params; - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new','bean':jsonEncode({'id':widget.bean.id.toString(),'amount':widget.bean.amount.toString(),'oldAmount':widget.bean.oldAmount.toString(),'iosItem':widget.bean.ios_item})}; // return; @@ -1328,7 +1330,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien arguments: { 'imaglist': imgList, 'index': currentIndex, - 'userId':lists.user?.id!.toString() + 'userId':list.user?.id!.toString() },parameters: params); }, child: ClipRRect( @@ -1346,7 +1348,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien InkWell( onTap: () { Get.bottomSheet( - CallOutShareDialog('','',lists), isScrollControlled: true, + CallOutShareDialog('','',list), isScrollControlled: true, enableDrag: false ); @@ -1362,7 +1364,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 5.sp), decoration: BoxDecoration( @@ -1383,14 +1385,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien widgets.isNotEmpty ? Expanded( child: Text( - '${lists.chat!.count!}位圈友已私聊', + '${list.chat!.count!}位圈友已私聊', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -1398,7 +1400,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien GestureDetector( onTap: () { pushMsgPage( - lists, + list, widget.bean.id.toString(), ); }, @@ -1413,16 +1415,16 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), GestureDetector( onTapUp: (TapUpDetails details) { - if (lists.isInteract! > 0) { + if (list.isInteract! > 0) { showOKToast('这个喊话已经点过了哦'); return; } - _showEmojiPicker(lists,lists.id!,context, details.globalPosition); + _showEmojiPicker(list,list.id!,context, details.globalPosition); }, child: Container( - margin: EdgeInsets.only(left: 10.sp, bottom: (lists.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), + margin: EdgeInsets.only(left: 10.sp, bottom: (list.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), // height: 40.sp, alignment: Alignment.center, child: Stack( @@ -1432,15 +1434,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien height: 43.sp, ), Text( - lists.interactedTypeEmote ?? '❤', + list.interactedTypeEmote ?? '❤', style: TextStyle(color: Colors.white, fontSize: 20.sp), ), - if ((lists.topInteractType!['userCount'] ?? 0) > 0) + if ((list.topInteractType!['userCount'] ?? 0) > 0) Positioned( bottom: 0, child: Text( - '${lists.topInteractType!['userCount']}', + '${list.topInteractType!['userCount']}', style: TextStyle(color: Colors.white, fontSize: 10.sp), ), @@ -1458,13 +1460,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } ///普通图文喊话 - normalDynamicItem(Lists lists) { - int type = (lists.topInteractType?['type'] ?? 1) - 1; - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, + normalDynamicItem(Lists list) { + int type = (list.topInteractType?['type'] ?? 1) - 1; + Widget descText = widget.logic.openCallOutIdList.contains(list.id) ? Text( + list.content!, style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == Routes.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); + ) : HideText(text: list.content!,maxWidth: Get.currentRoute == Routes.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(list.id); setState(() { }); @@ -1474,16 +1476,16 @@ class InfoListViewState extends State with AutomaticKeepAliveClien double picHeight = 0.0; double ratio = 0.0; double picWidth = (widgetWidth - 8.sp )/3 + 45; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; + if (list.album != null) { + if (list.album!.isNotEmpty) { + Album info = list.album!.first; if (info.type == 1) { ratio = (widgetWidth - 8.sp - 24.sp) / 3 / picWidth; - if (lists.album!.length > 3) { + if (list.album!.length > 3) { picHeight = picWidth * 2; } else { - if (lists.album!.length == 1) { + if (list.album!.length == 1) { picHeight = 250; } else { picHeight = picWidth; @@ -1497,7 +1499,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien List widgets = []; int index = 0; - lists.chat!.users!.forEach((element) { + list.chat!.users!.forEach((element) { widgets.add(Positioned( left: 12.sp * index, child: circleWidget(element.avatar!,element.id.toString(), width: 24), @@ -1506,7 +1508,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien }); if (widgets.isNotEmpty) { widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, + left: 12.sp * list.chat!.users!.length, child: Image.asset( getCircleImage('more'), width: 24.sp, @@ -1516,8 +1518,8 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Widget atWidget = Container(); List atList = []; - if (lists.at!.isNotEmpty) { - List infoList = jsonDecode(lists.at!); + if (list.at!.isNotEmpty) { + List infoList = jsonDecode(list.at!); infoList.forEach((element) { atList.add(GestureDetector( onTap: () { @@ -1578,7 +1580,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien borderRadius: BorderRadius.only(topLeft: Radius.circular(0),bottomRight: Radius.circular(0),topRight: Radius.circular(12.sp),bottomLeft: Radius.circular(12.sp) ) ), child: Text( - (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0,4) + '...' :(lists.user!.city ?? '外星'), + (list.user!.city ?? '外星').length > 4 ? (list.user!.city ?? '外星').substring(0,4) + '...' :(list.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 15.sp), ), ) @@ -1602,11 +1604,11 @@ class InfoListViewState extends State with AutomaticKeepAliveClien onTap: ()async { var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); - if(lists.user?.id!.toString() == myUserId){ + if(list.user?.id!.toString() == myUserId){ Get.toNamed(Routes.UserInfoPage); return; } - pushUserHome(lists.user!.id!.toString()); + pushUserHome(list.user!.id!.toString(),lists.indexOf(list) >= chargeFreeNum); }, child: Stack( alignment: Alignment.center, @@ -1617,7 +1619,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), ClipOval( child: CachedImg( - imageUrl:lists.user!.avatar_thumb!, + imageUrl:list.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover, @@ -1637,7 +1639,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Row( children: [ Text( - lists.user!.nickname!, + list.user!.nickname!, style: TextStyle( color: Colors.white, fontSize: 18.sp, @@ -1646,7 +1648,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien SizedBox( width: 8.sp, ), - UserTagWidget(lists.user!.mark!), + UserTagWidget(list.user!.mark!), ], ), SizedBox( @@ -1662,12 +1664,12 @@ class InfoListViewState extends State with AutomaticKeepAliveClien decoration: BoxDecoration( borderRadius: BorderRadius.circular(9.sp), - gradient: sexBgGradient(lists.user!.gender ?? 0,)), + gradient: sexBgGradient(list.user!.gender ?? 0,)), child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), + getAgeCOntent(list.user!.gender??0, list.user!.age??0, + list.user!.role??0, list.user!.orientation??0), style: TextStyle( - color: sexBgColor(lists.user!.gender ?? 0,), + color: sexBgColor(list.user!.gender ?? 0,), fontSize: 12.sp, ), ), @@ -1693,18 +1695,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: picHeight == 200.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!,lists.id!.toString(),lists.user!.id.toString())) + child: VideoItemWidget(list.album![0].url!,list.id!.toString(),list.user!.id.toString())) : picHeight == 250 ? GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new','bean':jsonEncode({'id':widget.bean.id.toString(),'amount':widget.bean.amount.toString(),'oldAmount':widget.bean.oldAmount.toString(),'iosItem':widget.bean.ios_item})}; // return; @@ -1717,19 +1719,19 @@ class InfoListViewState extends State with AutomaticKeepAliveClien arguments: { 'imaglist': imgList, 'index': 0, - 'userId':lists.user?.id!.toString() + 'userId':list.user?.id!.toString() },parameters: params); }, child: ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: CachedImg( - imageUrl: lists.album!.first.url!, + imageUrl: list.album!.first.url!, fit: BoxFit.cover, ), ), ) : GridView.builder( - itemCount: lists.album!.length, + itemCount: list.album!.length, physics: const NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -1739,18 +1741,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien childAspectRatio:ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; + Album album = list.album![currentIndex]; return GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } Map? params; - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = {'source':widget.index == 0 ? 'callout_list_hot' : 'callout_list_new','bean':jsonEncode({'id':widget.bean.id.toString(),'amount':widget.bean.amount.toString(),'oldAmount':widget.bean.oldAmount.toString(),'iosItem':widget.bean.ios_item})}; // return; @@ -1763,7 +1765,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien arguments: { 'imaglist': imgList, 'index': currentIndex, - 'userId':lists.user?.id!.toString() + 'userId':list.user?.id!.toString() },parameters: params); }, child: Container( @@ -1784,7 +1786,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien InkWell( onTap: () { Get.bottomSheet( - CallOutShareDialog('','',lists), isScrollControlled: true, + CallOutShareDialog('','',list), isScrollControlled: true, enableDrag: false ); @@ -1800,7 +1802,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 5.sp), decoration: BoxDecoration( @@ -1821,14 +1823,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien widgets.isNotEmpty ? Expanded( child: Text( - '${lists.chat!.count!}位圈友已私聊', + '${list.chat!.count!}位圈友已私聊', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -1836,7 +1838,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien GestureDetector( onTap: () { pushMsgPage( - lists, + list, widget.bean.id.toString(), ); }, @@ -1851,15 +1853,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), GestureDetector( onTapUp: (TapUpDetails details) { - if (lists.isInteract! > 0) { + if (list.isInteract! > 0) { showOKToast('这个喊话已经点过了哦'); return; } - _showEmojiPicker(lists,lists.id!,context, details.globalPosition); + _showEmojiPicker(list,list.id!,context, details.globalPosition); }, child: Container( - margin: EdgeInsets.only(left: 10.sp, bottom: (lists.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), + margin: EdgeInsets.only(left: 10.sp, bottom: (list.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), // height: 40.sp, alignment: Alignment.center, child: Stack( @@ -1869,15 +1871,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien height: 43.sp, ), Text( - lists.interactedTypeEmote ?? '❤', + list.interactedTypeEmote ?? '❤', style: TextStyle(color: Colors.white, fontSize: 20.sp), ), - if ((lists.topInteractType!['userCount'] ?? 0) > 0) + if ((list.topInteractType!['userCount'] ?? 0) > 0) Positioned( bottom: 0, child: Text( - '${lists.topInteractType!['userCount']}', + '${list.topInteractType!['userCount']}', style: TextStyle(color: Colors.white, fontSize: 10.sp), ), @@ -2163,7 +2165,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien circleWidget(String url, String userId,{double width = 24}) { return GestureDetector( onTap: () async { - pushUserHome(userId); + pushUserHome(userId,false); }, child: Stack( alignment: Alignment.center, diff --git a/circle_app/lib/circle_app/circle/widgets/like_view.dart b/circle_app/lib/circle_app/circle/widgets/like_view.dart index 8ba615d..00ca414 100644 --- a/circle_app/lib/circle_app/circle/widgets/like_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/like_view.dart @@ -1159,7 +1159,7 @@ class _LikeViewState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 0.sp), decoration: BoxDecoration( @@ -1187,7 +1187,7 @@ class _LikeViewState extends State )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -1561,7 +1561,7 @@ class _LikeViewState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 0.sp), decoration: BoxDecoration( @@ -1589,7 +1589,7 @@ class _LikeViewState extends State )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), diff --git a/circle_app/lib/circle_app/circle/widgets/play_video_view.dart b/circle_app/lib/circle_app/circle/widgets/play_video_view.dart index 9024570..57d11bf 100644 --- a/circle_app/lib/circle_app/circle/widgets/play_video_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/play_video_view.dart @@ -109,7 +109,7 @@ class _PlayVideoViewState extends State }); userList = [list]; - + sendReadRequest(); WidgetsBinding.instance.addObserver(this); _pageController.addListener(_pageListener); diff --git a/circle_app/lib/circle_app/circle/widgets/video_play_widget.dart b/circle_app/lib/circle_app/circle/widgets/video_play_widget.dart index 6909aac..7d933b6 100644 --- a/circle_app/lib/circle_app/circle/widgets/video_play_widget.dart +++ b/circle_app/lib/circle_app/circle/widgets/video_play_widget.dart @@ -389,7 +389,7 @@ class _VideoPlayerWidgetState extends State with RouteAware { )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的圈友吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 14.sp), diff --git a/circle_app/lib/circle_app/circle_list/widgets/all_circle_item.dart b/circle_app/lib/circle_app/circle_list/widgets/all_circle_item.dart index fe2bfdc..a4b5887 100644 --- a/circle_app/lib/circle_app/circle_list/widgets/all_circle_item.dart +++ b/circle_app/lib/circle_app/circle_list/widgets/all_circle_item.dart @@ -1112,7 +1112,7 @@ class _AllCircleItemState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -1140,7 +1140,7 @@ class _AllCircleItemState extends State )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -1609,7 +1609,7 @@ class _AllCircleItemState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -1637,7 +1637,7 @@ class _AllCircleItemState extends State )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), diff --git a/circle_app/lib/circle_app/circle_list/widgets/more_video_item.dart b/circle_app/lib/circle_app/circle_list/widgets/more_video_item.dart index 23e1c96..18c280a 100644 --- a/circle_app/lib/circle_app/circle_list/widgets/more_video_item.dart +++ b/circle_app/lib/circle_app/circle_list/widgets/more_video_item.dart @@ -37,6 +37,8 @@ class _MoreVideoItemState extends State { Get.to( PlayVideoView(bean.album!.first.url!, bean.id!.toString(), bean.user!.id!.toString(),bean.chat!.toJson(),bean.user!.imId!,bean.content!,bean.user! .avatar!,bean.user!.nickname!,bean.interest!.title!)); + loadRecommandVideoData(); + } }, child: Container( @@ -75,7 +77,8 @@ class _MoreVideoItemState extends State { void loadRecommandVideoData() async { var data = await DioManager.getInstance() - .get(url: Api.queryNextVideoStorysByType, params: {'pageIndex':1,'curCalloutId':0}); + + .get(url: Api.queryNextVideoStorysByType, params: {'pageIndex':1,'curCalloutId':recommandVideoList.isNotEmpty ? recommandVideoList.first.id! : 0}); if (data['code'] == 200) { recommandVideoList.clear(); List dataList = data['data']['lists']; diff --git a/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart b/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart index f85e32d..b5dfaed 100644 --- a/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart +++ b/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart @@ -1522,7 +1522,7 @@ class _RightCircleListWidgetState extends State super.dispose(); } - + int chargeFreeNum = 0; StreamSubscription? callRefreshCicle = null; StreamSubscription? cicleInfoRefresh = null; StreamSubscription? scroToTop = null; @@ -1634,6 +1634,8 @@ class _RightCircleListWidgetState extends State refreshController.refreshCompleted(); if (data["code"] == 200) { List dataList = data["data"]["lists"] ?? []; + // "total" -> 0"chargeType" -> 1 + chargeFreeNum = data['data']['chargeFreeNum'] ?? 0; if (callOutPage == 1) { if (lists.isNotEmpty) { lists.clear(); @@ -1651,6 +1653,7 @@ class _RightCircleListWidgetState extends State // 只有当 ID 不存在时才添加 if (!existingIds.contains(newItem.id)) { + lists.add(newItem); existingIds.add(newItem.id!); // 记录新的 ID } @@ -1715,27 +1718,35 @@ class _RightCircleListWidgetState extends State }); } + bool checkOpen(Lists bean, String cicleId) { + + if (widget.bean.is_limit && widget.bean.amount > 0 && (lists.indexOf(bean) >= chargeFreeNum)) { + showJoinCiclePiker(cicleId, widget.bean.amount.toString(), + widget.bean.oldAmount.toString(), 2, (payResult) { + widget.bean.is_limit = false; + if (Get.isRegistered()) { + var logic = Get.find(); + for (var element in logic.circle.lists) { + if (element.id == widget.bean.id) { + element.is_limit = false; + element.isJoin = true; + } + } + logic.update(); + } + Get.back(); + }, widget.bean.ios_item); + return false; + } + return true; +} + void pushMsgPage(Lists bean, String cicleId) async { if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } - if (widget.bean.is_limit && widget.bean.amount > 0) { - showJoinCiclePiker(cicleId, widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), 2, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); + if (!checkOpen(bean,cicleId)) { return; } @@ -1800,7 +1811,7 @@ class _RightCircleListWidgetState extends State child: circleWidget( element.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), + element.id.toString(),widget.bean), )); i++; }); @@ -1882,15 +1893,15 @@ class _RightCircleListWidgetState extends State } ///至尊喊话 - vipDynamicItem(Lists lists) { - int type = (lists.topInteractType?['type'] ?? 1) - 1; - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) + vipDynamicItem(Lists list) { + int type = (list.topInteractType?['type'] ?? 1) - 1; + Widget descText = widget.logic.openCallOutIdList.contains(list.id) ? Text( - lists.content!, + list.content!, style: TextStyle(color: Colors.white, fontSize: 15.sp), ) : HideText( - text: lists.content!, + text: list.content!, maxWidth: Get.currentRoute == Routes.Home ? Get.width - 90.sp : Get.width - 20.sp, @@ -1900,7 +1911,7 @@ class _RightCircleListWidgetState extends State additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 15.sp), onTap: () { - widget.logic.openCallOutIdList.add(lists.id); + widget.logic.openCallOutIdList.add(list.id); setState(() {}); }, ); @@ -1908,16 +1919,16 @@ class _RightCircleListWidgetState extends State // List urlList = bean.lastJoinUsers; List widgets = []; int index = 0; - for (var element in lists.chat!.users!) { + for (var element in list.chat!.users!) { widgets.add(Positioned( left: 12.sp * index, - child: circleWidget(element.avatar!, element.id.toString(), width: 24), + child: circleWidget(element.avatar!, element.id.toString(),list, width: 24), )); index++; } if (widgets.isNotEmpty) { widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, + left: 12.sp * list.chat!.users!.length, child: Image.asset( getCircleImage('more'), width: 24.sp, @@ -1926,9 +1937,9 @@ class _RightCircleListWidgetState extends State double picHeight = 0.0; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; + if (list.album != null) { + if (list.album!.isNotEmpty) { + Album info = list.album!.first; if (info.type == 1) { double picWidth = (Get.width - @@ -1937,10 +1948,10 @@ class _RightCircleListWidgetState extends State : 60.sp)) / 3 + 45; - if (lists.album!.length > 3) { + if (list.album!.length > 3) { picHeight = picWidth * 2; } else { - if (lists.album!.length == 1) { + if (list.album!.length == 1) { picHeight = 250; } else { picHeight = picWidth; @@ -1955,8 +1966,8 @@ class _RightCircleListWidgetState extends State Widget atWidget = Container(); List atList = []; - if (lists.at!.isNotEmpty) { - List infoList = jsonDecode(lists.at!); + if (list.at!.isNotEmpty) { + List infoList = jsonDecode(list.at!); infoList.forEach((element) { atList.add(GestureDetector( onTap: () { @@ -2022,9 +2033,9 @@ class _RightCircleListWidgetState extends State topRight: Radius.circular(12.sp), bottomLeft: Radius.circular(12.sp))), child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + '...' - : (lists.user!.city ?? '外星'), + (list.user!.city ?? '外星').length > 4 + ? (list.user!.city ?? '外星').substring(0, 4) + '...' + : (list.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 14.sp), ), ) @@ -2049,11 +2060,11 @@ class _RightCircleListWidgetState extends State await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); - if (lists.user?.id!.toString() == myUserId) { + if (list.user?.id!.toString() == myUserId) { Get.toNamed(Routes.UserInfoPage); return; } - pushUserHome(lists.user!.id!.toString()); + pushUserHome(list.user!.id!.toString(),list); }, child: Stack( alignment: Alignment.center, @@ -2095,13 +2106,13 @@ class _RightCircleListWidgetState extends State child: ClipRRect( borderRadius: BorderRadius.circular(30.sp), child: Image.network( - lists.user!.avatar_thumb!, + list.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover), ), ), - if ((lists.user!.onlineFlag ?? '').isNotEmpty) + if ((list.user!.onlineFlag ?? '').isNotEmpty) Positioned( bottom: 0, child: Container( @@ -2120,7 +2131,7 @@ class _RightCircleListWidgetState extends State ), alignment: Alignment.center, child: Text( - lists.user!.onlineFlag ?? '', + list.user!.onlineFlag ?? '', style: TextStyle( color: const Color.fromRGBO( 247, 250, 250, 1.0), @@ -2139,7 +2150,7 @@ class _RightCircleListWidgetState extends State Row( children: [ Text( - lists.user!.nickname!, + list.user!.nickname!, style: TextStyle( color: Colors.white, fontSize: 18.sp, @@ -2148,7 +2159,7 @@ class _RightCircleListWidgetState extends State SizedBox( width: 8.sp, ), - UserTagWidget(lists.user!.mark!), + UserTagWidget(list.user!.mark!), ], ), SizedBox( @@ -2164,18 +2175,18 @@ class _RightCircleListWidgetState extends State decoration: BoxDecoration( borderRadius: BorderRadius.circular(9.sp), gradient: sexBgGradient( - lists.user!.gender ?? 0, + list.user!.gender ?? 0, )), child: Text( getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), + list.user!.gender ?? 0, + list.user!.age ?? 0, + list.user!.role ?? 0, + list.user!.orientation ?? 0), // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', style: TextStyle( color: sexBgColor( - lists.user!.gender ?? 0, + list.user!.gender ?? 0, ), fontSize: 12.sp, ), @@ -2203,14 +2214,14 @@ class _RightCircleListWidgetState extends State ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget( - lists.album![0].url!, - lists.id!.toString(), - lists.user!.id.toString())) + list.album![0].url!, + list.id!.toString(), + list.user!.id.toString())) : picHeight == 250 ? GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; @@ -2219,7 +2230,7 @@ class _RightCircleListWidgetState extends State await refreshCircleData(); } if (widget.bean.is_limit && - widget.bean.amount > 0) { + widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = { 'source': widget.index == 0 ? 'callout_list_hot' @@ -2246,21 +2257,21 @@ class _RightCircleListWidgetState extends State arguments: { 'imaglist': imgList, 'index': 0, - 'userId': lists.user?.id!.toString() + 'userId': list.user?.id!.toString() }, parameters: params); }, child: ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: CachedImg( - imageUrl: lists.album!.first.url!, + imageUrl: list.album!.first.url!, fit: BoxFit.cover, ), ), ) : GridView.builder( controller: GridScrollController, - itemCount: lists.album!.length, + itemCount: list.album!.length, scrollDirection: Axis.vertical, physics: const NeverScrollableScrollPhysics(), gridDelegate: @@ -2271,7 +2282,7 @@ class _RightCircleListWidgetState extends State childAspectRatio: 0.6 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; + Album album = list.album![currentIndex]; return GestureDetector( onTap: () async { if (widget.bean.is_limit && @@ -2280,12 +2291,12 @@ class _RightCircleListWidgetState extends State } var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; if (widget.bean.is_limit && - widget.bean.amount > 0) { + widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = { 'source': widget.index == 0 ? 'callout_list_hot' @@ -2313,7 +2324,7 @@ class _RightCircleListWidgetState extends State arguments: { 'imaglist': imgList, 'index': currentIndex, - 'userId': lists.user?.id!.toString() + 'userId': list.user?.id!.toString() }, parameters: params); }, @@ -2333,7 +2344,7 @@ class _RightCircleListWidgetState extends State InkWell( onTap: () { Get.bottomSheet( - CallOutShareDialog('','',lists), isScrollControlled: true, + CallOutShareDialog('','',list), isScrollControlled: true, enableDrag: false ); @@ -2349,7 +2360,7 @@ class _RightCircleListWidgetState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 5.sp), decoration: BoxDecoration( @@ -2370,14 +2381,14 @@ class _RightCircleListWidgetState extends State widgets.isNotEmpty ? Expanded( child: Text( - '${lists.chat!.count!}位圈友已私聊', + '${list.chat!.count!}位圈友已私聊', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 14.sp), )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 14.sp), @@ -2385,7 +2396,7 @@ class _RightCircleListWidgetState extends State GestureDetector( onTap: () { pushMsgPage( - lists, + list, widget.bean.id.toString(), ); }, @@ -2400,19 +2411,19 @@ class _RightCircleListWidgetState extends State ), GestureDetector( onTapUp: (TapUpDetails details) { - if (lists.isInteract! > 0) { + if (list.isInteract! > 0) { showOKToast('这个喊话已经点过了哦'); return; } _showEmojiPicker( - lists, lists.id!, context, details.globalPosition); + list, list.id!, context, details.globalPosition); }, child: Container( margin: EdgeInsets.only( left: 10.sp, bottom: - (lists.topInteractType!['userCount'] ?? 0) > 0 + (list.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), // height: 40.sp, @@ -2424,15 +2435,15 @@ class _RightCircleListWidgetState extends State height: 43.sp, ), Text( - lists.interactedTypeEmote ?? '❤️', + list.interactedTypeEmote ?? '❤️', style: TextStyle( color: Colors.white, fontSize: 20.sp), ), - if ((lists.topInteractType!['userCount'] ?? 0) > 0) + if ((list.topInteractType!['userCount'] ?? 0) > 0) Positioned( bottom: 0, child: Text( - '${lists.topInteractType!['userCount']}', + '${list.topInteractType!['userCount']}', style: TextStyle( color: Colors.white, fontSize: 10.sp), ), @@ -2450,16 +2461,16 @@ class _RightCircleListWidgetState extends State } ///普通图文喊话 - normalDynamicItem(Lists lists) { - int type = (lists.topInteractType?['type'] ?? 1) - 1; + normalDynamicItem(Lists list) { + int type = (list.topInteractType?['type'] ?? 1) - 1; - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) + Widget descText = widget.logic.openCallOutIdList.contains(list.id) ? Text( - lists.content!, + list.content!, style: TextStyle(color: Colors.white, fontSize: 15.sp), ) : HideText( - text: lists.content!, + text: list.content!, maxWidth: Get.currentRoute == Routes.Home ? Get.width - 90.sp : Get.width - 20.sp, @@ -2469,7 +2480,7 @@ class _RightCircleListWidgetState extends State additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 15.sp), onTap: () { - widget.logic.openCallOutIdList.add(lists.id); + widget.logic.openCallOutIdList.add(list.id); setState(() {}); }, ); @@ -2480,18 +2491,18 @@ class _RightCircleListWidgetState extends State (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp)) / 3 + 45; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; + if (list.album != null) { + if (list.album!.isNotEmpty) { + Album info = list.album!.first; ratio = ((Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp)) / 3) / picWidth; if (info.type == 1) { - if (lists.album!.length > 3) { + if (list.album!.length > 3) { picHeight = picWidth * 2; } else { - if (lists.album!.length == 1) { + if (list.album!.length == 1) { picHeight = 250; } else { picHeight = picWidth; @@ -2505,16 +2516,16 @@ class _RightCircleListWidgetState extends State List widgets = []; int index = 0; - lists.chat!.users!.forEach((element) { + list.chat!.users!.forEach((element) { widgets.add(Positioned( left: 12.sp * index, - child: circleWidget(element.avatar!, element.id.toString(), width: 24), + child: circleWidget(element.avatar!, element.id.toString(),list, width: 24), )); index++; }); if (widgets.isNotEmpty) { widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, + left: 12.sp * list.chat!.users!.length, child: Image.asset( getCircleImage('more'), width: 24.sp, @@ -2524,8 +2535,8 @@ class _RightCircleListWidgetState extends State Widget atWidget = Container(); List atList = []; - if (lists.at!.isNotEmpty) { - List infoList = jsonDecode(lists.at!); + if (list.at!.isNotEmpty) { + List infoList = jsonDecode(list.at!); infoList.forEach((element) { atList.add(GestureDetector( onTap: () { @@ -2588,9 +2599,9 @@ class _RightCircleListWidgetState extends State topRight: Radius.circular(12.sp), bottomLeft: Radius.circular(12.sp))), child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + '...' - : (lists.user!.city ?? '外星'), + (list.user!.city ?? '外星').length > 4 + ? (list.user!.city ?? '外星').substring(0, 4) + '...' + : (list.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 14.sp), ), ) @@ -2613,7 +2624,7 @@ class _RightCircleListWidgetState extends State var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); - if (lists.user?.id!.toString() == myUserId) { + if (list.user?.id!.toString() == myUserId) { Get.toNamed(Routes.UserInfoPage); return; } @@ -2621,7 +2632,7 @@ class _RightCircleListWidgetState extends State widget.bean.amount > 0) { await refreshCircleData(); } - pushUserHome(lists.user!.id!.toString()!); + pushUserHome(list.user!.id!.toString()!,list); // if (widget.bean.is_limit && // widget.bean.amount > 0) { // showJoinCiclePiker( @@ -2674,13 +2685,13 @@ class _RightCircleListWidgetState extends State child: ClipRRect( borderRadius: BorderRadius.circular(30.sp), child: Image.network( - lists.user!.avatar_thumb!, + list.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover), ), ), - if ((lists.user!.onlineFlag ?? '').isNotEmpty) + if ((list.user!.onlineFlag ?? '').isNotEmpty) Positioned( bottom: 0, child: Container( @@ -2699,7 +2710,7 @@ class _RightCircleListWidgetState extends State ), alignment: Alignment.center, child: Text( - lists.user!.onlineFlag ?? '', + list.user!.onlineFlag ?? '', style: TextStyle( color: const Color.fromRGBO( 247, 250, 250, 1.0), @@ -2718,7 +2729,7 @@ class _RightCircleListWidgetState extends State Row( children: [ Text( - lists.user!.nickname!, + list.user!.nickname!, style: TextStyle( color: Colors.white, fontSize: 18.sp, @@ -2727,7 +2738,7 @@ class _RightCircleListWidgetState extends State SizedBox( width: 8.sp, ), - UserTagWidget(lists.user!.mark!), + UserTagWidget(list.user!.mark!), ], ), SizedBox( @@ -2744,17 +2755,17 @@ class _RightCircleListWidgetState extends State borderRadius: BorderRadius.circular(9.sp), gradient: sexBgGradient( - lists.user!.gender ?? 0, + list.user!.gender ?? 0, )), child: Text( getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), + list.user!.gender ?? 0, + list.user!.age ?? 0, + list.user!.role ?? 0, + list.user!.orientation ?? 0), style: TextStyle( color: sexBgColor( - lists.user!.gender ?? 0, + list.user!.gender ?? 0, ), fontSize: 12.sp, ), @@ -2783,14 +2794,14 @@ class _RightCircleListWidgetState extends State ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget( - lists.album![0].url!, - lists.id!.toString(), - lists.user!.id.toString())) + list.album![0].url!, + list.id!.toString(), + list.user!.id.toString())) : picHeight == 250 ? GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; @@ -2799,7 +2810,7 @@ class _RightCircleListWidgetState extends State await refreshCircleData(); } if (widget.bean.is_limit && - widget.bean.amount > 0) { + widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { params = { 'source': widget.index == 0 ? 'callout_list_hot' @@ -2828,7 +2839,7 @@ class _RightCircleListWidgetState extends State 'imaglist': imgList, 'index': 0, 'userId': - lists.user?.id!.toString() + list.user?.id!.toString() }, parameters: params); }, @@ -2836,14 +2847,14 @@ class _RightCircleListWidgetState extends State borderRadius: BorderRadius.circular(6.sp), child: CachedImg( - imageUrl: lists.album!.first.url!, + imageUrl: list.album!.first.url!, fit: BoxFit.cover, ), ), ) : GridView.builder( controller: GridScrollController, - itemCount: lists.album!.length, + itemCount: list.album!.length, physics: const NeverScrollableScrollPhysics(), gridDelegate: @@ -2856,11 +2867,11 @@ class _RightCircleListWidgetState extends State ), itemBuilder: (contentxt, currentIndex) { Album album = - lists.album![currentIndex]; + list.album![currentIndex]; return GestureDetector( onTap: () async { var imgList = []; - for (var element in lists.album!) { + for (var element in list.album!) { imgList.add(element.url!); } Map params = {}; @@ -2901,7 +2912,7 @@ class _RightCircleListWidgetState extends State 'imaglist': imgList, 'index': currentIndex, 'userId': - lists.user?.id!.toString() + list.user?.id!.toString() }, parameters: params); }, @@ -2921,7 +2932,7 @@ class _RightCircleListWidgetState extends State InkWell( onTap: () { Get.bottomSheet( - CallOutShareDialog('','',lists), isScrollControlled: true, + CallOutShareDialog('','',list), isScrollControlled: true, enableDrag: false ); @@ -2937,7 +2948,7 @@ class _RightCircleListWidgetState extends State Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 5.sp), decoration: BoxDecoration( @@ -2958,14 +2969,14 @@ class _RightCircleListWidgetState extends State widgets.isNotEmpty ? Expanded( child: Text( - '${lists.chat!.count!}位圈友已私聊', + '${list.chat!.count!}位圈友已私聊', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -2973,7 +2984,7 @@ class _RightCircleListWidgetState extends State GestureDetector( onTap: () { pushMsgPage( - lists, + list, widget.bean.id.toString(), ); }, @@ -2988,19 +2999,19 @@ class _RightCircleListWidgetState extends State ), GestureDetector( onTapUp: (TapUpDetails details) { - if (lists.isInteract! > 0) { + if (list.isInteract! > 0) { showOKToast('这个喊话已经点过了哦'); return; } - _showEmojiPicker(lists, lists.id!, context, + _showEmojiPicker(list, list.id!, context, details.globalPosition); }, child: Container( margin: EdgeInsets.only( left: 10.sp, bottom: - (lists.topInteractType!['userCount'] ?? 0) > 0 + (list.topInteractType!['userCount'] ?? 0) > 0 ? 10.sp : 5.sp), // height: 40.sp, @@ -3012,16 +3023,16 @@ class _RightCircleListWidgetState extends State height: 43.sp, ), Text( - lists.interactedTypeEmote ?? '❤️', + list.interactedTypeEmote ?? '❤️', style: TextStyle( color: Colors.white, fontSize: 20.sp), ), - if ((lists.topInteractType!['userCount'] ?? 0) > + if ((list.topInteractType!['userCount'] ?? 0) > 0) Positioned( bottom: 0, child: Text( - '${lists.topInteractType!['userCount']}', + '${list.topInteractType!['userCount']}', style: TextStyle( color: Colors.white, fontSize: 10.sp), ), @@ -3293,11 +3304,11 @@ class _RightCircleListWidgetState extends State _overlayEntry = null; } - pushUserHome(String userId) async { + pushUserHome(String userId,Lists list) async { if (widget.bean.is_limit && widget.bean.amount > 0) { await refreshCircleData(); } - if (widget.bean.is_limit && widget.bean.amount > 0) { + if (widget.bean.is_limit && widget.bean.amount > 0 && lists.indexOf(list) >= chargeFreeNum) { Get.toNamed(Routes.UserInfoPage, arguments: userId, parameters: { 'source': widget.index == 0 ? 'callout_list_hot' : 'callout_list_new', 'bean': jsonEncode({ @@ -3316,10 +3327,10 @@ class _RightCircleListWidgetState extends State } } - circleWidget(String url, String userId, {double width = 24}) { + circleWidget(String url, String userId,list, {double width = 24}) { return GestureDetector( onTap: () async { - pushUserHome(userId); + pushUserHome(userId,list); }, child: Stack( alignment: Alignment.center, diff --git a/circle_app/lib/circle_app/home/logic.dart b/circle_app/lib/circle_app/home/logic.dart index 6853ee1..02a4071 100644 --- a/circle_app/lib/circle_app/home/logic.dart +++ b/circle_app/lib/circle_app/home/logic.dart @@ -20,6 +20,7 @@ import 'package:connectivity/connectivity.dart'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_bugly/flutter_bugly.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -642,6 +643,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { loginIM( data['data']['account_id'].toString(), data['data']['user_sig']); accountId = data['data']['account_id'].toString(); + await FlutterBugly.setUserId(accountId); } else { if (Get.currentRoute != Routes.Login && data['code'] >= 500 && count < 5) { getIMData(count: count++); @@ -757,7 +759,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } } - loadMyInfoData() async { + Future loadMyInfoData() async { var data = await DioManager.instance.get(url: Api.getUserMine,params: {'1':1}); var bean = BaseResponse.fromJson( data, (data) => MineResponseBean.fromJson(data)); @@ -790,6 +792,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { // update(); // } } + return true; } bool isDifferenceGreaterThan30Days(String dateString) { diff --git a/circle_app/lib/circle_app/invite/share.dart b/circle_app/lib/circle_app/invite/share.dart index 230e55b..bb21c7d 100644 --- a/circle_app/lib/circle_app/invite/share.dart +++ b/circle_app/lib/circle_app/invite/share.dart @@ -463,8 +463,9 @@ class _ShareState extends State { String filePath = ''; if (byteData != null) { Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; + Directory? directory = await getExternalStorageDirectory(); + String fileName = 'widget_image_${DateTime.now().millisecondsSinceEpoch}.png'; + filePath = '${directory!.path}/$fileName'; File imageFile = File(filePath); imageFile.writeAsBytesSync(pngBytes); } diff --git a/circle_app/lib/circle_app/likelist/view.dart b/circle_app/lib/circle_app/likelist/view.dart index dbe7386..c671c53 100644 --- a/circle_app/lib/circle_app/likelist/view.dart +++ b/circle_app/lib/circle_app/likelist/view.dart @@ -525,7 +525,7 @@ class _LikelistPageState extends State with RouteAware { showOKToast('已为你增加10倍曝光啦'); } else { showOKToast('开通年VIP可以增加10倍曝光哦~'); - await showOepnVipDialog('ten_push'); + await showOepnVipDialog('ten_push',isYear:true); logic.loadMyInfo(); } } diff --git a/circle_app/lib/circle_app/login/login/logic.dart b/circle_app/lib/circle_app/login/login/logic.dart index 88869c5..6199b7e 100644 --- a/circle_app/lib/circle_app/login/login/logic.dart +++ b/circle_app/lib/circle_app/login/login/logic.dart @@ -47,9 +47,9 @@ class LoginLogic extends GetxController { // TODO: implement onInit super.onInit(); - if (!kDebugMode) { - checkNetworkUrl(); - } + // if (!kDebugMode) { + // checkNetworkUrl(); + // } SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); loginPhone = await sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE) ?? diff --git a/circle_app/lib/circle_app/minefragment/logic.dart b/circle_app/lib/circle_app/minefragment/logic.dart index e63991d..055781d 100644 --- a/circle_app/lib/circle_app/minefragment/logic.dart +++ b/circle_app/lib/circle_app/minefragment/logic.dart @@ -278,7 +278,7 @@ class MinefragmentLogic extends GetxController { } } - getMode() async { + Future getMode() async { var data = await DioManager.instance.get(url: Api.getUserMine, params: {'2': 2}); var bean = BaseResponse.fromJson( diff --git a/circle_app/lib/circle_app/msg/logic.dart b/circle_app/lib/circle_app/msg/logic.dart index c926f9d..b614bc1 100644 --- a/circle_app/lib/circle_app/msg/logic.dart +++ b/circle_app/lib/circle_app/msg/logic.dart @@ -78,6 +78,7 @@ class MsgLogic extends GetxController { var bean = BaseResponse.fromJson( data, (data) => UserList.fromJson(data)); if (bean.isSuccess()) { + lists.clear(); lists.addAll(bean.data.lists); } if (isFresh) { diff --git a/circle_app/lib/circle_app/swiper/view.dart b/circle_app/lib/circle_app/swiper/view.dart index 0dc8bb8..2b2961d 100644 --- a/circle_app/lib/circle_app/swiper/view.dart +++ b/circle_app/lib/circle_app/swiper/view.dart @@ -400,7 +400,7 @@ class _SwiperPageState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { diff --git a/circle_app/lib/circle_app/userinfo/logic.dart b/circle_app/lib/circle_app/userinfo/logic.dart index 6e24d0e..4b75d51 100644 --- a/circle_app/lib/circle_app/userinfo/logic.dart +++ b/circle_app/lib/circle_app/userinfo/logic.dart @@ -396,10 +396,7 @@ class UserinfoLogic extends GetxController { } setLike() async { - // if (isBlack || isDestroy) { - // showOKToast("喜欢失败,存在拉黑关系或者该账户已注销"); - // return; - // } + var data = await DioManager.instance.post( url: "${Api.setLike + userId}/follow", @@ -432,6 +429,7 @@ class UserinfoLogic extends GetxController { serviceLocator(); isBlack = status == "1"; + isLike = false; try { if (isBlack) { Navigator.pop(Get.context!); diff --git a/circle_app/lib/commons/widgets/circle_share.dart b/circle_app/lib/commons/widgets/circle_share.dart index dbf5b48..87046b4 100644 --- a/circle_app/lib/commons/widgets/circle_share.dart +++ b/circle_app/lib/commons/widgets/circle_share.dart @@ -26,6 +26,7 @@ import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import '../../circle_app/circle/state.dart'; import '../../circle_app/circle/widgets/video_item.dart'; +import '../../circle_app/home/logic.dart'; import '../../circle_app/likelist/logic.dart'; import '../../router/routers.dart'; import '../../utils/cache_img.dart'; @@ -46,19 +47,38 @@ class _CircleShareState extends State { // TODO: add state variables and methods GlobalKey _globalKey = GlobalKey(); List lists = []; - late MinefragmentLogic logic; + late HomeLogic logic; List conList = []; @override void initState() { // TODO: implement initState super.initState(); - Get.lazyPut(() => MinefragmentLogic()); - logic = Get.find(); + // Get.lazyPut(() => MinefragmentLogic()); + logic = Get.find(); + loadMyInfoData(); loadFollowMeData(); loadInviteData(); } + Future loadMyInfoData() async { + var data = await DioManager.instance.get(url: Api.getUserMine,params: {'1':1}); + var bean = BaseResponse.fromJson( + data, (data) => MineResponseBean.fromJson(data)); + if (bean.isSuccess()) { + logic.model = bean.data.user; + var result = await DioManager.instance.get(url: Api.inviteMainPage); + if (result['code'] == 200) { + Autogenerated info = Autogenerated.fromJson(result); + logic.inviteCode = info.data!.inviteCode!; + logic.link = info.data!.link!; + setState(() { + + }); + } + } + } + loadInviteData() async { var data = await DioManager.instance.get(url: Api.inviteMainPage); if (data['code'] == 200) { @@ -75,14 +95,18 @@ class _CircleShareState extends State { @override Widget build(BuildContext context) { // TODO: add widget build method + return Scaffold( backgroundColor: Colors.transparent, body: Container( + child: Column( children: [ - Expanded(child: Container()), + Spacer(), Container( width: Get.width - 40.sp, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + color: Colors.red, // height: Get.height - Get.bottomBarHeight - 164.sp - 10.sp, child: SingleChildScrollView( child: RepaintBoundary( @@ -393,7 +417,7 @@ class _CircleShareState extends State { shareWxData(2); }), shareAction('save', '复制邀请链接', () { - copyInviteText(logic.name); + copyInviteText(logic.model!.nickname!); }), shareAction('hb', '保存邀请海报', () { _saveLocalImage(); @@ -428,13 +452,13 @@ class _CircleShareState extends State { ); } - Widget _buildAvatar1(MinefragmentLogic logic) { + Widget _buildAvatar1(HomeLogic logic) { return ClipOval( child: GestureDetector( onTap: () { - if (logic.userInfoBean != null) { + if (logic.model != null) { var imgList = []; - imgList.add(logic.userInfoBean!.avatar); + imgList.add(logic.model!.avatar); // Get.toNamed(AppRoutes.Swiper,arguments:imgList); // Get.toNamed(AppRoutes.Swiper, arguments: { // 'imaglist': imgList, @@ -442,14 +466,14 @@ class _CircleShareState extends State { // }); } }, - child: logic.userInfoBean == null + child: logic.model == null ? SizedBox( width: 63.sp, height: 63.sp, ) : CachedImg( fit: BoxFit.cover, - imageUrl: logic.avatar, + imageUrl: logic.model!.avatar!, width: 63.sp, height: 63.sp, ), @@ -457,14 +481,14 @@ class _CircleShareState extends State { ); } - Widget _buildNameRow(MinefragmentLogic logic) { + Widget _buildNameRow(HomeLogic logic) { return Container( margin: EdgeInsets.only(top: 6.sp), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - logic.name, + logic.model!.nickname!, style: TextStyle( color: const Color.fromRGBO(247, 250, 250, 1.0), fontSize: 16.sp, @@ -476,14 +500,14 @@ class _CircleShareState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(17), - gradient: sexBgGradient(logic.userInfoBean?.gender ?? 0), + gradient: sexBgGradient(logic.model?.gender ?? 0), ), padding: EdgeInsets.only( top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), child: Text( - logic.ageMsg, + getAgeCOntent(logic.model!.gender, logic.model!.age, logic.model!.role, logic.model!.orientation), style: TextStyle( - color: sexBgColor(logic.userInfoBean?.gender ?? 0), + color: sexBgColor(logic.model?.gender ?? 0), fontSize: 10.sp, ), ), @@ -493,7 +517,7 @@ class _CircleShareState extends State { ); } - Widget _buildInfoRow(MinefragmentLogic logic) { + Widget _buildInfoRow(HomeLogic logic) { return Row( children: [ Text('邀请您加入', @@ -756,7 +780,7 @@ class _CircleShareState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { @@ -794,14 +818,15 @@ class _CircleShareState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); String filePath = ''; if (byteData != null) { Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; + Directory? directory = await getExternalStorageDirectory(); + String fileName = 'widget_image_${DateTime.now().millisecondsSinceEpoch}.png'; + filePath = '${directory!.path}/$fileName'; File imageFile = File(filePath); imageFile.writeAsBytesSync(pngBytes); } @@ -881,7 +906,7 @@ class _CallOutShareDialogState extends State { // TODO: add state variables and methods GlobalKey _globalKey = GlobalKey(); List lists = []; - late MinefragmentLogic logic; + late HomeLogic logic; List conList = []; final ScrollController GridScrollController = ScrollController(); @@ -890,7 +915,14 @@ class _CallOutShareDialogState extends State { // TODO: implement initState super.initState(); Get.lazyPut(() => MinefragmentLogic()); - logic = Get.find(); + logic = Get.find(); + if (logic.model == null) { + logic.loadMyInfoData().then((value) { + setState(() { + + }); + }); + } loadFollowMeData(); loadInviteData(); } @@ -920,8 +952,9 @@ class _CallOutShareDialogState extends State { height: Get.height, child: Column( children: [ - Container(height: MediaQuery.of(context).padding.top,), + + Spacer(), Container( width: Get.width - 40.sp, child: SingleChildScrollView( @@ -1127,10 +1160,11 @@ class _CallOutShareDialogState extends State { ), ))), ), - SizedBox( - height: 10.sp, - ), - Spacer() + Spacer(), + + Container( + height: lists.isNotEmpty || conList.isNotEmpty ? 264.sp : 164.sp, + ) ], ), ), @@ -1248,7 +1282,7 @@ class _CallOutShareDialogState extends State { shareWxData(2); }), shareAction('save', '复制邀请链接', () { - copyInviteText(logic.name); + copyInviteText(logic.model?.nickname ?? ''); }), shareAction('hb', '保存邀请海报', () { _saveLocalImage(); @@ -1633,7 +1667,7 @@ class _CallOutShareDialogState extends State { Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 5.sp, right: 0.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -1661,7 +1695,7 @@ class _CallOutShareDialogState extends State { )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -2048,7 +2082,7 @@ class _CallOutShareDialogState extends State { Expanded( child: Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + padding: EdgeInsets.only(left: 5.sp, right: 2.sp), margin: EdgeInsets.only( top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( @@ -2076,7 +2110,7 @@ class _CallOutShareDialogState extends State { )) : Expanded( child: Text( - '赶紧成为第一位私聊ta的人吧', + '快成为第一位私聊ta的人', style: TextStyle( color: Colors.white.withOpacity(0.75), fontSize: 13.sp), @@ -2288,13 +2322,13 @@ class _CallOutShareDialogState extends State { )); } - Widget _buildAvatar1(MinefragmentLogic logic) { + Widget _buildAvatar1(HomeLogic logic) { return ClipOval( child: GestureDetector( onTap: () { - if (logic.userInfoBean != null) { + if (logic.model != null) { var imgList = []; - imgList.add(logic.userInfoBean!.avatar); + imgList.add(logic.model!.avatar); // Get.toNamed(AppRoutes.Swiper,arguments:imgList); // Get.toNamed(AppRoutes.Swiper, arguments: { // 'imaglist': imgList, @@ -2302,14 +2336,14 @@ class _CallOutShareDialogState extends State { // }); } }, - child: logic.userInfoBean == null + child: logic.model == null ? SizedBox( width: 63.sp, height: 63.sp, ) : CachedImg( fit: BoxFit.cover, - imageUrl: logic.avatar, + imageUrl: logic.model!.avatar!, width: 63.sp, height: 63.sp, ), @@ -2317,14 +2351,14 @@ class _CallOutShareDialogState extends State { ); } - Widget _buildNameRow(MinefragmentLogic logic) { + Widget _buildNameRow(HomeLogic logic) { return Container( margin: EdgeInsets.only(top: 6.sp), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - logic.name, + logic.model?.nickname ?? '', style: TextStyle( color: const Color.fromRGBO(247, 250, 250, 1.0), fontSize: 16.sp, @@ -2336,14 +2370,14 @@ class _CallOutShareDialogState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(17), - gradient: sexBgGradient(logic.userInfoBean?.gender ?? 0), + gradient: sexBgGradient(logic.model?.gender ?? 0), ), padding: EdgeInsets.only( top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), child: Text( - logic.ageMsg, + getAgeCOntent(logic.model!.gender, logic.model!.age, logic.model!.role, logic.model!.orientation), style: TextStyle( - color: sexBgColor(logic.userInfoBean?.gender ?? 0), + color: sexBgColor(logic.model?.gender ?? 0), fontSize: 10.sp, ), ), @@ -2353,7 +2387,7 @@ class _CallOutShareDialogState extends State { ); } - Widget _buildInfoRow(MinefragmentLogic logic) { + Widget _buildInfoRow(var logic) { return Row( children: [ Text('邀请您加入', @@ -2418,7 +2452,7 @@ class _CallOutShareDialogState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { @@ -2456,14 +2490,15 @@ class _CallOutShareDialogState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); String filePath = ''; if (byteData != null) { Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; + Directory? directory = await getExternalStorageDirectory(); + String fileName = 'widget_image_${DateTime.now().millisecondsSinceEpoch}.png'; + filePath = '${directory!.path}/$fileName'; File imageFile = File(filePath); imageFile.writeAsBytesSync(pngBytes); } diff --git a/circle_app/lib/commons/widgets/sign_in_dialog.dart b/circle_app/lib/commons/widgets/sign_in_dialog.dart index 47b88d3..5a825ca 100644 --- a/circle_app/lib/commons/widgets/sign_in_dialog.dart +++ b/circle_app/lib/commons/widgets/sign_in_dialog.dart @@ -369,8 +369,9 @@ class _SignInDialogState extends State { var result = await DioManager.instance.post(url: Api.daySignIn); isSign = false; if (result['code'] == 200) { - showOKToast('签到成功'); - loadWeekCofigData(); + showOKToast(result['msg']); + Get.back(); + // loadWeekCofigData(); } } diff --git a/circle_app/lib/commons/widgets/text_more.dart b/circle_app/lib/commons/widgets/text_more.dart index 8541735..4f26875 100644 --- a/circle_app/lib/commons/widgets/text_more.dart +++ b/circle_app/lib/commons/widgets/text_more.dart @@ -1,7 +1,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; +import 'package:characters/characters.dart'; ///文字超出一定行,自动隐藏,并添加入"...查看更多详情"为它设置点击事件 class HideText extends StatefulWidget { @@ -32,6 +31,12 @@ class HideText extends StatefulWidget { } class _HideTextState extends State { + + String safeSubstring(String input, int start, int end) { + final chars = input.characters; + return chars.getRange(start, end).toString(); + } + @override Widget build(BuildContext context) { return Container( @@ -82,7 +87,7 @@ class _HideTextState extends State { int num = 0; int skip = 1; while(true){ - bool isExceed = widget.text.length < num + skip || _textPaint([TextSpan(text: widget.text.substring(0, num + skip) + "...", style: widget.style), + bool isExceed = widget.text.length < num + skip || _textPaint([TextSpan(text: "${safeSubstring(widget.text,0, num + skip)}...", style: widget.style), TextSpan(text: widget.additionText, style: widget.additionStyle)]).didExceedMaxLines; if(!isExceed) { num = num + skip; diff --git a/circle_app/lib/commons/widgets/user_share.dart b/circle_app/lib/commons/widgets/user_share.dart index eb21604..687d748 100644 --- a/circle_app/lib/commons/widgets/user_share.dart +++ b/circle_app/lib/commons/widgets/user_share.dart @@ -582,7 +582,7 @@ class _UserShareState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { @@ -623,14 +623,15 @@ class _UserShareState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); String filePath = ''; if (byteData != null) { Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; + Directory? directory = await getExternalStorageDirectory(); + String fileName = 'widget_image_${DateTime.now().millisecondsSinceEpoch}.png'; + filePath = '${directory!.path}/$fileName'; File imageFile = File(filePath); imageFile.writeAsBytesSync(pngBytes); } diff --git a/circle_app/lib/commons/widgets/video_share_dialog.dart b/circle_app/lib/commons/widgets/video_share_dialog.dart index eb704d0..795054a 100644 --- a/circle_app/lib/commons/widgets/video_share_dialog.dart +++ b/circle_app/lib/commons/widgets/video_share_dialog.dart @@ -411,7 +411,7 @@ class _VideoShareDialogState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { @@ -452,14 +452,15 @@ class _VideoShareDialogState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = - await boundary.toImage(pixelRatio: 1.0); + await boundary.toImage(pixelRatio: 3.0); ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); String filePath = ''; if (byteData != null) { Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; + Directory? directory = await getExternalStorageDirectory(); + String fileName = 'widget_image_${DateTime.now().millisecondsSinceEpoch}.png'; + filePath = '${directory!.path}/$fileName'; File imageFile = File(filePath); imageFile.writeAsBytesSync(pngBytes); } diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index cb87af3..4be87b5 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -226,7 +226,7 @@ packages: source: hosted version: "4.2.1" characters: - dependency: transitive + dependency: "direct main" description: name: characters sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index a7e2341..c8af779 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -132,6 +132,7 @@ dependencies: quickpass_yidun_flutter: ^1.5.6 #视频播放器 fijkplayer: ^0.11.0 + characters: ^1.2.1 dev_dependencies: flutter_test: