1150 lines
51 KiB
Dart
1150 lines
51 KiB
Dart
import 'dart:ui' as ui;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_ui/components/appbar/chatvibe_appbar.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_compontent.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
|
|
import 'package:aslan/chatvibe_data/sources/local/user_manager.dart';
|
|
import 'package:marquee/marquee.dart';
|
|
import 'package:aslan/chatvibe_ui/theme/chatvibe_theme.dart';
|
|
import 'package:aslan/chatvibe_data/sources/repositories/family_repository_impl.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/at_famaily_leader_board_res.dart';
|
|
import 'package:aslan/chatvibe_features/index/main_route.dart';
|
|
|
|
class FamilyUserRankPage extends StatefulWidget {
|
|
final String familyId;
|
|
final String rankType;
|
|
@override
|
|
final Key? key;
|
|
|
|
const FamilyUserRankPage(this.familyId, this.rankType, {this.key}) : super(key: key);
|
|
|
|
@override
|
|
_FamilyUserRankPageState createState() => _FamilyUserRankPageState();
|
|
}
|
|
|
|
class _FamilyUserRankPageState extends State<FamilyUserRankPage> {
|
|
List<SupporterWeekRank> supporterWeekRank = [];
|
|
List<HostWeekRank> hostWeekRank = [];
|
|
HostWeekRank? myRank;
|
|
|
|
bool isLoading = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_loadRankList();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
Image.asset(
|
|
"atu_images/family/at_icon_family_head_bg.png",
|
|
fit: BoxFit.fitWidth,
|
|
),
|
|
Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
resizeToAvoidBottomInset: false,
|
|
appBar: ChatVibeStandardAppBar(
|
|
title: "",
|
|
actions: [],
|
|
backButtonColor: Colors.white,
|
|
),
|
|
body: SafeArea(
|
|
top: false,
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.bottomCenter,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
SizedBox(height: 115.w),
|
|
Expanded(
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12.w),
|
|
topRight: Radius.circular(12.w),
|
|
),
|
|
child: BackdropFilter(
|
|
filter: ui.ImageFilter.blur(sigmaX: 18, sigmaY: 18),
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
color: Colors.white10,
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 15.w),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
text(
|
|
widget.rankType == "0"
|
|
? ATAppLocalizations.of(
|
|
context,
|
|
)!.supporterList
|
|
: ATAppLocalizations.of(
|
|
context,
|
|
)!.hostList,
|
|
fontSize: 15.sp,
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 10.w),
|
|
Expanded(
|
|
child: Container(
|
|
margin: EdgeInsetsDirectional.symmetric(horizontal: 10.w),
|
|
alignment: Alignment.topCenter,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
// 渐变色边框
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Color(0xffcecece), // 渐变色1
|
|
Color(0xff5b5b5b), // 渐变色2
|
|
Color(0xffcecece), // 渐变色3
|
|
],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
// 内部留白(边框宽度)
|
|
padding: EdgeInsets.all(0.2.w), // 边框宽度
|
|
child: Container(
|
|
height: double.infinity,
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 10.w,
|
|
horizontal: 6.w,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.black87,
|
|
borderRadius: BorderRadius.circular(
|
|
8.w,
|
|
),
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
SizedBox(height: 10.w),
|
|
Stack(
|
|
alignment:
|
|
AlignmentDirectional
|
|
.center,
|
|
children: [
|
|
_buildRankUserAvatar(1),
|
|
IgnorePointer(
|
|
child: Image.asset(
|
|
"atu_images/family/at_icon_family_user_rank_1.png",
|
|
height: 170.w,
|
|
),
|
|
),
|
|
_buildRankUserName(1),
|
|
],
|
|
),
|
|
Transform.translate(
|
|
offset: Offset(0, -70),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment
|
|
.spaceBetween,
|
|
children: [
|
|
Stack(
|
|
alignment:
|
|
AlignmentDirectional
|
|
.center,
|
|
children: [
|
|
_buildRankUserAvatar(
|
|
2,
|
|
),
|
|
IgnorePointer(
|
|
child: Image.asset(
|
|
"atu_images/family/at_icon_family_user_rank_2.png",
|
|
height: 155.w,
|
|
),
|
|
),
|
|
_buildRankUserName(2),
|
|
],
|
|
),
|
|
Stack(
|
|
alignment:
|
|
AlignmentDirectional
|
|
.center,
|
|
children: [
|
|
_buildRankUserAvatar(
|
|
3,
|
|
),
|
|
IgnorePointer(
|
|
child: Image.asset(
|
|
"atu_images/family/at_icon_family_user_rank_3.png",
|
|
height: 155.w,
|
|
),
|
|
),
|
|
_buildRankUserName(3),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 3
|
|
? Transform.translate(
|
|
offset: Offset(0, -35),
|
|
child: ListView.separated(
|
|
shrinkWrap: true,
|
|
physics:
|
|
NeverScrollableScrollPhysics(),
|
|
itemCount:
|
|
supporterWeekRank
|
|
.sublist(
|
|
3,
|
|
supporterWeekRank
|
|
.length,
|
|
)
|
|
.length,
|
|
// 列表项数量
|
|
padding:
|
|
EdgeInsets.only(
|
|
left: 5.w,
|
|
right: 15.w,
|
|
),
|
|
itemBuilder: (
|
|
context,
|
|
index,
|
|
) {
|
|
return _buildRankUserItem(
|
|
index,
|
|
);
|
|
},
|
|
separatorBuilder: (
|
|
BuildContext context,
|
|
int index,
|
|
) {
|
|
return Divider(
|
|
height: 12.w,
|
|
thickness: 0.2.w,
|
|
color: ChatVibeTheme.dividerColor,
|
|
);
|
|
},
|
|
),
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.length > 3
|
|
? Transform.translate(
|
|
offset: Offset(0, -30),
|
|
child: ListView.separated(
|
|
shrinkWrap: true,
|
|
physics:
|
|
NeverScrollableScrollPhysics(),
|
|
itemCount:
|
|
hostWeekRank
|
|
.sublist(
|
|
3,
|
|
hostWeekRank
|
|
.length,
|
|
)
|
|
.length,
|
|
// 列表项数量
|
|
padding:
|
|
EdgeInsets.only(
|
|
left: 5.w,
|
|
right: 15.w,
|
|
),
|
|
itemBuilder: (
|
|
context,
|
|
index,
|
|
) {
|
|
return _buildRankUserItem(
|
|
index,
|
|
);
|
|
},
|
|
separatorBuilder: (
|
|
BuildContext context,
|
|
int index,
|
|
) {
|
|
return Divider(
|
|
height: 12.w,
|
|
thickness: 0.2.w,
|
|
color: ChatVibeTheme.dividerColor,
|
|
);
|
|
},
|
|
),
|
|
)
|
|
: Container()),
|
|
|
|
isLoading
|
|
? Container()
|
|
: ((myRank?.isHost ?? false) &&
|
|
widget.rankType == "1"
|
|
? SizedBox(height: 40.w)
|
|
: (!(myRank?.isHost ??
|
|
false)) &&
|
|
widget.rankType == "0"
|
|
? SizedBox(height: 40.w)
|
|
: Container()),
|
|
],
|
|
),
|
|
), // 背景色,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
isLoading
|
|
? Container()
|
|
: ((myRank?.isHost ?? false) && widget.rankType == "1"
|
|
? _buildRankUserWithMe()
|
|
: (!(myRank?.isHost ?? false)) && widget.rankType == "0"
|
|
? _buildRankUserWithMe()
|
|
: Container()),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildRankUserAvatar(int rank) {
|
|
if (rank == 1) {
|
|
return PositionedDirectional(
|
|
top: 21.w,
|
|
child:
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.isNotEmpty
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: supporterWeekRank.first.avatar ?? "",
|
|
width: 75.w,
|
|
height: 75.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == supporterWeekRank.first.userId}&tageId=${supporterWeekRank.first.userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.isNotEmpty
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: hostWeekRank.first.avatar ?? "",
|
|
width: 75.w,
|
|
height: 75.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hostWeekRank.first.userId}&tageId=${hostWeekRank.first.userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container()),
|
|
);
|
|
} else if (rank == 2) {
|
|
return PositionedDirectional(
|
|
top: 10.w,
|
|
child:
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 1
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: supporterWeekRank[1].avatar ?? "",
|
|
width: 73.w,
|
|
height: 73.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == supporterWeekRank[1].userId}&tageId=${supporterWeekRank[1].userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.length > 1
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: hostWeekRank[1].avatar ?? "",
|
|
width: 73.w,
|
|
height: 73.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hostWeekRank[1].userId}&tageId=${hostWeekRank[1].userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container()),
|
|
);
|
|
} else if (rank == 3) {
|
|
return PositionedDirectional(
|
|
top: 10.w,
|
|
child:
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 2
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: supporterWeekRank[2].avatar ?? "",
|
|
width: 73.w,
|
|
height: 73.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == supporterWeekRank[2].userId}&tageId=${supporterWeekRank[2].userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.length > 2
|
|
? ATDebounceWidget(
|
|
child: netImage(
|
|
url: hostWeekRank[2].avatar ?? "",
|
|
width: 73.w,
|
|
height: 73.w,
|
|
shape: BoxShape.circle,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hostWeekRank[2].userId}&tageId=${hostWeekRank[2].userId}",
|
|
);
|
|
},
|
|
)
|
|
: Container()),
|
|
);
|
|
}
|
|
return Container();
|
|
}
|
|
|
|
Widget _buildRankUserItem(int index) {
|
|
if (widget.rankType == "0") {
|
|
SupporterWeekRank swr = supporterWeekRank[index + 3];
|
|
return Row(
|
|
children: [
|
|
Container(
|
|
alignment: AlignmentDirectional.center,
|
|
width: 35.w,
|
|
child: text(
|
|
"${index + 4}",
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
),
|
|
SizedBox(width: 15.w),
|
|
ATDebounceWidget(
|
|
child: netImage(
|
|
url: swr.avatar ?? "",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: Color(0xffFEE5BB), width: 0.5.w),
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == swr.userId}&tageId=${swr.userId}",
|
|
);
|
|
},
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
constraints: BoxConstraints(maxWidth: 125.w, maxHeight: 21.w),
|
|
child:
|
|
(swr.nickname?.length ?? 0) > 12
|
|
? Marquee(
|
|
text: swr.nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(milliseconds: 550),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
swr.nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
),
|
|
text(
|
|
"ID:${swr.account}",
|
|
fontSize: 14.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Row(
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 28.w),
|
|
SizedBox(width: 3.w),
|
|
text(
|
|
swr.exp ?? "0",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
} else {
|
|
HostWeekRank hwr = hostWeekRank[index + 3];
|
|
return Row(
|
|
children: [
|
|
Container(
|
|
alignment: AlignmentDirectional.center,
|
|
width: 35.w,
|
|
child: text(
|
|
"${index + 4}",
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
),
|
|
SizedBox(width: 15.w),
|
|
ATDebounceWidget(
|
|
child: netImage(
|
|
url: hwr.avatar ?? "",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: Color(0xffFEE5BB), width: 0.5.w),
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hwr.userId}&tageId=${hwr.userId}",
|
|
);
|
|
},
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
constraints: BoxConstraints(maxWidth: 125.w, maxHeight: 21.w),
|
|
child:
|
|
(hwr.nickname?.length ?? 0) > 12
|
|
? Marquee(
|
|
text: hwr.nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(milliseconds: 550),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
hwr.nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
),
|
|
text(
|
|
"ID:${hwr.account}",
|
|
fontSize: 14.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Row(
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 28.w),
|
|
SizedBox(width: 3.w),
|
|
text(
|
|
hwr.exp ?? "0",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
Widget _buildRankUserName(int rank) {
|
|
if (rank == 1) {
|
|
return PositionedDirectional(
|
|
bottom: 2.w,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.isNotEmpty
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 19.w,
|
|
),
|
|
child:
|
|
(supporterWeekRank.first.nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: supporterWeekRank.first.nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffD85458),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
supporterWeekRank.first.nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffD85458),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.isNotEmpty
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 19.w,
|
|
),
|
|
child:
|
|
(hostWeekRank.first.nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: hostWeekRank.first.nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffD85458),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
hostWeekRank.first.nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffD85458),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container()),
|
|
SizedBox(height: 13.w),
|
|
Container(
|
|
width: 85.w,
|
|
height: 25.w,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Color(0xffFFB906), width: 0.6.w),
|
|
borderRadius: BorderRadius.all(Radius.circular(25.w)),
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Color(0xffAD1300),
|
|
Color(0xffFE280C),
|
|
Color(0xffAD1300),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 20.w),
|
|
text(
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.isNotEmpty
|
|
? supporterWeekRank.first.exp ?? "0"
|
|
: "0")
|
|
: (hostWeekRank.isNotEmpty
|
|
? hostWeekRank.first.exp ?? "0"
|
|
: "0"),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 13.sp,
|
|
textColor: Color(0xffFFE601),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
} else if (rank == 2) {
|
|
return PositionedDirectional(
|
|
bottom: 5.w,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 1
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 17.w,
|
|
),
|
|
child:
|
|
(supporterWeekRank[1].nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: supporterWeekRank[1].nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 11.sp,
|
|
color: Color(0xff4073C4),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
supporterWeekRank[1].nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 11.sp,
|
|
color: Color(0xff4073C4),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.length > 1
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 18.w,
|
|
),
|
|
child:
|
|
(hostWeekRank[1].nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: hostWeekRank[1].nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff4073C4),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
hostWeekRank[1].nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff4073C4),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container()),
|
|
SizedBox(height: 10.w),
|
|
Container(
|
|
width: 75.w,
|
|
height: 22.w,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Color(0xffFFB906), width: 0.6.w),
|
|
borderRadius: BorderRadius.all(Radius.circular(25.w)),
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Color(0xffA3C7FD),
|
|
Color(0xff1D5ABD),
|
|
Color(0xffA3C6FD),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 18.w),
|
|
text(
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 1
|
|
? supporterWeekRank[1].exp ?? "0"
|
|
: "0")
|
|
: (hostWeekRank.length > 1
|
|
? hostWeekRank[1].exp ?? "0"
|
|
: "0"),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
} else if (rank == 3) {
|
|
return PositionedDirectional(
|
|
bottom: 5.w,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 2
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 18.w,
|
|
),
|
|
child:
|
|
(supporterWeekRank[2].nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: supporterWeekRank[2].nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff95522E),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
supporterWeekRank[2].nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff95522E),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container())
|
|
: (hostWeekRank.length > 2
|
|
? Container(
|
|
constraints: BoxConstraints(
|
|
maxWidth: 70.w,
|
|
maxHeight: 18.w,
|
|
),
|
|
child:
|
|
(hostWeekRank[2].nickname?.length ?? 0) > 6
|
|
? Marquee(
|
|
text: hostWeekRank[2].nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff95522E),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
hostWeekRank[2].nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: Color(0xff95522E),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
)
|
|
: Container()),
|
|
SizedBox(height: 10.w),
|
|
Container(
|
|
width: 75.w,
|
|
height: 22.w,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Color(0xffFFB906), width: 0.6.w),
|
|
borderRadius: BorderRadius.all(Radius.circular(25.w)),
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Color(0xffF5EAE4),
|
|
Color(0xffF9C29E),
|
|
Color(0xffF5EAE4),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 18.w),
|
|
text(
|
|
widget.rankType == "0"
|
|
? (supporterWeekRank.length > 2
|
|
? supporterWeekRank[2].exp ?? "0"
|
|
: "0")
|
|
: (hostWeekRank.length > 2
|
|
? hostWeekRank[2].exp ?? "0"
|
|
: "0"),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
return Container();
|
|
}
|
|
|
|
void _loadRankList() {
|
|
GroupRepository()
|
|
.familyMemberTop100(widget.familyId)
|
|
.then((res) {
|
|
supporterWeekRank = res.supporterWeekRank ?? [];
|
|
hostWeekRank = res.hostWeekRank ?? [];
|
|
myRank = res.myRankInfo;
|
|
isLoading = false;
|
|
setState(() {});
|
|
})
|
|
.catchError((_) {});
|
|
}
|
|
|
|
_buildRankUserWithMe() {
|
|
return Container(
|
|
height: 68.w,
|
|
padding: EdgeInsets.symmetric(vertical: 8.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(15.w),
|
|
topRight: Radius.circular(15.w),
|
|
),
|
|
color: Colors.black87,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 10.w),
|
|
Container(
|
|
alignment: AlignmentDirectional.center,
|
|
width: 35.w,
|
|
child: text(
|
|
"${myRank?.rank ?? 0}",
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
),
|
|
SizedBox(width: 8.w),
|
|
ATDebounceWidget(
|
|
child: netImage(
|
|
url: myRank?.avatar ?? "",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
defaultImg: "atu_images/general/at_icon_avar_defalt.png",
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: Color(0xffFEE5BB), width: 0.5.w),
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == myRank?.userId}&tageId=${myRank?.userId}",
|
|
);
|
|
},
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
constraints: BoxConstraints(maxWidth: 125.w, maxHeight: 21.w),
|
|
child:
|
|
(myRank?.nickname?.length ?? 0) > 12
|
|
? Marquee(
|
|
text: myRank?.nickname ?? "",
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
blankSpace: 20.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(seconds: 1),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(milliseconds: 550),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
myRank?.nickname ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
),
|
|
text(
|
|
"ID:${myRank?.account}",
|
|
fontSize: 14.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Row(
|
|
children: [
|
|
Image.asset("atu_images/general/at_icon_jb.png", height: 28.w),
|
|
SizedBox(width: 3.w),
|
|
text(
|
|
myRank?.exp ?? "0",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(width: 20.w),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|