From 3d8c3f9cc35abfa714c8cd31fa15a2e7c8e2845d Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Tue, 29 Aug 2023 11:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=88=E5=AD=90=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=9B=BE=E7=89=87=E5=8A=A0=E8=BD=BD=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=BA=A2=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/circle/widgets/info_list_view.dart | 900 +++++++++--------- 1 file changed, 457 insertions(+), 443 deletions(-) diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart index d12c969..1eea8a4 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -20,10 +20,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import '../../../util/SharedPreferencesHelper.dart'; import '../../../util/eventBus.dart'; -const listBgWidget = Image( - image: AssetImage('assets/images/circle/circle_bg.png'), - fit: BoxFit.fill, -); + class InfoListView extends StatefulWidget { // Get.lazyPut(() => ListLogic()); @@ -88,7 +85,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } catch (_) {} }); circleId = widget.bean.id.toString(); + + // if (Get.currentRoute == AppRoutes.Home || Get.currentRoute == AppRoutes.MyCircle) { loadCallOutListData(); + // } + + + callRefreshCicle = EventBusManager.on().listen((event) { if(widget.bean.id.toString() == event.circleId){ loadCallOutListData(); @@ -104,7 +107,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ); }); - // widget.back(widget.createState()); + // widget.back(widget.createState()); } @@ -195,23 +198,23 @@ class InfoListViewState extends State with AutomaticKeepAliveClien void pushMsgPage(Lists 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; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - },widget.bean.ios_item); - return; - } + // if (widget.bean.is_limit&&widget.bean.amount>0) { + // showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ + // widget.bean.is_limit = false; + // if (Get.isRegistered()) { + // var logic = Get.find(); + // for (var element in logic.circle.lists) { + // if (element.id == widget.bean.id) { + // element.is_limit = false; + // element.isJoin = true; + // } + // } + // logic.update(); + // } + // Get.back(); + // },widget.bean.ios_item); + // return; + // } var sp = await SharedPreferencesHelper.getInstance(); String myUserId = sp.getMyUserId(); @@ -222,19 +225,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // 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!); - await Future.delayed(Duration(seconds: 1)); - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID)??0; - String avatar = sharedPreferences.getString(SharedPreferencesHelper.AVATAR)??""; - String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??""; - bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name)); - widget.logic.update(); - // }); + pushChatPage(data['data']['account_id'].toString().split("_").last,data['data']['account_id'], bean.user!.nickname!); + await Future.delayed(Duration(seconds: 1)); + SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); + // SharedPreferencesHelper.getInstance().then((sharedPreferences) { + int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID)??0; + String avatar = sharedPreferences.getString(SharedPreferencesHelper.AVATAR)??""; + String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??""; + bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name)); + widget.logic.update(); } } @@ -243,7 +245,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien List urlList = widget.bean.lastJoinUsers; List widgets = []; int i = 0; - // print(urlList); + // print(urlList); if(null!=urlList){ urlList.forEach((element) { if(widgets.length>2){ @@ -251,7 +253,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } 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++; }); @@ -263,14 +265,17 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: Container( width: Get.width, margin: - EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp), + EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp), child: Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(10.sp), child: SizedBox( width: Get.width, - child: listBgWidget + child: Image.asset( + getCircleImage('circle_bg'), + fit: BoxFit.fill, + ), )), Container( height: Get.height, @@ -288,94 +293,96 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // : loaddingWidget(true) // : ListView.builder( - physics: const AlwaysScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: lists.length + 2, - itemBuilder: (context, index) { - if (index == 0) { - return Container( - padding: EdgeInsets.only( - left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width, - // height: 50.sp, - child: HideText(text: widget.bean.intro,additionText: '查看更多',maxLines: 3,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { - _showTextContentDialog( - context, widget.bean.intro,widget.bean.title); - }, + physics: const AlwaysScrollableScrollPhysics(), + addAutomaticKeepAlives:false, + addRepaintBoundaries:false, + scrollDirection: Axis.vertical, + controller: scrollController, + itemCount: lists.length + 2, + itemBuilder: (context, index) { + if (index == 0) { + return Container( + padding: EdgeInsets.only( + left: 12.sp, right: 12.sp), + // height:urlList.length==0?47.sp: 118.sp, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('circle_desc')))), + child: Container( + margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 7.sp), + width: Get.width, + // height: 50.sp, + child: HideText(text: widget.bean.intro,additionText: '查看更多',maxLines: 3,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { + _showTextContentDialog( + context, widget.bean.intro,widget.bean.title); + }, )), - GestureDetector( - behavior:HitTestBehavior.opaque, - onTap: (){ - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); - }, - child:urlList.length==0?Container(): Row( + GestureDetector( + behavior:HitTestBehavior.opaque, + onTap: (){ + // showToast("点个鸡毛,星哥还没做"); + // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); + }, + child:urlList.length==0?Container(): Row( + children: [ + Row( children: [ - Row( - children: [ - SizedBox( - height: 30.sp, - width: 30.0.sp + - 15.sp * - (widgets.length - - 1.sp), - child: Stack( - children: widgets, - ), - ), - SizedBox( - width: 8.sp, - ), - Text( - '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp), - ), - SizedBox( - width: 8.sp, - ), - // Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ) - ], - ) + SizedBox( + height: 30.sp, + width: 30.0.sp + + 15.sp * + (widgets.length - + 1.sp), + child: Stack( + children: widgets, + ), + ), + SizedBox( + width: 8.sp, + ), + Text( + '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, + fontSize: 12.sp), + ), + SizedBox( + width: 8.sp, + ), + // Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ) ], - ), - ), - ], + ) + ], + ), ), - ), - ); - } else if (lists.length + 1 > index) { - Lists list = lists[index - 1]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - } else { - return Container( - margin: EdgeInsets.only( - top: callOutMore ? 0 : 10.sp), - child: loaddingWidget(callOutMore)); - } - }), + ], + ), + ), + ); + } else if (lists.length + 1 > index) { + Lists list = lists[index - 1]; + if (list.isQueen!) { + return vipDynamicItem(list); + } else { + return normalDynamicItem(list); + } + } else { + return Container( + margin: EdgeInsets.only( + top: callOutMore ? 0 : 10.sp), + child: loaddingWidget(callOutMore)); + } + }), ), ), ClipRRect( @@ -389,7 +396,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien image: DecorationImage( fit: BoxFit.fill, image: - AssetImage(getCircleImage('top_circle_bg')))), + AssetImage(getCircleImage('top_circle_bg')))), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -411,11 +418,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien padding: EdgeInsets.all(1.sp), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), - child: Image.network( - widget.bean.image, - width: 40.sp, - height: 40.sp, - fit:BoxFit.cover + child: CachedNetworkImage( + imageUrl:widget.bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + fit:BoxFit.cover ), ), ), @@ -430,33 +439,33 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ); }, child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + // alignment: Alignment., + height: 72.sp, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.bean.title, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + height: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - ), + ), )), GestureDetector(//加入圈子 onTap: () async { @@ -537,7 +546,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien left: 0, right: 0, child: Center(child: Text(title, style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)), + color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)), Container( margin: EdgeInsets.only(top: 24.sp,bottom: 24.sp), child: Container( @@ -553,16 +562,16 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), ), Positioned( - top:8.sp, + top:8.sp, right: 10.sp, child: GestureDetector( onTap: () { Get.back(); }, child: Icon( - Icons.close,color: Colors.white, - size: 20.sp, - ), + Icons.close,color: Colors.white, + size: 20.sp, + ), )), ], ), @@ -700,83 +709,83 @@ class InfoListViewState extends State with AutomaticKeepAliveClien pushHomePage(lists, lists.id.toString()); }, child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: Image.network( - lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - )), + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl:lists.user!.avatar_thumb!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + ), + ) + ], + )), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + 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, + ) + ], ), SizedBox( - width: 8.sp, + height: 4.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: + 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, - ), - ), - ) + 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, + ), + ), + ) + ], + ), ], ), - ], - ), - )), + )), ], ), ), @@ -790,51 +799,51 @@ class InfoListViewState extends State with AutomaticKeepAliveClien 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: 34.sp, @@ -850,27 +859,27 @@ class InfoListViewState extends State with AutomaticKeepAliveClien children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 12.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 12.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: 12.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + )), GestureDetector( onTap: () { pushMsgPage(lists, widget.bean.id.toString(),); @@ -1006,83 +1015,85 @@ class InfoListViewState extends State with AutomaticKeepAliveClien pushHomePage(lists, lists.id.toString()); }, child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: Image.network( - lists.user!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - )), + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl:lists.user!.avatar_thumb!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + memCacheHeight: 40, + memCacheWidth: 40, + ), + ) + ], + )), Expanded( child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + 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, + ) + ], ), SizedBox( - width: 8.sp, + height: 4.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: + 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, - ), - ), - ) + 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, + ), + ), + ) + ], + ), ], ), - ], - ), - )), + )), ], ), ), @@ -1093,64 +1104,64 @@ class InfoListViewState extends State with AutomaticKeepAliveClien ), 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: 34.sp, @@ -1166,31 +1177,32 @@ class InfoListViewState extends State with AutomaticKeepAliveClien children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 12.sp, - height: 24.sp, - child: Stack(children: widgets), - ) + width: 24 + 12.sp * widgets.length - 12.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: 12.sp), - )) + child: Text( + '${lists.chat!.count!}位圈友已私聊', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + )) : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - )), + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + )), GestureDetector( onTap: () async{ pushMsgPage(lists, widget.bean.id.toString()); + // }); }, child: Image.asset( getCircleImage('chat'), @@ -1208,26 +1220,28 @@ class InfoListViewState extends State with AutomaticKeepAliveClien circleWidget(String url, String userId,{double width = 30}) { return GestureDetector( - onTap: (){ - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, + onTap: (){ + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + }, child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: Image.network( - url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: width.sp, + ), + ClipOval( + child: CachedNetworkImage( + imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + width: (width - 1).sp, + height: (width - 1).sp, + fit: BoxFit.cover, + memCacheHeight: width.toInt() - 1, + memCacheWidth: width.toInt() - 1, + ), + ) + ], + )); } void _showOutCircleDialog( @@ -1273,7 +1287,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container(