From c4c0b8d1552661a0b3951047213d6ca55448f441 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Tue, 13 Aug 2024 09:42:07 +0800 Subject: [PATCH] =?UTF-8?q?2.1.8=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 | 13 +- circle_app/data/img/circle/lock_icon.png | Bin 0 -> 796 bytes circle_app/ios/Podfile.lock | 6 - circle_app/ios/Runner/Runner.entitlements | 5 +- ..._uikit_chat_history_message_list_item.dart | 3 +- .../tim_uikit_text_field.dart | 36 +- .../tim_uikit_text_field_layout/narrow.dart | 15 + circle_app/lib/circle_app/chat/view.dart | 76 +- .../chat/widget/chat_circle_share_dialog.dart | 20 +- .../chat/widget/chat_gift_pannel.dart | 4 +- .../lib/circle_app/chat/widget/gift.dart | 4 +- .../chat/widget/send_vip_tip_dialog.dart | 138 +++ .../circle_app/chat/widget/svg_dialog.dart | 16 +- .../circle_app/chat/widget/wish_dialog.dart | 312 ++++--- circle_app/lib/circle_app/circle/logic.dart | 1 + circle_app/lib/circle_app/circle/view.dart | 89 +- .../circle_app/circle/widgets/discover.dart | 87 +- .../circle_app/circle/widgets/like_view.dart | 807 ++++++++-------- .../circle_app/circle/widgets/vicinity.dart | 82 +- .../lib/circle_app/circle_list/view.dart | 155 ++-- .../widgets/right_circle_iten.dart | 871 +++++++++++------- .../lib/circle_app/dialog/UpdateDialog.dart | 4 +- .../like_peole_sended_call_out_dialog.dart | 132 +++ circle_app/lib/circle_app/home/logic.dart | 40 +- circle_app/lib/circle_app/home/view.dart | 17 + .../login/complete_material/logic.dart | 2 +- .../lib/circle_app/minefragment/view.dart | 30 +- .../tim_uikit_conversation.dart | 4 +- .../tim_uikit_conversation_item.dart | 6 +- .../tim_uikit_conversation_last_msg.dart | 14 +- circle_app/lib/circle_app/msg/view.dart | 11 +- circle_app/lib/circle_app/userinfo/logic.dart | 7 +- circle_app/lib/circle_app/userinfo/view.dart | 25 +- .../userinfo/widgets/home_call_out.dart | 278 +++--- .../userinfo/widgets/home_call_out_logic.dart | 2 +- .../lib/circle_app/world_call_out/view.dart | 382 +++++--- .../lib/commons/widgets/my_app_bar.dart | 1 + .../lib/commons/widgets/wx_edit_dialog.dart | 8 +- circle_app/lib/net/api.dart | 7 + .../lib/utils/SharedPreferencesHelper.dart | 18 + circle_app/lib/utils/util.dart | 32 +- circle_app/lib/view/ExitAppConfirmation.dart | 2 +- circle_app/lib/view/notice.dart | 221 +++++ .../Flutter/GeneratedPluginRegistrant.swift | 2 - circle_app/pubspec.lock | 28 +- circle_app/pubspec.yaml | 8 +- 46 files changed, 2605 insertions(+), 1416 deletions(-) create mode 100644 circle_app/data/img/circle/lock_icon.png create mode 100644 circle_app/lib/circle_app/chat/widget/send_vip_tip_dialog.dart create mode 100644 circle_app/lib/circle_app/home/like_peole_sended_call_out_dialog.dart diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index df5378a..30d027d 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 67 - versionName "2.1.7" + versionCode 68 + versionName "2.1.8" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", @@ -98,6 +98,15 @@ android { } } + applicationVariants.all { variant -> + variant.outputs.each { output -> + def versionName = variant.versionName + def newName = "wly_${versionName}.apk" + if (output instanceof com.android.build.gradle.internal.api.BaseVariantOutputImpl) { + output.outputFileName = newName + } + } + } } diff --git a/circle_app/data/img/circle/lock_icon.png b/circle_app/data/img/circle/lock_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..83f6e7f2ae55215b058079f56ca3036e795deca1 GIT binary patch literal 796 zcmV+%1LOROP)Px%)=5M`RA@u(m`$inQ5462f8;AeWyAo5F?xhTk%!U~6GaIVCZ@h)z{Es~49G+Z zkAb=Jm7+)nipb<8%2%XUWI3z$eVupR`|R`4x%bvtvr}vD{r~U(I_qPL9yj$kerf{E z3YyteU_P)F*aFNAJ|BSRz-8c$B>ygKr7B=%3xQL>n*Sgh0?q+vC4Dc#qBH_#*5@}1 zxB{_u8`v!AckF^@zfuU8*<#>vYI6hL12=*Dz_$=qn}8+2l$7tFBoDP*R+xa9%}GM$ zAuuC_;6U!8qWCc}UzE3yGOc2+Ft`Zl8gb zl3rwGP>6t;O$VL=GsD52VfMttw3*EUUZ(z;W0Fo(O<*?gCLH<$*dXa%42Yn@rDXl~ z;P0w!lQbN&zTs0;0nhcA0DTcS96H!V;i++A#@p{$7RrIM?UIfuP!@@rK;BARE6}MzR@Tio z_UZY5V85g@MMlbIpt0000 - - aps-environment - development - + diff --git a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart index 2f99177..c6c0c17 100644 --- a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart +++ b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:math'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/circle_app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart'; import 'package:circle_app/circle_app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart'; import 'package:circle_app/circle_app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart'; import 'package:circle_app/circle_app/chat/widget/chat_msg_card_item.dart'; @@ -19,7 +20,7 @@ import 'package:loading_animation_widget/loading_animation_widget.dart'; import 'package:provider/provider.dart'; import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart'; +// import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart'; import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart'; import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_translate_elem.dart'; import 'package:tencent_cloud_chat_uikit/ui/widgets/forward_message_screen.dart'; diff --git a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart index fe8475b..13f8ecb 100644 --- a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart +++ b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math'; import 'package:circle_app/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart'; +import 'package:circle_app/circle_app/home/logic.dart'; import 'package:circle_app/main.dart'; import 'package:circle_app/net/api.dart'; import 'package:circle_app/net/dio_manager.dart'; @@ -34,6 +35,7 @@ import '../../../../commons/Widgets/base_tip_widget.dart'; import '../../../../commons/Widgets/open_vip_tip/view.dart'; import '../../../../utils/eventBus.dart'; import '../../../userinfo/logic.dart'; +import '../../view.dart'; import '../../widget/send_gift_dialog.dart'; enum MuteStatus { none, me, all } @@ -225,32 +227,7 @@ class _InputTextFieldState extends TIMUIKitState { // 和onSubmitted一样,只是保持焦点的不同 onEmojiSubmitted() { - lastText = ""; - final text = textEditingController.text.trim(); - final convType = widget.conversationType; - if (text.isNotEmpty && text != zeroWidthSpace) { - if (widget.model.repliedMessage != null) { - MessageUtils.handleMessageError( - widget.model.sendReplyMessage( - text: text, - convID: widget.conversationID, - convType: convType, - atUserIDList: getUserIdFromMemberInfoMap(), - ), - context); - } else { - MessageUtils.handleMessageError( - widget.model.sendTextMessage( - text: text, - convID: widget.conversationID, - convType: convType, - ), - context); - } - textEditingController.clear(); - goDownBottom(); - } - currentCursor = null; + onSubmitted(); } // index为emoji的index,data为baseurl+name @@ -604,8 +581,9 @@ class _InputTextFieldState extends TIMUIKitState { List words = []; + HomeLogic logic = Get.find(); - if (!isContain) { + if (!isContain && !(widget.conversationID.contains('qpqz_prod_10_') || (logic.model?.id ?? 0) < 1000)) { var data = await DioManager.instance .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); if (data['data']['code'] == 10000) { @@ -646,6 +624,9 @@ class _InputTextFieldState extends TIMUIKitState { isSending = false; goDownBottom(); _handleSendEditStatus("", false); + + EventBusManager.fire(MsgSendSuccess()); + } else { showOKToast('请输入消息内容'); isSending = false; @@ -1358,3 +1339,4 @@ class _InputTextFieldState extends TIMUIKitState { } } } + diff --git a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart index aff0c8e..7f3952f 100644 --- a/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart +++ b/circle_app/lib/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart @@ -6,6 +6,7 @@ import 'dart:typed_data'; import 'package:circle_app/circle_app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart'; import 'package:circle_app/circle_app/chat/widget/send_gift_dialog.dart'; +import 'package:circle_app/circle_app/chat/widget/send_vip_tip_dialog.dart'; import 'package:circle_app/circle_app/chat/widget/wish_dialog.dart'; import 'package:circle_app/circle_app/minefragment/logic.dart'; import 'package:circle_app/commons/Widgets/open_vip_tip/view.dart'; @@ -431,6 +432,16 @@ class _TIMTextFieldLayoutNarrowState ); } + showSendVipDialog() { + Get.bottomSheet( + SendVipDialog( + widget.conversationID, + ), + isScrollControlled: true, + enableDrag: false, + ); + } + @override Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { final theme = value.theme; @@ -1117,6 +1128,10 @@ class _TIMTextFieldLayoutNarrowState } Future checkVipStatus(int plate) async { + // qpqz_prod_10_102 + if (widget.userId?.contains('qpqz_prod_10_') ?? false) { + return true; + } var data = await DioManager.instance.get(url: Api.getIsVips + plate.toString()); diff --git a/circle_app/lib/circle_app/chat/view.dart b/circle_app/lib/circle_app/chat/view.dart index afc6583..fa54e48 100644 --- a/circle_app/lib/circle_app/chat/view.dart +++ b/circle_app/lib/circle_app/chat/view.dart @@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/circle_app/chat/TIMUIKitChat/tim_uikit_chat.dart'; import 'package:circle_app/circle_app/chat/widget/more_dialog.dart'; import 'package:circle_app/circle_app/chat/widget/send_gift_dialog.dart'; +import 'package:circle_app/circle_app/chat/widget/send_vip_tip_dialog.dart'; import 'package:circle_app/net/api.dart'; import 'package:circle_app/net/dio_manager.dart'; import 'package:circle_app/router/routers.dart'; @@ -37,15 +38,11 @@ class _ChatPageState extends State { // final state = Get.find().state; bool isShowTip = false; - String tip = 'TA上传了形象照,您上传后更方便了解哦,点击前往'; + String tip = 'TA上传了形象照,您上传后更方便了解哦,'; - @override - void dispose() { - // TODO: implement dispose - sub.cancel(); - sub1.cancel(); - super.dispose(); - } + List tipSendVipIdlList = []; + + int isNeedVip = 0; final TIMUIKitChatController _timuiKitChatController = TIMUIKitChatController(); @@ -56,6 +53,17 @@ class _ChatPageState extends State { bool isBlack = false; var sub; var sub1; + var addSub; + + @override + void dispose() { + // TODO: implement dispose + sub.cancel(); + sub1.cancel(); + addSub.cancel(); + super.dispose(); + } + @override void initState() { // TODO: implement initState @@ -90,12 +98,16 @@ class _ChatPageState extends State { if (bean.isSuccess()) { otherUserBean = bean.data.user; - + // 2"chatNeedVip" -> 1 + isNeedVip = data['data']['chatNeedVip']; if (!isShowTip) { fetchMyAlbum(Api.getMyAlbum); } - setState(() {}); + if (mounted) { + setState(() {}); + } + } loadIsShowSendGiftDialogData(); @@ -116,7 +128,7 @@ class _ChatPageState extends State { bool isOtherHave = await loadCallOutListData(otherUserBean!.id!.toString()); if (isOtherHave && !isMyHave) { isShowTip = true; - tip = 'TA发布了喊话,您发布后形象会更完善,点击前往'; + tip = 'TA发布了喊话,您发布后形象会更完善,'; } else if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) { isShowTip = true; tip = 'TA完成了good号认证,您认证后可获得多种特权,联系客服'; @@ -151,9 +163,11 @@ class _ChatPageState extends State { } } - setState(() { + if (mounted) { + setState(() { - }); + }); + } } } @@ -189,6 +203,15 @@ class _ChatPageState extends State { sub1 = EventBusManager.on().listen((event) async { _timuiKitChatController.refreshCurrentHistoryList(); }); + + addSub = EventBusManager.on().listen((event) { + if (isNeedVip == 1) { + if (!tipSendVipIdlList.contains(otherUserBean!.id!.toString())) { + tipSendVipIdlList.add(otherUserBean!.id!.toString()); + Get.bottomSheet(SendVipDialog(otherUserBean!.account_id!),isScrollControlled:true); + } + } + }); } Widget renderCustomStickerPanel( @@ -370,7 +393,7 @@ class _ChatPageState extends State { } else { var result = await DioManager.instance.post(url: Api.goodAuth); if (result['code'] == 200) { - showOKToast('发送成功'); + showOKToast('客服回复您了,前往消息列表查看~'); } } }, @@ -386,14 +409,19 @@ class _ChatPageState extends State { child: Row( children: [ Expanded( - child: Text( - tip, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, + child: Row( + children: [ + Text( + tip, + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + Text('点击前往',style: TextStyle(color: AppColor.mainColor,fontSize: 12.sp),) + ], )), GestureDetector( onTap: () async { @@ -564,3 +592,7 @@ class _ChatPageState extends State { } class ChatLoadUserInfoData {} + +class MsgSendSuccess { + +} \ No newline at end of file diff --git a/circle_app/lib/circle_app/chat/widget/chat_circle_share_dialog.dart b/circle_app/lib/circle_app/chat/widget/chat_circle_share_dialog.dart index 2ffe251..8d85e04 100644 --- a/circle_app/lib/circle_app/chat/widget/chat_circle_share_dialog.dart +++ b/circle_app/lib/circle_app/chat/widget/chat_circle_share_dialog.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/commons/colors/app_color.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -62,9 +63,16 @@ class _ChatCircleShareDialogState extends State { var bean = BaseResponse.fromJson( data, (data) => InterestsBean.fromJson(data)); - circle = bean.data!; - if (circle.lists.length < 20) { + InterestsBean tempCircle = bean.data!; + + if (tempCircle.lists.isEmpty) { isMore = false; + } else { + if (page == 1) { + circle = tempCircle; + } else { + circle.lists.addAll(tempCircle.lists); + } } setState(() { @@ -87,7 +95,13 @@ class _ChatCircleShareDialogState extends State { Container( height:Get.height * 0.5, - color: Color(0xFF423055), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.sp), + topLeft: Radius.circular(10.sp)), + gradient: AppColor.bgHorLinearGradient, + + ), child: circle.lists.isEmpty ? !isMore ? noResultWidget() diff --git a/circle_app/lib/circle_app/chat/widget/chat_gift_pannel.dart b/circle_app/lib/circle_app/chat/widget/chat_gift_pannel.dart index 6c330d8..e2bd81c 100644 --- a/circle_app/lib/circle_app/chat/widget/chat_gift_pannel.dart +++ b/circle_app/lib/circle_app/chat/widget/chat_gift_pannel.dart @@ -66,7 +66,7 @@ class _ChatGiftPannelState extends State children: [ Expanded(child: Container()), Container( - margin: EdgeInsets.only(bottom: 10.sp,right: 15.sp), + margin: EdgeInsets.only(bottom: 10.sp,left: 15.sp), child: GestureDetector( onTap: () { showRechargeScreenDialog().then((value) { @@ -75,7 +75,7 @@ class _ChatGiftPannelState extends State }, child: Container( child: Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, children: [ Image.asset(getMineImage('bi_icon4'),width: 30.sp,), Text('首充大礼包',style: TextStyle(color: AppColor.mainColor,fontSize: 16.sp,fontWeight: FontWeight.bold),) diff --git a/circle_app/lib/circle_app/chat/widget/gift.dart b/circle_app/lib/circle_app/chat/widget/gift.dart index 1763c34..d53d344 100644 --- a/circle_app/lib/circle_app/chat/widget/gift.dart +++ b/circle_app/lib/circle_app/chat/widget/gift.dart @@ -73,7 +73,7 @@ class _GiftState extends State { AssetsDataDataPriceConfs info = AssetsDataDataPriceConfs.fromJson(response.last); balanceTipStr = info.remark!.isNotEmpty - ? '首冲最高赠送' + info.remark!.split('送').last + '>' + ? '首充最高赠送' + info.remark!.split('送').last + '>' : '充值>'; } } @@ -139,7 +139,7 @@ class _GiftState extends State { fontWeight: FontWeight.w500), ), SizedBox( - width: 16.sp, + width: 8.sp, ), Text( balanceTipStr, diff --git a/circle_app/lib/circle_app/chat/widget/send_vip_tip_dialog.dart b/circle_app/lib/circle_app/chat/widget/send_vip_tip_dialog.dart new file mode 100644 index 0000000..71180eb --- /dev/null +++ b/circle_app/lib/circle_app/chat/widget/send_vip_tip_dialog.dart @@ -0,0 +1,138 @@ + +import 'package:circle_app/commons/colors/app_color.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import 'chat_gift_pannel.dart'; + + + +class SendVipDialog extends StatefulWidget { + + String conversationID; + SendVipDialog(this.conversationID); + @override + _SendVipDialogState createState() => new _SendVipDialogState(); + +} + +class _SendVipDialogState extends State { + // TODO: add state variables and methods + + @override + Widget build(BuildContext context) { + // TODO: add widget build method + return GestureDetector( + onTap: () { + + }, + child: Scaffold( + backgroundColor: Colors.transparent, + body: Center( + child: Container( + constraints: BoxConstraints( + maxHeight: 170.sp + ), + margin: EdgeInsets.only(left: 15.sp,right: 15.sp), + padding: EdgeInsets.only(left: 15.sp,right: 15.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: AppColor.bgHorLinearGradient + // gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), + // border: Gra0ientBoxBorder( + // gradient: + // AppColor.mainVerLinearGradient, + // width: 1.sp, + // ), + ), + child: Column( + children: [ + + Column( + children: [ + SizedBox(height: 20.sp,), + Container( + child: Text( + '温馨提示', + style: TextStyle(color: Colors.white.withOpacity(0.75), fontSize: 17.sp,), + ), + ), + Container( + margin: EdgeInsets.only(top: 12.sp), + child: Text( + '因对方未开会员可能回不了您的消息,可以帮他解锁会员【成为会员】,畅聊更多话题~', + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 20.sp,), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Get.back(); + + }, + child: Container( + height: 42.sp, + width: 126.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + color: Color(0x26FFFFFF) + ), + alignment: Alignment.center, + child: Text( + '放弃', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + GestureDetector( + onTap: () async { + Get.back(); + Get.bottomSheet( + ChatGiftPannel( + accid: widget.conversationID, + selectedIndex: 1, + ), + isScrollControlled: false, + enableDrag: false, + ); + }, + child: Container( + height: 42.sp, + width: 126.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: AppColor.mainVerLinearGradient + ), + child: Text( + '解锁', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/circle_app/lib/circle_app/chat/widget/svg_dialog.dart b/circle_app/lib/circle_app/chat/widget/svg_dialog.dart index 4108b0f..5da662c 100644 --- a/circle_app/lib/circle_app/chat/widget/svg_dialog.dart +++ b/circle_app/lib/circle_app/chat/widget/svg_dialog.dart @@ -33,12 +33,16 @@ class _SvgDialogState extends State void loadAnimation() async { final videoItem = await SVGAParser.shared.decodeFromURL( widget.url); - animationController.videoItem = videoItem; - animationController - .forward() // Try to use .forward() .reverse() - .whenComplete(() { - Get.back(); - }); + try { + animationController.videoItem = videoItem; + animationController + .forward() // Try to use .forward() .reverse() + .whenComplete(() { + Get.back(); + }); + } catch (e) { + + } } @override diff --git a/circle_app/lib/circle_app/chat/widget/wish_dialog.dart b/circle_app/lib/circle_app/chat/widget/wish_dialog.dart index 6cf13ea..c7ea755 100644 --- a/circle_app/lib/circle_app/chat/widget/wish_dialog.dart +++ b/circle_app/lib/circle_app/chat/widget/wish_dialog.dart @@ -144,168 +144,166 @@ class _WishDialogState extends State { Get.back(); }, child: Container())), - SafeArea( - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.sp), - bottomRight: Radius.circular(10.sp)), - color: Color(0xFF423055), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 8.sp, bottom: 15.sp), - width: 30.sp, - height: 3.sp, - decoration: BoxDecoration( - color: Color(0x33FFFFFF), - borderRadius: BorderRadius.circular(1.5.sp)), - ), - Text( - '对方满足你的愿望后要尽快兑现承诺哈,感恩是你们建立稳定关系的保障哦~', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - Container( - height: tipStr.isNotEmpty ? 145.sp : 122.sp, - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient( - colors: [Color(0xFF132B40), Color(0xFF251240)])), - child: Column( - children: [ - if (tipStr.isNotEmpty) - Padding( - padding: EdgeInsets.only(top: 6.sp), - child: Text( - '礼物送出后,获得$tipStr小时的消息置顶', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - giftGridWidget(), - ], - ), - ), - GestureDetector( - onTap: () { - showOptionPiker(withStr); - }, - // behavior: HitTestBehavior.opaque, - child: Container( - height: 30.sp, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(15.sp)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '选择感恩方式', - style: TextStyle( - color: Color(0xB3FFFFFF), fontSize: 15.sp), - ), - Row( - children: [ - Text( - withStr.isNotEmpty ? withStr : '请选择', - style: TextStyle( - color: withStr.isNotEmpty - ? AppColor.mainColor - : Colors.white, - fontSize: 15.sp), - ), - Image.asset( - getHomeImage('icon_in'), - width: 24.sp, - ) - ], - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(top: 12.sp, bottom: 15.sp), - padding: EdgeInsets.only(left: 30.sp, right: 30.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } - var info = giftList[selectedIndex]; - sendInventWishCustomMsg( - widget.accId, jsonEncode(info), '邀请你许个愿'); - }, - child: Container( - height: 42.sp, - width: 136.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainVerLinearGradient, - ), - alignment: Alignment.center, - child: Text( - '邀请对方许愿', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), + Container( + padding: EdgeInsets.only(left: 15.sp, right: 15.sp,bottom: MediaQuery.of(context).padding.bottom), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.sp), + topLeft: Radius.circular(10.sp)), + gradient: AppColor.bgHorLinearGradient, + ), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 8.sp, bottom: 15.sp), + width: 30.sp, + height: 3.sp, + decoration: BoxDecoration( + color: Color(0x33FFFFFF), + borderRadius: BorderRadius.circular(1.5.sp)), + ), + Text( + '对方满足你的愿望后要尽快兑现承诺哈,感恩是你们建立稳定关系的保障哦~', + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + Container( + height: tipStr.isNotEmpty ? 145.sp : 122.sp, + margin: EdgeInsets.only(top: 12.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: LinearGradient( + colors: [Color(0xFF132B40), Color(0xFF251240)])), + child: Column( + children: [ + if (tipStr.isNotEmpty) + Padding( + padding: EdgeInsets.only(top: 6.sp), + child: Text( + '礼物送出后,获得$tipStr小时的消息置顶', + style: TextStyle( + color: AppColor.mainColor, + fontSize: 12.sp, + fontWeight: FontWeight.w500), ), ), - GestureDetector( - onTap: () { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } else if (withStr.isEmpty) { - showOKToast('请选择感恩方式'); - return; - } - var info = giftList[selectedIndex]; - info['option'] = withStr; - sendGetWishCustomMsg(widget.accId, jsonEncode(info), - '许愿:想要${info['name']}'); - }, - child: Container( - height: 42.sp, - width: 136.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFF7660FF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, + giftGridWidget(), + ], + ), + ), + GestureDetector( + onTap: () { + showOptionPiker(withStr); + }, + // behavior: HitTestBehavior.opaque, + child: Container( + height: 30.sp, + padding: EdgeInsets.only(left: 10.sp, right: 10.sp), + margin: EdgeInsets.only(top: 12.sp), + decoration: BoxDecoration( + color: Color(0x1AFFFFFF), + borderRadius: BorderRadius.circular(15.sp)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '选择感恩方式', + style: TextStyle( + color: Color(0xB3FFFFFF), fontSize: 15.sp), + ), + Row( + children: [ + Text( + withStr.isNotEmpty ? withStr : '请选择', + style: TextStyle( + color: withStr.isNotEmpty + ? AppColor.mainColor + : Colors.white, + fontSize: 15.sp), ), - ), - child: Text( - '立即许愿', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), + Image.asset( + getHomeImage('icon_in'), + width: 24.sp, + ) + ], + ), + ], + ), + )), + Container( + margin: EdgeInsets.only(top: 12.sp, bottom: 15.sp), + padding: EdgeInsets.only(left: 30.sp, right: 30.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + if (selectedIndex < 0) { + showOKToast('请选择一个礼物'); + return; + } + var info = giftList[selectedIndex]; + sendInventWishCustomMsg( + widget.accId, jsonEncode(info), '邀请你许个愿'); + }, + child: Container( + height: 42.sp, + width: 136.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: AppColor.mainVerLinearGradient, + ), + alignment: Alignment.center, + child: Text( + '邀请对方许愿', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), ), ), - ], - ), - ) - ], - ), + ), + GestureDetector( + onTap: () { + if (selectedIndex < 0) { + showOKToast('请选择一个礼物'); + return; + } else if (withStr.isEmpty) { + showOKToast('请选择感恩方式'); + return; + } + var info = giftList[selectedIndex]; + info['option'] = withStr; + sendGetWishCustomMsg(widget.accId, jsonEncode(info), + '许愿:想要${info['name']}'); + }, + child: Container( + height: 42.sp, + width: 136.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFF7660FF), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + child: Text( + '立即许愿', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + ], + ), + ) + ], ), ) ], diff --git a/circle_app/lib/circle_app/circle/logic.dart b/circle_app/lib/circle_app/circle/logic.dart index ffb0535..7b62ca7 100644 --- a/circle_app/lib/circle_app/circle/logic.dart +++ b/circle_app/lib/circle_app/circle/logic.dart @@ -39,6 +39,7 @@ class CircleLogic extends GetxController { final RefreshController refreshController = RefreshController(); final RefreshController peopleRefreshController = RefreshController(); + List visibleItems = []; bool isShowLocationDialog = false; diff --git a/circle_app/lib/circle_app/circle/view.dart b/circle_app/lib/circle_app/circle/view.dart index f09a913..c71f6ca 100644 --- a/circle_app/lib/circle_app/circle/view.dart +++ b/circle_app/lib/circle_app/circle/view.dart @@ -10,6 +10,7 @@ import 'package:circle_app/circle_app/dialog/ScreenBottomSheetDialog.dart'; import 'package:circle_app/circle_app/circle/view.dart'; import 'package:circle_app/circle_app/home/logic.dart'; import 'package:circle_app/commons/Widgets/base_tip_widget.dart'; +import 'package:circle_app/commons/colors/app_color.dart'; import 'package:circle_app/router/routers.dart'; import 'package:circle_app/utils/eventBus.dart'; import 'package:circle_app/utils/util.dart'; @@ -19,16 +20,13 @@ import 'package:flutter_pickers/style/picker_style.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:get/get.dart'; -import 'package:gradient_borders/gradient_borders.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../commons/Widgets/today_people_dialog.dart'; -import '../../commons/colors/app_color.dart'; import '../../net/api.dart'; import '../../net/dio_manager.dart'; import '../../utils/cache_img.dart'; import '../minefragment/logic.dart'; -import '../select_circle/logic.dart'; import '../userinfo/logic.dart'; import 'logic.dart'; @@ -104,14 +102,16 @@ class _CirclePageState extends State super.build(context); return GetBuilder(builder: (controller) { + if (currentIndex == 0) { + logic.isNewPeopleRed = false; + } return Scaffold( backgroundColor: Colors.transparent, body: SafeArea( child: Stack( children: [ Column(children: [ - navigatorItem(controller.statistics.value) - , + navigatorItem(controller.statistics.value), // Text(controller.state.msg), //组件使用 ]), @@ -529,7 +529,6 @@ class _CirclePageState extends State return Swiper( itemBuilder: (BuildContext context, int index) { var bean = logic.circle.lists[index]; - // final GlobalKey infoListViewKey = GlobalKey(); return InfoListView(index, bean, logic); }, onIndexChanged: (index) async { @@ -628,7 +627,9 @@ class _CirclePageState extends State getMsgImage('gift'), width: 14.sp, ), - SizedBox(width: 2.sp,), + SizedBox( + width: 2.sp, + ), Text( homelogic.inventStr, style: TextStyle( @@ -668,14 +669,37 @@ class _CirclePageState extends State : Positioned( left: 0, child: GestureDetector( - onTap: () { - Get.toNamed(Routes.DisCover); - }, - child: Image.asset( - getCircleImage('clocked_icon'), - width: 65.sp, - ), - )), + onTap: () { + Get.toNamed(Routes.DisCover); + }, + child: Container( + // width: 70.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp, top: 4.sp, bottom: 4.sp), + // height: 26.sp, + decoration: BoxDecoration( + gradient: AppColor.mainVerLinearGradient, + borderRadius: BorderRadius.circular(13.sp)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + getCircleImage('lock_icon'), + height: 18.sp, + ), + SizedBox( + width: 2.sp, + ), + Text( + '已解锁', + style: TextStyle( + color: Color(0xFFF7FAFA), + fontSize: 13.sp, + fontWeight: FontWeight.w500), + ) + ], + ), + ))), Container( alignment: Alignment.center, //padding: EdgeInsets.symmetric(horizontal: 10.sp), @@ -792,7 +816,7 @@ class _CirclePageState extends State logic.snedHelloMoreData(); }, child: Container( - padding: EdgeInsets.only(left: 2.sp,right: 2.sp), + padding: EdgeInsets.only(left: 2.sp, right: 2.sp), child: Row( children: [ Image.asset( @@ -802,7 +826,6 @@ class _CirclePageState extends State // SizedBox(width: 2.sp,), Container( margin: EdgeInsets.only(top: 4.sp), - child: Text( '30', style: TextStyle( @@ -830,11 +853,15 @@ class _CirclePageState extends State : Row( children: [ InkWell( - onTap: ()async { + onTap: () async { if (_tabController.index == 2) { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); + var data = await DioManager.instance + .get(url: Api.getUserMine); + var bean = + BaseResponse.fromJson( + data, + (data) => + MineResponseBean.fromJson(data)); User userInfoBean = bean.data.user; if (userInfoBean.vip > 0) { @@ -843,8 +870,6 @@ class _CirclePageState extends State showOKToast('领取特权之后更容易上精选'); showOepnVipDialog(); } - - } else { Get.bottomSheet( TodayPeopleDialog(isShow: true), @@ -887,20 +912,22 @@ class _CirclePageState extends State return ScreenBottomSheetDialog( genderList: _tabController.index == 1 ? logic.genderList - : _tabController.index == 0 - ? logic.new_genderList - : logic.dis_genderList, + : _tabController.index == 0 + ? logic.new_genderList + : logic.dis_genderList, orientationList: _tabController.index == 1 ? logic.orientationList : _tabController.index == 0 - ? logic.new_orientationList - :logic.dis_orientationList, - roleList: - _tabController.index == 1 ? logic.roleList : _tabController.index == 0 ? logic.new_roleList : logic.dis_roleList, + ? logic.new_orientationList + : logic.dis_orientationList, + roleList: _tabController.index == 1 + ? logic.roleList + : _tabController.index == 0 + ? logic.new_roleList + : logic.dis_roleList, isHaveCity: _tabController.index == 1, callback: (genderList, orientationList, roleList) { if (_tabController.index == 1) { - EventBusManager.fire(NearScrollTap()); _onRefresh(); } else if (_tabController.index == 0) { diff --git a/circle_app/lib/circle_app/circle/widgets/discover.dart b/circle_app/lib/circle_app/circle/widgets/discover.dart index 033ce03..dc7034c 100644 --- a/circle_app/lib/circle_app/circle/widgets/discover.dart +++ b/circle_app/lib/circle_app/circle/widgets/discover.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; @@ -31,6 +32,8 @@ import 'dart:ui' as ui show PlaceholderAlignment; const String todayAddWxStatus = 'todayAddWxStatus'; +const String firstContactTip = 'firstContactTip'; + class Discover extends StatefulWidget { int unlockWxNum; Discover(this.unlockWxNum, {super.key}); @@ -76,12 +79,21 @@ class _DiscoverState extends State final GlobalKey _key = GlobalKey(); + Timer? _timer; + + int _start = 2; + void animateToOffset(ScrollController controller, double offset, void Function() onScrollCompleted) { controller .animateTo(offset, duration: const Duration(milliseconds: 200), curve: Curves.easeIn) .then((value) { + if (widget.unlockWxNum == 0) { + stopTimer(); + startTimer(); + } + if (onScrollCompleted != null) { onScrollCompleted(); } @@ -141,12 +153,39 @@ class _DiscoverState extends State }; } + void startTimer() { + stopTimer(); // 确保定时器每次启动前都已停止 + _start = 2; + _timer = Timer.periodic(Duration(seconds: 1), (timer) { + if (_start == 0) { + sendRequest(); + stopTimer(); + } else { + _start--; + } + }); + } + + void stopTimer() { + if (_timer != null) { + _timer!.cancel(); + _timer = null; + } + } + + + sendRequest() async { + var data = + await DioManager.getInstance().postBody(url: Api.visitUserById,params: {'id': list[lastPage]['id']}); + } + @override void dispose() { // TODO: implement dispose super.dispose(); if (widget.unlockWxNum == 0) { subscripition.cancel(); + stopTimer(); } sub.cancel(); sub1.cancel(); @@ -477,22 +516,46 @@ class _DiscoverState extends State } void checkIsPopWxTip() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - var date = DateTime.now(); - final dateFormat = DateFormat("yyyy-MM-dd"); - final date2 = dateFormat.format(date); - if (sp.preferences!.containsKey(todayAddWxStatus)) { - var lastDate = sp.preferences!.getString(todayAddWxStatus); - if (lastDate != date2) { - loadWxNumData(); - sp.preferences!.setString(todayAddWxStatus, date2); - } - } else { - sp.preferences!.setString(todayAddWxStatus, date2); + bool isShow = await isFirstContactTip(); + if (isShow) { loadWxNumData(); } } + Future isFirstContactTip() async { + SharedPreferencesHelper preferences = await SharedPreferencesHelper.getInstance(); + String time = await preferences!.getString(firstContactTip) ?? ''; + if (time.isNotEmpty) { + DateTime dateTime = DateTime.parse(time); + bool isShow = !isWithinOneMonth(dateTime,DateTime.now()); + if (isShow) { + preferences!.setString(firstContactTip, DateTime.now().toString()); + } + return isShow; + } else { + preferences!.setString(firstContactTip, DateTime.now().toString()); + } + return true; + } + + bool isWithinOneMonth(DateTime time1, DateTime time2) { + // 加上一个月 + DateTime time1PlusOneMonth = DateTime( + time1.year, + time1.month + 1, + time1.day, + time1.hour, + time1.minute, + time1.second, + time1.millisecond, + time1.microsecond, + ); + + // 检查 time2 是否在 time1 和 time1PlusOneMonth 之间 + return time2.isAfter(time1) && time2.isBefore(time1PlusOneMonth); + } + + loadWxNumData() async { var data = await DioManager.instance.get( url: Api.checkWxNumState, diff --git a/circle_app/lib/circle_app/circle/widgets/like_view.dart b/circle_app/lib/circle_app/circle/widgets/like_view.dart index 08e2716..d832778 100644 --- a/circle_app/lib/circle_app/circle/widgets/like_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/like_view.dart @@ -20,6 +20,7 @@ import 'package:get/get.dart'; import 'package:gradient_borders/box_borders/gradient_box_border.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:visibility_detector/visibility_detector.dart'; import '../../../commons/Widgets/base_tip_widget.dart'; import '../../../commons/Widgets/tag_widget.dart'; @@ -68,6 +69,11 @@ class _LikeViewState extends State // if (null != scroToTop) { // EventBusManager.cancelSubscription(scroToTop!); // } + try { + scrollController.position.isScrollingNotifier + .removeListener(isScrollingListener); + } catch (e) {} + _timer?.cancel(); EventBusManager.cancelSubscription(likeRefreshSub!); moreScrollController.dispose(); scrollController.dispose(); @@ -77,7 +83,9 @@ class _LikeViewState extends State StreamSubscription? callRefreshCicle = null; StreamSubscription? scroToTop = null; StreamSubscription? likeRefreshSub = null; - + List visibleItems = []; + bool isScrolling = false; + Timer? _timer; @override void initState() { // TODO: implement initState @@ -97,21 +105,57 @@ class _LikeViewState extends State refreshData(); }); moreScrollController.addListener(() { - if (moreScrollController.position.maxScrollExtent == moreScrollController.offset) { - Get.toNamed(Routes.FriendsPage,arguments: 1); + if (moreScrollController.position.maxScrollExtent == + moreScrollController.offset) { + Get.toNamed(Routes.FriendsPage, arguments: 1); } }); } + void isScrollingListener() { + if (scrollController.hasClients && + scrollController.position.isScrollingNotifier.hasListeners) { + isScrolling = scrollController.position.isScrollingNotifier.value; + if (isScrolling) { + isScrolling = true; + _stopTimer(); + } else { + _startTimer(); + } + } + } + + void _startTimer() { + // isScrolling = true; + _timer?.cancel(); // 取消现有的定时器 + _timer = Timer(Duration(seconds: 1), _executeTask); + } + + void _stopTimer() { + _timer?.cancel(); + } + + void _executeTask() { + if (!isScrolling) { + // 在这里执行你的任务 + print("执行任务"); + isScrolling = false; + sendReadBottleData(); + _stopTimer(); + } + } + + sendReadBottleData() async { + var data = await DioManager.getInstance() + .post(url: Api.readCalloutByIds, params: {'ids': visibleItems}); + } + loadActiveUsersData() async { // if (likeMore) { - var data = await DioManager.instance.get( - url: Api.activeUsers); + var data = await DioManager.instance.get(url: Api.activeUsers); if (data["code"] == 200) { peopleList = data['data']; - setState(() { - - }); + setState(() {}); } } @@ -231,8 +275,7 @@ class _LikeViewState extends State // if (bean.user!.id == userId) { // Get.toNamed(AppRoutes.UserInfoActivity); // } else { - Get.toNamed(Routes.UserInfoPage, - arguments: bean.user!.id!.toString()); + Get.toNamed(Routes.UserInfoPage, arguments: bean.user!.id!.toString()); // } // }); @@ -278,15 +321,12 @@ class _LikeViewState extends State url: "/up-service/callout/${bean.id}/chat", ); if (data["code"] == 200) { - pushChatPage(data['data']['account_id'] - .toString() - .split("_") - .last, + pushChatPage(data['data']['account_id'].toString().split("_").last, data['data']['account_id'], bean.user!.nickname!); await Future.delayed(Duration(seconds: 1)); SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); + await SharedPreferences.getInstance(); // SharedPreferencesHelper.getInstance().then((sharedPreferences) { int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; @@ -365,6 +405,8 @@ class _LikeViewState extends State controller: scrollController, itemCount: lists.length + recomanddlists.length + 1, itemBuilder: (context, index) { + scrollController.position.isScrollingNotifier + .addListener(isScrollingListener); if (lists.length - 1 >= index) { var list = lists[index]; if (lists.length - 1 == index) { @@ -372,7 +414,6 @@ class _LikeViewState extends State if (list.isQueen!) { return Column( children: [ - vipDynamicItem(list), GestureDetector( onTap: () { @@ -386,7 +427,7 @@ class _LikeViewState extends State decoration: BoxDecoration( color: AppColor.bgColor, borderRadius: - BorderRadius.circular(5.sp)), + BorderRadius.circular(5.sp)), child: Text( ' 展开更早发布的喊话 ↓ ', style: TextStyle( @@ -400,7 +441,6 @@ class _LikeViewState extends State } else { return Column( children: [ - normalDynamicItem(list), GestureDetector( onTap: () { @@ -415,16 +455,16 @@ class _LikeViewState extends State decoration: BoxDecoration( border: GradientBoxBorder( gradient: - AppColor.mainVerLinearGradient, + AppColor.mainVerLinearGradient, width: 1.sp, ), borderRadius: - BorderRadius.circular(5.sp)), + BorderRadius.circular(5.sp)), child: Column( crossAxisAlignment: - CrossAxisAlignment.center, + CrossAxisAlignment.center, mainAxisAlignment: - MainAxisAlignment.center, + MainAxisAlignment.center, children: [ Text( ' 展开更早发布的喊话 ↓ ', @@ -450,10 +490,11 @@ class _LikeViewState extends State ], ); } else { - return Column( - children: [ - if (index == 0 && peopleList.isNotEmpty) - morePeoleListWidget(),normalDynamicItem(list)]); + return Column(children: [ + if (index == 0 && peopleList.isNotEmpty) + morePeoleListWidget(), + normalDynamicItem(list) + ]); } } else if (lists.length == index && recomanddlists.isNotEmpty) { @@ -461,39 +502,55 @@ class _LikeViewState extends State } else if (index - lists.length < recomanddlists.length) { var list = recomanddlists[index - lists.length]; if (list.isQueen!) { - return vipDynamicItem(list); + return VisibilityDetector( + key: Key(index.toString()), + onVisibilityChanged: (visibilityInfo) { + _onVisibilityChanged( + list.id!, + visibilityInfo.visibleFraction > 0.0, + ); + }, + child: vipDynamicItem(list)); } else { - return normalDynamicItem(list); + return VisibilityDetector( + key: Key(index.toString()), + onVisibilityChanged: (visibilityInfo) { + _onVisibilityChanged( + list.id!, + visibilityInfo.visibleFraction > 0.0, + ); + }, + child: normalDynamicItem(list)); } } else { return Container( margin: - EdgeInsets.only(top: recomandMore ? 0 : 10.sp), + EdgeInsets.only(top: recomandMore ? 0 : 10.sp), child: recomandMore ? loaddingWidget(recomandMore) : GestureDetector( - onTap: () { - widget.changeCallback(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getLoginImage('start_bg'), - width: 180.sp, + onTap: () { + widget.changeCallback(); + }, + child: Container( + margin: EdgeInsets.only(bottom: 10.sp), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getLoginImage('start_bg'), + width: 180.sp, + ), + Text( + '查看更多圈子', + style: TextStyle( + color: Colors.white, + fontSize: 18.sp), + ) + ], + ), ), - Text( - '查看更多圈子', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ) - ], - ), - ), - )); + )); } }), ), @@ -516,11 +573,21 @@ class _LikeViewState extends State ); } + void _onVisibilityChanged(int id, bool visible) async { + if (visible) { + if (!visibleItems.contains(id)) { + visibleItems.add(id); + } + } else { + visibleItems.remove(id); + } + } + morePeoleListWidget() { return Container( width: Get.width, height: 75.sp, - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), child: ListView.builder( controller: moreScrollController, scrollDirection: Axis.horizontal, @@ -532,7 +599,7 @@ class _LikeViewState extends State } return peopleWidget(peopleList[index]); }, - itemCount: peopleList.length < 10 ? peopleList.length + 1 : 10, + itemCount: peopleList.length < 10 ? peopleList.length + 1 : 10, ), ); } @@ -540,7 +607,7 @@ class _LikeViewState extends State Widget MoreItem() { return GestureDetector( onTap: () { - Get.toNamed(Routes.FriendsPage,arguments: 1); + Get.toNamed(Routes.FriendsPage, arguments: 1); }, child: Container( // width: 68.sp, @@ -591,10 +658,9 @@ class _LikeViewState extends State peopleWidget(Map info) { return GestureDetector( onTap: () { - Get.toNamed(Routes.UserInfoPage,arguments: info['id'].toString()); + Get.toNamed(Routes.UserInfoPage, arguments: info['id'].toString()); }, child: Stack( - children: [ Container( margin: EdgeInsets.only(left: 12.sp), @@ -608,8 +674,7 @@ class _LikeViewState extends State width: 52.sp, decoration: BoxDecoration( gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(26.sp) - ), + borderRadius: BorderRadius.circular(26.sp)), ), ClipOval( child: Image.network( @@ -620,30 +685,29 @@ class _LikeViewState extends State ), ), 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, - ), - ))) + 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: 3.sp, @@ -655,7 +719,6 @@ class _LikeViewState extends State ], ), ), - ], ), ); @@ -680,7 +743,7 @@ class _LikeViewState extends State // pushOtherPeopleHomePage(element.id.toString()); }, child: - circleWidget(element.avatar!, element.id.toString(), width: 24), + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -751,7 +814,7 @@ class _LikeViewState extends State alignment: Alignment.center, children: [ Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), padding: EdgeInsets.only(left: 15.sp, right: 15.sp), alignment: Alignment.center, height: 28.sp, @@ -764,8 +827,7 @@ class _LikeViewState extends State bottomLeft: Radius.circular(12.sp))), child: Text( (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + - '...' + ? (lists.user!.city ?? '外星').substring(0, 4) + '...' : (lists.user!.city ?? '外星'), style: TextStyle(color: Colors.white, fontSize: 15.sp), )) @@ -803,73 +865,73 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + Row( 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!), - // lists.user?.vip != null && - // lists.user!.vip == 0 - // ? Container() - // : Image.asset( - // getCircleImage(lists.user!.vip == 1 - // ? 'vip' - // : 'year_vip'), - // width: 36.sp, - // ) - ], + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), 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, - ), - ), - ) - ], + width: 8.sp, ), + UserTagWidget(lists.user!.mark!), + // lists.user?.vip != null && + // lists.user!.vip == 0 + // ? Container() + // : Image.asset( + // getCircleImage(lists.user!.vip == 1 + // ? 'vip' + // : 'year_vip'), + // width: 36.sp, + // ) ], ), - )), + SizedBox( + 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, + ), + ), + ) + ], + ), + ], + ), + )), ], ), ), @@ -882,44 +944,46 @@ class _LikeViewState extends State height: picHeight, // color: Colors.red, - margin: EdgeInsets.only(top: 5.sp,), + margin: EdgeInsets.only( + top: 5.sp, + ), child: picHeight == 140.sp ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(Routes.SwiperPage, arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId': lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedImg( - imageUrl: album.url!, - fit: BoxFit.cover, - ), - ), - ); - }), + itemCount: lists.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: 0.7 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(Routes.SwiperPage, arguments: { + 'imaglist': imgList, + 'index': currentIndex, + 'userId': lists.user!.id.toString() + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedImg( + imageUrl: album.url!, + fit: BoxFit.cover, + ), + ), + ); + }), ), Container( height: 30.sp, @@ -932,29 +996,29 @@ class _LikeViewState extends State children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), GestureDetector( onTap: () { pushMsgPage( @@ -973,14 +1037,12 @@ class _LikeViewState extends State ), ), Container( - - margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), + margin: EdgeInsets.only(bottom: 10.sp, top: 5.sp), child: circleInfoItem(lists.interest, lists, index), ) ], ), ), - ])), ); } @@ -1019,7 +1081,7 @@ class _LikeViewState extends State child: GestureDetector( onTap: () {}, child: - circleWidget(element.avatar!, element.id.toString(), width: 24), + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -1061,7 +1123,7 @@ class _LikeViewState extends State alignment: Alignment.center, children: [ Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), + // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), padding: EdgeInsets.only(left: 15.sp, right: 15.sp), alignment: Alignment.center, height: 28.sp, @@ -1075,10 +1137,10 @@ class _LikeViewState extends State child: Text( (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0, 4) + - '...' + '...' : (lists.user!.city ?? '外星'), style: - TextStyle(color: Colors.white, fontSize: 15.sp), + TextStyle(color: Colors.white, fontSize: 15.sp), )) ], ), @@ -1113,64 +1175,63 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only( - left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + Row( 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!), - ], + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), 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, - ), - ), - ) - ], + 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, + ), + ), + ) + ], + ), + ], + ), + )), ], ), ), @@ -1181,59 +1242,59 @@ class _LikeViewState extends State ), picHeight > 0 ? Container( - // color: Colors.red, - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: - VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: - const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 4.sp, - mainAxisSpacing: 4.sp, - childAspectRatio: 0.7 - //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - if (album.type == 2) { - return ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: VideoItemWidget(album.url!)); - } - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(Routes.SwiperPage, - arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId': - lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedImg( - imageUrl: album.url!, - fit: BoxFit.cover, - ), - ), - ); - })) + // color: Colors.red, + height: picHeight, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 140.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: + VideoItemWidget(lists.album![0].url!)) + : GridView.builder( + itemCount: lists.album!.length, + physics: + const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 4.sp, + mainAxisSpacing: 4.sp, + childAspectRatio: 0.7 + //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + if (album.type == 2) { + return ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: VideoItemWidget(album.url!)); + } + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(Routes.SwiperPage, + arguments: { + 'imaglist': imgList, + 'index': currentIndex, + 'userId': + lists.user!.id.toString() + }); + }, + child: ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: CachedImg( + imageUrl: album.url!, + fit: BoxFit.cover, + ), + ), + ); + })) : Container(), Container( height: 30.sp, @@ -1242,7 +1303,7 @@ class _LikeViewState extends State right: 10.sp, ), margin: - EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), + EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000)), @@ -1250,29 +1311,29 @@ class _LikeViewState extends State children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontSize: 14.sp), + )), GestureDetector( onTap: () async { pushMsgPage( @@ -1288,8 +1349,7 @@ class _LikeViewState extends State ), ), Container( - - margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), + margin: EdgeInsets.only(bottom: 10.sp, top: 5.sp), child: circleInfoItem(lists.interest, lists, index), ) ], @@ -1311,14 +1371,13 @@ class _LikeViewState extends State if (showTitle) logic.recommendCircleFriendData.isNotEmpty ? Container( - // color: Colors.red, - child: RecommendCircleFriendItem( - false,0, - recommendCircleFriendData: logic.recommendCircleFriendData, - getDataCallBack: () { - logic.loadRecommendCircleFriendData(); - }), - ) + // color: Colors.red, + child: RecommendCircleFriendItem(false, 0, + recommendCircleFriendData: logic + .recommendCircleFriendData, getDataCallBack: () { + logic.loadRecommendCircleFriendData(); + }), + ) : Container(), if (showTitle) Container( @@ -1340,9 +1399,9 @@ class _LikeViewState extends State children: [ Expanded( child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), Container( margin: EdgeInsets.only(left: 8.sp, right: 8.sp), height: 2.sp, @@ -1374,9 +1433,9 @@ class _LikeViewState extends State ), Expanded( child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), ], ), ) @@ -1431,41 +1490,41 @@ class _LikeViewState extends State ), Expanded( child: Container( - padding: EdgeInsets.only( - left: 8.sp, - top: 12.sp, + padding: EdgeInsets.only( + left: 8.sp, + top: 12.sp, + ), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + bean['title'], + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['view_total'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], + SizedBox( + height: 4.sp, ), - )), + Text( + // "view_total" -> 21 + '${convertToTenThousand(bean['view_total'])}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), Container( margin: EdgeInsets.only(right: 8.sp), child: GestureDetector( - //加入圈子 + //加入圈子 onTap: () async { CircleLogic cLogic = Get.find(); if (bean['is_join']) { @@ -1520,7 +1579,7 @@ class _LikeViewState extends State Text( !bean['is_join'] ? '申请加入' : '分享有奖', style: - TextStyle(color: Colors.white, fontSize: 12.sp), + TextStyle(color: Colors.white, fontSize: 12.sp), ) ], )), @@ -1598,7 +1657,7 @@ class _LikeViewState extends State child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( diff --git a/circle_app/lib/circle_app/circle/widgets/vicinity.dart b/circle_app/lib/circle_app/circle/widgets/vicinity.dart index afb7005..785f935 100644 --- a/circle_app/lib/circle_app/circle/widgets/vicinity.dart +++ b/circle_app/lib/circle_app/circle/widgets/vicinity.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/circle_app/circle/logic.dart'; import 'package:circle_app/circle_app/circle/view.dart'; @@ -14,6 +16,7 @@ import 'package:get/get_core/src/get_main.dart'; import 'package:gradient_borders/box_borders/gradient_box_border.dart'; import 'package:keframe/keframe.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:visibility_detector/visibility_detector.dart'; import '../../../commons/Widgets/tag_widget.dart'; import 'package:flutter_bmflocation/flutter_bmflocation.dart'; @@ -21,6 +24,8 @@ import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import '../../../commons/colors/app_color.dart'; import 'dart:ui' as ui show PlaceholderAlignment; +import '../../../net/api.dart'; +import '../../../net/dio_manager.dart'; import '../../../utils/cache_img.dart'; class Vicinity extends StatefulWidget { @@ -38,6 +43,11 @@ class _VicinityState extends State ScrollController _scrollController = ScrollController(); double maxOff = 0; + + + bool isScrolling = false; + Timer? _timer; + @override bool get wantKeepAlive => true; @override @@ -59,7 +69,12 @@ class _VicinityState extends State // TODO: implement dispose super.dispose(); _scrollController.dispose(); + try { + _scrollController.position.isScrollingNotifier.removeListener(isScrollingListener); + } catch (e) { + } + _timer?.cancel(); sub.cancel(); } @@ -82,14 +97,24 @@ class _VicinityState extends State padding: EdgeInsets.all(10.sp), itemCount: widget.logic.vicinityList.length + 1, itemBuilder: (context, index) { + _scrollController.position.isScrollingNotifier + .addListener(isScrollingListener); if (index == 0) { return bannerView(widget.logic); } else { return FrameSeparateWidget( index: index, - child: ListItem( + child: VisibilityDetector( + key: Key(index.toString()), + onVisibilityChanged: (visibilityInfo) { + _onVisibilityChanged( + index - 1, + visibilityInfo.visibleFraction > 0.0, + ); + }, + child: ListItem( widget.logic.vicinityList[index - 1], - index - 1)); + index - 1))); } }, ), @@ -121,6 +146,59 @@ class _VicinityState extends State }); } + void _onVisibilityChanged(int index, bool visible) async { + int id = widget.logic.vicinityList[index].id; + if (visible) { + if (!widget.logic.visibleItems.contains(id)) { + widget.logic.visibleItems.add(id); + } + } else { + widget.logic.visibleItems.remove(id); + } + } + + void isScrollingListener() { + if (_scrollController.hasClients && _scrollController.position.isScrollingNotifier.hasListeners) { + isScrolling = _scrollController.position.isScrollingNotifier.value; + if (isScrolling) { + isScrolling = true; + _stopTimer(); + } else { + + _startTimer(); + } + } + } + + + void _startTimer() { + // isScrolling = true; + _timer?.cancel(); // 取消现有的定时器 + _timer = Timer(Duration(seconds: 1), _executeTask); + } + + void _stopTimer() { + _timer?.cancel(); + } + + void _executeTask() { + if (!isScrolling) { + // 在这里执行你的任务 + print("执行任务"); + isScrolling = false; + sendReadPeopleData(); + _stopTimer(); + } + } + + + sendReadPeopleData() async { + var data = + await DioManager.getInstance().post( + url: Api.visitUserByIds, params: {'ids': widget.logic.visibleItems}); + } + + Widget bannerView(CircleLogic controller) { return SizedBox( height: 160.sp, diff --git a/circle_app/lib/circle_app/circle_list/view.dart b/circle_app/lib/circle_app/circle_list/view.dart index 74171ad..f8f6eb6 100644 --- a/circle_app/lib/circle_app/circle_list/view.dart +++ b/circle_app/lib/circle_app/circle_list/view.dart @@ -110,76 +110,87 @@ class _CircleListPageState extends State logic.update(); } - return logic.isLoadFial ? noResultWidget(tip:'',callBack: () { - logic.isLoadFial = false; - logic.isLoad = true; - logic.update(); - logic.loadMyInfo(); - logic.loadData(); - }) : logic.isLoad - ? loaddingWidget(true) - : Container( - width: Get.width, - height: Get.height, - child: Row( - children: [ - Container( - width: 65.sp, - child: Column( - children: [ - leftItem('', logic.currentIndex == -1, false, -1), - leftItem('', logic.currentIndex == -2, false, -2), - Container( - alignment: Alignment.center, - height: 20, - child: Container( - width: 33.sp, - height: 1.sp, - color: Color(0x4DFFFFFF), - )), - Expanded( - child: MediaQuery.removePadding( - removeTop: true, - context: context, - child: ListView.builder( - controller: logic.myCircleCtr, - itemBuilder: (context, index) { - return leftItem( - logic.mycircle.lists[index].title, - logic.currentIndex == index, - logic.hasNewList.length > index - ? logic.hasNewList[index] - : false, - index); - }, - itemCount: logic.mycircle.lists.length, - ))) - ], - )), - Expanded( - child: Container( - child: logic.currentIndex == -1 - ? circleRecommandWidget() - : logic.currentIndex == -2 - ? LikeView( - changeCallback: () { - logic.currentIndex = -1; - logic.update(); - }, - ) - : RightCircleIten( logic.currentIndex, - logic.mycircle - .lists[logic.currentIndex], - logic,key: ValueKey( - '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'),))) + return logic.isLoadFial + ? noResultWidget( + tip: '', + callBack: () { + logic.isLoadFial = false; + logic.isLoad = true; + logic.update(); + logic.loadMyInfo(); + logic.loadData(); + }) + : logic.isLoad + ? loaddingWidget(true) + : Container( + width: Get.width, + height: Get.height, + child: Row( + children: [ + Container( + width: 65.sp, + child: Column( + children: [ + leftItem( + '', logic.currentIndex == -1, false, -1), + leftItem( + '', logic.currentIndex == -2, false, -2), + Container( + alignment: Alignment.center, + height: 20, + child: Container( + width: 33.sp, + height: 1.sp, + color: Color(0x4DFFFFFF), + )), + Expanded( + child: MediaQuery.removePadding( + removeTop: true, + context: context, + child: ListView.builder( + controller: logic.myCircleCtr, + itemBuilder: (context, index) { + return leftItem( + logic.mycircle.lists[index] + .title, + logic.currentIndex == index, + logic.hasNewList.length > + index + ? logic.hasNewList[index] + : false, + index); + }, + itemCount: + logic.mycircle.lists.length, + ))) + ], + )), + Expanded( + child: Container( + child: logic.currentIndex == -1 + ? circleRecommandWidget() + : logic.currentIndex == -2 + ? LikeView( + changeCallback: () { + logic.currentIndex = -1; + logic.update(); + }, + ) + : RightCircleIten( + logic.currentIndex, + logic.mycircle + .lists[logic.currentIndex], + logic, + key: ValueKey( + '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'), + ))) - // InfoListView( + // InfoListView( - - // ))) - ], - ), - ); + // ))) + ], + ), + ); }), ), ); @@ -638,7 +649,7 @@ class _CircleListPageState extends State )); } - leftItem(String text, bool isSelcted, bool isUnread, int index) { + leftItem(String text, bool isSelcted, bool isUnread, int index) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -687,9 +698,11 @@ class _CircleListPageState extends State maxWidth: double.infinity, minHeight: 0.0, maxHeight: double.infinity, - child: Image.asset(getCircleImage('circle_selected_bg'),width: 65.sp,), + child: Image.asset( + getCircleImage('circle_selected_bg'), + width: 65.sp, + ), ), - if (text.isEmpty && index == -1) topCicleStatusItem( isSelcted, diff --git a/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart b/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart index d088aa2..3c6d8f7 100644 --- a/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart +++ b/circle_app/lib/circle_app/circle_list/widgets/right_circle_iten.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:circle_app/circle_app/circle_list/widgets/hug_tip.dart'; import 'package:circle_app/commons/colors/app_color.dart'; import 'package:flutter/foundation.dart'; @@ -26,6 +28,7 @@ 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 'package:visibility_detector/visibility_detector.dart'; import '../../../commons/Widgets/tag_widget.dart'; import '../../../net/api.dart'; @@ -82,8 +85,8 @@ class _RightCircleItenState extends State void initState() { super.initState(); sub = EventBusManager.on().listen((event) { - isSetState = false; - setState(() {}); + isSetState = false; + setState(() {}); }); circleId = widget.bean.id.toString(); @@ -109,7 +112,6 @@ class _RightCircleItenState extends State loadInterestAgent(); } - loadInterestAgent() async { var data = await DioManager.instance.get( url: "${Api.interestAgent}$circleId", @@ -296,98 +298,100 @@ class _RightCircleItenState extends State ), ), 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(Routes.UserInfoPage,arguments: interestAgentMap['user']['id'].toString()); - } - - }, - child: Text( - interestAgentMap.isNotEmpty ? interestAgentMap['user']['nickname'] : '', - style: TextStyle(color: AppColor.mainColor, fontSize: 13.sp), + 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), ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMineImage('bi_icon1'), - width: 20.sp, - ), - Text( - '${convertToThousand(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), - ), + GestureDetector( + onTap: () { + if (interestAgentMap.isNotEmpty) { + Get.toNamed(Routes.UserInfoPage, + 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( + '${convertToThousand(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( - 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), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + ), 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, + 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, + ), + ), + ], + ), ), ), ), - ), - ], - ) - ], + ], + ) + ], + ), ), - ), - ], ); } @@ -474,10 +478,13 @@ class _RightCircleItenState extends State double contentHeight(String content) { return calculateTextHeight( - content, 17.sp, FontWeight.w300, Get.currentRoute == Routes.Home ? Get.width - 90.sp : Get.width - 64.sp, 3); + content, + 17.sp, + FontWeight.w300, + Get.currentRoute == Routes.Home ? Get.width - 90.sp : Get.width - 64.sp, + 3); } - @override Widget build(BuildContext context) { if (widget.bean.image.isEmpty) { @@ -503,10 +510,8 @@ class _RightCircleItenState extends State }); } - double textHeight = contentHeight(widget.bean.intro); - return ClipRRect( borderRadius: BorderRadius.circular(10.sp), child: Container( @@ -527,180 +532,208 @@ class _RightCircleItenState extends State height: Get.height, width: Get.width, margin: EdgeInsets.only(top: 72.sp), - child: NotificationListener( + child: NotificationListener( onNotification: (notification) { - if (notification is OverscrollNotification && notification.overscroll < -15) { + if (notification is OverscrollNotification && + notification.overscroll < -15) { // 下拉刷新时禁用NestedScrollView的滚动 - if (!refreshController.isLoading && scrollController.offset == 0) { + if (refreshController.headerStatus != RefreshStatus.refreshing && + scrollController.offset == 0) { count++; - print(notification); - if (count > 0 && count == 2 ) { - - refreshController.requestRefresh(); - - } - return true; + if (count == 2) { + refreshController.requestRefresh(); + } } } return true; }, child: SmartRefresher( - controller: refreshController, + // scrollController: scrollController, onRefresh: () { - EventBusManager.fire(RightRefreshContrller(_tabController.index)); + EventBusManager.fire( + RightRefreshContrller(_tabController.index)); Future.delayed(Duration(milliseconds: 200), () { refreshController.refreshCompleted(); loadInterestAgent(); count = 0; }); - // refreshController.refreshToIdle(); }, - enablePullDown:true, - enablePullUp: false, - + enablePullDown: true, + enablePullUp: true, child: NestedScrollView( - // physics: ClampingScrollPhysics(), - controller: scrollController, - headerSliverBuilder: (context, isScrolled) { - print('isScrolled' + isScrolled.toString()); - return [ - SliverToBoxAdapter( - child: 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, - ), + controller: scrollController, + headerSliverBuilder: (context, isScrolled) { + print('isScrolled' + isScrolled.toString()); + + return [ + if (!isScrolled) + SliverToBoxAdapter( + child: circleTiitleWidget( + urlList, + widgets, + )), + SliverPersistentHeader( + pinned: true, + delegate: MySliverAppBarDelegate( + minHeight: 35, + maxHeight: 35, + child: Stack( + fit: StackFit.expand, + children: [ + Container( + color: AppColor.bgColor, + child: Image.asset( + getCircleImage('circle_bg'), + fit: BoxFit.cover, ), ), - Tab( - child: Text( - '最新', - style: TextStyle( - fontSize: 18.sp, - ), + 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, + ), + ), + ], + ), + ), + ), + ], ), ), ], - 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,() { - _tabController.index = 1; + ]; + }, + body: TabBarView( + controller: _tabController, + children: [ + RightCircleListWidget( + widget.index, + widget.bean, + widget.logic, + 0, + scrollController, + interestAgentMap, () { + _tabController.index = 1; - setState(() { - - }); - Future.delayed(Duration(milliseconds: 200),() { - EventBusManager.fire(RightScrollViewIsEnd(true)); - }); - }), - RightCircleListWidget(widget.index, widget.bean, widget.logic,1,scrollController,interestAgentMap,(){ - - }), - ], - ), - ), - ], - ) - ), + setState(() {}); + Future.delayed(Duration(milliseconds: 200), () { + EventBusManager.fire( + RightScrollViewIsEnd(true)); + }); + }), + RightCircleListWidget( + widget.index, + widget.bean, + widget.logic, + 1, + scrollController, + interestAgentMap, + () {}), + ], + )), ), ), ), @@ -994,25 +1027,30 @@ class _RightCircleItenState extends State } void sendApplyToAgentData() async { - var data = await DioManager.instance - .post(url: Api.applyToAgent + '$circleId'); + var data = + await DioManager.instance.post(url: Api.applyToAgent + '$circleId'); if (data['code'] == 200) { - var con; - if(kDebugMode){ + if (kDebugMode) { con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ + 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); + conversationID: "c2c_qpqz_prod_10_102", + userID: "qpqz_prod_10_102", + showName: "乐园客服", + type: 1); } Get.toNamed(Routes.Chat, arguments: con); } else if (data['code'] == 32104) { - showReportDialog(Get.context!,data['msg']); + showReportDialog(Get.context!, data['msg']); } } - void showReportDialog(BuildContext context,String msg) { + void showReportDialog(BuildContext context, String msg) { showDialog( context: context, builder: (BuildContext context) { @@ -1047,7 +1085,7 @@ class _RightCircleItenState extends State child: Text( "申请代理提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( @@ -1065,7 +1103,6 @@ class _RightCircleItenState extends State mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - GestureDetector( onTap: () { Get.back(); @@ -1113,9 +1150,11 @@ class _RightCircleItenState extends State void showSendMoneyDialog(String userId) { if (interestAgentMap.isNotEmpty) { - Get.bottomSheet(HugTip(userId, interestAgentMap['rewardConfigs'], () { - loadInterestAgent(); - }),isScrollControlled: true); + Get.bottomSheet( + HugTip(userId, interestAgentMap['rewardConfigs'], () { + loadInterestAgent(); + }), + isScrollControlled: true); } } } @@ -1129,7 +1168,9 @@ class RightCircleListWidget extends StatefulWidget { Map interestAgentMap; Function changeTab; - RightCircleListWidget(this.index, this.bean, this.logic,this.type,this.scrollController,this.interestAgentMap,this.changeTab, {super.key}); + RightCircleListWidget(this.index, this.bean, this.logic, this.type, + this.scrollController, this.interestAgentMap, this.changeTab, + {super.key}); @override State createState() => _RightCircleListWidgetState(); @@ -1152,11 +1193,15 @@ class _RightCircleListWidgetState extends State var circleId = ''; List lists = []; Map interestAgentMap = {}; + List visibleItems = []; + + bool isScrolling = false; + Timer? _timer; bool isEnd = false; var sub; var sub1; - + bool isLoadCircleInfo = false; @override void dispose() { // TODO: implement dispose @@ -1164,12 +1209,19 @@ class _RightCircleListWidgetState extends State sub.cancel(); try { sub1.camcel(); - } catch (e) { - - } + } catch (e) {} callRefreshCicle?.cancel(); scrollController.dispose(); + + if (widget.type == 0) { + try { + scrollController.position.isScrollingNotifier + .removeListener(isScrollingListener); + } catch (e) {} + _timer?.cancel(); + } + super.dispose(); } @@ -1201,16 +1253,17 @@ class _RightCircleListWidgetState extends State } }); - scrollController.addListener(() { if (scrollController.offset <= 0) { - EventBusManager.fire(RightScrollViewScrollTop()); - EventBusManager.fire(RightScrollViewIsEnd(false)); - - isEnd = false; - setState(() {}); - } else if (scrollController.offset == scrollController.position.maxScrollExtent) { - if (widget.type == 0 && refreshController.footerStatus == LoadStatus.noMore) { + // EventBusManager.fire(RightScrollViewScrollTop()); + // EventBusManager.fire(RightScrollViewIsEnd(false)); + // + // isEnd = false; + // setState(() {}); + } else if (scrollController.offset == + scrollController.position.maxScrollExtent) { + if (widget.type == 0 && + refreshController.footerStatus == LoadStatus.noMore) { widget.changeTab(); } } @@ -1230,7 +1283,47 @@ class _RightCircleListWidgetState extends State loadCallOutListData(); } }); + } + + + void isScrollingListener() { + if (scrollController.hasClients && + scrollController.position.isScrollingNotifier + .hasListeners) { + isScrolling = scrollController.position.isScrollingNotifier.value; + if (isScrolling) { + isScrolling = true; + _stopTimer(); + } else { + _startTimer(); + } + } + } + + void _startTimer() { + // isScrolling = true; + _timer?.cancel(); // 取消现有的定时器 + _timer = Timer(Duration(seconds: 1), _executeTask); + } + + void _stopTimer() { + _timer?.cancel(); + } + + void _executeTask() { + if (!isScrolling) { + // 在这里执行你的任务 + print("执行任务"); + isScrolling = false; + sendReadBottleData(); + _stopTimer(); + } + } + + sendReadBottleData() async { + var data = await DioManager.getInstance() + .post(url: Api.readCalloutByIds, params: {'ids': visibleItems}); } @@ -1239,8 +1332,8 @@ class _RightCircleListWidgetState extends State url: "/up-service/interest/$circleId", ); if (data["code"] == 200) { - widget.bean = Circle.fromJson(data['data']); + isLoadCircleInfo = true; if (mounted) { setState(() {}); } @@ -1249,8 +1342,11 @@ class _RightCircleListWidgetState extends State loadCallOutListData() async { var data = await DioManager.instance.get( - url: widget.type ==0 ? '/up-service/interest/$circleId/pushCallouts' : "/up-service/interest/$circleId/newCallouts", + url: widget.type == 0 + ? '/up-service/interest/$circleId/pushCallouts' + : "/up-service/interest/$circleId/newCallouts", params: {"page": callOutPage, "page_size": "20"}); + refreshController.refreshCompleted(); if (data["code"] == 200) { List dataList = data["data"]["lists"] ?? []; if (callOutPage == 1) { @@ -1316,8 +1412,7 @@ class _RightCircleListWidgetState extends State if (bean.user!.id == userId) { Get.toNamed(Routes.UserInfoPage); } else { - Get.toNamed(Routes.UserInfoPage, - arguments: bean.user!.id!.toString()); + Get.toNamed(Routes.UserInfoPage, arguments: bean.user!.id!.toString()); } }); @@ -1400,7 +1495,7 @@ class _RightCircleListWidgetState extends State @override Widget build(BuildContext context) { - if (widget.bean.image.isEmpty) { + if (widget.bean.image.isEmpty && !isLoadCircleInfo) { loadCircleInfo(); } List urlList = widget.bean.lastJoinUsers; @@ -1423,35 +1518,96 @@ class _RightCircleListWidgetState extends State }); } - return !callOutMore && lists.isEmpty ? noResultWidget() : SmartRefresher( - controller: refreshController, - // onRefresh: refreshData, - enablePullDown:false, - onLoading: loadMore, - enablePullUp: true, + return !callOutMore && lists.isEmpty + ? noResultWidget() + :NotificationListener( + onNotification: (notification) { + if (notification is OverscrollNotification && + notification.overscroll < -5) { + if (isEnd) { + isEnd = false; + widget.scrollController.animateTo(0, + duration: Duration(milliseconds: 200), + curve: Curves.easeIn); + setState(() {}); + } + } - child:ListView.builder( - physics: isEnd - ? BouncingScrollPhysics() - : NeverScrollableScrollPhysics(), - addAutomaticKeepAlives: false, - addRepaintBoundaries: false, - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: lists.length, - shrinkWrap: true, - itemBuilder: (context, index) { - - Lists list = lists[index]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - }), - ); + return true; + }, + child: SmartRefresher( + controller: refreshController, + // onRefresh: refreshData, + enablePullDown: false, + onLoading: loadMore, + enablePullUp: true, + child: ListView.builder( + physics: !isEnd ? NeverScrollableScrollPhysics() : ClampingScrollPhysics(), + addAutomaticKeepAlives: false, + addRepaintBoundaries: false, + scrollDirection: Axis.vertical, + controller: scrollController, + itemCount: lists.length, + shrinkWrap: true, + itemBuilder: (context, index) { + if (widget.type == 0) { + scrollController.position.isScrollingNotifier + .addListener(isScrollingListener); + } + Lists list = lists[index]; + if (list.isQueen!) { + return VisibilityDetector( + key: Key(index.toString()), + onVisibilityChanged: (visibilityInfo) { + _onVisibilityChanged( + index, + visibilityInfo.visibleFraction > 0.0, + ); + }, + child:vipDynamicItem(list)); + } else { + return VisibilityDetector( + key: Key(index.toString()), + onVisibilityChanged: (visibilityInfo) { + _onVisibilityChanged( + index, + visibilityInfo.visibleFraction > 0.0, + ); + }, + child:normalDynamicItem(list)); + } + })), + ); + // CustomScrollView( + // physics: ClampingScrollPhysics(), + // // controller: scrollController, + // slivers: [ + // SliverList( + // delegate: SliverChildBuilderDelegate((context, index) { + // Lists list = lists[index]; + // if (list.isQueen!) { + // return vipDynamicItem(list); + // } else { + // return normalDynamicItem(list); + // } + // }, childCount: lists.length)) + // ]), + // ) + ; } + void _onVisibilityChanged(int index, bool visible) async { + int id = lists[index].id!; + if (visible) { + if (!visibleItems.contains(id)) { + visibleItems.add(id); + } + } else { + visibleItems.remove(id); + } + } + + ///至尊喊话 vipDynamicItem(Lists lists) { Widget descText = widget.logic.openCallOutIdList.contains(lists.id) @@ -1707,49 +1863,48 @@ class _RightCircleListWidgetState extends State ? 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.6 //宽高比为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(Routes.SwiperPage, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedImg( - imageUrl: album.url!, - fit: BoxFit.cover, + : 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.6 //宽高比为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(Routes.SwiperPage, + arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedImg( + imageUrl: album.url!, + 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), + margin: EdgeInsets.only( + top: picHeight > 0 ? 5.sp : 5.sp, bottom: 10.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000)), @@ -1833,7 +1988,10 @@ class _RightCircleListWidgetState extends State if (lists.album != null) { if (lists.album!.isNotEmpty) { Album info = lists.album!.first; - ratio = ((Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3) / picWidth; + ratio = ((Get.width - + (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp)) / + 3) / + picWidth; if (info.type == 1) { if (lists.album!.length > 3) { picHeight = picWidth * 2; @@ -2052,7 +2210,7 @@ class _RightCircleListWidgetState extends State borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget(lists.album![0].url!)) : GridView.builder( - controller: GridScrollController, + controller: GridScrollController, itemCount: lists.album!.length, physics: const NeverScrollableScrollPhysics(), gridDelegate: @@ -2060,7 +2218,8 @@ class _RightCircleListWidgetState extends State crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 4.sp, mainAxisSpacing: 4.sp, - childAspectRatio: ratio //宽高比为1时,子widget + childAspectRatio: + ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -2454,9 +2613,7 @@ class _RightCircleListWidgetState extends State content, 17.sp, FontWeight.w300, - Get.currentRoute == Routes.Home - ? Get.width - 90.sp - : Get.width - 64.sp, + Get.currentRoute == Routes.Home ? Get.width - 90.sp : Get.width - 64.sp, 100); } @@ -2488,10 +2645,42 @@ class RightScrollViewIsEnd { RightScrollViewIsEnd(this.isEnd); } - class RightScrollViewScrollTop {} class RightRefreshContrller { -int index; -RightRefreshContrller(this.index); -} \ No newline at end of file + int index; + RightRefreshContrller(this.index); +} + +class MySliverAppBarDelegate extends SliverPersistentHeaderDelegate { + MySliverAppBarDelegate({ + required this.minHeight, + required this.maxHeight, + required this.child, + }); + + final double minHeight; + final double maxHeight; + final Widget child; + + @override + double get minExtent => minHeight; + + @override + double get maxExtent => max(maxHeight, minHeight); + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return SizedBox.expand(child: child); + } + + @override + bool shouldRebuild(MySliverAppBarDelegate oldDelegate) { + return maxHeight != oldDelegate.maxHeight || + minHeight != oldDelegate.minHeight || + child != oldDelegate.child; + } +} + + diff --git a/circle_app/lib/circle_app/dialog/UpdateDialog.dart b/circle_app/lib/circle_app/dialog/UpdateDialog.dart index c8918dc..39670fc 100644 --- a/circle_app/lib/circle_app/dialog/UpdateDialog.dart +++ b/circle_app/lib/circle_app/dialog/UpdateDialog.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -// import 'package:flutter_install_app/flutter_install_app.dart'; +import 'package:flutter_install_app/flutter_install_app.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -302,7 +302,7 @@ class _CustomDialogState extends State { installApk() async { //flutter_install_app - // await AppInstaller.installApk(filePath, actionRequired: false); + await AppInstaller.installApk(filePath, actionRequired: false); } } diff --git a/circle_app/lib/circle_app/home/like_peole_sended_call_out_dialog.dart b/circle_app/lib/circle_app/home/like_peole_sended_call_out_dialog.dart new file mode 100644 index 0000000..f2a6e81 --- /dev/null +++ b/circle_app/lib/circle_app/home/like_peole_sended_call_out_dialog.dart @@ -0,0 +1,132 @@ +import 'package:circle_app/circle_app/home/logic.dart'; +import 'package:flutter/material.dart'; + +import 'package:circle_app/commons/colors/app_color.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../circle_list/logic.dart'; + +class LikePeoleSendedCallOutDialog extends StatelessWidget { + String desc; + // TODO: add state variables, methods and constructor params + LikePeoleSendedCallOutDialog(this.desc); + + @override + Widget build(BuildContext context) { + // TODO: add widget build method + return GestureDetector( + onTap: () { + + }, + child: Scaffold( + backgroundColor: Colors.transparent, + body: Center( + child: Container( + constraints: BoxConstraints( + maxHeight: 170.sp + ), + margin: EdgeInsets.only(left: 15.sp,right: 15.sp), + padding: EdgeInsets.only(left: 15.sp,right: 15.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: AppColor.bgHorLinearGradient + // gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), + // border: Gra0ientBoxBorder( + // gradient: + // AppColor.mainVerLinearGradient, + // width: 1.sp, + // ), + ), + child: Column( + children: [ + + Column( + children: [ + SizedBox(height: 20.sp,), + Container( + child: Text( + '温馨提示', + style: TextStyle(color: Colors.white.withOpacity(0.75), fontSize: 17.sp,), + ), + ), + Container( + margin: EdgeInsets.only(top: 12.sp), + child: Text( + desc, + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 20.sp,), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Get.back(); + }, + child: Container( + height: 42.sp, + width: 126.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + color: Color(0x26FFFFFF) + ), + alignment: Alignment.center, + child: Text( + '放弃', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + GestureDetector( + onTap: () async { + Get.back(); + HomeLogic logic = Get.find(); + logic.updateIndex(1); + Future.delayed(Duration(milliseconds: 500),() { + final likeLogic = Get.find(); + likeLogic.currentIndex == -2; + likeLogic.update(); + }); + + }, + child: Container( + height: 42.sp, + width: 126.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(21.sp), + gradient: AppColor.mainVerLinearGradient + ), + child: Text( + '前往查看', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w600), + ), + ), + ), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } + +} + diff --git a/circle_app/lib/circle_app/home/logic.dart b/circle_app/lib/circle_app/home/logic.dart index 5cafc50..ea3c9ab 100644 --- a/circle_app/lib/circle_app/home/logic.dart +++ b/circle_app/lib/circle_app/home/logic.dart @@ -37,6 +37,7 @@ import '../dialog/UpdateDialog.dart'; import '../invite/logic.dart'; import '../minefragment/view.dart'; import '../msg/view.dart'; +import 'like_peole_sended_call_out_dialog.dart'; import 'state.dart'; import 'package:intl/intl.dart'; @@ -195,7 +196,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { }); TencentImSDKPlugin.v2TIMManager.v2TIMMessageManager.addAdvancedMsgListener( - listener: V2TimAdvancedMsgListener(onRecvNewMessage: (message) { + listener: V2TimAdvancedMsgListener(onRecvNewMessage: (message) async { getUnreadSize(); print(message); if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) { @@ -234,8 +235,12 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { }); } else if (int.parse(event) == 3) { //喜欢列表刷新 - showOKToast(message.customElem!.desc!.toString()); - EventBusManager.fire(LikeRefresh()); + SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); + if (await sp.isFirstPeopleSendCallOut()) { + Future.delayed(Duration(seconds: 20),() { + showSendedCallOutDialog(message.customElem!.desc!.toString()); + }); + } } else if (int.parse(event) == 5) { //有人送礼会话置顶 // print(jsonData.toString()); @@ -251,13 +256,19 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { logic.update(); } else if (int.parse(event) == 8) { //有新的喊话 - World_call_outLogic logic = Get.find(); - logic.isNewMsg = true; - logic.update(); + if (Get.isRegistered()) { + 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 (int.parse(event) == 11) { + var info = jsonDecode(jsonData['content']); + EventBusManager.fire(ShowGiftNotifi(info)); + } } else if (jsonData.containsKey('type')) { int type = jsonData['type']; @@ -296,6 +307,17 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } } + showSendedCallOutDialog(String desc) { + + Get.bottomSheet( + LikePeoleSendedCallOutDialog( + desc + ), + isScrollControlled: true, + enableDrag: false, + ); + } + Future checkVersion() async { var data = await DioManager.instance.get(url: Api.APP_VERSION); var bean = BaseResponse.fromJson( @@ -366,6 +388,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { FlutterNativeSplash.remove(); final logic = Get.find(); logic.loadCirclePeopleData(); + } addBadge() { @@ -603,3 +626,8 @@ class conTop { } class MsgRecommendCardRefresh {} + +class ShowGiftNotifi { + Map info; + ShowGiftNotifi(this.info); +} \ No newline at end of file diff --git a/circle_app/lib/circle_app/home/view.dart b/circle_app/lib/circle_app/home/view.dart index 8ee376c..fd308fd 100644 --- a/circle_app/lib/circle_app/home/view.dart +++ b/circle_app/lib/circle_app/home/view.dart @@ -3,6 +3,7 @@ import 'package:circle_app/circle_app/minefragment/view.dart'; import 'package:circle_app/circle_app/msg/view.dart'; import 'package:circle_app/circle_app/world_call_out/view.dart'; import 'package:circle_app/commons/colors/app_color.dart'; +import 'package:circle_app/utils/eventBus.dart'; import 'package:circle_app/utils/util.dart'; import 'package:circle_app/view/ExitAppConfirmation.dart'; import 'package:flutter/material.dart'; @@ -10,7 +11,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../main.dart'; +import '../../router/routers.dart'; +import '../../view/notice.dart'; import '../circle_list/view.dart'; +import '../world_call_out/logic.dart'; import 'logic.dart'; class HomePage extends StatefulWidget { @@ -29,6 +33,7 @@ class _HomePageState extends State bool get wantKeepAlive => true; HomeLogic logic = Get.find(); + var sub; @override void initState() { // TODO: implement initState @@ -38,6 +43,17 @@ class _HomePageState extends State vsync: this, initialIndex: 0, animationDuration: Duration.zero); + sub = EventBusManager.on().listen((event) { + var info = event.info; + showGiftButtonOverlay(context!, info['msg'], info['fromUser'], info['toUser'], () { + Get.until((route) => route.settings.name == Routes.Home); + logic.updateIndex(2); + World_call_outLogic worldLogic = Get.find(); + worldLogic.index = 1; + worldLogic.loadData(); + + }); + }); } @override @@ -58,6 +74,7 @@ class _HomePageState extends State void dispose() { // TODO: implement dispose super.dispose(); + sub.cancel(); routeObserver.unsubscribe(this); } diff --git a/circle_app/lib/circle_app/login/complete_material/logic.dart b/circle_app/lib/circle_app/login/complete_material/logic.dart index 16e746a..7a6750e 100644 --- a/circle_app/lib/circle_app/login/complete_material/logic.dart +++ b/circle_app/lib/circle_app/login/complete_material/logic.dart @@ -84,7 +84,7 @@ class Complete_materialLogic extends GetxController { userInfoBean = bean.data.user; state.wxEditingController.text = userInfoBean!.wx_num ; state.nickName = userInfoBean!.nickname; - state.sex = getGenderImg(userInfoBean!.gender); + state.sex = getGenderStr(userInfoBean!.gender); state.genderId = userInfoBean!.gender.toString(); state.age = userInfoBean!.age.toString(); state.brithday = userInfoBean!.birthday.toString(); diff --git a/circle_app/lib/circle_app/minefragment/view.dart b/circle_app/lib/circle_app/minefragment/view.dart index f9102e0..2bb79cb 100644 --- a/circle_app/lib/circle_app/minefragment/view.dart +++ b/circle_app/lib/circle_app/minefragment/view.dart @@ -803,28 +803,14 @@ class _MinefragmentPageState extends State with RouteAware { return ClipOval( - child: GestureDetector( - onTap: () { - if(logic.userInfoBean!=null){ - var imgList = []; - imgList.add(logic.userInfoBean!.avatar); - // Get.toNamed(AppRoutes.Swiper,arguments:imgList); - Get.toNamed(Routes.SwiperPage, arguments: { - 'imaglist': imgList, - 'index': 0 - }); - } - - }, - child:logic.userInfoBean==null ? SizedBox( - width: 63.sp, - height: 63.sp, - ): CachedImg( - fit: BoxFit.cover, - imageUrl: logic.avatar, - width: 63.sp, - height: 63.sp, - ), + child: logic.userInfoBean==null ? SizedBox( + width: 63.sp, + height: 63.sp, + ): CachedImg( + fit: BoxFit.cover, + imageUrl: logic.avatar, + width: 63.sp, + height: 63.sp, ), ); diff --git a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index 09b39f9..e1c91b1 100644 --- a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -644,8 +644,8 @@ class _TIMConversationState extends TIMUIKitState { const Color(0x0F4B3E5E), const Color(0xaF334141) ])), - padding: const EdgeInsets.only( - top: 6, bottom: 6, left: 16, right: 16), + padding: EdgeInsets.only( + top: 6, bottom: 6, left: 10.sp, right: 10.sp), child: Row( children: [ ClipOval(child: Image.network( diff --git a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart index 9fde2d6..9258a64 100644 --- a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart +++ b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart @@ -83,8 +83,10 @@ class TIMConversationItem extends TIMUIKitStatelessWidget { lastMessageBuilder!(lastMsg, groupAtInfoList) != null) { return lastMessageBuilder!(lastMsg, groupAtInfoList)!; } - return Row( + + + return Row( children: [ isSameCity ? const Text('[同城]', @@ -157,7 +159,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget { final isDesktopScreen = TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; return Container( - padding: const EdgeInsets.only(top: 6, bottom: 6, left: 16, right: 16), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 10.sp, right: 10.sp), decoration: BoxDecoration( // color: Colors.transparent, // gl.startPoint = CGPointMake(0.48, 0.48); diff --git a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart index 85019fa..5759bd4 100644 --- a/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart +++ b/circle_app/lib/circle_app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart @@ -51,7 +51,7 @@ class _TIMLastMsgState extends TIMUIKitState { final isSelf = widget.lastMsg!.isSelf ?? true; final option1 = isSelf ? TIM_t("您") - : widget.lastMsg!.nickName ?? widget.lastMsg?.sender; + : 'Ta'; if (mounted) { setState(() { groupTipsAbstractText = TIM_t_para( @@ -82,7 +82,7 @@ class _TIMLastMsgState extends TIMUIKitState { case MessageElemType.V2TIM_ELEM_TYPE_SOUND: return "[语音]"; case MessageElemType.V2TIM_ELEM_TYPE_TEXT: - return (widget.lastMsg?.textElem?.text)?.trim() ?? ""; + return (widget.lastMsg?.textElem?.text)?.trim() ?? ""; case MessageElemType.V2TIM_ELEM_TYPE_FACE: return "[表情]"; case MessageElemType.V2TIM_ELEM_TYPE_FILE: @@ -133,6 +133,16 @@ class _TIMLastMsgState extends TIMUIKitState { Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { final TUITheme theme = value.theme; final icon = _getIconByMsgStatus(context); + final isRevokedMessage = widget.lastMsg!.status == 6; + if (isRevokedMessage) { + final isSelf = widget.lastMsg!.isSelf ?? true; + final option1 = isSelf + ? TIM_t("您") + : 'Ta'; + groupTipsAbstractText = TIM_t_para( + "{{option1}}撤回了一条消息", "$option1撤回了一条消息")(option1: option1); + } + return Row(children: [ if (icon != null) Container( diff --git a/circle_app/lib/circle_app/msg/view.dart b/circle_app/lib/circle_app/msg/view.dart index 049204d..52c5b11 100644 --- a/circle_app/lib/circle_app/msg/view.dart +++ b/circle_app/lib/circle_app/msg/view.dart @@ -30,7 +30,7 @@ class MsgPage extends StatefulWidget { } class _MsgPageState extends State with AutomaticKeepAliveClientMixin { - final ctr = Get.put(MsgLogic()); + final ctr = Get.lazyPut(() =>MsgLogic()); // final controller = Get.find(); var logic = Get.find(); void getPipeiData() async { @@ -93,7 +93,8 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { Get.toNamed(Routes.SysNotifyListPage, arguments: selectedConv); return; } - Get.toNamed(Routes.Chat, arguments: selectedConv); + await Get.toNamed(Routes.Chat, arguments: selectedConv); + }, )) ], @@ -177,7 +178,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { return Container( width: Get.width, - padding: EdgeInsets.only(left: 18.sp, right: 18.sp), + padding: EdgeInsets.only(left: 10.sp, right: 10.sp), height: 44.sp, child: Stack( alignment: Alignment.center, @@ -272,7 +273,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { tipWidget(MsgLogic controller) { return Container( margin: EdgeInsets.only(top: 10.sp, bottom: 15.sp), - padding: EdgeInsets.only(left: 16.sp, right: 12.sp), + padding: EdgeInsets.only(left: 10.sp, right: 4.sp), width: Get.width, height: 20.sp, child: Row( @@ -322,7 +323,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { reconmandWidget(MsgLogic controller) { return Container( - padding: EdgeInsets.only(left: 16.sp, right: 18.sp), + padding: EdgeInsets.only(left: 10.sp, right: 12.sp), width: Get.width, height: 80.sp, child: Row( diff --git a/circle_app/lib/circle_app/userinfo/logic.dart b/circle_app/lib/circle_app/userinfo/logic.dart index 9b62f27..ff641d4 100644 --- a/circle_app/lib/circle_app/userinfo/logic.dart +++ b/circle_app/lib/circle_app/userinfo/logic.dart @@ -417,10 +417,11 @@ class UserinfoLogic extends GetxController { class UserBean { int id; String nickname; + String account_id; String avatar; String birthday; String wx_num; - + int chat_need_vip; int age; String contact; int contactType; @@ -446,6 +447,7 @@ class UserBean { required this.id, required this.nickname, required this.avatar, + required this.account_id, required this.wx_num, required this.birthday, required this.age, @@ -466,6 +468,7 @@ class UserBean { required this.lat, required this.onlineFlag, this.city, + required this.chat_need_vip, required this.isOnline, this.offlineTime, required this.avatarThumb, @@ -478,6 +481,8 @@ class UserBean { currentCity: json['currentCity'] ?? '', hide_wx_num: json['hide_wx_num'] ?? 0, orientations: json['orientations'] ?? [], + account_id: json['account_id'] ?? '', + chat_need_vip: json['chatNeedVip'], wx_num: json['wx_num'] ?? '', mark: json['mark'] ?? 0, nickname: json['nickname'], diff --git a/circle_app/lib/circle_app/userinfo/view.dart b/circle_app/lib/circle_app/userinfo/view.dart index 4249214..c6ba795 100644 --- a/circle_app/lib/circle_app/userinfo/view.dart +++ b/circle_app/lib/circle_app/userinfo/view.dart @@ -21,6 +21,7 @@ import '../../utils/cache_img.dart'; import '../../utils/eventBus.dart'; import '../../utils/util.dart'; import '../../view/notice.dart'; +import '../circle_list/widgets/right_circle_iten.dart'; import '../home/logic.dart'; import '../select_circle/logic.dart'; import 'logic.dart'; @@ -294,16 +295,23 @@ class MyTabbedScreenState extends State width: Get.width, // color: Colors.red, child: NestedScrollView( - controller: scrollController, + // controller: scrollController, headerSliverBuilder: (context, isScrolled) { return [ + SliverToBoxAdapter( + child: buildContent(logic), + ), SliverOverlapAbsorber( - handle: - NestedScrollView.sliverOverlapAbsorberHandleFor( - context), - sliver: SliverToBoxAdapter( - child: buildContent(logic), - )) + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + sliver:SliverPersistentHeader( + pinned: true, + + delegate: MySliverAppBarDelegate( + minHeight: 35, + maxHeight: 35, + child: titleTab(logic), + ), + )), ]; }, body: contentWidget(logic), @@ -752,7 +760,7 @@ class MyTabbedScreenState extends State contentWidget(UserinfoLogic controller) { return Column( children: [ - titleTab(controller), + SizedBox(height: 35.sp,), Expanded( child: TabBarView( controller: _tabController, @@ -1027,6 +1035,7 @@ class MyTabbedScreenState extends State ) : Expanded( child: GridView.builder( + physics: ClampingScrollPhysics(), padding: const EdgeInsets.only(bottom: 58.0), shrinkWrap: true, gridDelegate: diff --git a/circle_app/lib/circle_app/userinfo/widgets/home_call_out.dart b/circle_app/lib/circle_app/userinfo/widgets/home_call_out.dart index 12fe8af..4f74023 100644 --- a/circle_app/lib/circle_app/userinfo/widgets/home_call_out.dart +++ b/circle_app/lib/circle_app/userinfo/widgets/home_call_out.dart @@ -12,6 +12,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../../commons/Widgets/text_more.dart'; import '../../../net/api.dart'; @@ -36,7 +37,7 @@ class _HomeCallOutViewState extends State @override bool get wantKeepAlive => true; HomeCallOutLogic? listsLg; - + final RefreshController refreshController = RefreshController(); ScrollController scrollController = ScrollController(); UserinfoLogic logic = Get.find(); @@ -86,65 +87,75 @@ class _HomeCallOutViewState extends State @override Widget build(BuildContext context) { return GetBuilder( - assignId: true, - builder: (listLogic) { - return listLogic.lists.isEmpty - ? Center( - child: Image.asset( - getBaseImage('no_result'), - width: 200, - // height: 11, - ), - ) - : Container( - width: Get.width, - // margin: EdgeInsets.only(top: isEnd ? 40.sp : 0.sp), - child: listLogic.lists.isEmpty - ? loaddingWidget(true) - : ListView.builder( - // physics: const AlwaysScrollableScrollPhysics(), - physics: isEnd - ? BouncingScrollPhysics() - : NeverScrollableScrollPhysics(), - // shrinkWrap:true, - padding: EdgeInsets.only( - bottom: - MediaQuery.of(context).padding.bottom + 56.sp), - scrollDirection: Axis.vertical, - controller: listLogic.scrollController, - itemCount: listLogic.lists.length + 1, - itemBuilder: (context, index) { - if (listLogic.lists.length > index) { - Lists lists = listLogic.lists[index]; - if (lists.isQueen!) { - return vipDynamicItem(lists); + assignId: true, + builder: (listLogic) { + return listLogic.lists.isEmpty + ? Center( + child: Image.asset( + getBaseImage('no_result'), + width: 200, + // height: 11, + ), + ) + : Container( + width: Get.width, + padding: EdgeInsets.only( + bottom: + MediaQuery.of(context).padding.bottom + 56.sp), + child: listLogic.lists.isEmpty + ? loaddingWidget(true) + : SmartRefresher( + controller: refreshController, + enablePullDown: false, + onLoading: () async { + await listLogic.loadCallOutListData(widget.userId); + if (listLogic.callOutMore) { + refreshController.loadNoData(); } else { - return normalDynamicItem(lists); + refreshController.loadComplete(); } - } else { - return Container( - margin: EdgeInsets.only( - top: listLogic.callOutMore ? 0 : 10.sp), - child: loaddingWidget(listLogic.callOutMore), - ); - } - })); - }, - ); + }, + enablePullUp: true, + child: ListView.builder( + + scrollDirection: Axis.vertical, + itemCount: listLogic.lists.length, + itemBuilder: (context, index) { + if (listLogic.lists.length > index) { + Lists lists = listLogic.lists[index]; + if (lists.isQueen!) { + return vipDynamicItem(lists); + } else { + return normalDynamicItem(lists); + } + } + }) + )); + }); } ///至尊喊话 vipDynamicItem(Lists lists) { - 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 == Routes.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(() { - - }); - }, - ); + 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 == Routes.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(() {}); + }, + ); double picHeight = 0.0; @@ -184,7 +195,6 @@ class _HomeCallOutViewState extends State ), ), Container( - margin: EdgeInsets.only(top: 10.sp), width: Get.width, // height: widgetHeight, @@ -223,7 +233,11 @@ class _HomeCallOutViewState extends State Container( // height: widgetHeight, width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp,), + padding: EdgeInsets.only( + top: 12.sp, + left: 12.sp, + right: 12.sp, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -374,32 +388,34 @@ class _HomeCallOutViewState extends State }), ), if (widget.userId.isEmpty) - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "", - style: TextStyle( - color: Colors.white, fontSize: 1.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showCallOutTipPop(lists.id!.toString(), - listsLg!.lists.indexOf(lists),lists!.userTop! == 1); - }, - child: Icon( - Icons.more_vert, - color: AppColor.mainColor, - size: 20, - )) - ], - )) + Container( + width: Get.width, + margin: EdgeInsets.only(top: 4.sp, bottom: 5.sp), + alignment: Alignment.centerLeft, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "", + style: TextStyle( + color: Colors.white, fontSize: 1.sp), + ), + widget.userId.isNotEmpty + ? Container() + : GestureDetector( + onTap: () { + showCallOutTipPop( + lists.id!.toString(), + listsLg!.lists.indexOf(lists), + lists!.userTop! == 1); + }, + child: Icon( + Icons.more_vert, + color: AppColor.mainColor, + size: 20, + )) + ], + )) ], ), ) @@ -410,16 +426,26 @@ class _HomeCallOutViewState extends State ///普通图文喊话 normalDynamicItem(Lists lists) { - 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 == Routes.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(() { - - }); - }, - ); + 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 == Routes.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(() {}); + }, + ); double picHeight = 0.0; @@ -597,7 +623,9 @@ class _HomeCallOutViewState extends State // margin: EdgeInsets.only(top: 4.sp), child: descText, ), - SizedBox(height: picHeight > 0 ? 5.sp : 10.sp,), + SizedBox( + height: picHeight > 0 ? 5.sp : 10.sp, + ), picHeight > 0 ? Container( height: picHeight, @@ -648,33 +676,34 @@ class _HomeCallOutViewState extends State })) : Container(), if (widget.userId.isEmpty) - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), - - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "", - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showCallOutTipPop(lists.id!.toString(), - listsLg!.lists.indexOf(lists),lists.userTop == 1); - }, - child: Icon( - Icons.more_vert, - color: AppColor.mainColor, - size: 20, - )) - ], - )) + Container( + width: Get.width, + margin: EdgeInsets.only(top: 4.sp, bottom: 5.sp), + alignment: Alignment.centerLeft, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "", + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + widget.userId.isNotEmpty + ? Container() + : GestureDetector( + onTap: () { + showCallOutTipPop( + lists.id!.toString(), + listsLg!.lists.indexOf(lists), + lists.userTop == 1); + }, + child: Icon( + Icons.more_vert, + color: AppColor.mainColor, + size: 20, + )) + ], + )) ], ), ) @@ -729,7 +758,11 @@ class _HomeCallOutViewState extends State return painter.width; } - showCallOutTipPop(String calloutId, int index, bool isTop,) { + showCallOutTipPop( + String calloutId, + int index, + bool isTop, + ) { Get.bottomSheet( CupertinoActionSheet( title: Text( @@ -748,8 +781,7 @@ class _HomeCallOutViewState extends State CupertinoActionSheetAction( onPressed: () { Get.back(); - showTipPiker(calloutId, - index); + showTipPiker(calloutId, index); // toast('举报成功,等待反馈!'); }, child: Text('删除'), diff --git a/circle_app/lib/circle_app/userinfo/widgets/home_call_out_logic.dart b/circle_app/lib/circle_app/userinfo/widgets/home_call_out_logic.dart index 8209215..7f13def 100644 --- a/circle_app/lib/circle_app/userinfo/widgets/home_call_out_logic.dart +++ b/circle_app/lib/circle_app/userinfo/widgets/home_call_out_logic.dart @@ -34,7 +34,7 @@ class HomeCallOutLogic extends GetxController { } callOutPage++; } - callOutMore = dataList.length == 20; + callOutMore = dataList.isEmpty; update(); } else { showOKToast(data["msg"]); diff --git a/circle_app/lib/circle_app/world_call_out/view.dart b/circle_app/lib/circle_app/world_call_out/view.dart index 421e319..b24413b 100644 --- a/circle_app/lib/circle_app/world_call_out/view.dart +++ b/circle_app/lib/circle_app/world_call_out/view.dart @@ -46,7 +46,7 @@ class _WorldCallOutPageState extends State void initState() { // TODO: implement initState super.initState(); - + logic.isNewMsg = false; /// 初始化 WidgetsBinding.instance.addObserver(this); } @@ -57,70 +57,70 @@ class _WorldCallOutPageState extends State return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: logic.total > 0 - ? '全球喊话' + '(${convertToTenThousand(logic.total)})' - : '全球喊话', - isBack: false, - isDiyBack: true, - backWdiget: Positioned( - left: 15.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(Routes.InvitePage); - }, - 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( - homelogic.inventStr, - style: TextStyle( - fontSize: 12.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - ), - ), - actionWdiget: GestureDetector( - onTap: () { - logic.showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), - ), - ), + // appBar: MyAppBar( + // centerTitle: logic.total > 0 + // ? '全球喊话' + '(${convertToTenThousand(logic.total)})' + // : '全球喊话', + // isBack: false, + // isDiyBack: true, + // backWdiget: Positioned( + // left: 15.sp, + // child: GestureDetector( + // onTap: () { + // Get.toNamed(Routes.InvitePage); + // }, + // 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( + // homelogic.inventStr, + // style: TextStyle( + // fontSize: 12.sp, + // color: Colors.white, + // ), + // ), + // ], + // ), + // ), + // ), + // ), + // ), + // actionWdiget: GestureDetector( + // onTap: () { + // logic.showBottomSheet(context); + // }, + // child: Image.asset( + // getCircleImage('icon_screen'), + // width: 30.sp, + // ), + // ), + // ), body: Stack( fit: StackFit.expand, children: [ @@ -133,49 +133,56 @@ class _WorldCallOutPageState extends State // logic.sendTextMessage(); }, child: - SmartRefresher( - controller: logic.refreshController, - onLoading: () { - logic.loadMore(); - }, - onRefresh: () { - logic.isNewMsg = false; - logic.index = 1; - logic.isMore = true; - logic.refreshController.resetNoData(); - // 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 - ? !logic.isMore - ? noResultWidget() - : loaddingWidget(true) - : ListView.builder( - reverse: true, - shrinkWrap: true, - itemBuilder: (context, index) { - WorldLists data = logic.lists[index]; - if (data.content!.contains('赚钱')) { - print('111'); - } - if (data.showType == 2) { - return SigalItemWidget(index, data); - } - return SysItemWidget(index, logic.lists[index],logic); - }, - itemCount: logic.lists.length, - controller: logic.scrollController, - physics: const AlwaysScrollableScrollPhysics(), - )), + Column( + children: [ + titleWidget(), + Expanded( + child: SmartRefresher( + controller: logic.refreshController, + onLoading: () { + logic.loadMore(); + }, + onRefresh: () { + logic.isNewMsg = false; + logic.index = 1; + logic.isMore = true; + logic.refreshController.resetNoData(); + // 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 + ? !logic.isMore + ? noResultWidget() + : loaddingWidget(true) + : ListView.builder( + reverse: true, + shrinkWrap: true, + itemBuilder: (context, index) { + WorldLists data = logic.lists[index]; + if (data.content!.contains('赚钱')) { + print('111'); + } + if (data.showType == 2) { + return SigalItemWidget(index, data); + } + return SysItemWidget(index, logic.lists[index],logic); + }, + itemCount: logic.lists.length, + controller: logic.scrollController, + physics: const AlwaysScrollableScrollPhysics(), + )), + ), + ], + ), ), Positioned( bottom: 36.sp, @@ -226,6 +233,100 @@ class _WorldCallOutPageState extends State }); } + titleWidget() { + return SafeArea( + child: Container( + width: Get.width, + height: 44.sp, + child:Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + Semantics( + namesRoute: true, + header: true, + child: Container( + alignment: Alignment.center, + width: double.infinity, + margin: const EdgeInsets.symmetric(horizontal: 48.0), + child: 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( + logic.total > 0 + ? '全球喊话' + '(${convertToTenThousand(logic.total)})' + : '全球喊话', + style: TextStyle(fontSize: 18.sp,fontWeight: FontWeight.w600,color: Colors.white,shadows: [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))]), + ), + ), + )), + Positioned( + left: 10.sp, + child: GestureDetector( + onTap: () { + Get.toNamed(Routes.InvitePage); + }, + 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( + homelogic.inventStr, + style: TextStyle( + fontSize: 12.sp, + color: Colors.white, + ), + ), + ], + ), + ), + ), + ), + ), + Positioned(right: 10.sp,child: GestureDetector( + onTap: () { + logic.showBottomSheet(context); + }, + child: Image.asset( + getCircleImage('icon_screen'), + width: 30.sp, + ), + ),) + ], + )), + ); + } + double getBottomHeight(context) { if (logic.showKeyboard) { final currentKeyboardHeight = MediaQuery.of(context).viewInsets.bottom; @@ -751,7 +852,7 @@ class _SysItemWidgetState extends State { margin: EdgeInsets.only(left: 10.sp, right: 10.sp,bottom: 5.sp), child: picHeight == 200.sp ? VideoItemWidget(list.album![0].url!) - : GridView.builder( + : MediaQuery.removePadding(removeTop: true,context: context, child:GridView.builder( itemCount: list.album!.length, physics: const NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -781,7 +882,7 @@ class _SysItemWidgetState extends State { ), ), ); - })) + }))) : Container(); } @@ -1033,37 +1134,38 @@ class _SigalItemWidgetState extends State { margin: EdgeInsets.only(left: 10.sp, right: 10.sp,bottom: 5.sp), child: picHeight == 200.sp ? VideoItemWidget(list.album![0].url!) - : GridView.builder( - itemCount: list.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 4.sp, - mainAxisSpacing: 4.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = list.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in list.album!) { - imgList.add(element.url!); - } - Get.toNamed(Routes.SwiperPage, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedImg( - imageUrl: album.url!, - fit: BoxFit.cover, + : MediaQuery.removePadding(removeTop: true,context: context, child:GridView.builder( + itemCount: list.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 4.sp, + mainAxisSpacing: 4.sp, + childAspectRatio: 0.7 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = list.album![currentIndex]; + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in list.album!) { + imgList.add(element.url!); + } + Get.toNamed(Routes.SwiperPage, arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedImg( + imageUrl: album.url!, + fit: BoxFit.cover, + ), ), - ), - ); - })) + ); + }), + )) : Container(); } } diff --git a/circle_app/lib/commons/widgets/my_app_bar.dart b/circle_app/lib/commons/widgets/my_app_bar.dart index f990f38..1db97c5 100644 --- a/circle_app/lib/commons/widgets/my_app_bar.dart +++ b/circle_app/lib/commons/widgets/my_app_bar.dart @@ -61,6 +61,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { } else { + FocusManager.instance.primaryFocus?.unfocus(); Navigator.pop(superContext!); } diff --git a/circle_app/lib/commons/widgets/wx_edit_dialog.dart b/circle_app/lib/commons/widgets/wx_edit_dialog.dart index 80cc01e..afeeaad 100644 --- a/circle_app/lib/commons/widgets/wx_edit_dialog.dart +++ b/circle_app/lib/commons/widgets/wx_edit_dialog.dart @@ -335,7 +335,7 @@ class _WxEditDialogState extends State { showOKToast('请设置联系方式解锁金额大于零'); return; } else if (int.parse(moneyEditingController.text) > 300 || int.parse(moneyEditingController.text) < 10) { - showOKToast('请设置联系方式解锁金额在10元~200元之间'); + showOKToast('请设置联系方式解锁金额在10元~300元之间'); return; } } @@ -354,16 +354,12 @@ class _WxEditDialogState extends State { "price": (wxInfo['price'] != null ? wxInfo['price'].toString() : '').isNotEmpty ? moneyEditingController.text.isEmpty ? 0 : moneyEditingController.text : '', 'contactType':type, "contact": wxEditingController.text}); - if (result['code'] ==200) { + if (result['code'] == 200) { showOKToast('设置成功'); Get.back(); } else if (result['code'] == 10081) { showRechargeScreenDialog(); } - - - // Get.back(); - // showRechargeDialog(); }, child: Container( height: 30.sp, diff --git a/circle_app/lib/net/api.dart b/circle_app/lib/net/api.dart index 41d6911..3459783 100644 --- a/circle_app/lib/net/api.dart +++ b/circle_app/lib/net/api.dart @@ -452,5 +452,12 @@ class Api { //每日在线圈友推荐 static const dayOnline = '/msg-service/im/chat/recommend/dayOnline'; + //查看单个用户 + static const visitUserById = '/user-service/visitUserById'; + //批量查看多个用户 + static const visitUserByIds = '/user-service/visitUserByIds'; + + //批量查看多个喊话 + static const readCalloutByIds = '/up-service/readCalloutByIds'; } \ No newline at end of file diff --git a/circle_app/lib/utils/SharedPreferencesHelper.dart b/circle_app/lib/utils/SharedPreferencesHelper.dart index 36c7829..79af100 100644 --- a/circle_app/lib/utils/SharedPreferencesHelper.dart +++ b/circle_app/lib/utils/SharedPreferencesHelper.dart @@ -25,6 +25,8 @@ class SharedPreferencesHelper { static const FirstAutoMatch = 'FirstAutoMatch'; + static const FirstPeopleSendCallOut = 'FirstPeopleSendCallOut'; + static SharedPreferencesHelper? _instance; static SharedPreferences? _preferences; @@ -117,6 +119,22 @@ class SharedPreferencesHelper { return true; } + Future isFirstPeopleSendCallOut() async { + String time = preferences!.getString(FirstPeopleSendCallOut) ?? ''; + if (time.isNotEmpty) { + DateTime dateTime = DateTime.parse(time); + bool isShow = !isSameDay(dateTime,DateTime.now()); + if (isShow) { + preferences!.setString(FirstPeopleSendCallOut, DateTime.now().toString()); + } + return isShow; + } else { + preferences!.setString(FirstPeopleSendCallOut, DateTime.now().toString()); + } + return true; + } + + bool isSameDay(DateTime time1, DateTime time2) { return time1.year == time2.year && time1.month == time2.month && diff --git a/circle_app/lib/utils/util.dart b/circle_app/lib/utils/util.dart index 1c839c4..5bd8241 100644 --- a/circle_app/lib/utils/util.dart +++ b/circle_app/lib/utils/util.dart @@ -27,7 +27,7 @@ import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversa import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:video_compress/video_compress.dart'; +// import 'package:video_compress/video_compress.dart'; import '../circle_app/circle/logic.dart'; import '../circle_app/circle_list/logic.dart'; @@ -349,21 +349,21 @@ String getRoleContent(int number) { typedef void MyCallback(String path); -Future compressVideo( - String inputPath, String outputPath, MyCallback myCallback) async { - final info = await VideoCompress.compressVideo( - inputPath, - quality: VideoQuality.MediumQuality, - deleteOrigin: false, - ); - - if (info != null && null != info.path) { - print(info.path); - myCallback(info.path!); - } else { - print('视频压缩失败'); - } -} +// Future compressVideo( +// String inputPath, String outputPath, MyCallback myCallback) async { + // final info = await VideoCompress.compressVideo( + // inputPath, + // quality: VideoQuality.MediumQuality, + // deleteOrigin: false, + // ); + // + // if (info != null && null != info.path) { + // print(info.path); + // myCallback(info.path!); + // } else { + // print('视频压缩失败'); + // } +// } class CustomRefreshHeader extends StatelessWidget { @override diff --git a/circle_app/lib/view/ExitAppConfirmation.dart b/circle_app/lib/view/ExitAppConfirmation.dart index cd7635f..f5a229a 100644 --- a/circle_app/lib/view/ExitAppConfirmation.dart +++ b/circle_app/lib/view/ExitAppConfirmation.dart @@ -32,7 +32,7 @@ class _ExitAppConfirmationState extends State { // ScaffoldMessenger.of(context).showSnackBar( // const SnackBar(content: Text('再按一次返回键退出应用')), // ); - showOKToast("再按一次返回键退出应用"); + showOKToast("再次滑动可退出APP"); return Future.value(false); } return Future.value(true); diff --git a/circle_app/lib/view/notice.dart b/circle_app/lib/view/notice.dart index caad8f4..8cebc26 100644 --- a/circle_app/lib/view/notice.dart +++ b/circle_app/lib/view/notice.dart @@ -229,6 +229,227 @@ void showFloatingButtonOverlay(BuildContext context, String nickname, overlayState?.insert(overlayEntry!); } +void showGiftButtonOverlay(BuildContext context,String content, + Map sendUser, Map recevierUser, NoticeCallback noticeCallback) { + OverlayState? overlayState = Overlay.of(context); + late OverlayEntry overlayEntry; + bool showMessage = false; + + int countdownSeconds = 5; // 倒计时秒数 + + // 创建 Timer + late Timer countdownTimer; + + // 创建 OverlayEntry + overlayEntry = OverlayEntry( + builder: (BuildContext context) { + return Stack( + alignment: Alignment.center, + children: [ + Positioned( + top: MediaQuery.of(context).padding.top, + // right: 16, + child: AnimatedContainer( + duration: const Duration(milliseconds: 500), + curve: Curves.easeInOut, + height: showMessage ? 55 : 0, + child: Container( + width: Get.width - 8, + // margin: EdgeInsets.only(top:10.sp), + padding: EdgeInsets.fromLTRB(8.sp, 8.sp, 8.sp, 8.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: const Color(0xFF353443), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + + // const SizedBox(width: 8), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + // direction: Axis.vertical, + children: [ + GestureDetector( + onTap: () { + countdownTimer.cancel(); + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + Get.toNamed(Routes.UserInfoPage,arguments:sendUser['id'].toString()); + }, + child: Row( + children: [ + ClipOval( + child: CachedImg( + fit: BoxFit.cover, + imageUrl: sendUser['avatar'], + width: 30.sp, + height: 30.sp, + ), + ), + Container( + // width: 70.sp, + child: Text( + sendUser['nickname'], + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: AppColor.mainColor, + fontSize: 15.sp, + ), + ), + ), + ], + ), + ), + Container( + // width: 70.sp, + child: Text( + '送', + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color.fromRGBO(247, 250, 250, 1.0), + fontSize: 15.sp, + ), + ), + ), + GestureDetector( + onTap: () { + countdownTimer.cancel(); + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + Get.toNamed(Routes.UserInfoPage,arguments:recevierUser['id'].toString()); + }, + child: Container( + // width: 70.sp, + child: Text( + recevierUser['nickname'], + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: AppColor.mainColor, + fontSize: 15.sp, + ), + ), + ), + ), + Container( + // width: 70.sp, + child: Text( + '礼物' + content.split(recevierUser['nickname']).last, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color.fromRGBO(247, 250, 250, 1.0), + fontSize: 15.sp, + ), + ), + ), + ], + ), + ), + GestureDetector( + onTap: () { + countdownTimer.cancel(); + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + noticeCallback(); + + // logic.setLike(); + // logic.showMessage = false; + // logic.update(); + }, + child: Container( + // margin: EdgeInsets.only(top: 6.sp), + height: 24, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.symmetric( + horizontal: 8.sp, vertical: 0.sp), + child: Text( + '围观', + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + ), + ), + ), + ), + + // ), + ], + ), + ), + ), + ), + Positioned( + top: MediaQuery.of(context).padding.top, + right: 5.sp, + child: GestureDetector( + onTap: () { + countdownTimer.cancel(); + // 取消计时器 + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + }, + child: Container( + height: 15, + width: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(10), + bottomLeft: Radius.circular(10)), + gradient: AppColor.tagVerLinearGradient), + alignment: Alignment.center, + child: Icon( + Icons.close, + size: 15, + color: Colors.white, + ), + ), + )) + ], + ); + }, + ); + // setState(() {}); + showMessage = true; + mainOverlayEntry = overlayEntry; + countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) { + if (countdownSeconds > 0) { + countdownSeconds--; + // overlayEntry.markNeedsBuild(); // 刷新 OverlayEntry + } else { + // 取消计时器 + timer.cancel(); + + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + } + }); + // 将 OverlayEntry 添加到 Overlay 中 + overlayState?.insert(overlayEntry!); +} + + void showTipFloatingButtonOverlay(BuildContext context, String tip) { OverlayState? overlayState = Overlay.of(context); late OverlayEntry overlayEntry; diff --git a/circle_app/macos/Flutter/GeneratedPluginRegistrant.swift b/circle_app/macos/Flutter/GeneratedPluginRegistrant.swift index 7d850ae..f3a9a4a 100644 --- a/circle_app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/circle_app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -21,7 +21,6 @@ import photo_manager import shared_preferences_foundation import sqflite import url_launcher_macos -import video_compress import wakelock_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { @@ -41,6 +40,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - VideoCompressPlugin.register(with: registry.registrar(forPlugin: "VideoCompressPlugin")) WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) } diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index 0b83131..324c027 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: app_settings - sha256: "2ec421f375d747916c4c0193933567074ea60c4f01c4a68642f07fef1002524e" + sha256: e6a34735d4ddb24ca9c5fd7e965ec65c8b611cbd3a329152c294f9e9f4bacb33 url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.4" + version: "4.3.1" archive: dependency: transitive description: @@ -630,6 +630,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.3" + flutter_install_app: + dependency: "direct main" + description: + name: flutter_install_app + sha256: "9b117006d17c900e671c26bcbc9b15c7b8efd15d6f9b4442ad5d576de20fab53" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" flutter_intl: dependency: "direct main" description: @@ -1906,14 +1914,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" - video_compress: - dependency: "direct main" - description: - name: video_compress - sha256: "407693726e674a1e1958801deb2d9daf5a5297707ba6d03375007012dae7389a" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.1.2" video_player: dependency: "direct main" description: @@ -1962,6 +1962,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.5.3" + visibility_detector: + dependency: "direct main" + description: + name: visibility_detector + sha256: ec932527913f32f65aa01d3a393504240b9e9021ecc77123f017755605e48832 + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.2" wakelock: dependency: transitive description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 24bd5f9..9ae2aa3 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -79,7 +79,7 @@ dependencies: #时间戳 flutter_intl: ^0.0.1 #视频压缩 - video_compress: ^3.1.2 +# video_compress: ^3.1.2 #图片缓存 cached_network_image: ^3.2.3 #网络拦截 @@ -90,7 +90,7 @@ dependencies: fluwx: ^3.8.1+1 event_bus: ^2.0.0 #安装apk -# flutter_install_app: 1.3.0 + flutter_install_app: 1.3.0 #闪屏页 flutter_native_splash: 2.2.16 #腾讯离线推送 @@ -112,13 +112,15 @@ dependencies: #边框渐变 gradient_borders: ^1.0.0 #系统设置 安卓4.3.1 苹果4.0.4 - app_settings: 4.0.4 + app_settings: 4.3.1 #百度定位插件 flutter_bmflocation: ^3.6.0 #通知权限 notification_permissions: ^0.6.1 #分帧 keframe: ^2.0.6 + #判断item是否可见 + visibility_detector: ^0.2.2 dev_dependencies: flutter_test: