diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index 3877ade..88eafad 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 24 - versionName "1.3.2" + versionCode 22 + versionName "1.3.0" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/assets/images/circle/circile_all_icon.png b/circle_app/assets/images/circle/circile_all_icon.png index 501fdee..68ef933 100644 Binary files a/circle_app/assets/images/circle/circile_all_icon.png and b/circle_app/assets/images/circle/circile_all_icon.png differ diff --git a/circle_app/ios/Runner.xcodeproj/project.pbxproj b/circle_app/ios/Runner.xcodeproj/project.pbxproj index 6144de6..bd5e934 100644 --- a/circle_app/ios/Runner.xcodeproj/project.pbxproj +++ b/circle_app/ios/Runner.xcodeproj/project.pbxproj @@ -381,8 +381,8 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.6; - PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; + MARKETING_VERSION = 1.3.1; + PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -530,8 +530,8 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.6; - PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; + MARKETING_VERSION = 1.3.1; + PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -573,8 +573,8 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.6; - PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; + MARKETING_VERSION = 1.3.1; + PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/circle_app/ios/Runner/Runner.entitlements b/circle_app/ios/Runner/Runner.entitlements index 0c67376..903def2 100644 --- a/circle_app/ios/Runner/Runner.entitlements +++ b/circle_app/ios/Runner/Runner.entitlements @@ -1,5 +1,8 @@ - + + aps-environment + development + diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index f0b45f7..812858b 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -493,6 +493,7 @@ class Circle { String ios_item; double amount; bool is_limit; + bool is_top; double oldAmount; String lastCalloutTime; bool isJoin; @@ -510,6 +511,7 @@ class Circle { required this.intro, required this.amount, required this.oldAmount, + required this.is_top, required this.lastCalloutTime, required this.isJoin, required this.isLike, @@ -529,6 +531,7 @@ class Circle { return Circle( id: json['id'], + is_top: json['is_top'] ?? false, is_limit: json['is_limit'] ?? false, image: json['image'] ?? '', ios_item: json['ios_item'] ?? '', diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart index 03f79f9..f3f53f6 100644 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/circle/logic.dart'; @@ -16,20 +17,20 @@ import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class LikeView extends StatefulWidget { - @override _LikeViewState createState() => _LikeViewState(); - } -class _LikeViewState extends State with AutomaticKeepAliveClientMixin { +class _LikeViewState extends State + with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => true; final ScrollController scrollController = ScrollController(); - + final RefreshController refreshController = RefreshController(); // ListLogic? listsLg; @@ -47,52 +48,44 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin void dispose() { // TODO: implement dispose - if(null!=scroToTop){ + if (null != scroToTop) { EventBusManager.cancelSubscription(scroToTop!); - } + EventBusManager.cancelSubscription(likeRefreshSub!); + scrollController.dispose(); super.dispose(); - - } - StreamSubscription? callRefreshCicle =null; - StreamSubscription? scroToTop =null; + StreamSubscription? callRefreshCicle = null; + StreamSubscription? scroToTop = null; + StreamSubscription? likeRefreshSub = null; @override void initState() { // TODO: implement initState super.initState(); - scrollController.addListener(() { - try { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - loadMore(); - } - } catch (_) {} - }); + loadLikeListData(); - - - scroToTop = EventBusManager.on().listen((event) { + scroToTop = EventBusManager.on().listen((event) { // if (widget.logic.state.index == widget.index) { - scrollController.animateTo( - 0.0, - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - // } - + var str = '{\"content\":{\"calloutId\":10453,\"interestId\":5},\"event\":3}'; + var params = jsonDecode(str); + scrollController.animateTo( + 0.0, + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }); + likeRefreshSub = EventBusManager.on().listen((event) { + // if (widget.logic.state.index == widget.index) { + refreshData(); + // } }); - // widget.back(widget.createState()); } - - - loadLikeListData() async { if (likeMore) { var data = await DioManager.instance.get( @@ -101,8 +94,9 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin if (data["code"] == 200) { List dataList = data["data"]["lists"] ?? []; if (callOutPage == 1) { - lists.clear(); + lists.clear(); } + if (dataList.isNotEmpty) { likeMore = true; for (var element in dataList) { @@ -113,7 +107,15 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin likeMore = dataList.length == 20; if (!likeMore) { loadRecomdistData(); + } else { + if (callOutPage == 2 || callOutPage == 1) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } else { + refreshController.loadComplete(); + } } + if (mounted) { setState(() {}); } @@ -144,6 +146,16 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin recomandPage++; } recomandMore = dataList.length == 20; + + if (recomandPage == 2 || recomandPage == 1) { + refreshController.refreshCompleted(); + } else { + if (recomandMore) { + refreshController.loadComplete(); + } else { + refreshController.loadNoData(); + } + } if (mounted) { setState(() {}); } @@ -159,7 +171,10 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin void refreshData() { callOutPage = 1; + recomandPage = 1; likeMore = true; + recomandMore = true; + refreshController.resetNoData(); loadLikeListData(); } @@ -188,15 +203,11 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin // if (bean.user!.id == userId) { // Get.toNamed(AppRoutes.UserInfoActivity); // } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: bean.user!.id!.toString()); + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: bean.user!.id!.toString()); // } // }); - - - - // if (bean.isQueen) { // showJoinCiclePiker(cicleId); // } else { @@ -209,7 +220,6 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin } void pushMsgPage(var bean, String cicleId) async { - // if (widget.bean.is_limit&&widget.bean.amount>0) { // showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ // widget.bean.is_limit = false; @@ -237,16 +247,22 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin // if () var data = await DioManager.instance.get( - url: "/up-service/callout/${bean.id}/chat",); + url: "/up-service/callout/${bean.id}/chat", + ); if (data["code"] == 200) { - pushChatPage(data['data']['account_id'].toString().split("_").last,data['data']['account_id'], bean.user!.nickname!); + pushChatPage(data['data']['account_id'].toString().split("_").last, + data['data']['account_id'], bean.user!.nickname!); await Future.delayed(Duration(seconds: 1)); - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); + SharedPreferences sharedPreferences = + await SharedPreferences.getInstance(); // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID)??0; - String avatar = sharedPreferences.getString(SharedPreferencesHelper.AVATAR)??""; - String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??""; + int userId = + sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; + String avatar = + sharedPreferences.getString(SharedPreferencesHelper.AVATAR) ?? ""; + String name = + sharedPreferences.getString(SharedPreferencesHelper.NAME) ?? ""; // bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name)); // widget.logic.update(); } @@ -258,95 +274,103 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin List widgets = []; int i = 0; // print(urlList); - if(null!=urlList){ + if (null != urlList) { urlList.forEach((element) { - if(widgets.length>2){ + if (widgets.length > 2) { return; } widgets.add(Positioned( left: 15.sp * i, - child: circleWidget(element.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.id.toString()), + child: circleWidget( + element.avatar! ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + element.id.toString()), )); i++; }); } - return ClipRRect( borderRadius: BorderRadius.circular(10.sp), child: Container( width: Get.width, - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), + padding: EdgeInsets.only(left: 10.sp, right: 10.sp), // margin: // EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp), - child: - RefreshIndicator( - onRefresh: () async { - refreshData(); - // refreshCircleData(); - }, - child: - ListView.builder( - physics: const AlwaysScrollableScrollPhysics(), - addAutomaticKeepAlives:false, - addRepaintBoundaries:false, - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: likeMore ? lists.length + 1 : lists.length + 1 + recomanddlists.length, - itemBuilder: (context, index) { - if (lists.length > index) { - var list = lists[index]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - } else if (!likeMore && lists.length == index) { - return tipItem(); - } else if (index - lists.length < recomanddlists.length) { - var list = recomanddlists[index - lists.length]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } + child: SmartRefresher( + controller: refreshController, + onRefresh: refreshData, + onLoading: loadMore, + enablePullUp: recomandMore, + child: ListView.builder( + physics: const AlwaysScrollableScrollPhysics(), + addAutomaticKeepAlives: false, + addRepaintBoundaries: false, + scrollDirection: Axis.vertical, + controller: scrollController, + itemCount: likeMore + ? lists.length + : lists.length + recomanddlists.length + 1, + itemBuilder: (context, index) { + if (lists.length - 1 >= index) { + var list = lists[index]; + if (list.isQueen!) { + return vipDynamicItem(list); } else { - return Container( - margin: EdgeInsets.only( - top: likeMore ? 0 : 10.sp), - child: likeMore ? loaddingWidget(likeMore) : GestureDetector( - onTap: () { - - var homeLogic = Get.find(); - homeLogic.tabController.animateTo(1, duration: Duration(milliseconds: 0), curve: Curves.ease); - homeLogic.updateIndex(1); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('add'), - width: 180.sp, - ), - Text( - '查看更多圈子', - style: TextStyle( - color: Colors.white, fontSize: 18.sp), - ) - ], - ), - ), - )); + return normalDynamicItem(list); } - }), - ), - + } else if (!likeMore && + lists.length == index && + recomanddlists.isNotEmpty) { + return tipItem(); + } else if (index - lists.length < recomanddlists.length && + !likeMore) { + var list = recomanddlists[index - lists.length]; + if (list.isQueen!) { + return vipDynamicItem(list); + } else { + return normalDynamicItem(list); + } + } else { + if (recomandMore) return Container(); + return Container( + margin: EdgeInsets.only(top: likeMore ? 0 : 10.sp), + child: likeMore + ? loaddingWidget(likeMore) + : GestureDetector( + onTap: () { + var homeLogic = Get.find(); + homeLogic.tabController.animateTo(1, + duration: Duration(milliseconds: 0), + curve: Curves.ease); + homeLogic.updateIndex(1); + }, + child: Container( + margin: EdgeInsets.only(bottom: 10.sp), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getLoginImage('start_bg'), + width: 180.sp, + ), + Text( + '查看更多圈子', + style: TextStyle( + color: Colors.white, + fontSize: 18.sp), + ) + ], + ), + ), + )); + } + }), + ), )); } - void _showTextContentDialog(BuildContext context, String msg,String title) { + void _showTextContentDialog(BuildContext context, String msg, String title) { showDialog( context: context, builder: (BuildContext context) { @@ -357,7 +381,6 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin padding: const EdgeInsets.all(1.0), child: Stack( children: [ - Container( decoration: BoxDecoration( shape: BoxShape.rectangle, @@ -385,31 +408,37 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin top: 15, left: 0, right: 0, - child: Center(child: Text(title, style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)), + child: Center( + child: Text(title, + style: TextStyle( + color: const Color(0xFFF7FAFA), fontSize: 16.sp)), + )), Container( - margin: EdgeInsets.only(top: 24.sp,bottom: 24.sp), + margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), child: Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), + margin: + EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), alignment: Alignment.center, - child: SingleChildScrollView(child: Text( - msg, - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ),), + child: SingleChildScrollView( + child: Text( + msg, + textAlign: TextAlign.center, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), ), ), Positioned( - top:8.sp, + top: 8.sp, right: 10.sp, child: GestureDetector( onTap: () { Get.back(); }, child: Icon( - Icons.close,color: Colors.white, + Icons.close, + color: Colors.white, size: 20.sp, ), )), @@ -439,7 +468,8 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin onTap: () { // pushOtherPeopleHomePage(element.id.toString()); }, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), + child: + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -455,13 +485,12 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin double picHeight = 0.0; - if (lists.album != null) { if (lists.album!.isNotEmpty) { Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - 20.sp)/3; + double picWidth = (Get.width - 20.sp) / 3; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { @@ -473,19 +502,20 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin } } - double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; + double widgetHeight = + 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; return GestureDetector( onTap: () async { - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); + var sp = await SharedPreferencesHelper.getInstance(); + String myUserId = sp.getMyUserId(); - if(lists.user?.id!.toString() == myUserId){ - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - pushHomePage(lists, lists.id.toString()); - }, + if (lists.user?.id!.toString() == myUserId) { + Get.toNamed(AppRoutes.UserInfoActivity); + return; + } + pushHomePage(lists, lists.id.toString()); + }, child: Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, @@ -496,10 +526,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin image: AssetImage( getCircleImage('pic_bg'), ))), - child: Stack(children: - - [ - + child: Stack(children: [ Positioned( left: 0, top: 2.sp, @@ -509,7 +536,6 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin Positioned( right: 2.sp, top: 2.sp, - child: Stack( alignment: Alignment.center, children: [ @@ -544,7 +570,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), ClipOval( child: CachedNetworkImage( - imageUrl:lists.user!.avatar_thumb!, + imageUrl: lists.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover, @@ -554,65 +580,72 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - lists.user?.vip != null && lists.user!.vip == 0 - ? Container() - : Image.asset( - getCircleImage(lists.user!.vip == 1 ? 'vip' : 'year_vip'), - width: 36.sp, - ) - ], + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], + width: 8.sp, ), + lists.user?.vip != null && + lists.user!.vip == 0 + ? Container() + : Image.asset( + getCircleImage(lists.user!.vip == 1 + ? 'vip' + : 'year_vip'), + width: 36.sp, + ) ], ), - )), + SizedBox( + height: 4.sp, + ), + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender ?? 0, + lists.user!.age ?? 0, + lists.user!.role ?? 0, + lists.user!.orientation ?? 0), + // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ) + ], + ), + ], + ), + )), ], ), ), @@ -626,51 +659,51 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin margin: EdgeInsets.only(top: 5.sp), child: picHeight == 140.sp ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), + itemCount: lists.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: 1.0 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + // placeholder: (context, url) => + // SizedBox( + // width: 30.sp, + // height: 30.sp, + // child: CircularProgressIndicator( + // color: Color(0xFF07FAFB), + // strokeWidth: 2.sp, + // ), + // ), + errorWidget: (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + }), ), Container( height: 30.sp, @@ -678,36 +711,38 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin margin: EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000) - ), + color: Color(0x33000000)), child: Row( children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )), GestureDetector( onTap: () { - pushMsgPage(lists, lists.interest!['id'].toString(),); + pushMsgPage( + lists, + lists.interest!['id'].toString(), + ); // pushHomePage( // lists, widget.bean.id.toString()); }, @@ -727,7 +762,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin left: 2.sp, child: Container( width: Get.width - 4.sp - 20.sp, - child: circleInfoItem(lists.interest,lists,index), + child: circleInfoItem(lists.interest, lists, index), )) ])), ); @@ -747,7 +782,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin Album info = lists.album!.first; if (info.type == 1) { - double picWidth = (Get.width - 20.sp)/3; + double picWidth = (Get.width - 20.sp) / 3; if (lists.album!.length > 3) { picHeight = picWidth * 2; } else { @@ -765,9 +800,9 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin widgets.add(Positioned( left: 12.sp * index, child: GestureDetector( - onTap: () { - }, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), + onTap: () {}, + child: + circleWidget(element.avatar!, element.id.toString(), width: 24), ), )); index++; @@ -784,7 +819,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin onTap: () async { var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); - if(lists.user?.id!.toString() == myUserId){ + if (lists.user?.id!.toString() == myUserId) { Get.toNamed(AppRoutes.UserInfoActivity); return; } @@ -822,7 +857,6 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), Container( width: Get.width, - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), child: Column( children: [ @@ -840,7 +874,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), ClipOval( child: CachedNetworkImage( - imageUrl:lists.user!.avatar_thumb!, + imageUrl: lists.user!.avatar_thumb!, width: 40.sp, height: 40.sp, fit: BoxFit.cover, @@ -852,65 +886,71 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - lists.user?.vip != null && lists.user!.vip == 0 - ? Container() - : Image.asset( - getCircleImage(lists.user!.vip == 1 ? 'vip' : 'year_vip'), - width: 36.sp, - ) - ], + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], + width: 8.sp, ), + lists.user?.vip != null && + lists.user!.vip == 0 + ? Container() + : Image.asset( + getCircleImage(lists.user!.vip == 1 + ? 'vip' + : 'year_vip'), + width: 36.sp, + ) ], ), - )), + SizedBox( + height: 4.sp, + ), + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender ?? 0, + lists.user!.age ?? 0, + lists.user!.role ?? 0, + lists.user!.orientation ?? 0), + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, + ), + ), + ) + ], + ), + ], + ), + )), ], ), ), @@ -921,69 +961,77 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), picHeight > 0 ? Container( - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - if (album.type == 2) { - return ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: VideoItemWidget(album.url!)); - } - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) + height: picHeight, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 140.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: + VideoItemWidget(lists.album![0].url!)) + : GridView.builder( + itemCount: lists.album!.length, + physics: + const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: + 1.0 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + if (album.type == 2) { + return ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: VideoItemWidget(album.url!)); + } + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, + arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + // placeholder: (context, url) => + // SizedBox( + // width: 30.sp, + // height: 30.sp, + // child: CircularProgressIndicator( + // color: Color(0xFF07FAFB), + // strokeWidth: 2.sp, + // ), + // ), + errorWidget: + (context, url, error) => + const Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + })) : Container(), Container( height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp,), - margin: EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), + padding: EdgeInsets.only( + left: 5.sp, + right: 10.sp, + ), + margin: + EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.sp), color: Color(0x33000000)), @@ -991,30 +1039,31 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 8.sp, + height: 24.sp, + child: Stack(children: widgets), + ) : Container(), SizedBox( width: 4.sp, ), widgets.isNotEmpty ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )), GestureDetector( - onTap: () async{ - pushMsgPage(lists, lists.interest!['id'].toString()); + onTap: () async { + pushMsgPage( + lists, lists.interest!['id'].toString()); // }); }, @@ -1025,7 +1074,6 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ], ), ), - ], ), ), @@ -1034,7 +1082,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin bottom: 2.sp, child: Container( width: Get.width - 4.sp - 20.sp, - child: circleInfoItem(lists.interest,lists,index), + child: circleInfoItem(lists.interest, lists, index), )) ], )), @@ -1057,32 +1105,43 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), ), if (showTitle) - Text('还没有您喜欢的圈友发布喊话哦~',style: TextStyle(color: Colors.white,fontSize: 16.sp),), + Text( + '还没有您喜欢的圈友发布喊话哦~', + style: TextStyle(color: Colors.white, fontSize: 16.sp), + ), Container( margin: EdgeInsets.only(top: 20.sp), - padding: EdgeInsets.only(left: 30.sp,right: 30.sp), + padding: EdgeInsets.only(left: 30.sp, right: 30.sp), child: Row( children: [ - Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)), + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), Container( - margin: EdgeInsets.only(left: 8.sp,right: 8.sp), + margin: EdgeInsets.only(left: 8.sp, right: 8.sp), height: 2.sp, decoration: BoxDecoration( - color: Colors.white.withOpacity(0.5), - borderRadius: BorderRadius.circular(1.sp) - ), + color: Colors.white.withOpacity(0.5), + borderRadius: BorderRadius.circular(1.sp)), + ), + Text( + '喊话推荐', + style: TextStyle(color: Colors.white, fontSize: 17.sp), ), - Text('喊话推荐',style: TextStyle(color: Colors.white,fontSize: 17.sp),), Container( - margin: EdgeInsets.only(left: 8.sp,right: 8.sp), + margin: EdgeInsets.only(left: 8.sp, right: 8.sp), height: 2.sp, decoration: BoxDecoration( - color: Colors.white.withOpacity(0.5), - borderRadius: BorderRadius.circular(1.sp) - ), + color: Colors.white.withOpacity(0.5), + borderRadius: BorderRadius.circular(1.sp)), ), - - Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)), + Expanded( + child: Container( + height: 2.sp, + color: Colors.white.withOpacity(0.5), + )), ], ), ) @@ -1091,23 +1150,21 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ); } - circleInfoItem(var bean,Lists list,int index) { + circleInfoItem(var bean, Lists list, int index) { return GestureDetector( onTap: () { Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean['id'].toString()); }, child: ClipRRect( - borderRadius: BorderRadius.circular( - 12.sp), + borderRadius: BorderRadius.circular(12.sp), child: Container( padding: EdgeInsets.only(left: 12.sp, right: 12.sp), height: 72.sp, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, - image: - AssetImage(getCircleImage('top_circle_bg')))), + image: AssetImage(getCircleImage('top_circle_bg')))), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -1130,68 +1187,79 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin child: ClipRRect( borderRadius: BorderRadius.circular(8.0), child: CachedNetworkImage( - imageUrl:bean['image'], + imageUrl: bean['image'], width: 40.sp, height: 40.sp, memCacheHeight: 40, memCacheWidth: 40, - fit:BoxFit.cover - ), + fit: BoxFit.cover), ), ), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['view_total'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + bean['title'], + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), ), - )), - GestureDetector(//加入圈子 + SizedBox( + height: 4.sp, + ), + Text( + // "view_total" -> 21 + '${convertToTenThousand(bean['view_total'])}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), + GestureDetector( + //加入圈子 onTap: () async { CircleLogic cLogic = Get.find(); if (bean['is_join']) { var data = await DioManager.instance.get( - url: "/up-service/interest/${bean['id']}",); + url: "/up-service/interest/${bean['id']}", + ); if (data["code"] == 200) { Circle info = Circle.fromJson(data['data']); - Get.bottomSheet( - CircleShare('','',info), isScrollControlled: true, - enableDrag: false - ); + Get.bottomSheet(CircleShare('', '', info), + isScrollControlled: true, enableDrag: false); } } else { await cLogic.outCircle( - bean['id'].toString(), - bean['is_join']); + bean['id'].toString(), bean['is_join']); bean['is_join'] = !bean['is_join']; - list.interest = bean; - lists[index] = list; - setState(() { + if (recomanddlists.isNotEmpty) { + recomanddlists.forEach((element) { + if (element.interest!['id'].toString() == bean['id'].toString()) { + element.interest!['is_join'] = true; + element.interest = element.interest!; + } + }); + } - }); + if (lists.isNotEmpty) { + lists.forEach((element) { + if (element.interest!['id'].toString() == bean['id'].toString()) { + element.interest!['is_join'] = true; + element.interest = element.interest!; + } + }); + } + setState(() {}); } }, child: Stack( @@ -1203,8 +1271,8 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), Text( !bean['is_join'] ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), + style: + TextStyle(color: Colors.white, fontSize: 12.sp), ) ], )) @@ -1214,9 +1282,9 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ); } - circleWidget(String url, String userId,{double width = 24}) { + circleWidget(String url, String userId, {double width = 24}) { return GestureDetector( - onTap: (){ + onTap: () { Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); }, child: Stack( @@ -1228,7 +1296,8 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin ), ClipOval( child: CachedNetworkImage( - imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + imageUrl: url ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", width: (width - 1).sp, height: (width - 1).sp, fit: BoxFit.cover, @@ -1240,8 +1309,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin )); } - void _showOutCircleDialog( - BuildContext context, var controller, var bean) { + void _showOutCircleDialog(BuildContext context, var controller, var bean) { showDialog( context: context, builder: (BuildContext context) { @@ -1283,7 +1351,7 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( @@ -1336,9 +1404,8 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin GestureDetector( onTap: () async { Navigator.pop(context); - await controller - .outCircle(bean['id'].toString(), bean['is_join']); - + await controller.outCircle( + bean['id'].toString(), bean['is_join']); }, child: Container( margin: EdgeInsets.only(top: 24.sp), @@ -1406,4 +1473,4 @@ class _LikeViewState extends State with AutomaticKeepAliveClientMixin // logic.update(); // } } -} \ No newline at end of file +} diff --git a/circle_app/lib/app/dialog/UnlockCallDialog.dart b/circle_app/lib/app/dialog/UnlockCallDialog.dart index 7f1d72a..4ee69a6 100644 --- a/circle_app/lib/app/dialog/UnlockCallDialog.dart +++ b/circle_app/lib/app/dialog/UnlockCallDialog.dart @@ -203,7 +203,7 @@ class UnlockCallDialog extends GetxController { child: Row( children: [ Text( - '¥${int.parse(amount)}', + '¥${double.parse(amount).toInt()}', style: TextStyle( color: Color(0xffE845FF), fontSize: 16.sp, @@ -213,7 +213,7 @@ class UnlockCallDialog extends GetxController { width: 2.sp, ), Text( - '(原价${int.parse(oldAmount)})', + '(原价${double.parse(oldAmount).toInt()})', style: TextStyle( color: Colors.white70, fontSize: 16.sp, diff --git a/circle_app/lib/app/dialog/UpdateDialog.dart b/circle_app/lib/app/dialog/UpdateDialog.dart index 0d6f247..ecd9b01 100644 --- a/circle_app/lib/app/dialog/UpdateDialog.dart +++ b/circle_app/lib/app/dialog/UpdateDialog.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -// import 'package:flutter_install_app/flutter_install_app.dart'; +import 'package:flutter_install_app/flutter_install_app.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -260,7 +260,7 @@ class _CustomDialogState extends State { // SmartDialog.dismiss(); print(error); }); - // await AppInstaller.installApk(filePath, actionRequired: false); + await AppInstaller.installApk(filePath, actionRequired: false); } } diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index f4f9aa6..d5a0e70 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -40,7 +40,16 @@ class HomeLogic extends GetxController { final RxString unreadSIze = "0".obs; final RxBool showcirlceUnred = false.obs; + late V2TimSimpleMsgListener msgListener; + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + TencentImSDKPlugin.v2TIMManager + .v2TIMMessageManager.removeAdvancedMsgListener(); + + } @override void onInit() async { @@ -55,11 +64,15 @@ class HomeLogic extends GetxController { tabs.add(MsgPage()); tabs.add(MinefragmentPage()); - EventBusManager.on().listen((event) { - getUnreadSize(); - }); + // EventBusManager.on().listen((event) { + // getUnreadSize(); + // }); getUnreadSize(); - var msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: ( + + + + + msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: ( msgID, userInfo, text, @@ -100,7 +113,7 @@ class HomeLogic extends GetxController { break; case 2://上线 - String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; + String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],2,(){ pushChatPage(content['id'].toString(), content['imId'], @@ -113,6 +126,25 @@ class HomeLogic extends GetxController { }); + TencentImSDKPlugin.v2TIMManager + .v2TIMMessageManager.addAdvancedMsgListener( + listener: V2TimAdvancedMsgListener( + onRecvNewMessage: (message) { + print(message); + if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) { + if ( message.customElem?.data != null) { + print(message.customElem!.data!); + Map jsonData = jsonDecode(message.customElem!.data!); + String event = jsonData['event'].toString(); + if (int.parse(event) == 3) { + showOKToast(message.customElem!.desc!.toString()); + EventBusManager.fire(LikeRefresh()); + } + } + } + } + ) + ); diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart index 506eeea..0df2c6c 100644 --- a/circle_app/lib/app/home/view.dart +++ b/circle_app/lib/app/home/view.dart @@ -18,7 +18,7 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State - with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin { + with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { @override bool get wantKeepAlive => true; @@ -27,7 +27,11 @@ class _HomePageState extends State void initState() { // TODO: implement initState super.initState(); - logic.tabController = TabController(length: 4, vsync: this, initialIndex: 0,animationDuration: Duration.zero); + logic.tabController = TabController( + length: 4, + vsync: this, + initialIndex: 0, + animationDuration: Duration.zero); } @override @@ -67,7 +71,7 @@ class _HomePageState extends State width: MediaQuery.of(context).size.width, // height: // Get.height - 49.sp + MediaQuery.of(context).padding.bottom, - decoration: const BoxDecoration(image: bgWidget), + decoration: const BoxDecoration(image: bgWidget), ), TabBarView( physics: const NeverScrollableScrollPhysics(), @@ -94,7 +98,8 @@ class _HomePageState extends State behavior: HitTestBehavior.opaque, onTap: () { if (!isSelected) { - logic.tabController.animateTo(index, duration: Duration(milliseconds: 0), curve: Curves.ease); + logic.tabController.animateTo(index, + duration: Duration(milliseconds: 0), curve: Curves.ease); controller.updateIndex(index); } }, @@ -113,24 +118,24 @@ class _HomePageState extends State gaplessPlayback: true, ))), // if (logic.showcirlceUnred.value && index == 1) - Obx(() => Visibility( - visible: index == 1 && controller.showcirlceUnred.value, - child: Positioned( - // right: 4.sp, - top: 10.sp, - child: Container( - - width: 14.sp, - height: 14.sp, - margin: EdgeInsets.only( - left:24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.sp), - gradient: LinearGradient( - colors: controller.showcirlceUnred.value ? [Color(0xFFC343F9), Color(0xFFFB34B2)] : [Color(0xFFC343F9), Color(0xFFFB34B2)]), - border: - Border.all(color: Color(0xFF170730), width: 1.sp))), - ))), + Obx(() => Visibility( + visible: index == 1 && controller.showcirlceUnred.value, + child: Positioned( + // right: 4.sp, + top: 10.sp, + child: Container( + width: 14.sp, + height: 14.sp, + margin: EdgeInsets.only(left: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.sp), + gradient: LinearGradient( + colors: controller.showcirlceUnred.value + ? [Color(0xFFC343F9), Color(0xFFFB34B2)] + : [Color(0xFFC343F9), Color(0xFFFB34B2)]), + border: + Border.all(color: Color(0xFF170730), width: 1.sp))), + ))), // Obx(() => null) Obx(() => Visibility( visible: index == 2 && controller.unreadSIze != "0", diff --git a/circle_app/lib/app/like/logic.dart b/circle_app/lib/app/like/logic.dart index 3880df8..d7fbbdf 100644 --- a/circle_app/lib/app/like/logic.dart +++ b/circle_app/lib/app/like/logic.dart @@ -155,6 +155,17 @@ class LikeLogic extends GetxController { showOKToast(bean.msg); } + setTopCircle(String interest_id,bool isStatus) async { + var data = await DioManager.instance.post( + url: Api.circleTop, + params: {"interestId": interest_id,'isTop' :isStatus ? 1 : 0}); + var bean = BaseResponse.fromJson(data, (data) => data); + if (bean.code == 200) { + relaodMyData(); + } + showOKToast(bean.msg); + } + loadCalloutsNew() async { List idList = []; diff --git a/circle_app/lib/app/like/view.dart b/circle_app/lib/app/like/view.dart index 608b7bf..4cfe535 100644 --- a/circle_app/lib/app/like/view.dart +++ b/circle_app/lib/app/like/view.dart @@ -1,9 +1,13 @@ + + import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/circle/logic.dart'; import 'package:circle_app/app/circle/widgets/info_list_view.dart'; import 'package:circle_app/app/select_circle/logic.dart'; import 'package:circle_app/common/Widgets/circle_share.dart'; import 'package:circle_app/common/Widgets/text_more.dart'; +import 'package:circle_app/main.dart'; +import 'package:circle_app/network/dio_manager.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; @@ -12,11 +16,48 @@ import 'package:get/get.dart'; import 'logic.dart'; -class LikePage extends StatelessWidget { +class LikePage extends StatefulWidget { LikePage({Key? key}) : super(key: key); + + @override + State createState() => _LikePageState(); +} + +class _LikePageState extends State with RouteAware { final ctr = Get.lazyPut(() => LikeLogic()); + final logic = Get.find(); + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); + } + + + @override + void dispose() { + routeObserver.unsubscribe(this); + super.dispose(); + } + + void didPopNext() { + print('didPopNext'); + logic.loadMyCircleData(); + } + + ///当前页面进入时触发 + void didPush() { + print('didPopNext'); + + } + void didPop() { + print('didPop'); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -70,7 +111,8 @@ class LikePage extends StatelessWidget { logic.currentIndex, logic.mycircle.lists[logic.currentIndex], logic, - key: ValueKey('${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'), + key: ValueKey( + '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'), ))) ], ), @@ -91,7 +133,7 @@ class LikePage extends StatelessWidget { child: ListView.builder( controller: logic.rightCtr, itemBuilder: (context, index) { - return circleInfoItem(logic.circle.lists[index]); + return circleInfoItem(logic.circle.lists[index],index); }, itemCount: logic.circle.lists.length, )), @@ -112,7 +154,7 @@ class LikePage extends StatelessWidget { ); } - circleInfoItem(Circle bean) { + circleInfoItem(Circle bean,int index) { List urlList = bean.lastJoinUsers; List widgets = []; int i = 0; @@ -133,10 +175,20 @@ class LikePage extends StatelessWidget { }); } return GestureDetector( - onTap: () { - // if (bean.isJoin) { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - // } + onTap: () async { + var result = await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); + var data = await DioManager.instance.get( + url: "/up-service/interest/${bean.id}",); + if (data["code"] == 200) { + var bean = Circle.fromJson(data['data']); + logic.circle.lists[index] = bean; + if (mounted) { + setState(() { + + }); + } + + } }, child: Container( margin: EdgeInsets.only(bottom: 10.sp), @@ -261,9 +313,9 @@ class LikePage extends StatelessWidget { additionText: '查看更多', maxLines: 3, style: - TextStyle(color: Colors.white, fontSize: 14.sp), + TextStyle(color: Colors.white, fontSize: 17.sp), additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 14.sp), + color: const Color(0xFFFF4DF6), fontSize: 17.sp), onTap: () { _showTextContentDialog( Get.context!, bean.intro, bean.title); @@ -365,6 +417,27 @@ class LikePage extends StatelessWidget { logic.update(); } }, + onLongPress: () { + if (index >= 0) { + int count = 0; + for(int i = 0; i < logic.mycircle.lists.length; i++) { + if (logic.mycircle.lists[i].is_top) { + count++; + } + if (count == 5 || i > 5) { + break; + } + } + + if (count == 5 && !logic.mycircle.lists[index].is_top) { + showOKToast('圈子置顶最多五个哦~'); + } else { + _showSetTopCircleDialog(Get.context!,logic,logic.mycircle.lists[index]); + } + + + } + }, child: Container( width: 65.sp, height: 65.sp, @@ -373,31 +446,35 @@ class LikePage extends StatelessWidget { alignment: Alignment.center, children: [ if (text.isEmpty) - Image.asset( - getCircleImage('circile_all_icon'), - width: 55.sp, - ), + topCicleStatusItem( + isSelcted, + Image.asset( + getCircleImage('circile_all_icon'), + width: 55.sp, + )), if (text.isNotEmpty) - Container( - margin: EdgeInsets.all(6.sp), - // padding: EdgeInsets.only(left: 4.sp), - alignment: Alignment.center, - padding: EdgeInsets.all(6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.sp), - gradient: LinearGradient( - colors: [Color(0xFF3F6967), Color(0xFF5C3769)])), - child: Text( - text, - maxLines: 2, - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - overflow: TextOverflow.ellipsis, - fontWeight: FontWeight.w600), - textAlign: TextAlign.center, - ), - ), + cicleStatusItem( + isSelcted, + Container( + // margin: EdgeInsets.all(6.sp), + // padding: EdgeInsets.only(left: 4.sp), + alignment: Alignment.center, + // padding: EdgeInsets.all(6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.sp), + gradient: LinearGradient( + colors: [Color(0xFF3F6967), Color(0xFF5C3769)])), + child: Text( + text, + maxLines: 2, + style: TextStyle( + color: Colors.white, + fontSize: 13.sp, + overflow: TextOverflow.ellipsis, + fontWeight: FontWeight.w600), + textAlign: TextAlign.center, + ), + )), if (isUnread) Positioned( right: 6.sp, @@ -406,7 +483,7 @@ class LikePage extends StatelessWidget { width: 15.sp, height: 15.sp, decoration: BoxDecoration( - shape: BoxShape.circle, + shape: BoxShape.circle, gradient: LinearGradient( colors: [Color(0xFFC343F9), Color(0xFFFB34B2)]), border: @@ -418,6 +495,77 @@ class LikePage extends StatelessWidget { ); } + cicleStatusItem(bool isSelected, Widget widget) { + return Container( + width: 48.sp, + height: 48.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.0), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: isSelected + ? [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ] + : [ + Colors.transparent, + Colors.transparent, + ], + stops: [0.0365, 0.9427], + ), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(7.0), + child: Container( + padding: EdgeInsets.all(isSelected ? 1.sp : 0.sp), + color: Color(0x14022AFF), + child: widget, + )), + ); + } + + topCicleStatusItem(bool isSelected, Widget widget) { + return Container( + alignment: Alignment.center, + width: 48.sp, + height: 48.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.0), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: isSelected + ? [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ] + : [ + Colors.transparent, + Colors.transparent, + ], + stops: [0.0365, 0.9427], + ), + ), + child: Container( + width: 47.sp, + height: 47.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.sp), + gradient: LinearGradient( + colors: [Color(0xFF3F6967), Color(0xFF5C3769)])), + // padding: EdgeInsets.all(isSelected ? 1.sp : 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(7.0), + child: Container( + margin: EdgeInsets.all(isSelected ? 1.sp : 0.sp), + color: Color(0x14022AFF), + child: widget, + ))), + ); + } + void _showTextContentDialog(BuildContext context, String msg, String title) { showDialog( context: context, @@ -498,4 +646,140 @@ class LikePage extends StatelessWidget { ); } + void _showSetTopCircleDialog(BuildContext context, var controller, var bean) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 160.sp, + padding: EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: LinearGradient( + colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.all(1.sp), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 24.sp), + child: Column( + children: [ + Center( + child: Text( + "提示", + style: + TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), + Container( + margin: EdgeInsets.only( + top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + bean.is_top ? "是否取消置顶该圈子。" : "是否置顶该圈子。", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Container( + margin: EdgeInsets.only(top: 30.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: LinearGradient( + colors: [ + Color(0x26FFFFFF), + Color(0x26FFFFFF), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: Text( + "否", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ), + SizedBox(width: 24.sp), + GestureDetector( + onTap: () { + Navigator.pop(context); + logic.setTopCircle(bean.id.toString(), !bean.is_top); + }, + child: Container( + margin: EdgeInsets.only(top: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: Text( + "是", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } } diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index 004ab23..fdc18bd 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:math'; +import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_slidable_for_tencent_im/flutter_slidable.dart'; @@ -41,9 +42,8 @@ class TIMConversation extends StatefulWidget { /// conversation controller final TIMUIKitConversationController? controller; - - final AutoScrollController? autoScrollController; + final AutoScrollController? autoScrollController; final ScrollController? scrollController; @@ -84,7 +84,7 @@ class TIMConversation extends StatefulWidget { this.controller, this.autoScrollController, this.itemSecondaryMenuBuilder, - this.scrollController, + this.scrollController, this.itemBuilder, this.isShowDraft = true, this.itemSlideBuilder, @@ -160,21 +160,30 @@ class _TIMConversationState extends TIMUIKitState { serviceLocator(); late TIMUIKitConversationController _timuiKitConversationController; final TUIThemeViewModel themeViewModel = serviceLocator(); - final TUIFriendShipViewModel friendShipViewModel = - serviceLocator(); - + // final TUIFriendShipViewModel friendShipViewModel = + // serviceLocator(); + bool hasMore = true; @override void initState() { super.initState(); final controller = getController(); + widget.scrollController!.addListener(() { + + try { + if (widget.scrollController!.position.pixels == + widget.scrollController!.position.maxScrollExtent && hasMore) { + _timuiKitConversationController.loadData(); + } + } catch (_) {} + }); _timuiKitConversationController = controller; _timuiKitConversationController.model = model; } scrollToTop() { widget.autoScrollController!.animateTo( - 0.0, // Scroll to the top + 0, // Scroll to the top duration: Duration(milliseconds: 300), curve: Curves.easeInOut, ); @@ -191,10 +200,10 @@ class _TIMConversationState extends TIMUIKitState { model.setSelectedConversation(conversation); } - _clearHistory(V2TimConversation conversationItem) async{ - await _timuiKitConversationController.clearHistoryMessage( + _clearHistory(V2TimConversation conversationItem) async { + await _timuiKitConversationController.clearHistoryMessage( conversation: conversationItem); - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(Duration(seconds: 1)); EventBusManager.fire(RefreshUnread()); } @@ -204,8 +213,8 @@ class _TIMConversationState extends TIMUIKitState { isPinned: !conversation.isPinned!); } - _deleteConversation(V2TimConversation conversation) async{ - await _timuiKitConversationController.deleteConversation( + _deleteConversation(V2TimConversation conversation) async { + await _timuiKitConversationController.deleteConversation( conversationID: conversation.conversationID); await Future.delayed(Duration(seconds: 1)); EventBusManager.fire(RefreshUnread()); @@ -217,15 +226,15 @@ class _TIMConversationState extends TIMUIKitState { (element) => (element?.groupID != null || element?.userID != null)) .toList(); - // 过滤指定的 userID + // 过滤指定的 userID qpqz_prod_10_10000000000 String devtTargetUserID = "qpqz_dev_10_10000000000"; - String prodTargetUserID = "qpqz_dev_10_10000000000"; + String prodTargetUserID = "qpqz_prod_10_10000000000"; filteredConversationList = filteredConversationList .where((conversation) => - conversation?.userID != devtTargetUserID ||conversation?.userID != prodTargetUserID) + conversation?.userID != devtTargetUserID && + conversation?.userID != prodTargetUserID) .toList(); - if (widget.conversationCollector != null) { filteredConversationList = filteredConversationList .where(widget.conversationCollector!) @@ -384,14 +393,12 @@ class _TIMConversationState extends TIMUIKitState { return MultiProvider( providers: [ ChangeNotifierProvider.value(value: model), - ChangeNotifierProvider.value(value: friendShipViewModel) + // ChangeNotifierProvider.value(value: friendShipViewModel) ], builder: (BuildContext context, Widget? w) { final _model = Provider.of(context); - bool haveMoreData = _model.haveMoreData; - final _friendShipViewModel = - Provider.of(context); - _model.lifeCycle = widget.lifeCycle; + hasMore = _model.haveMoreData; + // _model.lifeCycle = widget.lifeCycle; List filteredConversationList = getFilteredConversation(); @@ -413,31 +420,43 @@ class _TIMConversationState extends TIMUIKitState { future: getUserListInfo(userIdList), builder: (BuildContext context, AsyncSnapshot> snapshot) { + // if (snapshot.connectionState != ConnectionState.done || + // haveMoreData) { + // if (haveMoreData) { + // _timuiKitConversationController.loadData(); + // } + // + // return Container(); + // } + return ListView.builder( controller: widget.scrollController!, shrinkWrap: true, itemCount: filteredConversationList.length, itemBuilder: (context, index) { - if (index == filteredConversationList.length - 1) { - if (haveMoreData) { - _timuiKitConversationController.loadData(); - } - } + // if (index == filteredConversationList.length - 1) { + // if (haveMoreData) { + // loaddingWidget(true); + // // _timuiKitConversationController.loadData(); + // } else { + // return Container(); + // } + // } final conversationItem = filteredConversationList[index]; - final V2TimUserStatus? onlineStatus = - _friendShipViewModel.userStatusList.firstWhere( - (item) => - item.userID == conversationItem?.userID, - orElse: () => - V2TimUserStatus(statusType: 0)); + // final V2TimUserStatus? onlineStatus = + // _friendShipViewModel.userStatusList.firstWhere( + // (item) => + // item.userID == conversationItem?.userID, + // orElse: () => + // V2TimUserStatus(statusType: 0)); - if (widget.itemBuilder != null) { - return widget.itemBuilder!( - conversationItem!, onlineStatus); - } + // if (widget.itemBuilder != null) { + // return widget.itemBuilder!( + // conversationItem!, onlineStatus); + // } final slideChildren = _getSlideBuilder()(conversationItem!); @@ -454,28 +473,38 @@ class _TIMConversationState extends TIMUIKitState { ConnectionState.done) { if ((snapshot.data ?? []).isNotEmpty) { snapshot.data!.forEach((element) { - if (element.userID == conversationItem.userID) { + if (element.userID == + conversationItem.userID) { userFullInfo = element; } }); //自己的信息 - V2TimUserFullInfo myuserFullInfo =snapshot.data!.where((element) => element.userID! == model.selfInfoViewModel.loginInfo!.userID!).toList().first; - + V2TimUserFullInfo myuserFullInfo = snapshot + .data! + .where((element) => + element.userID! == + model.selfInfoViewModel.loginInfo! + .userID!) + .toList() + .first; if (userFullInfo!.customInfo! .containsKey('Label')) { - var otherInfo = jsonDecode(userFullInfo! + if (userFullInfo! .customInfo!['Label'] - .toString()); - Map myInfo = jsonDecode(myuserFullInfo! - .customInfo!['Label'] - .toString()); - if (myInfo != null) { - if (myInfo.containsKey('city')) { - if (myInfo['city'] - .toString() - .contains(otherInfo['city'].toString())) { - isSameCity = true; + .toString().isNotEmpty) { + var otherInfo = jsonDecode(userFullInfo! + .customInfo!['Label'] + .toString()); + Map myInfo = jsonDecode(myuserFullInfo! + .customInfo!['Label'] + .toString()); + if (myInfo != null) { + if (myInfo.containsKey('city')) { + if (myInfo['city'].toString().contains( + otherInfo['city'].toString())) { + isSameCity = true; + } } } } @@ -483,7 +512,7 @@ class _TIMConversationState extends TIMUIKitState { if (userFullInfo != null) { List userIdList = - userFullInfo!.userID!.split('_'); + userFullInfo!.userID!.split('_'); if (userIdList.length >= 4) { if (int.parse(userIdList[2]) == 10) { isOfficial = true; @@ -493,7 +522,6 @@ class _TIMConversationState extends TIMUIKitState { } } } - } Widget conversationLineItem() { @@ -524,7 +552,7 @@ class _TIMConversationState extends TIMUIKitState { conversationItem.userID != null && conversationItem .userID!.isNotEmpty) - ? onlineStatus + ? null : null, draftTimestamp: conversationItem.draftTimestamp, @@ -590,20 +618,18 @@ class _TIMConversationState extends TIMUIKitState { ? widget.emptyBuilder!() : Container()); } - - return TUIKitScreenUtils.getDeviceWidget( + // EasyRefresh( + // header: CustomizeBallPulseHeader(color: theme.primaryColor), + // onRefresh: () async { + // model.refresh(); + // }, + // child: + return TUIKitScreenUtils.getDeviceWidget( defaultWidget: SlidableAutoCloseBehavior( - child: EasyRefresh( - header: CustomizeBallPulseHeader(color: theme.primaryColor), - onRefresh: () async { - model.refresh(); - }, - child:SingleChildScrollView( - controller: widget.scrollController, - child: conversationList(), - ), + child: conversationList(), + ), - ), + desktopWidget: Scrollbar( controller: widget.autoScrollController!, child: conversationList())); diff --git a/circle_app/lib/app/msg/logic.dart b/circle_app/lib/app/msg/logic.dart index 7bb853a..d6923d0 100644 --- a/circle_app/lib/app/msg/logic.dart +++ b/circle_app/lib/app/msg/logic.dart @@ -3,17 +3,20 @@ import 'package:circle_app/network/api.dart'; import 'package:circle_app/network/dio_manager.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; - +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'state.dart'; class MsgLogic extends GetxController { final MsgState state = MsgState(); List lists = []; + ScrollController listScrollController = ScrollController(); + @override void onInit() { // TODO: implement onInit super.onInit(); + loadLikeData(); } loadLikeData() async { diff --git a/circle_app/lib/app/msg/view.dart b/circle_app/lib/app/msg/view.dart index 4ad3b14..59846ee 100644 --- a/circle_app/lib/app/msg/view.dart +++ b/circle_app/lib/app/msg/view.dart @@ -23,12 +23,16 @@ import 'logic.dart'; const msgBgWidget = DecorationImage( fit: BoxFit.fill, image: AssetImage('assets/images/base/home_back.png')); -class MsgPage extends StatelessWidget { +class MsgPage extends StatefulWidget { MsgPage({Key? key}) : super(key: key); + @override + State createState() => _MsgPageState(); +} + +class _MsgPageState extends State with AutomaticKeepAliveClientMixin { final ctr = Get.put(MsgLogic()); - - + var logic = Get.find(); void getPipeiData() async { var data = await DioManager.instance .get(url: Api.getMatch); @@ -46,7 +50,6 @@ class MsgPage extends StatelessWidget { } } - showRechargeDialog(){ Get.bottomSheet( Scaffold( @@ -73,7 +76,19 @@ class MsgPage extends StatelessWidget { // tipWidget(), // reconmandWidget(), // Text(controller.state.msg), - Expanded(child: msgWdiget(context)) + 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(AppRoutes.Sys_notify_list, arguments: selectedConv); + return; + } + Get.toNamed(AppRoutes.Chat, arguments: selectedConv); + + }, + )) ], ); }), @@ -371,4 +386,8 @@ class MsgPage extends StatelessWidget { Widget msgItem(conv, status) { return Container(); } + + @override + // TODO: implement wantKeepAlive + bool get wantKeepAlive => true; } diff --git a/circle_app/lib/app/my_circle/view.dart b/circle_app/lib/app/my_circle/view.dart index b23fb0a..4220fec 100644 --- a/circle_app/lib/app/my_circle/view.dart +++ b/circle_app/lib/app/my_circle/view.dart @@ -504,140 +504,5 @@ class _My_circlePageState extends State ); } - void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认退出该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Navigator.pop(context); - logic.outCircle(bean.id.toString(), bean.isJoin); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } + } diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index a37b173..f50acba 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -272,8 +272,8 @@ class MyTabbedScreenState extends State borderRadius: BorderRadius.circular(17.sp), gradient: const LinearGradient( colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), + Color(0xaaDC5BFD), + Color(0xaa06F9FA), ], begin: Alignment.centerLeft, end: Alignment.centerRight, diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index dcb586c..d657443 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -33,6 +33,9 @@ import 'package:tencent_chat_push_for_china/tencent_chat_push_for_china.dart'; import 'app/login/login/logic.dart'; import 'app/splash/view.dart'; +///定义全局的 routeObserver 对象 +final RouteObserver routeObserver = RouteObserver(); + final CoreServicesImpl coreInstance = TIMUIKitCore.getInstance(); final TUIChatSeparateViewModel chatSeparateViewModel = TUIChatSeparateViewModel(); @@ -524,6 +527,7 @@ class _MyAppState extends State with WidgetsBindingObserver { Locale('en', 'US'), ], home: SplashPage(), + navigatorObservers: [routeObserver], builder: FlutterSmartDialog.init(), debugShowCheckedModeBanner: false, ))); diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index 49070bf..3c2470a 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -303,6 +303,7 @@ class Api { //获取多个圈子是否有新喊话 static const calloutsNew = '/up-service/interests/callouts/new'; - +//是否置顶圈子 + static const circleTop = '/up-service/interest/top'; } \ No newline at end of file diff --git a/circle_app/lib/util/eventBus.dart b/circle_app/lib/util/eventBus.dart index bbb651a..2448e13 100644 --- a/circle_app/lib/util/eventBus.dart +++ b/circle_app/lib/util/eventBus.dart @@ -62,4 +62,9 @@ class ScrollToTop { class RefreshUnread { +} + + +class LikeRefresh { + } \ No newline at end of file diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart index f437f2c..8c9aeda 100644 --- a/circle_app/lib/util/util.dart +++ b/circle_app/lib/util/util.dart @@ -315,6 +315,24 @@ class CustomLoadFooter extends StatelessWidget { } } + +class CustomLikeLoadFooter extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ClassicFooter( + // 自定义加载更多时的文字 + canLoadingText: "松手开始加载数据", + loadingText: "正在加载...", + idleText: "上拉加载更多", + noDataText: "", + height: 20.sp, + spacing: 5, + failedText: "加载失败", + ); + } +} + + // 获取应用程序的文档目录路径 Future getApplicationDocumentsDirectoryPath() async { final directory = await getApplicationDocumentsDirectory(); diff --git a/circle_app/lib/view/notice.dart b/circle_app/lib/view/notice.dart index 421d5ce..92b0970 100644 --- a/circle_app/lib/view/notice.dart +++ b/circle_app/lib/view/notice.dart @@ -170,7 +170,7 @@ void showFloatingButtonOverlay( countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) { if (countdownSeconds > 0) { countdownSeconds--; - // overlayEntry.markNeedsBuild(); // 刷新 OverlayEntry + // overlayEntry.markNeedsBuild(); // 刷新 OverlayEntry } else { timer.cancel(); // 取消计时器 diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index 0ddb926..f8baf87 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -606,6 +606,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.3" + flutter_install_app: + dependency: "direct main" + description: + name: flutter_install_app + sha256: "9b117006d17c900e671c26bcbc9b15c7b8efd15d6f9b4442ad5d576de20fab53" + url: "https://pub.dev" + source: hosted + version: "1.3.0" flutter_intl: dependency: "direct main" description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 2be09f0..af33f4c 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -95,7 +95,7 @@ dependencies: #event_bus: event_bus: ^2.0.0 #安装apk -# flutter_install_app: 1.3.0 + flutter_install_app: 1.3.0 #闪屏页 flutter_native_splash: 2.2.16 #腾讯离线推送