235 lines
7.5 KiB
Dart
235 lines
7.5 KiB
Dart
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_core/constants/at_screen.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/login_res.dart';
|
|
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../chatvibe_ui/components/at_compontent.dart';
|
|
import '../../../chatvibe_ui/components/at_page_list.dart';
|
|
import '../../../chatvibe_ui/components/at_tts.dart';
|
|
import '../../../chatvibe_ui/components/text/at_text.dart';
|
|
|
|
///房间用户在线列表
|
|
class ATRoomOnlinePage extends ATPageList {
|
|
String? roomId = "";
|
|
|
|
ATRoomOnlinePage({super.key, this.roomId});
|
|
|
|
@override
|
|
_ATRoomOnlinePageState createState() => _ATRoomOnlinePageState(roomId);
|
|
}
|
|
|
|
class _ATRoomOnlinePageState
|
|
extends ATPageListState<ChatVibeUserProfile, ATRoomOnlinePage> {
|
|
String? roomId = "";
|
|
|
|
_ATRoomOnlinePageState(this.roomId);
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
enablePullUp = false;
|
|
backgroundColor = Colors.transparent;
|
|
loadData(1);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SafeArea(
|
|
top: false,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12.w),
|
|
topRight: Radius.circular(12.w),
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 15.w),
|
|
text(
|
|
"User(${items.length})",
|
|
fontSize: 14.sp,
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Colors.black,
|
|
),
|
|
SizedBox(height: 10.w),
|
|
SizedBox(height: 350.w, child: buildList(context)),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget buildItem(ChatVibeUserProfile userInfo) {
|
|
return GestureDetector(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(vertical: 3.w),
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12.w),
|
|
color: Colors.transparent,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
GestureDetector(
|
|
child: head(
|
|
url: userInfo.userAvatar ?? "",
|
|
width: 55.w,
|
|
headdress: userInfo.getHeaddress()?.sourceUrl,
|
|
),
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
num index = Provider.of<RtcProvider>(
|
|
context,
|
|
listen: false,
|
|
).userOnMaiInIndex(userInfo.id ?? "");
|
|
Provider.of<RtcProvider>(
|
|
context,
|
|
listen: false,
|
|
).clickSite(index, clickUser: userInfo);
|
|
},
|
|
),
|
|
SizedBox(width: 3.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
msgRoleTag(userInfo.roles ?? "", width: 20.w, height: 20.w),
|
|
SizedBox(width: 3.w),
|
|
chatvibeNickNameText(
|
|
textColor: Colors.black,
|
|
maxWidth: 200.w,
|
|
userInfo.userNickname ?? "",
|
|
fontSize: 14.sp,
|
|
type: userInfo.getVIP()?.name ?? "",
|
|
needScroll:
|
|
(userInfo.userNickname?.characters.length ?? 0) > 16,
|
|
),
|
|
getVIPBadge(
|
|
userInfo.getVIP()?.name,
|
|
width: 45.w,
|
|
height: 25.w,
|
|
),
|
|
// ListView.separated(
|
|
// scrollDirection: Axis.horizontal,
|
|
// shrinkWrap: true,
|
|
// itemCount: userInfo.wearBadge?.length ?? 0,
|
|
// itemBuilder: (context, index) {
|
|
// return netImage(
|
|
// width: 25.w,
|
|
// height: 25.w,
|
|
// url: userInfo.wearBadge?[index].selectUrl ?? "",
|
|
// );
|
|
// },
|
|
// separatorBuilder: (BuildContext context, int index) {
|
|
// return SizedBox(width: 5.w);
|
|
// },
|
|
// ),
|
|
],
|
|
),
|
|
GestureDetector(
|
|
child: Container(
|
|
child: Row(
|
|
textDirection: TextDirection.ltr,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
getIdIcon(
|
|
userInfo.wealthLevel ?? 0,
|
|
width: 28.w,
|
|
height: 28.w,
|
|
textColor: Color(0xFF333333),
|
|
fontSize: 12.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
chatvibeNickNameText(
|
|
maxWidth: 135.w,
|
|
userInfo.getID() ?? "",
|
|
textColor: Color(0xFF333333),
|
|
fontSize: 12.sp,
|
|
fontWeight: FontWeight.w600,
|
|
type: userInfo.getVIP()?.name ?? "",
|
|
needScroll:
|
|
(userInfo.getID().characters.length ?? 0) >
|
|
13,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
Clipboard.setData(
|
|
ClipboardData(text: userInfo.getID() ?? ""),
|
|
);
|
|
ATTts.show(
|
|
ATAppLocalizations.of(context)!.copiedToClipboard,
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {},
|
|
);
|
|
}
|
|
|
|
@override
|
|
empty() {
|
|
List<Widget> list = [];
|
|
list.add(SizedBox(height: height(30)));
|
|
list.add(Image.asset('atu_images/general/at_icon_loading.png'));
|
|
list.add(SizedBox(height: height(15)));
|
|
list.add(
|
|
Text(
|
|
"No data",
|
|
style: TextStyle(
|
|
fontSize: sp(14),
|
|
color: Color(0xff999999),
|
|
fontWeight: FontWeight.w400,
|
|
decoration: TextDecoration.none,
|
|
height: 1,
|
|
),
|
|
),
|
|
);
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: list,
|
|
);
|
|
}
|
|
|
|
@override
|
|
builderDivider() {
|
|
// return Divider(
|
|
// height: 1.w,
|
|
// color: Color(0xff3D3277).withOpacity(0.5),
|
|
// indent: 15.w,
|
|
// );
|
|
return Container(height: 8.w);
|
|
}
|
|
|
|
///加载数据
|
|
@override
|
|
loadPage({
|
|
required int page,
|
|
required Function(List<ChatVibeUserProfile>) onSuccess,
|
|
Function? onErr,
|
|
}) async {
|
|
// var roomList = await ChatRoomRepository().roomOnlineUsers(roomId ?? "");
|
|
await Provider.of<RtcProvider>(context!, listen: false).getOnlineUsers();
|
|
List<ChatVibeUserProfile> userList =
|
|
Provider.of<RtcProvider>(context!, listen: false).onlineUsers;
|
|
onSuccess(userList);
|
|
}
|
|
}
|