黑名单更新

newHost
王亚玲 3 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:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
part 'blacklist_model.g.dart'; part 'blacklist_model.g.dart';
@JsonSerializable() @JsonSerializable()
class BlacklistModel extends Equatable { class BlacklistModel extends Equatable {
int id; final int id;
List imgList; final List<ImgModel> imgList;
String name; final String? name;
factory BlacklistModel.fromJson(Map<String, dynamic> json) => factory BlacklistModel.fromJson(Map<String, dynamic> json) =>
_$BlacklistModelFromJson(json); _$BlacklistModelFromJson(json);
BlacklistModel({ BlacklistModel({
required this.id, required this.id,
required this.imgList, required this.imgList,
@ -21,5 +20,9 @@ class BlacklistModel extends Equatable {
}); });
@override @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 _$BlacklistModelFromJson(Map<String, dynamic> json) =>
BlacklistModel( BlacklistModel(
id: json['id'] as int, id: json['id'] as int,
imgList: json['imgList'] as List<dynamic>, imgList: (json['imgList'] as List<dynamic>)
name: json['name'] as String, .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/gen/assets.gen.dart';
import 'package:aku_new_community/model/user/blacklist_model.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/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/dialog/bee_custom_dialog.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -55,11 +57,11 @@ class _blackListPageState extends State<blackListPage> {
void initState() { void initState() {
super.initState(); super.initState();
// ///appbar refresh ///appbar refresh
// Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
// await _refresh(); await _refresh();
// setState(() {}); //setState(() {});
// }); });
} }
@override @override
@ -68,9 +70,10 @@ class _blackListPageState extends State<blackListPage> {
super.dispose(); super.dispose();
} }
// Future _refresh() async { Future _refresh() async {
// blackList = await BlackListFunc.getBlackList(); blackList = await BlackListFunc.getBlackList();
// } setState(() {});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -98,10 +101,19 @@ class _blackListPageState extends State<blackListPage> {
])), ])),
), ),
Expanded( Expanded(
child: EasyRefresh( child:
// ListView.builder(
// itemBuilder: (context, index) {
// //return Text('这是一个开始');
// return _blackList(blackList[index]);
// },
// //itemCount: 6,
// itemCount: blackList.length,
// )
EasyRefresh(
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
footer: MaterialFooter(), //footer: MaterialFooter(),
controller: _refreshController, controller: _refreshController,
onRefresh: () async { onRefresh: () async {
blackList = await BlackListFunc.getBlackList(); blackList = await BlackListFunc.getBlackList();
@ -115,10 +127,14 @@ class _blackListPageState extends State<blackListPage> {
// _page // _page
}, },
onLoad: () async {}, onLoad: () async {},
child: ListView.builder( child: blackList.isEmpty
? SizedBox()
: ListView.builder(
itemBuilder: (context, index) { itemBuilder: (context, index) {
//return Text('这是一个开始');
return _blackList(blackList[index]); return _blackList(blackList[index]);
}, },
//itemCount: 6,
itemCount: blackList.length, itemCount: blackList.length,
))) )))
], ],
@ -129,19 +145,24 @@ class _blackListPageState extends State<blackListPage> {
return Column( return Column(
children: [ children: [
ListTile( ListTile(
leading: Container( leading: BeeAvatarWidget(
width: 88.w, imgs: model.imgList,
height: 88.w, )
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), // Container(
image: DecorationImage( // width: 88.w,
image: ExactAssetImage( // height: 88.w,
R.ASSETS_IMAGES_PLACEHOLDER_WEBP ?? model.imgList.first, // decoration: BoxDecoration(
), // borderRadius: BorderRadius.circular(40),
fit: BoxFit.cover)), // image: DecorationImage(
), // image: ExactAssetImage(R.ASSETS_IMAGES_PLACEHOLDER_WEBP
// //?? model.imgList.first,
// ),
// fit: BoxFit.cover)),
// )
,
title: Text( title: Text(
_getText(model.name), model.name == null ? '' : _getText(model.name!),
style: TextStyle(fontSize: 28.sp, color: ktextSubColor), style: TextStyle(fontSize: 28.sp, color: ktextSubColor),
), ),
trailing: GestureDetector( trailing: GestureDetector(

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

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

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

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

Loading…
Cancel
Save