1.3.2代码提交

This commit is contained in:
CYH 2023-11-14 09:09:04 +08:00
parent 8ce0f58a77
commit 7b7f01ae93
24 changed files with 1113 additions and 759 deletions

View File

@ -71,8 +71,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode 24
versionName "1.3.2"
versionCode 22
versionName "1.3.0"
manifestPlaceholders = [
vivo_APPID: "105669716",
vivo_APPKEY:"84f750207787376b310ca5b0d5969122",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -381,8 +381,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.6;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -530,8 +530,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.6;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -573,8 +573,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.6;
PRODUCT_BUNDLE_IDENTIFIER = com.example.circleApp;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>

View File

@ -493,6 +493,7 @@ class Circle {
String ios_item;
double amount;
bool is_limit;
bool is_top;
double oldAmount;
String lastCalloutTime;
bool isJoin;
@ -510,6 +511,7 @@ class Circle {
required this.intro,
required this.amount,
required this.oldAmount,
required this.is_top,
required this.lastCalloutTime,
required this.isJoin,
required this.isLike,
@ -529,6 +531,7 @@ class Circle {
return Circle(
id: json['id'],
is_top: json['is_top'] ?? false,
is_limit: json['is_limit'] ?? false,
image: json['image'] ?? '',
ios_item: json['ios_item'] ?? '',

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/circle/logic.dart';
@ -16,20 +17,20 @@ import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
class LikeView extends StatefulWidget {
@override
_LikeViewState createState() => _LikeViewState();
}
class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin {
class _LikeViewState extends State<LikeView>
with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;
final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController();
// ListLogic? listsLg;
@ -47,52 +48,44 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
void dispose() {
// TODO: implement dispose
if(null!=scroToTop){
if (null != scroToTop) {
EventBusManager.cancelSubscription(scroToTop!);
}
EventBusManager.cancelSubscription(likeRefreshSub!);
scrollController.dispose();
super.dispose();
}
StreamSubscription? callRefreshCicle =null;
StreamSubscription? scroToTop =null;
StreamSubscription? callRefreshCicle = null;
StreamSubscription? scroToTop = null;
StreamSubscription? likeRefreshSub = null;
@override
void initState() {
// TODO: implement initState
super.initState();
scrollController.addListener(() {
try {
if (scrollController.position.pixels ==
scrollController.position.maxScrollExtent) {
loadMore();
}
} catch (_) {}
});
loadLikeListData();
scroToTop = EventBusManager.on<ScrollToTop>().listen((event) {
// if (widget.logic.state.index == widget.index) {
var str = '{\"content\":{\"calloutId\":10453,\"interestId\":5},\"event\":3}';
var params = jsonDecode(str);
scrollController.animateTo(
0.0,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
// }
});
likeRefreshSub = EventBusManager.on<LikeRefresh>().listen((event) {
// if (widget.logic.state.index == widget.index) {
refreshData();
// }
});
// widget.back(widget.createState());
}
loadLikeListData() async {
if (likeMore) {
var data = await DioManager.instance.get(
@ -103,6 +96,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
if (callOutPage == 1) {
lists.clear();
}
if (dataList.isNotEmpty) {
likeMore = true;
for (var element in dataList) {
@ -113,7 +107,15 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
likeMore = dataList.length == 20;
if (!likeMore) {
loadRecomdistData();
} else {
if (callOutPage == 2 || callOutPage == 1) {
refreshController.refreshCompleted();
refreshController.loadComplete();
} else {
refreshController.loadComplete();
}
}
if (mounted) {
setState(() {});
}
@ -144,6 +146,16 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
recomandPage++;
}
recomandMore = dataList.length == 20;
if (recomandPage == 2 || recomandPage == 1) {
refreshController.refreshCompleted();
} else {
if (recomandMore) {
refreshController.loadComplete();
} else {
refreshController.loadNoData();
}
}
if (mounted) {
setState(() {});
}
@ -159,7 +171,10 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
void refreshData() {
callOutPage = 1;
recomandPage = 1;
likeMore = true;
recomandMore = true;
refreshController.resetNoData();
loadLikeListData();
}
@ -193,10 +208,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
// }
// });
// if (bean.isQueen) {
// showJoinCiclePiker(cicleId);
// } else {
@ -209,7 +220,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
}
void pushMsgPage(var bean, String cicleId) async {
// if (widget.bean.is_limit&&widget.bean.amount>0) {
// showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){
// widget.bean.is_limit = false;
@ -237,16 +247,22 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
// if ()
var data = await DioManager.instance.get(
url: "/up-service/callout/${bean.id}/chat",);
url: "/up-service/callout/${bean.id}/chat",
);
if (data["code"] == 200) {
pushChatPage(data['data']['account_id'].toString().split("_").last,data['data']['account_id'], bean.user!.nickname!);
pushChatPage(data['data']['account_id'].toString().split("_").last,
data['data']['account_id'], bean.user!.nickname!);
await Future.delayed(Duration(seconds: 1));
SharedPreferences sharedPreferences =await SharedPreferences.getInstance();
SharedPreferences sharedPreferences =
await SharedPreferences.getInstance();
// SharedPreferencesHelper.getInstance().then((sharedPreferences) {
int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID)??0;
String avatar = sharedPreferences.getString(SharedPreferencesHelper.AVATAR)??"";
String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??"";
int userId =
sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0;
String avatar =
sharedPreferences.getString(SharedPreferencesHelper.AVATAR) ?? "";
String name =
sharedPreferences.getString(SharedPreferencesHelper.NAME) ?? "";
// bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name));
// widget.logic.update();
}
@ -258,52 +274,57 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
List<Widget> widgets = [];
int i = 0;
// print(urlList);
if(null!=urlList){
if (null != urlList) {
urlList.forEach((element) {
if(widgets.length>2){
if (widgets.length > 2) {
return;
}
widgets.add(Positioned(
left: 15.sp * i,
child: circleWidget(element.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.id.toString()),
child: circleWidget(
element.avatar! ??
"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",
element.id.toString()),
));
i++;
});
}
return ClipRRect(
borderRadius: BorderRadius.circular(10.sp),
child: Container(
width: Get.width,
padding: EdgeInsets.only(left: 10.sp,right: 10.sp),
padding: EdgeInsets.only(left: 10.sp, right: 10.sp),
// margin:
// EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp),
child:
RefreshIndicator(
onRefresh: () async {
refreshData();
// refreshCircleData();
},
child:
ListView.builder(
child: SmartRefresher(
controller: refreshController,
onRefresh: refreshData,
onLoading: loadMore,
enablePullUp: recomandMore,
child: ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
addAutomaticKeepAlives:false,
addRepaintBoundaries:false,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
scrollDirection: Axis.vertical,
controller: scrollController,
itemCount: likeMore ? lists.length + 1 : lists.length + 1 + recomanddlists.length,
itemCount: likeMore
? lists.length
: lists.length + recomanddlists.length + 1,
itemBuilder: (context, index) {
if (lists.length > index) {
if (lists.length - 1 >= index) {
var list = lists[index];
if (list.isQueen!) {
return vipDynamicItem(list);
} else {
return normalDynamicItem(list);
}
} else if (!likeMore && lists.length == index) {
} else if (!likeMore &&
lists.length == index &&
recomanddlists.isNotEmpty) {
return tipItem();
} else if (index - lists.length < recomanddlists.length) {
} else if (index - lists.length < recomanddlists.length &&
!likeMore) {
var list = recomanddlists[index - lists.length];
if (list.isQueen!) {
return vipDynamicItem(list);
@ -311,14 +332,17 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
return normalDynamicItem(list);
}
} else {
if (recomandMore) return Container();
return Container(
margin: EdgeInsets.only(
top: likeMore ? 0 : 10.sp),
child: likeMore ? loaddingWidget(likeMore) : GestureDetector(
margin: EdgeInsets.only(top: likeMore ? 0 : 10.sp),
child: likeMore
? loaddingWidget(likeMore)
: GestureDetector(
onTap: () {
var homeLogic = Get.find<HomeLogic>();
homeLogic.tabController.animateTo(1, duration: Duration(milliseconds: 0), curve: Curves.ease);
homeLogic.tabController.animateTo(1,
duration: Duration(milliseconds: 0),
curve: Curves.ease);
homeLogic.updateIndex(1);
},
child: Container(
@ -327,13 +351,14 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
alignment: Alignment.center,
children: [
Image.asset(
getCircleImage('add'),
getLoginImage('start_bg'),
width: 180.sp,
),
Text(
'查看更多圈子',
style: TextStyle(
color: Colors.white, fontSize: 18.sp),
color: Colors.white,
fontSize: 18.sp),
)
],
),
@ -342,11 +367,10 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
}
}),
),
));
}
void _showTextContentDialog(BuildContext context, String msg,String title) {
void _showTextContentDialog(BuildContext context, String msg, String title) {
showDialog(
context: context,
builder: (BuildContext context) {
@ -357,7 +381,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
padding: const EdgeInsets.all(1.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
@ -385,31 +408,37 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
top: 15,
left: 0,
right: 0,
child: Center(child: Text(title, style: TextStyle(
color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)),
child: Center(
child: Text(title,
style: TextStyle(
color: const Color(0xFFF7FAFA), fontSize: 16.sp)),
)),
Container(
margin: EdgeInsets.only(top: 24.sp,bottom: 24.sp),
margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp),
child: Container(
margin: EdgeInsets.only(
top: 12.sp, left: 14.sp, right: 14.sp),
margin:
EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp),
alignment: Alignment.center,
child: SingleChildScrollView(child: Text(
child: SingleChildScrollView(
child: Text(
msg,
textAlign: TextAlign.center,
style: TextStyle(
color: const Color(0xCCF7FAFA), fontSize: 16.sp),
),),
),
),
),
),
Positioned(
top:8.sp,
top: 8.sp,
right: 10.sp,
child: GestureDetector(
onTap: () {
Get.back();
},
child: Icon(
Icons.close,color: Colors.white,
Icons.close,
color: Colors.white,
size: 20.sp,
),
)),
@ -439,7 +468,8 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
onTap: () {
// pushOtherPeopleHomePage(element.id.toString());
},
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
child:
circleWidget(element.avatar!, element.id.toString(), width: 24),
),
));
index++;
@ -455,13 +485,12 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
double picHeight = 0.0;
if (lists.album != null) {
if (lists.album!.isNotEmpty) {
Album info = lists.album!.first;
if (info.type == 1) {
double picWidth = (Get.width - 20.sp)/3;
double picWidth = (Get.width - 20.sp) / 3;
if (lists.album!.length > 3) {
picHeight = picWidth * 2;
} else {
@ -473,14 +502,15 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
}
}
double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight + 76.sp;
double widgetHeight =
130.sp + contentHeight(lists.content!) + picHeight + 76.sp;
return GestureDetector(
onTap: () async {
var sp = await SharedPreferencesHelper.getInstance();
String myUserId = sp.getMyUserId();
if(lists.user?.id!.toString() == myUserId){
if (lists.user?.id!.toString() == myUserId) {
Get.toNamed(AppRoutes.UserInfoActivity);
return;
}
@ -496,10 +526,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
image: AssetImage(
getCircleImage('pic_bg'),
))),
child: Stack(children:
[
child: Stack(children: [
Positioned(
left: 0,
top: 2.sp,
@ -509,7 +536,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
Positioned(
right: 2.sp,
top: 2.sp,
child: Stack(
alignment: Alignment.center,
children: [
@ -544,7 +570,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
ClipOval(
child: CachedNetworkImage(
imageUrl:lists.user!.avatar_thumb!,
imageUrl: lists.user!.avatar_thumb!,
width: 40.sp,
height: 40.sp,
fit: BoxFit.cover,
@ -571,10 +597,13 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
SizedBox(
width: 8.sp,
),
lists.user?.vip != null && lists.user!.vip == 0
lists.user?.vip != null &&
lists.user!.vip == 0
? Container()
: Image.asset(
getCircleImage(lists.user!.vip == 1 ? 'vip' : 'year_vip'),
getCircleImage(lists.user!.vip == 1
? 'vip'
: 'year_vip'),
width: 36.sp,
)
],
@ -587,10 +616,11 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
Container(
alignment: Alignment.center,
height: 18.sp,
padding:
EdgeInsets.only(left: 6.sp, right: 6.sp),
padding: EdgeInsets.only(
left: 6.sp, right: 6.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(9.sp),
borderRadius:
BorderRadius.circular(9.sp),
gradient: const LinearGradient(
begin: Alignment(0.25, 0.5),
end: Alignment(0.75, 0.5),
@ -599,8 +629,11 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
Color(0xffB5D3FF)
])),
child: Text(
getAgeCOntent(lists.user!.gender??0, lists.user!.age??0,
lists.user!.role??0, lists.user!.orientation??0),
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,
@ -678,8 +711,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
margin: EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.sp),
color: Color(0x33000000)
),
color: Color(0x33000000)),
child: Row(
children: [
widgets.isNotEmpty
@ -707,7 +739,10 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
)),
GestureDetector(
onTap: () {
pushMsgPage(lists, lists.interest!['id'].toString(),);
pushMsgPage(
lists,
lists.interest!['id'].toString(),
);
// pushHomePage(
// lists, widget.bean.id.toString());
},
@ -727,7 +762,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
left: 2.sp,
child: Container(
width: Get.width - 4.sp - 20.sp,
child: circleInfoItem(lists.interest,lists,index),
child: circleInfoItem(lists.interest, lists, index),
))
])),
);
@ -747,7 +782,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
Album info = lists.album!.first;
if (info.type == 1) {
double picWidth = (Get.width - 20.sp)/3;
double picWidth = (Get.width - 20.sp) / 3;
if (lists.album!.length > 3) {
picHeight = picWidth * 2;
} else {
@ -765,9 +800,9 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
widgets.add(Positioned(
left: 12.sp * index,
child: GestureDetector(
onTap: () {
},
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
onTap: () {},
child:
circleWidget(element.avatar!, element.id.toString(), width: 24),
),
));
index++;
@ -784,7 +819,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
onTap: () async {
var sp = await SharedPreferencesHelper.getInstance();
String myUserId = sp.getMyUserId();
if(lists.user?.id!.toString() == myUserId){
if (lists.user?.id!.toString() == myUserId) {
Get.toNamed(AppRoutes.UserInfoActivity);
return;
}
@ -822,7 +857,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
Container(
width: Get.width,
padding: EdgeInsets.only(left: 12.sp, right: 12.sp),
child: Column(
children: [
@ -840,7 +874,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
ClipOval(
child: CachedNetworkImage(
imageUrl:lists.user!.avatar_thumb!,
imageUrl: lists.user!.avatar_thumb!,
width: 40.sp,
height: 40.sp,
fit: BoxFit.cover,
@ -869,10 +903,13 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
SizedBox(
width: 8.sp,
),
lists.user?.vip != null && lists.user!.vip == 0
lists.user?.vip != null &&
lists.user!.vip == 0
? Container()
: Image.asset(
getCircleImage(lists.user!.vip == 1 ? 'vip' : 'year_vip'),
getCircleImage(lists.user!.vip == 1
? 'vip'
: 'year_vip'),
width: 36.sp,
)
],
@ -898,8 +935,11 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
Color(0xffB5D3FF)
])),
child: Text(
getAgeCOntent(lists.user!.gender??0, lists.user!.age??0,
lists.user!.role??0, lists.user!.orientation??0),
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,
@ -927,16 +967,19 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
child: picHeight == 140.sp
? ClipRRect(
borderRadius: BorderRadius.circular(6.sp),
child: VideoItemWidget(lists.album![0].url!))
child:
VideoItemWidget(lists.album![0].url!))
: GridView.builder(
itemCount: lists.album!.length,
physics: const NeverScrollableScrollPhysics(),
physics:
const NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, //widget
crossAxisSpacing: 8.sp,
mainAxisSpacing: 8.sp,
childAspectRatio: 1.0 //1widget
childAspectRatio:
1.0 //1widget
),
itemBuilder: (contentxt, currentIndex) {
Album album = lists.album![currentIndex];
@ -972,7 +1015,8 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
// strokeWidth: 2.sp,
// ),
// ),
errorWidget: (context, url, error) =>
errorWidget:
(context, url, error) =>
const Icon(Icons.error),
fit: BoxFit.cover,
),
@ -982,8 +1026,12 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
: Container(),
Container(
height: 30.sp,
padding: EdgeInsets.only(left: 5.sp, right: 10.sp,),
margin: EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp),
padding: EdgeInsets.only(
left: 5.sp,
right: 10.sp,
),
margin:
EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.sp),
color: Color(0x33000000)),
@ -1013,8 +1061,9 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
color: Colors.white, fontSize: 14.sp),
)),
GestureDetector(
onTap: () async{
pushMsgPage(lists, lists.interest!['id'].toString());
onTap: () async {
pushMsgPage(
lists, lists.interest!['id'].toString());
// });
},
@ -1025,7 +1074,6 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
],
),
),
],
),
),
@ -1034,7 +1082,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
bottom: 2.sp,
child: Container(
width: Get.width - 4.sp - 20.sp,
child: circleInfoItem(lists.interest,lists,index),
child: circleInfoItem(lists.interest, lists, index),
))
],
)),
@ -1057,32 +1105,43 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
),
if (showTitle)
Text('还没有您喜欢的圈友发布喊话哦~',style: TextStyle(color: Colors.white,fontSize: 16.sp),),
Text(
'还没有您喜欢的圈友发布喊话哦~',
style: TextStyle(color: Colors.white, fontSize: 16.sp),
),
Container(
margin: EdgeInsets.only(top: 20.sp),
padding: EdgeInsets.only(left: 30.sp,right: 30.sp),
padding: EdgeInsets.only(left: 30.sp, right: 30.sp),
child: Row(
children: [
Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)),
Expanded(
child: Container(
height: 2.sp,
color: Colors.white.withOpacity(0.5),
)),
Container(
margin: EdgeInsets.only(left: 8.sp,right: 8.sp),
margin: EdgeInsets.only(left: 8.sp, right: 8.sp),
height: 2.sp,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.5),
borderRadius: BorderRadius.circular(1.sp)
borderRadius: BorderRadius.circular(1.sp)),
),
Text(
'喊话推荐',
style: TextStyle(color: Colors.white, fontSize: 17.sp),
),
Text('喊话推荐',style: TextStyle(color: Colors.white,fontSize: 17.sp),),
Container(
margin: EdgeInsets.only(left: 8.sp,right: 8.sp),
margin: EdgeInsets.only(left: 8.sp, right: 8.sp),
height: 2.sp,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.5),
borderRadius: BorderRadius.circular(1.sp)
borderRadius: BorderRadius.circular(1.sp)),
),
),
Expanded(child: Container(height: 2.sp,color: Colors.white.withOpacity(0.5),)),
Expanded(
child: Container(
height: 2.sp,
color: Colors.white.withOpacity(0.5),
)),
],
),
)
@ -1091,23 +1150,21 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
);
}
circleInfoItem(var bean,Lists list,int index) {
circleInfoItem(var bean, Lists list, int index) {
return GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.Signal_circle_list,
arguments: bean['id'].toString());
},
child: ClipRRect(
borderRadius: BorderRadius.circular(
12.sp),
borderRadius: BorderRadius.circular(12.sp),
child: Container(
padding: EdgeInsets.only(left: 12.sp, right: 12.sp),
height: 72.sp,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image:
AssetImage(getCircleImage('top_circle_bg')))),
image: AssetImage(getCircleImage('top_circle_bg')))),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -1130,13 +1187,12 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: CachedNetworkImage(
imageUrl:bean['image'],
imageUrl: bean['image'],
width: 40.sp,
height: 40.sp,
memCacheHeight: 40,
memCacheWidth: 40,
fit:BoxFit.cover
),
fit: BoxFit.cover),
),
),
Expanded(
@ -1169,30 +1225,42 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
],
),
)),
GestureDetector(//
GestureDetector(
//
onTap: () async {
CircleLogic cLogic = Get.find<CircleLogic>();
if (bean['is_join']) {
var data = await DioManager.instance.get(
url: "/up-service/interest/${bean['id']}",);
url: "/up-service/interest/${bean['id']}",
);
if (data["code"] == 200) {
Circle info = Circle.fromJson(data['data']);
Get.bottomSheet(
CircleShare('','',info), isScrollControlled: true,
enableDrag: false
);
Get.bottomSheet(CircleShare('', '', info),
isScrollControlled: true, enableDrag: false);
}
} else {
await cLogic.outCircle(
bean['id'].toString(),
bean['is_join']);
bean['id'].toString(), bean['is_join']);
bean['is_join'] = !bean['is_join'];
list.interest = bean;
lists[index] = list;
setState(() {
if (recomanddlists.isNotEmpty) {
recomanddlists.forEach((element) {
if (element.interest!['id'].toString() == bean['id'].toString()) {
element.interest!['is_join'] = true;
element.interest = element.interest!;
}
});
}
if (lists.isNotEmpty) {
lists.forEach((element) {
if (element.interest!['id'].toString() == bean['id'].toString()) {
element.interest!['is_join'] = true;
element.interest = element.interest!;
}
});
}
setState(() {});
}
},
child: Stack(
alignment: Alignment.center,
@ -1203,8 +1271,8 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
Text(
!bean['is_join'] ? '申请加入' : '分享有奖',
style: TextStyle(
color: Colors.white, fontSize: 12.sp),
style:
TextStyle(color: Colors.white, fontSize: 12.sp),
)
],
))
@ -1214,9 +1282,9 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
);
}
circleWidget(String url, String userId,{double width = 24}) {
circleWidget(String url, String userId, {double width = 24}) {
return GestureDetector(
onTap: (){
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId);
},
child: Stack(
@ -1228,7 +1296,8 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
),
ClipOval(
child: CachedNetworkImage(
imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",
imageUrl: url ??
"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",
width: (width - 1).sp,
height: (width - 1).sp,
fit: BoxFit.cover,
@ -1240,8 +1309,7 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
));
}
void _showOutCircleDialog(
BuildContext context, var controller, var bean) {
void _showOutCircleDialog(BuildContext context, var controller, var bean) {
showDialog(
context: context,
builder: (BuildContext context) {
@ -1336,9 +1404,8 @@ class _LikeViewState extends State<LikeView> with AutomaticKeepAliveClientMixin
GestureDetector(
onTap: () async {
Navigator.pop(context);
await controller
.outCircle(bean['id'].toString(), bean['is_join']);
await controller.outCircle(
bean['id'].toString(), bean['is_join']);
},
child: Container(
margin: EdgeInsets.only(top: 24.sp),

View File

@ -203,7 +203,7 @@ class UnlockCallDialog extends GetxController {
child: Row(
children: [
Text(
'${int.parse(amount)}',
'${double.parse(amount).toInt()}',
style: TextStyle(
color: Color(0xffE845FF),
fontSize: 16.sp,
@ -213,7 +213,7 @@ class UnlockCallDialog extends GetxController {
width: 2.sp,
),
Text(
'(原价${int.parse(oldAmount)})',
'(原价${double.parse(oldAmount).toInt()})',
style: TextStyle(
color: Colors.white70,
fontSize: 16.sp,

View File

@ -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<UpdateDialog> {
// SmartDialog.dismiss();
print(error);
});
// await AppInstaller.installApk(filePath, actionRequired: false);
await AppInstaller.installApk(filePath, actionRequired: false);
}
}

View File

@ -40,7 +40,16 @@ class HomeLogic extends GetxController {
final RxString unreadSIze = "0".obs;
final RxBool showcirlceUnred = false.obs;
late V2TimSimpleMsgListener msgListener;
@override
void onClose() {
// TODO: implement onClose
super.onClose();
TencentImSDKPlugin.v2TIMManager
.v2TIMMessageManager.removeAdvancedMsgListener();
}
@override
void onInit() async {
@ -55,11 +64,15 @@ class HomeLogic extends GetxController {
tabs.add(MsgPage());
tabs.add(MinefragmentPage());
EventBusManager.on<RefreshUnread>().listen((event) {
// EventBusManager.on<RefreshUnread>().listen((event) {
// getUnreadSize();
// });
getUnreadSize();
});
getUnreadSize();
var msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: (
msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: (
msgID,
userInfo,
text,
@ -113,6 +126,25 @@ class HomeLogic extends GetxController {
});
TencentImSDKPlugin.v2TIMManager
.v2TIMMessageManager.addAdvancedMsgListener(
listener: V2TimAdvancedMsgListener(
onRecvNewMessage: (message) {
print(message);
if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) {
if ( message.customElem?.data != null) {
print(message.customElem!.data!);
Map jsonData = jsonDecode(message.customElem!.data!);
String event = jsonData['event'].toString();
if (int.parse(event) == 3) {
showOKToast(message.customElem!.desc!.toString());
EventBusManager.fire(LikeRefresh());
}
}
}
}
)
);

View File

@ -18,7 +18,7 @@ class HomePage extends StatefulWidget {
}
class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin {
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
@override
bool get wantKeepAlive => true;
@ -27,7 +27,11 @@ class _HomePageState extends State<HomePage>
void initState() {
// TODO: implement initState
super.initState();
logic.tabController = TabController(length: 4, vsync: this, initialIndex: 0,animationDuration: Duration.zero);
logic.tabController = TabController(
length: 4,
vsync: this,
initialIndex: 0,
animationDuration: Duration.zero);
}
@override
@ -94,7 +98,8 @@ class _HomePageState extends State<HomePage>
behavior: HitTestBehavior.opaque,
onTap: () {
if (!isSelected) {
logic.tabController.animateTo(index, duration: Duration(milliseconds: 0), curve: Curves.ease);
logic.tabController.animateTo(index,
duration: Duration(milliseconds: 0), curve: Curves.ease);
controller.updateIndex(index);
}
},
@ -119,15 +124,15 @@ class _HomePageState extends State<HomePage>
// right: 4.sp,
top: 10.sp,
child: Container(
width: 14.sp,
height: 14.sp,
margin: EdgeInsets.only(
left:24.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)]),
colors: controller.showcirlceUnred.value
? [Color(0xFFC343F9), Color(0xFFFB34B2)]
: [Color(0xFFC343F9), Color(0xFFFB34B2)]),
border:
Border.all(color: Color(0xFF170730), width: 1.sp))),
))),

View File

@ -155,6 +155,17 @@ class LikeLogic extends GetxController {
showOKToast(bean.msg);
}
setTopCircle(String interest_id,bool isStatus) async {
var data = await DioManager.instance.post(
url: Api.circleTop,
params: {"interestId": interest_id,'isTop' :isStatus ? 1 : 0});
var bean = BaseResponse<String>.fromJson(data, (data) => data);
if (bean.code == 200) {
relaodMyData();
}
showOKToast(bean.msg);
}
loadCalloutsNew() async {
List<String> idList = [];

View File

@ -1,9 +1,13 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/app/circle/logic.dart';
import 'package:circle_app/app/circle/widgets/info_list_view.dart';
import 'package:circle_app/app/select_circle/logic.dart';
import 'package:circle_app/common/Widgets/circle_share.dart';
import 'package:circle_app/common/Widgets/text_more.dart';
import 'package:circle_app/main.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
@ -12,11 +16,48 @@ import 'package:get/get.dart';
import 'logic.dart';
class LikePage extends StatelessWidget {
class LikePage extends StatefulWidget {
LikePage({Key? key}) : super(key: key);
@override
State<LikePage> createState() => _LikePageState();
}
class _LikePageState extends State<LikePage> with RouteAware {
final ctr = Get.lazyPut(() => LikeLogic());
final logic = Get.find<LikeLogic>();
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute);
}
@override
void dispose() {
routeObserver.unsubscribe(this);
super.dispose();
}
void didPopNext() {
print('didPopNext');
logic.loadMyCircleData();
}
///
void didPush() {
print('didPopNext');
}
void didPop() {
print('didPop');
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -70,7 +111,8 @@ class LikePage extends StatelessWidget {
logic.currentIndex,
logic.mycircle.lists[logic.currentIndex],
logic,
key: ValueKey('${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'),
key: ValueKey(
'${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'),
)))
],
),
@ -91,7 +133,7 @@ class LikePage extends StatelessWidget {
child: ListView.builder(
controller: logic.rightCtr,
itemBuilder: (context, index) {
return circleInfoItem(logic.circle.lists[index]);
return circleInfoItem(logic.circle.lists[index],index);
},
itemCount: logic.circle.lists.length,
)),
@ -112,7 +154,7 @@ class LikePage extends StatelessWidget {
);
}
circleInfoItem(Circle bean) {
circleInfoItem(Circle bean,int index) {
List<JoinUser> urlList = bean.lastJoinUsers;
List<Widget> widgets = [];
int i = 0;
@ -133,10 +175,20 @@ class LikePage extends StatelessWidget {
});
}
return GestureDetector(
onTap: () {
// if (bean.isJoin) {
Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id);
// }
onTap: () async {
var result = await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id);
var data = await DioManager.instance.get(
url: "/up-service/interest/${bean.id}",);
if (data["code"] == 200) {
var bean = Circle.fromJson(data['data']);
logic.circle.lists[index] = bean;
if (mounted) {
setState(() {
});
}
}
},
child: Container(
margin: EdgeInsets.only(bottom: 10.sp),
@ -261,9 +313,9 @@ class LikePage extends StatelessWidget {
additionText: '查看更多',
maxLines: 3,
style:
TextStyle(color: Colors.white, fontSize: 14.sp),
TextStyle(color: Colors.white, fontSize: 17.sp),
additionStyle: TextStyle(
color: const Color(0xFFFF4DF6), fontSize: 14.sp),
color: const Color(0xFFFF4DF6), fontSize: 17.sp),
onTap: () {
_showTextContentDialog(
Get.context!, bean.intro, bean.title);
@ -365,6 +417,27 @@ class LikePage extends StatelessWidget {
logic.update();
}
},
onLongPress: () {
if (index >= 0) {
int count = 0;
for(int i = 0; i < logic.mycircle.lists.length; i++) {
if (logic.mycircle.lists[i].is_top) {
count++;
}
if (count == 5 || i > 5) {
break;
}
}
if (count == 5 && !logic.mycircle.lists[index].is_top) {
showOKToast('圈子置顶最多五个哦~');
} else {
_showSetTopCircleDialog(Get.context!,logic,logic.mycircle.lists[index]);
}
}
},
child: Container(
width: 65.sp,
height: 65.sp,
@ -373,16 +446,20 @@ class LikePage extends StatelessWidget {
alignment: Alignment.center,
children: [
if (text.isEmpty)
topCicleStatusItem(
isSelcted,
Image.asset(
getCircleImage('circile_all_icon'),
width: 55.sp,
),
)),
if (text.isNotEmpty)
cicleStatusItem(
isSelcted,
Container(
margin: EdgeInsets.all(6.sp),
// margin: EdgeInsets.all(6.sp),
// padding: EdgeInsets.only(left: 4.sp),
alignment: Alignment.center,
padding: EdgeInsets.all(6.sp),
// padding: EdgeInsets.all(6.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7.sp),
gradient: LinearGradient(
@ -397,7 +474,7 @@ class LikePage extends StatelessWidget {
fontWeight: FontWeight.w600),
textAlign: TextAlign.center,
),
),
)),
if (isUnread)
Positioned(
right: 6.sp,
@ -418,6 +495,77 @@ class LikePage extends StatelessWidget {
);
}
cicleStatusItem(bool isSelected, Widget widget) {
return Container(
width: 48.sp,
height: 48.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7.0),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: isSelected
? [
Color(0xFF71F3F2),
Color(0xFFF558FF),
]
: [
Colors.transparent,
Colors.transparent,
],
stops: [0.0365, 0.9427],
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(7.0),
child: Container(
padding: EdgeInsets.all(isSelected ? 1.sp : 0.sp),
color: Color(0x14022AFF),
child: widget,
)),
);
}
topCicleStatusItem(bool isSelected, Widget widget) {
return Container(
alignment: Alignment.center,
width: 48.sp,
height: 48.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7.0),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: isSelected
? [
Color(0xFF71F3F2),
Color(0xFFF558FF),
]
: [
Colors.transparent,
Colors.transparent,
],
stops: [0.0365, 0.9427],
),
),
child: Container(
width: 47.sp,
height: 47.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7.sp),
gradient: LinearGradient(
colors: [Color(0xFF3F6967), Color(0xFF5C3769)])),
// padding: EdgeInsets.all(isSelected ? 1.sp : 0),
child: ClipRRect(
borderRadius: BorderRadius.circular(7.0),
child: Container(
margin: EdgeInsets.all(isSelected ? 1.sp : 0.sp),
color: Color(0x14022AFF),
child: widget,
))),
);
}
void _showTextContentDialog(BuildContext context, String msg, String title) {
showDialog(
context: context,
@ -498,4 +646,140 @@ class LikePage extends StatelessWidget {
);
}
void _showSetTopCircleDialog(BuildContext context, var controller, var bean) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: Container(
height: 160.sp,
padding: EdgeInsets.all(1.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.all(1.sp),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.only(top: 24.sp),
child: Column(
children: [
Center(
child: Text(
"提示",
style:
TextStyle(color: Colors.white, fontSize: 16.sp),
),
),
Container(
margin: EdgeInsets.only(
top: 12.sp, left: 14.sp, right: 14.sp),
alignment: Alignment.center,
child: Text(
bean.is_top ? "是否取消置顶该圈子。" : "是否置顶该圈子。",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xCCF7FAFA), fontSize: 16.sp),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
margin: EdgeInsets.only(top: 30.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0x26FFFFFF),
Color(0x26FFFFFF),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
SizedBox(width: 24.sp),
GestureDetector(
onTap: () {
Navigator.pop(context);
logic.setTopCircle(bean.id.toString(), !bean.is_top);
},
child: Container(
margin: EdgeInsets.only(top: 24.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
)
],
)
],
),
)
],
),
),
);
},
);
}
}

View File

@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:math';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_slidable_for_tencent_im/flutter_slidable.dart';
@ -44,7 +45,6 @@ class TIMConversation extends StatefulWidget {
final AutoScrollController? autoScrollController;
final ScrollController? scrollController;
/// the builder for conversation item
@ -160,21 +160,30 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
serviceLocator<TUIConversationViewModel>();
late TIMUIKitConversationController _timuiKitConversationController;
final TUIThemeViewModel themeViewModel = serviceLocator<TUIThemeViewModel>();
final TUIFriendShipViewModel friendShipViewModel =
serviceLocator<TUIFriendShipViewModel>();
// final TUIFriendShipViewModel friendShipViewModel =
// serviceLocator<TUIFriendShipViewModel>();
bool hasMore = true;
@override
void initState() {
super.initState();
final controller = getController();
widget.scrollController!.addListener(() {
try {
if (widget.scrollController!.position.pixels ==
widget.scrollController!.position.maxScrollExtent && hasMore) {
_timuiKitConversationController.loadData();
}
} catch (_) {}
});
_timuiKitConversationController = controller;
_timuiKitConversationController.model = model;
}
scrollToTop() {
widget.autoScrollController!.animateTo(
0.0, // Scroll to the top
0, // Scroll to the top
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
@ -191,7 +200,7 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
model.setSelectedConversation(conversation);
}
_clearHistory(V2TimConversation conversationItem) async{
_clearHistory(V2TimConversation conversationItem) async {
await _timuiKitConversationController.clearHistoryMessage(
conversation: conversationItem);
await Future.delayed(Duration(seconds: 1));
@ -204,7 +213,7 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
isPinned: !conversation.isPinned!);
}
_deleteConversation(V2TimConversation conversation) async{
_deleteConversation(V2TimConversation conversation) async {
await _timuiKitConversationController.deleteConversation(
conversationID: conversation.conversationID);
await Future.delayed(Duration(seconds: 1));
@ -217,15 +226,15 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
(element) => (element?.groupID != null || element?.userID != null))
.toList();
// userID
// userID qpqz_prod_10_10000000000
String devtTargetUserID = "qpqz_dev_10_10000000000";
String prodTargetUserID = "qpqz_dev_10_10000000000";
String prodTargetUserID = "qpqz_prod_10_10000000000";
filteredConversationList = filteredConversationList
.where((conversation) =>
conversation?.userID != devtTargetUserID ||conversation?.userID != prodTargetUserID)
conversation?.userID != devtTargetUserID &&
conversation?.userID != prodTargetUserID)
.toList();
if (widget.conversationCollector != null) {
filteredConversationList = filteredConversationList
.where(widget.conversationCollector!)
@ -384,14 +393,12 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
return MultiProvider(
providers: [
ChangeNotifierProvider.value(value: model),
ChangeNotifierProvider.value(value: friendShipViewModel)
// ChangeNotifierProvider.value(value: friendShipViewModel)
],
builder: (BuildContext context, Widget? w) {
final _model = Provider.of<TUIConversationViewModel>(context);
bool haveMoreData = _model.haveMoreData;
final _friendShipViewModel =
Provider.of<TUIFriendShipViewModel>(context);
_model.lifeCycle = widget.lifeCycle;
hasMore = _model.haveMoreData;
// _model.lifeCycle = widget.lifeCycle;
List<V2TimConversation?> filteredConversationList =
getFilteredConversation();
@ -413,31 +420,43 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
future: getUserListInfo(userIdList),
builder: (BuildContext context,
AsyncSnapshot<List<V2TimUserFullInfo>> snapshot) {
// if (snapshot.connectionState != ConnectionState.done ||
// haveMoreData) {
// if (haveMoreData) {
// _timuiKitConversationController.loadData();
// }
//
// return Container();
// }
return ListView.builder(
controller: widget.scrollController!,
shrinkWrap: true,
itemCount: filteredConversationList.length,
itemBuilder: (context, index) {
if (index == filteredConversationList.length - 1) {
if (haveMoreData) {
_timuiKitConversationController.loadData();
}
}
// if (index == filteredConversationList.length - 1) {
// if (haveMoreData) {
// loaddingWidget(true);
// // _timuiKitConversationController.loadData();
// } else {
// return Container();
// }
// }
final conversationItem =
filteredConversationList[index];
final V2TimUserStatus? onlineStatus =
_friendShipViewModel.userStatusList.firstWhere(
(item) =>
item.userID == conversationItem?.userID,
orElse: () =>
V2TimUserStatus(statusType: 0));
// final V2TimUserStatus? onlineStatus =
// _friendShipViewModel.userStatusList.firstWhere(
// (item) =>
// item.userID == conversationItem?.userID,
// orElse: () =>
// V2TimUserStatus(statusType: 0));
if (widget.itemBuilder != null) {
return widget.itemBuilder!(
conversationItem!, onlineStatus);
}
// if (widget.itemBuilder != null) {
// return widget.itemBuilder!(
// conversationItem!, onlineStatus);
// }
final slideChildren =
_getSlideBuilder()(conversationItem!);
@ -454,16 +473,26 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
ConnectionState.done) {
if ((snapshot.data ?? []).isNotEmpty) {
snapshot.data!.forEach((element) {
if (element.userID == conversationItem.userID) {
if (element.userID ==
conversationItem.userID) {
userFullInfo = element;
}
});
//
V2TimUserFullInfo myuserFullInfo =snapshot.data!.where((element) => element.userID! == model.selfInfoViewModel.loginInfo!.userID!).toList().first;
V2TimUserFullInfo myuserFullInfo = snapshot
.data!
.where((element) =>
element.userID! ==
model.selfInfoViewModel.loginInfo!
.userID!)
.toList()
.first;
if (userFullInfo!.customInfo!
.containsKey('Label')) {
if (userFullInfo!
.customInfo!['Label']
.toString().isNotEmpty) {
var otherInfo = jsonDecode(userFullInfo!
.customInfo!['Label']
.toString());
@ -472,14 +501,14 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
.toString());
if (myInfo != null) {
if (myInfo.containsKey('city')) {
if (myInfo['city']
.toString()
.contains(otherInfo['city'].toString())) {
if (myInfo['city'].toString().contains(
otherInfo['city'].toString())) {
isSameCity = true;
}
}
}
}
}
if (userFullInfo != null) {
List<String> userIdList =
@ -493,7 +522,6 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
}
}
}
}
Widget conversationLineItem() {
@ -524,7 +552,7 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
conversationItem.userID != null &&
conversationItem
.userID!.isNotEmpty)
? onlineStatus
? null
: null,
draftTimestamp:
conversationItem.draftTimestamp,
@ -590,20 +618,18 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
? widget.emptyBuilder!()
: Container());
}
// EasyRefresh(
// header: CustomizeBallPulseHeader(color: theme.primaryColor),
// onRefresh: () async {
// model.refresh();
// },
// child:
return TUIKitScreenUtils.getDeviceWidget(
defaultWidget: SlidableAutoCloseBehavior(
child: EasyRefresh(
header: CustomizeBallPulseHeader(color: theme.primaryColor),
onRefresh: () async {
model.refresh();
},
child:SingleChildScrollView(
controller: widget.scrollController,
child: conversationList(),
),
),
),
desktopWidget: Scrollbar(
controller: widget.autoScrollController!,
child: conversationList()));

View File

@ -3,17 +3,20 @@ import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'state.dart';
class MsgLogic extends GetxController {
final MsgState state = MsgState();
List<UserListItem> lists = [];
ScrollController listScrollController = ScrollController();
@override
void onInit() {
// TODO: implement onInit
super.onInit();
loadLikeData();
}
loadLikeData() async {

View File

@ -23,12 +23,16 @@ import 'logic.dart';
const msgBgWidget = DecorationImage(
fit: BoxFit.fill,
image: AssetImage('assets/images/base/home_back.png'));
class MsgPage extends StatelessWidget {
class MsgPage extends StatefulWidget {
MsgPage({Key? key}) : super(key: key);
@override
State<MsgPage> createState() => _MsgPageState();
}
class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
final ctr = Get.put(MsgLogic());
var logic = Get.find<CircleLogic>();
void getPipeiData() async {
var data = await DioManager.instance
.get(url: Api.getMatch);
@ -46,7 +50,6 @@ class MsgPage extends StatelessWidget {
}
}
showRechargeDialog(){
Get.bottomSheet(
Scaffold(
@ -73,7 +76,19 @@ class MsgPage extends StatelessWidget {
// tipWidget(),
// reconmandWidget(),
// Text(controller.state.msg),
Expanded(child: msgWdiget(context))
Expanded(child: TIMConversation(
autoScrollController: logic.scrollController,
scrollController: logic.listScrollController,
onTapItem: (selectedConv) async{
String type = selectedConv.userID!.split('_')[2];
if (int.parse(type) == 11) {
Get.toNamed(AppRoutes.Sys_notify_list, arguments: selectedConv);
return;
}
Get.toNamed(AppRoutes.Chat, arguments: selectedConv);
},
))
],
);
}),
@ -371,4 +386,8 @@ class MsgPage extends StatelessWidget {
Widget msgItem(conv, status) {
return Container();
}
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
}

View File

@ -504,140 +504,5 @@ class _My_circlePageState extends State<My_circlePage>
);
}
void _showOutCircleDialog(BuildContext context, var controller, Circle bean) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: Container(
height: 160.sp,
padding: EdgeInsets.all(1.0),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.all(1.sp),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10.0),
gradient: LinearGradient(
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
Container(
margin: EdgeInsets.only(top: 24.sp),
child: Column(
children: [
Center(
child: Text(
"提示",
style:
TextStyle(color: Colors.white, fontSize: 16.sp),
),
),
Container(
margin: EdgeInsets.only(
top: 12.sp, left: 14.sp, right: 14.sp),
alignment: Alignment.center,
child: Text(
"是否确认退出该圈子。",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xCCF7FAFA), fontSize: 16.sp),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
margin: EdgeInsets.only(top: 30.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0x26FFFFFF),
Color(0x26FFFFFF),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
SizedBox(width: 24.sp),
GestureDetector(
onTap: () {
Navigator.pop(context);
logic.outCircle(bean.id.toString(), bean.isJoin);
},
child: Container(
margin: EdgeInsets.only(top: 24.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 10.sp,
bottom: 10.sp,
left: 52.sp,
right: 52.sp),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
)
],
)
],
),
)
],
),
),
);
},
);
}
}

View File

@ -272,8 +272,8 @@ class MyTabbedScreenState extends State<UserinfoPage>
borderRadius: BorderRadius.circular(17.sp),
gradient: const LinearGradient(
colors: [
Color(0x26FFFFFF),
Color(0x26FFFFFF),
Color(0xaaDC5BFD),
Color(0xaa06F9FA),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,

View File

@ -33,6 +33,9 @@ import 'package:tencent_chat_push_for_china/tencent_chat_push_for_china.dart';
import 'app/login/login/logic.dart';
import 'app/splash/view.dart';
/// routeObserver
final RouteObserver<PageRoute> routeObserver = RouteObserver();
final CoreServicesImpl coreInstance = TIMUIKitCore.getInstance();
final TUIChatSeparateViewModel chatSeparateViewModel =
TUIChatSeparateViewModel();
@ -524,6 +527,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
Locale('en', 'US'),
],
home: SplashPage(),
navigatorObservers: [routeObserver],
builder: FlutterSmartDialog.init(),
debugShowCheckedModeBanner: false,
)));

View File

@ -303,6 +303,7 @@ class Api {
//
static const calloutsNew = '/up-service/interests/callouts/new';
//
static const circleTop = '/up-service/interest/top';
}

View File

@ -63,3 +63,8 @@ class ScrollToTop {
class RefreshUnread {
}
class LikeRefresh {
}

View File

@ -315,6 +315,24 @@ class CustomLoadFooter extends StatelessWidget {
}
}
class CustomLikeLoadFooter extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClassicFooter(
//
canLoadingText: "松手开始加载数据",
loadingText: "正在加载...",
idleText: "上拉加载更多",
noDataText: "",
height: 20.sp,
spacing: 5,
failedText: "加载失败",
);
}
}
//
Future<String> getApplicationDocumentsDirectoryPath() async {
final directory = await getApplicationDocumentsDirectory();

View File

@ -606,6 +606,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.3"
flutter_install_app:
dependency: "direct main"
description:
name: flutter_install_app
sha256: "9b117006d17c900e671c26bcbc9b15c7b8efd15d6f9b4442ad5d576de20fab53"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
flutter_intl:
dependency: "direct main"
description:

View File

@ -95,7 +95,7 @@ dependencies:
#event_bus:
event_bus: ^2.0.0
#安装apk
# flutter_install_app: 1.3.0
flutter_install_app: 1.3.0
#闪屏页
flutter_native_splash: 2.2.16
#腾讯离线推送