diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index 73d5bce..3877ade 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 21 - versionName "1.2.7" + versionCode 24 + versionName "1.3.2" manifestPlaceholders = [ vivo_APPID: "105669716", vivo_APPKEY:"84f750207787376b310ca5b0d5969122", diff --git a/circle_app/assets/images/circle/callout_icon.png b/circle_app/assets/images/circle/callout_icon.png new file mode 100644 index 0000000..4341393 Binary files /dev/null and b/circle_app/assets/images/circle/callout_icon.png differ diff --git a/circle_app/assets/images/circle/circile_all_icon.png b/circle_app/assets/images/circle/circile_all_icon.png new file mode 100644 index 0000000..501fdee Binary files /dev/null and b/circle_app/assets/images/circle/circile_all_icon.png differ diff --git a/circle_app/assets/images/tabbar/like_normal.png b/circle_app/assets/images/tabbar/like_normal.png new file mode 100644 index 0000000..1fb9c3b Binary files /dev/null and b/circle_app/assets/images/tabbar/like_normal.png differ diff --git a/circle_app/assets/images/tabbar/like_selected.png b/circle_app/assets/images/tabbar/like_selected.png new file mode 100644 index 0000000..de146fa Binary files /dev/null and b/circle_app/assets/images/tabbar/like_selected.png differ diff --git a/circle_app/ios/Runner.xcodeproj/project.pbxproj b/circle_app/ios/Runner.xcodeproj/project.pbxproj index 0fe606b..6144de6 100644 --- a/circle_app/ios/Runner.xcodeproj/project.pbxproj +++ b/circle_app/ios/Runner.xcodeproj/project.pbxproj @@ -381,7 +381,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.5; + MARKETING_VERSION = 1.2.6; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -530,7 +530,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.5; + MARKETING_VERSION = 1.2.6; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -573,7 +573,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.5; + MARKETING_VERSION = 1.2.6; PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/circle_app/ios/Runner/Info.plist b/circle_app/ios/Runner/Info.plist index 37fb641..e35fb11 100644 --- a/circle_app/ios/Runner/Info.plist +++ b/circle_app/ios/Runner/Info.plist @@ -10,9 +10,11 @@ CFBundleTypeRole Editor CFBundleURLName - + weixin CFBundleURLSchemes - + + wxab2387c2198f01e1 + LSApplicationQueriesSchemes diff --git a/circle_app/ios/Runner/Runner.entitlements b/circle_app/ios/Runner/Runner.entitlements index ab3837e..0c67376 100644 --- a/circle_app/ios/Runner/Runner.entitlements +++ b/circle_app/ios/Runner/Runner.entitlements @@ -1,10 +1,5 @@ - - com.apple.developer.associated-domains - - applinks:https://www.leyuan666.com/ - - + diff --git a/circle_app/lib/app/call_out/logic.dart b/circle_app/lib/app/call_out/logic.dart index 640b152..8306218 100644 --- a/circle_app/lib/app/call_out/logic.dart +++ b/circle_app/lib/app/call_out/logic.dart @@ -37,7 +37,7 @@ class Call_outLogic extends GetxController { var quToken = ''; VideoPlayerController? videoPlayerController; List numbers = []; - List myConfigData = Get.arguments['numbers']; + List? myConfigData; int vip = 0; bool isZfbPrice = true; @@ -51,24 +51,7 @@ class Call_outLogic extends GetxController { @override void onInit() async { super.onInit(); - if (myConfigData != null) { - // print(myConfigData.name); - numbers.addAll(myConfigData); - if(numbers.length>0){ - circleName = numbers[0].name; - } - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - vip = sharedPreferences.getInt(SharedPreferencesHelper.VIP); - print(vip); - if (vip == 2) { - isCheck = true; - } - update(); - }); - - update(); - } var data = await DioManager.instance.get(url: Api.getCircleList, params: {}); @@ -80,11 +63,51 @@ class Call_outLogic extends GetxController { showOKToast(bean.msg); } - var quniuData = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var qiniuBean = BaseResponse.fromJson( - quniuData, (quniuData) => QnTokenData.fromJson(quniuData)); - quToken = qiniuBean.data!.token.toString(); + Map arg = Get.arguments; + + if (arg != null) { + // print(myConfigData.name); + List myConfigData = Get.arguments['numbers']; + numbers.addAll(myConfigData); + if(numbers.length>0) { + circleName = numbers[0].name; + } + update(); + } else { + var data = await DioManager.instance + .get(url: Api.getMyCircleInterests, params: {"page": 1,'page_size':20}); + + var bean = BaseResponse.fromJson( + data, (data) => InterestsBean.fromJson(data)); + + InterestsBean info = bean.data; + + if (info.lists.isNotEmpty) { + Circle circle = info.lists.first; + MyConfigData configData = MyConfigData(circle.id.toString(),circle.title,true); + numbers.add(configData); + if(numbers.length>0){ + circleName = numbers[0].name; + } + + + update(); + } + + + } + + SharedPreferencesHelper.getInstance().then((sharedPreferences) { + vip = sharedPreferences.getInt(SharedPreferencesHelper.VIP); + print(vip); + if (vip == 2) { + isCheck = true; + } + update(); + }); + + + loadQiniuToken(); StreamSubscription subscription = EventBusManager.on().listen((event) { @@ -92,6 +115,14 @@ class Call_outLogic extends GetxController { }); } + Future loadQiniuToken() async { + var quniuData = + await DioManager.instance.get(url: Api.getqiniuToken, params: {}); + var qiniuBean = BaseResponse.fromJson( + quniuData, (quniuData) => QnTokenData.fromJson(quniuData)); + quToken = qiniuBean.data!.token.toString(); + } + showRechargeDialog() { Get.bottomSheet( Scaffold( diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index c126f7c..f0b45f7 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -198,7 +198,7 @@ class CircleLogic extends GetxController { if (data['code'] == 200) { statistics.value = myAlbumBean.data; - // update(); + update(); } } @@ -305,6 +305,7 @@ class CircleLogic extends GetxController { vicinityList.addAll(bean.data.users); vicinityPage = vicinityPage + 1; } on Exception {} + update(); } else if (bean.code == 21201) { myVip = 0; refreshController.loadComplete(); @@ -478,7 +479,7 @@ class InterestsBean { InterestsBean({required this.lists}); factory InterestsBean.fromJson(Map json) { - List listsJson = json['lists']; + List listsJson = json.containsKey('lists') ? json['lists'] : json; List lists = listsJson.map((e) => Circle.fromJson(e)).toList(); return InterestsBean(lists: lists); } @@ -518,24 +519,28 @@ class Circle { }); factory Circle.fromJson(Map json) { - List lastJoinUsersJson = json['last_join_users']; - List lastJoinUsers = - lastJoinUsersJson.map((e) => JoinUser.fromJson(e)).toList(); + List lastJoinUsers = []; + if (json.containsKey('last_join_users')) { + List lastJoinUsersJson = json['last_join_users']; + lastJoinUsers = + lastJoinUsersJson.map((e) => JoinUser.fromJson(e)).toList(); + } + return Circle( id: json['id'], is_limit: json['is_limit'] ?? false, - image: json['image'], + image: json['image'] ?? '', ios_item: json['ios_item'] ?? '', - title: json['title'], - intro: json['intro'], - amount: json['amount'].toDouble(), - oldAmount: json['old_amount'].toDouble(), - lastCalloutTime: json['last_callout_time'], - isJoin: json['is_join'], - isLike: json['is_like'], - viewTotal: json['view_total'], - joinTotal: json['join_total'], + title: json['title'] ?? '', + intro: json['intro'] ?? '', + amount: json.containsKey('amount') ? json['amount'].toDouble() ?? 0 : 0, + oldAmount: json.containsKey('amount') ? json['old_amount'].toDouble() ?? 0 : 0, + lastCalloutTime: json['last_callout_time'] ?? '', + isJoin: json['is_join'] ?? false, + isLike: json['is_like'] ?? false, + viewTotal: json['view_total'] ?? 0, + joinTotal: json['join_total'] ?? 0, lastJoinUsers: lastJoinUsers, ); } diff --git a/circle_app/lib/app/circle/view.dart b/circle_app/lib/app/circle/view.dart index 526ed33..f003104 100644 --- a/circle_app/lib/app/circle/view.dart +++ b/circle_app/lib/app/circle/view.dart @@ -3,8 +3,10 @@ import 'dart:math'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/circle/widgets/discover.dart'; import 'package:circle_app/app/circle/widgets/info_list_view.dart'; +import 'package:circle_app/app/circle/widgets/like_view.dart'; import 'package:circle_app/app/circle/widgets/vicinity.dart'; import 'package:circle_app/app/dialog/ScreenBottomSheetDialog.dart'; +import 'package:circle_app/app/like/view.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/eventBus.dart'; import 'package:circle_app/util/util.dart'; @@ -24,7 +26,7 @@ const bgWidget = DecorationImage( fit: BoxFit.fill, image: AssetImage('assets/images/base/home_back.png')); class CirclePage extends StatefulWidget { - CirclePage({Key? key}) : super(key: key); + const CirclePage({Key? key}) : super(key: key); @override State createState() => _CirclePageState(); @@ -37,6 +39,14 @@ class _CirclePageState extends State int currentIndex = 0; + + final logic = Get.find(); + + final state = Get.find().state; + + var getContext; + + // 是否需要缓存 @override bool get wantKeepAlive => true; @@ -45,10 +55,12 @@ class _CirclePageState extends State @override void initState() { super.initState(); + currentIndex = Random().nextInt(3); _pageController = PageController(initialPage: currentIndex); _tabController = TabController(length: 3, vsync: this, initialIndex: currentIndex); _tabController.addListener(_handleTabChange); + getContext = context; } void _handleTabChange() { @@ -59,12 +71,6 @@ class _CirclePageState extends State logic.update(); } - // 是否需要缓存 - final logic = Get.put(CircleLogic()); - - final state = Get.find().state; - - var getContext; @override void dispose() { @@ -76,13 +82,13 @@ class _CirclePageState extends State @override Widget build(BuildContext context) { - getContext = context; - return GetBuilder(builder: (logic) { + super.build(context); + + return GetBuilder(builder: (controller) { return Scaffold( backgroundColor: Colors.transparent, body: SafeArea( - child: GetBuilder(builder: (CircleLogic controller) { - return Stack( + child:Stack( children: [ Column(children: [ Obx(() { @@ -93,42 +99,44 @@ class _CirclePageState extends State ]), Container( margin: EdgeInsets.only(top: 45.sp), - child: PageView( - controller: _pageController, - onPageChanged: (index) { - _tabController.animateTo(index); - print("index=" + index.toString()); - }, + child: TabBarView( + controller: _tabController, + // controller: _pageController, + // onPageChanged: (index) { + // _tabController.animateTo(index); + // print("index=" + index.toString()); + // }, children: [ - circleList(controller), + LikeView(), + // circleList(controller), Vicinity(controller), Discover(0) ], ), ), - _tabController.index == 0 - ? Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - List numbers = []; - numbers.add(MyConfigData( - logic.getCircleIndex().id.toString(), - logic.getCircleIndex().title!, - false)); - var data = await Get.toNamed(AppRoutes.Call_out, - arguments: {'numbers': numbers}); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 60.sp, - ))) - : Center() + // _tabController.index == 0 + // ? Positioned( + // bottom: 36.sp, + // right: 10.sp, + // child: GestureDetector( + // onTap: () async { + // List numbers = []; + // numbers.add(MyConfigData( + // logic.getCircleIndex().id.toString(), + // logic.getCircleIndex().title!, + // false)); + // var data = await Get.toNamed(AppRoutes.Call_out, + // arguments: {'numbers': numbers}); + // }, + // child: Image.asset( + // getCircleImage('send_msg'), + // width: 60.sp, + // ))) + // : Center() ], - ); - }), - ), + ) + ), + ); }); } @@ -691,7 +699,7 @@ class _CirclePageState extends State tabs: [ Tab( child: Text( - '圈子', + '喜欢', style: TextStyle( fontSize: 20.sp, ), @@ -750,11 +758,11 @@ class _CirclePageState extends State return; } currentIndex = index; - _pageController.animateToPage( - index, // 目标页面索引 - duration: const Duration(milliseconds: 300), // 动画时长 - curve: Curves.ease, // 动画曲线 - ); + // _pageController.animateToPage( + // index, // 目标页面索引 + // duration: const Duration(milliseconds: 300), // 动画时长 + // curve: Curves.ease, // 动画曲线 + // ); }, ), @@ -766,11 +774,11 @@ class _CirclePageState extends State child: _tabController.index == 0 ? GestureDetector( onTap: () { - Get.toNamed(AppRoutes.MyCircle, arguments: ''); + Get.toNamed(AppRoutes.Call_out); }, child: Image.asset( - getCircleImage('my_circle'), - width: 64.sp, + getCircleImage('callout_icon'), + width: 75.sp, ), ) : GestureDetector( diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart index 870f59e..99ca9a0 100644 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ b/circle_app/lib/app/circle/widgets/discover.dart @@ -507,7 +507,7 @@ class _DiscoverState extends State user.userId.toString()); }), SizedBox( - height: 10.sp, + height: 15.sp, ), Row( children: [ @@ -562,13 +562,13 @@ class _DiscoverState extends State ), Container( width: Get.width - 120.sp, - margin: EdgeInsets.only(top: 5.sp), + margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), child: Text( user.signature! ?? '', overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( - fontSize: 15.sp, + fontSize: 16.sp, color: const Color(0XFFF7FAFA)), ), ), 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 f654b61..ccc9d08 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -6,7 +6,10 @@ import 'package:circle_app/app/circle/logic.dart'; import 'package:circle_app/app/circle/state.dart'; import 'package:circle_app/app/circle/widgets/list_logic.dart'; import 'package:circle_app/app/circle/widgets/video_item.dart'; +import 'package:circle_app/app/like/logic.dart'; +import 'package:circle_app/app/select_circle/logic.dart'; import 'package:circle_app/common/Widgets/base_tip_widget.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'; @@ -53,6 +56,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien List lists = []; + @override void dispose() { // TODO: implement dispose @@ -92,29 +96,42 @@ class InfoListViewState extends State with AutomaticKeepAliveClien + callRefreshCicle = EventBusManager.on().listen((event) { if(widget.bean.id.toString() == event.circleId){ loadCallOutListData(); } }); - - scroToTop = EventBusManager.on().listen((event) { - if (widget.logic.state.index == widget.index) { - scrollController.animateTo( - 0.0, - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - } - - }); + // + // scroToTop = EventBusManager.on().listen((event) { + // if (widget.logic.state.index == widget.index) { + // scrollController.animateTo( + // 0.0, + // duration: Duration(milliseconds: 300), + // curve: Curves.easeInOut, + // ); + // } + // + // }); // widget.back(widget.createState()); } + loadCircleInfo() async{ + var data = await DioManager.instance.get( + url: "/up-service/interest/$circleId",); + if (data["code"] == 200) { + widget.bean = Circle.fromJson(data['data']); + if (mounted) { + setState(() { + }); + } + + } + } loadCallOutListData() async { var data = await DioManager.instance.get( @@ -143,6 +160,8 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } } + + setCircleId(String id) { circleId = id; loadCallOutListData(); @@ -245,6 +264,9 @@ class InfoListViewState extends State with AutomaticKeepAliveClien @override Widget build(BuildContext context) { + if (widget.bean.image.isEmpty) { + loadCircleInfo(); + } List urlList = widget.bean.lastJoinUsers; List widgets = []; int i = 0; @@ -267,17 +289,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien borderRadius: BorderRadius.circular(10.sp), child: Container( width: Get.width, - margin: - EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp), + // margin: + child: Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(10.sp), child: SizedBox( width: Get.width, + height: Get.height, child: Image.asset( getCircleImage('circle_bg'), - fit: BoxFit.fill, + fit: BoxFit.cover, ), )), Container( @@ -321,7 +344,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien 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: () { + child: HideText(text: widget.bean.intro,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 60.sp,additionText: '查看更多',maxLines: 3,style: TextStyle(color: Colors.white, fontSize: 17.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 17.sp),onTap: () { _showTextContentDialog( context, widget.bean.intro,widget.bean.title); }, @@ -333,39 +356,51 @@ class InfoListViewState extends State with AutomaticKeepAliveClien // showToast("点个鸡毛,星哥还没做"); // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); }, - child:urlList.length==0?Container(): Row( - children: [ - Row( - children: [ - SizedBox( - height: 30.sp, - width: 30.0.sp + - 15.sp * - (widgets.length - - 1.sp), - child: Stack( - children: widgets, - ), + child:urlList.length==0?Container(): Container( + height: 30.sp, + child: Row( + children: [ + SizedBox( + height: 30.sp, + width: 30.0.sp + + 15.sp * + (widgets.length - + 1.sp), + child: Stack( + alignment: Alignment.center, + 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( + width: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, + fontSize: 12.sp), + ), + SizedBox( + width: 8.sp, + ), + // GestureDetector( + // onTap: () { + // Get.bottomSheet( + // CircleShare('','',widget.bean), isScrollControlled: true, + // enableDrag: false + // ); + // }, + // child: Container( + // height: 30.sp, + // alignment: Alignment.center, + // child: Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ), + // ), + // ) + ], + ), ), ), ], @@ -403,32 +438,39 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl:widget.bean.image, - width: 40.sp, - height: 40.sp, - memCacheHeight: 40, - memCacheWidth: 40, - fit:BoxFit.cover + GestureDetector( + onTap: () { + if (widget.bean.isJoin) { + _showOutCircleDialog(Get.context!, widget.logic, widget.bean); + } + }, + child: Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), ), + padding: EdgeInsets.all(1.sp), + child: widget.bean.image.isNotEmpty ? ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl:widget.bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + fit:BoxFit.cover + ) , + ) : Container(), ), ), Expanded( @@ -473,8 +515,10 @@ class InfoListViewState extends State with AutomaticKeepAliveClien GestureDetector(//加入圈子 onTap: () async { if (widget.bean.isJoin) { - _showOutCircleDialog( - context, widget.logic, widget.bean); + Get.bottomSheet( + CircleShare('','',widget.bean), isScrollControlled: true, + enableDrag: false + ); } else { await widget.logic.outCircle( widget.bean.id.toString(), @@ -490,7 +534,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien width: 77.sp, ), Text( - !widget.bean.isJoin ? '申请加入' : '已加入', + !widget.bean.isJoin ? '申请加入' : '分享有奖', style: TextStyle( color: Colors.white, fontSize: 12.sp), ) @@ -505,6 +549,26 @@ class InfoListViewState extends State with AutomaticKeepAliveClien getCircleImage('circle_line'), width: Get.width, )), + if (Get.currentRoute == AppRoutes.Home) + Positioned( + bottom: 36.sp, + right: 10.sp, + child: GestureDetector( + onTap: () async { + List numbers = []; + numbers.add(MyConfigData( + widget.bean.id.toString(), + widget.bean.title, + false)); + var data = await Get.toNamed( + AppRoutes.Call_out, + arguments: {'numbers': numbers} + ); + }, + child: Image.asset( + getCircleImage('send_msg'), + width: 70.sp, + ))) ], ))); } @@ -588,7 +652,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien vipDynamicItem(Lists lists) { Text descText = Text( lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), + style: TextStyle(color: Colors.white, fontSize: 17.sp), maxLines: 2, ); @@ -624,10 +688,11 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Album info = lists.album!.first; if (info.type == 1) { + double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3; if (lists.album!.length > 3) { - picHeight = 218.sp; + picHeight = picWidth * 2; } else { - picHeight = 109.sp; + picHeight = picWidth; } } else { picHeight = 140.sp; @@ -635,7 +700,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien } } - double widgetHeight = 140.sp + contentHeight(lists.content!) + picHeight; + double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; return Container( margin: EdgeInsets.only(top: 10.sp), @@ -657,17 +722,17 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Positioned( right: 2.sp, top: 2.sp, - height: 18.sp, + child: Stack( alignment: Alignment.center, children: [ Image.asset( getCircleImage('location'), - height: 20.sp, + height: 30.sp, ), Text( lists.user!.city ?? '外星', - style: TextStyle(color: Colors.white, fontSize: 12.sp), + style: TextStyle(color: Colors.white, fontSize: 15.sp), ) ], ), @@ -849,20 +914,18 @@ class InfoListViewState extends State with AutomaticKeepAliveClien }), ), Container( - height: 34.sp, + height: 30.sp, padding: EdgeInsets.only(left: 5.sp, right: 10.sp), - margin: EdgeInsets.only(top: 5.sp), + margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 5.sp), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [Color(0xff261240), Color(0xff122D40)])), + borderRadius: BorderRadius.circular(15.sp), + color: Color(0x33000000) + ), child: Row( children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 12.sp, + width: 24 + 12.sp * widgets.length - 8.sp, height: 24.sp, child: Stack(children: widgets), ) @@ -875,13 +938,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: Text( '${lists.chat!.count!}位圈友已私聊', style: TextStyle( - color: Colors.white, fontSize: 12.sp), + color: Colors.white, fontSize: 14.sp), )) : Expanded( child: Text( '赶紧成为第一位私聊ta的圈友吧', style: TextStyle( - color: Colors.white, fontSize: 12.sp), + color: Colors.white, fontSize: 14.sp), )), GestureDetector( onTap: () { @@ -907,7 +970,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien normalDynamicItem(Lists lists) { Text descText = Text( lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), + style: TextStyle(color: Colors.white, fontSize: 17.sp), // maxLines: 2, ); @@ -917,10 +980,11 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Album info = lists.album!.first; if (info.type == 1) { + double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3; if (lists.album!.length > 3) { - picHeight = 218.sp; + picHeight = picWidth * 2; } else { - picHeight = 109.sp; + picHeight = picWidth; } } else { picHeight = 140.sp; @@ -952,7 +1016,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien return Container( margin: EdgeInsets.only(top: 10.sp), width: Get.width, - height: 130.sp + contentHeight(lists.content!) + picHeight, + height: 120.sp + contentHeight(lists.content!) + picHeight, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -969,19 +1033,19 @@ class InfoListViewState extends State with AutomaticKeepAliveClien children: [ Image.asset( getCircleImage('location'), - height: 20.sp, + height: 30.sp, ), Text( lists.user!.city ?? '外星', - style: TextStyle(color: Colors.white, fontSize: 12.sp), + style: TextStyle(color: Colors.white, fontSize: 15.sp), ) ], ), // height: 18.sp, ), Container( - height: 130.sp + contentHeight(lists.content!) + picHeight, width: Get.width, + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), child: Column( children: [ @@ -1167,20 +1231,17 @@ class InfoListViewState extends State with AutomaticKeepAliveClien })) : Container(), Container( - height: 34.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), - margin: EdgeInsets.only(top: 5.sp), + height: 30.sp, + padding: EdgeInsets.only(left: 5.sp, right: 10.sp,), + margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 10.sp), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [Color(0xff261240), Color(0xff122D40)])), + borderRadius: BorderRadius.circular(15.sp), + color: Color(0x33000000)), child: Row( children: [ widgets.isNotEmpty ? SizedBox( - width: 24 + 12.sp * widgets.length - 12.sp, + width: 24 + 12.sp * widgets.length - 8.sp, height: 24.sp, child: Stack(children: widgets), ) @@ -1193,13 +1254,13 @@ class InfoListViewState extends State with AutomaticKeepAliveClien child: Text( '${lists.chat!.count!}位圈友已私聊', style: TextStyle( - color: Colors.white, fontSize: 12.sp), + color: Colors.white, fontSize: 14.sp), )) : Expanded( child: Text( '赶紧成为第一位私聊ta的圈友吧', style: TextStyle( - color: Colors.white, fontSize: 12.sp), + color: Colors.white, fontSize: 14.sp), )), GestureDetector( onTap: () async{ @@ -1213,15 +1274,137 @@ class InfoListViewState extends State with AutomaticKeepAliveClien )) ], ), - ) + ), + ], ), - ) + ), + // Positioned( + // bottom: 0, + // child: Container( + // width: Get.width - 26.sp, + // child: circleInfoItem(), + // )) ], )); } - circleWidget(String url, String userId,{double width = 30}) { + circleInfoItem() { + return ClipRRect( + borderRadius: BorderRadius.circular( + 10.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')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl:widget.bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + fit:BoxFit.cover + ), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + scrollController.animateTo( + 0.0, // Scroll to the top + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }, + 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), + ), + SizedBox( + height: 4.sp, + ), + Text( + '${convertToTenThousand(widget.bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + ), + )), + GestureDetector(//加入圈子 + onTap: () async { + if (widget.bean.isJoin) { + Get.bottomSheet( + CircleShare('','',widget.bean), isScrollControlled: true, + enableDrag: false + ); + } else { + await widget.logic.outCircle( + widget.bean.id.toString(), + widget.bean.isJoin); + widget.logic.update(); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('add'), + width: 77.sp, + ), + Text( + !widget.bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + )) + ], + ), + )); + } + + circleWidget(String url, String userId,{double width = 24}) { return GestureDetector( onTap: (){ Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); @@ -1345,7 +1528,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien Navigator.pop(context); await widget.logic .outCircle(bean.id.toString(), bean.isJoin); - widget.logic.update(); + // widget.logic.update(); }, child: Container( margin: EdgeInsets.only(top: 24.sp), @@ -1389,7 +1572,7 @@ class InfoListViewState extends State with AutomaticKeepAliveClien double contentHeight(String content) { return calculateTextHeight( - content, 14.sp, FontWeight.w300, Get.width - 64.sp, 100); + content, 17.sp, FontWeight.w300, Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 64.sp, 100); } void refreshCircleData() async { @@ -1400,10 +1583,10 @@ class InfoListViewState extends State with AutomaticKeepAliveClien .get(url: 'up-service/interest/${widget.bean.id}'); if (data['code'] == 200) { widget.bean = Circle.fromJson(data['data']); - widget.logic.updateCircleInfo(widget.bean); - setState(() { - - }); + // widget.logic.updateCircleInfo(widget.bean); + // setState(() { + // + // }); // final logic = Get.put(CircleLogic()); // logic.update(); diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart new file mode 100644 index 0000000..03f79f9 --- /dev/null +++ b/circle_app/lib/app/circle/widgets/like_view.dart @@ -0,0 +1,1409 @@ +import 'dart:async'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/circle/state.dart'; +import 'package:circle_app/app/circle/widgets/video_item.dart'; +import 'package:circle_app/app/home/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/SharedPreferencesHelper.dart'; +import 'package:circle_app/util/eventBus.dart'; +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:shared_preferences/shared_preferences.dart'; + +class LikeView extends StatefulWidget { + + @override + _LikeViewState createState() => _LikeViewState(); + +} + +class _LikeViewState extends State with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; + final ScrollController scrollController = ScrollController(); + + + // ListLogic? listsLg; + + int callOutPage = 1; + int recomandPage = 1; + + bool isLoad = true; + bool likeMore = true; + bool recomandMore = true; + var circleId = ''; + List lists = []; + List recomanddlists = []; + + @override + void dispose() { + // TODO: implement dispose + + if(null!=scroToTop){ + EventBusManager.cancelSubscription(scroToTop!); + + } + scrollController.dispose(); + super.dispose(); + + + } + + StreamSubscription? callRefreshCicle =null; + StreamSubscription? scroToTop =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) { + // if (widget.logic.state.index == widget.index) { + scrollController.animateTo( + 0.0, + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + // } + + }); + + // widget.back(widget.createState()); + } + + + + + loadLikeListData() async { + if (likeMore) { + var data = await DioManager.instance.get( + url: "/up-service/follow/callouts", + params: {"page": callOutPage, "page_size": "20"}); + if (data["code"] == 200) { + List dataList = data["data"]["lists"] ?? []; + if (callOutPage == 1) { + lists.clear(); + } + if (dataList.isNotEmpty) { + likeMore = true; + for (var element in dataList) { + lists.add(Lists.fromJson(element)); + } + callOutPage++; + } + likeMore = dataList.length == 20; + if (!likeMore) { + loadRecomdistData(); + } + if (mounted) { + setState(() {}); + } + } else { + showOKToast(data["msg"]); + } + } else { + loadRecomdistData(); + } + } + + loadRecomdistData() async { + var data = await DioManager.instance.get( + url: "/up-service/recommend/callouts", + params: {"page": recomandPage, "page_size": "20"}); + if (data["code"] == 200) { + List dataList = data["data"]["lists"] ?? []; + if (recomandPage == 1) { + if (recomanddlists.isNotEmpty) { + recomanddlists.clear(); + } + } + if (dataList.isNotEmpty) { + recomandMore = true; + for (var element in dataList) { + recomanddlists.add(Lists.fromJson(element)); + } + recomandPage++; + } + recomandMore = dataList.length == 20; + if (mounted) { + setState(() {}); + } + } else { + showOKToast(data["msg"]); + } + } + + setCircleId(String id) { + circleId = id; + loadLikeListData(); + } + + void refreshData() { + callOutPage = 1; + likeMore = true; + loadLikeListData(); + } + + void loadMore() { + if (recomandMore == false) return; + loadLikeListData(); + } + + void pushOtherPeopleHomePage(String userId) { + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + + // if (bean.isQueen) { + // showJoinCiclePiker(cicleId); + // } else { + //跳转消息页面 + // Get.bottomSheet(Open_vip_tipPage(), + // isScrollControlled: true, + // enableDrag: false, + // ); + // } + } + + void pushHomePage(var bean, String cicleId) async { + // SharedPreferencesHelper.getInstance().then((sharedPreferences) { + // int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); + // if (bean.user!.id == userId) { + // Get.toNamed(AppRoutes.UserInfoActivity); + // } else { + Get.toNamed(AppRoutes.UserInfoActivity, + arguments: bean.user!.id!.toString()); + // } + // }); + + + + + + // if (bean.isQueen) { + // showJoinCiclePiker(cicleId); + // } else { + //跳转消息页面 + // Get.bottomSheet(Open_vip_tipPage(), + // isScrollControlled: true, + // enableDrag: false, + // ); + // } + } + + 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; + // 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(); + if (bean.user!.id.toString() == myUserId) { + showOKToast('无法与自己私聊'); + return; + } + // if () + + var data = await DioManager.instance.get( + 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(); + } + } + + @override + Widget build(BuildContext context) { + List urlList = []; + List widgets = []; + int i = 0; + // print(urlList); + if(null!=urlList){ + urlList.forEach((element) { + 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()), + )); + i++; + }); + } + + + return ClipRRect( + borderRadius: BorderRadius.circular(10.sp), + child: Container( + width: Get.width, + 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); + } + } 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), + ) + ], + ), + ), + )); + } + }), + ), + + )); + } + + void _showTextContentDialog(BuildContext context, String msg,String title) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 300.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const 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: const LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Positioned( + top: 15, + left: 0, + right: 0, + child: Center(child: Text(title, style: TextStyle( + color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)), + Container( + margin: EdgeInsets.only(top: 24.sp,bottom: 24.sp), + child: Container( + 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), + ),), + ), + ), + Positioned( + top:8.sp, + right: 10.sp, + child: GestureDetector( + onTap: () { + Get.back(); + }, + child: Icon( + Icons.close,color: Colors.white, + size: 20.sp, + ), + )), + ], + ), + ), + ); + }, + ); + } + + ///至尊喊话 + vipDynamicItem(Lists lists) { + Text descText = Text( + lists.content!, + style: TextStyle(color: Colors.white, fontSize: 17.sp), + maxLines: 2, + ); + + // List urlList = bean.lastJoinUsers; + List widgets = []; + int index = 0; + for (var element in lists.chat!.users!) { + widgets.add(Positioned( + left: 12.sp * index, + child: GestureDetector( + onTap: () { + // pushOtherPeopleHomePage(element.id.toString()); + }, + child: circleWidget(element.avatar!,element.id.toString(), width: 24), + ), + )); + index++; + } + if (widgets.isNotEmpty) { + widgets.add(Positioned( + left: 12.sp * lists.chat!.users!.length, + child: Image.asset( + getCircleImage('more'), + width: 24.sp, + ))); + } + + 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; + if (lists.album!.length > 3) { + picHeight = picWidth * 2; + } else { + picHeight = picWidth; + } + } else { + picHeight = 140.sp; + } + } + } + + double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; + + return GestureDetector( + onTap: () async { + 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()); + }, + child: Container( + margin: EdgeInsets.only(top: 10.sp), + width: Get.width, + height: widgetHeight, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('pic_bg'), + ))), + child: Stack(children: + + [ + + Positioned( + left: 0, + top: 2.sp, + height: 18.sp, + child: Image.asset(getCircleImage('vip_say')), + ), + Positioned( + right: 2.sp, + top: 2.sp, + + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('location'), + height: 30.sp, + ), + Text( + lists.user!.city ?? '外星', + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ) + ], + ), + ), + Container( + height: widgetHeight, + width: Get.width, + padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), + child: Column( + children: [ + SizedBox( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Stack( + 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( + 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( + 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, + ), + ), + ) + ], + ), + ], + ), + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + Container( + height: picHeight, + 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]; + 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, + 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) + ), + child: Row( + children: [ + widgets.isNotEmpty + ? SizedBox( + 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), + )) + : Expanded( + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )), + GestureDetector( + onTap: () { + pushMsgPage(lists, lists.interest!['id'].toString(),); + // pushHomePage( + // lists, widget.bean.id.toString()); + }, + child: Image.asset( + getCircleImage('chat'), + width: 60.sp, + ), + ) + ], + ), + ) + ], + ), + ), + Positioned( + bottom: 2.sp, + left: 2.sp, + child: Container( + width: Get.width - 4.sp - 20.sp, + child: circleInfoItem(lists.interest,lists,index), + )) + ])), + ); + } + + ///普通图文喊话 + normalDynamicItem(Lists lists) { + Text descText = Text( + lists.content!, + style: TextStyle(color: Colors.white, fontSize: 17.sp), + // maxLines: 2, + ); + + 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; + if (lists.album!.length > 3) { + picHeight = picWidth * 2; + } else { + picHeight = picWidth; + } + } else { + picHeight = 140.sp; + } + } + } + + List widgets = []; + int index = 0; + lists.chat!.users!.forEach((element) { + widgets.add(Positioned( + left: 12.sp * index, + child: GestureDetector( + onTap: () { + }, + child: circleWidget(element.avatar!,element.id.toString(), width: 24), + ), + )); + index++; + }); + if (widgets.isNotEmpty) { + widgets.add(Positioned( + left: 12.sp * lists.chat!.users!.length, + child: Image.asset( + getCircleImage('more'), + width: 24.sp, + ))); + } + return GestureDetector( + onTap: () async { + 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()); + }, + child: Container( + margin: EdgeInsets.only(top: 10.sp), + width: Get.width, + height: 120.sp + contentHeight(lists.content!) + picHeight + 76.sp, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('normal_bg'), + ))), + child: Stack( + children: [ + Positioned( + right: 2.sp, + top: 2.sp, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('location'), + height: 30.sp, + ), + Text( + lists.user!.city ?? '外星', + style: TextStyle(color: Colors.white, fontSize: 15.sp), + ) + ], + ), + // height: 18.sp, + ), + Container( + width: Get.width, + + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + child: Column( + children: [ + SizedBox( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Stack( + 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( + 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( + 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, + ), + ), + ) + ], + ), + ], + ), + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + 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, + ), + ), + ); + })) + : Container(), + Container( + height: 30.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)), + child: Row( + children: [ + widgets.isNotEmpty + ? SizedBox( + 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), + )) + : Expanded( + child: Text( + '赶紧成为第一位私聊ta的圈友吧', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + )), + GestureDetector( + onTap: () async{ + pushMsgPage(lists, lists.interest!['id'].toString()); + + // }); + }, + child: Image.asset( + getCircleImage('chat'), + width: 60.sp, + )) + ], + ), + ), + + ], + ), + ), + Positioned( + left: 2.sp, + bottom: 2.sp, + child: Container( + width: Get.width - 4.sp - 20.sp, + child: circleInfoItem(lists.interest,lists,index), + )) + ], + )), + ); + } + + tipItem() { + bool showTitle = lists.isEmpty; + return Container( + margin: EdgeInsets.only(top: showTitle ? 20.sp : 0, bottom: 0.sp), + // height: 30.sp, + child: Column( + children: [ + if (showTitle) + Container( + margin: EdgeInsets.only(bottom: 8.sp), + child: Image.asset( + getBaseImage('no_result'), + width: 200.sp, + ), + ), + if (showTitle) + 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), + child: Row( + children: [ + Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)), + Container( + 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) + ), + ), + Text('喊话推荐',style: TextStyle(color: Colors.white,fontSize: 17.sp),), + Container( + 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) + ), + ), + + Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)), + ], + ), + ) + ], + ), + ); + } + + 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), + 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')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl:bean['image'], + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + 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, + ), + ), + ], + ), + )), + GestureDetector(//加入圈子 + onTap: () async { + CircleLogic cLogic = Get.find(); + if (bean['is_join']) { + var data = await DioManager.instance.get( + url: "/up-service/interest/${bean['id']}",); + if (data["code"] == 200) { + Circle info = Circle.fromJson(data['data']); + Get.bottomSheet( + CircleShare('','',info), isScrollControlled: true, + enableDrag: false + ); + } + } else { + await cLogic.outCircle( + bean['id'].toString(), + bean['is_join']); + bean['is_join'] = !bean['is_join']; + list.interest = bean; + lists[index] = list; + setState(() { + + }); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('add'), + width: 77.sp, + ), + Text( + !bean['is_join'] ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + )) + ], + ), + )), + ); + } + + circleWidget(String url, String userId,{double width = 24}) { + return GestureDetector( + onTap: (){ + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + }, + child: Stack( + 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( + BuildContext context, var controller, var bean) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 160.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const 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: const 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: const 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: const 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.sp, + ), + ), + ), + ), + SizedBox(width: 24.sp), + GestureDetector( + onTap: () async { + Navigator.pop(context); + await controller + .outCircle(bean['id'].toString(), bean['is_join']); + + }, + child: Container( + margin: EdgeInsets.only(top: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: Text( + "是", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + }, + ); + } + + double contentHeight(String content) { + return calculateTextHeight( + content, 17.sp, FontWeight.w300, Get.width - 64.sp, 100); + } + + void refreshCircleData() async { + var routePath = Get.currentRoute; + if (routePath == AppRoutes.Signal_circle_list) return; + + // var data = await DioManager.instance + // .get(url: 'up-service/interest/${widget.bean.id}'); + // if (data['code'] == 200) { + // widget.bean = Circle.fromJson(data['data']); + // widget.logic.updateCircleInfo(widget.bean); + // setState(() { + // + // }); + // // final logic = Get.put(CircleLogic()); + // // logic.update(); + // + // }else if(data['code'] == 404){ + // var logic = Get.put(CircleLogic()); + // logic.circle.lists.removeAt(logic.state.index); + // logic.update(); + // } + } +} \ No newline at end of file diff --git a/circle_app/lib/app/circle/widgets/vicinity.dart b/circle_app/lib/app/circle/widgets/vicinity.dart index ea4c7d2..1f73826 100644 --- a/circle_app/lib/app/circle/widgets/vicinity.dart +++ b/circle_app/lib/app/circle/widgets/vicinity.dart @@ -248,7 +248,7 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin margin: EdgeInsets.only(top: 10.sp), // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), width: Get.width, - height: 200.sp, + height: 210.sp, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -264,14 +264,12 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin topLeft: Radius.circular(10.sp), topRight: Radius.circular(10.sp), ), - child: item.images.length == 0 - ? Image( + child: Image( image: AssetImage(getCircleImage("icon_list_null")), width: Get.width, fit: BoxFit.fill, height: 92.sp, ) - : Container(), ), ), Column(children: [ @@ -355,7 +353,7 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin ), ), Container( - height: 38.sp, // 设置固定高度 + height: 55.sp, // 设置固定高度 width: Get.width, margin: EdgeInsets.symmetric(horizontal: 8.0), child: Align( @@ -363,7 +361,7 @@ class _VicinityState extends State with AutomaticKeepAliveClientMixin child: Text( item.signature, maxLines: 2, - style: TextStyle(color: Colors.white, fontSize: 14.sp), + style: TextStyle(color: Colors.white, fontSize: 18.sp), overflow: TextOverflow.ellipsis, ), ), diff --git a/circle_app/lib/app/dialog/UnlockCallDialog.dart b/circle_app/lib/app/dialog/UnlockCallDialog.dart index e555c60..7f1d72a 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( - '¥$amount', + '¥${int.parse(amount)}', style: TextStyle( color: Color(0xffE845FF), fontSize: 16.sp, @@ -213,7 +213,7 @@ class UnlockCallDialog extends GetxController { width: 2.sp, ), Text( - '(原价$oldAmount)', + '(原价${int.parse(oldAmount)})', 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 ecd9b01..0d6f247 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/binding.dart b/circle_app/lib/app/home/binding.dart index 80dd392..b476cb9 100644 --- a/circle_app/lib/app/home/binding.dart +++ b/circle_app/lib/app/home/binding.dart @@ -1,3 +1,4 @@ +import 'package:circle_app/app/circle/logic.dart'; import 'package:get/get.dart'; import 'logic.dart'; @@ -6,5 +7,6 @@ class HomeBinding extends Bindings { @override void dependencies() { Get.lazyPut(() => HomeLogic()); + Get.lazyPut(() => CircleLogic()); } } diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index 513fa23..f4f9aa6 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/like/view.dart'; import 'package:circle_app/app/minefragment/logic.dart'; import 'package:circle_app/main.dart'; import 'package:circle_app/network/api.dart'; @@ -26,25 +27,32 @@ import '../msg/view.dart'; import 'state.dart'; class HomeLogic extends GetxController { - PageController pageController = PageController(initialPage: 1); - int currentIndex = 1; + late TabController tabController; + + int currentIndex = 0; Widget currentPage = Container(); final HomeState state = HomeState(); - final List tabs = []; - var circlePage = CirclePage(); + List tabs = []; static final MessageService _messageService = serviceLocator(); final RxString unreadSIze = "0".obs; + final RxBool showcirlceUnred = false.obs; + + @override void onInit() async { super.onInit(); + getIMData(); - tabs.add(MsgPage()); + + tabs.add(CirclePage()); + tabs.add(LikePage()); + tabs.add(MsgPage()); tabs.add(MinefragmentPage()); EventBusManager.on().listen((event) { @@ -110,6 +118,12 @@ class HomeLogic extends GetxController { _messageService.addSimpleMsgListener(listener: msgListener); + checkVersion(); + } + + + + Future checkVersion() async { var data = await DioManager.instance.get(url: Api.APP_VERSION); var bean = BaseResponse.fromJson( data, (data) => UpdateInfo.fromJson(data)); @@ -174,6 +188,10 @@ class HomeLogic extends GetxController { super.onReady(); FlutterNativeSplash.remove(); + final logic = Get.find(); + logic.loadCirclePeopleData(); + + } void showReportDialog( @@ -206,13 +224,13 @@ class HomeLogic extends GetxController { updateIndex(int index) { currentIndex = index; - if (index == 1) { + if (index == 0) { final logic = Get.put(CircleLogic()); logic.loadCirclePeopleData(); - } else if (index == 2) { + } else if (index == 3) { final logic = Get.put(MinefragmentLogic()); logic.getMode(); - } else { + } else if (index == 2) { getUnreadSize(); } update(); diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart index 0b63f75..506eeea 100644 --- a/circle_app/lib/app/home/view.dart +++ b/circle_app/lib/app/home/view.dart @@ -1,5 +1,7 @@ - import 'package:circle_app/app/circle/view.dart'; +import 'package:circle_app/app/like/view.dart'; +import 'package:circle_app/app/minefragment/view.dart'; +import 'package:circle_app/app/msg/view.dart'; import 'package:circle_app/util/util.dart'; import 'package:circle_app/view/ExitAppConfirmation.dart'; import 'package:flutter/material.dart'; @@ -16,62 +18,71 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State - with AutomaticKeepAliveClientMixin { + with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin { @override bool get wantKeepAlive => true; - final logic = Get.lazyPut(() => HomeLogic()); - final state = Get.find().state; + HomeLogic logic = Get.find(); + @override + void initState() { + // TODO: implement initState + super.initState(); + logic.tabController = TabController(length: 4, vsync: this, initialIndex: 0,animationDuration: Duration.zero); + } @override Widget build(BuildContext context) { - super.build(context); - return GetBuilder(builder: (HomeLogic controller) { - return ExitAppConfirmation(child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color.fromRGBO(15, 10, 31, 1.0), - bottomNavigationBar: Container( - height: 49.sp + MediaQuery.of(context).padding.bottom, - width: Get.width, - // color: Colors.red, - padding: EdgeInsets.only(left: 40.sp, right: 40.sp), - decoration: BoxDecoration( - color: const Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getTabbarImage('tabbar_bg'), - ))), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, + return ExitAppConfirmation( + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color.fromRGBO(15, 10, 31, 1.0), + bottomNavigationBar: Container( + height: 49.sp + MediaQuery.of(context).padding.bottom, + width: Get.width, + // color: Colors.red, + padding: EdgeInsets.only(left: 20.sp, right: 20.sp), + decoration: BoxDecoration( + color: const Color(0xFF423055), + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getTabbarImage('tabbar_bg'), + ))), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + funcItem(0, 'circle', 0 == controller.currentIndex, controller), + funcItem(1, 'like', 1 == controller.currentIndex, controller), + funcItem(2, 'msg', 2 == controller.currentIndex, controller), + funcItem(3, 'mine', 3 == controller.currentIndex, controller), + ], + ), + ), + body: Stack( + fit: StackFit.expand, children: [ - funcItem(0, 'msg', 0 == controller.currentIndex, controller), - funcItem(1, 'circle', 1 == controller.currentIndex, controller), - funcItem(2, 'mine', 2 == controller.currentIndex, controller), + Container( + width: MediaQuery.of(context).size.width, + // height: + // Get.height - 49.sp + MediaQuery.of(context).padding.bottom, + decoration: const BoxDecoration(image: bgWidget), + ), + TabBarView( + physics: const NeverScrollableScrollPhysics(), + controller: logic.tabController, + children: [ + const CirclePage(), + LikePage(), + MsgPage(), + MinefragmentPage() + ], + ) ], ), ), - body: Stack( - children: [ - Container( - width: MediaQuery.of(context).size.width, - height: Get.height - 49.sp + MediaQuery.of(context).padding.bottom, - decoration: const BoxDecoration( - image: bgWidget),), - PageView( - physics: const NeverScrollableScrollPhysics(), - controller: controller.pageController, - onPageChanged: (int index) { - // controller.updateIndex(index); - }, - children: controller.tabs, - - ) - ], - ), - ),); + ); }); } @@ -83,30 +94,46 @@ class _HomePageState extends State behavior: HitTestBehavior.opaque, onTap: () { if (!isSelected) { - controller.pageController.jumpToPage(index); + logic.tabController.animateTo(index, duration: Duration(milliseconds: 0), curve: Curves.ease); controller.updateIndex(index); } }, - child: Stack( - alignment: Alignment.center, - children:[ - Container( - + child: Stack(alignment: Alignment.center, children: [ + Container( margin: EdgeInsets.only(top: 8.sp), child: Center( - child: Image.asset( - isSelected - ? getTabbarImage('${image}_selected') - : getTabbarImage('${image}_normal'), - width: 38.sp, - height: 38.sp, - fit: BoxFit.fill, - excludeFromSemantics: true, - gaplessPlayback: true, - ))), + child: Image.asset( + isSelected + ? getTabbarImage('${image}_selected') + : getTabbarImage('${image}_normal'), + width: 38.sp, + height: 38.sp, + fit: BoxFit.fill, + excludeFromSemantics: true, + 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(() => null) Obx(() => Visibility( - visible: index == 0 && controller.unreadSIze != "0", + visible: index == 2 && controller.unreadSIze != "0", child: Positioned( // right: 4.sp, top: 6.sp, diff --git a/circle_app/lib/app/invite/view.dart b/circle_app/lib/app/invite/view.dart index a1e3027..93e4daa 100644 --- a/circle_app/lib/app/invite/view.dart +++ b/circle_app/lib/app/invite/view.dart @@ -487,7 +487,6 @@ void showCodePicker(InviteLogic logic) { alignment: Alignment.center, child: TextField( controller: logic.codeEditingController, - keyboardType: TextInputType.phone, maxLength: 8, textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontSize: 16.sp), diff --git a/circle_app/lib/app/like/binding.dart b/circle_app/lib/app/like/binding.dart new file mode 100644 index 0000000..db3098d --- /dev/null +++ b/circle_app/lib/app/like/binding.dart @@ -0,0 +1,10 @@ +import 'package:get/get.dart'; + +import 'logic.dart'; + +class LikeBinding extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => LikeLogic()); + } +} diff --git a/circle_app/lib/app/like/logic.dart b/circle_app/lib/app/like/logic.dart new file mode 100644 index 0000000..3880df8 --- /dev/null +++ b/circle_app/lib/app/like/logic.dart @@ -0,0 +1,188 @@ +import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/home/logic.dart'; +import 'package:circle_app/app/invite/logic.dart'; +import 'package:circle_app/network/api.dart'; +import 'package:circle_app/network/dio_manager.dart'; +import 'package:circle_app/util/util.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:get/get.dart'; + +class LikeLogic extends GetxController { + int currentIndex = -1; + + int page = 1; + int myPage = 1; + + InterestsBean circle = InterestsBean(lists: []); + InterestsBean mycircle = InterestsBean(lists: []); + + ScrollController leftCtr = ScrollController(); + ScrollController rightCtr = ScrollController(); + ScrollController myCircleCtr = ScrollController(); + + bool isMore = true; + bool isMyMore = true; + bool isLoad = true; + + List hasNewList = []; + + Data? homeData; + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + // leftCtr.addListener(() { + // if (leftCtr.position.pixels == + // leftCtr.position.maxScrollExtent) { + // loadMore(); + // } + // }); + rightCtr.addListener(() { + if (rightCtr.position.pixels == + rightCtr.position.maxScrollExtent) { + loadMore(); + } + }); + // + // myCircleCtr.addListener(() { + // if (myCircleCtr.position.pixels == + // myCircleCtr.position.maxScrollExtent) { + // loadMyMore(); + // } + // }); + loadInviteData(); + loadCircleListData(); + loadMyCircleData(); + } + + loadInviteData() async { + + var data = await DioManager.instance.get(url: Api.inviteMainPage); + if (data['code'] == 200) { + Autogenerated result = Autogenerated.fromJson(data); + + homeData = result.data; + + } + } + + loadCircleListData() async { + var data = await DioManager.instance.get( + url: Api.getCircleInterests, params: {"page": page, 'page_size': 20}); + var bean = BaseResponse.fromJson( + data, (data) => InterestsBean.fromJson(data)); + if (bean.data is InterestsBean && bean.isSuccess()) { + if (page == 1) { + circle = bean.data!; + } else { + circle.lists.addAll(bean.data!.lists); + } + + isLoad = false; + if (circle.lists.length < 20) { + isMore = false; + } + update(); + } + } + + loadMyCircleData() async { + var data = await DioManager.instance + .get(url: Api.getMyCircleAll); + + // var bean = BaseResponse.fromJson( + // data, (data) => InterestsBean.fromJson(data)); + + if (data['code'] == 200) { + List circleList = data['data']; + if (circleList.isNotEmpty) { + List infoList = []; + circleList.forEach((element) { + var info = Circle.fromJson(element); + infoList.add(info); + }); + mycircle.lists = infoList; + if (currentIndex >= mycircle.lists.length - 1) { + currentIndex = mycircle.lists.length -1; + } + + loadCalloutsNew(); + } + } + + update(); + } + + loadMore() { + if (isMore) { + page = page + 1; + loadCircleListData(); + } + } + + void relaodData() { + page = 1; + loadCircleListData(); + } + + loadMyMore() { + if (isMyMore) { + myPage = myPage + 1; + loadMyCircleData(); + } + } + + void relaodMyData() { + myPage = 1; + loadMyCircleData(); + } + + outCircle(String interest_id, bool isStatus) async { + var data = await DioManager.instance.post( + url: "${Api.outCrrcle}$interest_id/join", + params: {"status": isStatus ? "0" : "1"}); + var bean = BaseResponse.fromJson(data, (data) => data); + if (bean.code == 200) { + circle.lists.forEach((element) { + if (element.id.toString() == interest_id.toString()) { + element.isJoin = !isStatus; + } + }); + + + relaodMyData(); + } + showOKToast(bean.msg); + } + + + loadCalloutsNew() async { + List idList = []; + mycircle.lists.forEach((element) { + idList.add(element.id.toString()); + }); + var data = await DioManager.instance.post( + url:Api.calloutsNew, + params: {"interestIds":idList}); + + if (data['code'] == 200) { + hasNewList.clear(); + List infoList = data['data']; + bool isHasNew = false; + if (infoList.isNotEmpty) { + infoList.forEach((element) { + // "hasNew" -> false + hasNewList.add(element['hasNew']); + if (element['hasNew']) { + isHasNew = true; + } + }); + } + HomeLogic logic = Get.find(); + logic.showcirlceUnred.value = isHasNew; + // logic.update(); + // update(); + } + } + +} diff --git a/circle_app/lib/app/like/view.dart b/circle_app/lib/app/like/view.dart new file mode 100644 index 0000000..608b7bf --- /dev/null +++ b/circle_app/lib/app/like/view.dart @@ -0,0 +1,501 @@ +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/router/app_routers.dart'; +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 'logic.dart'; + +class LikePage extends StatelessWidget { + LikePage({Key? key}) : super(key: key); + final ctr = Get.lazyPut(() => LikeLogic()); + final logic = Get.find(); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.transparent, + body: SafeArea( + child: GetBuilder(builder: (logic) { + return logic.isLoad + ? loaddingWidget(true) + : Container( + width: Get.width, + height: Get.height, + child: Row( + children: [ + Container( + width: 65.sp, + child: Column( + children: [ + leftItem('', logic.currentIndex == -1, false, -1), + Container( + alignment: Alignment.center, + height: 20, + child: Container( + width: 33.sp, + height: 1.sp, + color: Color(0x4DFFFFFF), + )), + Expanded( + child: MediaQuery.removePadding( + removeTop: true, + context: context, + child: ListView.builder( + controller: logic.myCircleCtr, + itemBuilder: (context, index) { + return leftItem( + logic.mycircle.lists[index].title, + logic.currentIndex == index, + logic.hasNewList.length > index + ? logic.hasNewList[index] + : false, + index); + }, + itemCount: logic.mycircle.lists.length, + ))) + ], + )), + Expanded( + child: Container( + child: logic.currentIndex == -1 + ? circleInfoListView() + : InfoListView( + logic.currentIndex, + logic.mycircle.lists[logic.currentIndex], + logic, + key: ValueKey('${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'), + ))) + ], + ), + ); + }), + ), + ); + } + + circleInfoListView() { + return Stack( + fit: StackFit.expand, + children: [ + RefreshIndicator( + onRefresh: () async { + logic.relaodData(); + }, + child: ListView.builder( + controller: logic.rightCtr, + itemBuilder: (context, index) { + return circleInfoItem(logic.circle.lists[index]); + }, + itemCount: logic.circle.lists.length, + )), + Positioned( + bottom: 36.sp, + right: 10.sp, + child: GestureDetector( + onTap: () async { + var data = await Get.toNamed( + AppRoutes.Call_out, + ); + }, + child: Image.asset( + getCircleImage('send_msg'), + width: 60.sp, + ))) + ], + ); + } + + circleInfoItem(Circle bean) { + List urlList = bean.lastJoinUsers; + List widgets = []; + int i = 0; + // print(urlList); + if (null != urlList) { + urlList.forEach((element) { + 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()), + )); + i++; + }); + } + return GestureDetector( + onTap: () { + // if (bean.isJoin) { + Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); + // } + }, + child: Container( + margin: EdgeInsets.only(bottom: 10.sp), + child: Column( + children: [ + ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.sp), + topRight: Radius.circular(10.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')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + 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( + '${convertToTenThousand(bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), + GestureDetector( + //加入圈子 + onTap: () async { + if (bean.isJoin) { + Get.bottomSheet(CircleShare('', '', bean), + isScrollControlled: true, enableDrag: false); + } else { + await logic.outCircle( + bean.id.toString(), bean.isJoin); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('add'), + width: 77.sp, + ), + Text( + !bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + )) + ], + ), + )), + 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 - 80.sp, + // height: 50.sp, + child: HideText( + text: bean.intro, + maxWidth: Get.width - 89.sp, + additionText: '查看更多', + maxLines: 3, + style: + TextStyle(color: Colors.white, fontSize: 14.sp), + additionStyle: TextStyle( + color: const Color(0xFFFF4DF6), fontSize: 14.sp), + onTap: () { + _showTextContentDialog( + Get.context!, bean.intro, bean.title); + }, + )), + urlList.length == 0 + ? Container() + : Row( + children: [ + SizedBox( + height: 30.sp, + width: + 30.0.sp + 14.sp * (widgets.length - 1.sp), + child: Stack( + alignment: Alignment.center, + children: widgets, + ), + ), + SizedBox( + width: 4.sp, + ), + Text( + '${convertToTenThousand(bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + SizedBox( + width: 4.sp, + ), + // GestureDetector( + // onTap: () { + // // Get.bottomSheet( + // // CircleShare(logic.homeData!.inviteCode!,logic.homeData!.link!,bean), isScrollControlled: true, + // // enableDrag: false + // // ); + // }, + // behavior: HitTestBehavior.opaque, + // child: Container( + // height: 30.sp, + // alignment: Alignment.center, + // child: Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ), + // ), + // ) + ], + ), + ], + ), + ), + ), + ], + ), + ), + ); + } + + circleWidget(String url, String userId, {double width = 24}) { + return GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); + }, + child: Stack( + 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, + ), + ) + ], + )); + } + + leftItem(String text, bool isSelcted, bool isUnread, int index) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + logic.currentIndex = index; + + if (index >= 0) { + logic.hasNewList[index] = false; + logic.update(); + Future.delayed(Duration(seconds: 1), () { + logic.loadCalloutsNew(); + }); + } else { + logic.update(); + } + }, + child: Container( + width: 65.sp, + height: 65.sp, + color: isSelcted ? Colors.white.withOpacity(0.3) : Colors.transparent, + child: Stack( + alignment: Alignment.center, + children: [ + if (text.isEmpty) + 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, + ), + ), + if (isUnread) + Positioned( + right: 6.sp, + top: 6.sp, + child: Container( + width: 15.sp, + height: 15.sp, + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient( + colors: [Color(0xFFC343F9), Color(0xFFFB34B2)]), + border: + Border.all(color: Color(0xFF170730), width: 1.sp)), + )) + ], + ), + ), + ); + } + + void _showTextContentDialog(BuildContext context, String msg, String title) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 300.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const 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: const LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Positioned( + top: 15, + left: 0, + right: 0, + child: Center( + child: Text(title, + style: TextStyle( + color: const Color(0xFFF7FAFA), fontSize: 16.sp)), + )), + Container( + margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), + child: Container( + 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), + ), + ), + ), + ), + Positioned( + top: 8.sp, + right: 10.sp, + child: GestureDetector( + onTap: () { + Get.back(); + }, + child: Icon( + Icons.close, + color: Colors.white, + size: 20.sp, + ), + )), + ], + ), + ), + ); + }, + ); + } + +} diff --git a/circle_app/lib/app/login/complete_material/logic.dart b/circle_app/lib/app/login/complete_material/logic.dart index 473096c..ba5ad10 100644 --- a/circle_app/lib/app/login/complete_material/logic.dart +++ b/circle_app/lib/app/login/complete_material/logic.dart @@ -247,7 +247,7 @@ class Complete_materialLogic extends GetxController { } if (state.wxEditingController.text.isNotEmpty && !isPass) { - RegExp wxReg = RegExp(r'^[a-zA-Z][-_a-zA-Z0-9]{5,19}$'); + RegExp wxReg = RegExp(r'^[-_a-zA-Z][-_a-zA-Z0-9]{5,19}$'); if (!wxReg.hasMatch(state.wxEditingController.text)) { showOKToast('请输入正确的微信号'); return; diff --git a/circle_app/lib/app/msg/sys_notify_list/view.dart b/circle_app/lib/app/msg/sys_notify_list/view.dart index 30774ad..2de154a 100644 --- a/circle_app/lib/app/msg/sys_notify_list/view.dart +++ b/circle_app/lib/app/msg/sys_notify_list/view.dart @@ -119,8 +119,8 @@ class Sys_notify_listPage extends StatelessWidget { break; case "my_main": final homeLogic = Get.put(HomeLogic()); - homeLogic.pageController.jumpToPage(2); - homeLogic.updateIndex(2); + homeLogic.tabController.animateTo(3); + homeLogic.updateIndex(3); Get.back(); diff --git a/circle_app/lib/app/msg/view.dart b/circle_app/lib/app/msg/view.dart index dde3471..4ad3b14 100644 --- a/circle_app/lib/app/msg/view.dart +++ b/circle_app/lib/app/msg/view.dart @@ -20,7 +20,7 @@ import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_conversation_co import '../../util/eventBus.dart'; import 'TIMUIKitConversation/tim_uikit_conversation.dart'; import 'logic.dart'; -const bgWidget = DecorationImage( +const msgBgWidget = DecorationImage( fit: BoxFit.fill, image: AssetImage('assets/images/base/home_back.png')); class MsgPage extends StatelessWidget { diff --git a/circle_app/lib/app/my_circle/view.dart b/circle_app/lib/app/my_circle/view.dart index 3951160..b23fb0a 100644 --- a/circle_app/lib/app/my_circle/view.dart +++ b/circle_app/lib/app/my_circle/view.dart @@ -1,7 +1,10 @@ +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/my_circle/logic.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/components/my_app_bar.dart'; import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; @@ -12,7 +15,6 @@ import 'package:get/get.dart'; import '../../util/eventBus.dart'; - class My_circlePage extends StatefulWidget { My_circlePage({Key? key}) : super(key: key); @override @@ -29,92 +31,324 @@ class _My_circlePageState extends State final state = Get.find().state; - var getContext; @override Widget build(BuildContext context) { getContext = context; - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - color: Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: GetBuilder(builder: (MyCircleLogic controller) { - return Stack( + return Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + decoration: BoxDecoration( + color: Color(0xFF423055), + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage(getBaseImage('home_back')))), + child: Scaffold( + backgroundColor: Colors.transparent, + body: SafeArea( + child: GetBuilder(builder: (MyCircleLogic controller) { + return Stack( + children: [ + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + child: Container( + child: Column(children: [ + backNavigatorItem(), + // Text(controller.state.msg), + //组件使用 + Expanded( + child: logic.circle.lists.isEmpty + ? !logic.isMore + ? noResultWidget() + : loaddingWidget(logic.isMore) + : ListView.builder( + // controller: logic.rightCtr, + itemBuilder: (context, index) { + var bean = logic.circle.lists[index]; + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + + Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); + + }, + child: circleInfoItemWidget( + logic.circle.lists[index])); + }, + itemCount: logic.circle.lists.length, + )) + // Swiper( + // itemBuilder: (BuildContext context, int index) { + // var bean = logic.circle.lists[index]; + // // final GlobalKey infoListViewKey = GlobalKey(); + // // MyinfoListViewKey = infoListViewKey; + // return InfoListView( + // index, + // bean, + // controller + // ); + // }, + // index: controller.state.index, + // itemCount: logic.circle.lists.length, + // viewportFraction: 0.93, + // // scale: 0.9, + // loop: false, + // onIndexChanged: (index) { + // controller.state.index = index; + // if (index == logic.circle.lists.length - 1 && controller.isMore) { + // + // logic.loadMore(); + // } + // + // }, + // // pagination: new SwiperPagination(),//如果不填则不显示指示点 + // // control: new SwiperControl(),//如果不填则不显示左右按钮 + // ) + ]), + ), + ), + ], + ); + }), + ), + )); + } + + var MyinfoListViewKey; + + circleInfoItemWidget(Circle bean) { + List urlList = bean.lastJoinUsers; + List widgets = []; + int i = 0; + // print(urlList); + if (null != urlList) { + urlList.forEach((element) { + if (widgets.length > 2) { + return; + } + widgets.add(Positioned( + left: 15.sp * i, + child: circleWidget( + element.avatar! ?? + "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", + ), + )); + i++; + }); + } + return Container( + margin: EdgeInsets.only(bottom: 10.sp, left: 10.sp, right: 10.sp), + child: Column( + children: [ + ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.sp), + topRight: Radius.circular(10.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')))), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Container( - child: Column(children: [ - backNavigatorItem(), - // Text(controller.state.msg), - //组件使用 - Expanded( - child: logic.circle.lists.isEmpty ? !logic.isMore ? noResultWidget() : loaddingWidget(logic.isMore) : Swiper( - itemBuilder: (BuildContext context, int index) { - var bean = logic.circle.lists[index]; - // final GlobalKey infoListViewKey = GlobalKey(); - // MyinfoListViewKey = infoListViewKey; - return InfoListView( - index, - bean, - controller - ); - }, - index: controller.state.index, - itemCount: logic.circle.lists.length, - viewportFraction: 0.93, - // scale: 0.9, - loop: false, - onIndexChanged: (index) { - controller.state.index = index; - if (index == logic.circle.lists.length - 1 && controller.isMore) { - - logic.loadMore(); - } - - }, - // pagination: new SwiperPagination(),//如果不填则不显示指示点 - // control: new SwiperControl(),//如果不填则不显示左右按钮 - )) - ]), + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + 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( + '${convertToTenThousand(bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), + GestureDetector( + //加入圈子 + onTap: () async { + if (bean.isJoin) { + Get.bottomSheet( + CircleShare('','',bean), isScrollControlled: true, + enableDrag: false + ); + } else { + await logic.outCircle( + bean.id.toString(), bean.isJoin); + } + }, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('add'), + width: 77.sp, + ), + Text( + !bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + )) ], - ); - }), + ), + )), + 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 - 20.sp, + // height: 50.sp, + child: HideText( + text: bean.intro, + maxWidth: Get.width - 50.sp, + additionText: '查看更多', + maxLines: 3, + style: + TextStyle(color: Colors.white, fontSize: 17.sp), + additionStyle: TextStyle( + color: const Color(0xFFFF4DF6), fontSize: 17.sp), + onTap: () { + _showTextContentDialog( + Get.context!, + bean.intro, + ); + }, + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + // showToast("点个鸡毛,星哥还没做"); + // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); + }, + child: urlList.length == 0 + ? Container() + : Row( + children: [ + SizedBox( + height: 30.sp, + width: + 30.0.sp + 14.sp * (widgets.length - 1.sp), + child: Stack( + alignment: Alignment.center, + children: widgets, + ), + ), + SizedBox( + width: 4.sp, + ), + Text( + '${convertToTenThousand(bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + SizedBox( + width: 4.sp, + ), + // GestureDetector( + // onTap: () { + // // Get.bottomSheet( + // // CircleShare(logic.homeData!.inviteCode!,logic.homeData!.link!,bean), isScrollControlled: true, + // // enableDrag: false + // // ); + // }, + // behavior: HitTestBehavior.opaque, + // child: Container( + // height: 30.sp, + // alignment: Alignment.center, + // child: Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ), + // ), + // ) + ], + ), + ), + ], + ), ), - )); - + ), + ], + ), + ); } - var MyinfoListViewKey; backNavigatorItem() { return MyAppBar( centerTitle: '我的圈子', - onCenterTitlePressed: (){ + onCenterTitlePressed: () { EventBusManager.fire(ScrollToTop()); }, - actionWdiget: const Text( - "发布喊话", - style: TextStyle(color: Colors.white), + actionWdiget: Image.asset( + getCircleImage('callout_icon'), + width: 75.sp, ), - onPressed: () async{ + onPressed: () async { List numbers = []; - numbers.add(MyConfigData( - logic.getCircleIndex().id.toString(), - logic.getCircleIndex().title!, - false)); - var data = await Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); - // MyinfoListViewKey.currentState?.loadCallOutListData(); + numbers.add(MyConfigData(logic.getCircleIndex().id.toString(), + logic.getCircleIndex().title!, false)); + var data = await Get.toNamed(AppRoutes.Call_out, + arguments: {'numbers': numbers}); + // MyinfoListViewKey.currentState?.loadCallOutListData(); // logic.refresh(); // logic.update(); }, @@ -146,7 +380,6 @@ class _My_circlePageState extends State Positioned( left: 0, child: Container( - width: 30.sp * widgets.length, height: 44.sp, child: Stack( @@ -177,7 +410,8 @@ class _My_circlePageState extends State right: 0, child: GestureDetector( onTap: () { - Get.toNamed(AppRoutes.MyCircle,arguments: '',preventDuplicates:false); + Get.toNamed(AppRoutes.MyCircle, + arguments: '', preventDuplicates: false); }, child: Image.asset( getCircleImage('my_circle'), @@ -192,26 +426,24 @@ class _My_circlePageState extends State circleWidget(String url, {double width = 30}) { return GestureDetector( child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: Image.network( - url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.fill, - ), - ) - ], - )); + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: width.sp, + ), + ClipOval( + child: Image.network( + url, + width: (width - 1).sp, + height: (width - 1).sp, + fit: BoxFit.fill, + ), + ) + ], + )); } - - void _showTextContentDialog(BuildContext context, String msg) { showDialog( context: context, @@ -272,8 +504,7 @@ class _My_circlePageState extends State ); } - void _showOutCircleDialog( - BuildContext context, CircleLogic controller, Circle bean) { + void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { showDialog( context: context, builder: (BuildContext context) { @@ -315,7 +546,7 @@ class _My_circlePageState extends State child: Text( "提示", style: - TextStyle(color: Colors.white, fontSize: 16.sp), + TextStyle(color: Colors.white, fontSize: 16.sp), ), ), Container( @@ -410,4 +641,3 @@ class _My_circlePageState extends State ); } } - diff --git a/circle_app/lib/app/select_circle/logic.dart b/circle_app/lib/app/select_circle/logic.dart index e520eaf..5b19eb9 100644 --- a/circle_app/lib/app/select_circle/logic.dart +++ b/circle_app/lib/app/select_circle/logic.dart @@ -7,41 +7,41 @@ import 'state.dart'; class Select_circleLogic extends GetxController { late Map interestMap = Get.arguments['interestMap']; bool isRodio = Get.arguments['isRodio']; - List selectCircle = Get.arguments['selectCircle']; + List selectCircle = Get.arguments['selectCircle']; var selectIndex = -1; @override void onInit() async { - if(isRodio){ + if (isRodio) { List> entries = interestMap.entries.toList(); for (var entry in entries.asMap().entries) { - MyConfigData bean = MyConfigData(entry.value.key, entry.value.value, false); - if(selectCircle.isEmpty){ + MyConfigData bean = + MyConfigData(entry.value.key, entry.value.value, false); + if (selectCircle.isEmpty) { arrList.add(bean); - }else{ + } else { selectCircle.forEach((element) { - if(entry.value.key==element.id){ + if (entry.value.key == element.id) { bean.isSelect = true; selectIndex = entry.key; } arrList.add(bean); }); } - } - }else{ + } else { interestMap.forEach((key, value) { - MyConfigData bean = MyConfigData(key, value, false); + MyConfigData bean = MyConfigData(key, value, false); selectCircle.forEach((element) { - if(key==element.id){ + if (key == element.id) { bean.isSelect = true; } }); arrList.add(bean); }); } -print(arrList.length.toString()); + print(arrList.length.toString()); update(); } diff --git a/circle_app/lib/app/signal_circle_list/view.dart b/circle_app/lib/app/signal_circle_list/view.dart index 62abae2..56b966a 100644 --- a/circle_app/lib/app/signal_circle_list/view.dart +++ b/circle_app/lib/app/signal_circle_list/view.dart @@ -1,6 +1,8 @@ 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/components/my_app_bar.dart'; +import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -28,7 +30,21 @@ class Signal_circle_listPage extends StatelessWidget { backgroundColor: Colors.transparent, appBar: MyAppBar( centerTitle: logic.circle?.title ?? '', - + actionWdiget: Image.asset( + getCircleImage('callout_icon'), + width: 75.sp, + ), + onPressed: () async{ + List numbers = []; + numbers.add(MyConfigData( + controller.circle!.id.toString(), + controller.circle!.title, + false)); + var data = await Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); + // MyinfoListViewKey.currentState?.loadCallOutListData(); + // logic.refresh(); + // logic.update(); + }, ), body: Container( padding: EdgeInsets.only(left: 15.sp, right: 15.sp), diff --git a/circle_app/lib/common/Widgets/base_tip_widget.dart b/circle_app/lib/common/Widgets/base_tip_widget.dart index 8b2eeac..daed097 100644 --- a/circle_app/lib/common/Widgets/base_tip_widget.dart +++ b/circle_app/lib/common/Widgets/base_tip_widget.dart @@ -262,9 +262,11 @@ typedef void MyCallback(bool payResult); showJoinCiclePiker(String cicleId, String pirce, String oldPrice, int type, MyCallback payResult,String iosItem) { String title = ['解锁圈子才能发布喊话', '解锁圈子才能查看主页', '解锁圈子才能主动私聊'][type]; + int intP = double.parse(pirce).toInt(); + int intoldPrice = double.parse(oldPrice).toInt(); return Get.bottomSheet( - joiinCircileTipWdiget(cicleId, pirce, oldPrice, title, payResult,iosItem: iosItem), - isScrollControlled: true, + joiinCircileTipWdiget(cicleId,intP.toString(), intoldPrice.toString(), title, payResult,iosItem: iosItem), + isScrollControlled: true, enableDrag: false); } diff --git a/circle_app/lib/common/Widgets/circle_share.dart b/circle_app/lib/common/Widgets/circle_share.dart new file mode 100644 index 0000000..6ef3c9b --- /dev/null +++ b/circle_app/lib/common/Widgets/circle_share.dart @@ -0,0 +1,735 @@ +import 'dart:io'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:circle_app/app/circle/logic.dart'; +import 'package:circle_app/app/invite/logic.dart'; +import 'package:circle_app/app/minefragment/logic.dart'; +import 'package:circle_app/common/Widgets/text_more.dart'; +import 'package:circle_app/network/api.dart'; +import 'package:circle_app/network/dio_manager.dart'; +import 'package:circle_app/util/util.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; +import 'package:get/get_core/src/get_main.dart'; +import 'package:image_gallery_saver/image_gallery_saver.dart'; +import 'dart:ui' as ui; +import 'package:fluwx/fluwx.dart' as fluwx; +import 'package:path_provider/path_provider.dart'; +import 'package:qr_flutter/qr_flutter.dart'; + + +class CircleShare extends StatefulWidget { + Circle bean; + String code; + String link; + CircleShare(this.code, this.link,this.bean); + @override + _CircleShareState createState() => new _CircleShareState(); + +} + +class _CircleShareState extends State { + // TODO: add state variables and methods + GlobalKey _globalKey = GlobalKey(); + + MinefragmentLogic logic = Get.find(); + + + @override + void initState() { + // TODO: implement initState + super.initState(); + loadInviteData(); + } + + loadInviteData() async { + + var data = await DioManager.instance.get(url: Api.inviteMainPage); + if (data['code'] == 200) { + Autogenerated result = Autogenerated.fromJson(data); + + Data homeData = result.data!; + widget.code = homeData.inviteCode!; + + widget.link = homeData.link!; + setState(() { + + }); + + } + } + + @override + Widget build(BuildContext context) { + // TODO: add widget build method + return Scaffold( + backgroundColor: Colors.transparent, + body: Container( + child: Column( + children: [ + Expanded(child: Container()), + Container( + width: Get.width - 40.sp, + // height: Get.height - Get.bottomBarHeight - 164.sp - 10.sp, + child:SingleChildScrollView( + child: RepaintBoundary( + key: _globalKey, + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(getCircleImage("open_vip_bg")), + fit: BoxFit.fill, + ), + ), + child: Column( + children: [ + Container( + width: Get.width, + height: 65.sp, + margin: EdgeInsets.only(left: 15.sp, top: 20.sp,right: 15.sp), + child: Row( + children: [ + Center( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 47.sp, + height: 47.sp, + decoration: const BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient( + colors: [ + Color(0xFFDD3DF4), + Color(0xFF30FFD9) + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + SizedBox( + width: 46.sp, + height: 46.sp, + child: _buildAvatar1(logic), + ) + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 10.sp), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + _buildNameRow(logic), + SizedBox(height: 10.sp), + _buildInfoRow(logic), + ], + ), + ), + ), + Image.asset( + getBaseImage("ic_launcher"), + width: 65.sp, + height: 65.sp, + ) + ], + ), + ), + // Expanded( + // child: + Container( + padding: EdgeInsets.only(left: 10.sp,right: 10.sp), + // color: Colors.red, + // height: 310.sp, + child: Column( + children: [ + SizedBox( + height: 5.sp, + ), + Container( + padding: EdgeInsets.only(left: 15.sp,right: 15.sp), + child: Image.asset( + getMineImage('share_title'), + ), + ), + SizedBox( + height: 10.sp, + ), + circleInfoItem(widget.bean) + ], + ), + ), + Container( + // height: 90.sp, + // color: Color(0xFF334141), + alignment: Alignment.center, + // color: Colors.yellow, + // width: Get.width-40.sp, + margin: EdgeInsets.only(bottom: 15.sp,top: 10.sp), + padding: EdgeInsets.only(left: 15.sp, right: 15.sp), + child: Row( + + children: [ + Expanded( + child: Container( + // color: Colors.red, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + // color: Colors.blue, + child: Row( + children: [ + Text( + '专属邀请码', + style: TextStyle( + color: Colors.white, + fontSize: 18.sp), + ), + SizedBox( + width: 8.sp, + ), + Container( + alignment: Alignment.center, + padding: EdgeInsets.only( + left: 10.sp, right: 10.sp), + height: 25.sp, + decoration: BoxDecoration( + // color: Color(0xFFDC5BFD), + gradient: + const LinearGradient( + colors: [ + Color(0xFF0DF5F7), + Color(0xFFD263FB) + ], + begin: + Alignment.centerLeft, + end: + Alignment.centerRight, + ), + borderRadius: + BorderRadius.circular( + 12.5.sp)), + child: Text( + widget.code, + style: TextStyle( + color: Colors.black, + fontSize: 12.sp), + ), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.sp), + width: Get.width - 200.sp, + child: Text( + '扫码或长按识别下载APP,认识更多小众圈子里的人,给生活带来更多乐趣~', + style: TextStyle( + color: Colors.white, + fontSize: 15.sp)), + ) + ], + ), + ), + ), + // Image.asset(getBaseImage("ic_launcher"),width: 80.sp,height: 80.sp,) + Stack( + alignment: Alignment.center, + children: [ + Container( + color: Colors.white, + width: 90.sp, + height: 90.sp, + ), + QrImageView( + data: widget.link, + padding: EdgeInsets.zero, + version: QrVersions.auto, + size: 80.sp, + gapless: false, + // backgroundColor: Colors.black, + ) + ], + ) + ], + ), + ) + ], + ), + )) + ), + ), + SafeArea( + top: false, + child: Container( + height: 164.sp, + width: Get.width, + color: Color(0xFF292247), + child: Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsets.only( + top: 15.sp, left: 15.sp, right: 15.sp), + alignment: Alignment.center, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + shareAction('wx', '微信', () { + shareWxData(1); + }), + shareAction('wxq', '朋友圈', () { + shareWxData(2); + }), + shareAction('qq', 'QQ', () { + copyInviteText(logic.name); + }), + shareAction('wb', '微博', () { + copyInviteText(logic.name); + }), + shareAction('hb', '保存海报', () { + _saveLocalImage(); + }), + ], + ), + )), + Container( + height: 1.sp, + color: Color(0x33FFFFFF), + ), + GestureDetector( + onTap: () { + Get.back(); + }, + child: Container( + height: 67.sp, + alignment: Alignment.center, + child: Text( + '取消', + style: TextStyle( + color: Colors.white, fontSize: 14.sp), + ), + ), + ) + ], + ), + )) + ], + ), + ), + ); + } + + Widget _buildAvatar1(MinefragmentLogic logic) { + return ClipOval( + child: GestureDetector( + onTap: () { + if (logic.userInfoBean != null) { + var imgList = []; + imgList.add(logic.userInfoBean!.avatar); + // Get.toNamed(AppRoutes.Swiper,arguments:imgList); + // Get.toNamed(AppRoutes.Swiper, arguments: { + // 'imaglist': imgList, + // 'index': 0 + // }); + } + }, + child: logic.userInfoBean == null + ? SizedBox( + width: 63.sp, + height: 63.sp, + ) + : CachedNetworkImage( + fit: BoxFit.cover, + placeholder: null, + imageUrl: logic.avatar, + width: 63.sp, + height: 63.sp, + ), + ), + ); + } + + Widget _buildNameRow(MinefragmentLogic logic) { + return Container( + margin: EdgeInsets.only(top: 6.sp), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + logic.name, + style: TextStyle( + color: const Color.fromRGBO(247, 250, 250, 1.0), + fontSize: 16.sp, + ), + ), + SizedBox( + width: 4.sp, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color.fromRGBO(141, 255, 248, 1.0), + Color.fromRGBO(181, 211, 255, 1.0), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), + child: Text( + logic.ageMsg, + style: TextStyle( + color: Colors.black, + fontSize: 10.sp, + ), + ), + ), + ], + ), + ); + } + + Widget _buildInfoRow(MinefragmentLogic logic) { + return Row( + children: [ + Text('邀请您加入', + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + )), + Text('【微乐园APP】', + style: TextStyle( + color: Color(0xFF0DF5F7), + fontSize: 12.sp, + )), + ], + ); + } + circleWidget(String url, String userId, {double width = 24}) { + return Stack( + 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, + ), + ) + ], + ); + } + circleInfoItem(Circle bean) { + List urlList = bean.lastJoinUsers; + List widgets = []; + int i = 0; + // print(urlList); + if (null != urlList) { + urlList.forEach((element) { + 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()), + )); + i++; + }); + } + return Container( + margin: EdgeInsets.only(bottom: 10.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.sp), + gradient: LinearGradient(colors: [Color(0xFF261240),Color(0xFF132C40),]) + ), + child: Column( + children: [ + ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.sp), + topRight: Radius.circular(10.sp)), + child: Container( + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + height: 72.sp, + decoration: BoxDecoration( + + gradient: LinearGradient(colors: [Color(0xFF261240),Color(0xFF132C40),]), + + ), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 42.sp, + height: 42.sp, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + gradient: const LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF71F3F2), + Color(0xFFF558FF), + ], + stops: [0.0365, 0.9427], + ), + ), + padding: EdgeInsets.all(1.sp), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: CachedNetworkImage( + imageUrl: bean.image, + width: 40.sp, + height: 40.sp, + memCacheHeight: 40, + memCacheWidth: 40, + 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( + '${convertToTenThousand(bean.viewTotal)}人看过', + textAlign: TextAlign.left, + style: TextStyle( + color: const Color(0xff03FEFB), + fontSize: 12.sp, + ), + ), + ], + ), + )), + + Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('add'), + width: 77.sp, + ), + Text( + !bean.isJoin ? '申请加入' : '分享有奖', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ) + ], + ) + ], + ), + )), + Container( + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + // height:urlList.length==0?47.sp: 118.sp, + decoration: BoxDecoration( + + ), + child: Container( + margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 7.sp), + width: Get.width - 80.sp, + // height: 50.sp, + child: HideText( + text: bean.intro, + maxWidth: Get.width - 84.sp, + additionText: '查看更多', + maxLines: 3, + style: TextStyle(color: Colors.white, fontSize: 14.sp), + additionStyle: TextStyle( + color: const Color(0xFFFF4DF6), fontSize: 14.sp), + onTap: () { + + }, + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + // showToast("点个鸡毛,星哥还没做"); + // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); + }, + child: urlList.length == 0 + ? Container() + : Row( + children: [ + SizedBox( + height: 30.sp, + width: + 30.0.sp + 14.sp * (widgets.length - 1.sp), + child: Stack( + alignment: Alignment.center, + children: widgets, + ), + ), + SizedBox( + width: 4.sp, + ), + Text( + '${convertToTenThousand(bean.joinTotal)}圈友加入', + style: TextStyle( + color: Colors.white, fontSize: 12.sp), + ), + SizedBox( + width: 4.sp, + ), + // GestureDetector( + // onTap: () { + // Get.bottomSheet( + // CircleShare('code','link,',bean), isScrollControlled: true, + // enableDrag: false + // ); + // }, + // behavior: HitTestBehavior.opaque, + // child: Container( + // height: 30.sp, + // alignment: Alignment.center, + // child: Image.asset( + // getCircleImage('play'), + // width: 20.sp, + // ), + // ), + // ) + ], + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + shareAction(String img, String name, GestureTapCallback onTap) { + return GestureDetector( + onTap: onTap, + child: Container( + child: Column( + children: [ + Image.asset( + getMineImage(img), + width: 40.sp, + ), + SizedBox( + height: 10.sp, + ), + Text( + name, + style: TextStyle(color: Colors.white, fontSize: 12.sp), + ) + ], + ), + ), + ); + } + + _saveLocalImage() async { + RenderRepaintBoundary boundary = + _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; + ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); + ByteData? byteData = + await (image.toByteData(format: ui.ImageByteFormat.png)); + if (byteData != null) { + final result = + await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); + print(result); + // isSuccess + if (result['isSuccess']) { + showOKToast('保存成功'); + } else { + showOKToast('保存失败,请检查相册权限是否开启'); + } + } + } + + copyInviteText( + String username, + ) { + Clipboard.setData(ClipboardData( + text: '【${username}】邀请你加入“微乐园”,邀请码为${widget.code},点击进入${(widget.link!) + + '?code=${widget.code}'}')); + showOKToast('您已成功复制分享链接,前往对应平台粘贴发送即可~'); + } + /** + * 分享图片到微信, + * file=本地路径 + * url=网络地址 + * asset=内置在app的资源图片 + * scene=分享场景,1好友会话,2朋友圈,3收藏 + */ + void shareWxData(int scene) async { + + SmartDialog.showLoading(msg:'正在生成分享图片...'); + RenderRepaintBoundary boundary = + _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; + ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); + ByteData? byteData = + await (image.toByteData(format: ui.ImageByteFormat.png)); + String filePath = ''; + if (byteData != null) { + Uint8List pngBytes = byteData!.buffer.asUint8List(); + Directory directory = await getApplicationDocumentsDirectory(); + filePath = '${directory.path}/widget_image.png'; + File imageFile = File(filePath); + imageFile.writeAsBytesSync(pngBytes); + } + SmartDialog.dismiss(); + fluwx.WeChatScene wxScene = fluwx.WeChatScene.SESSION; + if (scene == 2) { + wxScene = fluwx.WeChatScene.TIMELINE; + } + fluwx.WeChatShareImageModel? model; + + if (filePath.isNotEmpty) { + model = fluwx.WeChatShareImageModel(fluwx.WeChatImage.file(File(filePath)), + title: '', description: '', scene: wxScene); + } + if (model != null) { + fluwx.shareToWeChat(model!); + } + + } +} diff --git a/circle_app/lib/common/Widgets/open_vip_tip/view.dart b/circle_app/lib/common/Widgets/open_vip_tip/view.dart index d90a09d..da26590 100644 --- a/circle_app/lib/common/Widgets/open_vip_tip/view.dart +++ b/circle_app/lib/common/Widgets/open_vip_tip/view.dart @@ -321,14 +321,14 @@ class Open_vip_tipPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - controller.priceBean[index].amount.toString(), + '${controller.priceBean[index].amount.toInt()}', style: TextStyle(color: Colors.white, fontSize: 14.sp), ), SizedBox( width: 4.sp, ), Text( - "${controller.priceBean[index].oldAmount}元", + "${controller.priceBean[index].oldAmount.toInt()}元", style: TextStyle( color: Colors.white70, fontSize: 10.sp, diff --git a/circle_app/lib/common/Widgets/text_more.dart b/circle_app/lib/common/Widgets/text_more.dart index 7c670f2..8541735 100644 --- a/circle_app/lib/common/Widgets/text_more.dart +++ b/circle_app/lib/common/Widgets/text_more.dart @@ -11,7 +11,8 @@ class HideText extends StatefulWidget { required this.style, //正常字样式 required this.additionText, //附加字,如点击查看更多 this.additionStyle, //附加字的样式 - this.maxLines = 3, //行数,不传 默认为3 + this.maxLines = 3, //行数,不传 默认为3 + required this.maxWidth, this.additionUrl, //点击附加字跳转URL this.additionParams, this.onTap,//点击附加字跳转时携带的参数 @@ -22,6 +23,7 @@ class HideText extends StatefulWidget { final String? additionText; final TextStyle? additionStyle; final int? maxLines; + final double maxWidth; final String? additionUrl; GestureTapCallback? onTap; final Map? additionParams; @@ -72,7 +74,7 @@ class _HideTextState extends State { children: children ), textDirection: TextDirection.ltr) - ..layout(maxWidth: Get.width - 60.sp); //若新功能宽度不一致,可尝试修改, + ..layout(maxWidth: widget.maxWidth); //若新功能宽度不一致,可尝试修改, //UIUtils.screenWidth(context)是自定义的获取屏幕宽度的方法 } diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index 606a66e..49070bf 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -248,7 +248,10 @@ class Api { // /up-service/my/interests /up-service/interest/statistics + static const getMyCircleInterests = 'up-service/my/interests'; + //我的所有圈子 + static const getMyCircleAll = '/up-service/my/interests/all'; //缘分匹配 static const getMatch = 'msg-service/im/chat/match'; //系统通知 @@ -297,6 +300,9 @@ class Api { //重置密码 static const resetPassword = '/user-service/register/user/password/reset'; + //获取多个圈子是否有新喊话 + static const calloutsNew = '/up-service/interests/callouts/new'; + } \ No newline at end of file diff --git a/circle_app/lib/view/notice.dart b/circle_app/lib/view/notice.dart index 617033c..421d5ce 100644 --- a/circle_app/lib/view/notice.dart +++ b/circle_app/lib/view/notice.dart @@ -57,7 +57,7 @@ void showFloatingButtonOverlay( Row( children: [ Container( - width: 70.sp, + // width: 70.sp, child: Text( nickname, overflow: TextOverflow.ellipsis,