You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
232 lines
8.6 KiB
232 lines
8.6 KiB
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:dating_touchme_app/components/page_appbar.dart';
|
|
import 'package:dating_touchme_app/controller/setting/blacklist_controller.dart';
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart';
|
|
import 'package:dating_touchme_app/generated/assets.dart';
|
|
import 'package:dating_touchme_app/model/mine/blacklist_data.dart';
|
|
import 'package:dating_touchme_app/pages/home/report_page.dart';
|
|
import 'package:dating_touchme_app/pages/home/user_information_page.dart';
|
|
import 'package:easy_refresh/easy_refresh.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
class BlacklistPage extends StatelessWidget {
|
|
const BlacklistPage({super.key});
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetX<BlacklistController>(
|
|
init: BlacklistController(),
|
|
builder: (controller) {
|
|
return Scaffold(
|
|
appBar: PageAppbar(title: "黑名单"),
|
|
body: EasyRefresh(
|
|
controller: controller.listRefreshController,
|
|
header: const ClassicHeader(
|
|
dragText: '下拉刷新',
|
|
armedText: '释放刷新',
|
|
readyText: '刷新中...',
|
|
processingText: '刷新中...',
|
|
processedText: '刷新完成',
|
|
failedText: '刷新失败',
|
|
noMoreText: '没有更多数据',
|
|
showMessage: false
|
|
),
|
|
footer: ClassicFooter(
|
|
dragText: '上拉加载',
|
|
armedText: '释放加载',
|
|
readyText: '加载中...',
|
|
processingText: '加载中...',
|
|
processedText: '加载完成',
|
|
failedText: '加载失败',
|
|
noMoreText: '没有更多数据',
|
|
showMessage: false
|
|
),
|
|
// 下拉刷新
|
|
onRefresh: () async {
|
|
print('推荐列表下拉刷新被触发');
|
|
controller.page.value = 1;
|
|
controller.blackList.clear();
|
|
await controller.getBlackList();
|
|
controller.listRefreshController.finishRefresh(IndicatorResult.success);
|
|
controller.listRefreshController.finishLoad(IndicatorResult.none);
|
|
},
|
|
// 上拉加载更多
|
|
onLoad: () async {
|
|
print('推荐列表上拉加载被触发, hasMore: ');
|
|
controller.page.value += 1;
|
|
controller.getBlackList();
|
|
},
|
|
child: SingleChildScrollView(
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 20.w,
|
|
horizontal: 15.w
|
|
),
|
|
child: Column(
|
|
children: [
|
|
...controller.blackList.map((e){
|
|
return BlackItem(item: e, controller: controller,);
|
|
})
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
class BlackItem extends StatefulWidget {
|
|
final Records item;
|
|
final BlacklistController controller;
|
|
const BlackItem({super.key, required this.item, required this.controller});
|
|
|
|
@override
|
|
State<BlackItem> createState() => _BlackItemState();
|
|
}
|
|
|
|
class _BlackItemState extends State<BlackItem> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.only(
|
|
bottom: 20.w
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.all(Radius.circular(40.w)),
|
|
child: (widget.item.profilePhoto != null && widget.item.profilePhoto != "") ? CachedNetworkImage(
|
|
imageUrl: "${widget.item.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_120",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
imageBuilder: (context, imageProvider) => Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: imageProvider,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
) : Image.asset(
|
|
gaplessPlayback: true,
|
|
Assets.imagesUserAvatar,
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
),
|
|
SizedBox(width: 12.w,),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"${widget.item.nickName ?? ""}",
|
|
style: TextStyle(
|
|
fontSize: 13.w,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
Text(
|
|
"拉黑时间:${widget.item.createTime}",
|
|
style: TextStyle(
|
|
fontSize: 11.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1)
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
Icon(
|
|
Icons.more_horiz,
|
|
size: 20.w,
|
|
)
|
|
],
|
|
),
|
|
).onTap(() {
|
|
Navigator.of(context).push(
|
|
TDSlidePopupRoute(
|
|
slideTransitionFrom: SlideTransitionFrom.bottom,
|
|
builder: (context) {
|
|
return Material(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)),
|
|
child: Container(
|
|
color: TDTheme.of(context).bgColorContainer,
|
|
height: 212.w,
|
|
padding: EdgeInsets.symmetric(horizontal: 28.w),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
height: 65.w,
|
|
decoration: BoxDecoration(
|
|
border: Border(bottom: BorderSide(width: 1, color: const Color.from(alpha: 245, red: 245, green: 245, blue: 1)))
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"查看详情",
|
|
style: TextStyle(
|
|
fontSize: 18.w
|
|
),
|
|
),
|
|
),
|
|
).onTap((){
|
|
|
|
Get.to(() => UserInformationPage(miId: widget.item.miId ?? ""));
|
|
}),
|
|
Container(
|
|
height: 65.w,
|
|
decoration: BoxDecoration(
|
|
border: Border(bottom: BorderSide(width: 1, color: const Color.from(alpha: 245, red: 245, green: 245, blue: 1)))
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"解除拉黑",
|
|
style: TextStyle(
|
|
fontSize: 18.w
|
|
),
|
|
),
|
|
),
|
|
).onTap((){
|
|
widget.controller.unBlack(widget.item.id ?? "");
|
|
}),
|
|
Container(
|
|
height: 65.w,
|
|
decoration: BoxDecoration(
|
|
border: Border(bottom: BorderSide(width: 1, color: const Color.fromRGBO(245, 245, 245, 1)))
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"举报",
|
|
style: TextStyle(
|
|
fontSize: 18.w,
|
|
color: const Color.fromRGBO(245, 83, 83, 1)
|
|
),
|
|
),
|
|
),
|
|
).onTap((){
|
|
|
|
Get.to(() => ReportPage(id: widget.item.blackUserId ?? "", userId: widget.item.blackUserId ?? "", type: 1,));
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
});
|
|
}
|
|
}
|
|
|