227 lines
7.3 KiB
Dart
227 lines
7.3 KiB
Dart
import 'dart:ui' as ui;
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:yumi/services/audio/rtc_manager.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:yumi/app_localizations.dart';
|
|
import 'package:yumi/app/constants/sc_screen.dart';
|
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
|
|
|
import '../../../ui_kit/components/sc_compontent.dart';
|
|
import '../../../ui_kit/components/sc_page_list.dart';
|
|
import '../../../ui_kit/components/sc_tts.dart';
|
|
import '../../../ui_kit/components/text/sc_text.dart';
|
|
|
|
///房间用户在线列表
|
|
class RoomOnlinePage extends SCPageList {
|
|
String? roomId = "";
|
|
|
|
RoomOnlinePage({super.key, this.roomId});
|
|
|
|
@override
|
|
_RoomOnlinePageState createState() => _RoomOnlinePageState(roomId);
|
|
}
|
|
|
|
class _RoomOnlinePageState
|
|
extends SCPageListState<SocialChatUserProfile, RoomOnlinePage> {
|
|
String? roomId = "";
|
|
|
|
_RoomOnlinePageState(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(SocialChatUserProfile 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),
|
|
socialchatNickNameText(
|
|
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);
|
|
// },
|
|
// ),
|
|
],
|
|
),
|
|
SizedBox(height: 3.w),
|
|
GestureDetector(
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 3.w),
|
|
child: Row(
|
|
textDirection: TextDirection.ltr,
|
|
children: [
|
|
text(
|
|
"ID:${userInfo.getID()}",
|
|
fontSize: 12.sp,
|
|
textColor: Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Image.asset(
|
|
"sc_images/room/sc_icon_user_card_copy_id.png",
|
|
width: 12.w,
|
|
height: 12.w,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
Clipboard.setData(
|
|
ClipboardData(text: userInfo.getID() ?? ""),
|
|
);
|
|
SCTts.show(SCAppLocalizations.of(context)!.copiedToClipboard);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {},
|
|
);
|
|
}
|
|
|
|
@override
|
|
empty() {
|
|
List<Widget> list = [];
|
|
list.add(SizedBox(height: height(30)));
|
|
list.add(Image.asset('sc_images/general/sc_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<SocialChatUserProfile>) onSuccess,
|
|
Function? onErr,
|
|
}) async {
|
|
// var roomList = await SCChatRoomRepository().roomOnlineUsers(roomId ?? "");
|
|
await Provider.of<RtcProvider>(context!, listen: false).fetchOnlineUsersList();
|
|
List<SocialChatUserProfile> userList =
|
|
Provider.of<RtcProvider>(context!, listen: false).onlineUsers;
|
|
onSuccess(userList);
|
|
}
|
|
}
|