diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index a803b88..5941416 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 52 - versionName "2.0.2" + versionCode 53 + versionName "2.0.3" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/assets/images/circle/search_bg_icon.png b/circle_app/assets/images/circle/search_bg_icon.png new file mode 100644 index 0000000..13c1681 Binary files /dev/null and b/circle_app/assets/images/circle/search_bg_icon.png differ diff --git a/circle_app/assets/images/circle/search_icon.png b/circle_app/assets/images/circle/search_icon.png new file mode 100644 index 0000000..f088f6f Binary files /dev/null and b/circle_app/assets/images/circle/search_icon.png differ diff --git a/circle_app/ios/Podfile.lock b/circle_app/ios/Podfile.lock index d74bbf1..0359ca2 100644 --- a/circle_app/ios/Podfile.lock +++ b/circle_app/ios/Podfile.lock @@ -315,7 +315,7 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" SPEC CHECKSUMS: - app_settings: 54b8813f690b34f757c0bf97a46637bed5acc76c + app_settings: d103828c9f5d515c4df9ee754dabd443f7cedcf3 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 BMKLocationKit: a93bc412af3a601f12d243f4fb83f77650103e56 Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da diff --git a/circle_app/ios/Runner.xcodeproj/project.pbxproj b/circle_app/ios/Runner.xcodeproj/project.pbxproj index 388aa94..57db7c9 100644 --- a/circle_app/ios/Runner.xcodeproj/project.pbxproj +++ b/circle_app/ios/Runner.xcodeproj/project.pbxproj @@ -383,7 +383,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -534,7 +534,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -579,7 +579,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart index 12604d9..cf03153 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart @@ -743,7 +743,8 @@ class _TIMTextFieldLayoutNarrowState getImageFile(); }, child: - Image.asset(getMsgImage('photo'), width: 40.sp), + Opacity(opacity: 0.75, + child: Image.asset(getMsgImage('photo'), width: 40.sp)), ), GestureDetector( onTap: () { @@ -754,8 +755,10 @@ class _TIMTextFieldLayoutNarrowState } getTakeImageFile(); }, - child: Image.asset(getMsgImage('take_photo'), - width: 40.sp), + child: Opacity(opacity: 0.75, + child: Image.asset(getMsgImage('take_photo'), + width: 40.sp), + ), ), GestureDetector( onTap: () async { @@ -780,8 +783,10 @@ class _TIMTextFieldLayoutNarrowState } getVideoFile(ImageSource.gallery); }, - child: Image.asset(getMsgImage('icon_video'), - width: 40.sp), + child: Opacity(opacity: 0.75, + child: Image.asset(getMsgImage('icon_video'), + width: 40.sp), + ), ), GestureDetector( onTap: () { @@ -792,8 +797,10 @@ class _TIMTextFieldLayoutNarrowState } getVideoFile(ImageSource.camera); }, - child: Image.asset(getMsgImage('icon_video_camera'), - width: 40.sp), + child: Opacity(opacity: 0.75, + child: Image.asset(getMsgImage('icon_video_camera'), + width: 40.sp), + ), ), ], ), @@ -884,6 +891,10 @@ class _TIMTextFieldLayoutNarrowState ); } + opacityWidget(Widget child) { + return Opacity(opacity: 0.75,child: widget,); + } + chatActionWidget(String img, String action, GestureTapCallback onTap) { return GestureDetector( onTap: onTap, diff --git a/circle_app/lib/app/chat/view.dart b/circle_app/lib/app/chat/view.dart index b7328c7..8b1a969 100644 --- a/circle_app/lib/app/chat/view.dart +++ b/circle_app/lib/app/chat/view.dart @@ -9,6 +9,7 @@ import 'package:circle_app/network/api.dart'; import 'package:circle_app/network/dio_manager.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; +import 'package:circle_app/view/notice.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -16,13 +17,12 @@ import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_glo import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart'; +import '../../common/colors/app_color.dart'; import '../../util/eventBus.dart'; import '../userinfo/logic.dart'; class ChatPage extends StatefulWidget { - - ChatPage({Key? key}) - : super(key: key); + ChatPage({Key? key}) : super(key: key); @override State createState() => _ChatPageState(); @@ -32,6 +32,10 @@ class _ChatPageState extends State { // final logic = Get.find(); // // final state = Get.find().state; + + bool isShowTip = false; + String tip = 'Ta主页形象质量不错哦,您也完善一下呗,点击前往'; + @override void dispose() { // TODO: implement dispose @@ -40,9 +44,9 @@ class _ChatPageState extends State { } final TIMUIKitChatController _timuiKitChatController = - TIMUIKitChatController(); + TIMUIKitChatController(); V2TimConversation con = Get.arguments; - User? userInfoBean; + UserBean? userInfoBean; UserBean? otherUserBean; String conversationID = ''; bool isBlack = false; @@ -54,25 +58,26 @@ class _ChatPageState extends State { super.initState(); initEventBus(); loadMyInfo(); - loadUserData(); } - - void loadIsShowSendGiftDialogData() async { - var data = await DioManager.instance.get(url: Api.isShow_give_gift + conversationID.split('_').last); + var data = await DioManager.instance + .get(url: Api.isShow_give_gift + conversationID.split('_').last); if (data['code'] == 200) { if (data['data']) { - Get.bottomSheet(SendGiftDialog(accid: conversationID,title: data['msg'],), isScrollControlled: true, + Get.bottomSheet( + SendGiftDialog( + accid: conversationID, + title: data['msg'], + ), + isScrollControlled: true, enableDrag: false); } } } - loadUserData() async { - conversationID = con!.conversationID!; String url = "${Api.getUserInfoTA + conversationID.split('_').last}/home"; var data = await DioManager.instance.get(url: url); @@ -82,48 +87,71 @@ class _ChatPageState extends State { if (bean.isSuccess()) { otherUserBean = bean.data.user; + if (!isShowTip) { - setState(() { - - }); + fetchMyAlbum(Api.getMyAlbum); + } + setState(() {}); } loadIsShowSendGiftDialogData(); } + Future fetchMyAlbum(String url) async { + var myAlbumData = await DioManager.instance.get(url: url); + var myAlbumBean = BaseResponse.fromJson( + myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - initEventBus()async{ - sub = EventBusManager.on().listen((event) async{ - V2TimValueCallback? sendMessageRes = - await _timuiKitChatController.sendMessage( - messageInfo: event.createCustomMessageRes?.data?.messageInfo); - if (sendMessageRes!.code == 0) { - // 发送成功 - if (sendMessageRes.data?.customElem?.extension != 'cardData') { - showOKToast('发送成功'); - } - // - sendMessageRes.data?.customElem?.data; //自定义data - sendMessageRes.data?.customElem?.desc; //自定义desc - sendMessageRes.data?.customElem?.extension; //自定义extension - } - }); + if (myAlbumBean.isSuccess()) { + List list = myAlbumBean.data.lists ?? []; + if (list.isEmpty) { + isShowTip = true; + tip = '您还没上传照片,上传后更方便了解,点击前往'; + setState(() { + }); + } else { + if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) { + isShowTip = true; + setState(() { + + }); + } + } + } } - Widget renderCustomStickerPanel({ - sendTextMessage, - sendFaceMessage, - deleteText, - addCustomEmojiText, - addText, - List defaultCustomEmojiStickerList = const [], - double? height, - double? width - }) { + + initEventBus() async { + sub = EventBusManager.on().listen((event) async { + V2TimValueCallback? sendMessageRes = + await _timuiKitChatController.sendMessage( + messageInfo: event.createCustomMessageRes?.data?.messageInfo); + if (sendMessageRes!.code == 0) { + // 发送成功 + if (sendMessageRes.data?.customElem?.extension != 'cardData') { + showOKToast('发送成功'); + } + // + sendMessageRes.data?.customElem?.data; //自定义data + sendMessageRes.data?.customElem?.desc; //自定义desc + sendMessageRes.data?.customElem?.extension; //自定义extension + } + }); + } + + Widget renderCustomStickerPanel( + {sendTextMessage, + sendFaceMessage, + deleteText, + addCustomEmojiText, + addText, + List defaultCustomEmojiStickerList = const [], + double? height, + double? width}) { final defaultEmojiList = - defaultCustomEmojiStickerList.map((customEmojiPackage) { + defaultCustomEmojiStickerList.map((customEmojiPackage) { return CustomStickerPackage( name: customEmojiPackage.name, baseUrl: "assets/custom_face_resource/${customEmojiPackage.name}", @@ -133,7 +161,7 @@ class _ChatPageState extends State { .asMap() .keys .map((idx) => - CustomSticker(index: idx, name: customEmojiPackage.list[idx])) + CustomSticker(index: idx, name: customEmojiPackage.list[idx])) .toList(), menuItem: CustomSticker( index: 0, @@ -141,8 +169,8 @@ class _ChatPageState extends State { )); }).toList(); return StickerPanel( - // height: 100.sp, - backgroundColor:Colors.transparent, + // height: 100.sp, + backgroundColor: Colors.transparent, showBottomContainer: true, sendTextMsg: sendTextMessage, sendFaceMsg: (index, data) => @@ -158,103 +186,185 @@ class _ChatPageState extends State { @override Widget build(BuildContext context) { // - return TIMChat( - conversation: con, - customStickerPanel: renderCustomStickerPanel, - // onTapAvatar :(String userId,TapDownDetails tapDownDetails)async{ - // var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last,preventDuplicates: false); - // // setState(() { - // // - // // }); - // }, - controller : _timuiKitChatController, - config: TIMUIKitChatConfig( + return Stack( + fit: StackFit.expand, + children: [ + TIMChat( + conversation: con, + customStickerPanel: renderCustomStickerPanel, + // onTapAvatar :(String userId,TapDownDetails tapDownDetails)async{ + // var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last,preventDuplicates: false); + // // setState(() { + // // + // // }); + // }, + controller: _timuiKitChatController, + config: TIMUIKitChatConfig( + // 仅供演示,非全部配置项,实际使用中,可只传和默认项不同的参数,无需传入所有开关 + isAllowClickAvatar: true, + isUseDefaultEmoji: true, + isAllowLongPressMessage: true, + isShowReadingStatus: true, + isShowGroupReadingStatus: true, + notificationTitle: "", + isUseMessageReaction: true, + notificationBody: + (V2TimMessage message, String convID, ConvType convType) { + // V2TIM_ELEM_TYPE_NONE = 0, ///< 未知消息 + // V2TIM_ELEM_TYPE_TEXT = 1, ///< 文本消息 + // V2TIM_ELEM_TYPE_CUSTOM = 2, ///< 自定义消息 + // V2TIM_ELEM_TYPE_IMAGE = 3, ///< 图片消息 + // V2TIM_ELEM_TYPE_SOUND = 4, ///< 语音消息 + // V2TIM_ELEM_TYPE_VIDEO = 5, ///< 视频消息 + // V2TIM_ELEM_TYPE_FILE = 6, ///< 文件消息 + // V2TIM_ELEM_TYPE_LOCATION = 7, ///< 地理位置消息 + // V2TIM_ELEM_TYPE_FACE = 8, ///< 表情消息 + // V2TIM_ELEM_TYPE_GROUP_TIPS = 9, ///< 群 Tips 消息 + // V2TIM_ELEM_TYPE_MERGER = 10, ///< 合并消息 - // 仅供演示,非全部配置项,实际使用中,可只传和默认项不同的参数,无需传入所有开关 - isAllowClickAvatar: true, - isUseDefaultEmoji: true, - isAllowLongPressMessage: true, - isShowReadingStatus: true, - isShowGroupReadingStatus: true, - notificationTitle: "", - isUseMessageReaction: true, - notificationBody: (V2TimMessage message, String convID, ConvType convType) { - // V2TIM_ELEM_TYPE_NONE = 0, ///< 未知消息 - // V2TIM_ELEM_TYPE_TEXT = 1, ///< 文本消息 - // V2TIM_ELEM_TYPE_CUSTOM = 2, ///< 自定义消息 - // V2TIM_ELEM_TYPE_IMAGE = 3, ///< 图片消息 - // V2TIM_ELEM_TYPE_SOUND = 4, ///< 语音消息 - // V2TIM_ELEM_TYPE_VIDEO = 5, ///< 视频消息 - // V2TIM_ELEM_TYPE_FILE = 6, ///< 文件消息 - // V2TIM_ELEM_TYPE_LOCATION = 7, ///< 地理位置消息 - // V2TIM_ELEM_TYPE_FACE = 8, ///< 表情消息 - // V2TIM_ELEM_TYPE_GROUP_TIPS = 9, ///< 群 Tips 消息 - // V2TIM_ELEM_TYPE_MERGER = 10, ///< 合并消息 + if (userInfoBean == null) { + loadMyInfo(); + } - if (userInfoBean == null) { - loadMyInfo(); - } - - if (message.elemType ==1) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + message.textElem!.text! ?? ''; - } else if (message.elemType == 3) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一张图片'; - } else if (message.elemType == 4) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条语音'; - } else if (message.elemType == 5) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条视频'; - } else { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条消息'; - } - - }, - groupReadReceiptPermissionList: [ - GroupReceiptAllowType.work, - GroupReceiptAllowType.meeting, - GroupReceiptAllowType.public - ], - ), - customAppBar:MyAppBar( - centerTitle: '', - actionWdiget: GestureDetector( - onTap: () { - Get.bottomSheet( - MoreDialog( + if (message.elemType == 1) { + return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty + ? (userInfoBean!.nickname ?? '昵称待审核') + ':' + : '') + + message.textElem!.text! ?? + ''; + } else if (message.elemType == 3) { + return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty + ? (userInfoBean!.nickname ?? '昵称待审核') + ':' + : '') + + '发了一张图片'; + } else if (message.elemType == 4) { + return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty + ? (userInfoBean!.nickname ?? '昵称待审核') + ':' + : '') + + '发了一条语音'; + } else if (message.elemType == 5) { + return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty + ? (userInfoBean!.nickname ?? '昵称待审核') + ':' + : '') + + '发了一条视频'; + } else { + return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty + ? (userInfoBean!.nickname ?? '昵称待审核') + ':' + : '') + + '发了一条消息'; + } + }, + groupReadReceiptPermissionList: [ + GroupReceiptAllowType.work, + GroupReceiptAllowType.meeting, + GroupReceiptAllowType.public + ], + ), + customAppBar: MyAppBar( + centerTitle: '', + actionWdiget: GestureDetector( + onTap: () { + Get.bottomSheet( + MoreDialog( sessionId: conversationID, - userId: (otherUserBean?.id ?? 0) > 0 ? otherUserBean!.id!.toString() : '', + userId: (otherUserBean?.id ?? 0) > 0 + ? otherUserBean!.id!.toString() + : '', deleteMsgCallBack: () { // context.read().clearMsg(); // ChatViewModel viewModel = context.read(); // viewModel.messageList.clear(); // viewModel.notifyListeners(); - },blackCallBack: () { + }, + blackCallBack: () { loadUserData(); - },), - isScrollControlled: true); - // defaultAvatarTap(widget.sessionId, isSelf:false); - }, - child: Image.asset( - getMsgImage('msg_more'), - width: 24.sp, - )), - onPressed: () {}, + }, + ), + isScrollControlled: true); + // defaultAvatarTap(widget.sessionId, isSelf:false); + }, + child: Image.asset( + getMsgImage('msg_more'), + width: 24.sp, + )), + onPressed: () {}, + ), + + userAvatarBuilder: (BuildContext context, V2TimMessage message) { + return avatarWidget( + (message.faceUrl?.isNotEmpty ?? false) + ? message.faceUrl! + : 'https://qiniuyun.leyuan666.com/quanzi/avatar/default.png', + message!); + }, ), - - userAvatarBuilder: (BuildContext context, V2TimMessage message) { - return avatarWidget((message.faceUrl?.isNotEmpty ?? false) ? message.faceUrl! : 'https://qiniuyun.leyuan666.com/quanzi/avatar/default.png',message!); - }, - + if (isShowTip) + Positioned(child: tipWidget(tip)), + ], ); } - avatarWidget(String url,V2TimMessage message, {double width = 34}) { + tipWidget(String tip) { + return Column( + children: [ + GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity)!.then((value) { + loadMyInfo(); + }); + }, + child: Container( + width: Get.width - 16, + height: 40.sp, + margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top + 45), + padding: EdgeInsets.fromLTRB(16.sp, 0.sp, 16.sp, 0.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Color(0xFF353443), + ), + child: Row( + children: [ + Expanded( + child: Text( + tip, + style: TextStyle( + color: Colors.white, + fontSize: 13.sp, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + )), + GestureDetector( + onTap: () { + isShowTip = false; + setState(() { + + }); + }, + child: Icon( + Icons.close, + size: 20, + color: AppColor.mainColor, + ), + ) + ], + ), + ), + ), + ], + ); + } + + avatarWidget(String url, V2TimMessage message, {double width = 34}) { print(url); return GestureDetector( - onTap: () async { - // V2TimConversation con = Get.arguments; - // if (message.sender == con.userID.toString()) return; - var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: message.sender!.toString().split('_').last,preventDuplicates: false); - }, + onTap: () async { + // V2TimConversation con = Get.arguments; + // if (message.sender == con.userID.toString()) return; + var data = await Get.toNamed(AppRoutes.UserInfoActivity, + arguments: message.sender!.toString().split('_').last, + preventDuplicates: false); + }, child: Stack( alignment: Alignment.center, children: [ @@ -262,27 +372,31 @@ class _ChatPageState extends State { getCircleImage('avatar_bg'), width: width.sp, ), - url.contains("http") ? ClipOval( - child: CachedNetworkImage( - imageUrl:url, - width: (width - 2).sp, - height: (width - 2).sp, - fit: BoxFit.cover, - ), - ) : Text(url,style: TextStyle(color: Color(0xffF756FF),fontSize: 12.sp),) + url.contains("http") + ? ClipOval( + child: CachedNetworkImage( + imageUrl: url, + width: (width - 2).sp, + height: (width - 2).sp, + fit: BoxFit.cover, + ), + ) + : Text( + url, + style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), + ) ], )); } void loadMyInfo() async { var data = await DioManager.instance.get(url: Api.getUserMine); - if (data['code'] == 200) { - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - userInfoBean = bean.data.user!; + var bean = BaseResponse.fromJson( + data, (data) => ResponseBean.fromJson(data)); - } + if (bean.code == 200) { + userInfoBean = bean.data.user!; + loadUserData(); } } @@ -290,82 +404,78 @@ class _ChatPageState extends State { return userInfoBean == null ? Container() : GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userInfoBean!.id!.toString()); - }, - child: Container( - margin: - EdgeInsets.only(left: 0 > 99 ? 80.sp : 65.sp), - child: Row( - children: [ - ClipOval( - child: Image.network( - otherUserBean!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - )), - SizedBox( - width: 4.sp, + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: userInfoBean!.id!.toString()); + }, + child: Container( + margin: EdgeInsets.only(left: 0 > 99 ? 80.sp : 65.sp), + child: Row( + children: [ + ClipOval( + child: Image.network( + otherUserBean!.avatar!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + )), + SizedBox( + width: 4.sp, + ), + // Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // userInfoBean!.nickname ?? '昵称待审核', + // style: TextStyle( + // color: Colors.white, + // fontSize: + // ((otherUserBean!.onlineFlag ?? '').isNotEmpty) + // ? 14.sp + // : 16.sp), + // ), + // if ((otherUserBean!.onlineFlag ?? '').isNotEmpty) + // Text( + // otherUserBean!.onlineFlag ?? '', + // style: TextStyle( + // color: Colors.white.withOpacity(0.75), + // fontSize: 12.sp), + // ), + // ], + // ), + // if (otherUserBean!.! <= 1 )) + // GestureDetector( + // onTap: () { + // if (userInfoBean!.followStatus! <= 1) { + // setFollow(); + // } else { + // addFollowHeader(); + // } + // }, + // child: Container( + // margin: EdgeInsets.only( + // left: 5.sp, + // ), + // padding: EdgeInsets.only(left: 4.sp, right: 4.sp), + // height: 22.sp, + // decoration: BoxDecoration( + // gradient: AppColor.newMainVerLinearGradient, + // borderRadius: BorderRadius.circular(14), + // ), + // child: Center( + // child: Text( + // userInfoBean!.followStatus! <= 1 ? '关注' : '+特别关心', + // style: TextStyle( + // fontSize: 12.sp, color: Colors.white)), + // ), + // ), + // ), + ], + ), ), - // Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text( - // userInfoBean!.nickname ?? '昵称待审核', - // style: TextStyle( - // color: Colors.white, - // fontSize: - // ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - // ? 14.sp - // : 16.sp), - // ), - // if ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - // Text( - // otherUserBean!.onlineFlag ?? '', - // style: TextStyle( - // color: Colors.white.withOpacity(0.75), - // fontSize: 12.sp), - // ), - // ], - // ), - // if (otherUserBean!.! <= 1 )) - // GestureDetector( - // onTap: () { - // if (userInfoBean!.followStatus! <= 1) { - // setFollow(); - // } else { - // addFollowHeader(); - // } - // }, - // child: Container( - // margin: EdgeInsets.only( - // left: 5.sp, - // ), - // padding: EdgeInsets.only(left: 4.sp, right: 4.sp), - // height: 22.sp, - // decoration: BoxDecoration( - // gradient: AppColor.newMainVerLinearGradient, - // borderRadius: BorderRadius.circular(14), - // ), - // child: Center( - // child: Text( - // userInfoBean!.followStatus! <= 1 ? '关注' : '+特别关心', - // style: TextStyle( - // fontSize: 12.sp, color: Colors.white)), - // ), - // ), - // ), - ], - ), - ), - ); + ); } } - -class ChatLoadUserInfoData { - -} \ No newline at end of file +class ChatLoadUserInfoData {} diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index eb1b473..8722bb9 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -522,8 +522,6 @@ class CircleLogic extends GetxController { if (info.isNotEmpty) { newPeopleList.addAll(info); } - - newPeopleList.addAll(list); pageIndex = pageIndex + 1; } else { peopleRefreshController.loadNoData(); diff --git a/circle_app/lib/app/circle/view.dart b/circle_app/lib/app/circle/view.dart index 8919e3b..c20557f 100644 --- a/circle_app/lib/app/circle/view.dart +++ b/circle_app/lib/app/circle/view.dart @@ -688,7 +688,7 @@ class _CirclePageState extends State }, child: Image.asset( getCircleImage('clocked_icon'), - width: 50.sp, + width: 65.sp, ), )), Container( @@ -813,7 +813,7 @@ class _CirclePageState extends State // SizedBox(width: 2.sp,), Container( margin: EdgeInsets.only(top: 4.sp), - + child: Text( '30', style: TextStyle( diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart index c8bd0bb..d3dbfff 100644 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ b/circle_app/lib/app/circle/widgets/discover.dart @@ -387,7 +387,9 @@ class _DiscoverState extends State Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': imgList, - 'index': index + 'index': index, + 'userId':user.userId.toString() + }); }, child: CachedNetworkImage( diff --git a/circle_app/lib/app/circle/widgets/discover_item.dart b/circle_app/lib/app/circle/widgets/discover_item.dart index 8fdf72f..f9aae45 100644 --- a/circle_app/lib/app/circle/widgets/discover_item.dart +++ b/circle_app/lib/app/circle/widgets/discover_item.dart @@ -98,7 +98,8 @@ class _DiscoverItemState extends State { Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': imgList, - 'index': index + 'index': index, + 'userId':user.id.toString() }); }, child: CachedNetworkImage( diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart index 0b19762..c8f54b9 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -697,12 +697,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien for (var element in lists.chat!.users!) { widgets.add(Positioned( left: 12.sp * index, - child: GestureDetector( - onTap: () { - // pushOtherPeopleHomePage(element.id.toString()); - }, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), - ), + child: circleWidget(element.avatar!,element.id.toString(), width: 24), )); index++; } @@ -723,14 +718,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3; + double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { picHeight = picWidth; } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -937,15 +932,6 @@ class InfoListViewState extends State with AutomaticKeepAliveClien borderRadius: BorderRadius.circular(6.sp), child: CachedNetworkImage( imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), errorWidget: (context, url, error) => const Icon(Icons.error), fit: BoxFit.cover, @@ -990,8 +976,6 @@ class InfoListViewState extends State with AutomaticKeepAliveClien GestureDetector( onTap: () { pushMsgPage(lists, widget.bean.id.toString(),); - // pushHomePage( - // lists, widget.bean.id.toString()); }, child: Image.asset( getCircleImage('chat'), @@ -1016,19 +1000,19 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ); double picHeight = 0.0; + double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; if (lists.album != null) { if (lists.album!.isNotEmpty) { Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { picHeight = picWidth; } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -1038,11 +1022,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien lists.chat!.users!.forEach((element) { widgets.add(Positioned( left: 12.sp * index, - child: GestureDetector( - onTap: () { - }, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), - ), + child: circleWidget(element.avatar!,element.id.toString(), width: 24), )); index++; }); @@ -1224,7 +1204,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien height: picHeight, alignment: Alignment.centerLeft, margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp + child: picHeight == 200.sp ? ClipRRect( borderRadius: BorderRadius.circular(6.sp), child: VideoItemWidget(lists.album![0].url!)) @@ -1236,7 +1216,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget + childAspectRatio:0.7 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1459,7 +1439,27 @@ class InfoListViewState extends State with AutomaticKeepAliveClien circleWidget(String url, String userId,{double width = 24}) { return GestureDetector( - onTap: (){ + onTap: () async { + if (widget.bean.is_limit&&widget.bean.amount > 0) { + await refreshCircleData(); + } + if (widget.bean.is_limit&&widget.bean.amount>0) { + showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ + widget.bean.is_limit = false; + if (Get.isRegistered()) { + var logic = Get.find(); + for (var element in logic.circle.lists) { + if (element.id == widget.bean.id) { + element.is_limit = false; + element.isJoin = true; + } + } + logic.update(); + } + Get.back(); + },widget.bean.ios_item); + return; + } Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); }, child: Stack( diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart index 88c169e..0de878c 100644 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -596,14 +596,14 @@ class _LikeViewState extends State Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - 20.sp) / 3; + double picWidth = (Get.width - 100.sp) / 3 + 40; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { picHeight = picWidth; } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -787,7 +787,7 @@ class _LikeViewState extends State crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget + childAspectRatio: 0.7 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -799,7 +799,8 @@ class _LikeViewState extends State } Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': imgList, - 'index': currentIndex + 'index': currentIndex, + 'userId':lists.user!.id.toString() }); }, child: ClipRRect( @@ -902,14 +903,14 @@ class _LikeViewState extends State Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - 20.sp) / 3; + double picWidth = (Get.width - 100.sp) / 3 + 40; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { picHeight = picWidth; } } else { - picHeight = 140.sp; + picHeight = 200.sp; } } } @@ -1103,7 +1104,7 @@ class _LikeViewState extends State crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, childAspectRatio: - 1.0 //宽高比为1时,子widget + 0.7 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1122,7 +1123,8 @@ class _LikeViewState extends State Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': imgList, - 'index': currentIndex + 'index': currentIndex, + 'userId':lists.user!.id.toString() }); }, child: ClipRRect( diff --git a/circle_app/lib/app/circle/widgets/vicinity.dart b/circle_app/lib/app/circle/widgets/vicinity.dart index 7d49213..0215d75 100644 --- a/circle_app/lib/app/circle/widgets/vicinity.dart +++ b/circle_app/lib/app/circle/widgets/vicinity.dart @@ -374,7 +374,8 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': item.images, - 'index': i + 'index': i, + // 'userId': item.id.toString() }); }, child: ListAlbumItem(item.images[i], i)), diff --git a/circle_app/lib/app/msg/sys_notify_list/logic.dart b/circle_app/lib/app/msg/sys_notify_list/logic.dart index 82184dc..1735bcb 100644 --- a/circle_app/lib/app/msg/sys_notify_list/logic.dart +++ b/circle_app/lib/app/msg/sys_notify_list/logic.dart @@ -177,6 +177,7 @@ class Sys_notify_listLogic extends GetxController { void onRefresh() async { page = 0; next = 0; + lists.clear(); initList(); } diff --git a/circle_app/lib/app/quick/view.dart b/circle_app/lib/app/quick/view.dart index d363c94..48e93c7 100644 --- a/circle_app/lib/app/quick/view.dart +++ b/circle_app/lib/app/quick/view.dart @@ -281,7 +281,7 @@ class QuickPage extends StatelessWidget { child: _buildInterestsListView(item.interests)), if (item.images.isNotEmpty) Container( - height: 98, + height: 130, margin: EdgeInsets.only( top: 6.sp, left: 10.sp, right: 10.sp, bottom: 10.sp), child: SingleChildScrollView( @@ -295,7 +295,8 @@ class QuickPage extends StatelessWidget { onTap: () { Get.toNamed(AppRoutes.Swiper, arguments: { 'imaglist': item.images, - 'index': i + 'index': i, + 'userId':item.id.toString() }); }, child: ListAlbumItem(item.images[i], i)), @@ -315,7 +316,7 @@ class QuickPage extends StatelessWidget { borderRadius: BorderRadius.circular(8.sp), child: CachedNetworkImage( width: 88.sp, - height: 88.sp, + height: 130.sp, fit: BoxFit.cover, imageUrl: item + "?imageView2/1/w/176/h/176/q/75", ), diff --git a/circle_app/lib/app/swiper/logic.dart b/circle_app/lib/app/swiper/logic.dart index ec7716f..52f1afb 100644 --- a/circle_app/lib/app/swiper/logic.dart +++ b/circle_app/lib/app/swiper/logic.dart @@ -7,11 +7,15 @@ class SwiperLogic extends GetxController { final SwiperState state = SwiperState(); List imgList = Get.arguments['imaglist'] ; int index = Get.arguments['index'] ; + String userId = ''; SwiperController swiperController = SwiperController(); @override void onInit() { super.onInit(); - + Map arg = Get.arguments; + if (arg.containsKey('userId')) { + userId = arg['userId']; + } } @override void onReady() { diff --git a/circle_app/lib/app/swiper/view.dart b/circle_app/lib/app/swiper/view.dart index 1658fc8..6868062 100644 --- a/circle_app/lib/app/swiper/view.dart +++ b/circle_app/lib/app/swiper/view.dart @@ -13,6 +13,7 @@ import 'package:get/get_state_manager/src/simple/get_state.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import '../../router/app_routers.dart'; import '../home/logic.dart'; import 'logic.dart'; import 'dart:ui' as ui; @@ -113,7 +114,51 @@ class _SwiperPageState extends State { size: 25.sp, ), ), - )) + )), + if (logic.userId.isNotEmpty) + Positioned( + right: 16.sp, + top: 16.sp, + child: SafeArea( + child: GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: logic.userId); + Get.delete(); + }, + child: Container( + width: 73.sp, + height: 25.sp, + decoration: BoxDecoration( + gradient: + AppColor.mainVerLinearGradient, + borderRadius: + BorderRadius.circular(12.5.sp)), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 5.sp), + child: Text( + '查看主页', + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + ), + ), + ), + Image( + width: 15.sp, + image: AssetImage( + getDisCoverImage("right_icon")), + // width: 44.sp, + ), + ], + ), + ), + ), + )), ], ), ), diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart index c4b19d5..9faf5cc 100644 --- a/circle_app/lib/app/userinfo/logic.dart +++ b/circle_app/lib/app/userinfo/logic.dart @@ -429,6 +429,7 @@ class UserBean { int role; int mark; int orientation; + int userType; List interests; List orientations; double lng; @@ -449,6 +450,7 @@ class UserBean { required this.age, required this.signature, required this.vip, + required this.userType, required this.gender, required this.hide_wx_num, required this.orientations, @@ -471,6 +473,7 @@ class UserBean { factory UserBean.fromJson(Map json) { return UserBean( id: json['id'], + userType: json['userType'] ?? 0, currentCity: json['currentCity'] ?? '', hide_wx_num: json['hide_wx_num'] ?? 0, orientations: json['orientations'] ?? [], @@ -488,7 +491,7 @@ class UserBean { gender: json['gender'], role: json['role'], orientation: json['orientation'], - interests: List.from( + interests: json['interests'] == null ? [] : List.from( json['interests'].map((x) => Interest.fromJson(x)), ), lng: json['lng'], diff --git a/circle_app/lib/common/Widgets/today_people_dialog.dart b/circle_app/lib/common/Widgets/today_people_dialog.dart index 660539b..e22fba1 100644 --- a/circle_app/lib/common/Widgets/today_people_dialog.dart +++ b/circle_app/lib/common/Widgets/today_people_dialog.dart @@ -672,28 +672,31 @@ class _SearchAnimationWidgetState extends State crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - AnimatedBuilder( - animation: _controller, - builder: (context, child) { - return Transform.translate( - offset: Offset( - 30.0 * math.cos(2 * math.pi * _controller.value), - 30.0 * math.sin(2 * math.pi * _controller.value), - ), - child: IconButton( - icon: Icon( - Icons.search, - color: Colors.white, - size: 50.sp, - ), - onPressed: () { - // 处理点击事件 - }, - ), - ); - }), + Stack( + children: [ + Image.asset(getCircleImage('search_bg_icon'),width: 90.sp,), + AnimatedBuilder( + animation: _controller, + builder: (context, child) { + return Container( + margin: EdgeInsets.only(left: 30.sp,top: 30.sp), + child: Transform.translate( + offset: Offset( + 30.0 * math.cos(2 * math.pi * _controller.value), + 30.0 * math.sin(2 * math.pi * _controller.value), + ), + child: Image.asset( + getCircleImage('search_icon'), + + width: 27.sp, + ), + ), + ); + }), + ], + ), Container( - margin: EdgeInsets.only(top: 50.sp), + margin: EdgeInsets.only(top: 20.sp), child: Text( '正在为您匹配合适的那个Ta~', style: TextStyle(color: Colors.white, fontSize: 16.sp), diff --git a/circle_app/lib/view/notice.dart b/circle_app/lib/view/notice.dart index 7c83370..a7a2074 100644 --- a/circle_app/lib/view/notice.dart +++ b/circle_app/lib/view/notice.dart @@ -9,34 +9,30 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../main.dart'; +import '../router/app_routers.dart'; + typedef void NoticeCallback(); - -void showFloatingButtonOverlay( - BuildContext context, String nickname, String ageMsg, String avatar,int event,NoticeCallback noticeCallback) { - - +void showFloatingButtonOverlay(BuildContext context, String nickname, + String ageMsg, String avatar, int event, 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, + // right: 16, child: AnimatedContainer( duration: const Duration(milliseconds: 500), curve: Curves.easeInOut, @@ -109,13 +105,14 @@ void showFloatingButtonOverlay( ], ), const SizedBox(height: 4), - Text( event == 0 - ? "看了这么久,给我点个喜欢呗~" - : event == 1 - ? "我喜欢了你,可以喜欢我一下吗?" - : event == 2 - ? "你喜欢的人上线啦,赶紧找他聊天吧!" - : "我也喜欢了你,一起聊聊呗~", + Text( + event == 0 + ? "看了这么久,给我点个喜欢呗~" + : event == 1 + ? "我喜欢了你,可以喜欢我一下吗?" + : event == 2 + ? "你喜欢的人上线啦,赶紧找他聊天吧!" + : "我也喜欢了你,一起聊聊呗~", style: TextStyle( color: Colors.grey, fontSize: 13.sp, @@ -131,9 +128,7 @@ void showFloatingButtonOverlay( countdownTimer.cancel(); try { overlayEntry!.remove(); - } catch (e) { - - } + } catch (e) {} mainOverlayEntry = null; noticeCallback(); @@ -162,10 +157,10 @@ void showFloatingButtonOverlay( event == 0 ? "喜欢" : event == 1 - ? "回关" - : event == 2 - ? "私聊" - : "私聊", + ? "回关" + : event == 2 + ? "私聊" + : "私聊", style: TextStyle( color: Colors.white, fontSize: 14.sp, @@ -181,31 +176,34 @@ void showFloatingButtonOverlay( ), ), if (event == 0) - Positioned( - top: MediaQuery.of(context).padding.top, - right: 8, - child: GestureDetector( - onTap: () { - countdownTimer.cancel(); - // 取消计时器 - try { - overlayEntry!.remove(); - } catch (e) { - - } - mainOverlayEntry = null; - }, - child: Container( - height: 20, - width: 30, - decoration: BoxDecoration( - borderRadius: BorderRadius.only(topRight: Radius.circular(10),bottomLeft: Radius.circular(10)), - gradient: AppColor.mainVerLinearGradient + Positioned( + top: MediaQuery.of(context).padding.top, + right: 8, + child: GestureDetector( + onTap: () { + countdownTimer.cancel(); + // 取消计时器 + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + }, + child: Container( + height: 20, + width: 30, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(10), + bottomLeft: Radius.circular(10)), + gradient: AppColor.mainVerLinearGradient), + alignment: Alignment.center, + child: Icon( + Icons.close, + size: 20, + color: Colors.white, + ), ), - alignment: Alignment.center, - child: Icon(Icons.close,size: 20,color: Colors.white,), - ), - )) + )) ], ); }, @@ -216,16 +214,105 @@ void showFloatingButtonOverlay( countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) { if (countdownSeconds > 0) { countdownSeconds--; - // overlayEntry.markNeedsBuild(); // 刷新 OverlayEntry + // overlayEntry.markNeedsBuild(); // 刷新 OverlayEntry } else { // 取消计时器 timer.cancel(); try { overlayEntry!.remove(); - } catch (e) { - - } + } catch (e) {} + mainOverlayEntry = null; + } + }); + // 将 OverlayEntry 添加到 Overlay 中 + overlayState?.insert(overlayEntry!); +} + +void showTipFloatingButtonOverlay(BuildContext context, String tip) { + 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 Column( + children: [ + GestureDetector( + onTap: () { + countdownTimer.cancel(); + // 取消计时器 + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + Get.toNamed(AppRoutes.UserInfoActivity); + }, + child: Container( + width: Get.width - 16, + height: 40.sp, + margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top + 45), + padding: EdgeInsets.fromLTRB(16.sp, 0.sp, 16.sp, 0.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Color(0xFF353443).withOpacity(0.5), + ), + child: Row( + + children: [ + Expanded( + child: Text( + tip, + style: TextStyle( + color: Colors.grey, + fontSize: 13.sp, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + )), + GestureDetector( + onTap: () { + countdownTimer.cancel(); + // 取消计时器 + try { + overlayEntry!.remove(); + } catch (e) {} + mainOverlayEntry = null; + }, + child: Icon( + Icons.close, + size: 20, + color: AppColor.mainColor, + ), + ) + ], + ), + ), + ), + ], + ); + }, + ); + // 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; } }); diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 16f9afc..a84af43 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -112,7 +112,7 @@ dependencies: #边框渐变 gradient_borders: ^1.0.0 #系统设置 - app_settings: 4.0.4 + app_settings: 4.3.1 #百度定位插件 flutter_bmflocation: ^3.6.0