import 'dart:ui' as ui; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:yumi/app_localizations.dart'; import 'package:yumi/shared/data_sources/sources/repositories/sc_room_repository_imp.dart'; import 'package:yumi/ui_kit/components/sc_page_list.dart'; import 'package:yumi/ui_kit/components/text/sc_text.dart'; import 'package:yumi/app/routes/sc_fluro_navigator.dart'; import 'package:yumi/shared/data_sources/sources/local/user_manager.dart'; import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart'; import 'package:yumi/shared/business_logic/models/res/room_black_list_res.dart'; import 'package:yumi/modules/index/main_route.dart'; ///房间用户 黑名单 class BlockedListPage extends SCPageList { String? roomId; BlockedListPage({super.key, this.roomId}); @override _BlockedListPageState createState() => _BlockedListPageState(roomId); } class _BlockedListPageState extends SCPageListState { String? roomId; _BlockedListPageState(this.roomId); @override void initState() { super.initState(); enablePullUp = false; backgroundColor = Colors.transparent; isShowDivider = false; loadData(1); } @override Widget build(BuildContext context) { return SafeArea( child: ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(12.0), topRight: Radius.circular(12.0), ), child: BackdropFilter( filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15), child: Container( width: ScreenUtil().screenWidth, color: Color(0xff09372E).withOpacity(0.5), child: Column( children: [ SizedBox(height: 15.w), text( SCAppLocalizations.of(context)!.blockedList, fontSize: 14.sp, textColor: Colors.white, ), SizedBox(height: 10.w), SizedBox(height: 350.w, child: buildList(context)), ], ), ), ), ), ); } @override Widget buildItem(RoomBlackListRes res) { return Container( margin: REdgeInsets.symmetric(vertical: 5.w, horizontal: 10.w), padding: REdgeInsets.symmetric(vertical: 10.w), decoration: BoxDecoration( color: Color(0xffF2F2F2), borderRadius: BorderRadius.circular(10.w), ), child: Row( children: [ SizedBox(width: 10.w), GestureDetector( child: ClipOval( child: CachedNetworkImage( imageUrl: res.blacklistUserProfile?.userAvatar ?? "", width: 42.w, height: 42.w, ), ), onTap: () { SCNavigatorUtils.push( context, "${SCMainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == res.blacklistUserProfile?.id}&tageId=${res.blacklistUserProfile?.id}", ); }, ), SizedBox(width: 3.w), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( constraints: BoxConstraints(maxWidth: 190.w), child: text( res.blacklistUserProfile?.userNickname ?? "", fontSize: 14.sp, textColor: Colors.white, ), ), SizedBox(height: 4.w), text( "ID:${res.blacklistUserProfile?.getID()}", fontSize: 10.sp, textColor: Colors.white, ), ], ), ), SizedBox(width: 3.w), GestureDetector( child: Image.asset( "sc_images/room/sc_icon_remve_block.png", width: 22.w, height: 22.w, ), onTap: () { SCChatRoomRepository() .removeBlacklist( res.roomId ?? "", res.blacklistUserProfile?.id ?? "", ) .whenComplete(() { loadData(1); }); }, ), SizedBox(width: 15.w), ], ), ); } ///加载数据 @override loadPage({ required int page, required Function(List) onSuccess, Function? onErr, }) async { try { var roomList = await SCAccountRepository().roomBlacklist(roomId ?? "", "0"); onSuccess(roomList); } catch (e) { if (onErr != null) { onErr(); } } } }