2026-07-01 18:25:58 +08:00

2258 lines
94 KiB
Dart

import 'dart:ui' as ui;
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ninepatch_image/flutter_ninepatch_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.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_ui/components/at_tts.dart';
import 'package:aslan/chatvibe_core/utilities/at_loading_manager.dart';
import 'package:aslan/chatvibe_data/sources/repositories/family_repository_impl.dart';
import 'package:marquee/marquee.dart';
import 'package:provider/provider.dart';
import 'package:aslan/chatvibe_ui/components/dialog/dialog_base.dart';
import 'package:aslan/chatvibe_ui/theme/chatvibe_theme.dart';
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
import 'package:aslan/chatvibe_core/utilities/at_room_utils.dart';
import 'package:aslan/chatvibe_data/sources/local/user_manager.dart';
import 'package:aslan/chatvibe_domain/models/res/family_base_info_res.dart';
import 'package:aslan/chatvibe_managers/user_profile_manager.dart';
import 'package:aslan/chatvibe_features/index/main_route.dart';
import 'package:aslan/chatvibe_features/family/family_route.dart';
import '../../../chatvibe_data/models/enum/at_family_roles_type.dart';
import '../../../chatvibe_domain/models/res/at_famaily_leader_board_res.dart';
import '../../../chatvibe_domain/usecases/at_family_rank_tab_selector.dart';
class FamilyInfoPage extends StatefulWidget {
String familyId = "";
@override
_FamilyInfoPageState createState() => _FamilyInfoPageState();
FamilyInfoPage(this.familyId);
}
class _FamilyInfoPageState extends State<FamilyInfoPage> {
ChatVibeFamilyBaseInfoRes? familyBaseInfo;
List<SupporterWeekRank> supporterWeekRank = [];
List<HostWeekRank> hostWeekRank = [];
int _currentRankTabIndex = 0;
@override
void initState() {
super.initState();
loadFamilyInfo();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
resizeToAvoidBottomInset: false,
body: SafeArea(
top: false,
child: Stack(
alignment: Alignment.bottomCenter,
children: [
SingleChildScrollView(
child: Stack(
children: [
Image.asset(
"atu_images/family/at_icon_family_head_bg.png",
fit: BoxFit.fitWidth,
),
PositionedDirectional(
top: 11.w,
child: ChatVibeStandardAppBar(
actions: [],
title: "",
backButtonColor: Colors.white,
),
),
Container(
margin: EdgeInsets.only(top: 212.w),
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(
padding: EdgeInsets.symmetric(horizontal: 15.w),
alignment: Alignment.center,
color: Colors.white10,
child: Column(
children: [
SizedBox(height: 10.w),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Spacer(),
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.ADMIN.name
? Row(
mainAxisSize: MainAxisSize.min,
children: [
ATDebounceWidget(
child: Container(
padding: EdgeInsets.all(3.w),
child: Image.asset(
height: 22.w,
"atu_images/family/at_icon_family_join_request_tag.png",
),
),
onTap: () {
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyJoinRequest}?currentMember=${familyBaseInfo?.currentMember ?? 0}&maxMember=${familyBaseInfo?.maxMember ?? 0}",
replace: false,
).then((result) {
loadFamilyInfo();
});
},
),
ATDebounceWidget(
child: Container(
padding: EdgeInsets.all(3.w),
child: Image.asset(
height: 22.w,
"atu_images/family/at_icon_family_edit_tag.png",
),
),
onTap: () {
ATNavigatorUtils.push(
context,
"${FamilyRoute.editFamily}?familyId=${familyBaseInfo?.familyId}",
replace: false,
).then((result) {
loadFamilyInfo();
});
},
),
SizedBox(width: 8.w),
],
)
: Container(),
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MEMBER.name
? Builder(
builder: (ct) {
return ATDebounceWidget(
child: Container(
padding: EdgeInsets.all(3.w),
child: Icon(
Icons.more_horiz,
color: Colors.white,
size: 22.w,
),
),
onTap: () {
_showLeavFamilyOpt(ct);
},
);
},
)
: Container(),
],
),
SizedBox(height: 10.w),
_buidFamilyInfo(),
SizedBox(height: 10.w),
_buildFamilyAnnouncement(),
SizedBox(height: 10.w),
Row(
children: [
Container(
height: 22.w,
width: 4.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xffC670FF),
Color(0xff7726FF),
],
),
borderRadius: BorderRadius.circular(2.w),
),
),
SizedBox(width: 10.w),
text(
ATAppLocalizations.of(context)!.treasureChest,
textColor: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14.sp,
),
Spacer(),
ATDebounceWidget(
debounceTime: Duration(milliseconds: 800),
child: Container(
padding: EdgeInsets.all(3.w),
child: Image.asset(
"atu_images/person/at_icon_cp_helpe.png",
height: 18.w,
),
),
onTap: () {
if (familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.ADMIN.name ||
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MEMBER.name) {
SmartDialog.show(
tag: "showFamilyHelp",
alignment: Alignment.bottomCenter,
debounce: true,
animationType:
SmartAnimationType.fade,
clickMaskDismiss: true,
builder: (_) {
return SafeArea(
top: false,
child: Container(
decoration: BoxDecoration(
color: Color(0xff161616),
border: Border.all(
color: Colors.grey,
width: 0.3.w,
),
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
12.w,
),
topRight:
Radius.circular(
12.w,
),
),
),
child: Column(
mainAxisSize:
MainAxisSize.min,
children: [
SizedBox(height: 8.w),
Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
text(
ATAppLocalizations.of(
context,
)!.help,
textColor:
Colors.white,
fontSize: 15.sp,
fontWeight:
FontWeight.w600,
),
],
),
Container(
padding:
EdgeInsetsDirectional.only(
top: 8.w,
start: 10.w,
end: 10.w,
bottom: 20.w,
),
child: text(
ATAppLocalizations.of(
context,
)!.familyHelpTips,
maxLines: 50,
textColor: Colors.white,
fontSize: 15.sp,
fontWeight:
FontWeight.w600,
),
),
],
),
),
);
},
);
}
},
),
],
),
SizedBox(height: 10.w),
_buildBoxLine(),
SizedBox(height: 10.w),
Row(
children: [
Container(
height: 22.w,
width: 4.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xffC670FF),
Color(0xff7726FF),
],
),
borderRadius: BorderRadius.circular(2.w),
),
),
SizedBox(width: 10.w),
text(
"Lv.${familyBaseInfo?.familyLevel ?? 0}",
textColor: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14.sp,
),
Spacer(),
ATDebounceWidget(
debounceTime: Duration(milliseconds: 800),
child: Container(
padding: EdgeInsets.all(3.w),
child: Icon(
Icons.chevron_right,
size: 25.w,
color: Colors.white,
),
),
onTap: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyLevel}?curentLevel=${familyBaseInfo?.familyLevel ?? 0}&curentLevelExp=${familyBaseInfo?.currentExp ?? "0"}",
replace: false,
);
}
},
),
],
),
SizedBox(height: 10.w),
_buildLevelLine(),
SizedBox(height: 10.w),
Row(
children: [
Container(
height: 22.w,
width: 4.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xffC670FF),
Color(0xff7726FF),
],
),
borderRadius: BorderRadius.circular(2.w),
),
),
SizedBox(width: 10.w),
text(
"${ATAppLocalizations.of(context)!.memberList}:",
textColor: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14.sp,
),
Spacer(),
ATDebounceWidget(
debounceTime: Duration(milliseconds: 800),
child: Container(
padding: EdgeInsets.all(3.w),
child: Icon(
Icons.chevron_right,
size: 25.w,
color: Colors.white,
),
),
onTap: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyMemberList}?familyId=${familyBaseInfo?.familyId}&myFamilyRole=${familyBaseInfo?.myFamilyRole}",
replace: false,
).then((result) {
loadFamilyInfo();
});
}
},
),
],
),
SizedBox(height: 10.w),
_buildRankUserLine(),
SizedBox(height: 10.w),
_buildRankTabLine(),
],
),
),
),
),
),
],
),
),
Consumer<ChatVibeUserProfileManager>(
builder: (context, ref, child) {
return AccountStorage().getCurrentUser()?.userProfile?.familyId ==
null &&
familyBaseInfo?.joinWaiting == false
? ATDebounceWidget(
debounceTime: Duration(milliseconds: 800),
child: Container(
margin: EdgeInsets.only(bottom: 15.w),
height: 45.w,
alignment: Alignment.center,
width: 180.w,
padding: EdgeInsets.symmetric(vertical: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
gradient: LinearGradient(
colors: [Color(0xff0D0022), Color(0xff9F63FF)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: text(
ATAppLocalizations.of(context)!.applyToJoin,
fontSize: 15.sp,
fontWeight: FontWeight.w600,
textColor: Colors.white,
),
),
onTap: () {
GroupRepository()
.familyApplyJoin(familyBaseInfo?.familyId ?? "")
.then((res) {
ATTts.show(
ATAppLocalizations.of(
context,
)!.operationSuccessful,
);
loadFamilyInfo();
});
},
)
: (familyBaseInfo?.joinWaiting == true
? Container(
margin: EdgeInsets.only(bottom: 15.w),
height: 45.w,
alignment: Alignment.center,
width: 180.w,
padding: EdgeInsets.symmetric(vertical: 12.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
color: Color(0xff5a5851),
),
child: text(
ATAppLocalizations.of(context)!.pending,
fontSize: 15.sp,
fontWeight: FontWeight.w600,
textColor: Colors.white,
),
)
: Container());
},
),
],
),
),
);
}
_buidFamilyInfo() {
String familyIntro = (familyBaseInfo?.familyIntro ?? "").replaceAll(
RegExp(r'\s+'),
' ',
);
int level = 0;
if ((familyBaseInfo?.familyLevel ?? 0) > 0 &&
(familyBaseInfo?.familyLevel ?? 0) < 4) {
level = 1;
} else if ((familyBaseInfo?.familyLevel ?? 0) > 3 &&
(familyBaseInfo?.familyLevel ?? 0) < 7) {
level = 2;
} else if ((familyBaseInfo?.familyLevel ?? 0) > 6 &&
(familyBaseInfo?.familyLevel ?? 0) < 10) {
level = 3;
} else {
level = familyBaseInfo?.familyLevel ?? 0;
}
return SizedBox(
width: ScreenUtil().screenWidth,
child: NinePatchImage(
alignment: Alignment.center,
imageProvider: AssetImage(
"atu_images/family/at_icon_family_info_item_bg_$level.9.png",
),
sliceCachedKey: "atu_images/family/at_icon_family_info_item_bg_$level.9.png",
child: Column(
children: [
SizedBox(height: 5.w),
Row(
children: [
SizedBox(width: 5.w),
Container(
margin: EdgeInsetsDirectional.only(start: 8.w, top: 5.w),
child: netImage(
height: 80.w,
width: 80.w,
borderRadius: BorderRadius.circular(5.w),
url: familyBaseInfo?.familyAvatar ?? "",
),
),
SizedBox(width: 10.w),
Expanded(
child: Column(
children: [
Container(
constraints: BoxConstraints(
maxWidth: 135.w,
maxHeight: 24.w,
),
child:
(familyBaseInfo?.familyName?.length ?? 0) > 12
? Marquee(
text: familyBaseInfo?.familyName ?? "",
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
scrollAxis: Axis.horizontal,
blankSpace: 40.0,
velocity: 40.0,
pauseAfterRound: Duration(seconds: 1),
accelerationDuration: Duration(seconds: 1),
accelerationCurve: Curves.easeOut,
decelerationDuration: Duration(
milliseconds: 500,
),
decelerationCurve: Curves.easeOut,
)
: Text(
familyBaseInfo?.familyName ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
),
),
SizedBox(height: 5.w),
Row(
children: [
text(
"ID:${familyBaseInfo?.familyAccount ?? ""}",
fontWeight: FontWeight.w600,
fontSize: 13.sp,
textColor: Colors.white,
),
SizedBox(width: 2.w),
Container(
alignment: AlignmentDirectional.center,
height: 25.w,
width: 68.w,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
height: 15.w,
"atu_images/family/at_icon_family_member_tag.png",
),
SizedBox(width: 3.w),
text(
"${familyBaseInfo?.currentMember ?? 0}/${familyBaseInfo?.maxMember ?? 0}",
fontWeight: FontWeight.w600,
fontSize: 13.sp,
textColor: Colors.white,
),
],
),
),
],
),
],
),
),
Image.asset(
"atu_images/family/at_icon_family_level_${familyBaseInfo?.familyLevel ?? 0}.png",
height: 80.w,
),
// Image.asset(
// "images/family/at_icon_family_rank_tag.png",
// height: 80.w,
// ),
SizedBox(width: 5.w),
],
),
SizedBox(height: 8.w),
Container(
margin: EdgeInsets.symmetric(horizontal: 15.w),
padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 6.w),
// 外部容器用于实现渐变边框
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: Color(0xFFF5F5F5), width: 0.2.w),
),
child: Row(
children: [
Image.asset(
"atu_images/family/at_icon_announcement_tag.png",
height: 22.w,
),
SizedBox(width: 3.w),
Expanded(
child: SizedBox(
height: 22.w,
child:
(familyIntro?.length ?? 0) > 20
? Marquee(
text: familyIntro ?? "",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
scrollAxis: Axis.horizontal,
blankSpace: 40.0,
velocity: 40.0,
pauseAfterRound: Duration(seconds: 1),
accelerationDuration: Duration(seconds: 1),
accelerationCurve: Curves.easeOut,
decelerationDuration: Duration(
milliseconds: 500,
),
decelerationCurve: Curves.easeOut,
)
: Text(
(familyIntro ?? "").isEmpty
? ATAppLocalizations.of(
context,
)!.welcomeToMyFamily
: familyIntro ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
),
),
),
],
), // 背景色,
),
SizedBox(height: 10.w),
],
),
),
);
}
Widget _buildFamilyAnnouncement() {
String familyNotice = (familyBaseInfo?.familyNotice ?? "").replaceAll(
RegExp(r'\s+'),
' ',
);
return ATDebounceWidget(
child: Container(
alignment: Alignment.center,
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(
padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 6.w),
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(8.w),
),
child: Row(
children: [
Image.asset(
"atu_images/family/at_icon_announcement_tag2.png",
height: 22.w,
),
SizedBox(width: 3.w),
Expanded(
child: SizedBox(
height: 22.w,
child:
(familyNotice.length ?? 0) > 20
? Marquee(
text: familyNotice,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
scrollAxis: Axis.horizontal,
blankSpace: 40.0,
velocity: 40.0,
pauseAfterRound: Duration(seconds: 1),
accelerationDuration: Duration(seconds: 1),
accelerationCurve: Curves.easeOut,
decelerationDuration: Duration(milliseconds: 550),
decelerationCurve: Curves.easeOut,
)
: Text(
(familyNotice ?? "").isEmpty
? ATAppLocalizations.of(
context,
)!.welcomeToMyFamily
: familyNotice ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
),
),
),
Icon(Icons.chevron_right, size: 25.w, color: Colors.white),
],
), // 背景色,
),
),
onTap: () {
if (familyBaseInfo?.myFamilyRole == ATFamilyRolesType.ADMIN.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MEMBER.name) {
String familyAnnouncement = Uri.encodeComponent(
familyBaseInfo?.familyNotice ?? "",
);
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyNews}?familyId=${familyBaseInfo?.familyId}&familyAnnouncement=$familyAnnouncement",
replace: false,
);
}
},
);
}
Widget _buildBoxLine() {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.all(10.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("atu_images/family/at_icon_family_box_item_bg.png"),
fit: BoxFit.fill,
),
),
child: Column(
children: [
Stack(
alignment: Alignment.center,
children: [
Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white24,
borderRadius: BorderRadius.circular(8.w),
),
height: 12.w,
width: ScreenUtil().screenWidth * 0.8,
),
Container(
height: 12.w,
width: ATRoomUtils.collectCurrenProgressProcess(
familyBaseInfo?.boxInfo?.contributeCount ?? 0,
familyBaseInfo?.boxInfo?.chests?.last.requiredCount ?? 1,
ScreenUtil().screenWidth * 0.8,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xffE41A3F), Color(0xffFFFA0F)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.circular(8.w),
),
),
],
),
PositionedDirectional(
start: 0,
child: Transform.translate(
offset: Offset(-13, 0),
child: _buildBoxIcon(0),
),
),
_buildBoxIcon(1),
PositionedDirectional(
end: 0,
child: Transform.translate(
offset: Offset(13, 0),
child: _buildBoxIcon(2),
),
),
],
),
(familyBaseInfo?.boxInfo?.chests?.length ?? 0) > 2
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
"atu_images/family/at_icon_family_user_tag.png",
height: 16.w,
),
Container(
margin: EdgeInsets.only(top: 3.w),
child: text(
"${familyBaseInfo?.boxInfo?.chests![0].requiredCount ?? 0}",
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w500,
),
),
],
),
Row(
children: [
Image.asset(
"atu_images/family/at_icon_family_user_tag.png",
height: 16.w,
),
Container(
margin: EdgeInsets.only(top: 3.w),
child: text(
"${familyBaseInfo?.boxInfo?.chests![1].requiredCount ?? 0}",
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w500,
),
),
],
),
Row(
children: [
Image.asset(
"atu_images/family/at_icon_family_user_tag.png",
height: 16.w,
),
Container(
margin: EdgeInsets.only(top: 3.w),
child: text(
"${familyBaseInfo?.boxInfo?.chests![2].requiredCount ?? 0}",
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w500,
),
),
],
),
],
)
: Container(),
Row(
children: [
Container(
margin: EdgeInsets.only(top: 5.w),
height: 58.w,
width: 165.w,
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 15.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("atu_images/family/at_icon_box_btn_bg.png"),
fit: BoxFit.fill,
),
),
child: text(
ATAppLocalizations.of(context)!.numberOfSign(
"${familyBaseInfo?.boxInfo?.contributeCount ?? 0}",
),
fontSize: 13.sp,
fontWeight: FontWeight.w600,
textColor: Colors.white,
),
),
SizedBox(width: 10.w),
ATDebounceWidget(
debounceTime: Duration(milliseconds: 800),
child: Container(
margin: EdgeInsets.only(top: 5.w),
height: 58.w,
width: 135.w,
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 15.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("atu_images/family/at_icon_box_btn_bg.png"),
fit: BoxFit.fill,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset("atu_images/general/at_icon_jb.png", width: 25.w),
SizedBox(width: 8.w),
text(
"50",
fontSize: 15.sp,
fontWeight: FontWeight.w600,
textColor: Colors.white,
),
],
),
),
onTap: () {
if (familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.ADMIN.name ||
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole ==
ATFamilyRolesType.MEMBER.name) {
_familyBoxContribute();
}
},
),
],
),
],
),
);
}
Widget _buildBoxIcon(int index) {
if (familyBaseInfo?.myFamilyRole == ATFamilyRolesType.ADMIN.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MEMBER.name) {
Chests? chest = familyBaseInfo?.boxInfo?.chests![index];
if ((chest?.unlocked ?? false)) {
//宝箱已经解锁
if ((chest?.claimed ?? false)) {
//宝箱已经领取
return Image.asset(
"atu_images/family/at_icon_family_box${index + 1}_opened.png",
width: 35.w,
height: 35.w,
);
} else {
return ATDebounceWidget(
child: Image.asset(
"atu_images/family/at_icon_family_box${index + 1}_open.webp",
width: 35.w,
height: 35.w,
),
onTap: () {
if (familyBaseInfo?.myFamilyRole == ATFamilyRolesType.ADMIN.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MANAGE.name ||
familyBaseInfo?.myFamilyRole == ATFamilyRolesType.MEMBER.name) {
ATLoadingManager.exhibitOperation();
GroupRepository()
.familyBoxClaim(chest?.level ?? 0)
.then((res) {
ATTts.show(ATAppLocalizations.of(context)!.receiveSucc);
loadFamilyInfo();
})
.catchError((_) {});
}
},
);
}
}
}
return Image.asset(
"atu_images/family/at_icon_family_box${index + 1}.png",
width: 35.w,
height: 35.w,
);
}
Widget _buildLevelLine() {
int level = 0;
if ((familyBaseInfo?.familyLevel ?? 0) > 0 &&
(familyBaseInfo?.familyLevel ?? 0) < 4) {
level = 1;
} else if ((familyBaseInfo?.familyLevel ?? 0) > 3 &&
(familyBaseInfo?.familyLevel ?? 0) < 7) {
level = 2;
} else if ((familyBaseInfo?.familyLevel ?? 0) > 6 &&
(familyBaseInfo?.familyLevel ?? 0) < 10) {
level = 3;
} else {
level = familyBaseInfo?.familyLevel ?? 0;
}
return SizedBox(
width: ScreenUtil().screenWidth,
child: NinePatchImage(
alignment: Alignment.center,
imageProvider: AssetImage(
"atu_images/family/at_icon_family_info_item_bg_$level.9.png",
),
sliceCachedKey: "atu_images/family/at_icon_family_info_item_bg_$level.9.png",
child: Padding(
padding: EdgeInsetsDirectional.all(10.w),
child: Row(
children: [
Column(
children: [
text(
"${familyBaseInfo?.currentExp ?? 0}/${familyBaseInfo?.levelExp ?? 0}",
fontWeight: FontWeight.w600,
fontSize: 14.sp,
textColor: Colors.white,
),
SizedBox(height: 3.w),
Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white10,
borderRadius: BorderRadius.circular(8.w),
),
height: 9.w,
width: ScreenUtil().screenWidth * 0.65,
),
Container(
height: 9.w,
width: ATRoomUtils.collectCurrenProgressProcess(
int.parse(familyBaseInfo?.currentExp ?? "0"),
int.parse(familyBaseInfo?.levelExp ?? "1"),
ScreenUtil().screenWidth * 0.65,
),
decoration: BoxDecoration(
gradient: buildFamilyProgressLinearGradient(level),
borderRadius: BorderRadius.circular(8.w),
),
),
],
),
],
),
Spacer(),
Image.asset(
"atu_images/family/at_icon_family_level_${familyBaseInfo?.familyLevel ?? 0}.png",
width: 75.w,
),
],
),
),
),
);
}
Widget _buildRankUserLine() {
return Row(
children: [
Expanded(
child: ATDebounceWidget(
child: Container(
height: 88.w,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.only(
start: 10.w,
top: 8.w,
end: 3.w,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.w),
border: Border.all(color: Color(0xffE6E6E6), width: 0.1.w),
gradient: RadialGradient(
colors: [Color(0xff161616), Color(0xff101010)],
),
),
child: Column(
children: [
Row(
children: [
text(
"${ATAppLocalizations.of(context)!.supporter}:",
fontWeight: FontWeight.w600,
fontSize: 14.sp,
textColor: Colors.white,
),
Spacer(),
Container(
padding: EdgeInsets.all(3.w),
child: Icon(
Icons.chevron_right,
size: 22.w,
color: Colors.white,
),
),
],
),
SizedBox(height: 3.w),
Row(
children: [
Expanded(
child: SizedBox(
height: 35.w,
child: ListView.separated(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount:
familyBaseInfo
?.memberList
?.supporters
?.length ??
0,
itemBuilder: (context, index) {
return netImage(
width: 35.w,
height: 35.w,
url:
familyBaseInfo
?.memberList
?.supporters?[index]
.userAvatar ??
"",
shape: BoxShape.circle,
defaultImg:
"atu_images/general/at_icon_avar_defalt.png",
);
},
separatorBuilder: (
BuildContext context,
int index,
) {
return SizedBox(width: 5.w);
},
),
),
),
],
),
],
),
),
onTap: () {
if (AccountStorage().getCurrentUser()?.userProfile?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyUserRank}?familyId=${familyBaseInfo?.familyId}&rankType=0",
replace: false,
);
}
},
),
),
SizedBox(width: 10.w),
Expanded(
child: ATDebounceWidget(
child: Container(
height: 88.w,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.only(
start: 10.w,
top: 8.w,
end: 3.w,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.w),
border: Border.all(color: Color(0xffE6E6E6), width: 0.1.w),
gradient: LinearGradient(
colors: [Color(0xff161616), Color(0xff101010)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Column(
children: [
Row(
children: [
text(
"${ATAppLocalizations.of(context)!.host}:",
fontWeight: FontWeight.w600,
fontSize: 14.sp,
textColor: Colors.white,
),
Spacer(),
Container(
padding: EdgeInsets.all(3.w),
child: Icon(
Icons.chevron_right,
size: 22.w,
color: Colors.white,
),
),
],
),
SizedBox(height: 3.w),
Row(
children: [
Expanded(
child: SizedBox(
height: 35.w,
child: ListView.separated(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount:
familyBaseInfo?.memberList?.hosts?.length ?? 0,
itemBuilder: (context, index) {
return netImage(
width: 35.w,
height: 35.w,
url:
familyBaseInfo
?.memberList
?.hosts?[index]
.userAvatar ??
"",
shape: BoxShape.circle,
defaultImg:
"atu_images/general/at_icon_avar_defalt.png",
);
},
separatorBuilder: (
BuildContext context,
int index,
) {
return SizedBox(width: 5.w);
},
),
),
),
],
),
],
),
),
onTap: () {
if (AccountStorage().getCurrentUser()?.userProfile?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${FamilyRoute.familyUserRank}?familyId=${familyBaseInfo?.familyId}&rankType=1",
replace: false,
);
}
},
),
),
],
);
}
Widget _buildRankTabLine() {
return SizedBox(
width: ScreenUtil().screenWidth,
child: NinePatchImage(
imageProvider: AssetImage(
"atu_images/family/at_icon_family_tab_rank_bg.9.png",
),
sliceCachedKey: "atu_images/family/at_icon_family_tab_rank_bg.9.png",
child: Column(
children: [
SizedBox(height: 10.w),
Row(
children: [
SizedBox(width: 10.w),
ATFamilyRankTabSelector(
options: [
ATAppLocalizations.of(context)!.supporterWeeklyRank,
ATAppLocalizations.of(context)!.hostWeeklyRank,
],
onChanged: (index) {
setState(() {
_currentRankTabIndex = index;
});
},
initialIndex: 0,
),
SizedBox(width: 10.w),
],
),
Container(
margin: EdgeInsets.symmetric(horizontal: 5.w),
child: 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),
],
),
],
),
),
],
),
),
_currentRankTabIndex == 0
? (supporterWeekRank.length > 3
? Transform.translate(
offset: Offset(0, -35),
child: ListView.separated(
shrinkWrap: true,
physics: const 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: const 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()),
],
),
),
);
}
Widget _buildRankUserItem(int index) {
if (_currentRankTabIndex == 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: () {
if (AccountStorage().getCurrentUser()?.userProfile?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == swr.userId}&tageId=${swr.userId}",
);
}
},
),
SizedBox(width: 5.w),
Column(
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,
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(
supporterWeekRank.first.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,
),
),
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: () {
if (AccountStorage().getCurrentUser()?.userProfile?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hwr.userId}&tageId=${hwr.userId}",
);
}
},
),
SizedBox(width: 5.w),
Column(
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,
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,
),
],
),
],
);
}
}
void loadFamilyInfo() {
ATLoadingManager.exhibitOperation();
GroupRepository()
.familyBaseInfo(familyId: widget.familyId)
.then((result) {
familyBaseInfo = result;
loadFamilyLeaderboard();
setState(() {});
ATLoadingManager.veilRoutine();
})
.catchError((e) {
ATLoadingManager.veilRoutine();
});
}
///投入宝箱金币
void _familyBoxContribute() {
GroupRepository()
.familyBoxContribute(familyBaseInfo?.familyId ?? "")
.then((result) {
ATTts.show(ATAppLocalizations.of(context)!.operationSuccessful);
loadFamilyInfo();
})
.catchError((_) {});
}
///家族用户排行榜
void loadFamilyLeaderboard() {
GroupRepository()
.familyMemberTop10(familyBaseInfo?.familyId ?? "")
.then((result) {
supporterWeekRank = result.supporterWeekRank ?? [];
hostWeekRank = result.hostWeekRank ?? [];
setState(() {});
})
.catchError((_) {});
}
Widget _buildRankUserName(int rank) {
if (rank == 1) {
return PositionedDirectional(
bottom: 2.w,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_currentRankTabIndex == 0
? (supporterWeekRank.isNotEmpty
? Container(
alignment: AlignmentDirectional.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,
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: AlignmentDirectional.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,
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(
_currentRankTabIndex == 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: [
_currentRankTabIndex == 0
? (supporterWeekRank.length > 1
? Container(
constraints: BoxConstraints(
maxWidth: 70.w,
maxHeight: 18.w,
),
child:
(supporterWeekRank[1].nickname?.length ?? 0) > 6
? Marquee(
text: supporterWeekRank[1].nickname ?? "",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xff4073C4),
fontWeight: FontWeight.w600,
decoration: TextDecoration.none,
),
scrollAxis: Axis.horizontal,
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: 12.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,
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(
_currentRankTabIndex == 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: [
_currentRankTabIndex == 0
? (supporterWeekRank.length > 2
? Container(
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,
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(
alignment: Alignment.center,
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,
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(
_currentRankTabIndex == 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();
}
Widget _buildRankUserAvatar(int rank) {
if (rank == 1) {
return PositionedDirectional(
top: 21.w,
child:
_currentRankTabIndex == 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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
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:
_currentRankTabIndex == 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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
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:
_currentRankTabIndex == 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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
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: () {
if (AccountStorage()
.getCurrentUser()
?.userProfile
?.familyId ==
familyBaseInfo?.familyId) {
ATNavigatorUtils.push(
context,
"${MainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == hostWeekRank[2].userId}&tageId=${hostWeekRank[2].userId}",
);
}
},
)
: Container()),
);
}
return Container();
}
void _showLeavFamilyOpt(ct) {
SmartDialog.showAttach(
tag: "showLeavFamilyOpt",
targetContext: ct,
alignment: Alignment.bottomCenter,
animationType: SmartAnimationType.fade,
scalePointBuilder: (selfSize) => Offset(selfSize.width, 10),
builder: (_) {
return ATDebounceWidget(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 5.w),
margin: EdgeInsetsDirectional.only(end: 5.w),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: Colors.grey, width: 0.5.w),
),
child: text(
ATAppLocalizations.of(context)!.leavingTheFamily,
fontWeight: FontWeight.w600,
textColor: Colors.white,
fontSize: 15.sp,
),
),
onTap: () {
SmartDialog.dismiss(tag: "showLeavFamilyOpt");
SmartDialog.show(
tag: "showConfirmDialog",
alignment: Alignment.center,
debounce: true,
animationType: SmartAnimationType.fade,
builder: (_) {
return MsgDialog(
title: ATAppLocalizations.of(context)!.tips,
msg: ATAppLocalizations.of(context)!.leavFamilyTips,
isDark: true,
leftConfirm: true,
btnText: ATAppLocalizations.of(context)!.keep,
onEnsure: () {
ATLoadingManager.exhibitOperation();
GroupRepository()
.familyUserExit()
.then((res) {
ATTts.show(
ATAppLocalizations.of(context)!.operationSuccessful,
);
Provider.of<ChatVibeUserProfileManager>(
context,
listen: false,
).updateFamily(null);
ATLoadingManager.veilRoutine();
ATNavigatorUtils.goBack(context);
})
.catchError((_) {
ATLoadingManager.veilRoutine();
});
},
);
},
);
},
);
},
);
}
}