From 3e44662d84d8fcfe72cbf7f0576667cdc1c0033f Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Thu, 16 May 2024 18:20:37 +0800 Subject: [PATCH] =?UTF-8?q?2.1.2=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 +- .../ios/Runner.xcodeproj/project.pbxproj | 6 +- circle_app/lib/app/call_out/view.dart | 89 +- .../tim_uikit_text_field_layout/narrow.dart | 2 +- circle_app/lib/app/circle/logic.dart | 5 +- circle_app/lib/app/circle/view.dart | 5 +- .../lib/app/circle/widgets/discover.dart | 89 +- .../app/circle/widgets/info_list_view.dart | 9 +- .../lib/app/circle/widgets/like_view.dart | 301 +- .../lib/app/circle/widgets/new_people.dart | 93 +- .../lib/app/circle/widgets/vicinity.dart | 84 +- .../lib/app/circle/widgets/video_item.dart | 62 +- circle_app/lib/app/circle_list/logic.dart | 1 + circle_app/lib/app/circle_list/view.dart | 22 +- .../lib/app/circle_list/widgets/hug_tip.dart | 149 + .../widgets/right_circle_iten.dart | 2495 +++++++++++++++++ circle_app/lib/app/friendslist/view.dart | 18 +- circle_app/lib/app/home/logic.dart | 325 ++- circle_app/lib/app/likelist/view.dart | 18 +- circle_app/lib/app/minefragment/logic.dart | 25 +- circle_app/lib/app/minefragment/view.dart | 10 +- .../tim_uikit_conversation.dart | 1279 +++++---- circle_app/lib/app/msg/logic.dart | 44 + .../app/msg/recommend_circle_friend_item.dart | 5 +- circle_app/lib/app/quick/view.dart | 82 +- circle_app/lib/app/userinfo/view.dart | 4 +- .../app/userinfo/widgets/home_call_out.dart | 62 +- circle_app/lib/app/visitorlist/view.dart | 20 +- circle_app/lib/app/world_call_out/logic.dart | 3 + circle_app/lib/app/world_call_out/view.dart | 225 +- circle_app/lib/common/Widgets/add_wx_tip.dart | 27 +- .../common/Widgets/open_vip_tip/logic.dart | 15 +- .../lib/common/Widgets/open_vip_tip/view.dart | 18 +- circle_app/lib/common/colors/app_color.dart | 11 + circle_app/lib/network/api.dart | 20 +- circle_app/lib/network/dio_manager.dart | 17 +- circle_app/lib/util/util.dart | 136 +- 37 files changed, 4438 insertions(+), 1342 deletions(-) create mode 100644 circle_app/lib/app/circle_list/widgets/hug_tip.dart create mode 100644 circle_app/lib/app/circle_list/widgets/right_circle_iten.dart diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index b06bcf5..e9398ab 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 62 - versionName "2.1.2" + versionCode 63 + versionName "2.1.3" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/ios/Runner.xcodeproj/project.pbxproj b/circle_app/ios/Runner.xcodeproj/project.pbxproj index 57db7c9..eb8b994 100644 --- a/circle_app/ios/Runner.xcodeproj/project.pbxproj +++ b/circle_app/ios/Runner.xcodeproj/project.pbxproj @@ -383,7 +383,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.1; + MARKETING_VERSION = 2.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -534,7 +534,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.1; + MARKETING_VERSION = 2.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -579,7 +579,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.1; + MARKETING_VERSION = 2.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/circle_app/lib/app/call_out/view.dart b/circle_app/lib/app/call_out/view.dart index 9779a55..306f3cc 100644 --- a/circle_app/lib/app/call_out/view.dart +++ b/circle_app/lib/app/call_out/view.dart @@ -117,48 +117,59 @@ class _Call_outPageState extends State { padding: EdgeInsets.only(top: 15.sp), child: Stack( children: [ - SizedBox( - height: 100.sp, - child: TextField( - controller: - controller.textEditingController, - onChanged: (value) { - controller.update(); - }, - onTap: () { - isShowKeyboard = true; - setState(() {}); - }, - style: TextStyle( - color: Colors.white, fontSize: 17.0.sp), - maxLines: 32, - maxLength: 200, - decoration: InputDecoration( - hintStyle: TextStyle( - color: const Color.fromRGBO( - 255, 255, 255, 0.6), - fontSize: 14.sp), - hintText: '请输入...(左下角上传图片或视频哦)', - border: InputBorder.none, - contentPadding: EdgeInsets.only( - left: 17.sp, right: 17.sp), - counter: const Text('')), - ), + Column( + children: [ + SizedBox( + height: 150.sp, + child: TextField( + controller: + controller.textEditingController, + onChanged: (value) { + controller.update(); + }, + onTap: () { + isShowKeyboard = true; + setState(() {}); + }, + style: TextStyle( + color: Colors.white, fontSize: 17.0.sp), + maxLines: 32, + maxLength: 200, + decoration: InputDecoration( + hintStyle: TextStyle( + color: const Color.fromRGBO( + 255, 255, 255, 0.6), + fontSize: 14.sp), + hintText: '请输入...(左下角上传图片或视频哦)', + border: InputBorder.none, + contentPadding: EdgeInsets.only( + left: 17.sp, right: 17.sp), + counter: const Text('')), + ), + ), + Row( + children: [ + Expanded(child: Container()), + Text( + '${controller.textEditingController.text.length}/200', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + SizedBox(width: 15.sp,) + ], + ) + ], ), - Positioned( - right: 15.sp, - top: 100.sp, - child: Text( - '${controller.textEditingController.text.length}/200', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - )), + // Positioned( + // right: 15.sp, + // top: 100.sp, + // child:), Container( - margin: EdgeInsets.only(top: 130.sp), + margin: EdgeInsets.only(top: 180.sp), child: _imageAdapter(controller)), Container( margin: EdgeInsets.only( - top: 130.sp, left: 15.sp, right: 15.sp), + top: 180.sp, left: 15.sp, right: 15.sp), child: _showVideo(controller), ) ], @@ -440,8 +451,8 @@ class _Call_outPageState extends State { ), ), Positioned( - top: 0, - right: 0, + top: 5, + right: 5, child: GestureDetector( onTap: () { // showToast("删除"); 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 62f7884..a2c6e98 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== 5 ? '开通会员之后才能发送语音' : '开通会员之后才能发送图片'); + showOKToast(plate== 5 ? '开通会员之后才能发送语音' : (plate == 1 || plate == 3) ? '开通会员之后才能发送图片' : '开通会员之后才能发送视频'); 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 c6b6f59..89d82d5 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -475,6 +475,8 @@ class CircleLogic extends GetxController { myVip = 0; refreshController.loadComplete(); update(); + } else if (bean.code == 404) { + showOKToast(bean.msg); } update(); } @@ -522,7 +524,7 @@ class CircleLogic extends GetxController { if (list.isNotEmpty) { peopleRefreshController.refreshCompleted(); peopleRefreshController.loadComplete(); - + // "signature" -> "/////////////////" List info = []; list.forEach((element) { bool isContain = false; @@ -546,6 +548,7 @@ class CircleLogic extends GetxController { update(); } else if (data['code'] == 404) { isLoadFail = true; + showOKToast('网络不流畅哦,请检查网络情况'); update(); } else { isNewPeopleMore = false; diff --git a/circle_app/lib/app/circle/view.dart b/circle_app/lib/app/circle/view.dart index 3930b56..31babfc 100644 --- a/circle_app/lib/app/circle/view.dart +++ b/circle_app/lib/app/circle/view.dart @@ -108,9 +108,8 @@ class _CirclePageState extends State child: Stack( children: [ Column(children: [ - Obx(() { - return navigatorItem(controller.statistics.value); - }), + navigatorItem(controller.statistics.value) + , // Text(controller.state.msg), //组件使用 ]), diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart index c7c6b2a..2520966 100644 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ b/circle_app/lib/app/circle/widgets/discover.dart @@ -25,6 +25,8 @@ import '../../../../util/eventBus.dart'; import '../../chat/widget/chat_gift_pannel.dart'; import '../../home/logic.dart'; +import 'dart:ui' as ui show PlaceholderAlignment; + const String todayAddWxStatus = 'todayAddWxStatus'; class Discover extends StatefulWidget { @@ -262,6 +264,7 @@ class _DiscoverState extends State } else { loadFail = true; isMore = false; + showOKToast(data['msg']); setState(() { }); @@ -295,6 +298,11 @@ class _DiscoverState extends State return list.isEmpty ? loadFail ? noResultWidget(tip: '',callBack: () { + isMore = true; + loadFail = false; + setState(() { + + }); refreshData(); }) : isMore ? loaddingWidget(true) @@ -989,13 +997,42 @@ class _FeaturedItemState extends State { Container( width: Get.width - 120.sp, margin: EdgeInsets.only(top: 15.sp, bottom: 15.sp), - child: Text( - user.signature! ?? '', + child: RichText( overflow: TextOverflow.ellipsis, - maxLines: (user.signature! ?? '').length > 15 ? 2 : 1, - style: TextStyle( - fontSize: 16.sp, color: const Color(0XFFF7FAFA)), - ), + maxLines: 2, + text: TextSpan( + children: [ + WidgetSpan( + alignment: ui.PlaceholderAlignment.middle, + // alignment: Rect.fromCenter(center: center, width: width, height: height), + child: Container( + margin: EdgeInsets.only(right: 2.sp,), + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + height: 20.sp, + width: user.city!.length > 4 ? 70.sp : user.city!.contains('km') ? user.city!.length * 13.sp : user.city!.length * 20.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(22), + color: AppColor.cityBgColor, + ), + child: Text( + user.city!, + style: TextStyle( + color: Colors.white, + fontSize: 11.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + TextSpan( + text: user.signature!, + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp,)), + ], + ), + ) ), Container( width: Get.width - 110.sp, @@ -1096,34 +1133,26 @@ class _FeaturedItemState extends State { margin: EdgeInsets.only(right: 6.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 0.5.sp, ), 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: 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, - ), + child: Center( + child: Text( + tagName, + style: const TextStyle( + fontSize: 11.0, + color: Colors.white, ), ), ), 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 d643f12..10454ea 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -733,12 +733,12 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } } - double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; + // double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; return Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, - height: widgetHeight, + // height: widgetHeight, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -778,7 +778,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), ), Container( - height: widgetHeight, + // height: widgetHeight, width: Get.width, padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), child: Column( @@ -946,7 +946,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 : 5.sp), + margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 5.sp,bottom: 10.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000) @@ -1643,6 +1643,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // logic.update(); }else if(data['code'] == 404){ + var logic = Get.put(CircleLogic()); logic.circle.lists.removeAt(logic.state.index); logic.update(); diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart index 2db9711..771bdb8 100644 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -42,6 +42,8 @@ class _LikeViewState extends State @override bool get wantKeepAlive => true; final ScrollController scrollController = ScrollController(); + + final ScrollController moreScrollController = ScrollController(); final RefreshController refreshController = RefreshController(); CircleLogic logic = Get.find(); @@ -56,6 +58,7 @@ class _LikeViewState extends State var circleId = ''; List lists = []; List recomanddlists = []; + List peopleList = []; @override void dispose() { @@ -65,7 +68,7 @@ class _LikeViewState extends State // EventBusManager.cancelSubscription(scroToTop!); // } EventBusManager.cancelSubscription(likeRefreshSub!); - + moreScrollController.dispose(); scrollController.dispose(); super.dispose(); } @@ -78,7 +81,7 @@ class _LikeViewState extends State void initState() { // TODO: implement initState super.initState(); - + loadActiveUsersData(); loadLikeListData(); loadRecomdistData(); @@ -92,6 +95,23 @@ class _LikeViewState extends State likeRefreshSub = EventBusManager.on().listen((event) { refreshData(); }); + moreScrollController.addListener(() { + if (moreScrollController.position.maxScrollExtent == moreScrollController.offset) { + Get.toNamed(AppRoutes.FriendsActivity,arguments: 1); + } + }); + } + + loadActiveUsersData() async { + // if (likeMore) { + var data = await DioManager.instance.get( + url: Api.activeUsers); + if (data["code"] == 200) { + peopleList = data['data']; + setState(() { + + }); + } } loadLikeListData() async { @@ -190,6 +210,7 @@ class _LikeViewState extends State likeMore = true; recomandMore = true; refreshController.resetNoData(); + loadActiveUsersData(); loadLikeListData(); loadRecomdistData(); } @@ -350,6 +371,7 @@ class _LikeViewState extends State if (list.isQueen!) { return Column( children: [ + vipDynamicItem(list), GestureDetector( onTap: () { @@ -377,6 +399,7 @@ class _LikeViewState extends State } else { return Column( children: [ + normalDynamicItem(list), GestureDetector( onTap: () { @@ -418,9 +441,18 @@ class _LikeViewState extends State } } if (list.isQueen!) { - return vipDynamicItem(list); + return Column( + children: [ + if (index == 0 && peopleList.length > 2) + morePeoleListWidget(), + vipDynamicItem(list) + ], + ); } else { - return normalDynamicItem(list); + return Column( + children: [ + if (index == 0 && peopleList.isNotEmpty) + morePeoleListWidget(),normalDynamicItem(list)]); } } else if (lists.length == index && recomanddlists.isNotEmpty) { @@ -483,83 +515,146 @@ class _LikeViewState extends State ); } - void _showTextContentDialog(BuildContext context, String msg, String title) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( + morePeoleListWidget() { + return Container( + width: Get.width, + height: 75.sp, + margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), + child: ListView.builder( + controller: moreScrollController, + scrollDirection: Axis.horizontal, + itemBuilder: (contenxt, index) { + if (index == peopleList.length) { + return MoreItem(); + } + return peopleWidget(peopleList[index]); + }, + itemCount: peopleList.length < 10 ? peopleList.length + 1 : 10, + ), + ); + } + + Widget MoreItem() { + return GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.FriendsActivity,arguments: 1); + }, + child: Container( + // width: 68.sp, + margin: EdgeInsets.only(left: 12.sp), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 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, + Center( + child: ClipOval( + child: Container( + color: Colors.black, + width: 50.sp, + height: 50.sp, ), ), ), - 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, + Center( + child: ClipOval( + child: Image.asset( + getHomeImage("im_more"), + width: 50.sp, + // height: 48.sp, ), ), ), - Positioned( - top: 15, - left: 0, - right: 0, - child: Center( - child: Text(title, - style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)), - )), - Container( - margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), - child: Container( - margin: - EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: SingleChildScrollView( - child: Text( - msg, - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ], + ), + SizedBox(height: 4.0.sp), + Center( + child: Text( + "查看更多", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 12.0.sp, + color: Colors.white, // Replace with desired text color + ), + ), + ), + ], + ), + ), + ); + } + + peopleWidget(Map info) { + return GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity,arguments: info['id'].toString()); + }, + child: Stack( + + children: [ + Container( + margin: EdgeInsets.only(left: 12.sp), + child: Column( + children: [ + Stack( + alignment: Alignment.center, + children: [ + Container( + height: 52.sp, + width: 52.sp, + decoration: BoxDecoration( + gradient: AppColor.mainVerLinearGradient, + borderRadius: BorderRadius.circular(26.sp) ), ), - ), - ), - Positioned( - top: 8.sp, - right: 10.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Icon( - Icons.close, - color: Colors.white, - size: 20.sp, + ClipOval( + child: Image.network( + info['avatar_thumb'], + fit: BoxFit.cover, + width: 50.sp, + height: 50.sp, ), - )), + ), + if ((info['onlineFlag'] ?? '').toString().isNotEmpty) + Positioned(bottom: 0,child: Container( + height: 20.sp, + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(10.sp), + color: AppColor.bgColor, + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 1.sp, + ), + ), + alignment: Alignment.center, + child: Text( + info['onlineFlag'], + style: TextStyle( + color: + const Color.fromRGBO(247, 250, 250, 1.0), + fontSize: 10.sp, + ), + ))) + ], + + ), + SizedBox( + height: 4.sp, + ), + Text( + info['nickname'] ?? '', + style: TextStyle(color: Colors.white, fontSize: 12.sp), + ), ], ), ), - ); - }, + + ], + ), ); } @@ -610,13 +705,13 @@ class _LikeViewState extends State picHeight = picWidth; } } else { - picHeight = 200.sp; + picHeight = 140.sp; } } } - double widgetHeight = - 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; + // double widgetHeight = + // 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; return GestureDetector( onTap: () async { @@ -630,9 +725,9 @@ class _LikeViewState extends State pushHomePage(lists, lists.id.toString()); }, child: Container( - margin: EdgeInsets.only(top: 10.sp), + margin: EdgeInsets.only(bottom: 10.sp), width: Get.width, - height: widgetHeight, + // height: widgetHeight, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -675,7 +770,7 @@ class _LikeViewState extends State ), ), Container( - height: widgetHeight, + // height: widgetHeight, width: Get.width, padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), child: Column( @@ -782,7 +877,9 @@ class _LikeViewState extends State ), Container( height: picHeight, - margin: EdgeInsets.only(top: 5.sp), + + // color: Colors.red, + margin: EdgeInsets.only(top: 5.sp,), child: picHeight == 140.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), @@ -815,15 +912,6 @@ class _LikeViewState extends State 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, @@ -882,17 +970,16 @@ class _LikeViewState extends State ) ], ), + ), + Container( + + margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), + child: circleInfoItem(lists.interest, lists, index), ) ], ), ), - Positioned( - bottom: 2.sp, - left: 2.sp, - child: Container( - width: Get.width - 4.sp - 20.sp - 43.sp, - child: circleInfoItem(lists.interest, lists, index), - )) + ])), ); } @@ -918,7 +1005,7 @@ class _LikeViewState extends State picHeight = picWidth; } } else { - picHeight = 200.sp; + picHeight = 140.sp; } } } @@ -957,7 +1044,7 @@ class _LikeViewState extends State child: Container( margin: EdgeInsets.only(bottom: 10.sp), width: Get.width, - height: 120.sp + contentHeight(lists.content!) + picHeight + 76.sp, + // height: 120.sp + contentHeight(lists.content!) + picHeight + 76.sp, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -1093,6 +1180,7 @@ class _LikeViewState extends State ), picHeight > 0 ? Container( + // color: Colors.red, height: picHeight, alignment: Alignment.centerLeft, margin: EdgeInsets.only(top: 5.sp), @@ -1210,16 +1298,14 @@ class _LikeViewState extends State ], ), ), + Container( + + margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), + child: circleInfoItem(lists.interest, lists, index), + ) ], ), ), - Positioned( - left: 2.sp, - bottom: 2.sp, - child: Container( - width: Get.width - 4.sp - 20.sp - 43.sp, - child: circleInfoItem(lists.interest, lists, index), - )) ], )), ); @@ -1235,12 +1321,15 @@ class _LikeViewState extends State children: [ if (showTitle) logic.recommendCircleFriendData.isNotEmpty - ? RecommendCircleFriendItem( - false, - recommendCircleFriendData: logic.recommendCircleFriendData, - getDataCallBack: () { - logic.loadRecommendCircleFriendData(); - }) + ? Container( + // color: Colors.red, + child: RecommendCircleFriendItem( + false,0, + recommendCircleFriendData: logic.recommendCircleFriendData, + getDataCallBack: () { + logic.loadRecommendCircleFriendData(); + }), + ) : Container(), if (showTitle) Container( diff --git a/circle_app/lib/app/circle/widgets/new_people.dart b/circle_app/lib/app/circle/widgets/new_people.dart index 55223e0..789a41a 100644 --- a/circle_app/lib/app/circle/widgets/new_people.dart +++ b/circle_app/lib/app/circle/widgets/new_people.dart @@ -13,7 +13,7 @@ import '../../../util/eventBus.dart'; import '../../../util/util.dart'; import '../../userinfo/logic.dart'; import '../view.dart'; - +import 'dart:ui' as ui show PlaceholderAlignment; class NewPeople extends StatefulWidget { @override @@ -74,6 +74,8 @@ class _NewPeopleState extends State { ), ) : logic.isLoadFail ? noResultWidget(tip: '', callBack: () { + logic.isLoadFail = false; + logic.update(); logic.onLoading(); }) : loaddingWidget(logic.isNewPeopleMore,tip: '过段时间再来欢迎新人吧~'); }); @@ -229,13 +231,50 @@ class _NewPeopleItemState extends State { margin: EdgeInsets.symmetric(horizontal: 8.0,vertical: 10.sp), child: Align( alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: Text( - item.signature ?? '暂时还没有签名哦~', - maxLines: 2, - style: - TextStyle(color: Colors.white, fontSize: 18.sp), + child: RichText( overflow: TextOverflow.ellipsis, - ), + maxLines: 2, + text: TextSpan( + children: [ + WidgetSpan( + alignment: ui.PlaceholderAlignment.middle, + // alignment: Rect.fromCenter(center: center, width: width, height: height), + child: Container( + margin: EdgeInsets.only(right: 2.sp,), + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + height: 20.sp, + width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(22), + color: AppColor.cityBgColor, + ), + child: Text( + item.city!, + style: TextStyle( + color: Colors.white, + fontSize: 11.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + TextSpan( + text: item.signature!, + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp,)), + ], + ), + ) + + // Text( + // item.signature ?? '暂时还没有签名哦~', + // maxLines: 2, + // style: + // TextStyle(color: Colors.white, fontSize: 18.sp), + // overflow: TextOverflow.ellipsis, + // ), ), ), if (item.interests.isNotEmpty) @@ -339,34 +378,26 @@ class _NewPeopleItemState extends State { margin: EdgeInsets.only(right: 11.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 0.5.sp, ), 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: 15.sp, + right: 15.sp, ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), + child: Center( + child: Text( + interests[index].title, + style: const TextStyle( + fontSize: 13.0, + color: Colors.white, ), ), ), diff --git a/circle_app/lib/app/circle/widgets/vicinity.dart b/circle_app/lib/app/circle/widgets/vicinity.dart index fa4c363..bd8d959 100644 --- a/circle_app/lib/app/circle/widgets/vicinity.dart +++ b/circle_app/lib/app/circle/widgets/vicinity.dart @@ -18,6 +18,8 @@ import '../../../common/Widgets/tag_widget.dart'; import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import '../../../common/colors/app_color.dart'; +import 'dart:ui' as ui show PlaceholderAlignment; + class Vicinity extends StatefulWidget { CircleLogic logic; // TODO: add state variables, methods and constructor params @@ -99,6 +101,8 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin // ),) ], ) : widget.logic.isNearLoad ? loaddingWidget(true) : noResultWidget(tip: '',callBack: () { + widget.logic.isNearLoad = true; + widget.logic.update(); _onLoading(); }); } @@ -421,12 +425,42 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin margin: EdgeInsets.symmetric(vertical: 12.0.sp,horizontal: 9.sp), child: Align( alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: Text( - item.signature, - maxLines: 2, - style: TextStyle(color: Colors.white, fontSize: 18.sp), + child: RichText( overflow: TextOverflow.ellipsis, - ), + maxLines: 2, + text: TextSpan( + children: [ + WidgetSpan( + alignment: ui.PlaceholderAlignment.middle, + // alignment: Rect.fromCenter(center: center, width: width, height: height), + child: Container( + margin: EdgeInsets.only(right: 2.sp,), + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + height: 20.sp, + width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(22), + color: AppColor.cityBgColor, + ), + child: Text( + item.city!, + style: TextStyle( + color: Colors.white, + fontSize: 11.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + TextSpan( + text: item.signature!, + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp,)), + ], + ), + ) ), ), Container( @@ -504,34 +538,26 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin margin: EdgeInsets.only(right: 11.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 0.5.sp, ), 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: 15.sp, + right: 15.sp, ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), + child: Center( + child: Text( + interests[index].title, + style: const TextStyle( + fontSize: 13.0, + color: Colors.white, ), ), ), diff --git a/circle_app/lib/app/circle/widgets/video_item.dart b/circle_app/lib/app/circle/widgets/video_item.dart index eae0486..b5e7d6b 100644 --- a/circle_app/lib/app/circle/widgets/video_item.dart +++ b/circle_app/lib/app/circle/widgets/video_item.dart @@ -1,10 +1,9 @@ - +import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/circle/widgets/play_video_view.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:video_player/video_player.dart'; class VideoItemWidget extends StatefulWidget { String url; @@ -14,50 +13,29 @@ class VideoItemWidget extends StatefulWidget { } class _VideoItemWidgetState extends State { - VideoPlayerController? videoPlayerController; - - @override - void initState() { - super.initState(); - // ignore: deprecated_member_use - videoPlayerController = VideoPlayerController.network( - widget.url) - ..initialize().then((_) { - // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. - setState(() {}); - }); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - videoPlayerController?.dispose(); - } @override Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - Get.to(PlayVideoView(widget.url)); - }, - child: AspectRatio( - aspectRatio: videoPlayerController!.value.aspectRatio, - child: Stack( - children: [ - VideoPlayer(videoPlayerController!), - Center( - child: videoPlayerController!.value.isPlaying - ? Container() - : Image( - image: AssetImage(getMineImage("icon_play")), - width: 30.sp, - height: 30.sp, - ), + return Row( + children: [ + GestureDetector( + onTap: () { + Get.to(PlayVideoView(widget.url)); + }, + child: Stack( + alignment: Alignment.center, + children: [ + ClipRRect(borderRadius: BorderRadius.circular(6.sp),child: CachedNetworkImage(imageUrl:'${widget.url}?vframe/jpg/offset/1',height: 200.sp,fit: BoxFit.cover,)), + Image( + image: AssetImage(getMineImage("icon_play")), + width: 30.sp, + height: 30.sp, + ), + ], ), - ], - ), - ), + + ), + ], ); } } diff --git a/circle_app/lib/app/circle_list/logic.dart b/circle_app/lib/app/circle_list/logic.dart index 2769ba7..b03a20d 100644 --- a/circle_app/lib/app/circle_list/logic.dart +++ b/circle_app/lib/app/circle_list/logic.dart @@ -71,6 +71,7 @@ class LikeLogic extends GetxController { } } else if (bean.code == 404) { isLoadFial = true; + showOKToast('网络不流畅哦,请检查网络情况'); update(); } } diff --git a/circle_app/lib/app/circle_list/view.dart b/circle_app/lib/app/circle_list/view.dart index 09b1a5a..98d17b5 100644 --- a/circle_app/lib/app/circle_list/view.dart +++ b/circle_app/lib/app/circle_list/view.dart @@ -5,6 +5,7 @@ import 'package:circle_app/app/circle/logic.dart'; import 'package:circle_app/app/circle/widgets/info_list_view.dart'; import 'package:circle_app/app/circle/widgets/like_view.dart'; import 'package:circle_app/app/circle_list/widgets/circle_type_item.dart'; +import 'package:circle_app/app/circle_list/widgets/right_circle_iten.dart'; import 'package:circle_app/app/select_circle/logic.dart'; import 'package:circle_app/common/Widgets/circle_share.dart'; import 'package:circle_app/common/Widgets/text_more.dart'; @@ -109,6 +110,9 @@ class _CircleListPageState extends State } return logic.isLoadFial ? noResultWidget(tip:'',callBack: () { + logic.isLoadFial = false; + logic.isLoad = true; + logic.update(); logic.loadMyInfo(); logic.loadData(); }) : logic.isLoad @@ -162,14 +166,16 @@ class _CircleListPageState extends State logic.update(); }, ) - : InfoListView( - logic.currentIndex, - logic.mycircle - .lists[logic.currentIndex], - logic, - key: ValueKey( - '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'), - ))) + : RightCircleIten( logic.currentIndex, + logic.mycircle + .lists[logic.currentIndex], + logic,key: ValueKey( + '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'),))) + + // InfoListView( + + + // ))) ], ), ); diff --git a/circle_app/lib/app/circle_list/widgets/hug_tip.dart b/circle_app/lib/app/circle_list/widgets/hug_tip.dart new file mode 100644 index 0000000..f800b7c --- /dev/null +++ b/circle_app/lib/app/circle_list/widgets/hug_tip.dart @@ -0,0 +1,149 @@ +import 'package:circle_app/common/Widgets/base_tip_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:circle_app/app/home/logic.dart'; +import 'package:circle_app/common/colors/app_color.dart'; +import 'package:circle_app/components/func_widget.dart'; +import 'package:circle_app/network/api.dart'; +import 'package:circle_app/network/dio_manager.dart'; +import 'package:circle_app/util/util.dart'; +import 'package:gradient_borders/box_borders/gradient_box_border.dart'; + + +class HugTip extends StatefulWidget { + String circleId; + Function call; + List rewardConfigs; + HugTip(this.circleId,this.rewardConfigs,this.call); + @override + _HugTipState createState() => _HugTipState(); + +} + +class _HugTipState extends State { + // TODO: add state variables and methods + + + int index = 1; + + sendHugCount() async { + // [parameters setValue:self.hugCount forKey:@"hugCount"]; + // [parameters setValue:self.objId forKey:@"objId"]; + // [parameters setValue:@"2" forKey:@"objType"]; + + var result = await DioManager.instance.post(url: Api.rewardAgent,params: {'amount':widget.rewardConfigs[index],'interestAgentId':widget.circleId}); + if (result['code'] == 200) { + showOKToast('打赏成功'); + widget.call(); + Get.back(); + } else { + showOKToast(result['msg']); + if (result['code'] == 31201) { + showRechargeScreenDialog(); + } + + } + } + + @override + Widget build(BuildContext context) { + // TODO: add widget build method + return Scaffold( + backgroundColor: Colors.transparent, + body: Container( + width: Get.width, + alignment: Alignment.center, + child: Container( + width: Get.width, + margin: EdgeInsets.only(left: 20.sp,right: 20.sp), + height: 248.sp, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(getMineImage('im_neglect')), + fit: BoxFit.fill + ) + ), + child: Column( + children: [ + Container( + // width: 120.sp, + padding: EdgeInsets.only(left: 17.sp, right: 17.sp,top: 30.sp,bottom: 20.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + typeItem(index == 0, widget.rewardConfigs[0],0,), + typeItem(index == 1, widget.rewardConfigs[1],1), + typeItem(index == 2, widget.rewardConfigs[2],2), + ], + )), + GestureDetector( + onTap: () { + sendHugCount(); + }, + child: Container( + width: 232.sp, + height: 42.sp, + decoration: BoxDecoration( + gradient: AppColor.mainVerLinearGradient, + borderRadius: BorderRadius.circular(21.sp) + ), + alignment: Alignment.center, + child: Text('打赏小票',style: TextStyle(color: Colors.white,fontSize: 16.sp,fontWeight: FontWeight.w500),), + ), + ), + SizedBox(height: 15.sp,), + GestureDetector( + onTap: () { + Get.back(); + }, + child: Container( + child: Text('无情拒绝',style: TextStyle(color: Color(0xFFB7BECC),fontSize: 14.sp),), + ), + ) + ], + ), + ), + ), + ); + } + + typeItem(bool isSelected, int i,int currentIndex) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (!isSelected) { + index = currentIndex; + setState(() { + + }); + } + }, + child: Container( + width: 88.sp, + height: 100.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + border: GradientBoxBorder( + gradient: + isSelected ? AppColor.mainVerLinearGradient : AppColor.clearLinearGradient, + width:1.sp, + ), + ), + child: Column( + children: [ + SizedBox(height: 8.sp,), + Image.asset(getMineImage('bi_icon${currentIndex+2}'),width: 48.sp,), + SizedBox(height: 8.sp,), + Text( + '$i小票', + style: TextStyle( + color: Color(0xFFB7BECC), + fontSize: 12.sp), + ), + ], + ), + ), + ); + } +} diff --git a/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart b/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart new file mode 100644 index 0000000..7ea30e9 --- /dev/null +++ b/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart @@ -0,0 +1,2495 @@ +import 'package:circle_app/app/circle_list/widgets/hug_tip.dart'; +import 'package:circle_app/common/colors/app_color.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'dart:async'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/circle/state.dart'; +import 'package:circle_app/app/circle/widgets/list_logic.dart'; +import 'package:circle_app/app/circle/widgets/video_item.dart'; +import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/select_circle/logic.dart'; +import 'package:circle_app/common/Widgets/base_tip_widget.dart'; +import 'package:circle_app/common/Widgets/circle_share.dart'; +import 'package:circle_app/common/Widgets/text_more.dart'; +import 'package:circle_app/main.dart'; +import 'package:circle_app/network/dio_manager.dart'; +import 'package:circle_app/router/app_routers.dart'; +import 'package:circle_app/util/util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:get/get_core/src/get_main.dart'; +import 'package:gradient_borders/box_borders/gradient_box_border.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; + +import '../../../common/Widgets/tag_widget.dart'; +import '../../../network/api.dart'; +import '../../../util/SharedPreferencesHelper.dart'; +import '../../../util/eventBus.dart'; +import '../../circle_list/logic.dart'; +import '../../userinfo/view.dart'; + +class RightCircleIten extends StatefulWidget { + var logic; + Circle bean; + int index; + + // Function updateBeanCall; + + RightCircleIten(this.index, this.bean, this.logic, {super.key}); + @override + _RightCircleItenState createState() => new _RightCircleItenState(); +} + +class _RightCircleItenState extends State + with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { + @override + bool get wantKeepAlive => true; + final ScrollController scrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); + late TabController _tabController; + ListLogic? listsLg; + + int callOutPage = 1; + int currentIndex = 0; + int count = 0; + bool isLoad = true; + bool callOutMore = true; + var circleId = ''; + List lists = []; + + bool isSetState = false; + + var sub; + + Map interestAgentMap = {}; + + // TODO: add state variables and methods + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + sub.cancel(); + } + + @override + void initState() { + super.initState(); + sub = EventBusManager.on().listen((event) { + // if (isSetState) { + isSetState = false; + setState(() {}); + // } + }); + + circleId = widget.bean.id.toString(); + + _tabController = TabController(length: 2, vsync: this, initialIndex: 0); + _tabController.addListener(_handleTabChange); + + scrollController.addListener(() { + if (scrollController.position.pixels == + scrollController.position.maxScrollExtent) { + print('2222'); + isSetState = true; + EventBusManager.fire(RightScrollViewIsEnd(true)); + setState(() {}); + } else { + EventBusManager.fire(RightScrollViewIsEnd(false)); + if (isSetState) { + isSetState = false; + setState(() {}); + } + } + }); + loadInterestAgent(); + } + + + loadInterestAgent() async { + var data = await DioManager.instance.get( + url: "${Api.interestAgent}$circleId", + ); + if (data["code"] == 200) { + if (data['data'] != null) { + interestAgentMap = data['data']; + } + + if (mounted) { + setState(() {}); + } + } + } + + loadCircleInfo() async { + var data = await DioManager.instance.get( + url: "/up-service/interest/$circleId", + ); + if (data["code"] == 200) { + widget.bean = Circle.fromJson(data['data']); + if (mounted) { + setState(() {}); + } + } + } + + refreshCircleData() async { + var data = await DioManager.instance + .get(url: 'up-service/interest/${widget.bean.id}'); + if (data['code'] == 200) { + widget.bean = Circle.fromJson(data['data']); + } else if (data['code'] == 404) { + var logic = Get.put(CircleLogic()); + showOKToast('网络不流畅哦,请检查网络情况'); + logic.circle.lists.removeAt(logic.state.index); + logic.update(); + } + } + + void _handleTabChange() { + if (scrollController.position.pixels == + scrollController.position.maxScrollExtent) { + print('2222'); + isSetState = true; + EventBusManager.fire(RightScrollViewIsEnd(true)); + setState(() {}); + } + } + + circleWidget(String url, String userId, {double width = 24}) { + return GestureDetector( + onTap: () async { + if (widget.bean.is_limit && widget.bean.amount > 0) { + await refreshCircleData(); + } + if (widget.bean.is_limit && widget.bean.amount > 0) { + showJoinCiclePiker( + widget.bean.id.toString(), + widget.bean.amount.toString(), + widget.bean.oldAmount.toString(), + 1, (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; + } + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: width.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl: url ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + width: (width - 1).sp, + height: (width - 1).sp, + fit: BoxFit.cover, + ), + ) + ], + )); + } + + circleTiitleWidget(List urlList, List widgets) { + return Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + // height:urlList.length==0?47.sp: 118.sp, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage(getCircleImage('circle_desc')))), + child: Container( + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 7.sp), + width: Get.width, + // height: 50.sp, + child: HideText( + text: widget.bean.intro, + maxWidth: Get.currentRoute == AppRoutes.Home + ? Get.width - 90.sp + : Get.width - 60.sp, + additionText: '查看更多', + maxLines: 3, + style: TextStyle(color: Colors.white, fontSize: 17.sp), + additionStyle: TextStyle( + color: const Color(0xFFFF4DF6), fontSize: 17.sp), + onTap: () { + showTextContentDialog( + context, widget.bean.intro, widget.bean.title); + }, + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: urlList.length == 0 + ? Container() + : Container( + height: 30.sp, + child: Row( + children: [ + SizedBox( + height: 30.sp, + width: + 30.0.sp + 15.sp * (widgets.length - 1.sp), + child: Stack( + alignment: Alignment.center, + children: widgets, + ), + ), + SizedBox( + width: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + SizedBox( + width: 8.sp, + ), + // GestureDetector( + // onTap: () { + // Get.bottomSheet( + // CircleShare('','',widget.bean), isScrollControlled: true, + // enableDrag: false + // ); + // }, + // child: Container( + // height: 30.sp, + // alignment: Alignment.center, + // child: Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ), + // ), + // ) + ], + ), + ), + ), + ], + ), + ), + ), + if (interestAgentMap.isNotEmpty) + Container( + margin: EdgeInsets.only(top: 5.sp), + decoration: BoxDecoration( + color: AppColor.bgColor, + borderRadius: BorderRadius.circular(8.sp)), + height: 40.sp, + padding: EdgeInsets.only(left: 8.sp, right: 8.sp), + child: Row( + children: [ + Text( + '今日圈子代理人:', + style: TextStyle(color: Colors.white, fontSize: 13.sp), + ), + GestureDetector( + onTap: () { + if (interestAgentMap.isNotEmpty) { + Get.toNamed(AppRoutes.UserInfoActivity,arguments: interestAgentMap['user']['id'].toString()); + } + + }, + child: Text( + interestAgentMap.isNotEmpty ? interestAgentMap['user']['nickname'] : '', + style: TextStyle(color: AppColor.mainColor, fontSize: 13.sp), + ), + ), + SizedBox( + width: 4.sp, + ), + Image.asset( + getMineImage('bi_icon1'), + width: 20.sp, + ), + Text( + '${convertToTenThousand(interestAgentMap.isNotEmpty ? interestAgentMap['rewardCoin'] : 0)}', + style: TextStyle(color: Colors.white, fontSize: 13.sp), + ), + Expanded(child: Container()), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + showSendMoneyDialog(interestAgentMap['id'].toString()); + // Get.toNamed(AppRoutes.Invite); + }, + child: Container( + 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.6.sp), + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp, top: 4.sp, bottom: 4.sp), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + color: const Color(0xFF392D53), + ), + child: Row( + children: [ + Image.asset( + getMsgImage('gift'), + width: 14.sp, + ), + SizedBox( + width: 2.sp, + ), + Text( + "打赏", + style: TextStyle( + fontSize: 12.sp, + color: Colors.white, + ), + ), + ], + ), + ), + ), + ), + ], + ) + ], + ), + ), + + ], + ); + } + + void showTextContentDialog(BuildContext context, String msg, String title) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 300.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, + ), + ), + ), + Positioned( + top: 15, + left: 0, + right: 0, + child: Center( + child: Text(title, + style: TextStyle( + color: const Color(0xFFF7FAFA), fontSize: 16.sp)), + )), + Container( + margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), + child: Container( + margin: + EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: SingleChildScrollView( + child: Text( + msg, + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + ), + ), + Positioned( + top: 8.sp, + right: 10.sp, + child: GestureDetector( + onTap: () { + Get.back(); + }, + child: Icon( + Icons.close, + color: Colors.white, + size: 20.sp, + ), + )), + ], + ), + ), + ); + }, + ); + } + + double contentHeight(String content) { + return calculateTextHeight( + content, 17.sp, FontWeight.w300, Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 64.sp, 3); + } + + + @override + Widget build(BuildContext context) { + if (widget.bean.image.isEmpty) { + loadCircleInfo(); + } + List urlList = widget.bean.lastJoinUsers; + List widgets = []; + int i = 0; + // print(urlList); + if (null != urlList) { + urlList.forEach((element) { + if (widgets.length > 2) { + return; + } + widgets.add(Positioned( + left: 15.sp * i, + child: circleWidget( + element.avatar! ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + element.id.toString()), + )); + i++; + }); + } + + + double textHeight = contentHeight(widget.bean.intro); + + + return ClipRRect( + borderRadius: BorderRadius.circular(10.sp), + child: Container( + width: Get.width, + child: Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(10.sp), + child: SizedBox( + width: Get.width, + height: Get.height, + child: Image.asset( + getCircleImage('circle_bg'), + fit: BoxFit.cover, + ), + )), + Container( + height: Get.height, + width: Get.width, + margin: EdgeInsets.only(top: 72.sp), + child: NotificationListener( + onNotification: (notification) { + if (notification is OverscrollNotification && notification.overscroll < -15) { + // 下拉刷新时禁用NestedScrollView的滚动 + if (!refreshController.isLoading && scrollController.offset == 0) { + count++; + print(notification); + if (count > 0 && count == 2 ) { + + refreshController.requestRefresh(); + + } + return true; + } + } + return true; + }, + child: SmartRefresher( + controller: refreshController, + onRefresh: () { + EventBusManager.fire(RightRefreshContrller(_tabController.index)); + Future.delayed(Duration(milliseconds: 200), () { + refreshController.refreshCompleted(); + count = 0; + }); + // refreshController.refreshToIdle(); + }, + enablePullDown:true, + enablePullUp: false, + + child: NestedScrollView( + // physics: ClampingScrollPhysics(), + controller: scrollController, + headerSliverBuilder: (context, isScrolled) { + print('isScrolled' + isScrolled.toString()); + return [ + SliverAppBar( + stretch: false, + elevation: 0, + primary: true, + pinned: false, + floating: true, + forceElevated: true, + toolbarHeight: 0, + foregroundColor: Colors.transparent, + backgroundColor: Colors.transparent, + expandedHeight: 58.sp + textHeight + (interestAgentMap.isNotEmpty ? 45.sp : 0), + flexibleSpace: FlexibleSpaceBar( + expandedTitleScale: 1.0, + centerTitle: true, + titlePadding: EdgeInsets.zero, + title: circleTiitleWidget( + urlList, + widgets, + ), + ), + ) + ]; + }, + body: Column( + children: [ + Container( + height: 35.sp, + // color: Colors.red, + padding: EdgeInsets.only(right: 5.sp), + child: Row( + children: [ + TabBar( + isScrollable: true, + controller: _tabController, + labelPadding: EdgeInsets.symmetric(horizontal: 5.0.sp), + indicator: UnderlineTabIndicator( + borderSide: BorderSide( + color: const Color(0xFF00FFF4), + ), + ), + indicatorColor: const Color(0xFF00FFF4), + indicatorWeight: 2.sp, + labelColor: const Color(0xFF00FFF4), + unselectedLabelColor: const Color(0xB3FFFFFF), + indicatorSize: TabBarIndicatorSize.label, + indicatorPadding: + EdgeInsets.only(left: 12.sp, right: 12.sp, bottom: 8.sp), + tabs: [ + Tab( + child: Text( + '推荐', + style: TextStyle( + fontSize: 18.sp, + ), + ), + ), + Tab( + child: Text( + '最新', + style: TextStyle( + fontSize: 18.sp, + ), + ), + ), + ], + labelStyle: TextStyle( + color: const Color(0xFF00FFF4), + fontSize: 18.sp, + shadows: [ + Shadow( + color: const Color(0xFFF657FF).withOpacity(0.5), + offset: Offset(0, -2), // 阴影偏移 + blurRadius: 3, // 阴影模糊半径 + // spreadRadius: 0 + ), + ], + ), + unselectedLabelStyle: TextStyle( + // color: const Color(0xB3FFFFFF), + fontSize: 18.sp, + shadows: [ + Shadow( + // color: const Color(0xFFF657FF), + offset: const Offset(0, -1), + blurRadius: 3.0.sp, + ), + ], + ), + onTap: (index) { + }, + ), + Expanded(child: Container()), + GestureDetector( + onTap: () { + sendApplyToAgentData(); + // Get.toNamed(AppRoutes.Invite); + }, + child: Container( + height: 24.sp, + + margin: EdgeInsets.all(0.6.sp), + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp,), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + color: const Color(0xFF392D53), + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 1.sp, + ), + ), + child: Row( + children: [ + Text( + "🙋申请代理", + style: TextStyle( + fontSize: 12.sp, + color: Colors.white, + ), + ), + ], + ), + ), + ), + ], + ), + ), + Expanded( + child: TabBarView( + controller: _tabController, + children: [ + RightCircleListWidget(widget.index, widget.bean, widget.logic,0,scrollController,interestAgentMap), + RightCircleListWidget(widget.index, widget.bean, widget.logic,1,scrollController,interestAgentMap), + ], + ), + ), + ], + ) + ), + ), + ), + ), + ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.sp), + topRight: Radius.circular(10.sp)), + child: Container( + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + height: 72.sp, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: + AssetImage(getCircleImage('top_circle_bg')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + if (widget.bean.isJoin) { + _showOutCircleDialog( + Get.context!, widget.logic, widget.bean); + } + }, + child: Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: widget.bean.image.isNotEmpty + ? ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: widget.bean.image, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover), + ) + : Container(), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + scrollController.animateTo( + 0.0, // Scroll to the top + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }, + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.bean.title, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + height: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + ), + )), + GestureDetector( + //加入圈子 + onTap: () async { + if (widget.bean.isJoin) { + Get.bottomSheet( + CircleShare('', '', widget.bean), + isScrollControlled: true, + enableDrag: false); + } else { + await widget.logic.outCircle( + widget.bean.id.toString(), + widget.bean.isJoin); + widget.logic.update(); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Opacity( + opacity: 0.5, + child: Image.asset( + getCircleImage('add'), + width: 60.sp, + ), + ), + Text( + !widget.bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + )) + ], + ), + )), + Positioned( + top: 70.sp, + child: Image.asset( + getCircleImage('circle_line'), + width: Get.width, + )), + if (Get.currentRoute == AppRoutes.Home) + Positioned( + bottom: 36.sp, + right: 10.sp, + child: GestureDetector( + onTap: () async { + List numbers = []; + numbers.add(MyConfigData(widget.bean.id.toString(), + widget.bean.title, false)); + var data = await Get.toNamed(AppRoutes.Call_out, + arguments: {'numbers': numbers}); + }, + child: Image.asset( + getCircleImage('send_msg'), + width: 70.sp, + ))) + ], + ))); + } + + void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 160.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: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + "是否确认退出该圈子。", + 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: 30.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: 52.sp, + right: 52.sp), + child: Text( + "否", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ), + SizedBox(width: 24.sp), + GestureDetector( + onTap: () async { + Navigator.pop(context); + await widget.logic + .outCircle(bean.id.toString(), bean.isJoin); + // widget.logic.update(); + }, + 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: Text( + "是", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } + + void sendApplyToAgentData() async { + var data = await DioManager.instance + .post(url: Api.applyToAgent + '$circleId'); + if (data['code'] == 200) { + + var con; + if(kDebugMode){ + con = V2TimConversation( + conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); + }else{ + con = V2TimConversation( + conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); + } + Get.toNamed(AppRoutes.Chat, arguments: con); + } else if (data['code'] == 32104) { + showReportDialog(Get.context!,data['msg']); + } + } + + void showReportDialog(BuildContext context,String msg) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 200.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: AppColor.bgColor, + borderRadius: BorderRadius.circular(12.0.sp), + // gradient: const LinearGradient( + // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], + // begin: Alignment.topCenter, + // end: Alignment.bottomCenter, + // ), + ), + ), + // Container( + // margin: EdgeInsets.all(1.sp), + // child: Image.asset(getMineImage("im_neglect"),fit: BoxFit.fill,), + // ), + Container( + margin: EdgeInsets.only(top: 12.sp), + child: Column( + children: [ + Center( + child: Text( + "申请代理提示", + style: + TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + msg, + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + GestureDetector( + onTap: () { + Get.back(); + Get.toNamed(AppRoutes.Invite); + }, + child: Container( + margin: EdgeInsets.only(top: 16.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: 52.sp, + right: 52.sp), + child: const Text( + "前往邀请", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } + + void showSendMoneyDialog(String userId) { + if (interestAgentMap.isNotEmpty) { + Get.bottomSheet(HugTip(userId, interestAgentMap['rewardConfigs'], () { + loadInterestAgent(); + }),isScrollControlled: true); + } + } +} + +class RightCircleListWidget extends StatefulWidget { + var logic; + Circle bean; + int index; + int type; + ScrollController scrollController; + Map interestAgentMap; + // Function updateBeanCall; + + RightCircleListWidget(this.index, this.bean, this.logic,this.type,this.scrollController,this.interestAgentMap, {super.key}); + + @override + State createState() => _RightCircleListWidgetState(); +} + +class _RightCircleListWidgetState extends State + with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; + final ScrollController scrollController = ScrollController(); + + final ScrollController GridScrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); + ListLogic? listsLg; + + int callOutPage = 1; + + bool isLoad = true; + bool callOutMore = true; + var circleId = ''; + List lists = []; + Map interestAgentMap = {}; + + bool isEnd = false; + var sub; + var sub1; + + @override + void dispose() { + // TODO: implement dispose + + sub.cancel(); + sub1.camcel(); + callRefreshCicle?.cancel(); + scrollController.dispose(); + super.dispose(); + } + + StreamSubscription? callRefreshCicle = null; + StreamSubscription? cicleInfoRefresh = null; + StreamSubscription? scroToTop = null; + + @override + void initState() { + // TODO: implement initState + super.initState(); + // if (widget.scrollController.offset == widget.scrollController.position.maxScrollExtent) { + // isEnd = true; + // } + sub = EventBusManager.on().listen((event) { + if (event.isEnd) { + isEnd = true; + setState(() {}); + } else { + isEnd = false; + scrollController.jumpTo(0); + setState(() {}); + } + }); + sub1 = EventBusManager.on().listen((event) { + if (event.index == widget.type) { + callOutPage = 1; + loadCallOutListData(); + } + }); + + + scrollController.addListener(() { + if (scrollController.offset <= 0) { + EventBusManager.fire(RightScrollViewScrollTop()); + EventBusManager.fire(RightScrollViewIsEnd(false)); + + isEnd = false; + setState(() {}); + } + }); + GridScrollController.addListener(() { + GridScrollController.jumpTo(0.0); + }); + interestAgentMap = widget.interestAgentMap; + circleId = widget.bean.id.toString(); + // if (Get.currentRoute == AppRoutes.Home || Get.currentRoute == AppRoutes.MyCircle) { + loadCallOutListData(); + // } + + callRefreshCicle = EventBusManager.on().listen((event) { + if (widget.bean.id.toString() == event.circleId && widget.type == 1) { + callOutPage = 1; + loadCallOutListData(); + } + }); + + } + + + loadCircleInfo() async { + var data = await DioManager.instance.get( + url: "/up-service/interest/$circleId", + ); + if (data["code"] == 200) { + + widget.bean = Circle.fromJson(data['data']); + if (mounted) { + setState(() {}); + } + } + } + + loadCallOutListData() async { + var data = await DioManager.instance.get( + url: widget.type ==0 ? '/up-service/interest/$circleId/pushCallouts' : "/up-service/interest/$circleId/newCallouts", + params: {"page": callOutPage, "page_size": "20"}); + if (data["code"] == 200) { + List dataList = data["data"]["lists"] ?? []; + if (callOutPage == 1) { + if (lists.isNotEmpty) { + lists.clear(); + refreshController.resetNoData(); + // refreshController.refreshCompleted(); + } + } + if (dataList.isNotEmpty) { + callOutMore = true; + for (var element in dataList) { + lists.add(Lists.fromJson(element)); + } + callOutPage++; + refreshController.loadComplete(); + } + callOutMore = dataList.length == 20; + if (!callOutMore) { + refreshController.loadNoData(); + } + if (mounted) { + setState(() {}); + } + } else { + showOKToast(data["msg"]); + } + } + + setCircleId(String id) { + circleId = id; + loadCallOutListData(); + } + + void refreshData() { + callOutPage = 1; + callOutMore = true; + loadCallOutListData(); + } + + void loadMore() { + if (callOutMore == false) return; + loadCallOutListData(); + } + + void pushOtherPeopleHomePage(String userId) { + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + + // if (bean.isQueen) { + // showJoinCiclePiker(cicleId); + // } else { + //跳转消息页面 + // Get.bottomSheet(Open_vip_tipPage(), + // isScrollControlled: true, + // enableDrag: false, + // ); + // } + } + + void pushHomePage(Lists bean, String cicleId) async { + SharedPreferencesHelper.getInstance().then((sharedPreferences) { + int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); + if (bean.user!.id == userId) { + Get.toNamed(AppRoutes.UserInfoActivity); + } else { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: bean.user!.id!.toString()); + } + }); + + // if (bean.isQueen) { + // showJoinCiclePiker(cicleId); + // } else { + //跳转消息页面 + // Get.bottomSheet(Open_vip_tipPage(), + // isScrollControlled: true, + // enableDrag: false, + // ); + // } + } + + 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); + return; + } + + var sp = await SharedPreferencesHelper.getInstance(); + String myUserId = sp.getMyUserId(); + if (bean.user!.id.toString() == myUserId) { + showOKToast('无法与自己私聊'); + return; + } + // if () + + var data = await DioManager.instance.get( + url: "/up-service/callout/${bean.id}/chat", + ); + if (data["code"] == 200) { + 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(); + // SharedPreferencesHelper.getInstance().then((sharedPreferences) { + int userId = + sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; + String avatar = + sharedPreferences.getString(SharedPreferencesHelper.AVATAR) ?? ""; + String name = + sharedPreferences.getString(SharedPreferencesHelper.NAME) ?? ""; + + bool isContain = false; + for (var info in bean.chat!.users!) { + if (info.id == userId) { + isContain = true; + } + } + if (!isContain) { + bean.chat!.users! + .add(Users(avatar: avatar, id: userId, nickname: name)); + bean.chat!.count = bean.chat!.count! + 1; + widget.logic.update(); + } + } + } + + @override + Widget build(BuildContext context) { + if (widget.bean.image.isEmpty) { + loadCircleInfo(); + } + List urlList = widget.bean.lastJoinUsers; + List widgets = []; + int i = 0; + // print(urlList); + if (null != urlList) { + urlList.forEach((element) { + if (widgets.length > 2) { + return; + } + widgets.add(Positioned( + left: 15.sp * i, + child: circleWidget( + element.avatar! ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + element.id.toString()), + )); + i++; + }); + } + + return !callOutMore && lists.isEmpty ? noResultWidget() : SmartRefresher( + controller: refreshController, + // onRefresh: refreshData, + enablePullDown:false, + onLoading: loadMore, + enablePullUp: true, + + child:ListView.builder( + physics: isEnd + ? BouncingScrollPhysics() + : NeverScrollableScrollPhysics(), + addAutomaticKeepAlives: false, + addRepaintBoundaries: false, + scrollDirection: Axis.vertical, + controller: scrollController, + itemCount: lists.length, + itemBuilder: (context, index) { + + Lists list = lists[index]; + if (list.isQueen!) { + return vipDynamicItem(list); + } else { + return normalDynamicItem(list); + } + }), + ); + } + + ///至尊喊话 + vipDynamicItem(Lists lists) { + Widget descText = widget.logic.openCallOutIdList.contains(lists.id) + ? Text( + lists.content!, + 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; + List widgets = []; + int index = 0; + for (var element in lists.chat!.users!) { + widgets.add(Positioned( + left: 12.sp * index, + child: circleWidget(element.avatar!, element.id.toString(), width: 24), + )); + index++; + } + if (widgets.isNotEmpty) { + widgets.add(Positioned( + left: 12.sp * lists.chat!.users!.length, + child: Image.asset( + getCircleImage('more'), + width: 24.sp, + ))); + } + + double picHeight = 0.0; + + if (lists.album != null) { + if (lists.album!.isNotEmpty) { + Album info = lists.album!.first; + + if (info.type == 1) { + double picWidth = (Get.width - + (widget.logic.runtimeType == LikeLogic + ? 100.sp + : 60.sp)) / + 3 + + 45; + if (lists.album!.length > 3) { + picHeight = picWidth * 2; + } else { + picHeight = picWidth; + } + } else { + picHeight = 200.sp; + } + } + } + + // double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; + + return Container( + margin: EdgeInsets.only(bottom: 10.sp), + width: Get.width, + // height: widgetHeight, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('pic_bg'), + ))), + child: Stack(children: [ + Positioned( + left: 0, + top: 2.sp, + height: 18.sp, + child: Image.asset(getCircleImage('vip_say')), + ), + Positioned( + right: 2.sp, + top: 2.sp, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + alignment: Alignment.center, + height: 28.sp, + decoration: BoxDecoration( + color: Color.fromRGBO(52, 41, 67, 1), + 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 ?? '外星'), + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ) + ], + ), + ), + Container( + // height: widgetHeight, + width: Get.width, + padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () async { + var sp = + await SharedPreferencesHelper.getInstance(); + String myUserId = sp.getMyUserId(); + + if (lists.user?.id!.toString() == myUserId) { + Get.toNamed(AppRoutes.UserInfoActivity); + return; + } + if (widget.bean.is_limit && + widget.bean.amount > 0) { + await refreshCircleData(); + } + if (widget.bean.is_limit && + widget.bean.amount > 0) { + showJoinCiclePiker( + widget.bean.id.toString(), + widget.bean.amount.toString(), + widget.bean.oldAmount.toString(), + 1, (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; + } + pushHomePage(lists, lists.id.toString()); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl: lists.user!.avatar_thumb!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + ), + ) + ], + )), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + 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( + height: 4.sp, + ), + 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, + ), + ), + ) + ], + ), + ], + ), + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + Listener( + child: Container( + height: picHeight, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 200.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) + : AbsorbPointer( + absorbing: !scrollController.position.maxScrollExtent.isFinite, // ListView无法滚动时,阻止GridView获取滑动事件 + child: GridView.builder( + controller: GridScrollController, + itemCount: lists.album!.length, + scrollDirection: Axis.vertical, + 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 + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + errorWidget: (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + }), + ), + ), + ), + Container( + height: 30.sp, + padding: EdgeInsets.only(left: 5.sp, right: 10.sp), + margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 5.sp,bottom: 10.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.sp), + color: Color(0x33000000)), + child: Row( + children: [ + widgets.isNotEmpty + ? SizedBox( + 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), + )) + : Expanded( + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), + GestureDetector( + onTap: () { + pushMsgPage( + lists, + widget.bean.id.toString(), + ); + }, + child: Image.asset( + getCircleImage('chat'), + width: 60.sp, + ), + ) + ], + ), + ) + ], + ), + ) + ])); + } + + ///普通图文喊话 + normalDynamicItem(Lists lists) { + Widget descText = widget.logic.openCallOutIdList.contains(lists.id) + ? Text( + lists.content!, + 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; + double picWidth = + (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 (info.type == 1) { + if (lists.album!.length > 3) { + picHeight = picWidth * 2; + } else { + picHeight = picWidth; + } + } else { + picHeight = 200.sp; + } + } + } + + List widgets = []; + int index = 0; + lists.chat!.users!.forEach((element) { + widgets.add(Positioned( + left: 12.sp * index, + child: circleWidget(element.avatar!, element.id.toString(), width: 24), + )); + index++; + }); + if (widgets.isNotEmpty) { + widgets.add(Positioned( + left: 12.sp * lists.chat!.users!.length, + child: Image.asset( + getCircleImage('more'), + width: 24.sp, + ))); + } + return Container( + margin: EdgeInsets.only(bottom: 10.sp), + width: Get.width, + // height: 120.sp + contentHeight(lists.content!) + picHeight, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('normal_bg'), + ))), + child: Stack( + children: [ + Positioned( + right: 2.sp, + top: 2.sp, + child: Stack( + alignment: Alignment.center, + children: [ + // Image.asset( + // getCircleImage('location'), + // height: 30.sp, + // ), + Container( + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + alignment: Alignment.center, + height: 28.sp, + decoration: BoxDecoration( + color: Color.fromRGBO(52, 41, 67, 1), + 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 ?? '外星'), + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ) + ], + ), + // height: 18.sp, + ), + Container( + width: Get.width, + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + child: Column( + children: [ + SizedBox( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () async { + var sp = + await SharedPreferencesHelper.getInstance(); + String myUserId = sp.getMyUserId(); + if (lists.user?.id!.toString() == myUserId) { + Get.toNamed(AppRoutes.UserInfoActivity); + return; + } + if (widget.bean.is_limit && + widget.bean.amount > 0) { + await refreshCircleData(); + } + + if (widget.bean.is_limit && + widget.bean.amount > 0) { + showJoinCiclePiker( + widget.bean.id.toString(), + widget.bean.amount.toString(), + widget.bean.oldAmount.toString(), + 1, (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; + } + pushHomePage(lists, lists.id.toString()); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl: lists.user!.avatar_thumb!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + // + // , + ), + ) + ], + )), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + 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( + height: 4.sp, + ), + 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, + ), + ), + ) + ], + ), + ], + ), + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + picHeight > 0 + ? Container( + height: picHeight, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 200.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) + : GridView.builder( + controller: GridScrollController, + 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 + }); + }, + child: ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + errorWidget: (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + })) + : Container(), + Container( + height: 30.sp, + padding: EdgeInsets.only( + left: 5.sp, + right: 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)), + child: Row( + children: [ + widgets.isNotEmpty + ? SizedBox( + 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), + )) + : Expanded( + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), + GestureDetector( + onTap: () async { + pushMsgPage(lists, widget.bean.id.toString()); + + // }); + }, + child: Image.asset( + getCircleImage('chat'), + width: 60.sp, + )) + ], + ), + ), + ], + ), + ), + // Positioned( + // bottom: 0, + // child: Container( + // width: Get.width - 26.sp, + // child: circleInfoItem(), + // )) + ], + )); + } + + circleInfoItem() { + return ClipRRect( + borderRadius: BorderRadius.circular(10.sp), + child: Container( + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + height: 72.sp, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage(getCircleImage('top_circle_bg')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: widget.bean.image, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + scrollController.animateTo( + 0.0, // Scroll to the top + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }, + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.bean.title, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + height: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + ), + )), + GestureDetector( + //加入圈子 + onTap: () async { + if (widget.bean.isJoin) { + Get.bottomSheet(CircleShare('', '', widget.bean), + isScrollControlled: true, enableDrag: false); + } else { + await widget.logic.outCircle( + widget.bean.id.toString(), widget.bean.isJoin); + widget.logic.update(); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Opacity( + opacity: 0.5, + child: Image.asset( + getCircleImage('add'), + width: 60.sp, + ), + ), + Text( + !widget.bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle(color: Colors.white, fontSize: 12.sp), + ) + ], + )) + ], + ), + )); + } + + circleWidget(String url, String userId, {double width = 24}) { + return GestureDetector( + onTap: () async { + if (widget.bean.is_limit && widget.bean.amount > 0) { + await refreshCircleData(); + } + if (widget.bean.is_limit && widget.bean.amount > 0) { + showJoinCiclePiker( + widget.bean.id.toString(), + widget.bean.amount.toString(), + widget.bean.oldAmount.toString(), + 1, (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; + } + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: width.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl: url ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + width: (width - 1).sp, + height: (width - 1).sp, + fit: BoxFit.cover, + ), + ) + ], + )); + } + + void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 160.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: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + "是否确认退出该圈子。", + 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: 30.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: 52.sp, + right: 52.sp), + child: Text( + "否", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ), + SizedBox(width: 24.sp), + GestureDetector( + onTap: () async { + Navigator.pop(context); + await widget.logic + .outCircle(bean.id.toString(), bean.isJoin); + // widget.logic.update(); + }, + 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: Text( + "是", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } + + double contentHeight(String content) { + return calculateTextHeight( + content, + 17.sp, + FontWeight.w300, + Get.currentRoute == AppRoutes.Home + ? Get.width - 90.sp + : Get.width - 64.sp, + 100); + } + + refreshCircleData() async { + // var routePath = Get.currentRoute; + // if (routePath == AppRoutes.Signal_circle_list) return; + + var data = await DioManager.instance + .get(url: 'up-service/interest/${widget.bean.id}'); + if (data['code'] == 200) { + widget.bean = Circle.fromJson(data['data']); + // widget.logic.updateCircleInfo(widget.bean); + // setState(() { + // + // }); + // final logic = Get.put(CircleLogic()); + // logic.update(); + } else if (data['code'] == 404) { + var logic = Get.put(CircleLogic()); + showOKToast('网络不流畅哦,请检查网络情况'); + logic.circle.lists.removeAt(logic.state.index); + logic.update(); + } + } +} + +class RightScrollViewIsEnd { + bool isEnd; + RightScrollViewIsEnd(this.isEnd); +} + + +class RightScrollViewScrollTop {} + +class RightRefreshContrller { +int index; +RightRefreshContrller(this.index); +} \ No newline at end of file diff --git a/circle_app/lib/app/friendslist/view.dart b/circle_app/lib/app/friendslist/view.dart index ad1b539..a3c29b0 100644 --- a/circle_app/lib/app/friendslist/view.dart +++ b/circle_app/lib/app/friendslist/view.dart @@ -362,19 +362,11 @@ class _FriendslistPageState extends State Stack( children: [ ClipOval( - child: GestureDetector( - onTap: () { - var imgList = []; - imgList.add(item.avatar); - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imgList, 'index': 0}); - }, - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.avatarThumb, - width: 53.sp, - height: 53.sp, - ), + child: CachedNetworkImage( + fit: BoxFit.cover, + imageUrl: item.avatarThumb, + width: 53.sp, + height: 53.sp, ), ), Positioned( diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index f02e848..4a7a821 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; - import 'package:circle_app/app/chat/widget/svg_dialog.dart'; import 'package:circle_app/app/circle/logic.dart'; import 'package:circle_app/app/minefragment/logic.dart'; @@ -38,6 +37,7 @@ import '../invite/logic.dart'; import '../minefragment/view.dart'; import '../msg/view.dart'; import 'state.dart'; +import 'package:intl/intl.dart'; class HomeLogic extends GetxController with WidgetsBindingObserver { late TabController tabController; @@ -61,8 +61,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { StreamSubscription? sub; - bool isUpdateVersion = false; - + bool isUpdateVersion = false; bool isProd = true; @@ -76,8 +75,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { // TODO: implement onClose super.onClose(); connectivitySub.cancel(); - TencentImSDKPlugin.v2TIMManager - .v2TIMMessageManager.removeAdvancedMsgListener(); + TencentImSDKPlugin.v2TIMManager.v2TIMMessageManager + .removeAdvancedMsgListener(); WidgetsBinding.instance.removeObserver(this); sub!.cancel(); } @@ -101,24 +100,20 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { loadMyInfoData(); - sub = EventBusManager.on().listen((event) { getUnreadSize(); }); WidgetsBinding.instance.addObserver(this); - + addMsgListener(); checkVersion(); loadMyCircleData(); initWxApi(); - } - - void addMsgListener() { msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: ( msgID, @@ -132,106 +127,149 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { V2TimUserInfo sender, String customData, ) { - if (sender.userID == "qpqz_dev_10_10000000000" || sender.userID == "qpqz_prod_10_10000000000") { - if(customData.isEmpty){ + if (customData.isEmpty) { return; } - print("123123123123"+customData); + print("123123123123" + customData); Map jsonData = json.decode(customData); - int event = jsonData['event']; + int event = jsonData['event']; Map content = jsonData['content']; - switch(event) { - case 1://关注 - String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - if(content['isFollow']==1){//互关 - showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],3,(){ + switch (event) { + case 1: //关注 + String ageMsg = + "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; + if (content['isFollow'] == 1) { + //互关 + showFloatingButtonOverlay(Get.context!, content['nickname'], + ageMsg, content['avatarThumb'], 3, () { + pushChatPage(content['id'].toString(), content['imId'], + content['nickname']); + }); + } else { + showFloatingButtonOverlay(Get.context!, content['nickname'], + ageMsg, content['avatarThumb'], 1, () { + setLike(content['id'].toString()); + }); + } + + break; + case 2: //上线 + + String ageMsg = + "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; + + showFloatingButtonOverlay(Get.context!, content['nickname'], ageMsg, + content['avatarThumb'], 2, () { pushChatPage(content['id'].toString(), content['imId'], content['nickname']); }); - }else{ - showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],1,(){ - setLike(content['id'].toString()); - }); - } - - break; - case 2://上线 - - String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - - showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],2,(){ - pushChatPage(content['id'].toString(), content['imId'], - content['nickname']); - }); - break; - case 9://有新人加入 - { - CircleLogic logic = Get.find(); - logic.isNewPeopleRed = true; - logic.update(); - } - break; - case 8://有新的喊话 - { - World_call_outLogic logic = Get.find(); - logic.isNewMsg = true; - logic.update(); - } - break; - } - + break; + case 9: //有新人加入 + { + CircleLogic logic = Get.find(); + logic.isNewPeopleRed = true; + logic.update(); + } + break; + case 8: //有新的喊话 + { + World_call_outLogic logic = Get.find(); + logic.isNewMsg = true; + logic.update(); + } + break; + case 10: //有新访客 + { + MsgLogic logic = Get.find(); + logic.getMode(); + } + break; + } } }); + TencentImSDKPlugin.v2TIMManager.v2TIMMessageManager.addAdvancedMsgListener( + listener: V2TimAdvancedMsgListener(onRecvNewMessage: (message) { + getUnreadSize(); + print(message); + if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) { + if (message.customElem?.data != null) { + print(message.customElem!.data!); + Map jsonData = jsonDecode(message.customElem!.data!); + if (jsonData.containsKey('event')) { + String event = jsonData['event'].toString(); - TencentImSDKPlugin.v2TIMManager - .v2TIMMessageManager.addAdvancedMsgListener( - listener: V2TimAdvancedMsgListener( - onRecvNewMessage: (message) { - getUnreadSize(); - print(message); - if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) { - if ( message.customElem?.data != null) { - print(message.customElem!.data!); - Map jsonData = jsonDecode(message.customElem!.data!); - if (jsonData.containsKey('event')) { - String event = jsonData['event'].toString(); - if (int.parse(event) == 3) { - showOKToast(message.customElem!.desc!.toString()); - EventBusManager.fire(LikeRefresh()); - } else if (int.parse(event) == 5) { - - // print(jsonData.toString()); - var info = jsonDecode(jsonData['content']); - TencentImSDKPlugin.v2TIMManager.v2ConversationManager.pinConversation(conversationID: 'c2c_' + info['fromImId'], isPinned: info['top'] == 1); - } - } else if (jsonData.containsKey('type')) { - int type = jsonData['type']; - if (type == 1) { - String giftUrl = jsonData['gifUrl']; - if (giftUrl.isNotEmpty) { - Get.bottomSheet(SvgDialog(url: giftUrl),isScrollControlled: true, - enableDrag: false,isDismissible:false); - } - - } + if (int.parse(event) == 1) { + Map content = jsonData['content']; + String ageMsg = + "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; + if (content['isFollow'] == 1) { + //互关 + showFloatingButtonOverlay(Get.context!, content['nickname'], + ageMsg, content['avatarThumb'], 3, () { + pushChatPage(content['id'].toString(), content['imId'], + content['nickname']); + }); + } else { + showFloatingButtonOverlay(Get.context!, content['nickname'], + ageMsg, content['avatarThumb'], 1, () { + setLike(content['id'].toString()); + }); } + } else if (int.parse(event) == 2) { + Map content = jsonData['content']; + String ageMsg = + "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; + showFloatingButtonOverlay(Get.context!, content['nickname'], + ageMsg, content['avatarThumb'], 2, () { + pushChatPage(content['id'].toString(), content['imId'], + content['nickname']); + }); + } else if (int.parse(event) == 3) {//喜欢列表刷新 + showOKToast(message.customElem!.desc!.toString()); + EventBusManager.fire(LikeRefresh()); + } else if (int.parse(event) == 5) {//有人送礼会话置顶 + // print(jsonData.toString()); + var info = jsonDecode(jsonData['content']); + TencentImSDKPlugin.v2TIMManager.v2ConversationManager + .pinConversation( + conversationID: 'c2c_' + info['fromImId'], + isPinned: info['top'] == 1); + } else if (int.parse(event) == 9) {//有新人加入 + CircleLogic logic = Get.find(); + logic.isNewPeopleRed = true; + logic.update(); + } else if (int.parse(event) == 8) {//有新的喊话 + World_call_outLogic logic = Get.find(); + logic.isNewMsg = true; + logic.update(); + } else if (int.parse(event) == 10) {//有新访客 + MsgLogic logic = Get.find(); + logic.getMode(); + } + } else if (jsonData.containsKey('type')) { + int type = jsonData['type']; + if (type == 1) { + String giftUrl = jsonData['gifUrl']; + if (giftUrl.isNotEmpty) { + Get.bottomSheet(SvgDialog(url: giftUrl), + isScrollControlled: true, + enableDrag: false, + isDismissible: false); + } } } } - ) - ); - - + } + })); _messageService.addSimpleMsgListener(listener: msgListener); } - @override void didChangeAppLifecycleState(AppLifecycleState state) { switch (state) { @@ -250,9 +288,6 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } } - - - Future checkVersion() async { var data = await DioManager.instance.get(url: Api.APP_VERSION); var bean = BaseResponse.fromJson( @@ -263,25 +298,25 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } setLike(String userId) async { - var data = await DioManager.instance.post( - url: "${Api.setLike + userId}/follow", - params: {'status': "1"}); + var data = await DioManager.instance + .post(url: "${Api.setLike + userId}/follow", params: {'status': "1"}); var bean = BaseResponse.fromJson( data, - (jsonData) => jsonData, + (jsonData) => jsonData, ); if (bean.isSuccess()) { update(); } showOKToast(bean.msg); } + getUnreadSize() async { if (coreInstance.isLoginSuccess) { try { V2TimValueCallback getTotalUnreadMessageCountRes = - await TencentImSDKPlugin.v2TIMManager - .getConversationManager() - .getTotalUnreadMessageCount(); + await TencentImSDKPlugin.v2TIMManager + .getConversationManager() + .getTotalUnreadMessageCount(); print("未读数量desc=" + getTotalUnreadMessageCountRes.desc.toString() + "code=" + @@ -290,15 +325,13 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { getTotalUnreadMessageCountRes.data.toString()); if (getTotalUnreadMessageCountRes.code == 0) { - if (getTotalUnreadMessageCountRes.data.toString() != unreadSIze.value) { + if (getTotalUnreadMessageCountRes.data.toString() != + unreadSIze.value) { unreadSIze.value = getTotalUnreadMessageCountRes.data.toString(); } } } catch (e) {} - - } - } @override @@ -323,11 +356,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { super.onReady(); FlutterNativeSplash.remove(); - updateIndex(1); final logic = Get.find(); logic.loadCirclePeopleData(); - - } addBadge() { @@ -354,7 +384,6 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { if (!coreInstance.isLoginSuccess) { var data = await DioManager.instance.get(url: Api.getIMInfo); if (data['code'] == 200) { - loginIM( data['data']['account_id'].toString(), data['data']['user_sig']); accountId = data['data']['account_id'].toString(); @@ -379,24 +408,22 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } else if (index == 4) { final logic = Get.put(MinefragmentLogic()); logic.getMode(); - } else if (index == 3) { + } else if (index == 3) { final logic = Get.find(); EventBusManager.fire(MsgRecommendCardRefresh()); logic.loadChatData(); + logic.getVisitorMsgData(); } update(); } void setFirstData() async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - sharedPreferences.setString( - SharedPreferencesHelper.firstLogin, '1'); - + sharedPreferences.setString(SharedPreferencesHelper.firstLogin, '1'); } loadMyCircleData() async { - var data = await DioManager.instance - .get(url: Api.getMyCircleAll); + var data = await DioManager.instance.get(url: Api.getMyCircleAll); // var bean = BaseResponse.fromJson( // data, (data) => InterestsBean.fromJson(data)); @@ -411,7 +438,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { }); mycircle.lists = infoList; if (currentIndex >= mycircle.lists.length - 1) { - currentIndex = mycircle.lists.length -1; + currentIndex = mycircle.lists.length - 1; } loadCalloutsNew(); @@ -424,9 +451,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { mycircle.lists.forEach((element) { idList.add(element.id.toString()); }); - var data = await DioManager.instance.post( - url:Api.calloutsNew, - params: {"interestIds":idList}); + var data = await DioManager.instance + .post(url: Api.calloutsNew, params: {"interestIds": idList}); if (data['code'] == 200) { List infoList = data['data']; @@ -444,22 +470,25 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { /// 设置网络切换监听 connectListener() { - connectivitySub = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { - if (result == ConnectivityResult.none) { - if (currentIndex == 0) { - var logic = Get.put(CircleLogic()); - logic.loadData(); - } else if (currentIndex == 1) { - var logic = Get.put(LikeLogic()); - logic.loadData(); - } else if (currentIndex == 3) { - final logic = Get.find(); - logic.loadData(); - } else if (currentIndex == 4) { - var logic = Get.put(MinefragmentLogic()); - logic.loadData(); - } - }}); + connectivitySub = Connectivity() + .onConnectivityChanged + .listen((ConnectivityResult result) { + if (result == ConnectivityResult.none) { + if (currentIndex == 0) { + var logic = Get.put(CircleLogic()); + logic.loadData(); + } else if (currentIndex == 1) { + var logic = Get.put(LikeLogic()); + logic.loadData(); + } else if (currentIndex == 3) { + final logic = Get.find(); + logic.loadData(); + } else if (currentIndex == 4) { + var logic = Get.put(MinefragmentLogic()); + logic.loadData(); + } + } + }); } void loadEnvTypeData() async { @@ -482,25 +511,45 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { inviteCode = info.data!.inviteCode!; link = info.data!.link!; } - currentIndex = bean.data.isNewUser ? 1 : 0; + bool isGreaterThan30Days = isDifferenceGreaterThan30Days( + (model!.createTime?.isNotEmpty ?? false) + ? model!.createTime! + : DateTime.now().toString()); + + if (isGreaterThan30Days) { + currentIndex = 0; + } else { + currentIndex = 1; + } updateIndex(currentIndex); update(); } } + bool isDifferenceGreaterThan30Days(String dateString) { + // 获取当前时间 + DateTime now = DateTime.now(); + // 使用日期格式化对象来解析给定的时间字符串 + DateFormat format = DateFormat("yyyy-MM-dd"); + DateTime date = format.parse(dateString); + // 计算日期差异 + Duration difference = now.difference(date); - + // 检查差异是否超过30天 + if (difference.inDays.abs() > 30) { + return true; + } else { + return false; + } + } } - class conTop { bool isTop; String conId; - conTop(this.isTop,this.conId); + conTop(this.isTop, this.conId); } -class MsgRecommendCardRefresh { - -} \ No newline at end of file +class MsgRecommendCardRefresh {} diff --git a/circle_app/lib/app/likelist/view.dart b/circle_app/lib/app/likelist/view.dart index 03fae45..4ae0857 100644 --- a/circle_app/lib/app/likelist/view.dart +++ b/circle_app/lib/app/likelist/view.dart @@ -334,19 +334,11 @@ class _LikelistPageState extends State with RouteAware { Stack( children: [ ClipOval( - child: GestureDetector( - onTap: () { - var imgList = []; - imgList.add(item.user.avatar); - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imgList, 'index': 0}); - }, - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 53.sp, - height: 53.sp, - ), + child: CachedNetworkImage( + fit: BoxFit.cover, + imageUrl: item.user.avatarThumb, + width: 53.sp, + height: 53.sp, ), ), Positioned( diff --git a/circle_app/lib/app/minefragment/logic.dart b/circle_app/lib/app/minefragment/logic.dart index 7be0d70..6e47a0a 100644 --- a/circle_app/lib/app/minefragment/logic.dart +++ b/circle_app/lib/app/minefragment/logic.dart @@ -71,6 +71,15 @@ class MinefragmentLogic extends GetxController { } } + getVisitorMsgData() async { + var data = + await DioManager.instance.get(url: Api.getVisitorMsg,); + if (data['code'] == 200) { + recent_visit_count_new = data['data']['unreadCount'] ?? 0; + } + update(); + } + getMode() async { var data = await DioManager.instance.get(url: Api.getUserMine); var bean = BaseResponse.fromJson( @@ -82,21 +91,23 @@ class MinefragmentLogic extends GetxController { joinedCircle = "${"加入了${bean.data.joininterestcount}"}个圈子"; enterHomeInfoMsg = bean.data.mainGuideText; + has_pwd = bean.data.has_pwd; SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); if(bean.data.user.vip>0){ vipMsg = "会员时长剩余${bean.data.vipExpireDays}天"; + } else if (bean.data.last_vip_expire_date != '') { + vipMsg = "会员已于${bean.data.last_vip_expire_date.toString().split(' ').first}到期"; } int likeMeCount = sharedPreferences.getInt(SharedPreferencesHelper.LIKEMECOUNT)??0; - int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; + // int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; sharedPreferences.setString(SharedPreferencesHelper.PHOTO, bean.data.phone); like_me_count_new = like_me_count - likeMeCount; print("***************"); print("$likeMeCount-$like_me_count=$like_me_count_new"); - recent_visit_count_new = recent_visit_count - recentVisitCount; // like_me_count_new = recentVisitCount.toInt() - bean.data.likeMeCount.toInt(); @@ -121,7 +132,7 @@ class MinefragmentLogic extends GetxController { ageMsg = getAgeCOntent(gender, age, role, orientation); } - + getVisitorMsgData(); update(); } else { showOKToast(bean.msg); @@ -154,7 +165,7 @@ class User { double lat; String city; String avatarThumb; - + String? createTime; User({ required this.id, required this.has_pwd, @@ -172,6 +183,7 @@ class User { required this.lat, required this.city, required this.avatarThumb, + this.createTime, }); factory User.fromJson(Map json) { @@ -179,6 +191,7 @@ class User { id: json['id'], mark: json['mark'] ?? 0, has_pwd: json['has_pwd'] ?? false, + createTime: json['createTime'] ?? '', nickname: json['nickname'], avatar: json['avatar'], signature: json['signature'], @@ -202,6 +215,8 @@ class MineResponseBean { int likeMeCount; int recentVisitCount; String? vipExpireDate; + // "createTime" -> "2023-10-09T09:07:20.000+00:00" + String? last_vip_expire_date; int? vipExpireDays; bool? has_pwd; bool isNewUser; @@ -216,6 +231,7 @@ class MineResponseBean { required this.recentVisitCount, this.vipExpireDate, required this.isNewUser, + required this.last_vip_expire_date, this.vipExpireDays, required this.phone, required this.has_pwd, @@ -226,6 +242,7 @@ class MineResponseBean { return MineResponseBean( user: User.fromJson(json['user']), likeCount: json['like_count'], + last_vip_expire_date: json['last_vip_expire_date'] ?? '', has_pwd: json['has_pwd'], isNewUser : json['isNewUser'] ?? false, phone: json['phone'], diff --git a/circle_app/lib/app/minefragment/view.dart b/circle_app/lib/app/minefragment/view.dart index 48eb81e..2280d61 100644 --- a/circle_app/lib/app/minefragment/view.dart +++ b/circle_app/lib/app/minefragment/view.dart @@ -20,6 +20,7 @@ import '../../common/colors/app_color.dart'; import '../../main.dart'; import '../../util/SharedPreferencesHelper.dart'; import '../../util/util.dart'; +import '../msg/logic.dart'; import 'logic.dart'; const vipIcon = 'assets/images/home/icon_vip_more.png'; @@ -144,7 +145,7 @@ class _MinefragmentPageState extends State with RouteAware { ), ), if (!logic.isProxy) - Image.asset(getHomeImage(logic.isVip.value == 0 ? 'open_vip' : 'pay_vip'),height: 28.sp,), + Image.asset(getHomeImage(logic.vipMsg.contains('十几种') ? 'open_vip' : 'pay_vip'),height: 28.sp,), ], ), )), @@ -669,7 +670,7 @@ class _MinefragmentPageState extends State with RouteAware { ), Positioned( right: 0.sp, - top: 15.sp, + top: 6.sp, child: Text( logic.like_me_count_new>0 ? "+${logic.like_me_count_new}":"", style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)), @@ -685,6 +686,9 @@ class _MinefragmentPageState extends State with RouteAware { SharedPreferencesHelper.getInstance().then((sharedPreferences) { sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, logic.recent_visit_count); }); + MsgLogic msgLogic = Get.find(); + msgLogic.updateVisitCount(); + Get.toNamed(AppRoutes.VisitorListActivity); }, child: Stack( @@ -725,7 +729,7 @@ class _MinefragmentPageState extends State with RouteAware { ), Positioned( right: 0.sp, - top: 15.sp, + top: 6.sp, child: Text( logic.recent_visit_count_new>0 ? "+${logic.recent_visit_count_new}":"", style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)), 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 3d2a610..0ad46bd 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -30,6 +30,7 @@ import '../../../router/app_routers.dart'; import '../../../util/eventBus.dart'; import '../../../util/util.dart'; import '../../circle/widgets/discover.dart'; +import '../logic.dart'; import '../recommend_circle_friend_item.dart'; import 'tim_uikit_conversation_item.dart'; @@ -38,7 +39,7 @@ typedef TIMConversationItemBuilder = Widget Function( [V2TimUserStatus? onlineStatus]); typedef ConversationItemSlideBuilder = List - Function(V2TimConversation conversationItem); +Function(V2TimConversation conversationItem); typedef ConversationItemSecondaryMenuBuilder = Widget Function( V2TimConversation conversationItem, VoidCallback onClose); @@ -84,21 +85,20 @@ class TIMConversation extends StatefulWidget { /// to meet the identifier shows here. final bool isShowDraft; - const TIMConversation( - {Key? key, - this.lifeCycle, - this.onTapItem, - this.controller, - this.autoScrollController, - this.itemSecondaryMenuBuilder, - this.scrollController, - this.itemBuilder, - this.isShowDraft = true, - this.itemSlideBuilder, - this.conversationCollector, - this.emptyBuilder, - this.lastMessageBuilder, - this.isShowOnlineStatus = true}) + const TIMConversation({Key? key, + this.lifeCycle, + this.onTapItem, + this.controller, + this.autoScrollController, + this.itemSecondaryMenuBuilder, + this.scrollController, + this.itemBuilder, + this.isShowDraft = true, + this.itemSlideBuilder, + this.conversationCollector, + this.emptyBuilder, + this.lastMessageBuilder, + this.isShowOnlineStatus = true}) : super(key: key); @override @@ -118,7 +118,8 @@ class ConversationItemSlidePanel extends TIMUIKitStatelessWidget { this.icon, this.spacing = 4, this.label, - }) : assert(flex > 0), + }) + : assert(flex > 0), assert(icon != null || label != null), super(key: key); @@ -163,17 +164,20 @@ class ConversationItemSlidePanel extends TIMUIKitStatelessWidget { } class _TIMConversationState extends TIMUIKitState { + MsgLogic logic = Get.find(); final TUIConversationViewModel model = - serviceLocator(); + serviceLocator(); late TIMUIKitConversationController _timuiKitConversationController; final TUIThemeViewModel themeViewModel = serviceLocator(); + // final TUIFriendShipViewModel friendShipViewModel = // serviceLocator(); bool hasMore = true; var sub; - List chatImIdList = []; + List chatImIdList = []; Map recommendCircleFriendData = {}; + @override void initState() { super.initState(); @@ -183,7 +187,7 @@ class _TIMConversationState extends TIMUIKitState { widget.scrollController!.addListener(() { try { if (widget.scrollController!.position.pixels == - widget.scrollController!.position.maxScrollExtent && + widget.scrollController!.position.maxScrollExtent && hasMore) { _timuiKitConversationController.loadData(); } @@ -243,8 +247,8 @@ class _TIMConversationState extends TIMUIKitState { String prodTargetUserID = "qpqz_prod_10_10000000000"; filteredConversationList = filteredConversationList .where((conversation) => - conversation?.userID != devtTargetUserID && - conversation?.userID != prodTargetUserID) + conversation?.userID != devtTargetUserID && + conversation?.userID != prodTargetUserID) .toList(); if (widget.conversationCollector != null) { @@ -276,8 +280,8 @@ class _TIMConversationState extends TIMUIKitState { } } - Widget _defaultSecondaryMenu( - V2TimConversation conversationItem, VoidCallback onClose) { + Widget _defaultSecondaryMenu(V2TimConversation conversationItem, + VoidCallback onClose) { return TUIKitColumnMenu(data: [ if (!PlatformUtils().isWeb) ColumnMenuItem( @@ -309,8 +313,7 @@ class _TIMConversationState extends TIMUIKitState { } List _defaultSlideBuilder( - V2TimConversation conversationItem, - ) { + V2TimConversation conversationItem,) { final theme = themeViewModel.theme; return [ if (!PlatformUtils().isWeb) @@ -330,7 +333,7 @@ class _TIMConversationState extends TIMUIKitState { _pinConversation(conversationItem); }, backgroundColor: - theme.conversationItemSliderPinBgColor ?? CommonColor.infoColor, + theme.conversationItemSliderPinBgColor ?? CommonColor.infoColor, foregroundColor: theme.conversationItemSliderTextColor, label: conversationItem.isPinned! ? TIM_t("取消置顶") : TIM_t("置顶"), ), @@ -339,15 +342,15 @@ class _TIMConversationState extends TIMUIKitState { _deleteConversation(conversationItem); }, backgroundColor: - theme.conversationItemSliderDeleteBgColor ?? Colors.red, + theme.conversationItemSliderDeleteBgColor ?? Colors.red, foregroundColor: theme.conversationItemSliderTextColor, label: TIM_t("删除"), ) ]; } - Widget _getSecondaryMenu( - V2TimConversation conversation, VoidCallback onClose) { + Widget _getSecondaryMenu(V2TimConversation conversation, + VoidCallback onClose) { if (widget.itemSecondaryMenuBuilder != null) { return widget.itemSecondaryMenuBuilder!(conversation, onClose); } @@ -360,7 +363,6 @@ class _TIMConversationState extends TIMUIKitState { Future> getUserListInfo( List userIdList) async { - V2TimValueCallback getLoginUserRes = await TencentImSDKPlugin.v2TIMManager.getLoginUser(); if (getLoginUserRes.code == 0) { @@ -374,22 +376,24 @@ class _TIMConversationState extends TIMUIKitState { List list = []; double count = userIdList.length / 100; int size = count.toInt(); - - + + if (count > size) { for (int i = 0; i <= size; i++) { - List dataList = await getUserListData(userIdList.sublist(i + i * 100, i == size ? userIdList.length : (i + 1) * 100)); + List dataList = await getUserListData( + userIdList.sublist( + i + i * 100, i == size ? userIdList.length : (i + 1) * 100)); list.addAll(dataList); } } else { for (int i = 0; i < size; i++) { - List dataList = await getUserListData(userIdList.sublist(i + i * 100,(i + 1) * 100 )); + List dataList = await getUserListData( + userIdList.sublist(i + i * 100, (i + 1) * 100)); list.addAll(dataList); } } return list; } else { - //获取用户资料 V2TimValueCallback> getUsersInfoRes = await TencentImSDKPlugin.v2TIMManager @@ -411,14 +415,14 @@ class _TIMConversationState extends TIMUIKitState { return getUsersInfoRes.data ?? []; } } - + return []; } - - getUserListData(List userIdList) async { + + getUserListData(List userIdList) async { //获取用户资料 V2TimValueCallback> getUsersInfoRes = - await TencentImSDKPlugin.v2TIMManager + await TencentImSDKPlugin.v2TIMManager .getUsersInfo(userIDList: userIdList); //需要查询的用户id列表 if (getUsersInfoRes.code == 0) { // 查询成功 @@ -460,7 +464,7 @@ class _TIMConversationState extends TIMUIKitState { // _model.lifeCycle = widget.lifeCycle; List filteredConversationList = - getFilteredConversation(); + getFilteredConversation(); if (TencentUtils.checkString(_model.scrollToConversation) != null) { _onScrollToConversation(_model.scrollToConversation!); @@ -476,162 +480,223 @@ class _TIMConversationState extends TIMUIKitState { Widget conversationList() { return filteredConversationList.isNotEmpty ? FutureBuilder>( - future: getUserListInfo(userIdList), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - return ListView.builder( - controller: widget.scrollController!, - // shrinkWrap: true, - itemCount: recommendCircleFriendData.isNotEmpty && filteredConversationList.length < 15 - ? filteredConversationList.length + 1 - : filteredConversationList.length, - itemBuilder: (context, index) { - if (index == filteredConversationList.length) { - return recommendCircleFriendData.isNotEmpty - ? RecommendCircleFriendItem(true,recommendCircleFriendData: recommendCircleFriendData,getDataCallBack: () { - loadRecommendCircleFriendData(); + future: getUserListInfo(userIdList), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + return ListView.builder( + controller: widget.scrollController!, + // shrinkWrap: true, + itemCount: recommendCircleFriendData.isNotEmpty && + filteredConversationList.length < 15 + ? filteredConversationList.length + 1 + : filteredConversationList.length, + itemBuilder: (context, index) { + if (index == filteredConversationList.length) { + return recommendCircleFriendData.isNotEmpty + ? RecommendCircleFriendItem(true,15.sp, + recommendCircleFriendData: recommendCircleFriendData, + getDataCallBack: () { + loadRecommendCircleFriendData(); }) - : Container(); - } + : Container(); + } - final conversationItem = - filteredConversationList[index]; + final conversationItem = + filteredConversationList[index]; - // final V2TimUserStatus? onlineStatus = - // _friendShipViewModel.userStatusList.firstWhere( - // (item) => - // item.userID == conversationItem?.userID, - // orElse: () => - // V2TimUserStatus(statusType: 0)); + // final V2TimUserStatus? onlineStatus = + // _friendShipViewModel.userStatusList.firstWhere( + // (item) => + // item.userID == conversationItem?.userID, + // orElse: () => + // V2TimUserStatus(statusType: 0)); - // if (widget.itemBuilder != null) { - // return widget.itemBuilder!( - // conversationItem!, onlineStatus); - // } + // if (widget.itemBuilder != null) { + // return widget.itemBuilder!( + // conversationItem!, onlineStatus); + // } - final slideChildren = - _getSlideBuilder()(conversationItem!); + final slideChildren = + _getSlideBuilder()(conversationItem!); - final isCurrent = conversationItem.conversationID == - model.selectedConversation?.conversationID; + final isCurrent = conversationItem.conversationID == + model.selectedConversation?.conversationID; - final isPined = conversationItem.isPinned ?? false; + final isPined = conversationItem.isPinned ?? false; - V2TimUserFullInfo? userFullInfo; - bool isOfficial = false; - bool isSameCity = false; - int mark = 0; - if (snapshot.connectionState == - ConnectionState.done) { - if ((snapshot.data ?? []).isNotEmpty) { - snapshot.data!.forEach((element) { - if (element.userID == - conversationItem.userID) { - userFullInfo = element; - } - }); - //自己的信息 - V2TimUserFullInfo myuserFullInfo = snapshot - .data! - .where((element) => - element.userID! == - model.selfInfoViewModel.loginInfo! - .userID!) - .toList() - .first; + V2TimUserFullInfo? userFullInfo; + bool isOfficial = false; + bool isSameCity = false; + int mark = 0; + if (snapshot.connectionState == + ConnectionState.done) { + if ((snapshot.data ?? []).isNotEmpty) { + snapshot.data!.forEach((element) { + if (element.userID == + conversationItem.userID) { + userFullInfo = element; + } + }); + //自己的信息 + V2TimUserFullInfo myuserFullInfo = snapshot + .data! + .where((element) => + element.userID! == + model.selfInfoViewModel.loginInfo! + .userID!) + .toList() + .first; - if (userFullInfo!.customInfo! - .containsKey('Label')) { - if (userFullInfo!.customInfo!['Label'] - .toString() - .isNotEmpty) { - Map otherInfo = jsonDecode(userFullInfo! - .customInfo!['Label'] - .toString()); - Map myInfo = jsonDecode(myuserFullInfo! - .customInfo!['Label'] - .toString()); + if (userFullInfo!.customInfo! + .containsKey('Label')) { + if (userFullInfo!.customInfo!['Label'] + .toString() + .isNotEmpty) { + Map otherInfo = jsonDecode(userFullInfo! + .customInfo!['Label'] + .toString()); + Map myInfo = jsonDecode(myuserFullInfo! + .customInfo!['Label'] + .toString()); - if (otherInfo.containsKey('mark')) { - mark = otherInfo['mark'] ?? 0; - } - if (myInfo != null) { - if (myInfo.containsKey('city')) { - if (myInfo['city'].toString().contains( - otherInfo['city'].toString())) { - isSameCity = true; - } - } - } - } + if (otherInfo.containsKey('mark')) { + mark = otherInfo['mark'] ?? 0; } - - if (userFullInfo != null) { - List userIdList = - userFullInfo!.userID!.split('_'); - if (userIdList.length >= 4) { - if (int.parse(userIdList[2]) == 10) { - isOfficial = true; - } else { - isOfficial = false; + if (myInfo != null) { + if (myInfo.containsKey('city')) { + if (myInfo['city'].toString().contains( + otherInfo['city'].toString())) { + isSameCity = true; } } } } } - Widget conversationLineItem() { - return Material( - color: Colors.transparent, - child: InkWell( - child: TIMConversationItem( - mark:mark, - isSameCity: isSameCity, - isOfficial: isOfficial, - isCurrent: isCurrent, - userInfo: userFullInfo, - isShowDraft: widget.isShowDraft, - lastMessageBuilder: - widget.lastMessageBuilder, - faceUrl: conversationItem.faceUrl ?? "", - nickName: conversationItem.showName ?? "", - isDisturb: conversationItem.recvOpt != 0, - lastMsg: conversationItem.lastMessage, - isPined: isPined, - groupAtInfoList: - conversationItem.groupAtInfoList ?? - [], - unreadCount: - conversationItem.unreadCount ?? 0, - draftText: conversationItem.draftText, - onlineStatus: (widget - .isShowOnlineStatus && - conversationItem.userID != null && - conversationItem - .userID!.isNotEmpty) - ? null - : null, - draftTimestamp: - conversationItem.draftTimestamp, - convType: conversationItem.type), - onTap: () => onTapConvItem(conversationItem), - ), - ); + if (userFullInfo != null) { + List userIdList = + userFullInfo!.userID!.split('_'); + if (userIdList.length >= 4) { + if (int.parse(userIdList[2]) == 10) { + isOfficial = true; + } else { + isOfficial = false; + } + } } + } + } - return TUIKitScreenUtils.getDeviceWidget( + Widget conversationLineItem() { + return Material( + color: Colors.transparent, + child: InkWell( + child: TIMConversationItem( + mark: mark, + isSameCity: isSameCity, + isOfficial: isOfficial, + isCurrent: isCurrent, + userInfo: userFullInfo, + isShowDraft: widget.isShowDraft, + lastMessageBuilder: + widget.lastMessageBuilder, + faceUrl: conversationItem.faceUrl ?? "", + nickName: conversationItem.showName ?? "", + isDisturb: conversationItem.recvOpt != 0, + lastMsg: conversationItem.lastMessage, + isPined: isPined, + groupAtInfoList: + conversationItem.groupAtInfoList ?? + [], + unreadCount: + conversationItem.unreadCount ?? 0, + draftText: conversationItem.draftText, + onlineStatus: (widget + .isShowOnlineStatus && + conversationItem.userID != null && + conversationItem + .userID!.isNotEmpty) + ? null + : null, + draftTimestamp: + conversationItem.draftTimestamp, + convType: conversationItem.type), + onTap: () => onTapConvItem(conversationItem), + ), + ); + } + + return index == 0 ? Column( + children: [ + GetBuilder(builder: ( + logic) { + return GestureDetector( + onTap: () { + + Get.toNamed(AppRoutes.VisitorListActivity)!.then((value) => logic.getVisitorMsgData()); + }, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + const Color(0x0F4B3E5E), + const Color(0xaF334141) + ])), + padding: const EdgeInsets.only( + top: 6, bottom: 6, left: 16, right: 16), + child: Row( + children: [ + ClipOval(child: Image.network( + 'https://qiniuyun.ikuayou.com/dW5kZWZpbmVkLzE3MTU3ODAxNjM1MDNf5LyB5Lia5b6u5L-h5oiq5Zu-XzNkMzI0MjJkLTJmYWUtNGRmZC04MDQxLTUyZGE2NzBlNzVjMQ==', + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover,)), + SizedBox(width: 10,), + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + children: [ + Text('最近来访', style: TextStyle( + color: Colors.white, + fontSize: 16.sp),), + SizedBox(width: 4.sp,), + Text( + logic.recent_visit_count_new > 0 + ? "+${logic + .recent_visit_count_new}" + : "", + style: const TextStyle( + color: Color.fromRGBO( + 0, 255, 210, 1.0)), + ), + ], + ), + SizedBox(height: 6,), + Text(logic.tip, style: TextStyle( + color: Colors.white.withOpacity( + 0.5), fontSize: 14.sp),), + ], + )) + ], + ), + ), + ); + }), + TUIKitScreenUtils.getDeviceWidget( desktopWidget: AutoScrollTag( key: - ValueKey(conversationItem.conversationID), + ValueKey(conversationItem.conversationID), controller: widget.autoScrollController!, index: index, child: GestureDetector( onSecondaryTapDown: (details) { TUIKitWidePopup.showPopupWindow( operationKey: - TUIKitWideModalOperationKey - .conversationSecondaryMenu, + TUIKitWideModalOperationKey + .conversationSecondaryMenu, isDarkBackground: false, borderRadius: const BorderRadius.all( Radius.circular(4)), @@ -639,25 +704,28 @@ class _TIMConversationState extends TIMUIKitState { offset: Offset( min( details.globalPosition.dx, - MediaQuery.of(context) - .size - .width - + MediaQuery + .of(context) + .size + .width - 80), min( details.globalPosition.dy, - MediaQuery.of(context) - .size - .height - + MediaQuery + .of(context) + .size + .height - 130)), - child: (onClose) => _getSecondaryMenu( - conversationItem, onClose)); + child: (onClose) => + _getSecondaryMenu( + conversationItem, onClose)); }, child: conversationLineItem(), ), ), defaultWidget: AutoScrollTag( key: - ValueKey(conversationItem.conversationID), + ValueKey(conversationItem.conversationID), controller: widget.autoScrollController!, index: index, child: Slidable( @@ -669,12 +737,66 @@ class _TIMConversationState extends TIMUIKitState { : 0.5, motion: const DrawerMotion(), children: slideChildren)), - )); - }); - }) + )) + ], + ) : TUIKitScreenUtils.getDeviceWidget( + desktopWidget: AutoScrollTag( + key: + ValueKey(conversationItem.conversationID), + controller: widget.autoScrollController!, + index: index, + child: GestureDetector( + onSecondaryTapDown: (details) { + TUIKitWidePopup.showPopupWindow( + operationKey: + TUIKitWideModalOperationKey + .conversationSecondaryMenu, + isDarkBackground: false, + borderRadius: const BorderRadius.all( + Radius.circular(4)), + context: context, + offset: Offset( + min( + details.globalPosition.dx, + MediaQuery + .of(context) + .size + .width - + 80), + min( + details.globalPosition.dy, + MediaQuery + .of(context) + .size + .height - + 130)), + child: (onClose) => + _getSecondaryMenu( + conversationItem, onClose)); + }, + child: conversationLineItem(), + ), + ), + defaultWidget: AutoScrollTag( + key: + ValueKey(conversationItem.conversationID), + controller: widget.autoScrollController!, + index: index, + child: Slidable( + groupTag: 'conversation-list', + child: conversationLineItem(), + endActionPane: ActionPane( + extentRatio: slideChildren.length > 2 + ? 0.77 + : 0.5, + motion: const DrawerMotion(), + children: slideChildren)), + )); + }); + }) : (widget.emptyBuilder != null - ? widget.emptyBuilder!() - : recommendCircleFriendData.isNotEmpty + ? widget.emptyBuilder!() + : recommendCircleFriendData.isNotEmpty ? recommendCircleFriendWidget() : Container()); } @@ -696,397 +818,418 @@ class _TIMConversationState extends TIMUIKitState { } recommendCircleFriendWidget() { - try { - var info = {}; + try { + var info = {}; - var user = Users.fromJson(recommendCircleFriendData['user']); + var user = Users.fromJson(recommendCircleFriendData['user']); - // 对方喜欢了你100 - // ·你们有共同喜欢的圈友90 - // ·你喜欢的圈友也喜欢TA80 - // ·你们都在深圳留下过足迹70 - // ·你们有2个共同的圈子:圈子名称、圈子名称60 - // ·我刚来到这里哦55 - // ·可能是你想认识的人50 - // ·很多圈友都喜欢TA40 - // ·TA是乐园优秀圈主哦~30 + // 对方喜欢了你100 + // ·你们有共同喜欢的圈友90 + // ·你喜欢的圈友也喜欢TA80 + // ·你们都在深圳留下过足迹70 + // ·你们有2个共同的圈子:圈子名称、圈子名称60 + // ·我刚来到这里哦55 + // ·可能是你想认识的人50 + // ·很多圈友都喜欢TA40 + // ·TA是乐园优秀圈主哦~30 - info = checkCardReturnData(recommendCircleFriendData); + info = checkCardReturnData(recommendCircleFriendData); - List circleList = recommendCircleFriendData['interests']; + List circleList = recommendCircleFriendData['interests']; - return Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Column(children: [ - Container( - margin: EdgeInsets.only(top: 20.sp), - child: Row( - children: [ - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - Container( - width: 4.sp, - height: 4.sp, - margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.white.withOpacity(0.5)), - ), - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - child: Row( - children: [ - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - SizedBox( - width: 4.sp, - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '圈友推荐', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: Color(0xffF657FF), offset: Offset(0.0, -1)) - ]), - ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - Expanded(child: Container()), - InkWell( - onTap: () { - loadRecommendCircleFriendData(); - }, - child: Container( - child: Row( - children: [ - Icon( - Icons.refresh_sharp, - size: 18.sp, - color: AppColor.mainColor, - ), - SizedBox( - width: 4.sp, - ), - Text( - '换一位', - style: TextStyle( - color: AppColor.mainColor, fontSize: 15.sp), - ) - ], - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - width: Get.width, - // constraints: BoxConstraints(maxHeight: 230.sp), - decoration: BoxDecoration( - // gradient: LinearGradient( - // colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), - // borderRadius: BorderRadius.circular(8.sp), - // border: GradientBoxBorder( - // gradient: AppColor.mainVerLinearGradient, - // width: 0.sp, - // ), - ), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp,top: 10.sp), - child: Column( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: user.userId.toString()); - }, - child: Container( - child: Row( - children: [ - ClipOval( - child: Image.network( - recommendCircleFriendData['user']['avatar'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - width: 6.sp, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 16.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - SizedBox(width: 8.sp,), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - 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( - '匹配度' + (recommendCircleFriendData['recommend_score'].toString() ?? '') + '%', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - ), - ], - ) - ], - ), - 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: 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, - ), - ), - ), - if (user.vip! > 0) - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: Image.asset( - getCircleImage( - user.vip == 1 ? 'vip' : 'year_vip'), - width: 36.sp, - ), - ), - ], - ), - ], - )), - GestureDetector( - onTap: () async { - if (!chatImIdList.contains(user.userId.toString())) { - await createCustomMsg(user.userId.toString(), recommendCircleFriendData['user']['imId']); - } + return Container( + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Column(children: [ + Container( + margin: EdgeInsets.only(top: 20.sp), + child: Row( + children: [ + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + Container( + width: 4.sp, + height: 4.sp, + margin: EdgeInsets.only(left: 15.sp, right: 15.sp), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white.withOpacity(0.5)), + ), + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.sp), + child: Row( + children: [ + Image.asset( + getMsgImage('heart_icon'), + width: 18.sp, + ), + SizedBox( + width: 4.sp, + ), + ShaderMask( + shaderCallback: (Rect bounds) { + return const LinearGradient( + begin: Alignment(0.0, -1.0), + end: Alignment.bottomCenter, + colors: [Color(0xff71F3F2), Color(0xffF657FF)], + ).createShader(Offset.zero & bounds.size); + }, + child: Text( + '圈友推荐', + style: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.w600, + color: Colors.white, + shadows: [ + Shadow( + color: Color(0xffF657FF), offset: Offset( + 0.0, -1)) + ]), + ), + ), + SizedBox( + width: 4.sp, + ), + Image.asset( + getMsgImage('heart_icon'), + width: 18.sp, + ), + Expanded(child: Container()), + InkWell( + onTap: () { + loadRecommendCircleFriendData(); + }, + child: Container( + child: Row( + children: [ + Icon( + Icons.refresh_sharp, + size: 18.sp, + color: AppColor.mainColor, + ), + SizedBox( + width: 4.sp, + ), + Text( + '换一位', + style: TextStyle( + color: AppColor.mainColor, fontSize: 15.sp), + ) + ], + ), + ), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.sp), + width: Get.width, + // constraints: BoxConstraints(maxHeight: 230.sp), + decoration: BoxDecoration( + // gradient: LinearGradient( + // colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), + // borderRadius: BorderRadius.circular(8.sp), + // border: GradientBoxBorder( + // gradient: AppColor.mainVerLinearGradient, + // width: 0.sp, + // ), + ), + padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 10.sp), + child: Column( + children: [ + GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: user.userId.toString()); + }, + child: Container( + child: Row( + children: [ + ClipOval( + child: Image.network( + recommendCircleFriendData['user']['avatar'], + width: 50.sp, + height: 50.sp, + fit: BoxFit.cover, + ), + ), + SizedBox( + width: 6.sp, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + user.nickname ?? '', + style: TextStyle( + fontSize: 16.sp, + color: Color(0XFFF7FAFA), + fontWeight: FontWeight.bold), + ), + SizedBox(width: 8.sp,), + Row( + mainAxisAlignment: MainAxisAlignment + .start, + children: [ + 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( + '匹配度' + + (recommendCircleFriendData['recommend_score'] + .toString() ?? '') + '%', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w600, + color: Colors.white), + ), + ), + ], + ) + ], + ), + 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: 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, + ), + ), + ), + if (user.vip! > 0) + Container( + margin: EdgeInsets.only( + left: 4.sp, + ), + child: Image.asset( + getCircleImage( + user.vip == 1 + ? 'vip' + : 'year_vip'), + width: 36.sp, + ), + ), + ], + ), + ], + )), + GestureDetector( + onTap: () async { + if (!chatImIdList.contains( + user.userId.toString())) { + await createCustomMsg(user.userId.toString(), + recommendCircleFriendData['user']['imId']); + } - pushChatPage(user.userId.toString(), recommendCircleFriendData['user']['imId'], user.nickname!); - }, - child: Container( - height: 25.sp, - padding: EdgeInsets.only(left: 6.sp,right: 6.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.5.sp)), - alignment: Alignment.center, - child: Text( - '聊一聊', - style: - TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - ) - ], - ), - ), - ), - if (info.containsKey('desc')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['desc'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - if (info.containsKey('city')) - info['city'].toString().isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Expanded(child: Text( - info['city'], - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )) - ], - ), - ) - : Container(), - if (info.containsKey('both_interests')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['both_interests'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), + pushChatPage(user.userId.toString(), + recommendCircleFriendData['user']['imId'], + user.nickname!); + }, + child: Container( + height: 25.sp, + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + gradient: AppColor.mainVerLinearGradient, + borderRadius: BorderRadius.circular(12.5.sp)), + alignment: Alignment.center, + child: Text( + '聊一聊', + style: + TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ), + ) + ], + ), + ), + ), + if (info.containsKey('desc')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('city')) + info['city'] + .toString() + .isNotEmpty + ? Container( + margin: EdgeInsets.only(top: 10.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3.sp, + height: 3.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5.sp), + color: Color(0xFF00FFF4)), + ), + Expanded(child: Text( + info['city'], + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + )) + ], + ), + ) + : Container(), + if (info.containsKey('both_interests')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['both_interests'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), - Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp, top: 10.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - '交友宣言:' + - recommendCircleFriendData['user']['signature'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ])), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), + Container( + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + alignment: Alignment.centerLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp, top: 10.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Text( + '交友宣言:' + + recommendCircleFriendData['user']['signature'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500), + maxLines: 2, + overflow: TextOverflow.ellipsis, + )), + ])), + Image.asset( + getCircleImage('line'), + width: Get.width, + fit: BoxFit.fill, + ), - if (circleList.isNotEmpty) - Container( - height: 72.sp, - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), - width: Get.width, - child: ListView.builder(itemBuilder: (context,index) { - return circleInfoItem(circleList[index], index); - },itemCount: circleList.length,scrollDirection: Axis.horizontal,), - ) - ], - ), - ), - ])); - } catch (e) { - loadRecommendCircleFriendData(); - return Container(); - } + if (circleList.isNotEmpty) + Container( + height: 72.sp, + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + width: Get.width, + child: ListView.builder(itemBuilder: (context, index) { + return circleInfoItem(circleList[index], index); + }, + itemCount: circleList.length, + scrollDirection: Axis.horizontal,), + ) + ], + ), + ), + ])); + } catch (e) { + loadRecommendCircleFriendData(); + return Container(); + } } circleInfoItem(var bean, int index) { @@ -1139,7 +1282,7 @@ class _TIMConversationState extends TIMUIKitState { ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, ), + padding: EdgeInsets.only(left: 8.sp,), // alignment: Alignment., height: 72.sp, child: Column( @@ -1186,8 +1329,8 @@ class _TIMConversationState extends TIMUIKitState { setState(() {}); } } else { - - if ((data['code'] == 21201 || data['code'] == 21202) && recommendCircleFriendData.isNotEmpty) { + if ((data['code'] == 21201 || data['code'] == 21202) && + recommendCircleFriendData.isNotEmpty) { showOKToast(data['msg']); showVipDialog(); } diff --git a/circle_app/lib/app/msg/logic.dart b/circle_app/lib/app/msg/logic.dart index a443414..68467e9 100644 --- a/circle_app/lib/app/msg/logic.dart +++ b/circle_app/lib/app/msg/logic.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import '../../common/Widgets/base_tip_widget.dart'; import '../../util/SharedPreferencesHelper.dart'; import '../circle/logic.dart'; @@ -22,6 +23,9 @@ class MsgLogic extends GetxController { int total = 0; bool isStart = false; + String tip = ''; + + int recent_visit_count_new = 0; @override void onInit() { @@ -31,6 +35,7 @@ class MsgLogic extends GetxController { loadChatData(); loadLikeData(); loadStatusData(); + getMode(); } loadData() { @@ -54,6 +59,33 @@ class MsgLogic extends GetxController { update(); } + getMode() async { + var data = await DioManager.instance.get(url: Api.getUserMine); + var bean = BaseResponse.fromJson( + data, (data) => MineResponseBean.fromJson(data)); + if (bean.isSuccess()) { + int recent_visit_count = bean.data.recentVisitCount ?? 0; + SharedPreferences sharedPreferences = + await SharedPreferences.getInstance(); + int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; + + recent_visit_count_new = recent_visit_count - recentVisitCount; + getVisitorMsgData(); + + } + } + + updateVisitCount() async { + if (recent_visit_count_new > 0) { + SharedPreferences sharedPreferences = + await SharedPreferences.getInstance(); + sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, recent_visit_count_new); + } + + getMode(); + update(); + } + void loadChatData() async { var data = await DioManager.instance.post(url: Api.recommendQuickChatUser, params: { @@ -63,6 +95,8 @@ class MsgLogic extends GetxController { if (data['code'] == 200) { total = data['data']['total']; chatList = data['data']['lists']; + } else if (data['code'] == 404) { + showOKToast('网络不流畅哦,请检查网络情况'); } // vicinityList = bean.data.lists; @@ -70,6 +104,16 @@ class MsgLogic extends GetxController { } + getVisitorMsgData() async { + var data = + await DioManager.instance.get(url: Api.getVisitorMsg,); + if (data['code'] == 200) { + tip = data['data']['lastMsg']; + recent_visit_count_new = data['data']['unreadCount'] ?? 0; + } + update(); + } + Future queryQuickStart() async { var data = await DioManager.getInstance().get(url: Api.queryQuickStart); 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 8e0578d..560bf16 100644 --- a/circle_app/lib/app/msg/recommend_circle_friend_item.dart +++ b/circle_app/lib/app/msg/recommend_circle_friend_item.dart @@ -11,10 +11,11 @@ import '../../util/util.dart'; import '../circle/widgets/discover.dart'; class RecommendCircleFriendItem extends StatefulWidget { - RecommendCircleFriendItem(this.isShowTopLine,{super.key,required this.recommendCircleFriendData,required this.getDataCallBack,}); + RecommendCircleFriendItem(this.isShowTopLine,this.padding,{super.key,required this.recommendCircleFriendData,required this.getDataCallBack,}); var recommendCircleFriendData; Function getDataCallBack; bool isShowTopLine; + double padding; @override _RecommendCircleFriendItemState createState() => _RecommendCircleFriendItemState(); @@ -55,7 +56,7 @@ class _RecommendCircleFriendItemState extends State { List circleList = recommendCircleFriendData['interests'] ?? []; return Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + padding: EdgeInsets.only(left: widget.padding, right: widget.padding), child: Column(children: [ if (widget.isShowTopLine) Container( diff --git a/circle_app/lib/app/quick/view.dart b/circle_app/lib/app/quick/view.dart index 904fa95..a38ace6 100644 --- a/circle_app/lib/app/quick/view.dart +++ b/circle_app/lib/app/quick/view.dart @@ -15,6 +15,7 @@ import '../../util/util.dart'; import '../circle/logic.dart'; import '../userinfo/logic.dart'; import 'logic.dart'; +import 'dart:ui' as ui show PlaceholderAlignment; class QuickPage extends StatelessWidget { QuickPage({Key? key}) : super(key: key); @@ -316,13 +317,42 @@ class QuickPage extends StatelessWidget { child: Align( alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: Text( - item.signature ?? '暂时还没有签名哦~', - maxLines: 2, - style: - TextStyle(color: Colors.white, fontSize: 18.sp), + child: RichText( overflow: TextOverflow.ellipsis, - ), + maxLines: 2, + text: TextSpan( + children: [ + WidgetSpan( + alignment: ui.PlaceholderAlignment.middle, + // alignment: Rect.fromCenter(center: center, width: width, height: height), + child: Container( + margin: EdgeInsets.only(right: 2.sp,), + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + height: 20.sp, + width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(22), + color: AppColor.cityBgColor, + ), + child: Text( + item.city!, + style: TextStyle( + color: Colors.white, + fontSize: 11.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + TextSpan( + text: item.signature ?? '暂时还没有签名哦~', + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp,)), + ], + ), + ) ), ), if (item.interests.isNotEmpty) @@ -427,34 +457,26 @@ class QuickPage extends StatelessWidget { margin: EdgeInsets.only(right: 11.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], + border: GradientBoxBorder( + gradient: + AppColor.mainVerLinearGradient, + width: 0.5.sp, ), 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: 15.sp, + right: 15.sp, ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), + child: Center( + child: Text( + interests[index].title, + style: const TextStyle( + fontSize: 13.0, + color: Colors.white, ), ), ), diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index f0a69bd..332b910 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -291,7 +291,7 @@ class MyTabbedScreenState extends State toolbarHeight: 0, foregroundColor: Colors.transparent, backgroundColor: Colors.transparent, - expandedHeight: 352.sp, + expandedHeight: 362.sp, // bottom: PreferredSize( // preferredSize: Size(Get.width, 40), // child: titleTab(logic), @@ -479,7 +479,7 @@ class MyTabbedScreenState extends State child: Column( children: [ Container( - height: 58.sp, + height: 68.sp, padding: EdgeInsets.symmetric(horizontal: 15.sp), child: Row( crossAxisAlignment: CrossAxisAlignment.start, 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 e0724ef..6029093 100644 --- a/circle_app/lib/app/userinfo/widgets/home_call_out.dart +++ b/circle_app/lib/app/userinfo/widgets/home_call_out.dart @@ -134,7 +134,7 @@ class _HomeCallOutViewState extends State Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, 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: () { + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 15,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { logic.openCallOutIdList.add(lists.id); setState(() { @@ -151,13 +151,16 @@ class _HomeCallOutViewState extends State type = info.type!; if (info.type == 1) { - if (lists.album!.length > 3) { - picHeight = 218.sp; - } else { - picHeight = 109.sp; + picHeight = 140.sp; + if (info.type == 1) { + if (lists.album!.length > 3 && lists.album!.length < 7) { + picHeight = picHeight * 2; + } else if (lists.album!.length >= 7) { + picHeight = picHeight * 3; + } } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -327,7 +330,7 @@ class _HomeCallOutViewState extends State Container( height: picHeight, margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp + child: picHeight == 200.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget(lists.album![0]!.url!)) @@ -340,7 +343,7 @@ class _HomeCallOutViewState extends State crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget + childAspectRatio: 0.8 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -403,14 +406,14 @@ class _HomeCallOutViewState extends State ///普通图文喊话 normalDynamicItem(Lists lists) { - Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( + Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( lists.content!, 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: () { - logic.openCallOutIdList.add(lists.id); - setState(() { + ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 15,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + logic.openCallOutIdList.add(lists.id); + setState(() { - }); + }); }, ); @@ -423,13 +426,16 @@ class _HomeCallOutViewState extends State type = info.type!; if (info.type == 1) { - if (lists.album!.length > 3) { - picHeight = 218.sp; - } else { - picHeight = 109.sp; + picHeight = 140.sp; + if (info.type == 1) { + if (lists.album!.length > 3 && lists.album!.length < 7) { + picHeight = picHeight * 2; + } else if (lists.album!.length >= 7) { + picHeight = picHeight * 3; + } } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -587,19 +593,20 @@ class _HomeCallOutViewState extends State // margin: EdgeInsets.only(top: 4.sp), child: descText, ), + SizedBox(height: picHeight > 0 ? 5.sp : 10.sp,), picHeight > 0 ? Container( height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp + // alignment: Alignment.centerLeft, + margin: EdgeInsets.only(bottom: 10.sp), + child: picHeight == 200.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget(lists.album![0].url!)) : GridView.builder( controller: scrollController, - shrinkWrap: true, + // shrinkWrap: true, itemCount: lists.album!.length, physics: const NeverScrollableScrollPhysics(), @@ -609,16 +616,10 @@ class _HomeCallOutViewState extends State crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, childAspectRatio: - 1.0 //宽高比为1时,子widget + 0.8 //宽高比为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 = []; @@ -636,9 +637,6 @@ class _HomeCallOutViewState extends State BorderRadius.circular(6.sp), child: CachedNetworkImage( imageUrl: album.url!, - errorWidget: - (context, url, error) => - Icon(Icons.error), fit: BoxFit.cover, ), ), diff --git a/circle_app/lib/app/visitorlist/view.dart b/circle_app/lib/app/visitorlist/view.dart index 38ab52a..5ee9b9d 100644 --- a/circle_app/lib/app/visitorlist/view.dart +++ b/circle_app/lib/app/visitorlist/view.dart @@ -322,21 +322,11 @@ class VisitorlistPage extends StatelessWidget { Stack( children: [ ClipOval( - child: GestureDetector( - onTap: () { - if (logic.isVip > 0 || index < 3) { - var imgList = []; - imgList.add(item.user.avatar); - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imgList, 'index': 0}); - } - }, - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 53.sp, - height: 53.sp, - ), + child: CachedNetworkImage( + fit: BoxFit.cover, + imageUrl: item.user.avatarThumb, + width: 53.sp, + height: 53.sp, ), ), Positioned( diff --git a/circle_app/lib/app/world_call_out/logic.dart b/circle_app/lib/app/world_call_out/logic.dart index 62e7835..683605e 100644 --- a/circle_app/lib/app/world_call_out/logic.dart +++ b/circle_app/lib/app/world_call_out/logic.dart @@ -21,6 +21,7 @@ class World_call_outLogic extends GetxController { bool isLoad = true; List lists = []; List wantMeet = []; + List openCallOutIdList = []; int index = 1; int total = 0; @@ -123,6 +124,7 @@ class World_call_outLogic extends GetxController { if (tempLists.isNotEmpty) { isLoad = false; if (index == 1) { + refreshController.refreshCompleted(); lists = tempLists; } else { @@ -139,6 +141,7 @@ class World_call_outLogic extends GetxController { update(); } else if (bean1.code == 404) { + showOKToast('网络不流畅哦,请检查网络情况'); 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 77b2d76..16272e8 100644 --- a/circle_app/lib/app/world_call_out/view.dart +++ b/circle_app/lib/app/world_call_out/view.dart @@ -13,6 +13,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../common/Widgets/circle_share.dart'; import '../../common/Widgets/tag_widget.dart'; +import '../../common/Widgets/text_more.dart'; import '../../common/colors/app_color.dart'; import '../../router/app_routers.dart'; import '../circle/widgets/video_item.dart'; @@ -152,8 +153,19 @@ class _WorldCallOutPageState extends State onLoading: () { logic.loadMore(); }, + onRefresh: () { + logic.isNewMsg = false; + logic.index = 1; + logic.lists.clear(); + logic.update(); + logic.loadData(); + }, enablePullUp: true, + enablePullDown: true, child:logic.loadFail ? noResultWidget(tip: '',callBack: () { + logic.loadFail = false; + logic.isMore = true; + logic.update(); logic.initGerder(); logic.loadData(); }) : logic.lists.isEmpty @@ -222,175 +234,6 @@ class _WorldCallOutPageState extends State ), ), )), - // Positioned( - // bottom: 0, - // child: Container( - // width: Get.width, - // height: max(getBottomHeight(context), 0.0), - // child: AnimatedContainer( - // duration: Duration( - // milliseconds: - // (logic.showKeyboard && PlatformUtils().isAndroid) - // ? 200 - // : 340), - // curve: Curves.fastOutSlowIn, - // width: Get.width, - // height: max(getBottomHeight(context), 0.0), - // child: ListView( - // physics: const NeverScrollableScrollPhysics(), - // children: [ - // Container( - // width: MediaQuery.of(context).size.width, - // decoration: const BoxDecoration( - // color: Color(0xFF423055), - // borderRadius: BorderRadius.only( - // topLeft: Radius.circular(16), - // topRight: Radius.circular(16))), - // child: Container( - // // constraints: const BoxConstraints( - // // maxHeight: 60, - // // minHeight: 30, - // // ), - // padding: const EdgeInsets.symmetric( - // horizontal: 7.0, vertical: 7.0), - // child: Row( - // children: [ - // SizedBox( - // width: 6, - // ), - // Transform.scale( - // scale: 0.8, - // child: CupertinoSwitch( - // activeColor: AppColor.mainColor, - // value: logic.isOpenVip, - // onChanged: (bool value) async { - // // if (logic.vip == 3) { - // // showToast('「年合伙人」专属特权「至尊喊话」,开启后可以闪亮全场哦'); - // // _isOpenVip = value; - // // setState(() {}); - // // } else { - // // showToast('成为「年合伙人」才能使用「至尊喊话」,可以闪亮全场哦'); - // // showRechargeDialog('super_callout') - // // .then((value) { - // // logic.loadMyuserId(); - // // }); - // // } - // }, - // ), - // ), - // Expanded( - // child: Stack( - // alignment: Alignment.centerLeft, - // children: [ - // Container( - // constraints: const BoxConstraints( - // maxHeight: 60, - // minHeight: 30, - // ), - // width: Get.width, - // child: ExtendedTextField( - // controller: logic.inputController, - // focusNode: logic.focusNode, - // keyboardType: - // TextInputType.multiline, - // maxLength: 30, - // onTap: () { - // logic.showKeyboard = true; - // logic.inputController.value = TextEditingValue( - // ///用来设置文本 controller.text = "0000" - // text: logic.inputController.text, - // ///设置光标的位置 - // selection: TextSelection.fromPosition( - // ///用来设置文本的位置 - // TextPosition( - // affinity: TextAffinity.downstream, - // /// 光标向后移动的长度 - // offset: logic.inputController.text.length),),); - // logic.update(); - // }, - // decoration: InputDecoration( - // counterText: '', - // contentPadding: EdgeInsets.only( - // left: 10, - // right: 35, - // top: 10, - // bottom: 0), - // fillColor: Color(0x1AFFFFFF), - // filled: true, - // border: OutlineInputBorder( - // borderRadius: - // BorderRadius.circular( - // 15), - // borderSide: - // BorderSide.none), - // isDense: true, - // hintText: '发个喊话跟大家一起聊聊呗~', - // hintStyle: const TextStyle( - // color: Color(0xB3FFFFFF), - // fontSize: 14), - // enabled: false), - // maxLines: null, - // style: const TextStyle( - // color: Colors.white, - // fontSize: 14), - // textInputAction: - // TextInputAction.send, - // onChanged: (value) {}, - // onEditingComplete: () { - // logic.focusNode.unfocus(); - // logic.showKeyboard = false; - // logic.showEmojiPanel = false; - // logic.sendTextMessage(); - // }, - // enabled: true, - // specialTextSpanBuilder: - // DefaultSpecialTextSpanBuilder( - // isUseDefaultEmoji: true, - // customEmojiStickerList: - // ConstData.emojiList, - // showAtBackground: true, - // )), - // ), - // Positioned( - // right: 10, - // child: GestureDetector( - // onTap: () { - // logic.focusNode.unfocus(); - // logic.showKeyboard = false; - // logic.showEmojiPanel = true; - // logic.update(); - // }, - // child: Image.asset( - // getMsgImage('emoji'), - // width: 24, - // ), - // ), - // ), - // ], - // )), - // SizedBox( - // width: 6, - // ), - // GestureDetector( - // onTap: () { - // logic.focusNode.unfocus(); - // logic.showKeyboard = false; - // logic.showEmojiPanel = false; - // logic.sendTextMessage(); - // }, - // child: Image.asset( - // getMsgImage('send'), - // width: 24, - // )), - // ], - // ), - // ), - // ), - // getBottomContainer() - // ], - // ), - // ), - // )), ], )); }); @@ -623,12 +466,10 @@ class _WorldCallOutPageState extends State return picHeight > 0 ? Container( height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), + alignment: Alignment.topLeft, + margin: EdgeInsets.only(left: 10.sp, right: 10.sp,bottom: 5.sp), child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(list.album![0].url!)) + ? VideoItemWidget(list.album![0].url!) : GridView.builder( itemCount: list.album!.length, physics: const NeverScrollableScrollPhysics(), @@ -691,9 +532,30 @@ class _WorldCallOutPageState extends State } } + Widget descText = logic.openCallOutIdList.contains(list.id) + ? Text( + list.content!, + style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 14.sp), + ) + : Container( + // color: Colors.red, + child: HideText( + text: list.content!, + maxWidth: Get.width - 90.sp, + additionText: '查看更多', + maxLines: 15, + style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 14.sp), + additionStyle: + TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp), + onTap: () { + logic.openCallOutIdList.add(list.id!); + setState(() {}); + }, + ), + ); + return Container( - margin: EdgeInsets.only(top: 20.sp), - // alignment: index % 2 == 0 ? Alignment.centerRight : Alignment.centerLeft, + margin: EdgeInsets.only(top: 10.sp,bottom:10.sp), width: Get.width, padding: EdgeInsets.only(left: 5.sp, right: 5.sp), // height: widgetAllHeight + wordsHeight, @@ -795,7 +657,8 @@ class _WorldCallOutPageState extends State margin: EdgeInsets.only( top: 10.sp, bottom: 10.sp, left: 10.sp, right: 10.sp), alignment: Alignment.centerLeft, - child: Text.rich(TextSpan(children: [ + child: + (list!.isQueen!) ? Text.rich(TextSpan(children: [ if (list!.isQueen!) WidgetSpan( child: Container( @@ -825,11 +688,14 @@ class _WorldCallOutPageState extends State ), )), ), - TextSpan( + // WidgetSpan( + // child:descText) + TextSpan( text: list.content!, style: TextStyle( color: Color(0xFFF7FAFA), fontSize: 14.sp)), - ])), + ]) + ) : descText, ), if (picHeight > 0) picOrVideoItem(picHeight, list), circleInfoItem(list) @@ -1035,6 +901,7 @@ class _WorldCallOutPageState extends State ) ], ), + if (isSelf) GestureDetector( onTap: () { diff --git a/circle_app/lib/common/Widgets/add_wx_tip.dart b/circle_app/lib/common/Widgets/add_wx_tip.dart index 2e79a70..b76068e 100644 --- a/circle_app/lib/common/Widgets/add_wx_tip.dart +++ b/circle_app/lib/common/Widgets/add_wx_tip.dart @@ -116,19 +116,18 @@ class _AddWxTipState extends State { GestureDetector( onTap: () async { if (widget.isHidden) { - - var result = await DioManager().post( - url: Api.confset ,params: {'hideContact':widget.isWxHidden ? 0 : 1} - ); - if (result['code'] == 200) { - showOKToast('操作成功'); - } - Get.back(); - + var result = await DioManager() + .post(url: Api.confset, params: { + 'hideContact': widget.isWxHidden ? 0 : 1 + }); + if (result['code'] == 200) { + showOKToast('操作成功'); + } + Get.back(); } else { showOKToast('为了维护站内的社交环境,联系信息填写必须真实哦~'); + Get.back(); showUpdateWxPicker(phone: '1'); - } }, child: Container( @@ -142,8 +141,8 @@ class _AddWxTipState extends State { child: Text( widget.isHidden ? widget.isWxHidden - ? '取消隐藏方式' - : '隐藏联系方式' + ? '取消隐藏方式' + : '隐藏联系方式' : '手机号即微信', style: TextStyle( color: Colors.white, fontSize: 14.sp), @@ -168,7 +167,9 @@ class _AddWxTipState extends State { borderRadius: BorderRadius.circular(4.sp)), child: Text( - widget.isHaveWx ? ' 更新联系方式 ':' 填写联系方式 ', + widget.isHaveWx + ? ' 更新联系方式 ' + : ' 填写联系方式 ', style: TextStyle( color: Colors.white, fontSize: 14.sp), ), diff --git a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart b/circle_app/lib/common/Widgets/open_vip_tip/logic.dart index a6d302f..d0d68e9 100644 --- a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart +++ b/circle_app/lib/common/Widgets/open_vip_tip/logic.dart @@ -3,6 +3,7 @@ import 'package:circle_app/util/util.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; +import '../../../app/minefragment/logic.dart'; import '../../../network/api.dart'; import '../../../network/dio_manager.dart'; import '../../../util/PaymentUtils.dart'; @@ -16,12 +17,24 @@ class Open_vip_tipLogic extends GetxController { bool isYean = false; bool isShowInviteTip = false; + bool isVip = false; @override void onInit() { super.onInit(); - } + getMode() async { + var data = await DioManager.instance.get(url: Api.getUserMine); + var bean = BaseResponse.fromJson( + data, (data) => MineResponseBean.fromJson(data)); + if (bean.isSuccess()) { + if(bean.data.user.vip>0){ + isVip = true; + } else if (bean.data.last_vip_expire_date != '') { + isVip = true; + } + + }} loadData() async { var data = await DioManager.instance.get(url: Api.getVipPrice, params: {}); diff --git a/circle_app/lib/common/Widgets/open_vip_tip/view.dart b/circle_app/lib/common/Widgets/open_vip_tip/view.dart index d821990..d3f4c5e 100644 --- a/circle_app/lib/common/Widgets/open_vip_tip/view.dart +++ b/circle_app/lib/common/Widgets/open_vip_tip/view.dart @@ -29,8 +29,6 @@ class _Open_vip_tipPageState extends State { final state = Get.find().state; - bool isVip = false; - Map vipImgMap = { "身份标识" : 'vip_fun_1', "专属客服": 'vip_fun_2', @@ -53,22 +51,10 @@ class _Open_vip_tipPageState extends State { // TODO: implement initState super.initState(); logic.loadData(); + logic.getMode(); logic.isShowInvite(); } - getMode() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - User userInfoBean = bean.data.user; - isVip = userInfoBean!.vip! > 0; - setState(() { - - }); - } - } - @override Widget build(BuildContext context) { List vipFuncList = [ @@ -299,7 +285,7 @@ class _Open_vip_tipPageState extends State { Color(0xffD739EA) ])), child: Text( - isVip ? '续费特权' : '领取特权', + logic.isVip ? '续费特权' : '领取特权', style: TextStyle(color: Colors.white, fontSize: 16.sp), ), diff --git a/circle_app/lib/common/colors/app_color.dart b/circle_app/lib/common/colors/app_color.dart index a5003be..a49052b 100644 --- a/circle_app/lib/common/colors/app_color.dart +++ b/circle_app/lib/common/colors/app_color.dart @@ -7,6 +7,8 @@ class AppColor { static Color bgColor = Color(0xFF120D29); static Color mainBgColor = Color(0XFF392D53); + static Color cityBgColor = Color.fromRGBO(52, 41, 67, 1); + static Gradient mainVerLinearGradient = const LinearGradient( colors: [ Color(0xFF06F9FA), @@ -54,5 +56,14 @@ class AppColor { end: Alignment.centerRight, ); + static Gradient clearLinearGradient = LinearGradient( + colors: [ + mainColor.withOpacity(0), + mainColor.withOpacity(0), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ); + } diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index de57f85..13777c3 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -71,6 +71,12 @@ class Api { //mine 基本信息 static const getUserMine = 'user-service/my/main'; + //我关注的活跃用户列表 + static const activeUsers = '/user-service/follow/activeUsers'; + + + //访客未读消息 + static const getVisitorMsg = '/user-service/visit/getVisitorMsg'; //发消息是否需要vip弹窗 static const getIsVips = 'mall-service/vips/show/'; @@ -99,6 +105,15 @@ class Api { //拉黑 static const setBlock = 'user-service/user/'; + //圈子代理人 + static const interestAgent = '/up-service/interest/agent/'; + + //申请圈子代理人 + static const applyToAgent = '/up-service/interest/applyToAgent/'; + + //打赏圈子代理人 + static const rewardAgent = '/up-service/interest/agent/reward'; + //喜欢 static const setLike = 'user-service/user/'; @@ -238,7 +253,7 @@ class Api { static const UnlockWx = 'user-service/wxNum/unlock'; //微信号填写文案 - static const popWxNumStr = 'user-service/content/popup/wxNum'; + static const popWxNumStr = 'user-service/content/popup/contact'; //微信号修改 static const updateWxNum = 'user-service/updateWxNum'; @@ -422,4 +437,7 @@ class Api { //圈子分类 static const categoriesList = '/up-service/interest/categories'; + + //good认证发送 + static const goodAuth = '/user-service/user/goodAuth'; } \ No newline at end of file diff --git a/circle_app/lib/network/dio_manager.dart b/circle_app/lib/network/dio_manager.dart index e74ecd5..6ca99f7 100644 --- a/circle_app/lib/network/dio_manager.dart +++ b/circle_app/lib/network/dio_manager.dart @@ -43,9 +43,9 @@ class DioManager { // baseUrl2 baseUrl: // Api.baseUrl2, - Api.baseUrl, + // Api.baseUrl, - // type == 1 ? Api.baseUrl2 : Api.baseUrl1, + type == 1 ? Api.baseUrl2 : Api.baseUrl1, // 连接服务器超时时间,单位是毫秒 connectTimeout: const Duration(seconds: 30), // 接收数据的最长时限 @@ -197,7 +197,7 @@ class DioManager { var connectivityResult = await Connectivity().checkConnectivity(); if (connectivityResult == ConnectivityResult.none) { - // showToast(""); + // showOKToast("网络不流畅哦,请检查网络情况"); return {'code': 404, 'msg': '网络不流畅哦,请检查网络情况'}; } @@ -285,7 +285,7 @@ class DioManager { pushLoginPage(); break; } - if (responseMap["code"] != 200 && responseMap["code"] != 10000 && !url.contains(Api.checkWxNumState) && responseMap["code"] != 21201 && responseMap['code'] != 404) { + if (responseMap["code"] != 200 && responseMap["code"] != 10000 && !url.contains(Api.checkWxNumState) && responseMap["code"] != 21201 && responseMap['code'] != 32104) { showOKToast(responseMap['msg']); } } @@ -295,20 +295,13 @@ class DioManager { if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') { return {'code': 500, 'msg': ''}; } - // // DioError是指返回值不为200的情况 - // logger.shout('DioError报错${e.type}:${e.error.toString()}'); - // // 对错误进行判断 - // onErrorInterceptor(e); - // // 判断是否断网了 - // String? errorMsg = isNetworkConnected - // ? e.requestOptions.extra["errorMsg"] - // : "网络连接断开,请检查网络设置"; return {'code': 500, 'msg': '服务器开小差了,请重试'}; } catch (e) { SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') { return {'code': 500, 'msg': ''}; } + // 其他一些意外的报错 return {'code': 500, 'msg': '加载中...'}; } diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart index f446a11..46b0cff 100644 --- a/circle_app/lib/util/util.dart +++ b/circle_app/lib/util/util.dart @@ -86,7 +86,7 @@ showOKToast(String msg) { msg, duration: Duration(seconds: msg.length > 15 ? 5 : msg.length > 10 ? 3 : 2), position: ToastPosition.center, - backgroundColor: Colors.black.withOpacity(0.8), + backgroundColor: Colors.black, radius: 13.0, textStyle: const TextStyle(fontSize: 16.0,color: Colors.white), ); @@ -1099,6 +1099,8 @@ pushPage(String action,String param,{String name = ''}) { // public final static String GOOD_RATE = "good_rate";//好评反馈 // public final static String BUY_VIP = "buy_vip";//购买会员 // public final static String RECHARGE = "recharge";//充值 + // public final static String INTEREST = "interest";//圈子 + // public final static String GOOD_AUTH = "good_auth";//good认证 if (action == 'my_main') { Get.until((route) => route.settings.name == '/home'); final homeLogic = Get.put(HomeLogic()); @@ -1149,10 +1151,142 @@ pushPage(String action,String param,{String name = ''}) { conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); } Get.toNamed(AppRoutes.Chat, arguments: con); + } else if(action == 'interest') { + Get.toNamed(AppRoutes.Signal_circle_list,arguments: param); + } else if(action == 'good_auth') { + var con; + if(kDebugMode){ + con = V2TimConversation( + conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); + }else{ + con = V2TimConversation( + conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); + } + Get.toNamed(AppRoutes.Chat, arguments: con); + DioManager.instance.post(url: Api.goodAuth); + } else if (action == 'apply_interest_agent') { + sendApplyToAgentData(param); } } +void sendApplyToAgentData(var circleId) async { + var data = await DioManager.instance + .post(url: Api.applyToAgent + '$circleId'); + if (data['code'] == 200) { + + var con; + if(kDebugMode){ + con = V2TimConversation( + conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); + }else{ + con = V2TimConversation( + conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); + } + Get.toNamed(AppRoutes.Chat, arguments: con); + } else if (data['code'] == 32104) { + showReportDialog(Get.context!,data['msg']); + } +} + +void showReportDialog(BuildContext context,String msg) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 200.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: AppColor.bgColor, + borderRadius: BorderRadius.circular(12.0.sp), + // gradient: const LinearGradient( + // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], + // begin: Alignment.topCenter, + // end: Alignment.bottomCenter, + // ), + ), + ), + // Container( + // margin: EdgeInsets.all(1.sp), + // child: Image.asset(getMineImage("im_neglect"),fit: BoxFit.fill,), + // ), + Container( + margin: EdgeInsets.only(top: 12.sp), + child: Column( + children: [ + Center( + child: Text( + "申请代理提示", + style: + TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + msg, + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + GestureDetector( + onTap: () { + Get.back(); + Get.toNamed(AppRoutes.Invite); + }, + child: Container( + margin: EdgeInsets.only(top: 16.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: 52.sp, + right: 52.sp), + child: const Text( + "前往邀请", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); +} Future getCurrentPosition() async { return await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);