diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index 5ce6125..df5378a 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 64 - versionName "2.1.4" + versionCode 67 + versionName "2.1.7" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", @@ -97,6 +97,8 @@ android { project.ext.enableFlutterNullSafety = false } } + + } flutter { @@ -105,4 +107,5 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + } diff --git a/circle_app/ios/Runner/Info.plist b/circle_app/ios/Runner/Info.plist index c2e5fac..ee21ecd 100644 --- a/circle_app/ios/Runner/Info.plist +++ b/circle_app/ios/Runner/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.1.1 + 2.1.6 CFBundleSignature ???? CFBundleURLTypes diff --git a/circle_app/lib/circle_app/chat/TIMUIKitChat/tim_uikit_chat.dart b/circle_app/lib/circle_app/chat/TIMUIKitChat/tim_uikit_chat.dart index d77165d..5b66c62 100644 --- a/circle_app/lib/circle_app/chat/TIMUIKitChat/tim_uikit_chat.dart +++ b/circle_app/lib/circle_app/chat/TIMUIKitChat/tim_uikit_chat.dart @@ -282,9 +282,11 @@ class _TUIChatState extends TIMUIKitState { var result = await DioManager.instance .get(url: '${Api.setBlock + otherUserBean!.id!.toString()}/block'); isBlack = result["data"]["status"] == 1; - setState(() { + if (mounted) { + setState(() { - }); + }); + } } Widget _renderJoinGroupApplication(int amount, TUITheme theme) { diff --git a/circle_app/lib/circle_app/chat/view.dart b/circle_app/lib/circle_app/chat/view.dart index 4788b60..cc9b9e0 100644 --- a/circle_app/lib/circle_app/chat/view.dart +++ b/circle_app/lib/circle_app/chat/view.dart @@ -6,6 +6,7 @@ import 'package:circle_app/net/api.dart'; import 'package:circle_app/net/dio_manager.dart'; import 'package:circle_app/router/routers.dart'; import 'package:circle_app/utils/util.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -19,7 +20,9 @@ import '../../utils/SharedPreferencesHelper.dart'; import '../../utils/cache_img.dart'; import '../../utils/eventBus.dart'; import '../home/logic.dart'; +import '../select_circle/logic.dart'; import '../userinfo/logic.dart'; +import 'logic.dart'; class ChatPage extends StatefulWidget { ChatPage({Key? key}) : super(key: key); @@ -34,7 +37,7 @@ class _ChatPageState extends State { // final state = Get.find().state; bool isShowTip = false; - String tip = 'Ta主页形象质量不错哦,您也完善一下呗,点击前往'; + String tip = 'TA上传了形象照,您上传后更方便了解哦,点击前往'; @override void dispose() { @@ -107,11 +110,18 @@ class _ChatPageState extends State { List list = myAlbumBean.data.lists ?? []; if (list.isEmpty) { isShowTip = true; - tip = '您还没上传照片,上传后更方便了解,点击前往'; + // tip = '您还没上传照片,上传后更方便了解,点击前往'; } else { - if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) { + // bool isMyHave = await loadCallOutListData(userInfoBean!.id!.toString()); + // bool isOtherHave = await loadCallOutListData(otherUserBean!.id!.toString()); + // if (isOtherHave && !isMyHave) { + // isShowTip = true; + // tip = 'TA发布了喊话,您发布后形象会更完善,点击前往'; + // } else if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) { isShowTip = true; - } + + tip = 'TA完成了good号认证,您认证后可获得多种特权,联系客服'; + // } } if (isShowTip) { //处理七天后是否显示X按钮 @@ -146,7 +156,18 @@ class _ChatPageState extends State { }); } + } + + loadCallOutListData(String userId) async { + var data = await DioManager.instance.get( + url: "/up-service/${userId.isEmpty ? 'my/' : 'user/' + userId}/callouts", + params: {"page": 1, "page_size": "2"}); + if (data["code"] == 200) { + List dataList = data["data"]["lists"] ?? []; + return dataList.length == 2; + } + return false; } @@ -338,16 +359,27 @@ class _ChatPageState extends State { return Column( children: [ GestureDetector( - onTap: () { - Get.toNamed(Routes.UserInfoPage)!.then((value) { - loadMyInfo(); - }); + onTap: () async { + if (tip.contains('形象')) { + Get.toNamed(Routes.UserInfoPage)!.then((value) { + loadMyInfo(); + }); + } else if (tip.contains('喊话')) { + List numbers = []; + Get.toNamed(Routes.CallOutPage, + arguments: {'numbers': numbers}); + } else { + var result = await DioManager.instance.post(url: Api.goodAuth); + if (result['code'] == 200) { + showOKToast('发送成功'); + } + } }, 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), + padding: EdgeInsets.fromLTRB(8.sp, 0.sp, 8.sp, 0.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Color(0xFF353443), @@ -359,7 +391,7 @@ class _ChatPageState extends State { tip, style: TextStyle( color: Colors.white, - fontSize: 13.sp, + fontSize: 12.sp, ), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/circle_app/lib/circle_app/chat/widget/chat_msg_card_item.dart b/circle_app/lib/circle_app/chat/widget/chat_msg_card_item.dart index 06e2053..6f72b7c 100644 --- a/circle_app/lib/circle_app/chat/widget/chat_msg_card_item.dart +++ b/circle_app/lib/circle_app/chat/widget/chat_msg_card_item.dart @@ -48,25 +48,37 @@ class _ChatMsgCardItemState extends State { // title var recommendCircleFriendData = data['data']; + List tagList = recommendCircleFriendData['tags']; + if (tagList.isNotEmpty) { + title = tagList.first; + recommendCircleFriendData['tags'] = tagList; + Map cardInfo = checkCardReturnData(recommendCircleFriendData); - if (recommendCircleFriendData['is_follow_me']) { - title = '对方喜欢了你'; - } else if (recommendCircleFriendData['is_follow_to']) { - title = '你喜欢了TA'; - } else if (recommendCircleFriendData['has_both_friend']) { - title = '你们有共同喜欢的圈友'; - } else if (recommendCircleFriendData['is_new_user']) { - title = '我刚来到这里哦'; - } else if (recommendCircleFriendData['has_friend_follow_to']) { - title = '你喜欢的圈友也喜欢TA'; - } else if (recommendCircleFriendData['is_wanna_meet']) { - title = '很多圈友都喜欢TA'; - } else if (recommendCircleFriendData['is_excellent_qz_leader']) { - title = 'TA是乐园优秀圈主哦~'; - } else if (recommendCircleFriendData['is_most_fans']) { - title = '可能是你想认识的人'; + cardInfo['user'] = {'signature':info['user']['signature']}; + cardInfo['my']= {'signature':info['my']['signature']}; + cardInfo['interests'] = info['interests']; + cardInfo['myInterests'] = info['myInterests']; + title = cardInfo['desc']; + info = cardInfo; + } else { + if (recommendCircleFriendData['is_follow_me']) { + title = '对方喜欢了你'; + } else if (recommendCircleFriendData['is_follow_to']) { + title = '你喜欢了TA'; + } else if (recommendCircleFriendData['has_both_friend']) { + title = '你们有共同喜欢的圈友'; + } else if (recommendCircleFriendData['is_new_user']) { + title = '我刚来到这里哦'; + } else if (recommendCircleFriendData['has_friend_follow_to']) { + title = '你喜欢的圈友也喜欢TA'; + } else if (recommendCircleFriendData['is_wanna_meet']) { + title = '很多圈友都喜欢TA'; + } else if (recommendCircleFriendData['is_excellent_qz_leader']) { + title = 'TA是乐园优秀圈主哦~'; + } else if (recommendCircleFriendData['is_most_fans']) { + title = '可能是你想认识的人'; + } } - setState(() {}); } } @@ -186,6 +198,66 @@ class _ChatMsgCardItemState extends State { ], ), ), + if (info.containsKey('desc1')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc1'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('desc2')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc2'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), Container( margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), alignment: Alignment.centerLeft, diff --git a/circle_app/lib/circle_app/circle/logic.dart b/circle_app/lib/circle_app/circle/logic.dart index 0860119..d58db4b 100644 --- a/circle_app/lib/circle_app/circle/logic.dart +++ b/circle_app/lib/circle_app/circle/logic.dart @@ -72,24 +72,42 @@ class CircleLogic extends GetxController { List bannerList = []; List genderList - = []; + = [ + MyConfigData('0', '全部', true) + ]; - List orientationList = []; + List orientationList = [ + MyConfigData('0', '全部', false) + ]; - List roleList = []; + List roleList = [ + MyConfigData('0', '全部', false) + ]; - List dis_genderList = []; + List dis_genderList = [ + MyConfigData('0', '全部', true) + ]; - List dis_orientationList = []; + List dis_orientationList = [ + MyConfigData('0', '全部', false) + ]; - List dis_roleList = []; + List dis_roleList = [ + MyConfigData('0', '全部', false) + ]; - List new_genderList = []; + List new_genderList = [ + MyConfigData('0', '全部', true) + ]; - List new_orientationList = []; + List new_orientationList = [ + MyConfigData('0', '全部', false) + ]; - List new_roleList = []; + List new_roleList = [ + MyConfigData('0', '全部', false) + ]; List newPeopleList = []; @@ -125,7 +143,6 @@ class CircleLogic extends GetxController { loadCirclePeopleData(); initGerder(); getCityList(); - getBanner(); // getNearByList(); startTimer(); @@ -199,11 +216,17 @@ class CircleLogic extends GetxController { ConfigBean configBean = bean1.data!; configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); - dis_genderList.add(MyConfigData(key, value, false)); - new_genderList.add(MyConfigData(key, value, false)); + if (int.parse(key) < 3) { + genderList.add(MyConfigData(key, value, true)); + dis_genderList.add(MyConfigData(key, value, true)); + new_genderList.add(MyConfigData(key, value, true)); + } }); + genderList.add(MyConfigData('-1', '非二元', true)); + dis_genderList.add(MyConfigData('-1', '非二元', true)); + new_genderList.add(MyConfigData('-1', '非二元', true)); + configBean.orientationMap.forEach((key, value) { orientationList.add(MyConfigData(key, value, false)); dis_orientationList.add(MyConfigData(key, value, false)); @@ -365,18 +388,18 @@ class CircleLogic extends GetxController { void getNearByList() async { List genders = []; genderList.forEach((element) { - if (element.isSelect) { + if (element.isSelect && element.id != '0') { genders.add(element.id); } }); List roles = []; roleList.forEach((element) { - if (element.isSelect) roles.add(element.id); + if (element.isSelect && element.id != '0') roles.add(element.id); }); List orientations = []; orientationList.forEach((element) { - if (element.isSelect) orientations.add(element.id); + if (element.isSelect && element.id != '0') orientations.add(element.id); }); if (offset == 0) { getBanner(); @@ -391,7 +414,7 @@ class CircleLogic extends GetxController { 'flush': flush, "orientations": orientations }); - isNearLoad = false; + // isNearLoad = false; var bean = BaseResponse.fromJson( data, (data) => VicinityBean.fromJson(data)); @@ -421,7 +444,6 @@ class CircleLogic extends GetxController { try { - if (vicinityPage == 1) { vicinityList.addAll(bean.data.users); } else { @@ -463,6 +485,7 @@ class CircleLogic extends GetxController { } else if (isShowLocationDialog == false) { isShowLocationDialog = true; + update(); locationDialog(); } } else { @@ -485,6 +508,7 @@ class CircleLogic extends GetxController { refreshController.loadComplete(); update(); } else if (bean.code == 404) { + isNearLoad = false; showOKToast(bean.msg); } update(); @@ -503,18 +527,18 @@ class CircleLogic extends GetxController { isLoadFail = false; List genders = []; new_genderList.forEach((element) { - if (element.isSelect) { + if (element.isSelect && element.id != '0' ) { genders.add(element.id); } }); List roles = []; new_roleList.forEach((element) { - if (element.isSelect) roles.add(element.id); + if (element.isSelect && element.id != '0' ) roles.add(element.id); }); List orientations = []; new_orientationList.forEach((element) { - if (element.isSelect) orientations.add(element.id); + if (element.isSelect && element.id != '0' ) orientations.add(element.id); }); if (offset == 0) { getBanner(); diff --git a/circle_app/lib/circle_app/circle/state.dart b/circle_app/lib/circle_app/circle/state.dart index 3aef2b1..76c08af 100644 --- a/circle_app/lib/circle_app/circle/state.dart +++ b/circle_app/lib/circle_app/circle/state.dart @@ -19,6 +19,7 @@ class Lists { bool? isQueen; User? user; Map? interest; + int? userTop; String? create_time; Lists( {this.album, this.chat, this.content, this.id, this.isQueen, this.user}); @@ -36,6 +37,7 @@ class Lists { interest = json['interest'] ?? {}; create_time = json['create_time'] ?? ''; isQueen = json['is_queen']; + userTop = json['userTop'] ?? 0; user = json['user'] != null ? new User.fromJson(json['user']) : null; } diff --git a/circle_app/lib/circle_app/circle/widgets/discover.dart b/circle_app/lib/circle_app/circle/widgets/discover.dart index 014c2d9..033ce03 100644 --- a/circle_app/lib/circle_app/circle/widgets/discover.dart +++ b/circle_app/lib/circle_app/circle/widgets/discover.dart @@ -20,6 +20,7 @@ import 'package:get/get.dart'; import 'package:get/utils.dart'; import 'package:gradient_borders/gradient_borders.dart'; import 'package:intl/intl.dart'; +import 'package:keframe/keframe.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../../../utils/eventBus.dart'; import '../../../utils/cache_img.dart'; @@ -55,6 +56,7 @@ class _DiscoverState extends State bool isMore = true; bool loadFail = false; + bool isLoadMore = false; int index = 1; List tagList = []; @@ -72,6 +74,8 @@ class _DiscoverState extends State double screenHeight = 0; + final GlobalKey _key = GlobalKey(); + void animateToOffset(ScrollController controller, double offset, void Function() onScrollCompleted) { controller @@ -100,6 +104,14 @@ class _DiscoverState extends State pointerEnd = event.position; touchRangeY = pointerStart.dy - pointerEnd.dy; + if (lastPage >= list.length) { + lastPage = list.length - 1; + } + + // else if (lastPage < 0) { + // lastPage = 1; + // } + if (touchRangeY.abs() < screenHeight / 8) { // 滑动距离大于屏幕宽度的1/8就可以继续翻页了 nextOffset = (screenHeight + 5.sp) * lastPage; @@ -144,6 +156,8 @@ class _DiscoverState extends State void initState() { // TODO: implement initState super.initState(); + // 在帧绘制完成后获取组件的尺寸 + WidgetsBinding.instance.addPostFrameCallback(_getSize); loadData(); if (widget.unlockWxNum == 0) { subscripition = EventBusManager.on().listen((event) { @@ -172,12 +186,19 @@ class _DiscoverState extends State }); } - setLike(String userId, bool isLike, Function callBack) async { - // if (isBlack || isDestroy) { - // showOKToast("喜欢失败,存在拉黑关系或者该账户已注销"); - // return; - // } + + // 获取组件尺寸的方法 + void _getSize(Duration duration) { + final RenderBox renderBox = _key.currentContext!.findRenderObject() as RenderBox; + final size = renderBox.size; + setState(() { + screenHeight = size.height - 20.sp; + }); + } + + + setLike(String userId, bool isLike, Function callBack) async { var data = await DioManager.instance.post( url: "${Api.setLike + userId}/follow", params: {'status': isLike ? "0" : "1"}); @@ -213,6 +234,15 @@ class _DiscoverState extends State } loadData() async { + if (genderList.contains('0')) { + genderList.remove('0'); + } + if (roleList.contains('0')) { + roleList.remove('0'); + } + if (orientationList.contains('0')) { + orientationList.remove('0'); + } var data = await DioManager.instance.post(url: Api.findPage, params: { 'page': index, 'pageSize': 8, @@ -261,6 +291,12 @@ class _DiscoverState extends State } if (mounted) { setState(() {}); + if (isLoadMore) { + isLoadMore = false; + lastPage = lastPage + 1; + animateToOffset( + _scrollController, lastPage * (screenHeight + 5.sp), () {}); + } } } else { loadFail = true; @@ -279,6 +315,7 @@ class _DiscoverState extends State } _onLoading() { + isLoadMore = true; loadData(); } @@ -286,83 +323,89 @@ class _DiscoverState extends State Widget build(BuildContext context) { // TODO: add widget build method - /// 延时一下,需要等state layout结束之后才能获取size - Future.delayed(Duration(milliseconds: 100), () { - if (!mounted) return; - if (screenHeight == 0 && list.isNotEmpty) { - var size = context?.findRenderObject()?.paintBounds?.size; - screenHeight = size!.height - 20.sp; - setState(() {}); - print(size.toString()); - } - }); + // /// 延时一下,需要等state layout结束之后才能获取size + // Future.delayed(Duration(milliseconds: 100), () { + // if (!mounted) return; + // if (screenHeight == 0 && list.isNotEmpty) { + // var size = context?.findRenderObject()?.paintBounds?.size; + // screenHeight = size!.height - 20.sp; + // setState(() {}); + // print(size.toString()); + // } + // }); - return list.isEmpty - ? loadFail ? noResultWidget(tip: '',callBack: () { - isMore = true; - loadFail = false; - setState(() { + return Container( + key: _key, + child: list.isEmpty + ? loadFail ? noResultWidget(tip: '',callBack: () { + isMore = true; + loadFail = false; + setState(() { - }); - refreshData(); - }) : isMore - ? loaddingWidget(true) - : noResultWidget(tip: '已解锁联系方式的圈友会展示在这里哦~') - : Stack( - fit: StackFit.expand, - children: [ - Container(color: Colors.transparent), - Listener( - onPointerDown: getPointDownListenerInHorizontal(), - onPointerUp: getPointUpListenerInHorizontal(), - child: SmartRefresher( - footer: DiyLoadFooter( - noDataText: '只展示一些精选过的圈友哦~', - ), - onRefresh: refreshData, - controller: refreshController, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - itemBuilder: (context, index) { - var user = Users.fromJson(list[index]); - - String onLineStr = ''; - if (user.online_flag?.isNotEmpty ?? false) { - onLineStr = user.online_flag!; - if (user.distance != null) { - if (user.distance! < 100) { - onLineStr = - '${user.online_flag!}· ${user.distance!.toInt()}km'; - } - } - } else { - if (user.distance != null) { - if ((user.distance! ?? 10) < 100) { - onLineStr = '${user.distance!.toInt()}km'; - } - } - } - - return FeaturedItem(info: list[index], index: index, screenHeight: screenHeight, sendNoLookData: () { - sendNoLookData(user.userId!.toString(),index); - },setLike: () { - setLike(user.userId!.toString(), - user.is_follow!, () { - list[index]['is_follow'] = - !user.is_follow!; - setState(() {}); - }); - }, loadSignDiscoverData: loadSignDiscoverData, showGiftPannel: showGiftPannel); - }, - itemCount: list.length, - physics: BouncingScrollPhysics(), - controller: _scrollController, - ), - ), + }); + refreshData(); + }) : isMore + ? loaddingWidget(true) + : noResultWidget(tip: '已解锁联系方式的圈友会展示在这里哦~') + : Stack( + fit: StackFit.expand, + children: [ + Container(color: Colors.transparent), + Listener( + onPointerDown: getPointDownListenerInHorizontal(), + onPointerUp: getPointUpListenerInHorizontal(), + child: SizeCacheWidget( + child:SmartRefresher( + footer: DiyLoadFooter( + noDataText: '只展示一些精选过的圈友哦~', ), - ], - ); + onRefresh: refreshData, + controller: refreshController, + onLoading: _onLoading, + enablePullUp: true, + child: ListView.builder( + itemBuilder: (context, index) { + var user = Users.fromJson(list[index]); + + String onLineStr = ''; + if (user.online_flag?.isNotEmpty ?? false) { + onLineStr = user.online_flag!; + if (user.distance != null) { + if (user.distance! < 100) { + onLineStr = + '${user.online_flag!}· ${user.distance!.toInt()}km'; + } + } + } else { + if (user.distance != null) { + if ((user.distance! ?? 10) < 100) { + onLineStr = '${user.distance!.toInt()}km'; + } + } + } + + return FrameSeparateWidget( + index: index, + child: FeaturedItem(info: list[index], index: index, screenHeight: screenHeight, sendNoLookData: () { + sendNoLookData(user.userId!.toString(),index); + },setLike: () { + setLike(user.userId!.toString(), + user.is_follow!, () { + list[index]['is_follow'] = + !user.is_follow!; + setState(() {}); + }); + }, loadSignDiscoverData: loadSignDiscoverData, showGiftPannel: showGiftPannel)); + }, + itemCount: list.length, + physics: BouncingScrollPhysics(), + controller: _scrollController, + ), + ), + ),) + ], + ), + ); } tagItem(List item) { @@ -451,23 +494,21 @@ class _DiscoverState extends State } loadWxNumData() async { - loadWXEditStatus() async { - var data = await DioManager.instance.get( - url: Api.checkWxNumState, - ); - if (data['code'] == 200) { - var data = await DioManager.instance.get(url: Api.getUserInfo); + var data = await DioManager.instance.get( + url: Api.checkWxNumState, + ); + if (data['code'] == 200) { + var data = await DioManager.instance.get(url: Api.getUserInfo); - if (data['code'] != 4000) { - if (data['data']['user']['wxNum'] == null) { - showAddWxPicker(false); - } else if (data['data']['user']['wxNum'].toString().isEmpty) { - showAddWxPicker(false); - } + if (data['code'] != 4000) { + if (data['data']['user']['wxNum'] == null) { + showAddWxPicker(false); + } else if (data['data']['user']['wxNum'].toString().isEmpty) { + showAddWxPicker(false); } - } else { - // wxStatusInfo['${data['code']}'] = data['msg']; } + } else { + // wxStatusInfo['${data['code']}'] = data['msg']; } } diff --git a/circle_app/lib/circle_app/circle/widgets/info_list_view.dart b/circle_app/lib/circle_app/circle/widgets/info_list_view.dart index e10b6af..2860e5d 100644 --- a/circle_app/lib/circle_app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/info_list_view.dart @@ -47,7 +47,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien @override bool get wantKeepAlive => true; final ScrollController scrollController = ScrollController(); - + final GlobalKey _key = GlobalKey(); ListLogic? listsLg; @@ -58,7 +58,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien var circleId = ''; List lists = []; - + double widgetWidth = 0.0; @override void dispose() { @@ -88,6 +88,8 @@ class InfoListViewState extends State with AutomaticKeepAliveClien void initState() { // TODO: implement initState super.initState(); + // 在帧绘制完成后获取组件的尺寸 + WidgetsBinding.instance.addPostFrameCallback(_getSize); scrollController.addListener(() { try { if (scrollController.position.pixels == @@ -134,6 +136,15 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // widget.back(widget.createState()); } + // 获取组件尺寸的方法 + void _getSize(Duration duration) { + final RenderBox renderBox = _key.currentContext!.findRenderObject() as RenderBox; + final size = renderBox.size; + setState(() { + widgetWidth = size.width; + }); + } + loadCircleInfo() async{ var data = await DioManager.instance.get( @@ -318,6 +329,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien return ClipRRect( + key: _key, borderRadius: BorderRadius.circular(10.sp), child: Container( width: Get.width, @@ -385,8 +397,6 @@ class InfoListViewState extends State with AutomaticKeepAliveClien GestureDetector( behavior:HitTestBehavior.opaque, onTap: (){ - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); }, child:urlList.length==0?Container(): Container( height: 30.sp, @@ -717,12 +727,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien double picHeight = 0.0; + double ratio = 0; if (lists.album != null) { if (lists.album!.isNotEmpty) { Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; + double picWidth = (widgetWidth - 8.sp)/3 + 45; + ratio = (widgetWidth - 8.sp - 24.sp) / 3 / picWidth; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { @@ -917,7 +929,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio: 0.7//宽高比为1时,子widget + childAspectRatio: ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1007,12 +1019,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ); double picHeight = 0.0; - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; + double ratio = 0.0; + double picWidth = (widgetWidth - 8.sp )/3 + 45; if (lists.album != null) { if (lists.album!.isNotEmpty) { Album info = lists.album!.first; if (info.type == 1) { + ratio = (widgetWidth - 8.sp - 24.sp) / 3 / picWidth; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { @@ -1209,7 +1223,6 @@ class InfoListViewState extends State with AutomaticKeepAliveClien picHeight > 0 ? Container( height: picHeight, - alignment: Alignment.centerLeft, margin: EdgeInsets.only(top: 5.sp), child: picHeight == 200.sp ? ClipRRect( @@ -1223,7 +1236,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio:0.7 //宽高比为1时,子widget + childAspectRatio:ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1239,11 +1252,14 @@ class InfoListViewState extends State with AutomaticKeepAliveClien 'index': currentIndex }); }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedImg( - imageUrl: album.url!, + child: Container( + child: ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: CachedImg( + imageUrl: album.url!, + fit: BoxFit.cover, + ), ), ), ); 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 62d1b3f..08e2716 100644 --- a/circle_app/lib/circle_app/circle/widgets/like_view.dart +++ b/circle_app/lib/circle_app/circle/widgets/like_view.dart @@ -646,7 +646,7 @@ class _LikeViewState extends State ), SizedBox( - height: 4.sp, + height: 3.sp, ), Text( info['nickname'] ?? '', @@ -915,6 +915,7 @@ class _LikeViewState extends State borderRadius: BorderRadius.circular(6.sp), child: CachedImg( imageUrl: album.url!, + fit: BoxFit.cover, ), ), ); @@ -1196,10 +1197,10 @@ class _LikeViewState extends State gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: - 0.7 //宽高比为1时,子widget + crossAxisSpacing: 4.sp, + mainAxisSpacing: 4.sp, + childAspectRatio: 0.7 + //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1228,6 +1229,7 @@ class _LikeViewState extends State BorderRadius.circular(6.sp), child: CachedImg( imageUrl: album.url!, + fit: BoxFit.cover, ), ), ); diff --git a/circle_app/lib/circle_app/circle/widgets/vicinity.dart b/circle_app/lib/circle_app/circle/widgets/vicinity.dart index c3d1820..afb7005 100644 --- a/circle_app/lib/circle_app/circle/widgets/vicinity.dart +++ b/circle_app/lib/circle_app/circle/widgets/vicinity.dart @@ -12,6 +12,7 @@ import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:gradient_borders/box_borders/gradient_box_border.dart'; +import 'package:keframe/keframe.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import '../../../commons/Widgets/tag_widget.dart'; @@ -31,8 +32,8 @@ class Vicinity extends StatefulWidget { State createState() => _VicinityState(); } -class _VicinityState extends State with AutomaticKeepAliveClientMixin { - +class _VicinityState extends State + with AutomaticKeepAliveClientMixin { var sub; ScrollController _scrollController = ScrollController(); @@ -47,10 +48,9 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin sub = EventBusManager.on().listen((event) { try { _scrollController.animateTo(0, - duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - } catch (e) { - - } + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut); + } catch (e) {} }); } @@ -67,46 +67,58 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Widget build(BuildContext context) { // TODO: add widget build method - return widget.logic.vicinityList.isNotEmpty ? Stack( - fit: StackFit.expand, - children: [ - SmartRefresher( - controller: widget.logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - controller: _scrollController, - padding: EdgeInsets.all(10.sp), - itemCount:widget.logic.vicinityList.length + 1, - itemBuilder: (context, index) { - if (index == 0) { - return bannerView(widget.logic); - } else { - return ListItem(widget.logic.vicinityList[index - 1], index - 1); - } - }, - ), - ), - // if (widget.logic.myVip == 0) - // Positioned( - // bottom: 0, - // child: showVipView()) - // Positioned(top: 10.sp,left: 10.sp,child: GestureDetector( - // onTap: () { - // Get.toNamed(AppRoutes.WorldCallOut); - // }, - // child: Image.asset( - // getMsgImage('hu_icon'), - // width: 30.sp, - // ), - // ),) - ], - ) : widget.logic.isNearLoad ? loaddingWidget(true) : noResultWidget(tip: '',callBack: () { - widget.logic.isNearLoad = true; - widget.logic.update(); - _onLoading(); - }); + return widget.logic.vicinityList.isNotEmpty + ? Stack( + fit: StackFit.expand, + children: [ + SizeCacheWidget( + child: SmartRefresher( + controller: widget.logic.refreshController, + onRefresh: _onRefresh, + onLoading: _onLoading, + enablePullUp: true, + child: ListView.builder( + controller: _scrollController, + padding: EdgeInsets.all(10.sp), + itemCount: widget.logic.vicinityList.length + 1, + itemBuilder: (context, index) { + if (index == 0) { + return bannerView(widget.logic); + } else { + return FrameSeparateWidget( + index: index, + child: ListItem( + widget.logic.vicinityList[index - 1], + index - 1)); + } + }, + ), + ), + ) + // if (widget.logic.myVip == 0) + // Positioned( + // bottom: 0, + // child: showVipView()) + // Positioned(top: 10.sp,left: 10.sp,child: GestureDetector( + // onTap: () { + // Get.toNamed(AppRoutes.WorldCallOut); + // }, + // child: Image.asset( + // getMsgImage('hu_icon'), + // width: 30.sp, + // ), + // ),) + ], + ) + : widget.logic.isNearLoad + ? loaddingWidget(true) + : noResultWidget( + tip: '', + callBack: () { + widget.logic.isNearLoad = true; + widget.logic.update(); + _onLoading(); + }); } Widget bannerView(CircleLogic controller) { @@ -186,9 +198,9 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.sp), - color: Colors.black.withOpacity(0.87), + color: Colors.black.withOpacity(0.87), ), - margin: EdgeInsets.only(left: 15.sp,right: 15.sp), + margin: EdgeInsets.only(left: 15.sp, right: 15.sp), padding: EdgeInsets.symmetric(vertical: 15.sp, horizontal: 20.sp), child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -279,20 +291,24 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Get.toNamed(Routes.UserInfoPage, arguments: item.id.toString()); } else { if (widget.logic.chargeType == 1) { - if (widget.logic - .myVip > 0) { + if (widget.logic.myVip > 0) { Get.toNamed(Routes.UserInfoPage, arguments: item.id.toString()); } else { - Get.bottomSheet(Scaffold(backgroundColor: Colors.transparent,body: Center( - child: showVipView(), - ),),isScrollControlled: true,backgroundColor: Colors.transparent,barrierColor: Colors.black.withOpacity(0.6)); + Get.bottomSheet( + Scaffold( + backgroundColor: Colors.transparent, + body: Center( + child: showVipView(), + ), + ), + isScrollControlled: true, + backgroundColor: Colors.transparent, + barrierColor: Colors.black.withOpacity(0.6)); } - } else { + } else { Get.toNamed(Routes.UserInfoPage, arguments: item.id.toString()); } } - - }, child: Container( margin: EdgeInsets.only(top: 10.sp), @@ -300,11 +316,11 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin width: Get.width, // height: 210.sp, decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10.sp), + borderRadius: BorderRadius.circular(10.sp), border: GradientBoxBorder( - gradient: - item.vip == 2 ? AppColor.mainVerLinearGradient : AppColor.clearVerLinearGradient, + gradient: item.vip == 2 + ? AppColor.mainVerLinearGradient + : AppColor.clearVerLinearGradient, width: 1.sp, ), ), @@ -319,26 +335,25 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Container( margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp), child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp), - ), - child: Stack( - children: [ - Image( - image: AssetImage(getCircleImage("icon_list_null")), - width: Get.width, - fit: BoxFit.fill, - height: 92.sp, - ), - Container( - height: 92.sp, - width: Get.width, - color: Colors.black.withOpacity(0.25), - ) - ], - ) - ), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.sp), + topRight: Radius.circular(10.sp), + ), + child: Stack( + children: [ + Image( + image: AssetImage(getCircleImage("icon_list_null")), + width: Get.width, + fit: BoxFit.fill, + height: 92.sp, + ), + Container( + height: 92.sp, + width: Get.width, + color: Colors.black.withOpacity(0.25), + ) + ], + )), ), Column(children: [ Container( @@ -399,7 +414,9 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin child: Row( children: [ Text( - item.nickname.length > 5 ? item.nickname.substring(0,5) + '..' : item.nickname, + item.nickname.length > 5 + ? item.nickname.substring(0, 5) + '..' + : item.nickname, style: TextStyle( fontWeight: FontWeight.bold, color: const Color.fromRGBO(247, 250, 250, 1.0), @@ -424,49 +441,58 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Container( // height: 55.sp, // 设置固定高度 width: Get.width, - margin: EdgeInsets.symmetric(vertical: 12.0.sp,horizontal: 9.sp), + margin: + EdgeInsets.symmetric(vertical: 12.0.sp, horizontal: 9.sp), child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: RichText( - overflow: TextOverflow.ellipsis, - maxLines: 2, - text: TextSpan( - children: [ - WidgetSpan( - alignment: ui.PlaceholderAlignment.middle, - // alignment: Rect.fromCenter(center: center, width: width, height: height), - child: Container( - margin: EdgeInsets.only(right: 2.sp,), - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - height: 20.sp, - width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: AppColor.cityBgColor, - ), - child: Text( - item.city!, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), + alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 + child: RichText( + overflow: TextOverflow.ellipsis, + maxLines: 2, + text: TextSpan( + children: [ + WidgetSpan( + alignment: ui.PlaceholderAlignment.middle, + // alignment: Rect.fromCenter(center: center, width: width, height: height), + child: Container( + margin: EdgeInsets.only( + right: 2.sp, + ), + padding: + EdgeInsets.only(left: 4.sp, right: 4.sp), + height: 20.sp, + width: item.city!.length > 4 + ? 70.sp + : item.city!.contains('km') + ? item.city!.length * 13.sp + : item.city!.length * 20.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(22), + color: AppColor.cityBgColor, + ), + child: Text( + item.city!, + style: TextStyle( + color: Colors.white, + fontSize: 11.sp, + fontWeight: FontWeight.w600), + ), ), ), - ), - TextSpan( - text: item.signature!, - // overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp,)), - ], - ), - ) - ), + TextSpan( + text: item.signature!, + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + )), + ], + ), + )), ), Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp,bottom: 5.sp), + margin: + EdgeInsets.only(left: 8.sp, right: 3.sp, bottom: 5.sp), child: _buildInterestsListView(item.interests)) ]), ], @@ -488,7 +514,7 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin Widget _buildInfoRow(VicinityItemBean item) { String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); + getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); return Row( children: [ Container( @@ -496,8 +522,8 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin borderRadius: BorderRadius.circular(17), gradient: const LinearGradient( colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), + Color.fromRGBO(141, 255, 248, 1), + Color.fromRGBO(181, 211, 255, 1), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -541,8 +567,7 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.0), border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, + gradient: AppColor.mainVerLinearGradient, width: 0.5.sp, ), color: const Color(0xFF392D53), @@ -581,10 +606,11 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin } void _onLoading() async { - if (widget.logic.vicinityPage == 2 && maxOff == 0) { + if (widget.logic.vicinityPage == 2 && + maxOff == 0 && + widget.logic.lists.isNotEmpty) { maxOff = _scrollController.offset - 170.sp; } - widget.logic.getNearByList(); + widget.logic.getNearByList(); } - } 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 1c90ec1..d088aa2 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 @@ -1719,7 +1719,7 @@ class _RightCircleListWidgetState extends State crossAxisCount: 3, //横轴三个子widget crossAxisSpacing: 8.sp, mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget + childAspectRatio: 0.6 //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -1738,6 +1738,7 @@ class _RightCircleListWidgetState extends State borderRadius: BorderRadius.circular(6.sp), child: CachedImg( imageUrl: album.url!, + fit: BoxFit.cover, ), ), ); @@ -1824,6 +1825,7 @@ class _RightCircleListWidgetState extends State ); double picHeight = 0.0; + double ratio = 0; double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp)) / 3 + @@ -1831,7 +1833,7 @@ 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; if (info.type == 1) { if (lists.album!.length > 3) { picHeight = picWidth * 2; @@ -2056,9 +2058,9 @@ class _RightCircleListWidgetState extends State gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget + crossAxisSpacing: 4.sp, + mainAxisSpacing: 4.sp, + childAspectRatio: ratio //宽高比为1时,子widget ), itemBuilder: (contentxt, currentIndex) { Album album = lists.album![currentIndex]; @@ -2079,6 +2081,7 @@ class _RightCircleListWidgetState extends State BorderRadius.circular(6.sp), child: CachedImg( imageUrl: album.url!, + fit: BoxFit.cover, ), ), ); diff --git a/circle_app/lib/circle_app/dialog/ScreenBottomSheetDialog.dart b/circle_app/lib/circle_app/dialog/ScreenBottomSheetDialog.dart index cb75b8e..246598f 100644 --- a/circle_app/lib/circle_app/dialog/ScreenBottomSheetDialog.dart +++ b/circle_app/lib/circle_app/dialog/ScreenBottomSheetDialog.dart @@ -174,9 +174,38 @@ class _ScreenBottomSheetDialogState extends State { return GestureDetector( onTap: () { + if (index == 0) { + if (widget.genderList[0].isSelect) { + widget.genderList.forEach((element) { + print(element.name); + element.isSelect = false; + }); + } else { + widget.genderList.forEach((element) { + element.isSelect = true; + }); + } + + } else { + if (widget.genderList[index].isSelect) { + widget.genderList[index].isSelect = false; + widget.genderList[0].isSelect = false; + + } else { + widget.genderList[index].isSelect = true; + bool istrue = true; + widget.genderList.asMap().forEach((index,element) { + if(index!=0&&!element.isSelect) { + // print(element.isSelect); + istrue = false; + } + }); + widget.genderList[0].isSelect = istrue; + + } + } + setState(() { - widget.genderList[index].isSelect = - !widget.genderList[index].isSelect; }); }, child: Container( @@ -260,9 +289,39 @@ class _ScreenBottomSheetDialogState extends State { showRechargeDialog(); return; } + if (index == 0) { + if (widget.roleList[0].isSelect) { + widget.roleList.forEach((element) { + print(element.name); + element.isSelect = false; + }); + } else { + widget.roleList.forEach((element) { + element.isSelect = true; + }); + } + + } else { + if (widget.roleList[index].isSelect) { + widget.roleList[index].isSelect = false; + widget.roleList[0].isSelect = false; + + } else { + widget.roleList[index].isSelect = true; + bool istrue = true; + widget.roleList.asMap().forEach((index,element) { + if(index!=0&&!element.isSelect) { + // print(element.isSelect); + istrue = false; + } + }); + widget.roleList[0].isSelect = istrue; + + } + } setState(() { - widget.roleList[index].isSelect = - !widget.roleList[index].isSelect; + // widget.roleList[index].isSelect = + // !widget.roleList[index].isSelect; }); }, child: Container( @@ -355,9 +414,40 @@ class _ScreenBottomSheetDialogState extends State { showRechargeDialog(isYear: true); return; } + + if (index == 0) { + if (widget.orientationList[0].isSelect) { + widget.orientationList.forEach((element) { + print(element.name); + element.isSelect = false; + }); + } else { + widget.orientationList.forEach((element) { + element.isSelect = true; + }); + } + + } else { + if (widget.orientationList[index].isSelect) { + widget.orientationList[index].isSelect = false; + widget.orientationList[0].isSelect = false; + + } else { + widget.orientationList[index].isSelect = true; + bool istrue = true; + widget.orientationList.asMap().forEach((index,element) { + if(index!=0&&!element.isSelect) { + // print(element.isSelect); + istrue = false; + } + }); + widget.orientationList[0].isSelect = istrue; + + } + } setState(() { - widget.orientationList[index].isSelect = - !widget.orientationList[index].isSelect; + // widget.orientationList[index].isSelect = + // !widget.orientationList[index].isSelect; }); }, child: Container( diff --git a/circle_app/lib/circle_app/dialog/UpdateDialog.dart b/circle_app/lib/circle_app/dialog/UpdateDialog.dart index 72c863b..c8918dc 100644 --- a/circle_app/lib/circle_app/dialog/UpdateDialog.dart +++ b/circle_app/lib/circle_app/dialog/UpdateDialog.dart @@ -2,7 +2,8 @@ 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'; @@ -24,7 +25,7 @@ double myProgress = 0; class _CustomDialogState extends State { bool isDownload = false; bool isShowWeb = false; - + var filePath; void incrementCounter() {} void setDownloadUi() { @@ -114,14 +115,47 @@ class _CustomDialogState extends State { }, child: Column( children: [ - Container( - margin: EdgeInsets.only(top: 10.sp), + myProgress >= 1.0 ? GestureDetector( + onTap: () { + installApk(); + }, + child: Container( + width: 200.sp, + margin: EdgeInsets.only(top: 12.sp, bottom: 12.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: Center( + child: Text( + "立即安装", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ), + ) : Container( + margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), child: CircularProgressIndicator( value: myProgress, backgroundColor: Colors.grey, valueColor: - const AlwaysStoppedAnimation( - Color(0xFF30FFD9)), + const AlwaysStoppedAnimation( + Color(0xFF30FFD9)), strokeWidth: 4.0.sp, ), ), @@ -165,7 +199,8 @@ class _CustomDialogState extends State { throw 'Could not open App Store.'; } } else { - final String appStoreUrl = widget + final String appStoreUrl + = widget .updateInfo.downloadUrl; // App Store链接示例 if (appStoreUrl.contains("apk")) { @@ -245,8 +280,8 @@ class _CustomDialogState extends State { updataApk(String downloadUrl) async { //SmartDialog.showLoading(); - var filePath = await getApplicationSupportDirectoryPath(); - filePath = filePath + "leyuan.apk"; + var path = await getApplicationSupportDirectoryPath(); + filePath = path + "leyuan.apk"; DioManager.instance.setReceiveTimeout(300); var data = await DioManager.instance .download(downloadUrl, filePath, (received, total) { @@ -262,8 +297,12 @@ class _CustomDialogState extends State { print(error); }); DioManager.instance.setReceiveTimeout(30); - // flutter_install_app - await AppInstaller.installApk(filePath, actionRequired: false); + installApk(); + } + + installApk() async { + //flutter_install_app + // await AppInstaller.installApk(filePath, actionRequired: false); } } diff --git a/circle_app/lib/circle_app/help/view.dart b/circle_app/lib/circle_app/help/view.dart index 32b6533..fb097a0 100644 --- a/circle_app/lib/circle_app/help/view.dart +++ b/circle_app/lib/circle_app/help/view.dart @@ -225,7 +225,7 @@ class HelpPage extends StatelessWidget { // logic.userInfoBean!.nickname); }, icon: Image.asset( - getMineImage("im_service"), + getMineImage("service_icon"), width: 14.sp, height: 14.sp, ), diff --git a/circle_app/lib/circle_app/home/logic.dart b/circle_app/lib/circle_app/home/logic.dart index 8894a21..405f9e3 100644 --- a/circle_app/lib/circle_app/home/logic.dart +++ b/circle_app/lib/circle_app/home/logic.dart @@ -229,25 +229,30 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { pushChatPage(content['id'].toString(), content['imId'], content['nickname']); }); - } else if (int.parse(event) == 3) {//喜欢列表刷新 + } else if (int.parse(event) == 3) { + //喜欢列表刷新 showOKToast(message.customElem!.desc!.toString()); EventBusManager.fire(LikeRefresh()); - } else if (int.parse(event) == 5) {//有人送礼会话置顶 + } else if (int.parse(event) == 5) { + //有人送礼会话置顶 // print(jsonData.toString()); var info = jsonDecode(jsonData['content']); TencentImSDKPlugin.v2TIMManager.v2ConversationManager .pinConversation( conversationID: 'c2c_' + info['fromImId'], isPinned: info['top'] == 1); - } else if (int.parse(event) == 9) {//有新人加入 + } else if (int.parse(event) == 9) { + //有新人加入 CircleLogic logic = Get.find(); logic.isNewPeopleRed = true; logic.update(); - } else if (int.parse(event) == 8) {//有新的喊话 + } else if (int.parse(event) == 8) { + //有新的喊话 World_call_outLogic logic = Get.find(); logic.isNewMsg = true; logic.update(); - } else if (int.parse(event) == 10) {//有新访客 + } else if (int.parse(event) == 10) { + //有新访客 MsgLogic logic = Get.find(); logic.getMode(); } @@ -370,7 +375,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { BuildContext context, bool isDismiss, UpdateInfo updateInfo) { showDialog( context: context, - barrierDismissible: isDismiss, + barrierDismissible: false, builder: (BuildContext context) { return UpdateDialog( isDismiss: isDismiss, @@ -388,7 +393,9 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { data['data']['account_id'].toString(), data['data']['user_sig']); accountId = data['data']['account_id'].toString(); } else { - getIMData(); + if (Get.currentRoute != Routes.Login) { + getIMData(); + } } } } @@ -499,7 +506,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } } - loadMyInfoData() async { + loadMyInfoData() async { var data = await DioManager.instance.get(url: Api.getUserMine); var bean = BaseResponse.fromJson( data, (data) => MineResponseBean.fromJson(data)); @@ -549,17 +556,30 @@ class HomeLogic extends GetxController with WidgetsBindingObserver { } void awaitShowTodayDialog() { - - Future.delayed(Duration(seconds: 60), () async { + Future.delayed(Duration(seconds: 60), () async { SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); if (await sp.isFirstAutoMatch()) { - Get.bottomSheet( - TodayPeopleDialog(isShow: false,urlStr:Api.dayOnline), - isScrollControlled: true, - enableDrag: false, + var data = await DioManager.instance.get( + url: Api.dayOnline, ); - } + if (data['code'] == 200) { + SharedPreferencesHelper sp = + await SharedPreferencesHelper.getInstance(); + List dataList = data['data']; + if (dataList.isNotEmpty) { + var recommendCircleFriendData = data['data'][0]; + Get.bottomSheet( + TodayPeopleDialog( + isShow: false, + url: Api.dayOnline, + recommendCircleFriendData: recommendCircleFriendData), + isScrollControlled: true, + enableDrag: false, + ); + } + } + } }); } } diff --git a/circle_app/lib/circle_app/invite/logic.dart b/circle_app/lib/circle_app/invite/logic.dart index e7dd8cb..1861885 100644 --- a/circle_app/lib/circle_app/invite/logic.dart +++ b/circle_app/lib/circle_app/invite/logic.dart @@ -1,5 +1,6 @@ import 'package:circle_app/net/api.dart'; import 'package:circle_app/net/dio_manager.dart'; +import 'package:circle_app/utils/SharedPreferencesHelper.dart'; import 'package:circle_app/utils/util.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; @@ -31,6 +32,8 @@ class InviteLogic extends GetxController { bool isContentScroll = false; + bool isIventData = false; + @override void dispose() { // TODO: implement dispose @@ -68,7 +71,7 @@ class InviteLogic extends GetxController { } } }); - + loadStatus(); loadData(); loadMyInviteData(); loadAllInviteData(); @@ -123,6 +126,13 @@ class InviteLogic extends GetxController { showOKToast(recorddata['msg']); } } + + void loadStatus() async { + SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); + String phone = sp.getString(SharedPreferencesHelper.LOGINPHONE); + isIventData = phone != '18800000100'; + update(); + } } diff --git a/circle_app/lib/circle_app/invite/view.dart b/circle_app/lib/circle_app/invite/view.dart index bdef585..f1a5720 100644 --- a/circle_app/lib/circle_app/invite/view.dart +++ b/circle_app/lib/circle_app/invite/view.dart @@ -23,9 +23,6 @@ class InvitePage extends StatelessWidget { final logic = Get.find(); final state = Get.find().state; - - - @override Widget build(BuildContext context) { return Container( @@ -39,19 +36,27 @@ class InvitePage extends StatelessWidget { backgroundColor: Colors.transparent, appBar: MyAppBar( centerTitle: "邀请赚钱", - actionWdiget: Container( - alignment: Alignment.center, - height: 22.sp, - width: 62.sp, - child: Image.asset( - getMineImage('invite_right_icon'), - width: 62.sp, - fit: BoxFit.fill, - ), + actionWdiget: GetBuilder( + builder: (logic) { + return !logic.isIventData + ? Container() + : GestureDetector( + onTap: () { + navigateToInviteStrategy(); + }, + child: Container( + alignment: Alignment.center, + height: 22.sp, + width: 62.sp, + child: Image.asset( + getMineImage('invite_right_icon'), + width: 62.sp, + fit: BoxFit.fill, + ), + ), + ); + }, ), - onPressed: () { - navigateToInviteStrategy(); - }, ), body: GetBuilder(builder: (logic) { List peopleCountList = []; @@ -110,540 +115,596 @@ class InvitePage extends StatelessWidget { fit: StackFit.expand, children: [ SingleChildScrollView( - controller: logic.scrollController, + controller: logic.scrollController, child: Column(children: [ - Container( - // height: 83.sp, - margin: EdgeInsets.only( - left: 20.sp, right: 20.sp, top: 0.sp), - decoration: BoxDecoration( - color: Color(0xFF4C3E5F).withOpacity(0.25), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: BorderRadius.circular(10.sp)), - child: Column( - children: [ - Container( - padding: EdgeInsets.only( - left: 14.sp, right: 14.sp, top: 10.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '专属邀请码', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - if (logic.homeData!.superior == null) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showCodePicker(logic); - }, - child: Container( - alignment: Alignment.center, - width: 84.sp, - child: Image.asset( - getMineImage('add_code_icon')), + Container( + // height: 83.sp, + margin: EdgeInsets.only( + left: 20.sp, right: 20.sp, top: 0.sp), + decoration: BoxDecoration( + color: Color(0xFF4C3E5F).withOpacity(0.25), + border: GradientBoxBorder( + gradient: AppColor.mainVerLinearGradient, + width: 1.sp, + ), + borderRadius: BorderRadius.circular(10.sp)), + child: Column( + children: [ + Container( + padding: EdgeInsets.only( + left: 14.sp, + right: 14.sp, + top: 10.sp), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '专属邀请码', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w500), ), - ), - if (logic.homeData!.superior != null) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(Routes.UserInfoPage,arguments: logic.homeData!.superior!.id!.toString()); - }, - child: Container( - alignment: Alignment.center, - child: Row( - children: [ - Text('邀请人:',style: TextStyle(color: Colors.white,fontSize: 14.sp),), - Text( - '${logic.homeData!.superior!.nickname!}', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ], + if (logic.homeData!.superior == null) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + showCodePicker(logic); + }, + child: Container( + alignment: Alignment.center, + width: 84.sp, + child: Image.asset(getMineImage( + 'add_code_icon')), + ), ), + if (logic.homeData!.superior != null) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Get.toNamed(Routes.UserInfoPage, + arguments: logic + .homeData!.superior!.id! + .toString()); + }, + child: Container( + alignment: Alignment.center, + child: Row( + children: [ + Text( + '邀请人:', + style: TextStyle( + color: Colors.white, + fontSize: 14.sp), + ), + Text( + '${logic.homeData!.superior!.nickname!}', + style: TextStyle( + color: AppColor + .mainColor, + fontSize: 14.sp), + ), + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 0.sp), + child: Row( + children: [ + SizedBox( + width: 14.sp, ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 0.sp), - child: Row( - children: [ - SizedBox( - width: 14.sp, - ), - Text( - logic.homeData!.inviteCode! ?? '', - style: TextStyle( - fontSize: 30.sp, - fontWeight: FontWeight.w600, - color: Color(0xffF657FF)), - ), - SizedBox( - width: 4.sp, - ), - GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: logic.homeData! - .inviteCode! ?? - '')); - showOKToast('复制成功'); - }, - child: Text( - '复制', + Text( + logic.homeData!.inviteCode! ?? '', style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 14.sp), - )), - Expanded(child: Container()) - ], - ), - ), - ], - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.only( - left: 20.sp, right: 20.sp, top: 10.sp), - decoration: BoxDecoration( - color: Color(0xFF4C3E5F).withOpacity(0.25), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: BorderRadius.circular(10.sp), - ), - child: Swiper( - physics: NeverScrollableScrollPhysics(), - autoplay: true, - // controller: 5, - index: 0, - itemBuilder: (BuildContext context, int index) { - Map data = logic.sysData[index]; - return Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - data['inviter_name'], - style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 16.sp, - fontWeight: FontWeight.w500), + fontSize: 30.sp, + fontWeight: FontWeight.w600, + color: Color(0xffF657FF)), + ), + SizedBox( + width: 4.sp, + ), + GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData( + text: logic.homeData! + .inviteCode! ?? + '')); + showOKToast('复制成功'); + }, + child: Text( + '复制', + style: TextStyle( + color: Color(0xff0DF5F7), + fontSize: 14.sp), + )), + Expanded(child: Container()) + ], ), - Container( - margin: EdgeInsets.only( - left: 5.sp, right: 5.sp), - child: Text( - '邀请', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - )), - Text( - data['invitee_name'] ?? '', - style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '加入微乐园', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - )), - ], - ), - ); - }, - itemCount: logic.sysData.length, - ), - ), - Container( - height: 220.sp, - width: Get.width - 30.sp, - margin: EdgeInsets.only(top: 10.sp), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 10.sp, - right: 10.sp), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - getMineImage("invite_count_bg")), - fit: BoxFit.fill, + ), + ], ), ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - top: 15.sp, left: 35.sp, right: 35.sp), - alignment: Alignment.center, - child: Image.asset( - getMineImage('invite_title'), - height: 22.sp, - ), + Container( + height: 40.sp, + margin: EdgeInsets.only( + left: 20.sp, right: 20.sp, top: 10.sp), + decoration: BoxDecoration( + color: Color(0xFF4C3E5F).withOpacity(0.25), + border: GradientBoxBorder( + gradient: AppColor.mainVerLinearGradient, + width: 1.sp, ), - Container( - margin: EdgeInsets.only(top: 15.sp), - alignment: Alignment.center, - child: Image.asset( - getMineImage('invite_line'), - height: 1.2.sp, - ), - ), - Container( - height: 70.sp, - margin: EdgeInsets.only( - left: 15.sp, right: 15.sp), + borderRadius: BorderRadius.circular(10.sp), + ), + child: Swiper( + physics: NeverScrollableScrollPhysics(), + autoplay: true, + // controller: 5, + index: 0, + itemBuilder: + (BuildContext context, int index) { + Map data = logic.sysData[index]; + return Container( child: Row( + mainAxisAlignment: + MainAxisAlignment.center, children: [ Text( - '邀请人数', + data['inviter_name'], style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 14.sp, + color: Color(0xff0DF5F7), + fontSize: 16.sp, fontWeight: FontWeight.w500), ), - Expanded( - child: Stack( - // fit: StackFit.expand, - alignment: Alignment.center, - children: [ - Container( - margin: EdgeInsets.only( - left: 61.sp, right: 46.sp), - height: 2.sp, - color: Color(0xFF0DF5F7), - ), - Container( - margin: EdgeInsets.only( - left: 15.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: peopleCountList, - ), - ) - ], - )) - ], - )), - Container( - height: 20.sp, - margin: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Row( - children: [ + Container( + margin: EdgeInsets.only( + left: 5.sp, right: 5.sp), + child: Text( + '邀请', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: + FontWeight.w500), + )), Text( - '会员时长', + data['invitee_name'] ?? '', style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 14.sp, + color: Color(0xff0DF5F7), + fontSize: 16.sp, fontWeight: FontWeight.w500), ), - Expanded( - child: Stack( - // fit: StackFit.expand, - alignment: Alignment.center, - children: [ - Container( - margin: EdgeInsets.only( - left: 25.sp, right: 15.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: dayCountList), - ) - ], - )), + Container( + margin: + EdgeInsets.only(left: 5.sp), + child: Text( + '加入微乐园', + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: + FontWeight.w500), + )), ], - )), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only( - left: 15.sp, - right: 15.sp, - bottom: 10.sp), - child: RichText( - text: TextSpan(children: allSpan))) - ], - )), - Container( - margin: EdgeInsets.only( - top: 15.sp, - left: 15.sp, - right: 15.sp, - bottom: MediaQuery.of(context).padding.bottom + 10.sp + 50.sp), - height: 565.sp, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - getMineImage("invite_count_bg")), - fit: BoxFit.fill)), - child: Column( - children: [ + ), + ); + }, + itemCount: logic.sysData.length, + ), + ), + if (logic.isIventData) Container( - margin: EdgeInsets.only(top: 45.sp), - // height: 40.sp, - child: Row( + height: 220.sp, + width: Get.width - 30.sp, + margin: EdgeInsets.only(top: 10.sp), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 10.sp, + right: 10.sp), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + getMineImage("invite_count_bg")), + fit: BoxFit.fill, + ), + ), + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + top: 15.sp, + left: 35.sp, + right: 35.sp), + alignment: Alignment.center, + child: Image.asset( + getMineImage('invite_title'), + height: 22.sp, + ), + ), + Container( + margin: EdgeInsets.only(top: 15.sp), + alignment: Alignment.center, + child: Image.asset( + getMineImage('invite_line'), + height: 1.2.sp, + ), + ), + Container( + height: 70.sp, + margin: EdgeInsets.only( + left: 15.sp, right: 15.sp), + child: Row( + children: [ + Text( + '邀请人数', + style: TextStyle( + color: Color(0xFF0DF5F7), + fontSize: 14.sp, + fontWeight: + FontWeight.w500), + ), + Expanded( + child: Stack( + // fit: StackFit.expand, + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only( + left: 61.sp, + right: 46.sp), + height: 2.sp, + color: Color(0xFF0DF5F7), + ), + Container( + margin: EdgeInsets.only( + left: 15.sp), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: + peopleCountList, + ), + ) + ], + )) + ], + )), + Container( + height: 20.sp, + margin: EdgeInsets.only( + left: 15.sp, right: 15.sp), + child: Row( + children: [ + Text( + '会员时长', + style: TextStyle( + color: Color(0xFF0DF5F7), + fontSize: 14.sp, + fontWeight: + FontWeight.w500), + ), + Expanded( + child: Stack( + // fit: StackFit.expand, + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only( + left: 25.sp, + right: 15.sp), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: + dayCountList), + ) + ], + )), + ], + )), + Expanded(child: Container()), + Container( + margin: EdgeInsets.only( + left: 15.sp, + right: 15.sp, + bottom: 10.sp), + child: RichText( + text: TextSpan( + children: allSpan))) + ], + )), + if (logic.isIventData) + Container( + margin: EdgeInsets.only( + top: 15.sp, + left: 15.sp, + right: 15.sp, + bottom: MediaQuery.of(context) + .padding + .bottom + + 10.sp + + 50.sp), + height: 565.sp, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + getMineImage("invite_count_bg")), + fit: BoxFit.fill)), + child: Column( children: [ - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.homeData!.inviteCount! ?? 0}人', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '已成功邀请', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.homeData!.achieveRewardDay! ?? 0}天', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), + margin: EdgeInsets.only(top: 45.sp), + // height: 40.sp, + child: Row( + children: [ + Expanded( + child: Container( + child: Column( + children: [ + Container( + child: Text( + '${logic.homeData!.inviteCount! ?? 0}人', + style: TextStyle( + color: AppColor + .mainColor, + fontSize: 14.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 10.sp), + child: Text( + '已成功邀请', + style: TextStyle( + color: Color( + 0xFFF7FAFA), + fontSize: 12.sp), + ), + ), + ], ), ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '获得会员时长', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), + ), + Container( + width: 1, + height: 47.sp, + color: Color(0x3AF0F1F4), + ), + Expanded( + child: Container( + child: Column( + children: [ + Container( + child: Text( + '${logic.homeData!.achieveRewardDay! ?? 0}天', + style: TextStyle( + color: AppColor + .mainColor, + fontSize: 14.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 10.sp), + child: Text( + '获得会员时长', + style: TextStyle( + color: Color( + 0xFFF7FAFA), + fontSize: 12.sp), + ), + ), + ], ), ), - ], - ), + ), + Container( + width: 1, + height: 47.sp, + color: Color(0x3AF0F1F4), + ), + Expanded( + child: Container( + child: Column( + children: [ + Container( + child: Text( + '${logic.directProfit! ?? 0}票', + style: TextStyle( + color: AppColor + .mainColor, + fontSize: 14.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 10.sp), + child: Text( + '直接获利', + style: TextStyle( + color: Color( + 0xFFF7FAFA), + fontSize: 12.sp), + ), + ), + ], + ), + ), + ), + Container( + width: 1, + height: 47.sp, + color: Color(0x3AF0F1F4), + ), + Expanded( + child: Container( + child: Column( + children: [ + Container( + child: Text( + '${logic.rebate! ?? 0}票', + style: TextStyle( + color: AppColor + .mainColor, + fontSize: 14.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 10.sp), + child: Text( + '间接返利', + style: TextStyle( + color: Color( + 0xFFF7FAFA), + fontSize: 12.sp), + ), + ), + ], + ), + ), + ), + ], ), ), - Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), + buildSegment(), + // Container( + // margin: EdgeInsets.only(top: 21.sp), + // child: Image.asset(getMineImage('icon_yaoqingjilujifenhong'))), Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.directProfit! ?? 0}票', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '直接获利', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], + child: Container( + margin: EdgeInsets.only( + top: 15.sp, + left: 20.sp, + right: 20.sp, + bottom: + logic.selectedIndex == 1 + ? 15.sp + : 0.sp), + // height: 135.sp, + decoration: BoxDecoration( + color: Color(0x99363542), + borderRadius: + BorderRadiusDirectional + .circular(4.sp), + border: Border.all( + color: Color(0x99363542), + width: 1.sp)), + child: + logic.selectedIndex == 0 && + logic.inveiteData + .isEmpty + ? noResultWidget() + : logic.selectedIndex == + 1 && + logic + .allInveiteData + .isEmpty + ? noResultWidget() + : MediaQuery + .removePadding( + removeTop: true, + context: context, + child: ListView + .builder( + controller: + logic + .contentScrollController, + physics: logic + .isContentScroll + ? BouncingScrollPhysics() + : NeverScrollableScrollPhysics(), + itemBuilder: (BuildContext + context, + int + index) { + if (logic.selectedIndex == + 0) { + if (index == + 0) { + return myTitileWidget(); + } + var data = + logic.inveiteData[index - 1]; + return myRowWidget( + data['nickName'], + data['inviteTime'], + '${data['sysProfit']}票', + '${data['rebate'] > 0 ? data['rebate'] : 0}票(${data['rebateRate']}%)', + data['userId'].toString()); + } + + if (index == + 0) { + return titileWidget(); + } else if (logic.allInveiteData.length + + 1 == + index) { + return Container( + margin: EdgeInsets.only( + top: 4.sp, + left: 5.sp, + right: 5.sp), + child: + Text( + '温馨提示:仅展示前${logic.allInveiteData.length}名,上榜的推广大使还能获得微乐园APP官方定制的精美礼品一份哦~', + style: TextStyle(color: Colors.white.withOpacity(0.75), fontSize: 13.sp), + ), + ); + } + var data = + logic.allInveiteData[index - + 1]; + return rowWidget( + data[ + 'nickname'], + data['inviteCount'] + .toString(), + data['vipDaysStr'].toString() + + '天', + '${data['directProfitStr']}票', + '${data['rebateStr']}票', + data['userId'].toString()); + }, + itemCount: logic.selectedIndex == + 0 + ? logic.inveiteData!.length + + 1 + : logic.allInveiteData.length + + 2), + ))), + if (logic.selectedIndex == 0) + GestureDetector( + onTap: () { + Get.toNamed(Routes.InviteRecordPage, + arguments: 0); + }, + child: Container( + margin: EdgeInsets.only( + top: 5.sp, bottom: 15.sp), + child: Text( + '查看更多邀请记录>', + style: TextStyle( + color: AppColor.mainColor + .withOpacity(0.75), + fontSize: 12.sp, + fontWeight: FontWeight.w500), + ), ), - ), - ), - Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.rebate! ?? 0}票', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '间接返利', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), + ) ], ), ), - buildSegment(), - // Container( - // margin: EdgeInsets.only(top: 21.sp), - // child: Image.asset(getMineImage('icon_yaoqingjilujifenhong'))), - Expanded( - child: Container( - margin: EdgeInsets.only( - top: 15.sp, left: 20.sp, right: 20.sp,bottom: logic.selectedIndex == 1 ? 15.sp : 0.sp), - // height: 135.sp, - decoration: BoxDecoration( - color: Color(0x99363542), - borderRadius: - BorderRadiusDirectional.circular( - 4.sp), - border: Border.all( - color: Color(0x99363542), - width: 1.sp)), - child: logic.selectedIndex == 0 && - logic.inveiteData.isEmpty - ? noResultWidget() - : logic.selectedIndex == 1 && - logic.allInveiteData.isEmpty - ? noResultWidget() - : MediaQuery.removePadding( - removeTop:true, - context:context, - child:ListView.builder( - controller: logic.contentScrollController, - physics: logic.isContentScroll ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), - itemBuilder: - (BuildContext context, - int index) { - if (logic.selectedIndex == 0) { - if (index == 0) { - return myTitileWidget(); - } - var data = logic - .inveiteData[index - 1]; - return myRowWidget( - data['nickName'], - data['inviteTime'], - '${data['sysProfit']}票', - '${data['rebate'] > 0 ? data['rebate'] : 0}票(${data['rebateRate']}%)', - data['userId'] - .toString()); - } - - if (index == 0) { - return titileWidget(); - } else if (logic.allInveiteData - .length + - 1 == - index) { - return Container( - margin: EdgeInsets.only( - top: 4.sp, - left: 5.sp, - right: 5.sp), - child: Text( - '温馨提示:仅展示前${logic.allInveiteData.length}名,上榜的推广大使还能获得微乐园APP官方定制的精美礼品一份哦~', - style: TextStyle( - color: Colors.white - .withOpacity( - 0.75), - fontSize: 13.sp), - ), - ); - } - var data = logic - .allInveiteData[index - 1]; - return rowWidget( - data['nickname'], - data['inviteCount'] - .toString(), - data['vipDaysStr'].toString() + - '天', - '${data['directProfitStr']}票', - '${data['rebateStr']}票', - data['userId'].toString()); - }, - itemCount: logic.selectedIndex == - 0 - ? logic.inveiteData!.length + - 1 - : logic.allInveiteData - .length + - 2 - ), - ))), - if (logic.selectedIndex == 0) - GestureDetector( - onTap: () { - Get.toNamed(Routes.InviteRecordPage, - arguments: 0); - }, - child: Container( - margin: EdgeInsets.only( - top: 5.sp,bottom: 15.sp), - child: Text( - '查看更多邀请记录>', - style: TextStyle( - color: AppColor.mainColor - .withOpacity(0.75), - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - ) - ], - ), - ), - ])), + ])), Positioned( bottom: 10.sp, left: 30.sp, @@ -865,8 +926,7 @@ class InvitePage extends StatelessWidget { Expanded( child: GestureDetector( onTap: () { - Get.toNamed(Routes.UserInfoPage, - arguments: userId); + Get.toNamed(Routes.UserInfoPage, arguments: userId); }, child: infoText(str1, AppColor.mainColor)), flex: 1, @@ -930,8 +990,7 @@ class InvitePage extends StatelessWidget { onTap: () { if (userId == '0') return; - Get.toNamed(Routes.UserInfoPage, - arguments: userId); + Get.toNamed(Routes.UserInfoPage, arguments: userId); }, child: infoText(str1, AppColor.mainColor)), ), diff --git a/circle_app/lib/circle_app/minefragment/view.dart b/circle_app/lib/circle_app/minefragment/view.dart index a5cfabb..5484913 100644 --- a/circle_app/lib/circle_app/minefragment/view.dart +++ b/circle_app/lib/circle_app/minefragment/view.dart @@ -398,7 +398,11 @@ class _MinefragmentPageState extends State with RouteAware { behavior: HitTestBehavior.opaque, onTap: () { - showTipPop(); + if (Platform.isAndroid) { + showTipPop(); + } else { + launch('https://apps.apple.com/cn/app/%E5%BE%AE%E4%B9%90%E5%9B%AD-%E4%BA%9A%E6%96%87%E5%8C%96%E5%A4%9A%E5%85%83%E4%BA%A4%E5%8F%8B%E5%9F%BA%E5%9C%B0/id6459449499', forceSafariVC: false); + } }, child: Container( margin: EdgeInsets.only(top: 18.sp), @@ -413,17 +417,15 @@ class _MinefragmentPageState extends State with RouteAware { height: 24.sp, ), SizedBox(width: 10.sp), - const Text( "给个5星好评", style: TextStyle(color: Colors.white), ), - ], ), Row( children: [ - Container( + !Platform.isAndroid ? Container() : Container( width: 10.sp, height: 10.sp, margin: EdgeInsets.only(right: 4.sp), @@ -431,8 +433,8 @@ class _MinefragmentPageState extends State with RouteAware { color: Colors.red, shape: BoxShape.circle), ), - const Text( - "免费领3天会员", + Text( + !Platform.isAndroid ? '感谢您对我们的支持🙏' : "免费领3天会员", style: TextStyle(color: Colors.white60), ), Image( 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 b9b1176..09b39f9 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 @@ -1065,6 +1065,7 @@ class _TIMConversationState extends TIMUIKitState { onTap: () async { if (!chatImIdList.contains( user.userId.toString())) { + await createCustomMsg(user.userId.toString(), recommendCircleFriendData['user']['imId']); } @@ -1179,7 +1180,66 @@ class _TIMConversationState extends TIMUIKitState { ], ), ), - + if (info.containsKey('desc1')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc1'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('desc2')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc2'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), Container( margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), alignment: Alignment.centerLeft, @@ -1327,6 +1387,7 @@ class _TIMConversationState extends TIMUIKitState { List dataList = data['data']; if (dataList.isNotEmpty) { recommendCircleFriendData = data['data'][0]; + recommendCircleFriendData['tags'] = data['tags']; setState(() {}); } } else { diff --git a/circle_app/lib/circle_app/msg/recommend_circle_friend_item.dart b/circle_app/lib/circle_app/msg/recommend_circle_friend_item.dart index e04f530..82e6b95 100644 --- a/circle_app/lib/circle_app/msg/recommend_circle_friend_item.dart +++ b/circle_app/lib/circle_app/msg/recommend_circle_friend_item.dart @@ -441,6 +441,66 @@ class _RecommendCircleFriendItemState extends State { ], ), ), + if (info.containsKey('desc1')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc1'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('desc2')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc2'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), Container( margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), alignment: Alignment.centerLeft, diff --git a/circle_app/lib/circle_app/msg/view.dart b/circle_app/lib/circle_app/msg/view.dart index eba247f..049204d 100644 --- a/circle_app/lib/circle_app/msg/view.dart +++ b/circle_app/lib/circle_app/msg/view.dart @@ -30,8 +30,8 @@ class MsgPage extends StatefulWidget { } class _MsgPageState extends State with AutomaticKeepAliveClientMixin { - // final ctr = Get.put(MsgLogic()); - final ctr = Get.find(); + final ctr = Get.put(MsgLogic()); + // final controller = Get.find(); var logic = Get.find(); void getPipeiData() async { var data = await DioManager.instance @@ -69,30 +69,35 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { resizeToAvoidBottomInset: false, backgroundColor: Colors.transparent, body: SafeArea( - child: GetBuilder(builder: (MsgLogic controller) { - return Column( - children: [ - navigatorItem(controller), - if (controller.isShowNotifyTip) - notifyWidget(), - tipWidget(), - reconmandWidget(), - // Text(controller.state.msg), - Expanded(child: TIMConversation( - autoScrollController: logic.scrollController, - scrollController: logic.listScrollController, - onTapItem: (selectedConv) async { - String type = selectedConv.userID!.split('_')[2]; - if (int.parse(type) == 11) { - Get.toNamed(Routes.SysNotifyListPage, arguments: selectedConv); - return; - } - Get.toNamed(Routes.Chat, arguments: selectedConv); - }, - )) - ], - ); - }), + child: Column( + children: [ + GetBuilder(builder: (MsgLogic controller) { + return Column( + children: [ + navigatorItem(controller), + if (controller.isShowNotifyTip) + notifyWidget(controller), + tipWidget(controller), + reconmandWidget(controller), + // Text(controller.state.msg), + + ], + ); + }), + Expanded(child: TIMConversation( + autoScrollController: logic.scrollController, + scrollController: logic.listScrollController, + onTapItem: (selectedConv) async { + String type = selectedConv.userID!.split('_')[2]; + if (int.parse(type) == 11) { + Get.toNamed(Routes.SysNotifyListPage, arguments: selectedConv); + return; + } + Get.toNamed(Routes.Chat, arguments: selectedConv); + }, + )) + ], + ), ), ); } @@ -232,7 +237,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { ); } - notifyWidget() { + notifyWidget(MsgLogic controller) { return Container( height: 30.sp, margin: EdgeInsets.only(top: 10.sp), @@ -248,14 +253,14 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { Row( children: [ GestureDetector(onTap: () { - ctr.isShowNotifyTip = false; - ctr.update(); + controller.isShowNotifyTip = false; + controller.update(); AppSettings.openAppSettings(); },child:Text('去开启',style: TextStyle(color: AppColor.mainColor,fontSize: 14.sp),)), SizedBox(width: 4.sp,), GestureDetector(onTap: () { - ctr.isShowNotifyTip = false; - ctr.update(); + controller.isShowNotifyTip = false; + controller.update(); },child: Icon(Icons.close_rounded,size: 20.sp,color: Colors.white,)), ], ) @@ -264,7 +269,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { ); } - tipWidget() { + tipWidget(MsgLogic controller) { return Container( margin: EdgeInsets.only(top: 10.sp, bottom: 15.sp), padding: EdgeInsets.only(left: 16.sp, right: 12.sp), @@ -296,7 +301,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { ).createShader(Offset.zero & bounds.size); }, child: Text( - '${ctr.total}人在线等您聊', + '${controller.total}人在线等您聊', style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.w600, @@ -315,7 +320,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { ); } - reconmandWidget() { + reconmandWidget(MsgLogic controller) { return Container( padding: EdgeInsets.only(left: 16.sp, right: 18.sp), width: Get.width, @@ -324,7 +329,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { children: [ GestureDetector( onTap: () { - ctr.showTipPop(); + controller.showTipPop(); }, child: Column( children: [ @@ -336,7 +341,7 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { height: 4.sp, ), Text( - ctr.isStart ? '关闭速聊' : '冲到第一', + controller.isStart ? '关闭速聊' : '冲到第一', style: TextStyle(color: Colors.white, fontSize: 12.sp), ), ], @@ -346,12 +351,12 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { child: ListView.builder( scrollDirection: Axis.horizontal, itemBuilder: (contenxt, index) { - if (index == ctr.chatList.length) { + if (index == controller.chatList.length) { return MoreItem(); } - return peopleWidget(ctr.chatList[index]); + return peopleWidget(controller.chatList[index]); }, - itemCount: ctr.chatList.length + 1, + itemCount: controller.chatList.length + 1, )) ], ), @@ -410,11 +415,11 @@ class _MsgPageState extends State with AutomaticKeepAliveClientMixin { } - topWidget() { + topWidget(MsgLogic controller) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - ctr.showTipPop(); + controller.showTipPop(); }, child: Container( margin: EdgeInsets.only(left: 18.sp), diff --git a/circle_app/lib/circle_app/quick/logic.dart b/circle_app/lib/circle_app/quick/logic.dart index 97ed93f..d32d09e 100644 --- a/circle_app/lib/circle_app/quick/logic.dart +++ b/circle_app/lib/circle_app/quick/logic.dart @@ -15,7 +15,9 @@ class QuickLogic extends GetxController { final RefreshController refreshController = RefreshController(); - List genderList = []; + List genderList = [ + MyConfigData('0', '全部', true) + ]; List lists = []; int page = 1; int isVip = 0; @@ -43,8 +45,12 @@ class QuickLogic extends GetxController { ConfigBean configBean = bean1.data!; configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); + if (int.parse(key) < 3) { + genderList.add(MyConfigData(key, value, true)); + } + }); + genderList.add(MyConfigData('-1', '非二元', true)); } } @@ -52,7 +58,7 @@ class QuickLogic extends GetxController { List wantMeet = []; genderList.forEach((element) { - if (element.isSelect) { + if (element.isSelect && element.id != '0') { wantMeet.add(element.id); } }); diff --git a/circle_app/lib/circle_app/quick/view.dart b/circle_app/lib/circle_app/quick/view.dart index 1dac2b0..bb71155 100644 --- a/circle_app/lib/circle_app/quick/view.dart +++ b/circle_app/lib/circle_app/quick/view.dart @@ -43,14 +43,53 @@ class QuickPage extends StatelessWidget { duration: Duration(milliseconds: 300), curve: Curves.easeInOut); }, - actionWdiget: GestureDetector( - onTap: () { - logic.showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), + actionWdiget: Row( + children: [ + GestureDetector( + onTap: () { + showTipPop(); + }, + child: Container( + height: 28.sp, + padding: EdgeInsets.only(left: 4.sp,right: 4.sp), + // width: 80.sp, + decoration: BoxDecoration( + color: AppColor.mainBgColor, + // gradient: AppColor.newMainVerLinearGradient, + borderRadius: BorderRadius.circular(14.sp), + ), + alignment: Alignment.center, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + getMsgImage('hu_icon'), + width: 18.sp, + ), + SizedBox( + width: 2.sp, + ), + Text( + "召唤30人", + style: TextStyle( + color: Colors.white, + fontSize: 14.sp,), + ), + ], + ), + ), + ), + SizedBox(width: 2.sp), + GestureDetector( + onTap: () { + logic.showBottomSheet(context); + }, + child: Image.asset( + getCircleImage('icon_screen'), + width: 30.sp, + ), + ), + ], ), ), body: SafeArea( @@ -79,43 +118,10 @@ class QuickPage extends StatelessWidget { }, ), ), - Positioned( - bottom: 60.sp, - right: 0.sp, - child: GestureDetector( - onTap: () { - showTipPop(); - }, - child: Container( - height: 80.sp, - width: 80.sp, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.75), - // gradient: AppColor.newMainVerLinearGradient, - borderRadius: BorderRadius.circular(40.sp), - ), - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getMsgImage('hu_icon'), - width: 30.sp, - ), - Text( - "一呼百应", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.bold), - ), - SizedBox( - height: 5.sp, - ) - ], - ), - ), - )) + // Positioned( + // bottom: 60.sp, + // right: 0.sp, + // child: ) ], ), ), @@ -150,7 +156,7 @@ class QuickPage extends StatelessWidget { logic.callOrhers(); Get.back(); }, - child: Text('一键呼唤三十位您想认识的人'), + child: Text('一键召唤三十位您想认识的人'), ), CupertinoActionSheetAction( onPressed: () { diff --git a/circle_app/lib/circle_app/setup/view.dart b/circle_app/lib/circle_app/setup/view.dart index f20f4ee..7bb2f96 100644 --- a/circle_app/lib/circle_app/setup/view.dart +++ b/circle_app/lib/circle_app/setup/view.dart @@ -1,4 +1,7 @@ +import 'dart:io'; + import 'package:circle_app/circle_app/minefragment/logic.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../commons/Widgets/my_app_bar.dart'; import 'package:circle_app/utils/util.dart'; import 'package:flutter/material.dart'; @@ -131,7 +134,11 @@ class SetupPage extends StatelessWidget { ), ), Expanded(child: Container()), - SafeArea(child: Center(child: Text('备案号:粤ICP备2023079493号-2A',style: TextStyle(color: Colors.white.withOpacity(0.5),fontSize: 12.sp),))) + if (Platform.isAndroid) + SafeArea(child: GestureDetector(onTap: () { + launch('https://beian.miit.gov.cn', + forceSafariVC: false); + },child: Center(child: Text('备案号:粤ICP备2023079493号-2A',style: TextStyle(color: Colors.white.withOpacity(0.5),fontSize: 12.sp),)))) ], ), ),), diff --git a/circle_app/lib/circle_app/splash/logic.dart b/circle_app/lib/circle_app/splash/logic.dart index b1fa6a7..2a050e2 100644 --- a/circle_app/lib/circle_app/splash/logic.dart +++ b/circle_app/lib/circle_app/splash/logic.dart @@ -25,30 +25,9 @@ class SplashLogic extends GetxController { void onReady() async { // TODO: implement onReady super.onReady(); - loadConfig(); checkStatus(); } - loadConfig() async { - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - if (bean1.code == 200) { - configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(value); - }); - - configBean.orientationMap.forEach((key, value) { - orientationList.add(value); - }); - configBean.roleMap.forEach((key, value) { - roleList.add(value); - }); - } - } checkStatus() async { if ((await getAuthorization()).isEmpty) { @@ -90,21 +69,15 @@ class SplashLogic extends GetxController { return; } showOKToast(bean.msg.toString()); - if (bean.code == 500) { - await Future.delayed(Duration(seconds: 5)); - onInit(); + SharedPreferencesHelper sp = + await SharedPreferencesHelper.getInstance(); + String token = sp.getString(SharedPreferencesHelper.AUTHORIZATION); + if (token.isNotEmpty) { + Get.offNamed(Routes.Home); } else { - SharedPreferencesHelper sp = - await SharedPreferencesHelper.getInstance(); - String token = sp.getString(SharedPreferencesHelper.AUTHORIZATION); - if (token.isNotEmpty) { - Get.offNamed(Routes.Home); - } else { - pushLoginPage(); - } + pushLoginPage(); } - // Get.toNamed(AppRoutes.Home); } } diff --git a/circle_app/lib/circle_app/swiper/view.dart b/circle_app/lib/circle_app/swiper/view.dart index 31a2508..a98f645 100644 --- a/circle_app/lib/circle_app/swiper/view.dart +++ b/circle_app/lib/circle_app/swiper/view.dart @@ -4,6 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/commons/Widgets/base_tip_widget.dart'; import 'package:circle_app/commons/colors/app_color.dart'; import 'package:circle_app/utils/util.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -203,7 +204,7 @@ class _SwiperPageState extends State { children: [ Container( child: CachedImg( - imageUrl: logic.imgList[index], + imageUrl: logic.imgList[index].toString().split('?').first, fit: BoxFit.contain, ), ), @@ -312,8 +313,15 @@ class _SwiperPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - child: CachedImg( - imageUrl: logic.imgList[index], + child: CachedNetworkImage( + progressIndicatorBuilder: ( + BuildContext context, + String url, + DownloadProgress progress, + ) { + return CupertinoActivityIndicator(radius: 25,color: Colors.white,); + }, + imageUrl: logic.imgList[index].toString().split('?').first, fit: BoxFit.contain, ), ), diff --git a/circle_app/lib/circle_app/userinfo/logic.dart b/circle_app/lib/circle_app/userinfo/logic.dart index d76b44f..4df6325 100644 --- a/circle_app/lib/circle_app/userinfo/logic.dart +++ b/circle_app/lib/circle_app/userinfo/logic.dart @@ -61,7 +61,6 @@ class UserinfoLogic extends GetxController { @override void onClose() { // TODO: implement onClose - timer?.cancel(); super.onClose(); } @@ -83,7 +82,7 @@ class UserinfoLogic extends GetxController { state.imaglist.clear(); if (userId.isEmpty) { - isMe =true; + isMe = true; update(); fetchUserInfo(Api.getUserInfo); fetchMyAlbum(Api.getMyAlbum); @@ -107,11 +106,13 @@ class UserinfoLogic extends GetxController { } void loadData() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); + SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); String myId = sp.getMyUserId(); var result = await DioManager.instance.get( - url: userId.toString().isNotEmpty ? Api.giftHall + userId : Api.giftHall + myId, + url: userId.toString().isNotEmpty + ? Api.giftHall + userId + : Api.giftHall + myId, ); if (result['code'] == 200) { // topTitle = result['topDesc']; @@ -145,10 +146,6 @@ class UserinfoLogic extends GetxController { } } - - - - void showBlackDialog(BuildContext context) { showDialog( context: context, @@ -165,7 +162,6 @@ class UserinfoLogic extends GetxController { if (data['code'] == 200) { isBlack = data["data"]["status"] == 1; } - } Future fetchUserInfo(String url) async { @@ -185,13 +181,13 @@ class UserinfoLogic extends GetxController { unLockWxNum = userInfoBean!.contact!.contains('*') ? 0 : 1; isVip = userInfoBean?.vip ?? 0; imId = bean.data.accountId; - print("imId="+imId); + print("imId=" + imId); if (isMe) { isOnline = true; } else { - if(!isLike){ - startCountdown(); - } + // if(!isLike){ + // startCountdown(); + // } isOnline = userInfoBean!.isOnline; isBlackBeen = bean.data.isBlock; isDestroy = bean.data.isDestroy; @@ -219,31 +215,9 @@ class UserinfoLogic extends GetxController { update(); } - int countdown = 5; - Timer? timer = null; - - startCountdown(){ - - timer = Timer.periodic(const Duration(seconds: 1), (t) async { - if (countdown > 0) { - countdown--; - } else { - bool isTip = await checkIsShowTip(); - if (isTip) { - showFloatingButtonOverlay(Get.context!,userInfoBean!.nickname ?? '',ageMsg,userInfoBean!.avatarThumb,0,(){ - setLike(); - }); - } - timer?.cancel(); // 倒计时结束,取消定时器 - } - }); - } - - Future checkIsShowTip() async { - var result = await DioManager.instance.get( - url: Api.popup + userId , + url: Api.popup + userId, ); return result['data'] ?? false; } @@ -260,8 +234,6 @@ class UserinfoLogic extends GetxController { update(); } - - Future fetchUrgeStatus(String url) async { var urgedata = await DioManager.instance.get(url: url); var urgeBean = BaseResponse.fromJson( @@ -317,8 +289,6 @@ class UserinfoLogic extends GetxController { (jsonData) => jsonData, ); if (bean.isSuccess()) { - - timer?.cancel(); isLike = !isLike; update(); } @@ -366,8 +336,11 @@ class UserinfoLogic extends GetxController { showOKToast(bean.msg); } - - void sendGiftData(String accid, String giftId, String userId, ) async { + void sendGiftData( + String accid, + String giftId, + String userId, + ) async { var result = await DioManager.instance.post(url: Api.sendGift, params: { 'accid': accid, 'giftId': giftId, @@ -384,7 +357,7 @@ class UserinfoLogic extends GetxController { } Future getImageFile() async { - checkPhotosStatus(); + checkPhotosStatus(); try { final XFile? pickedFile = await _picker.pickImage( source: ImageSource.gallery, @@ -394,7 +367,8 @@ class UserinfoLogic extends GetxController { } SmartDialog.showLoading(msg: '上传中'); - uploadImage(quToken, pickedFile, ImgPath.USER_ALBUM_IMAGE, (result) async { + uploadImage(quToken, pickedFile, ImgPath.USER_ALBUM_IMAGE, + (result) async { var data = await DioManager.instance .post(url: Api.updataAlbum, params: {"type": 1, "url": result}); var myAlbumBean = BaseResponse.fromJson( @@ -408,8 +382,8 @@ class UserinfoLogic extends GetxController { id: myAlbumBean.data.id, type: myAlbumBean.data.type, url: result, - - urlThumb: result, isTop: 0)); + urlThumb: result, + isTop: 0)); update(); } }); @@ -417,7 +391,9 @@ class UserinfoLogic extends GetxController { } void sendWhatToWx() async { - var result = await DioManager.instance.get(url: Api.noticeWxNum + userId,); + var result = await DioManager.instance.get( + url: Api.noticeWxNum + userId, + ); if (result['code'] == 200) { showOKToast('已提醒对方填写'); } else { @@ -426,12 +402,16 @@ class UserinfoLogic extends GetxController { } void setTopAlbum(bool isTop, int index) async { - var result = await DioManager.instance.post(url: Api.setTopAlbum, params: {'picId':state.imaglist[index].id,'isTop': isTop ? 1 : 0}); + var result = await DioManager.instance.post( + url: Api.setTopAlbum, + params: {'picId': state.imaglist[index].id, 'isTop': isTop ? 1 : 0}); if (result['code'] == 200) { showOKToast('操作成功'); fetchMyAlbum(Api.getMyAlbum); } } + + } class UserBean { @@ -512,9 +492,11 @@ class UserBean { gender: json['gender'], role: json['role'], orientation: json['orientation'], - interests: json['interests'] == null ? [] : List.from( - json['interests'].map((x) => Interest.fromJson(x)), - ), + interests: json['interests'] == null + ? [] + : List.from( + json['interests'].map((x) => Interest.fromJson(x)), + ), lng: json['lng'], lat: json['lat'], city: json['city'], @@ -526,7 +508,6 @@ class UserBean { ); } - Map toJson() { final Map data = new Map(); data['age'] = this.age; @@ -600,7 +581,7 @@ class ResponseBean { {required this.user, required this.likeMeCount, required this.imageUrgeCount, - required this.unLockWxNum, + required this.unLockWxNum, required this.accountId, required this.isBlock, required this.isDestroy, @@ -609,7 +590,7 @@ class ResponseBean { factory ResponseBean.fromJson(Map json) { return ResponseBean( accountId: json['account_id'], - unLockWxNum : json['unLockWxNum'], + unLockWxNum: json['unLockWxNum'], user: UserBean.fromJson(json['user']), likeMeCount: json['like_me_count'], imageUrgeCount: json['image_urge_count'], @@ -655,12 +636,11 @@ class AlbumListItem { factory AlbumListItem.fromJson(Map json) { return AlbumListItem( - id: json['id'], - type: json['type'], - url: json['url'], - urlThumb: json['thumb'], - isTop: json['isTop'] ?? 0 - ); + id: json['id'], + type: json['type'], + url: json['url'], + urlThumb: json['thumb'], + isTop: json['isTop'] ?? 0); } } diff --git a/circle_app/lib/circle_app/userinfo/view.dart b/circle_app/lib/circle_app/userinfo/view.dart index 6a4ae3e..4249214 100644 --- a/circle_app/lib/circle_app/userinfo/view.dart +++ b/circle_app/lib/circle_app/userinfo/view.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ui'; import 'package:cached_network_image/cached_network_image.dart'; @@ -19,6 +20,7 @@ import '../../router/routers.dart'; import '../../utils/cache_img.dart'; import '../../utils/eventBus.dart'; import '../../utils/util.dart'; +import '../../view/notice.dart'; import '../home/logic.dart'; import '../select_circle/logic.dart'; import 'logic.dart'; @@ -38,6 +40,10 @@ class MyTabbedScreenState extends State bool isShowBlackTitle = false; bool isSetState = false; + + int countdown = 5; + Timer? timer = null; + var sub; @override void initState() { @@ -45,7 +51,8 @@ class MyTabbedScreenState extends State sub = EventBusManager.on().listen((event) { if (isSetState) { isSetState = false; - scrollController.animateTo(0, duration: Duration(milliseconds: 250), curve: Curves.easeIn); + scrollController.animateTo(0, + duration: Duration(milliseconds: 250), curve: Curves.easeIn); } }); scrollController.addListener(() { @@ -65,8 +72,11 @@ class MyTabbedScreenState extends State }); _tabController = TabController(length: 2, vsync: this); _tabController.animation!.addListener(_handleTabChange); + starTimer(); } + + @override void didChangeDependencies() { // TODO: implement didChangeDependencies @@ -103,6 +113,7 @@ class MyTabbedScreenState extends State @override void dispose() { _tabController.dispose(); + timer?.cancel(); sub.cancel(); routeObserver.unsubscribe(this); super.dispose(); @@ -302,22 +313,22 @@ class MyTabbedScreenState extends State width: Get.width, child: _meInfoButton(logic), ), - !logic.isShowAlbum && logic.isMe - ? Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - List numbers = []; - - var data = await Get.toNamed(Routes.CallOutPage, - arguments: {'numbers': numbers}); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 60.sp, - ))) - : Container() + // !logic.isShowAlbum && logic.isMe + // ? Positioned( + // bottom: 36.sp, + // right: 10.sp, + // child: GestureDetector( + // onTap: () async { + // List numbers = []; + // + // var data = await Get.toNamed(Routes.CallOutPage, + // arguments: {'numbers': numbers}); + // }, + // child: Image.asset( + // getCircleImage('send_msg'), + // width: 60.sp, + // ))) + // : Container() ], ), ), @@ -755,9 +766,7 @@ class MyTabbedScreenState extends State : _imageAdapter(controller), logic.isBlack || logic.isDestroy || logic.isBlackBeen ? Container() - : - HomeCallOutView(controller.userId), - + : HomeCallOutView(controller.userId), ], ), ), @@ -890,51 +899,67 @@ class MyTabbedScreenState extends State logic.isBlack || logic.isDestroy || logic.isBlackBeen ? Container() : _tabController.index == 0 - ? GestureDetector( - onTap: () { - if (!logic.isShowAlbum && controller.isMe) { - List numbers = []; - var data = Get.toNamed(Routes.CallOutPage, - arguments: {'numbers': numbers}); - return; - } - if (controller.isMe) { - controller.isEdit = !controller.isEdit; - controller.update(); - } else { - controller.urgeChange(); - } - }, - child: Visibility( - // visible: logic.isShowAlbum, - child: Container( - margin: EdgeInsets.only(left: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, + ? logic.isShowAlbum && logic.isMe + ? Container( + child: ShaderMask( + shaderCallback: (Rect bounds) { + return LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [Color(0xffF657FF), AppColor.mainColor], + ).createShader(Offset.zero & bounds.size); + }, + child: Text( + '真实露脸照更受欢迎', + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.w600, + color: Colors.white), ), ), - padding: EdgeInsets.symmetric( - vertical: 2.sp, - horizontal: 12.sp, - ), - child: Text( - buttonText, - style: const TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - ) - : Container(), + ) + : Container() + : _tabController.index == 1 && logic.isMe ? GestureDetector( + onTap: () { + if (!logic.isShowAlbum && controller.isMe) { + List numbers = []; + var data = Get.toNamed(Routes.CallOutPage, + arguments: {'numbers': numbers}); + return; + } + if (controller.isMe) { + controller.isEdit = !controller.isEdit; + controller.update(); + } else { + controller.urgeChange(); + } + }, + child: Container( + margin: EdgeInsets.only(left: 10.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.symmetric( + vertical: 2.sp, + horizontal: 12.sp, + ), + child: Text( + buttonText, + style: const TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) : Container(), ], ), ); @@ -1203,8 +1228,12 @@ class MyTabbedScreenState extends State for (var element in controller.state.imaglist) { imaglist.add(element.url); } - Get.toNamed(Routes.SwiperPage, - arguments: {'imaglist': imaglist, 'index': index,'isVague':homeLogic.model!.vip == 0})!.then((value) => logic.update()); + Get.toNamed(Routes.SwiperPage, arguments: { + 'imaglist': imaglist, + 'index': index, + 'isVague': homeLogic.model!.vip == 0 + })! + .then((value) => logic.update()); }, child: Image.network( fit: BoxFit.cover, @@ -1256,6 +1285,24 @@ class MyTabbedScreenState extends State ], ), ), + if (isTop == 1) + Positioned( + top: 0, + left: 5, + child: Container( + height: 25.sp, + width: 25.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.4), + borderRadius: BorderRadius.circular(15.sp)), + child: Icon( + Icons.vertical_align_top_sharp, + color: AppColor.mainColor, + size: 20.sp, + ), + ), + ), ], ); } @@ -1691,6 +1738,23 @@ class MyTabbedScreenState extends State }, ); } + + void starTimer() { + timer = Timer.periodic(const Duration(seconds: 1), (t) async { + if (countdown > 0) { + countdown--; + } else { + bool isTip = await logic.checkIsShowTip(); + if (isTip && !logic.isMe && !logic.isLike) { + showFloatingButtonOverlay(context, logic.userInfoBean!.nickname ?? '', + logic.ageMsg, logic.userInfoBean!.avatarThumb, 0, () { + logic.setLike(); + }); + } + timer?.cancel(); // 倒计时结束,取消定时器 + } + }); + } } class ScrollViewIsEnd { 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 bc8c6a1..12fe8af 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 @@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/circle_app/circle/state.dart'; import 'package:circle_app/circle_app/circle/widgets/video_item.dart'; import 'package:circle_app/circle_app/userinfo/widgets/home_call_out_logic.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'; @@ -13,6 +14,8 @@ import 'package:get/get_core/src/get_main.dart'; import 'package:get/get.dart'; import '../../../commons/Widgets/text_more.dart'; +import '../../../net/api.dart'; +import '../../../net/dio_manager.dart'; import '../../../utils/cache_img.dart'; import '../logic.dart'; import '../view.dart'; @@ -181,6 +184,7 @@ class _HomeCallOutViewState extends State ), ), Container( + margin: EdgeInsets.only(top: 10.sp), width: Get.width, // height: widgetHeight, @@ -219,7 +223,7 @@ class _HomeCallOutViewState extends State Container( // height: widgetHeight, width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp,bottom: 12.sp), + padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp,), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -386,12 +390,13 @@ class _HomeCallOutViewState extends State ? Container() : GestureDetector( onTap: () { - showTipPiker(lists.id!.toString(), - listsLg!.lists.indexOf(lists)); + showCallOutTipPop(lists.id!.toString(), + listsLg!.lists.indexOf(lists),lists!.userTop! == 1); }, - child: Image.asset( - getCircleImage('delete'), - width: 20.sp, + child: Icon( + Icons.more_vert, + color: AppColor.mainColor, + size: 20, )) ], )) @@ -646,6 +651,7 @@ class _HomeCallOutViewState extends State Container( width: Get.width, margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), + alignment: Alignment.centerLeft, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -659,12 +665,13 @@ class _HomeCallOutViewState extends State ? Container() : GestureDetector( onTap: () { - showTipPiker(lists.id!.toString(), - listsLg!.lists.indexOf(lists)); + showCallOutTipPop(lists.id!.toString(), + listsLg!.lists.indexOf(lists),lists.userTop == 1); }, - child: Image.asset( - getCircleImage('delete'), - width: 20.sp, + child: Icon( + Icons.more_vert, + color: AppColor.mainColor, + size: 20, )) ], )) @@ -722,6 +729,43 @@ class _HomeCallOutViewState extends State return painter.width; } + showCallOutTipPop(String calloutId, int index, bool isTop,) { + Get.bottomSheet( + CupertinoActionSheet( + title: Text( + '喊话操作', + style: TextStyle(fontSize: 22), + ), //标题 + //提示内容 + actions: [ + CupertinoActionSheetAction( + onPressed: () { + Get.back(); + setCallOutTop(!isTop, calloutId); + }, + child: Text(isTop ? '取消置顶' : '置顶'), + ), + CupertinoActionSheetAction( + onPressed: () { + Get.back(); + showTipPiker(calloutId, + index); + // toast('举报成功,等待反馈!'); + }, + child: Text('删除'), + ), + ], + cancelButton: CupertinoActionSheetAction( + //取消按钮 + onPressed: () { + Get.back(); + }, + child: Text('取消'), + ), + ), + isScrollControlled: true); + } + showTipPiker(String callOutId, int index) { return Get.bottomSheet( Scaffold( @@ -758,4 +802,15 @@ class _HomeCallOutViewState extends State enableDrag: false, ); } + + void setCallOutTop(bool isTop, String calloutId) async { + var result = await DioManager.instance.post( + url: Api.calloutTop, + params: {'calloutId': calloutId, 'isTop': isTop ? 1 : 0}); + if (result['code'] == 200) { + showOKToast('操作成功'); + listsLg?.callOutPage = 1; + listsLg?.loadCallOutListData(widget.userId); + } + } } diff --git a/circle_app/lib/circle_app/world_call_out/logic.dart b/circle_app/lib/circle_app/world_call_out/logic.dart index fc231d1..081fde3 100644 --- a/circle_app/lib/circle_app/world_call_out/logic.dart +++ b/circle_app/lib/circle_app/world_call_out/logic.dart @@ -16,7 +16,9 @@ class World_call_outLogic extends GetxController { TextEditingController inputController = TextEditingController(); final RefreshController refreshController = RefreshController(); FocusNode focusNode = FocusNode(); - List genderList = []; + List genderList = [ + MyConfigData('0', '全部', true) + ]; String myUserId = ''; bool isLoad = true; List lists = []; @@ -58,7 +60,6 @@ class World_call_outLogic extends GetxController { } void initGerder() async { - genderList.clear(); var data1 = await DioManager.instance.get(url: Api.getCircleList, params: {}); var bean1 = BaseResponse.fromJson( @@ -68,8 +69,11 @@ class World_call_outLogic extends GetxController { ConfigBean configBean = bean1.data!; configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); + if (int.parse(key) < 3) { + genderList.add(MyConfigData(key, value, true)); + } }); + genderList.add(MyConfigData('-1', '非二元', true)); } } @@ -106,7 +110,7 @@ class World_call_outLogic extends GetxController { List wantMeet = []; genderList.forEach((element) { - if (element.isSelect) { + if (element.isSelect && element.id != '0') { wantMeet.add(element.id); } }); 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 58b9088..fc3f206 100644 --- a/circle_app/lib/circle_app/world_call_out/view.dart +++ b/circle_app/lib/circle_app/world_call_out/view.dart @@ -32,8 +32,7 @@ class _WorldCallOutPageState extends State String zeroWidthSpace = '\ufeff'; int? currentCursor; - - final logic = Get.find(); + final logic = Get.put(World_call_outLogic()); @override void dispose() { diff --git a/circle_app/lib/commons/widgets/today_people_dialog.dart b/circle_app/lib/commons/widgets/today_people_dialog.dart index d0643e2..beb68a2 100644 --- a/circle_app/lib/commons/widgets/today_people_dialog.dart +++ b/circle_app/lib/commons/widgets/today_people_dialog.dart @@ -17,8 +17,9 @@ import 'dart:math' as math; class TodayPeopleDialog extends StatefulWidget { bool isShow; - String urlStr; - TodayPeopleDialog({super.key, this.isShow = false, this.urlStr = ''}); + String url; + Map recommendCircleFriendData; + TodayPeopleDialog({super.key, this.isShow = false, this.url = '', this.recommendCircleFriendData = const {}}); @override _TodayPeopleDialogState createState() => _TodayPeopleDialogState(); @@ -35,9 +36,11 @@ class _TodayPeopleDialogState extends State { void initState() { // TODO: implement initState super.initState(); - if (widget.urlStr.isNotEmpty) { + if (widget.url.isNotEmpty) { isLoad = false; + recommendCircleFriendData = widget.recommendCircleFriendData; } + fetchMyAlbum(Api.getMyAlbum); @@ -52,14 +55,17 @@ class _TodayPeopleDialogState extends State { if (myAlbumBean.isSuccess()) { imgList.addAll(myAlbumBean.data.lists); } - loadRecommendCircleFriendData(); + if (widget.url.isEmpty) { + loadRecommendCircleFriendData(); + } + } void loadRecommendCircleFriendData() async { - if (widget.urlStr.isEmpty) { + if (widget.url.isEmpty) { isLoad = true; } @@ -68,18 +74,19 @@ class _TodayPeopleDialogState extends State { }); var data = await DioManager.instance.get( - url: widget.urlStr.isNotEmpty ? widget.urlStr : Api.chatRecommendFriend, + url: widget.url.isNotEmpty ? widget.url : Api.chatRecommendFriend, ); if (data['code'] == 200) { SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - if (await sp.isShowMatch() && imgList.isEmpty && widget.urlStr.isEmpty) { + if (await sp.isShowMatch() && imgList.isEmpty && widget.url.isEmpty) { showOKToast('上传真实头像和形象照后更容易匹配到想认识的人哦~'); } isLoad = false; List dataList = data['data']; if (dataList.isNotEmpty) { recommendCircleFriendData = data['data'][0]; + recommendCircleFriendData['tags'] = data['tags']; if (mounted) { setState(() {}); } @@ -167,6 +174,10 @@ class _TodayPeopleDialogState extends State { } } + if (recommendCircleFriendData.containsKey('tags')) { + titleList = recommendCircleFriendData['tags']; + } + if (titleList.length >= 1) { info['city'] = titleList.first; } @@ -178,6 +189,14 @@ class _TodayPeopleDialogState extends State { if (titleList.length >= 3) { info['desc'] = titleList[2]; } + + if (titleList.length >= 4) { + info['desc1'] = titleList[3]; + } + if (titleList.length >= 5) { + info['desc2'] = titleList[4]; + } + } catch (e) { loadRecommendCircleFriendData(); return Container(); @@ -423,6 +442,66 @@ class _TodayPeopleDialogState extends State { ], ), ), + if (info.containsKey('desc1')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc1'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), + if (info.containsKey('desc2')) + Container( + margin: EdgeInsets.only(top: 10.sp, right: 16.sp), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 3, + height: 3, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.5), + color: Color(0xFF00FFF4)), + ), + Expanded( + child: Container( + child: Text( + info['desc2'], + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + ) + ], + ), + ), Container( margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), alignment: Alignment.centerLeft, @@ -616,6 +695,35 @@ class _TodayPeopleDialogState extends State { ), ), itemWidget(), + if (widget.url.isNotEmpty) + Container( + height: 40.sp, + margin: EdgeInsets.only(top: 20.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + Get.back(); + }, + child: Container( + width: 100.sp, + height: 40.sp, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF392D53), + borderRadius: BorderRadius.circular(20.sp)), + child: Text( + '先不看了', + style: TextStyle( + color: Colors.white, fontSize: 15.sp), + ), + ), + ), + ], + ), + ), + if (widget.url.isEmpty) Container( height: 40.sp, margin: EdgeInsets.only(top: 20.sp), diff --git a/circle_app/lib/commons/widgets/wx_edit_dialog.dart b/circle_app/lib/commons/widgets/wx_edit_dialog.dart index 4b02e61..fea081b 100644 --- a/circle_app/lib/commons/widgets/wx_edit_dialog.dart +++ b/circle_app/lib/commons/widgets/wx_edit_dialog.dart @@ -38,6 +38,7 @@ class _WxEditDialogState extends State { // TODO: implement initState super.initState(); loadMyWxInfoData(); + loadWxStatus(); // updateWxText(); } @@ -356,7 +357,7 @@ class _WxEditDialogState extends State { if (result['code'] ==200) { showOKToast('设置成功'); Get.back(); - } else if (result['code'] == 10081) { + } else if (result['code'] == 10081) { showRechargeScreenDialog(); } @@ -445,9 +446,9 @@ class _WxEditDialogState extends State { void loadWxStatus() async { var result = await DioManager.getInstance().get(url: Api.updateWxNumState,); if (result['code'] == 10034) { - wxStatusInfo['10034'] = result['msg']; + wxInfo['10034'] = result['msg']; } else if (result['code'] == 10595) { - wxStatusInfo['10595'] = result['msg']; + wxInfo['10595'] = result['msg']; } } diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index 4878af4..44b5964 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -55,6 +55,9 @@ void main() { FlutterBugly.init( androidAppId: "8509314e11", ); + if (Platform.isAndroid) { + getLostData(); + } } } else { FlutterBugly.init( @@ -62,9 +65,7 @@ void main() { ); } }); - if (Platform.isAndroid) { - getLostData(); - } + } setCustomErrorWidget() { @@ -162,6 +163,7 @@ void uploadBuzIDAndToken() async { ChannelPush.uploadToken(); print("token=" + token); + if (token != "") { V2TimCallback res = await coreInstance.setOfflinePushConfig( token: token, businessID: businessID); @@ -398,7 +400,19 @@ class _MyAppState extends State with WidgetsBindingObserver { ///设置文字大小不随系统设置改变 data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child:FlutterSmartDialog( - child: child, + child: RefreshConfiguration( + footerTriggerDistance: 15.0, + dragSpeedRatio: 0.91, + // headerBuilder: () => WaterDropHeader(), + footerBuilder: () => CustomLoadFooter(), // 使用自定义 Footer + headerTriggerDistance: 80.0, + maxOverScrollExtent: 100, + maxUnderScrollExtent: 0, + enableScrollWhenRefreshCompleted: true, + enableLoadingWhenFailed: true, + hideFooterWhenNotFull: false, + enableBallisticLoad: true, child: child!, + ) )); }, debugShowCheckedModeBanner: false, diff --git a/circle_app/lib/net/api.dart b/circle_app/lib/net/api.dart index 5910ae3..aa6000b 100644 --- a/circle_app/lib/net/api.dart +++ b/circle_app/lib/net/api.dart @@ -139,6 +139,10 @@ class Api { //置顶相册 static const setTopAlbum = 'up-service/topAlbum'; + + //置顶喊话 + static const calloutTop = 'up-service/callout/top'; + //他的相册 static const getTaAlbum = 'up-service/user/'; diff --git a/circle_app/lib/utils/util.dart b/circle_app/lib/utils/util.dart index 8e77d23..1c839c4 100644 --- a/circle_app/lib/utils/util.dart +++ b/circle_app/lib/utils/util.dart @@ -79,21 +79,30 @@ String getTabbarImage(String image) { String getCircleImage(String image) { return '${Values.circle_img}${image}.png'; } - +bool isShowToast = false; ///弹窗文本提示 msg: 提示内容 showOKToast(String msg) { + if (isShowToast) return; + isShowToast = true; + int seconds = msg.length > 15 ? 5 : msg.length > 10 ? 3 : 2; showToast( msg, textAlign: TextAlign.left, - duration: Duration(seconds: msg.length > 15 ? 5 : msg.length > 10 ? 3 : 2), + duration: Duration(seconds: seconds), position: ToastPosition.center, backgroundColor: Colors.black, radius: 13.0, textStyle: const TextStyle(fontSize: 16.0,color: Colors.white), ); + Future.delayed( + Duration( + seconds: seconds, + ), () { + isShowToast = false; + }); } -loaddingWidget(bool isMore,{String tip = '--到底了--'}) { +loaddingWidget(bool isMore,{String tip = '---更多精彩正在赶来的路上---'}) { return Container( alignment: Alignment.center, child: isMore @@ -377,7 +386,7 @@ class CustomLoadFooter extends StatelessWidget { canLoadingText: "松手开始加载数据", loadingText: "正在加载...", idleText: "上拉加载更多", - noDataText: "到底了~", + noDataText: "---更多精彩正在赶来的路上---", failedText: "加载失败", ); } @@ -686,6 +695,7 @@ createCustomMsg(String userId, String imId) async { info['myInterests'] = data['data']['myInterests'] ?? []; info['user'] = data['data']['user']; info['guide_text'] = data['data']['guide_text'] ?? '请问现在有空吗?'; + info['tags'] = recommendCircleFriendData['tags']; await sendCustomMsg(imId, jsonEncode(info), desc); return true; } @@ -965,6 +975,9 @@ Map checkCardReturnData(Map recommendCircleFriendData) { } } + if (recommendCircleFriendData.containsKey('tags')) { + titleList = recommendCircleFriendData['tags']; + } if (titleList.length >= 1) { info['city'] = titleList.first; } @@ -976,6 +989,15 @@ Map checkCardReturnData(Map recommendCircleFriendData) { if (titleList.length >= 3) { info['desc'] = titleList[2]; } + + if (titleList.length >= 4) { + info['desc1'] = titleList[3]; + } + + if (titleList.length >= 5) { + info['desc2'] = titleList[4]; + } + return info; } diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index d182e1b..0b83131 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: app_settings - sha256: e6a34735d4ddb24ca9c5fd7e965ec65c8b611cbd3a329152c294f9e9f4bacb33 + sha256: "2ec421f375d747916c4c0193933567074ea60c4f01c4a68642f07fef1002524e" url: "https://pub.flutter-io.cn" source: hosted - version: "4.3.1" + version: "4.0.4" archive: dependency: transitive description: @@ -630,14 +630,6 @@ 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: @@ -1045,6 +1037,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.8.1" + keframe: + dependency: "direct main" + description: + name: keframe + sha256: c0970f29443a3ac1a1f8b28d4f3572d8ff1f96d18dda8a68b23f78b10cb74997 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.6" link_preview_generator: dependency: transitive description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 2a540cd..24bd5f9 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -90,7 +90,7 @@ dependencies: fluwx: ^3.8.1+1 event_bus: ^2.0.0 #安装apk - flutter_install_app: 1.3.0 +# flutter_install_app: 1.3.0 #闪屏页 flutter_native_splash: 2.2.16 #腾讯离线推送 @@ -112,11 +112,13 @@ dependencies: #边框渐变 gradient_borders: ^1.0.0 #系统设置 安卓4.3.1 苹果4.0.4 - app_settings: 4.3.1 + app_settings: 4.0.4 #百度定位插件 flutter_bmflocation: ^3.6.0 #通知权限 notification_permissions: ^0.6.1 + #分帧 + keframe: ^2.0.6 dev_dependencies: flutter_test: