216 lines
6.9 KiB
Dart
216 lines
6.9 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_room_repository_imp.dart';
|
|
import 'package:yumi/main.dart';
|
|
|
|
import 'package:yumi/app_localizations.dart';
|
|
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
|
import 'package:yumi/ui_kit/components/sc_page_list.dart';
|
|
import 'package:yumi/ui_kit/components/text/sc_text.dart';
|
|
import 'package:yumi/ui_kit/components/sc_tts.dart';
|
|
import 'package:yumi/shared/tools/sc_lk_dialog_util.dart';
|
|
import 'package:yumi/shared/business_logic/models/res/room_gift_rank_res.dart';
|
|
import 'package:yumi/ui_kit/widgets/room/room_user_info_card.dart';
|
|
|
|
class RoomGiftRankTabPage extends SCPageList {
|
|
String roomId;
|
|
String dataType;
|
|
|
|
RoomGiftRankTabPage(this.roomId, this.dataType);
|
|
|
|
@override
|
|
_RoomGiftRankTabPageState createState() =>
|
|
_RoomGiftRankTabPageState(roomId, dataType);
|
|
}
|
|
|
|
class _RoomGiftRankTabPageState
|
|
extends SCPageListState<RoomGiftRankRes, RoomGiftRankTabPage> {
|
|
String roomId;
|
|
String dataType;
|
|
|
|
_RoomGiftRankTabPageState(this.roomId, this.dataType);
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
enablePullUp = false;
|
|
backgroundColor = Colors.transparent;
|
|
loadData(1);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return buildList(context);
|
|
}
|
|
|
|
@override
|
|
Widget buildItemOne(RoomGiftRankRes userInfo, int index) {
|
|
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: [
|
|
index == 0
|
|
? Image.asset(
|
|
"sc_images/room/sc_icon_room_contribute_rank1.png",
|
|
width: 22.w,
|
|
height: 22.w,
|
|
)
|
|
: (index == 1
|
|
? Image.asset(
|
|
"sc_images/room/sc_icon_room_contribute_rank2.png",
|
|
width: 22.w,
|
|
height: 22.w,
|
|
)
|
|
: (index == 2
|
|
? Image.asset(
|
|
"sc_images/room/sc_icon_room_contribute_rank3.png",
|
|
width: 22.w,
|
|
height: 22.w,
|
|
)
|
|
: Container(
|
|
width: 22.w,
|
|
alignment: AlignmentDirectional.center,
|
|
child: text(
|
|
"${index + 1}",
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Colors.white,
|
|
fontSize: 14.sp,
|
|
),
|
|
))),
|
|
SizedBox(width: 10.w),
|
|
GestureDetector(
|
|
child: head(
|
|
url: userInfo.userProfile?.userAvatar ?? "",
|
|
width: 55.w,
|
|
// headdress: userInfo.userProfile?.getHeaddress()?.sourceUrl,
|
|
),
|
|
onTap: () {
|
|
showBottomInCenterDialog(
|
|
navigatorKey.currentState!.context,
|
|
RoomUserInfoCard(userId: userInfo.userProfile?.id),
|
|
);
|
|
SmartDialog.dismiss(tag: "showRoomGiftRankPage");
|
|
},
|
|
),
|
|
SizedBox(width: 3.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
socialchatNickNameText(
|
|
maxWidth: 170.w,
|
|
userInfo.userProfile?.userNickname ?? "",
|
|
fontSize: 14.sp,
|
|
type: userInfo.userProfile?.getVIP()?.name ?? "",
|
|
needScroll:
|
|
(userInfo.userProfile?.userNickname?.characters.length ?? 0) >
|
|
14,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 3.w),
|
|
GestureDetector(
|
|
child: Container(
|
|
child: Row(
|
|
textDirection: TextDirection.ltr,
|
|
children: [
|
|
text(
|
|
"ID:${userInfo.userProfile?.getID()}",
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
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,
|
|
),
|
|
SizedBox(width: 8.w),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
Clipboard.setData(
|
|
ClipboardData(text: userInfo.userProfile?.getID() ?? ""),
|
|
);
|
|
SCTts.show(SCAppLocalizations.of(context)!.copiedToClipboard);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Image.asset(
|
|
"sc_images/general/sc_icon_jb.png",
|
|
width: 20.w,
|
|
height: 20.w,
|
|
),
|
|
SizedBox(width: 3.w),
|
|
text(
|
|
"${userInfo.totalFormat ?? 0}",
|
|
fontSize: 12.sp,
|
|
textColor: Color(0xFFFFB627),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {},
|
|
);
|
|
}
|
|
|
|
@override
|
|
empty() {
|
|
return mainEmpty(
|
|
image: Image.asset(
|
|
'sc_images/general/sc_icon_loading.png',
|
|
width: 121.w,
|
|
fit: BoxFit.fitWidth,
|
|
),
|
|
msg: SCAppLocalizations.of(context)!.noData,
|
|
textColor: Colors.white54,
|
|
);
|
|
}
|
|
|
|
@override
|
|
builderDivider() {
|
|
// return Divider(
|
|
// height: 1.w,
|
|
// color: Color(0xff3D3277).withOpacity(0.5),
|
|
// indent: 15.w,
|
|
// );
|
|
return Container(height: 4.w);
|
|
}
|
|
|
|
///加载数据
|
|
@override
|
|
loadPage({
|
|
required int page,
|
|
required Function(List<RoomGiftRankRes>) onSuccess,
|
|
Function? onErr,
|
|
}) async {
|
|
try {
|
|
var list = await SCChatRoomRepository().roomContributionRank(
|
|
roomId,
|
|
dataType,
|
|
size: 20,
|
|
);
|
|
onSuccess(list);
|
|
} catch (e) {
|
|
if (onErr != null) {
|
|
onErr();
|
|
}
|
|
}
|
|
}
|
|
}
|