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/cupertino.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/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({Key? key, required this.isMe, required this.tageId}) : super(key: key); @override _PersonDetailPageState 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; @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) { setState(() { _opacity = newOpacity; }); } } }); 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) { 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) { final isSelected = _tabController.index == index; return Tab(text: text); } @override Widget build(BuildContext context) { _tabs.clear(); // _tabs.add(_buildTab(0, ATAppLocalizations.of(context)!.dynamicT)); _tabs.add(_buildTab(0, ATAppLocalizations.of(context)!.aboutMe)); _tabs.add(_buildTab(1, ATAppLocalizations.of(context)!.giftwall)); _tabs.add(_buildTab(3, ATAppLocalizations.of(context)!.relationShip)); return Consumer( builder: (context, ref, child) { List backgroundPhotos = []; backgroundPhotos = (ref.userProfile?.backgroundPhotos ?? []) .where((t) => t.status == 1) .toList(); return Directionality( textDirection: window.locale.languageCode == "ar" ? TextDirection.rtl : TextDirection.ltr, child: SafeArea( top: false, child: Stack( children: [ // Container( // width: ScreenUtil().screenWidth, // height: ScreenUtil().screenHeight, // color: Color(0xffFDF7E5), // ), backgroundPhotos.isNotEmpty ? (isBlacklistLoading || isBlacklist ? Container() : Column( children: [ SizedBox( height: 300.w, child: CarouselSlider( options: CarouselOptions( height: 300.w, autoPlay: backgroundPhotos.length > 1, // 启用自动播放 enlargeCenterPage: false, // 居中放大当前页面 aspectRatio: 1 / 1, // 宽高比 enableInfiniteScroll: true, // 启用无限循环 autoPlayAnimationDuration: Duration( milliseconds: 800, ), // 自动播放动画时长 viewportFraction: 1, // 视口分数 onPageChanged: (index, reason) { setState(() {}); }, ), items: backgroundPhotos.map((item) { return GestureDetector( child: netImage( url: item.url ?? "", width: ScreenUtil().screenWidth, height: 300.w, fit: BoxFit.cover, ), onTap: () {}, ); }).toList(), ), ), Transform.translate( offset: Offset(0, -6.w), child: Container( decoration: BoxDecoration( color: Color(0xffFDF7E5), borderRadius: BorderRadius.only( topLeft: Radius.circular(8.w), topRight: Radius.circular(8.w), ), ), width: ScreenUtil().screenWidth, height: ScreenUtil().screenHeight, ), ), ], )) : Column( children: [ SizedBox( height: 300.w, child: Image.asset( 'atu_images/person/at_icon_my_head_bg_defalt.png', width: ScreenUtil().screenWidth, height: 300.w, fit: BoxFit.cover, ), ), Transform.translate( offset: Offset(0, -6.w), child: Container( decoration: BoxDecoration( color: Color(0xffFDF7E5), borderRadius: BorderRadius.only( topLeft: Radius.circular(8.w), topRight: Radius.circular(8.w), ), ), width: ScreenUtil().screenWidth, height: ScreenUtil().screenHeight, ), ), ], ), Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.transparent, appBar: ChatVibeStandardAppBar( backButtonColor: Colors.white, title: "", leading: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.pop(context); }, child: Container( width: width(50), height: height(30), alignment: AlignmentDirectional.centerStart, padding: EdgeInsetsDirectional.only(start: width(15)), child: Icon( window.locale.languageCode == "ar" ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left, size: 28.w, color: Colors.white, ), ), ), actions: [ // 在AppBar中显示头像和昵称 if (_opacity > 0.5) ...[ SizedBox(width: 45.w), head( url: ref.userProfile?.userAvatar ?? "", width: 50.w, height: 50.w, headdress: ref.userProfile?.getHeaddress()?.sourceUrl, ), SizedBox(width: 8.w), chatvibeNickNameText( maxWidth: 135.w, ref.userProfile?.userNickname ?? "", fontSize: 16.sp, textColor: Color(0xFF333333), fontWeight: FontWeight.w600, type: ref.userProfile?.getVIP()?.name ?? "", needScroll: (ref .userProfile ?.userNickname ?.characters .length ?? 0) > 13, ), SizedBox(width: 8.w), ], Spacer(), 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: 22.w, color: Colors.white, ), onPressed: () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, MainRoute.edit, replace: false, ); 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: Offset(0, -10), child: buildOptUserMenu(context, ref), ), onTap: () { SmartDialog.dismiss( tag: "showUserInfoOptMenu", ); }, ); }, ); }, ); }, ), ], ), body: isBlacklistLoading || isBlacklist ? Container() : ExtendedNestedScrollView( controller: _scrollController, onlyOneScrollInBody: true, headerSliverBuilder: ( BuildContext context, bool innerBoxIsScrolled, ) { return [ SliverToBoxAdapter( child: Container( color: Colors.transparent, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 210.w), // 给AppBar留出空间 Column( children: [ Row( children: [ SizedBox(width: 15.w), (ref .userProfile ?.cpList ?.isNotEmpty ?? false) ? SizedBox( height: 100.w, child: Stack( alignment: Alignment.center, children: [ Row( mainAxisSize: MainAxisSize .min, crossAxisAlignment: CrossAxisAlignment .center, children: [ GestureDetector( child: head( url: ref .userProfile ?.cpList ?.first .meUserAvatar ?? "", width: 88.w, headdress: ref.userProfile ?.getHeaddress() ?.sourceUrl, ), onTap: () { String encodedUrls = Uri.encodeComponent( jsonEncode([ ref .userProfile ?.cpList ?.first .meUserAvatar, ]), ); ATNavigatorUtils.push( context, "${MainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, ), SizedBox( width: 25.w, ), 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: 88.w, ), ), ], ), IgnorePointer( child: netImage( url: ref .userProfile ?.cpList ?.first .selfRing ?.sourceUrl ?? "", height: 75.w, width: 75.w, noDefaultImg: false, ), ), ], ), ) : GestureDetector( child: head( url: ref .userProfile ?.userAvatar ?? "", width: 88.w, headdress: ref.userProfile ?.getHeaddress() ?.sourceUrl, ), onTap: () { String encodedUrls = Uri.encodeComponent( jsonEncode([ ref .userProfile ?.userAvatar, ]), ); ATNavigatorUtils.push( context, "${MainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, ), ], ), SizedBox(height: 8.w), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ SizedBox(width: 12.w), chatvibeNickNameText( maxWidth: 135.w, ref .userProfile ?.userNickname ?? "", fontSize: 18.sp, textColor: Color( 0xFF333333, ), fontWeight: FontWeight.w600, type: ref.userProfile ?.getVIP() ?.name ?? "", needScroll: (ref .userProfile ?.userNickname ?.characters .length ?? 0) > 13, ), SizedBox(width: 3.w), getVIPBadge( ref.userProfile ?.getVIP() ?.name, width: 65.w, height: 28.w, ), SizedBox(width: 3.w), Container( width: (ref.userProfile?.age ?? 0) > 999 ? 56.w : 46.w, height: 23.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( crossAxisAlignment: CrossAxisAlignment .center, mainAxisAlignment: MainAxisAlignment .center, children: [ xb( ref .userProfile ?.userSex, ), text( "${ref.userProfile?.age ?? 0}", textColor: Colors.white, fontSize: 13.sp, fontWeight: FontWeight.w600, ), SizedBox(width: 3.w), ], ), ), ], ), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ SizedBox(width: 12.w), Row( children: [ Row( children: [ getIdIcon( ref .userProfile ?.wealthLevel ?? 0, width: 32.w, height: 32.w, fontSize: 16.sp, fontWeight: FontWeight .w600, textColor: Color( 0xFF333333, ), ), chatvibeNickNameText( maxWidth: 135.w, ref.userProfile ?.getID() ?? "", textColor: Color( 0xFF333333, ), fontSize: 16.sp, fontWeight: FontWeight .w600, type: ref.userProfile ?.getVIP() ?.name ?? "", needScroll: (ref.userProfile ?.getID() .characters .length ?? 0) > 13, ), ], ), ], ), SizedBox(width: 3.w), getWealthLevel( ref .userProfile ?.wealthLevel ?? 0, width: 58.w, height: 30.w, ), SizedBox(width: 3.w), getUserLevel( ref .userProfile ?.charmLevel ?? 0, width: 58.w, height: 30.w, ), SizedBox(width: 5.w), ], ), ), ], ), ref.userProfile?.wearHonor?.where(( item, ) { return item.use ?? false; }).isNotEmpty ?? false ? Row( children: [ SizedBox(width: 15.w), Expanded( child: Wrap( runSpacing: 2.w, spacing: 4.w, direction: Axis.horizontal, children: ref .userProfile! .wearHonor! .where((item) { return item .use ?? false; }) .map((item) { return netImage( url: item.animationUrl ?? "", height: 28.w, ); }) .toList(), ), ), SizedBox(width: 5.w), ], ) : Container(), (ref.userProfile?.wearHonor?.where(( item, ) { return item.use ?? false; }).isNotEmpty ?? false) ? SizedBox(height: 5.w) : Container(), Container( margin: EdgeInsetsDirectional.symmetric( horizontal: 10.w, ), alignment: AlignmentDirectional .centerStart, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( mainAxisSize: MainAxisSize.min, children: [ SizedBox(width: 5.w), ref.userProfile?.wearBadge ?.where((item) { return item .use ?? false; }) .isNotEmpty ?? false ? SizedBox( height: 35.w, child: ListView.separated( scrollDirection: Axis.horizontal, shrinkWrap: true, itemCount: ref .userProfile ?.wearBadge ?.where(( item, ) { return item .use ?? false; }) .length ?? 0, itemBuilder: ( context, index, ) { return netImage( width: 35.w, height: 35.w, url: ref .userProfile ?.wearBadge ?.where(( item, ) { return item.use ?? false; }) .toList()[index] .selectUrl ?? "", ); }, separatorBuilder: ( BuildContext context, int index, ) { return SizedBox( width: 5.w, ); }, ), ) : Container(), SizedBox(width: 5.w), ], ), ), ), SizedBox(height: 5.w), Consumer< ChatVibeUserProfileManager >( builder: (context, ref, child) { return Container( height: 72.w, alignment: AlignmentDirectional .center, width: ScreenUtil().screenWidth, margin: EdgeInsets.symmetric( horizontal: 18.w, ), padding: EdgeInsets.symmetric( horizontal: 35.w, ), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment .spaceBetween, children: [ GestureDetector( child: Column( mainAxisAlignment: MainAxisAlignment .center, children: [ text( "${counterMap["INTERVIEW"]?.quantity ?? 0}", fontSize: 17.sp, textColor: Colors.black, fontWeight: FontWeight .bold, ), text( ATAppLocalizations.of( context, )!.vistors, fontSize: 14.sp, textColor: Color( 0xffB1B1B1, ), ), ], ), onTap: () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.vistors}?removePreviousPersonDetail=true", ); } }, ), Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [ Color( 0xff333333, ).withOpacity( 0.0, ), Color(0xff333333), Color( 0xff333333, ).withOpacity( 0.0, ), ], begin: Alignment .topCenter, end: Alignment .bottomCenter, ), ), height: 25.w, width: 1.w, ), GestureDetector( onTap: () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.follow}?removePreviousPersonDetail=true", ); } }, child: Column( mainAxisAlignment: MainAxisAlignment .center, children: [ text( "${counterMap["SUBSCRIPTION"]?.quantity ?? 0}", fontSize: 17.sp, textColor: Colors.black, fontWeight: FontWeight .bold, ), text( ATAppLocalizations.of( context, )!.follow, fontSize: 14.sp, textColor: Color( 0xffB1B1B1, ), ), ], ), ), Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [ Color( 0xff333333, ).withOpacity( 0.0, ), Color(0xff333333), Color( 0xff333333, ).withOpacity( 0.0, ), ], begin: Alignment .topCenter, end: Alignment .bottomCenter, ), ), height: 25.w, width: 1.w, ), GestureDetector( child: Column( mainAxisAlignment: MainAxisAlignment .center, children: [ text( "${counterMap["FANS"]?.quantity ?? 0}", fontSize: 17.sp, textColor: Colors.black, fontWeight: FontWeight .bold, ), text( ATAppLocalizations.of( context, )!.fans, fontSize: 14.sp, textColor: Color( 0xffB1B1B1, ), ), ], ), onTap: () { if (widget.isMe == "true") { ATNavigatorUtils.push( context, "${MainRoute.fans}?removePreviousPersonDetail=true", ); } }, ), ], ), ); }, ), SizedBox(height: 6.w), ], ), ], ), ), ), ]; }, body: Container( padding: EdgeInsets.symmetric(horizontal: 3.w), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.w), topRight: Radius.circular(8.w), ), gradient: ref.userProfile?.userSex == 0 ? LinearGradient( colors: [ Color(0xFFFDF7E5), Color(0xFFFDF7E5), ], begin: AlignmentDirectional.topStart, end: AlignmentDirectional.bottomEnd, ) : LinearGradient( colors: [ Color(0xFFFDF7E5), Color(0xFFFDF7E5), ], begin: AlignmentDirectional.topStart, end: AlignmentDirectional.bottomEnd, ), ), child: Column( children: [ Row( children: [ SizedBox(width: 6.w), SizedBox( height: 35.w, child: TabBar( tabAlignment: TabAlignment.start, indicator: ATFixedWidthTabIndicator( width: 20.w, height: 4.w, gradient: ref.userProfile?.userSex == 0 ? LinearGradient( colors: [ Color(0xffFFD800), Color(0xffFF9500), ], ) : LinearGradient( colors: [ Color(0xffFFD800), Color(0xffFF9500), ], ), ), labelPadding: EdgeInsets.symmetric( horizontal: 12.w, ), labelColor: Colors.black, isScrollable: true, unselectedLabelColor: Color( 0xffB1B1B1, ), labelStyle: TextStyle( fontSize: 15.sp, fontWeight: FontWeight.bold, ), unselectedLabelStyle: TextStyle( fontSize: 13.sp, ), indicatorColor: Colors.transparent, dividerColor: Colors.transparent, controller: _tabController, tabs: _tabs, ), ), SizedBox(width: 6.w), ], ), Expanded( child: TabBarView( controller: _tabController, children: _pages, ), ), SizedBox(height: 75.w), ], ), ), ), ), // 底部按钮区域 isBlacklistLoading || isBlacklist ? Container() : Positioned( bottom: 0, left: 0, right: 0, child: widget.isMe == "true" ? Container() : (isLoading ? Container() : Container( alignment: AlignmentDirectional.center, width: ScreenUtil().screenWidth, height: 75.w, color: Color(0xffFDF7E5), child: Column( children: [ Container( height: 0.5.w, color: Colors.black12, ), SizedBox(height: 10.w), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ ATDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: SizedBox( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "atu_images/person/at_icon_person_in_room.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( ATAppLocalizations.of( context, )!.inRoom, textColor: Color( 0xff5C2C00, ), fontWeight: FontWeight.w600, fontSize: 14.sp, ), ), ], ), ), onTap: () { if ((ref .userProfile ?.inRoomId ?? "") .isNotEmpty) { ATRoomUtils.goRoom( ref.userProfile?.inRoomId ?? "", context, ); } }, ), SizedBox(width: 10.w), ATDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: Container( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "atu_images/person/at_icon_person_tochat.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( ATAppLocalizations.of( context, )!.message, textColor: Color( 0xff5C2C00, ), fontWeight: FontWeight.w600, fontSize: 14.sp, ), ), ], ), ), onTap: () async { var conversation = V2TimConversation( type: ConversationType .V2TIM_C2C, userID: widget.tageId, conversationID: '', ); var bool = await Provider.of< RtmProvider >( context, listen: false, ).startConversation( conversation, ); if (!bool) return; var json = jsonEncode( conversation.toJson(), ); ATNavigatorUtils.push( context, "${ATChatRouter.chat}?conversation=${Uri.encodeComponent(json)}", ); }, ), SizedBox(width: 10.w), ATDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: Container( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "atu_images/person/at_icon_person_follow.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( isFollow ? ATAppLocalizations.of( context, )!.following : ATAppLocalizations.of( context, )!.follow, textColor: Color( 0xff5C2C00, ), fontWeight: FontWeight.w600, fontSize: 14.sp, ), ), ], ), ), onTap: () { AccountRepository() .followUser(widget.tageId) .then((v) { isFollow = !isFollow; setState(() {}); }); }, ), ], ), ], ), )), ), ], ), ), ); }, ); } 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) { SmartDialog.dismiss(tag: "showPartWaysDialog"); ATTts.show( ATAppLocalizations.of( context, )!.operationSuccessful, ); ATLoadingManager.veilRoutine(); ATNavigatorUtils.popUntil( context, ModalRoute.withName(ATRoutes.home), ); }) .catchError((e) { ATLoadingManager.veilRoutine(); }); }, ), ], ), ], ), ); }, ); } }