1167 lines
44 KiB
Dart
1167 lines
44 KiB
Dart
|
||
import 'dart:io';
|
||
|
||
import 'package:cached_network_image/cached_network_image.dart';
|
||
import 'package:circle_app/app/circle/view.dart';
|
||
import 'package:circle_app/common/Widgets/base_tip_widget.dart';
|
||
import 'package:circle_app/common/Widgets/genderview.dart';
|
||
import 'package:circle_app/common/colors/app_color.dart';
|
||
import 'package:circle_app/common/const.dart';
|
||
import 'package:circle_app/main.dart';
|
||
import 'package:circle_app/network/api.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/util.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||
import 'package:get/get.dart';
|
||
import 'package:get/utils.dart';
|
||
import 'package:intl/intl.dart';
|
||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||
import '../../../../util/eventBus.dart';
|
||
|
||
const String todayAddWxStatus = 'todayAddWxStatus';
|
||
|
||
class Discover extends StatefulWidget {
|
||
int unlockWxNum;
|
||
Discover(this.unlockWxNum, {super.key});
|
||
@override
|
||
_DiscoverState createState() => _DiscoverState();
|
||
}
|
||
|
||
class _DiscoverState extends State<Discover>
|
||
with AutomaticKeepAliveClientMixin {
|
||
// TODO: add state variables and methods
|
||
@override
|
||
bool get wantKeepAlive => true;
|
||
// TODO: add state variables and methods
|
||
ScrollController _scrollController = ScrollController();
|
||
RefreshController refreshController = RefreshController();
|
||
var refreshSignSub;
|
||
var sub;
|
||
var sub1;
|
||
var subscripition;
|
||
List list = [];
|
||
List giftList = [];
|
||
bool isMore = true;
|
||
int index = 1;
|
||
List tagList = [];
|
||
|
||
List<String> genderList = [];List<String> orientationList= [];List<String> roleList= [];
|
||
bool isPop = false;
|
||
//获取屏幕宽度
|
||
|
||
Offset pointerStart = Offset.zero;
|
||
Offset pointerEnd = Offset.zero;
|
||
double touchRangeY = 0;
|
||
double nextOffset = 0;
|
||
int lastPage = 0;
|
||
|
||
double screenHeight = 0;
|
||
|
||
|
||
void animateToOffset(ScrollController controller, double offset,
|
||
void Function() onScrollCompleted) {
|
||
controller
|
||
.animateTo(offset,
|
||
duration: const Duration(milliseconds: 200), curve: Curves.easeIn)
|
||
.then((value) {
|
||
if (onScrollCompleted != null) {
|
||
onScrollCompleted();
|
||
}
|
||
}).catchError((e) {
|
||
print(e);
|
||
});
|
||
}
|
||
// 按下时保存当前的点
|
||
|
||
// 按下时保存当前的点
|
||
PointerDownEventListener getPointDownListenerInHorizontal() {
|
||
return (event) {
|
||
pointerStart = event.position;
|
||
};
|
||
}
|
||
|
||
// 抬起时触发
|
||
PointerUpEventListener getPointUpListenerInHorizontal() {
|
||
return (event) {
|
||
pointerEnd = event.position;
|
||
touchRangeY = pointerStart.dy - pointerEnd.dy;
|
||
|
||
if (touchRangeY.abs() < screenHeight / 8) {
|
||
// 滑动距离大于屏幕宽度的1/8就可以继续翻页了
|
||
nextOffset = (screenHeight + 5.sp) * lastPage;
|
||
animateToOffset(_scrollController, nextOffset, () {});
|
||
return;
|
||
}
|
||
if (touchRangeY < 0 && lastPage > 0) {
|
||
// 手指从下向上滑动
|
||
lastPage--;
|
||
animateToOffset(
|
||
_scrollController, lastPage * ( screenHeight + 5.sp), () {});
|
||
} else if (touchRangeY > 0 && lastPage < list.length - 1) {
|
||
// 从上向下
|
||
lastPage++;
|
||
animateToOffset(
|
||
_scrollController, lastPage * (screenHeight + 5.sp), () {});
|
||
if (lastPage == 3 && isPop == false && widget.unlockWxNum == 0) {
|
||
isPop = true;
|
||
//弹窗提示
|
||
checkIsPopWxTip();
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
@override
|
||
void dispose() {
|
||
// TODO: implement dispose
|
||
super.dispose();
|
||
if (widget.unlockWxNum == 0) {
|
||
subscripition.cancel();
|
||
}
|
||
sub.cancel();
|
||
sub1.cancel();
|
||
}
|
||
|
||
@override
|
||
void initState() {
|
||
// TODO: implement initState
|
||
super.initState();
|
||
loadData();
|
||
if (widget.unlockWxNum == 0) {
|
||
subscripition = EventBusManager.on<DiscoverDataRefresh>().listen((event) {
|
||
refreshData();
|
||
});
|
||
}
|
||
|
||
|
||
sub = EventBusManager.on<DiscovrScrollTap>().listen((event) {
|
||
pointerStart = Offset.zero;
|
||
pointerEnd = Offset.zero;
|
||
lastPage = 0;
|
||
_scrollController.animateTo(0,
|
||
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
|
||
});
|
||
sub1 = EventBusManager.on<OptionFindclass>().listen((event) {
|
||
genderList = event.genderList!;
|
||
orientationList = event.orientationList!;
|
||
roleList = event.roleList!;
|
||
index = 1;
|
||
loadData();
|
||
});
|
||
|
||
refreshSignSub = EventBusManager.on<DiscoverDataRefresh>().listen((event) {
|
||
loadSignDiscoverData(event.userId);
|
||
});
|
||
}
|
||
|
||
setLike(String userId, bool isLike, Function callBack) async {
|
||
// if (isBlack || isDestroy) {
|
||
// showOKToast("喜欢失败,存在拉黑关系或者该账户已注销");
|
||
// return;
|
||
// }
|
||
|
||
var data = await DioManager.instance.post(
|
||
url: "${Api.setLike + userId}/follow",
|
||
params: {'status': isLike ? "0" : "1"});
|
||
var bean = BaseResponse<dynamic>.fromJson(
|
||
data,
|
||
(jsonData) => jsonData,
|
||
);
|
||
if (bean.isSuccess()) {
|
||
callBack();
|
||
}
|
||
showOKToast(bean.msg);
|
||
}
|
||
|
||
loadSignDiscoverData(String userId) async {
|
||
try {
|
||
var result = await DioManager.instance
|
||
.get(url: Api.getFindPageUserByUserId, params: {
|
||
'userId': userId,
|
||
'lat': '0',
|
||
'lng': '0',
|
||
});
|
||
|
||
int initIndex = 0;
|
||
list.forEach((element) {
|
||
if (element['id'].toString() == userId) {
|
||
initIndex = list.indexOf(element);
|
||
}
|
||
});
|
||
|
||
list[initIndex] = result['data'];
|
||
setState(() {});
|
||
} catch (e) {
|
||
|
||
}
|
||
}
|
||
|
||
loadGiftListData() async {
|
||
// var result = await DioManager.instance.get(url: Api.giftList);
|
||
// if (result['code'] == 10000) {
|
||
// giftList = result['data'];
|
||
// await loadData();
|
||
// setState(() {});
|
||
// }
|
||
}
|
||
|
||
loadData() async {
|
||
var data = await DioManager.instance.post(url: Api.findPage, params: {
|
||
'page': index,
|
||
'pageSize': 8,
|
||
'unlockWxNum': widget.unlockWxNum,
|
||
"genders": genderList,
|
||
"roles": roleList,
|
||
"orientations": orientationList,
|
||
'lat': '0',
|
||
'lng': '0',
|
||
});
|
||
//
|
||
if (data['code'] == 200) {
|
||
List dataList = data['data'];
|
||
|
||
if (dataList.isNotEmpty) {
|
||
if (index == 1) {
|
||
list = dataList;
|
||
refreshController.refreshCompleted();
|
||
} else {
|
||
list.addAll(dataList);
|
||
}
|
||
|
||
index = index + 1;
|
||
isMore = true;
|
||
refreshController.loadComplete();
|
||
} else {
|
||
isMore = false;
|
||
refreshController.loadNoData();
|
||
}
|
||
if (mounted) {
|
||
setState(() {});
|
||
}
|
||
}
|
||
}
|
||
|
||
void refreshData() {
|
||
index = 1;
|
||
loadData();
|
||
}
|
||
|
||
_onLoading() {
|
||
loadData();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
// TODO: add widget build method
|
||
|
||
/// 延时一下,需要等state layout结束之后才能获取size
|
||
Future.delayed(Duration(milliseconds: 100), () {
|
||
if (!mounted) return;
|
||
if (screenHeight == 0 && list.isNotEmpty) {
|
||
var size = context?.findRenderObject()?.paintBounds?.size;
|
||
screenHeight = size!.height - 20.sp;
|
||
setState(() {
|
||
|
||
});
|
||
print(size.toString());
|
||
}
|
||
|
||
});
|
||
|
||
return list.isEmpty
|
||
? isMore
|
||
? loaddingWidget(true)
|
||
: noResultWidget(tip: '已解锁微信的圈友会展示在这里哦~')
|
||
: Stack(
|
||
fit: StackFit.expand,
|
||
children: [
|
||
Container(color: Colors.transparent),
|
||
Listener(
|
||
onPointerDown: getPointDownListenerInHorizontal(),
|
||
onPointerUp: getPointUpListenerInHorizontal(),
|
||
child: SmartRefresher(
|
||
onRefresh: refreshData,
|
||
controller: refreshController,
|
||
onLoading: _onLoading,
|
||
enablePullUp: true,
|
||
child: ListView.builder(
|
||
|
||
itemBuilder: (context, index) {
|
||
var user = Users.fromJson(list[index]);
|
||
|
||
String onLineStr = '';
|
||
if (user.online! ?? false) {
|
||
onLineStr = '当前在线';
|
||
if (user.distance != null) {
|
||
if (user.distance! < 100) {
|
||
onLineStr = '当前在线 · ${user.distance!.toInt()}km';
|
||
}
|
||
}
|
||
} else {
|
||
if (user.distance != null) {
|
||
if ((user.distance! ?? 10) < 100) {
|
||
onLineStr = '${user.distance!.toInt()}km';
|
||
}
|
||
}
|
||
}
|
||
|
||
return Container(
|
||
height: screenHeight,
|
||
width: Get.width,
|
||
margin: EdgeInsets.only(
|
||
top: 5.sp, left: 16.sp, right: 16.sp),
|
||
child: Stack(
|
||
children: [
|
||
Container(
|
||
clipBehavior: Clip.hardEdge,
|
||
decoration: BoxDecoration(
|
||
// borderRadius: BorderRadius.circular(10.sp),
|
||
image: DecorationImage(
|
||
fit: BoxFit.fill,
|
||
image: AssetImage(
|
||
getCircleImage('open_vip_bg'),
|
||
))),
|
||
height: screenHeight,
|
||
width: Get.width,
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(18),
|
||
clipBehavior: Clip.hardEdge,
|
||
child: Container(
|
||
padding: EdgeInsets.all(2.sp),
|
||
child: Swiper(
|
||
autoplay:
|
||
user.images!.length == 1 ? false : true,
|
||
loop: user.images!.length == 1 ? false : true,
|
||
itemBuilder:
|
||
(BuildContext context, int index) {
|
||
// print(index);
|
||
return GestureDetector(
|
||
onTap: () {
|
||
List<String> imgList = [];
|
||
user.images!.forEach((element) {
|
||
imgList.add(element);
|
||
});
|
||
|
||
Get.toNamed(AppRoutes.Swiper,
|
||
arguments: {
|
||
'imaglist': imgList,
|
||
'index': index
|
||
});
|
||
},
|
||
child: CachedNetworkImage(
|
||
imageUrl: user.images![index],
|
||
fit: BoxFit.cover,
|
||
width: Get.width,
|
||
height: screenHeight,
|
||
));
|
||
},
|
||
itemCount: user.images!.length,
|
||
),
|
||
)),
|
||
),
|
||
Positioned(
|
||
left: 16.sp,
|
||
top: 20.sp,
|
||
child: Container(
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
if (user.both_cities!.isNotEmpty)
|
||
Row(
|
||
children: [
|
||
Container(
|
||
width: 6.sp,
|
||
height: 6.sp,
|
||
margin:
|
||
EdgeInsets.only(right: 4.sp),
|
||
decoration: BoxDecoration(
|
||
borderRadius:
|
||
BorderRadius.circular(3.sp),
|
||
color: const Color(0xFFCE51FF),
|
||
),
|
||
),
|
||
// if (logic.online)
|
||
Text(
|
||
"你们都来过${user.both_cities!.first}",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 16.sp),
|
||
),
|
||
],
|
||
),
|
||
if (user.both_interests!.isNotEmpty)
|
||
SizedBox(
|
||
height: 8.sp,
|
||
),
|
||
if (user.both_interests!.isNotEmpty)
|
||
Row(
|
||
children: [
|
||
Container(
|
||
width: 6.sp,
|
||
height: 6.sp,
|
||
margin:
|
||
EdgeInsets.only(right: 4.sp),
|
||
decoration: BoxDecoration(
|
||
borderRadius:
|
||
BorderRadius.circular(3.sp),
|
||
color: const Color(0xFFCE51FF),
|
||
),
|
||
),
|
||
// if (logic.online)
|
||
Text(
|
||
"你们有共同的圈子:${user.both_interests!.first['title']}",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 16.sp),
|
||
),
|
||
],
|
||
),
|
||
if (user.both_cities!.isNotEmpty)
|
||
SizedBox(
|
||
height: 8.sp,
|
||
),
|
||
if (onLineStr.isNotEmpty)
|
||
Row(
|
||
children: [
|
||
Container(
|
||
width: 6.sp,
|
||
height: 6.sp,
|
||
margin:
|
||
EdgeInsets.only(right: 4.sp),
|
||
decoration: BoxDecoration(
|
||
borderRadius:
|
||
BorderRadius.circular(3.sp),
|
||
color: const Color(0xFFCE51FF),
|
||
),
|
||
),
|
||
// if (logic.online)
|
||
Text(
|
||
onLineStr,
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 16.sp),
|
||
),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
)),
|
||
Positioned(
|
||
right: 16.sp,
|
||
top: 16.sp,
|
||
child: GestureDetector(
|
||
onTap: () {
|
||
Get.toNamed(AppRoutes.UserInfoActivity,
|
||
arguments: user.userId!.toString());
|
||
},
|
||
child: Container(
|
||
width: 73.sp,
|
||
height: 25.sp,
|
||
decoration: BoxDecoration(
|
||
gradient: AppColor.mainVerLinearGradient,
|
||
borderRadius:
|
||
BorderRadius.circular(12.5.sp)),
|
||
child: Row(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Container(
|
||
margin: EdgeInsets.only(left: 5.sp),
|
||
child: Text(
|
||
'查看主页',
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 10.sp,
|
||
),
|
||
),
|
||
),
|
||
Image(
|
||
width: 15.sp,
|
||
image: AssetImage(
|
||
getDisCoverImage("right_icon")),
|
||
// width: 44.sp,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
)),
|
||
Positioned(
|
||
left: 6.sp,
|
||
bottom: 6.sp,
|
||
child: Container(
|
||
width: Get.width - 32.sp,
|
||
padding: EdgeInsets.only(right: 0.sp),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
if (user.wxNum != null)
|
||
wxStatusWidget(
|
||
user.unLockWxNum == 1,
|
||
user.wxNum!,
|
||
user.userId.toString(),
|
||
user.avatarUrl!, () {
|
||
loadSignDiscoverData(
|
||
user.userId.toString());
|
||
}),
|
||
SizedBox(
|
||
height: 15.sp,
|
||
),
|
||
Row(
|
||
children: [
|
||
Text(
|
||
user.nickname ?? '',
|
||
style: TextStyle(
|
||
fontSize: 18.sp,
|
||
color: Color(0XFFF7FAFA),
|
||
fontWeight: FontWeight.bold),
|
||
),
|
||
Container(
|
||
margin: EdgeInsets.only(left: 5.sp),
|
||
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(
|
||
user!.gender ?? 0,
|
||
user!.age ?? 0,
|
||
user!.role ?? 0,
|
||
user!.orientation ?? 0),
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
fontSize: 12.sp,
|
||
),
|
||
),
|
||
),
|
||
if (user.vip! > 0)
|
||
Container(
|
||
margin: EdgeInsets.only(
|
||
left: 4.sp,
|
||
),
|
||
child: Image.asset(
|
||
getCircleImage(user!.vip == 1
|
||
? 'vip'
|
||
: 'year_vip'),
|
||
width: 36.sp,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
Container(
|
||
width: Get.width - 120.sp,
|
||
margin: EdgeInsets.only(top: 15.sp,bottom: 15.sp),
|
||
child: Text(
|
||
user.signature! ?? '',
|
||
overflow: TextOverflow.ellipsis,
|
||
maxLines: (user.signature! ?? '').length > 15 ? 2 : 1,
|
||
style: TextStyle(
|
||
fontSize: 16.sp,
|
||
color: const Color(0XFFF7FAFA)),
|
||
),
|
||
),
|
||
Container(
|
||
width: Get.width - 110.sp,
|
||
height: 35.sp,
|
||
child: tagItem(user.interests!),
|
||
),
|
||
],
|
||
),
|
||
)),
|
||
Positioned(
|
||
bottom: 5.sp,
|
||
right: 15.sp,
|
||
child: Container(
|
||
child: Column(
|
||
children: [
|
||
GestureDetector(
|
||
onTap: () {
|
||
pushChatPage(
|
||
user.userId.toString(),
|
||
user.imAccid!.toString(),
|
||
user.nickname!);
|
||
},
|
||
child: Image.asset(
|
||
getCircleImage(
|
||
'chat_icon',
|
||
),
|
||
width: 50.sp,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 25.sp,
|
||
),
|
||
GestureDetector(
|
||
onTap: () {
|
||
setLike(user.userId!.toString(),
|
||
user.is_follow!, () {
|
||
list[index]['is_follow'] =
|
||
!user.is_follow!;
|
||
setState(() {});
|
||
});
|
||
},
|
||
child: Image.asset(
|
||
getCircleImage(
|
||
user.is_follow!
|
||
? 'like_icon'
|
||
: 'nor_like_icon',
|
||
),
|
||
width: 50.sp,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 20.sp,
|
||
),
|
||
GestureDetector(
|
||
onTap: () {
|
||
_showReportDialog(context,user.userId!.toString(),index);
|
||
|
||
},
|
||
child: Image.asset(
|
||
getCircleImage(
|
||
'no_look_icon',
|
||
),
|
||
width: 50.sp,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
))
|
||
],
|
||
));
|
||
},
|
||
itemCount: list.length,
|
||
physics: BouncingScrollPhysics(),
|
||
controller: _scrollController,
|
||
),
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
tagItem(List item) {
|
||
return Container(
|
||
width: Get.width,
|
||
margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp),
|
||
// color: Colors.red,
|
||
// height: 45.sp,
|
||
child: ListView.builder(
|
||
scrollDirection: Axis.horizontal,
|
||
itemCount: item.length,
|
||
itemBuilder: (context, index) {
|
||
return tagWidget(item[index]['title'], item[index]['id']);
|
||
}),
|
||
);
|
||
}
|
||
|
||
tagWidget(String tagName, int id) {
|
||
return GestureDetector(
|
||
onTap: () {
|
||
Get.toNamed(AppRoutes.Signal_circle_list, arguments: id);
|
||
},
|
||
child: Container(
|
||
margin: EdgeInsets.only(right: 6.sp),
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(17.0),
|
||
gradient: const LinearGradient(
|
||
colors: [
|
||
Color(0xFF06F9FA),
|
||
Color(0xFFDC5BFD),
|
||
],
|
||
),
|
||
color: const Color(0xFF392D53),
|
||
),
|
||
child: Container(
|
||
margin: EdgeInsets.all(0.2.sp),
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(17.0),
|
||
color: const Color(0xFF392D53),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
top: 2.sp,
|
||
bottom: 2.sp,
|
||
left: 10.sp,
|
||
right: 10.sp,
|
||
),
|
||
child: Center(
|
||
child: Text(
|
||
tagName,
|
||
style: const TextStyle(
|
||
fontSize: 11.0,
|
||
color: Colors.white,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
addWxPicker() {
|
||
return Get.bottomSheet(
|
||
Container(),
|
||
isScrollControlled: false,
|
||
enableDrag: false,
|
||
);
|
||
}
|
||
|
||
void checkIsPopWxTip() async {
|
||
SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance();
|
||
var date = DateTime.now();
|
||
final dateFormat = DateFormat("yyyy-MM-dd");
|
||
final date2 = dateFormat.format(date);
|
||
if (sp.preferences!.containsKey(todayAddWxStatus)) {
|
||
var lastDate = sp.preferences!.getString(todayAddWxStatus);
|
||
if (lastDate != date2) {
|
||
loadWxNumData();
|
||
sp.preferences!.setString(todayAddWxStatus, date2);
|
||
}
|
||
} else {
|
||
sp.preferences!.setString(todayAddWxStatus, date2);
|
||
loadWxNumData();
|
||
}
|
||
}
|
||
|
||
loadWxNumData() async {
|
||
var data = await DioManager.instance.get(url: Api.getUserInfo);
|
||
|
||
if (data['code'] == 200) {
|
||
if (data['data']['user']['wxNum'] == null) {
|
||
showAddWxPicker(false);
|
||
} else if (data['data']['user']['wxNum'].toString().isEmpty) {
|
||
showAddWxPicker(false);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
void sendNoLookData(String userId,int index) async {
|
||
var data = await DioManager.instance.post(url: Api.uninterested + userId);
|
||
if (data['code'] == 200) {
|
||
showOKToast('操作成功');
|
||
list.removeAt(index);
|
||
setState(() {
|
||
|
||
});
|
||
}
|
||
}
|
||
|
||
void _showReportDialog(BuildContext context,String userId,int currentIndex) {
|
||
showDialog(
|
||
context: context,
|
||
builder: (BuildContext context) {
|
||
return Dialog(
|
||
backgroundColor: Colors.transparent,
|
||
child: Container(
|
||
height: 277.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: 14.sp),
|
||
alignment: Alignment.center,
|
||
child: Image(
|
||
image: AssetImage(getCircleImage("no_look_icon_h")),
|
||
width: 70.sp,
|
||
height: 70.sp,
|
||
),
|
||
),
|
||
Container(
|
||
margin: EdgeInsets.only(
|
||
top: 12.sp, left: 14.sp, right: 14.sp),
|
||
alignment: Alignment.center,
|
||
child: Text(
|
||
"您确认对TA不感兴趣吗?确认之后在这个板块就看不见TA了。",
|
||
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: 24.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: 27.sp,
|
||
right: 27.sp),
|
||
child: const Text(
|
||
"再考虑考虑",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 12,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
SizedBox(width: 24.sp),
|
||
GestureDetector(
|
||
onTap: () {
|
||
Get.back();
|
||
sendNoLookData(userId,currentIndex);
|
||
},
|
||
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: const Text(
|
||
"确定",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 12,
|
||
),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
)
|
||
],
|
||
),
|
||
)
|
||
],
|
||
),
|
||
),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
}
|
||
|
||
|
||
class DiscoverDataRefresh {
|
||
String userId;
|
||
DiscoverDataRefresh(this.userId);
|
||
}
|
||
|
||
class Users {
|
||
int? age;
|
||
bool? auth;
|
||
String? avatarUrl;
|
||
String? bgPicUrl;
|
||
String? birthday;
|
||
bool? blacklist;
|
||
String? city;
|
||
double? distance;
|
||
bool? dust;
|
||
String? email;
|
||
bool? followBag;
|
||
int? followStatus;
|
||
int? gender;
|
||
String? genderName;
|
||
String? heartbeatValue;
|
||
int? height;
|
||
int? hugCount;
|
||
String? imAccid;
|
||
List? images;
|
||
List? interests;
|
||
String? inviteCode;
|
||
int? kyNum;
|
||
String? lastLoginLog;
|
||
String? lastLoginTime;
|
||
int? level;
|
||
List? litGifts;
|
||
int? lvType;
|
||
MapUserJumpAo? mapUserJumpAo;
|
||
String? nickname;
|
||
String? nicknameNote;
|
||
bool? online;
|
||
String? openId;
|
||
bool? partner;
|
||
bool? is_follow;
|
||
String? phoneNum;
|
||
int? popularityValue;
|
||
bool? realPersonAuth;
|
||
int? relationshipStatus;
|
||
String? signature;
|
||
bool? specialConcern;
|
||
int? storyCount;
|
||
List? tags;
|
||
int? touchTime;
|
||
int? unLockWxNum;
|
||
int? userId;
|
||
int? weight;
|
||
int? orientation;
|
||
int? role;
|
||
int? vip;
|
||
String? wxNum;
|
||
List? both_cities;
|
||
List? both_interests;
|
||
|
||
Users(
|
||
{this.age,
|
||
this.auth,
|
||
this.avatarUrl,
|
||
this.bgPicUrl,
|
||
this.birthday,
|
||
this.blacklist,
|
||
this.city,
|
||
this.both_interests,
|
||
this.distance,
|
||
this.dust,
|
||
this.email,
|
||
this.is_follow,
|
||
this.vip,
|
||
this.followBag,
|
||
this.followStatus,
|
||
this.gender,
|
||
this.genderName,
|
||
this.heartbeatValue,
|
||
this.height,
|
||
this.hugCount,
|
||
this.imAccid,
|
||
this.role,
|
||
this.images,
|
||
this.interests,
|
||
this.inviteCode,
|
||
this.kyNum,
|
||
this.lastLoginLog,
|
||
this.lastLoginTime,
|
||
this.level,
|
||
this.litGifts,
|
||
this.lvType,
|
||
this.mapUserJumpAo,
|
||
this.nickname,
|
||
this.nicknameNote,
|
||
this.online,
|
||
this.openId,
|
||
this.partner,
|
||
this.phoneNum,
|
||
this.popularityValue,
|
||
this.realPersonAuth,
|
||
this.relationshipStatus,
|
||
this.signature,
|
||
this.specialConcern,
|
||
this.storyCount,
|
||
this.tags,
|
||
this.touchTime,
|
||
this.unLockWxNum,
|
||
this.both_cities,
|
||
this.userId,
|
||
this.orientation,
|
||
this.weight,
|
||
this.wxNum});
|
||
|
||
Users.fromJson(Map<String, dynamic> json) {
|
||
age = json['age'];
|
||
vip = json['vip'];
|
||
role = json['role'];
|
||
auth = json['auth'];
|
||
both_interests = json['both_interests'] ?? [];
|
||
both_cities = json['both_cities'] ?? [];
|
||
is_follow = json['is_follow'];
|
||
interests = json['interests'];
|
||
avatarUrl = json['avatar'];
|
||
bgPicUrl = json['bgPicUrl'];
|
||
birthday = json['birthday'];
|
||
blacklist = json['blacklist'];
|
||
city = json['city'];
|
||
orientation = json['orientation'];
|
||
distance = json['distance'];
|
||
dust = json['dust'];
|
||
email = json['email'];
|
||
followBag = json['followBag'];
|
||
followStatus = json['followStatus'];
|
||
gender = json['gender'];
|
||
genderName = json['genderName'];
|
||
heartbeatValue = json['heartbeatValue'].toString();
|
||
height = json['height'];
|
||
hugCount = json['hugCount'];
|
||
imAccid = json['account_id'];
|
||
images = json['images'];
|
||
inviteCode = json['inviteCode'];
|
||
kyNum = json['kyNum'];
|
||
lastLoginLog = json['lastLoginLog'];
|
||
lastLoginTime = json['lastLoginTime'];
|
||
level = json['level'];
|
||
litGifts = json['litGifts'];
|
||
lvType = json['lvType'];
|
||
mapUserJumpAo = json['mapUserJumpAo'] != null
|
||
? new MapUserJumpAo.fromJson(json['mapUserJumpAo'])
|
||
: null;
|
||
nickname = json['nickname'];
|
||
nicknameNote = json['nicknameNote'];
|
||
online = json['isOnline'];
|
||
openId = json['openId'];
|
||
partner = json['partner'];
|
||
phoneNum = json['phoneNum'];
|
||
popularityValue = json['popularityValue'];
|
||
realPersonAuth = json['realPersonAuth'];
|
||
relationshipStatus = json['relationshipStatus'];
|
||
signature = json['signature'];
|
||
specialConcern = json['specialConcern'];
|
||
storyCount = json['storyCount'];
|
||
tags = json['tags'];
|
||
touchTime = json['touchTime'];
|
||
unLockWxNum = json['unLockWxNum'];
|
||
userId = json['id'];
|
||
weight = json['weight'];
|
||
wxNum = json['wx_num'];
|
||
}
|
||
|
||
Map<String, dynamic> toJson() {
|
||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||
data['age'] = this.age;
|
||
data['auth'] = this.auth;
|
||
data['avatarUrl'] = this.avatarUrl;
|
||
data['bgPicUrl'] = this.bgPicUrl;
|
||
data['birthday'] = this.birthday;
|
||
data['blacklist'] = this.blacklist;
|
||
data['city'] = this.city;
|
||
data['distance'] = this.distance;
|
||
data['dust'] = this.dust;
|
||
data['email'] = this.email;
|
||
data['followBag'] = this.followBag;
|
||
data['followStatus'] = this.followStatus;
|
||
data['gender'] = this.gender;
|
||
data['genderName'] = this.genderName;
|
||
data['heartbeatValue'] = this.heartbeatValue;
|
||
data['height'] = this.height;
|
||
data['hugCount'] = this.hugCount;
|
||
data['imAccid'] = this.imAccid;
|
||
if (this.images != null) {
|
||
data['images'] = this.images!.map((v) => v.toJson()).toList();
|
||
}
|
||
data['inviteCode'] = this.inviteCode;
|
||
data['kyNum'] = this.kyNum;
|
||
data['lastLoginLog'] = this.lastLoginLog;
|
||
data['lastLoginTime'] = this.lastLoginTime;
|
||
data['level'] = this.level;
|
||
if (this.litGifts != null) {
|
||
data['litGifts'] = this.litGifts!.map((v) => v.toJson()).toList();
|
||
}
|
||
data['lvType'] = this.lvType;
|
||
if (this.mapUserJumpAo != null) {
|
||
data['mapUserJumpAo'] = this.mapUserJumpAo!.toJson();
|
||
}
|
||
data['nickname'] = this.nickname;
|
||
data['nicknameNote'] = this.nicknameNote;
|
||
data['online'] = this.online;
|
||
data['openId'] = this.openId;
|
||
data['partner'] = this.partner;
|
||
data['phoneNum'] = this.phoneNum;
|
||
data['popularityValue'] = this.popularityValue;
|
||
data['realPersonAuth'] = this.realPersonAuth;
|
||
data['relationshipStatus'] = this.relationshipStatus;
|
||
data['signature'] = this.signature;
|
||
data['specialConcern'] = this.specialConcern;
|
||
data['storyCount'] = this.storyCount;
|
||
if (this.tags != null) {
|
||
data['tags'] = this.tags!.map((v) => v.toJson()).toList();
|
||
}
|
||
data['touchTime'] = this.touchTime;
|
||
data['unLockWxNum'] = this.unLockWxNum;
|
||
data['userId'] = this.userId;
|
||
data['weight'] = this.weight;
|
||
data['wxNum'] = this.wxNum;
|
||
return data;
|
||
}
|
||
}
|
||
|
||
class MapUserJumpAo {
|
||
int? id;
|
||
String? roomId;
|
||
String? title;
|
||
int? type;
|
||
|
||
MapUserJumpAo({this.id, this.roomId, this.title, this.type});
|
||
|
||
MapUserJumpAo.fromJson(Map<String, dynamic> json) {
|
||
id = json['id'];
|
||
roomId = json['roomId'];
|
||
title = json['title'];
|
||
type = json['type'];
|
||
}
|
||
|
||
Map<String, dynamic> toJson() {
|
||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||
data['id'] = this.id;
|
||
data['roomId'] = this.roomId;
|
||
data['title'] = this.title;
|
||
data['type'] = this.type;
|
||
return data;
|
||
}
|
||
}
|
||
|
||
class msgPageRefresh {}
|