黑名单更新

newHost
王亚玲 2 years ago
parent d92bb48fa4
commit dd12ea4a50

@ -1,19 +1,18 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'blacklist_model.g.dart';
@JsonSerializable()
class BlacklistModel extends Equatable {
int id;
List imgList;
String name;
final int id;
final List<ImgModel> imgList;
final String? name;
factory BlacklistModel.fromJson(Map<String, dynamic> json) =>
_$BlacklistModelFromJson(json);
BlacklistModel({
required this.id,
required this.imgList,
@ -21,5 +20,9 @@ class BlacklistModel extends Equatable {
});
@override
List<Object?> get props => [id, imgList, name,];
}
List<Object?> get props => [
id,
imgList,
name,
];
}

@ -9,6 +9,8 @@ part of 'blacklist_model.dart';
BlacklistModel _$BlacklistModelFromJson(Map<String, dynamic> json) =>
BlacklistModel(
id: json['id'] as int,
imgList: json['imgList'] as List<dynamic>,
name: json['name'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
name: json['name'] as String?,
);

@ -2,9 +2,11 @@ import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/user/blacklist_model.dart';
import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart';
import 'package:aku_new_community/widget/bee_avatar_widget.dart';
import 'package:aku_new_community/widget/dialog/bee_custom_dialog.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
@ -55,11 +57,11 @@ class _blackListPageState extends State<blackListPage> {
void initState() {
super.initState();
// ///appbar refresh
// Future.delayed(Duration(milliseconds: 0), () async {
// await _refresh();
// setState(() {});
// });
///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async {
await _refresh();
//setState(() {});
});
}
@override
@ -68,9 +70,10 @@ class _blackListPageState extends State<blackListPage> {
super.dispose();
}
// Future _refresh() async {
// blackList = await BlackListFunc.getBlackList();
// }
Future _refresh() async {
blackList = await BlackListFunc.getBlackList();
setState(() {});
}
@override
Widget build(BuildContext context) {
@ -98,29 +101,42 @@ class _blackListPageState extends State<blackListPage> {
])),
),
Expanded(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
footer: MaterialFooter(),
controller: _refreshController,
onRefresh: () async {
blackList = await BlackListFunc.getBlackList();
// blackList = [
// BlacklistModel(
// id: 0,
// imgList: [Assets.images.vegetableBanner.path],
// name: '张天天')
// ];
setState(() {});
// _page
},
onLoad: () async {},
child: ListView.builder(
itemBuilder: (context, index) {
return _blackList(blackList[index]);
},
itemCount: blackList.length,
)))
child:
// ListView.builder(
// itemBuilder: (context, index) {
// //return Text('这是一个开始');
// return _blackList(blackList[index]);
// },
// //itemCount: 6,
// itemCount: blackList.length,
// )
EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
//footer: MaterialFooter(),
controller: _refreshController,
onRefresh: () async {
blackList = await BlackListFunc.getBlackList();
// blackList = [
// BlacklistModel(
// id: 0,
// imgList: [Assets.images.vegetableBanner.path],
// name: '张天天')
// ];
setState(() {});
// _page
},
onLoad: () async {},
child: blackList.isEmpty
? SizedBox()
: ListView.builder(
itemBuilder: (context, index) {
//return Text('这是一个开始');
return _blackList(blackList[index]);
},
//itemCount: 6,
itemCount: blackList.length,
)))
],
));
}
@ -129,19 +145,24 @@ class _blackListPageState extends State<blackListPage> {
return Column(
children: [
ListTile(
leading: Container(
width: 88.w,
height: 88.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
image: DecorationImage(
image: ExactAssetImage(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP ?? model.imgList.first,
),
fit: BoxFit.cover)),
),
leading: BeeAvatarWidget(
imgs: model.imgList,
)
// Container(
// width: 88.w,
// height: 88.w,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// image: DecorationImage(
// image: ExactAssetImage(R.ASSETS_IMAGES_PLACEHOLDER_WEBP
// //?? model.imgList.first,
// ),
// fit: BoxFit.cover)),
// )
,
title: Text(
_getText(model.name),
model.name == null ? '' : _getText(model.name!),
style: TextStyle(fontSize: 28.sp, color: ktextSubColor),
),
trailing: GestureDetector(

@ -193,13 +193,13 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
},
text:
clockTimer.timerStart ? '${clockTimer.second}秒后重新获取' : '获取验证码'),
32.hb,
IconButton(
icon: Icon(Icons.ac_unit_outlined),
onPressed: () {
//Get.to(() => RootPage());
},
),
// 32.hb,
// IconButton(
// icon: Icon(Icons.ac_unit_outlined),
// onPressed: () {
// //Get.to(() => RootPage());
// },
// ),
24.w.heightBox,
Row(
mainAxisAlignment: MainAxisAlignment.center,

@ -165,6 +165,7 @@ class _CommunityPageState extends State<CommunityPage>
await (getNewInfo());
_gambitModels = await CommunityFunc.getListGambit();
_hotNewsModels = await CommunityFunc.getHotNews();
_onload = false;
setState(() {});
},

@ -124,7 +124,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
onSelect: (int value) async {
if (LoginUtil.isNotLogin) return;
if (value == 3) {
await Get.dialog(CupertinoAlertDialog(
bool? result = await Get.dialog(CupertinoAlertDialog(
title: '你确定要拉黑他吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
@ -132,17 +132,23 @@ class _EventDetailPageState extends State<EventDetailPage> {
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child: '确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () async {
var isShielding =
await BlackListFunc.Block(widget.dynamicId);
if (isShielding) {
Get.back();
}
},
),
child: '确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () => Get.back(result: true)
// async {
// var isShielding =
// await BlackListFunc.Block(widget.dynamicId);
// if (isShielding) {
// Get.back();
// }
// },
),
],
));
if (result == true) {
await BlackListFunc.Block(widget.dynamicId);
Get.back();
widget.refresh!();
}
} else {
if (!_isMyself) {
VoidCallback cancel = BotToast.showLoading();

@ -188,6 +188,7 @@ class _ChatCardState extends State<ChatCard> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return DecoratedBox(
decoration: BoxDecoration(
color: Colors.white,
@ -255,27 +256,68 @@ class _ChatCardState extends State<ChatCard> {
isMyself: _isMyself,
onSelect: (int value) async {
if (LoginUtil.isNotLogin) return;
if (value == 3) {
await Get.dialog(CupertinoAlertDialog(
title: '你确定要拉黑他吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child:
'确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () async {
var isShielding =
await BlackListFunc.Block(widget.model.id);
if (isShielding) {
Get.back();
}
},
),
],
));
if (widget.model.createId == userProvider.userInfoModel?.id) {
if (value == 3) {
//bool? result =
await Get.dialog(CupertinoAlertDialog(
title: '你确定要拉黑他吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child: '确定'
.text
.color(Colors.orange)
.isIntrinsic
.make(),
onPressed: () //=> Get.back(result: true),
async {
var isShielding =
await BlackListFunc.Block(widget.model.id);
if (isShielding) {
Get.back();
}
},
),
],
)); // if (result == true) {
// await BlackListFunc.Block(widget.model.id);
// widget.refresh();
// }
} else {
if (!_isMyself) {
VoidCallback cancel = BotToast.showLoading();
await Future.delayed(Duration(
milliseconds: 500 + Random().nextInt(500)));
cancel();
BotToast.showText(text: '举报成功');
} else {
bool? result = await Get.dialog(CupertinoAlertDialog(
title: '你确定删除吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child: '确定'
.text
.color(Colors.orange)
.isIntrinsic
.make(),
onPressed: () => Get.back(result: true),
),
],
));
if (result == true) {
await CommunityFunc.deleteDynamic(widget.model.id);
widget.refresh();
}
}
}
} else {
if (!_isMyself) {
VoidCallback cancel = BotToast.showLoading();
@ -362,19 +404,21 @@ class CommunityPopButton extends StatelessWidget {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)),
itemBuilder: (context) {
return [
PopupMenuItem(
child: '拉黑'.text.isIntrinsic.make(),
value: 3,
),
isMyself
? PopupMenuItem(
child: '删除'.text.isIntrinsic.make(),
value: 0,
)
: PopupMenuItem(
child: '举报'.text.isIntrinsic.make(),
value: 1,
),
if (isMyself)
PopupMenuItem(
child: '删除'.text.isIntrinsic.make(),
value: 0,
),
if (!isMyself)
PopupMenuItem(
child: '举报'.text.isIntrinsic.make(),
value: 1,
),
if (!isMyself)
PopupMenuItem(
child: '拉黑'.text.isIntrinsic.make(),
value: 3,
),
];
},
onSelected: onSelect,

Loading…
Cancel
Save