import 'dart:convert'; import 'dart:ui'; import 'package:aslan/chatvibe_features/user/profile/relation/relation_ship_page.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:aslan/chatvibe_features/user/profile/props/giftwall_page.dart'; import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart'; import 'package:aslan/chatvibe_ui/components/text/at_text.dart'; import 'package:aslan/chatvibe_core/utilities/at_room_utils.dart'; import 'package:aslan/chatvibe_core/utilities/at_user_utils.dart'; import 'package:aslan/chatvibe_features/index/main_route.dart'; import 'package:aslan/chatvibe_features/user/profile/profile/profile_page.dart'; import 'package:marquee/marquee.dart'; import 'package:provider/provider.dart'; import 'package:tencent_cloud_chat_sdk/enum/conversation_type.dart'; import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart'; import 'package:aslan/app_localizations.dart'; import 'package:aslan/chatvibe_ui/components/appbar/chatvibe_appbar.dart'; import 'package:aslan/chatvibe_ui/components/dialog/dialog_base.dart'; import 'package:aslan/chatvibe_ui/components/at_compontent.dart'; import 'package:aslan/chatvibe_ui/components/at_tts.dart'; import 'package:aslan/chatvibe_core/routes/at_routes.dart'; import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart'; import 'package:aslan/chatvibe_core/utilities/at_loading_manager.dart'; import 'package:aslan/chatvibe_data/sources/local/user_manager.dart'; import 'package:aslan/chatvibe_data/sources/repositories/user_repository_impl.dart'; import 'package:aslan/chatvibe_domain/models/res/login_res.dart'; import 'package:aslan/chatvibe_managers/rtm_manager.dart'; import 'package:aslan/chatvibe_managers/app_general_manager.dart'; import 'package:aslan/chatvibe_managers/user_profile_manager.dart'; import 'package:aslan/chatvibe_features/chat/at_chat_route.dart'; import '../../../chatvibe_core/constants/at_screen.dart'; import '../../../chatvibe_domain/models/res/at_user_counter_res.dart'; import '../../../chatvibe_domain/models/res/at_user_identity_res.dart'; import '../../../chatvibe_domain/usecases/at_fixed_width_tabIndicator.dart'; class PersonDetailPage extends StatefulWidget { final String isMe; final String tageId; const PersonDetailPage({super.key, required this.isMe, required this.tageId}); @override State createState() => _PersonDetailPageState(); } class _PersonDetailPageState extends State with SingleTickerProviderStateMixin { late TabController _tabController; final List _pages = []; final List _tabs = []; ATUserIdentityRes? userIdentity; bool isFollow = false; bool isLoading = true; bool isBlacklistLoading = true; bool isBlacklist = false; Map counterMap = {}; // 添加滚动控制器 final ScrollController _scrollController = ScrollController(); double _opacity = 0.0; double _scrollOffset = 0.0; @override void initState() { super.initState(); // _pages.add(PersonDynamicListPage(false, widget.tageId)); _pages.add(ProfilePage(false, widget.tageId)); _pages.add(GiftwallPage(widget.tageId)); _pages.add(RelationShipPage(false, widget.tageId)); _tabController = TabController( initialIndex: 0, length: _pages.length, vsync: this, ); _tabController.addListener(() { setState(() {}); // 刷新UI }); // 监听切换 // 监听滚动 _scrollController.addListener(() { if (_scrollController.hasClients) { final offset = _scrollController.offset; // 当滚动到一定位置时,头像和昵称应该完全显示在AppBar上 // 这里计算透明度,可以根据需要调整 final newOpacity = (offset / 320).clamp(0.0, 1.0); if (newOpacity != _opacity || offset != _scrollOffset) { setState(() { _opacity = newOpacity; _scrollOffset = offset; }); } } }); Provider.of(context, listen: false) .userProfile = null; Provider.of( context, listen: false, ).getUserInfoById(widget.tageId); AccountRepository().userIdentity(userId: widget.tageId).then((v) { userIdentity = v; setState(() {}); }); if (widget.isMe != "true") { AccountRepository() .followCheck(widget.tageId) .then((v) { isFollow = v; isLoading = false; setState(() {}); }) .catchError((e) { setState(() { isLoading = false; }); }); AccountRepository() .blacklistCheck(widget.tageId) .then((v) { if (!mounted) return; isBlacklist = v; isBlacklistLoading = false; setState(() {}); if (isBlacklist) { ATTts.show( ATAppLocalizations.of(context)!.thisUserHasBeenBlacklisted, ); } }) .catchError((e) { setState(() { isBlacklistLoading = false; }); }); } else { isBlacklist = false; isBlacklistLoading = false; } userCounter(widget.tageId); } void userCounter(String userId) async { counterMap.clear(); var userCounterList = await AccountRepository().userCounter(userId); counterMap = Map.fromEntries( userCounterList.map( (counter) => MapEntry(counter.counterType ?? "", counter), ), ); setState(() {}); } Widget _buildTab(int index, String text) { return Tab(text: text); } @override Widget build(BuildContext context) { _tabs.clear(); _tabs.add(_buildTab(0, ATAppLocalizations.of(context)!.aboutMe)); _tabs.add(_buildTab(1, ATAppLocalizations.of(context)!.giftwall)); _tabs.add(_buildTab(2, ATAppLocalizations.of(context)!.relationShip)); return Consumer( builder: (context, ref, child) { final backgroundPhotos = (ref.userProfile?.backgroundPhotos ?? []) .where((t) => t.status == 1) .toList(); final hideProfile = isBlacklistLoading || isBlacklist; return Directionality( textDirection: PlatformDispatcher.instance.locale.languageCode == "ar" ? TextDirection.rtl : TextDirection.ltr, child: SafeArea( top: false, child: Scaffold( resizeToAvoidBottomInset: false, backgroundColor: const Color(0xffFDF7E5), body: Stack( children: [ if (!hideProfile) _buildTopBackground(backgroundPhotos), if (!hideProfile) ExtendedNestedScrollView( controller: _scrollController, onlyOneScrollInBody: true, pinnedHeaderSliverHeightBuilder: () { return ScreenUtil().statusBarHeight + kToolbarHeight; }, headerSliverBuilder: (context, innerBoxIsScrolled) { return [ SliverToBoxAdapter( child: Column( children: [ SizedBox(height: 172.w), _buildProfilePanel(ref), ], ), ), ]; }, body: _buildTabContent(ref), ), _buildTopBar(ref), if (!hideProfile && widget.isMe != "true") _buildBottomActions(ref), ], ), ), ), ); }, ); } Widget _buildTopBackground(List backgroundPhotos) { return Positioned.fill( child: Stack( children: [ Column( children: [ SizedBox( height: 285.w, child: backgroundPhotos.isNotEmpty ? CarouselSlider( options: CarouselOptions( height: 285.w, autoPlay: backgroundPhotos.length > 1, enlargeCenterPage: false, aspectRatio: 1, enableInfiniteScroll: true, autoPlayAnimationDuration: const Duration( milliseconds: 800, ), viewportFraction: 1, ), items: backgroundPhotos.map((item) { return netImage( url: item.url ?? "", width: ScreenUtil().screenWidth, height: 285.w, fit: BoxFit.cover, ); }).toList(), ) : Image.asset( 'atu_images/person/at_icon_my_head_bg_defalt.png', width: ScreenUtil().screenWidth, height: 285.w, fit: BoxFit.cover, ), ), Expanded( child: Container( width: ScreenUtil().screenWidth, color: const Color(0xffFDF7E5), ), ), ], ), Positioned( top: 172.w - _scrollOffset, left: 0, right: 0, height: ScreenUtil().screenHeight + _scrollOffset + 220.w, child: _buildFrostedScrollBackground( borderRadius: BorderRadius.only( topLeft: Radius.circular(8.w), topRight: Radius.circular(8.w), ), ), ), ], ), ); } Widget _buildFrostedScrollBackground({BorderRadius? borderRadius}) { return ClipRRect( borderRadius: borderRadius ?? BorderRadius.zero, child: Stack( fit: StackFit.expand, children: [ ImageFiltered( imageFilter: ImageFilter.blur(sigmaX: 0, sigmaY: 30), child: Image.asset( 'atu_images/index/at_person_detail_bag.png', fit: BoxFit.fitWidth, alignment: Alignment.topCenter, repeat: ImageRepeat.repeatY, ), ), BackdropFilter( filter: ImageFilter.blur(sigmaX: 6, sigmaY: 6), child: Container(color: Colors.white.withValues(alpha: 0.18)), ), ], ), ); } Widget _buildTopBar(ChatVibeUserProfileManager ref) { return Positioned( left: 0, right: 0, top: 0, child: Container( decoration: BoxDecoration( image: DecorationImage( image: _buildTopBarBackgroundImage(ref), fit: BoxFit.cover, alignment: Alignment.topCenter, ), ), child: ChatVibeStandardAppBar( backButtonColor: Colors.white, title: "", titleWidget: _buildCollapsedTitle(ref), leading: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.pop(context); }, child: Row( children: [ Container( width: width(50), height: height(30), alignment: AlignmentDirectional.centerStart, padding: EdgeInsetsDirectional.only(start: width(15)), child: Icon( PlatformDispatcher.instance.locale.languageCode == "ar" ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left, size: 28.w, color: Colors.white, ), ), ], ), ), actions: [ Builder( builder: (ct) { return IconButton( icon: widget.isMe == "true" ? Image.asset( "atu_images/person/at_icon_edit_user_info2.png", width: 22.w, color: Colors.white, ) : Icon( Icons.more_horiz, size: 24.w, color: Colors.white, ), onPressed: () { if (widget.isMe == "true") { ATNavigatorUtils.push(context, MainRoute.edit); return; } SmartDialog.showAttach( tag: "showUserInfoOptMenu", targetContext: ct, alignment: Alignment.bottomCenter, maskColor: Colors.transparent, animationType: SmartAnimationType.fade, scalePointBuilder: (selfSize) => Offset(selfSize.width, 10), builder: (_) { return GestureDetector( child: Transform.translate( offset: const Offset(0, -10), child: buildOptUserMenu(context, ref), ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); }, ); }, ); }, ); }, ), SizedBox(width: 8.w), ], ), ), ); } ImageProvider _buildTopBarBackgroundImage(ChatVibeUserProfileManager ref) { final backgroundPhoto = (ref.userProfile?.backgroundPhotos ?? []) .where( (item) => item.status == 1 && (item.url?.isNotEmpty ?? false), ) .firstOrNull; if (backgroundPhoto?.url?.isNotEmpty ?? false) { return NetworkImage(backgroundPhoto!.url!); } return const AssetImage('atu_images/person/at_icon_my_head_bg_defalt.png'); } Widget _buildCollapsedTitle(ChatVibeUserProfileManager ref) { if (_opacity <= 0.55) { return const SizedBox.shrink(); } return Row( mainAxisSize: MainAxisSize.min, children: [ head( url: ref.userProfile?.userAvatar ?? "", width: 38.w, height: 38.w, headdress: ref.userProfile?.getHeaddress()?.sourceUrl, ), SizedBox(width: 8.w), chatvibeNickNameText( maxWidth: 145.w, ref.userProfile?.userNickname ?? "", fontSize: 15.sp, textColor: Colors.white, fontWeight: FontWeight.w600, type: ref.userProfile?.getVIP()?.name ?? "", needScroll: (ref.userProfile?.userNickname?.characters.length ?? 0) > 13, ), ], ); } Widget _buildProfilePanel(ChatVibeUserProfileManager ref) { return Container( width: ScreenUtil().screenWidth, padding: EdgeInsets.fromLTRB(10.w, 10.w, 10.w, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _buildUserHeader(ref), SizedBox(height: 10.w), _buildHonorRow(ref), SizedBox(height: 10.w), _buildCountryAndBadgeRow(ref), SizedBox(height: 10.w), _buildStats(ref), ], ), ); } Widget _buildUserHeader(ChatVibeUserProfileManager ref) { return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ _buildAvatar(ref), SizedBox(width: 10.w), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Row( children: [ Flexible( child: chatvibeNickNameText( maxWidth: 155.w, ref.userProfile?.userNickname ?? "", fontSize: 18.sp, textColor: const Color(0xFFB044FF), fontWeight: FontWeight.w700, type: ref.userProfile?.getVIP()?.name ?? "", needScroll: (ref.userProfile?.userNickname?.characters.length ?? 0) > 13, ), ), SizedBox(width: 6.w), getVIPBadge( ref.userProfile?.getVIP()?.name, width: 65.w, height: 28.w, ), ], ), SizedBox(height: 4.w), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ getIdIcon( ref.userProfile?.wealthLevel ?? 0, width: 24.w, height: 24.w, fontSize: 12.sp, fontWeight: FontWeight.w600, textColor: const Color(0xFF333333), ), chatvibeNickNameText( maxWidth: 92.w, ref.userProfile?.getID() ?? "", textColor: const Color(0xFF8F2DFF), fontSize: 15.sp, fontWeight: FontWeight.w700, type: ref.userProfile?.getVIP()?.name ?? "", needScroll: (ref.userProfile?.getID().characters.length ?? 0) > 10, ), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Clipboard.setData( ClipboardData(text: ref.userProfile?.getID() ?? ""), ); ATTts.show( ATAppLocalizations.of(context)!.copiedToClipboard, ); }, child: Padding( padding: EdgeInsets.all(2.w), child: Image.asset( "atu_images/index/at_icon_user_card_copy_id.png", width: 14.w, height: 14.w, ), ), ), SizedBox(width: 4.w), _buildAgeTag(ref), SizedBox(width: 4.w), getWealthLevel( ref.userProfile?.wealthLevel ?? 0, width: 50.w, height: 26.w, ), SizedBox(width: 4.w), getUserLevel( ref.userProfile?.charmLevel ?? 0, width: 50.w, height: 26.w, ), ], ), ), ], ), ), ], ); } Widget _buildAvatar(ChatVibeUserProfileManager ref) { if (ref.userProfile?.cpList?.isNotEmpty ?? false) { return SizedBox( width: 112.w, height: 72.w, child: Stack( alignment: Alignment.center, children: [ PositionedDirectional( start: 0, child: GestureDetector( onTap: () { final encodedUrls = Uri.encodeComponent( jsonEncode([ref.userProfile?.cpList?.first.meUserAvatar]), ); ATNavigatorUtils.push( context, "${MainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, child: head( url: ref.userProfile?.cpList?.first.meUserAvatar ?? "", width: 72.w, headdress: ref.userProfile?.getHeaddress()?.sourceUrl, ), ), ), PositionedDirectional( end: 0, child: GestureDetector( onTap: () { ATNavigatorUtils.push( context, replace: true, "${MainRoute.person}?isMe=${UserManager().getCurrentUser()?.userProfile?.id == ref.userProfile?.cpList?.first.cpUserId}&tageId=${ref.userProfile?.cpList?.first.cpUserId}", ); }, child: head( url: ref.userProfile?.cpList?.first.cpUserAvatar ?? "", headdress: ref.userProfile?.cpList?.first.cpUserAvatarFrame, width: 72.w, ), ), ), IgnorePointer( child: netImage( url: ref.userProfile?.cpList?.first.selfRing?.sourceUrl ?? "", height: 58.w, width: 58.w, noDefaultImg: false, ), ), ], ), ); } return GestureDetector( child: head( url: ref.userProfile?.userAvatar ?? "", width: 72.w, height: 72.w, headdress: ref.userProfile?.getHeaddress()?.sourceUrl, ), onTap: () { final encodedUrls = Uri.encodeComponent( jsonEncode([ref.userProfile?.userAvatar]), ); ATNavigatorUtils.push( context, "${MainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, ); } Widget _buildAgeTag(ChatVibeUserProfileManager ref) { return Container( width: (ref.userProfile?.age ?? 0) > 999 ? 52.w : 42.w, height: 22.w, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( ref.userProfile?.userSex == 0 ? "atu_images/login/at_icon_sex_woman_bg.png" : "atu_images/login/at_icon_sex_man_bg.png", ), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ xb(ref.userProfile?.userSex), text( "${ref.userProfile?.age ?? 0}", textColor: Colors.white, fontSize: 12.sp, fontWeight: FontWeight.w600, ), SizedBox(width: 2.w), ], ), ); } Widget _buildHonorRow(ChatVibeUserProfileManager ref) { final honors = (ref.userProfile?.wearHonor ?? []).where( (item) => item.use ?? false, ); if (honors.isEmpty) { return const SizedBox.shrink(); } return SizedBox( height: 24.w, child: ListView.separated( scrollDirection: Axis.horizontal, itemCount: honors.length, itemBuilder: (context, index) { final item = honors.toList()[index]; return netImage(url: item.animationUrl ?? "", height: 24.w); }, separatorBuilder: (_, __) => SizedBox(width: 4.w), ), ); } Widget _buildCountryAndBadgeRow(ChatVibeUserProfileManager ref) { final badges = (ref.userProfile?.wearBadge ?? []) .where((item) => item.use ?? false) .toList(); final flagUrl = Provider.of( context, listen: false, ).getCountryByName(ref.userProfile?.countryName ?? "")?.nationalFlag ?? ""; return SizedBox( height: 24.w, child: ListView( scrollDirection: Axis.horizontal, children: badges.map( (item) => Padding( padding: EdgeInsetsDirectional.only(end: 4.w), child: netImage( width: 24.w, height: 24.w, url: item.selectUrl ?? "", ), ), ).toList(), ), ); } Widget _buildRoundFlag(String flagUrl) { return Container( width: 24.w, height: 24.w, padding: EdgeInsets.all(5.w), decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.white.withValues(alpha: 0.7), border: Border.all(color: Colors.white, width: 1.w), ), child: netImage( url: flagUrl, width: 14.w, height: 14.w, borderRadius: BorderRadius.circular(7.w), ), ); } Widget _buildStats(ChatVibeUserProfileManager ref) { return Container( height: 60.w, alignment: AlignmentDirectional.center, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ _buildStatItem( "${counterMap["INTERVIEW"]?.quantity ?? 0}", ATAppLocalizations.of(context)!.vistors, () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.vistors}?removePreviousPersonDetail=true", ); } }, ), _buildDivider(), _buildStatItem( "${counterMap["SUBSCRIPTION"]?.quantity ?? 0}", ATAppLocalizations.of(context)!.follow, () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.follow}?removePreviousPersonDetail=true", ); } }, ), _buildDivider(), _buildStatItem( "${counterMap["FANS"]?.quantity ?? 0}", ATAppLocalizations.of(context)!.fans, () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.fans}?removePreviousPersonDetail=true", ); } }, ), ], ), ); } Widget _buildStatItem(String value, String label, VoidCallback onTap) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: onTap, child: SizedBox( width: 96.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ text( value, fontSize: 17.sp, textColor: const Color(0xff333333), fontWeight: FontWeight.bold, ), SizedBox(height: 2.w), text(label, fontSize: 13.sp, textColor: const Color(0xffB1B1B1)), ], ), ), ); } Widget _buildDivider() { return Container( width: 1.w, height: 18.w, color: const Color(0xff333333).withValues(alpha: 0.35), ); } Widget _buildTabContent(ChatVibeUserProfileManager ref) { return Container( padding: EdgeInsets.symmetric(horizontal: 3.w), color: Colors.transparent, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 35.w, child: TabBar( tabAlignment: TabAlignment.start, indicator: ATFixedWidthTabIndicator( width: 12.w, height: 3.w, gradient: const LinearGradient( colors: [Color(0xffFFD800), Color(0xffFF9500)], ), ), labelPadding: EdgeInsets.symmetric(horizontal: 12.w), labelColor: const Color(0xff333333), isScrollable: true, unselectedLabelColor: const Color(0xffB1B1B1), labelStyle: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.bold, ), unselectedLabelStyle: TextStyle(fontSize: 12.sp), indicatorColor: Colors.transparent, dividerColor: Colors.transparent, controller: _tabController, tabs: _tabs, ), ), Expanded( child: TabBarView(controller: _tabController, children: _pages), ), if (widget.isMe != "true") SizedBox(height: 86.w), ], ), ); } Widget _buildBottomActions(ChatVibeUserProfileManager ref) { if (isLoading) { return const SizedBox.shrink(); } return Positioned( bottom: 0, left: 0, right: 0, child: Container( height: 86.w, decoration: BoxDecoration( color: const Color(0xffFDF7E5), border: Border(top: BorderSide(color: Colors.black12, width: 0.5.w)), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _buildBottomAction( icon: "atu_images/person/at_icon_person_in_room.png", label: ATAppLocalizations.of(context)!.inRoom, onTap: () { if ((ref.userProfile?.inRoomId ?? "").isNotEmpty) { ATRoomUtils.goRoom(ref.userProfile?.inRoomId ?? "", context); } }, ), _buildBottomAction( icon: "atu_images/person/at_icon_person_tochat.png", label: ATAppLocalizations.of(context)!.message, onTap: () async { var conversation = V2TimConversation( type: ConversationType.V2TIM_C2C, userID: widget.tageId, conversationID: '', ); var ok = await Provider.of( context, listen: false, ).startConversation(conversation); if (!ok || !mounted) return; var json = jsonEncode(conversation.toJson()); ATNavigatorUtils.push( context, "${ATChatRouter.chat}?conversation=${Uri.encodeComponent(json)}", ); }, ), _buildBottomAction( icon: "atu_images/person/at_icon_person_follow.png", label: isFollow ? ATAppLocalizations.of(context)!.following : ATAppLocalizations.of(context)!.follow, onTap: () { AccountRepository().followUser(widget.tageId).then((v) { isFollow = !isFollow; setState(() {}); }); }, ), ], ), ), ); } Widget _buildBottomAction({ required String icon, required String label, required VoidCallback onTap, }) { return ATDebounceWidget( debounceTime: const Duration(milliseconds: 800), onTap: onTap, child: SizedBox( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset(icon, width: 25.w, height: 25.w), SizedBox(height: 6.w), text( label, textColor: const Color(0xff5C2C00), fontWeight: FontWeight.w700, fontSize: 12.sp, ), ], ), ), ); } Container buildOptUserMenu( BuildContext context, ChatVibeUserProfileManager ref, ) { return Container( width: 163.w, margin: EdgeInsetsDirectional.only(end: 8.w), decoration: BoxDecoration( color: Colors.white30, borderRadius: BorderRadius.circular(4), ), padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 5.w), child: Column( mainAxisSize: MainAxisSize.min, children: [ ATDebounceWidget( child: Container( padding: EdgeInsets.symmetric(horizontal: 10.w), child: text( ATAppLocalizations.of(context)!.report, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); ATNavigatorUtils.push( context, "${MainRoute.report}?type=user&tageId=${ref.userProfile?.id}", replace: false, ); }, ), ((!(userIdentity?.admin ?? false) && !(userIdentity?.superAdmin ?? false)) && ((Provider.of( context, listen: false, ).userIdentity?.admin ?? false))) ? ATDebounceWidget( child: Container( margin: EdgeInsets.only(top: 5.w), child: text( ATAppLocalizations.of(context)!.userEditing, letterSpacing: 0.1, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); ATNavigatorUtils.push( context, "${MainRoute.editingUserRoomAdmin}?type=User&profile=${Uri.encodeComponent(jsonEncode(ref.userProfile?.toJson()))}", ); }, ) : Container(), ((ref.userIdentity?.admin ?? false) || (ref.userIdentity?.superFreightAgent ?? false)) && !((userIdentity?.admin ?? false) || (userIdentity?.superFreightAgent ?? false)) ? SizedBox(height: 5.w) : Container(), ((ref.userIdentity?.admin ?? false) || (ref.userIdentity?.superFreightAgent ?? false)) && !((userIdentity?.admin ?? false) || (userIdentity?.superFreightAgent ?? false)) ? GestureDetector( child: text( letterSpacing: 0.1, ATAppLocalizations.of(context)!.becomeAgent, textColor: Colors.white, fontSize: 12.sp, ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); AccountRepository().teamCreate( ref.userProfile?.getID() ?? "", ); }, ) : Container(), (ref.userIdentity?.agent ?? false) ? GestureDetector( behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only(top: 3.w), child: text( letterSpacing: 0.1, ATAppLocalizations.of(context)!.inviteToBecomeAHost, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); ATLoadingManager.exhibitOperation(); AccountRepository() .teamInviteHost(ref.userProfile?.id ?? "") .then((r) { ATLoadingManager.veilRoutine(); }) .catchError((_) { ATLoadingManager.veilRoutine(); }); }, ) : Container(), (ref.userProfile?.isCpRelation ?? false) ? GestureDetector( behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only(top: 3.w), child: text( letterSpacing: 0.1, ATAppLocalizations.of(context)!.partWays, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { SmartDialog.dismiss(tag: "showUserInfoOptMenu"); _showPartWaysDialog(ref); }, ) : Container(), isBlacklistLoading ? Container() : GestureDetector( behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only(top: 3.w), child: text( letterSpacing: 0.1, isBlacklist ? ATAppLocalizations.of(context)!.removeFromBlacklist : ATAppLocalizations.of(context)!.moveToBlacklist, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { if ((ref.userProfile?.isCpRelation ?? false)) { SmartDialog.show( tag: "showConfirmDialog", alignment: Alignment.center, debounce: true, animationType: SmartAnimationType.fade, builder: (_) { return MsgDialog( title: ATAppLocalizations.of(context)!.tips, msg: ATAppLocalizations.of( context, )!.youAreCurrentlyCPRelationshipPleaseDissolve, btnText: ATAppLocalizations.of(context)!.confirm, onEnsure: () {}, ); }, ); return; } ATAccountHelper.optBlacklist( widget.tageId, isBlacklist, context, (isOptBlacklist) { isBlacklist = isOptBlacklist; setState(() {}); }, ); }, ), ], ), ); } void _showPartWaysDialog(ChatVibeUserProfileManager ref) { SmartDialog.show( tag: "showPartWaysDialog", alignment: Alignment.center, debounce: true, animationType: SmartAnimationType.fade, builder: (_) { return Container( height: 530.w, width: ScreenUtil().screenWidth * 0.9, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "atu_images/person/at_icon_send_cp_requst_dialog_bg.png", ), fit: BoxFit.fill, ), ), child: Column( children: [ SizedBox(height: 58.w), Container( child: text( ATAppLocalizations.of(context)!.partWays, fontSize: 22.sp, textColor: Color(0xffECB45C), fontWeight: FontWeight.bold, ), ), Transform.translate( offset: Offset(0, -25), child: Stack( alignment: AlignmentDirectional.center, children: [ PositionedDirectional( top: 31.w, child: Row( mainAxisSize: MainAxisSize.min, children: [ head( url: AccountStorage() .getCurrentUser() ?.userProfile ?.userAvatar ?? "", width: 95.w, ), SizedBox(width: 14.w), head( url: ref.userProfile?.userAvatar ?? "", width: 95.w, ), ], ), ), Image.asset( "atu_images/person/at_icon_send_cp_requst_dialog_head2.png", height: 120.w, fit: BoxFit.fill, ), ], ), ), Transform.translate( offset: Offset(0, -23), child: Container( height: 25.w, width: ScreenUtil().screenWidth * 0.6, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "atu_images/person/at_icon_send_cp_requst_username_bg.png", ), fit: BoxFit.fill, ), ), child: Row( children: [ SizedBox(width: 15.w), Expanded( child: Container( alignment: Alignment.center, height: 15.w, child: (AccountStorage() .getCurrentUser() ?.userProfile ?.userNickname ?.length ?? 0) > 8 ? Marquee( text: AccountStorage() .getCurrentUser() ?.userProfile ?.userNickname ?? "", style: TextStyle( fontSize: 10.sp, color: Color(0xffECB45C), 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.linear, decelerationDuration: Duration( milliseconds: 500, ), decelerationCurve: Curves.easeOut, ) : Text( AccountStorage() .getCurrentUser() ?.userProfile ?.userNickname ?? "", maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 10.sp, color: Color(0xffECB45C), fontWeight: FontWeight.w600, decoration: TextDecoration.none, ), ), ), ), SizedBox(width: 20.w), Expanded( child: Container( alignment: Alignment.center, height: 15.w, child: (ref.userProfile?.userNickname?.length ?? 0) > 8 ? Marquee( text: ref.userProfile?.userNickname ?? "", style: TextStyle( fontSize: 10.sp, color: Color(0xffECB45C), 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.linear, decelerationDuration: Duration( milliseconds: 500, ), decelerationCurve: Curves.easeOut, ) : Text( ref.userProfile?.userNickname ?? "", maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 10.sp, color: Color(0xffECB45C), fontWeight: FontWeight.w600, decoration: TextDecoration.none, ), ), ), ), SizedBox(width: 15.w), ], ), ), ), Container( padding: EdgeInsets.only(bottom: 12.w), margin: EdgeInsets.symmetric(horizontal: 18.w), decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "atu_images/person/at_icon_send_cp_requst_dialog_content.png", ), fit: BoxFit.fill, ), ), child: Column( children: [ Container( margin: EdgeInsets.symmetric( horizontal: 35.w, ).copyWith(top: 45.w), child: text( ATAppLocalizations.of( context, )!.areYouSureYouWantToPartWaysWithYourCP, fontWeight: FontWeight.w500, textColor: Color(0xffECB45C), maxLines: 3, fontSize: 14.sp, ), ), Container( margin: EdgeInsets.symmetric(horizontal: 20.w), alignment: AlignmentDirectional.center, child: text( ATAppLocalizations.of(context)!.partWaysTips, fontSize: 10.w, textColor: Color(0xffECB45C), maxLines: 6, fontWeight: FontWeight.w500, ), ), ], ), ), SizedBox(height: 10.w), Row( mainAxisSize: MainAxisSize.min, children: [ GestureDetector( child: Container( padding: EdgeInsets.only(top: 7.w), alignment: AlignmentDirectional.center, width: 130.w, height: 48.w, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "atu_images/person/at_icon_send_cp_requst_ok_bg.png", ), fit: BoxFit.fill, ), ), child: text( ATAppLocalizations.of(context)!.cancel, fontSize: 18.sp, fontWeight: FontWeight.bold, textColor: Color(0xffECB45C), ), ), onTap: () { SmartDialog.dismiss(tag: "showPartWaysDialog"); }, ), SizedBox(width: 25.w), GestureDetector( child: Container( padding: EdgeInsets.only(top: 7.w), alignment: AlignmentDirectional.center, width: 130.w, height: 48.w, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "atu_images/person/at_icon_send_cp_requst_cancel_bg.png", ), fit: BoxFit.fill, ), ), child: text( ATAppLocalizations.of(context)!.confirm, fontSize: 18.sp, fontWeight: FontWeight.bold, textColor: Color(0xffECB45C), ), ), onTap: () { ATLoadingManager.exhibitOperation(); AccountRepository() .cpRelationshipDismissApply(ref.userProfile?.id ?? "") .then((result) { if (!mounted) return; SmartDialog.dismiss(tag: "showPartWaysDialog"); ATTts.show( ATAppLocalizations.of( context, )!.operationSuccessful, ); ATLoadingManager.veilRoutine(); ATNavigatorUtils.popUntil( context, ModalRoute.withName(ATRoutes.home), ); }) .catchError((e) { ATLoadingManager.veilRoutine(); }); }, ), ], ), ], ), ); }, ); } }