import 'dart:convert'; import 'dart:ui'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.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:yumi/modules/user/profile/profile/sc_profile_page.dart'; import 'package:yumi/modules/user/profile/props/sc_giftwall_page.dart'; import 'package:yumi/ui_kit/components/sc_debounce_widget.dart'; import 'package:yumi/ui_kit/components/text/sc_text.dart'; import 'package:yumi/shared/tools/sc_room_utils.dart'; import 'package:yumi/shared/tools/sc_user_utils.dart'; import 'package:yumi/modules/index/main_route.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:yumi/app_localizations.dart'; import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart'; import 'package:yumi/ui_kit/components/dialog/dialog_base.dart'; import 'package:yumi/ui_kit/components/sc_compontent.dart'; import 'package:yumi/ui_kit/components/sc_tts.dart'; import 'package:yumi/app/routes/sc_routes.dart'; import 'package:yumi/app/routes/sc_fluro_navigator.dart'; import 'package:yumi/shared/tools/sc_loading_manager.dart'; import 'package:yumi/shared/data_sources/sources/local/user_manager.dart'; import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart'; import 'package:yumi/shared/business_logic/models/res/login_res.dart'; import 'package:yumi/services/audio/rtm_manager.dart'; import 'package:yumi/services/auth/user_profile_manager.dart'; import 'package:yumi/ui_kit/theme/socialchat_theme.dart'; import '../../../app/constants/sc_screen.dart'; import '../../../shared/business_logic/models/res/sc_user_counter_res.dart'; import '../../../shared/business_logic/models/res/sc_user_identity_res.dart'; import '../../../shared/business_logic/usecases/sc_fixed_width_tabIndicator.dart'; import '../../chat/chat_route.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 = []; SCUserIdentityRes? 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(SCProfilePage(false, widget.tageId)); _pages.add(SCGiftwallPage(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); SCAccountRepository().userIdentity(userId: widget.tageId).then((v) { userIdentity = v; setState(() {}); }); if (widget.isMe != "true") { SCAccountRepository() .followCheck(widget.tageId) .then((v) { isFollow = v; isLoading = false; setState(() {}); }) .catchError((e) { setState(() { isLoading = false; }); }); SCAccountRepository() .blacklistCheck(widget.tageId) .then((v) { isBlacklist = v; isBlacklistLoading = false; setState(() {}); if (isBlacklist) { SCTts.show( SCAppLocalizations.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 SCAccountRepository().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, SCAppLocalizations.of(context)!.dynamicT)); _tabs.add(_buildTab(0, SCAppLocalizations.of(context)!.aboutMe)); _tabs.add(_buildTab(1, SCAppLocalizations.of(context)!.giftwall)); // _tabs.add(_buildTab(3, SCAppLocalizations.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: [ 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(0xff083b2f), 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( 'sc_images/person/sc_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(0xff083b2f), 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: SocialChatStandardAppBar( 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), socialchatNickNameText( maxWidth: 135.w, textColor: Colors.white, ref.userProfile?.userNickname ?? "", fontSize: 16.sp, 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( "sc_images/person/sc_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") { SCNavigatorUtils.push( context, SCMainRoute.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: 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: [ GestureDetector( child: text( SCAppLocalizations.of( context, )!.report, textColor: Colors.white, fontSize: 12.sp, ), onTap: () { SmartDialog.dismiss( tag: "showUserInfoOptMenu", ); SCNavigatorUtils.push( context, "${SCMainRoute.report}?type=user&tageId=${ref.userProfile?.id}", replace: false, ); }, ), ((!(userIdentity?.admin ?? false) && !(userIdentity ?.superAdmin ?? false)) && ((Provider.of< SocialChatUserProfileManager >( context, listen: false, ).userIdentity?.admin ?? false))) ? GestureDetector( child: Container( margin: EdgeInsets.only( top: 5.w, ), child: text( SCAppLocalizations.of( context, )!.userEditing, letterSpacing: 0.1, textColor: Colors.white, fontSize: 12.sp, ), ), onTap: () { SmartDialog.dismiss( tag: "showUserInfoOptMenu", ); SCNavigatorUtils.push( context, "${SCMainRoute.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, SCAppLocalizations.of( context, )!.becomeAgent, textColor: Colors.white, fontSize: 12.sp, ), onTap: () { SmartDialog.dismiss( tag: "showUserInfoOptMenu", ); SCAccountRepository() .teamCreate( ref.userProfile ?.getID() ?? "", ); }, ) : Container(), (ref.userProfile?.isCpRelation ?? false) ? GestureDetector( behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only( top: 3.w, ), child: text( letterSpacing: 0.1, SCAppLocalizations.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 ? SCAppLocalizations.of( context, )!.removeFromBlacklist : SCAppLocalizations.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: SCAppLocalizations.of( context, )!.tips, msg: SCAppLocalizations.of( context, )!.youAreCurrentlyCPRelationshipPleaseDissolve, btnText: SCAppLocalizations.of( context, )!.confirm, onEnsure: () {}, ); }, ); return; } SCAccountHelper.optBlacklist( widget.tageId, isBlacklist, context, (isOptBlacklist) { isBlacklist = isOptBlacklist; setState(() {}); }, ); }, ), ], ), ), ), 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: [ Transform.translate( offset: Offset( 0, -5, ), child: Row( mainAxisSize: MainAxisSize .min, crossAxisAlignment: CrossAxisAlignment .center, children: [ GestureDetector( child: netImage( url: ref .userProfile ?.cpList ?.first .meUserAvatar ?? "", defaultImg: "sc_images/general/sc_icon_avar_defalt.png", width: 56.w, shape: BoxShape .circle, ), onTap: () { String encodedUrls = Uri.encodeComponent( jsonEncode([ ref .userProfile ?.cpList ?.first .meUserAvatar, ]), ); SCNavigatorUtils.push( context, "${SCMainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, ), SizedBox( width: 32.w, ), GestureDetector( onTap: () { SCNavigatorUtils.push( context, replace: true, "${SCMainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == ref.userProfile?.cpList?.first.cpUserId}&tageId=${ref.userProfile?.cpList?.first.cpUserId}", ); }, child: netImage( url: ref .userProfile ?.cpList ?.first .cpUserAvatar ?? "", defaultImg: "sc_images/general/sc_icon_avar_defalt.png", width: 56.w, shape: BoxShape .circle, ), ), ], ), ), IgnorePointer( child: Transform.translate( offset: Offset( 0, -15, ), child: Image.asset( "sc_images/person/sc_icon_send_cp_requst_dialog_head.png", ), ), ), ], ), ) : GestureDetector( child: head( url: ref .userProfile ?.userAvatar ?? "", width: 88.w, headdress: ref.userProfile ?.getHeaddress() ?.sourceUrl, ), onTap: () { String encodedUrls = Uri.encodeComponent( jsonEncode([ ref .userProfile ?.userAvatar, ]), ); SCNavigatorUtils.push( context, "${SCMainRoute.imagePreview}?imageUrls=$encodedUrls&initialIndex=0", ); }, ), ], ), SizedBox(height: 6.w), Row( children: [ SizedBox(width: 25.w), socialchatNickNameText( maxWidth: 135.w, ref .userProfile ?.userNickname ?? "", fontSize: 18.sp, textColor: Colors.white, 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: 45.w, height: 25.w, ), Row( children: [ SizedBox(width: 5.w), Container( width: (ref.userProfile?.age ?? 0) > 999 ? 58.w : 48.w, height: 24.w, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( ref.userProfile?.userSex == 0 ? "sc_images/login/sc_icon_sex_woman_bg.png" : "sc_images/login/sc_icon_sex_man_bg.png", ), ), ), child: Row( crossAxisAlignment: CrossAxisAlignment .center, mainAxisAlignment: MainAxisAlignment .center, children: [ xb( ref .userProfile ?.userSex, ), text( "${ref.userProfile?.age}", textColor: Colors.white, fontSize: 14.sp, fontWeight: FontWeight.w600, ), SizedBox(width: 3.w), ], ), ), ], ), ], ), SizedBox(height: 5.w), Row( children: [ SizedBox(width: 25.w), text( "ID:${ref.userProfile?.account ?? ""}", textColor: Colors.white, fontWeight: FontWeight.w400, fontSize: 16.sp, ), ], ), SizedBox(height: 5.w), Consumer< SocialChatUserProfileManager >( 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.white, fontWeight: FontWeight .bold, ), text( SCAppLocalizations.of( context, )!.vistors, fontSize: 14.sp, textColor: Color( 0xffB1B1B1, ), ), ], ), onTap: () { if (widget.isMe == "true") { SCNavigatorUtils.push( context, SCMainRoute .vistors, ); } }, ), 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") { SCNavigatorUtils.push( context, SCMainRoute .follow, ); } }, child: Column( mainAxisAlignment: MainAxisAlignment .center, children: [ text( "${counterMap["SUBSCRIPTION"]?.quantity ?? 0}", fontSize: 17.sp, textColor: Colors.white, fontWeight: FontWeight .bold, ), text( SCAppLocalizations.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.white, fontWeight: FontWeight .bold, ), text( SCAppLocalizations.of( context, )!.fans, fontSize: 14.sp, textColor: Color( 0xffB1B1B1, ), ), ], ), onTap: () { if (widget.isMe == "true") { SCNavigatorUtils.push( context, SCMainRoute.fans, ); } }, ), ], ), ); }, ), 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(0xff083b2f), Color(0xff083b2f), ], begin: AlignmentDirectional.topStart, end: AlignmentDirectional.bottomEnd, ) : LinearGradient( colors: [ Color(0xff083b2f), Color(0xff083b2f), ], 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: SCFixedWidthTabIndicator( width: 20.w, height: 4.w, gradient: ref.userProfile?.userSex == 0 ? LinearGradient( colors: [ Color(0xffFFD800), Color(0xffFFD800), ], ) : LinearGradient( colors: [ Color(0xffFFD800), Color(0xffFFD800), ], ), ), labelPadding: EdgeInsets.symmetric( horizontal: 12.w, ), labelColor: Colors.white, 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: 25.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, decoration: BoxDecoration( color: Color(0xff18F2B1).withOpacity(0.1), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.w), topRight: Radius.circular(10.w), ), ), child: Column( children: [ SizedBox(height: 10.w), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SCDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: SizedBox( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "sc_images/person/sc_icon_person_in_room.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( SCAppLocalizations.of( context, )!.inRoom, textColor: SocialChatTheme.primaryLight, fontWeight: FontWeight.w600, fontSize: 14.sp, ), ), ], ), ), onTap: () { if ((ref .userProfile ?.inRoomId ?? "") .isNotEmpty) { SCRoomUtils.goRoom( ref.userProfile?.inRoomId ?? "", context, ); } }, ), SizedBox(width: 10.w), SCDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: Container( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "sc_images/person/sc_icon_person_tochat.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( SCAppLocalizations.of( context, )!.message, textColor: SocialChatTheme.primaryLight, 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(), ); SCNavigatorUtils.push( context, "${SCChatRouter.chat}?conversation=${Uri.encodeComponent(json)}", ); }, ), SizedBox(width: 10.w), SCDebounceWidget( debounceTime: Duration( milliseconds: 800, ), child: Container( width: 110.w, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( "sc_images/person/sc_icon_person_follow.png", width: 23.w, ), SizedBox(height: 5.w), Container( margin: EdgeInsets.only( bottom: 0.w, ), child: text( isFollow ? SCAppLocalizations.of( context, )!.following : SCAppLocalizations.of( context, )!.follow, textColor: SocialChatTheme.primaryLight, fontWeight: FontWeight.w600, fontSize: 14.sp, ), ), ], ), ), onTap: () { SCAccountRepository() .followUser(widget.tageId) .then((v) { isFollow = !isFollow; setState(() {}); }); }, ), ], ), ], ), )), ), ], ), ), ); }, ); } void _showPartWaysDialog(SocialChatUserProfileManager 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( "sc_images/person/sc_icon_send_cp_requst_dialog_bg.png", ), fit: BoxFit.fill, ), ), child: Column( children: [ SizedBox(height: 58.w), Container( child: text( SCAppLocalizations.of(context)!.partWays, fontSize: 22.sp, textColor: Color(0xffDB5872), fontWeight: FontWeight.bold, ), ), Transform.translate( offset: Offset(0, -25), child: Stack( alignment: AlignmentDirectional.center, children: [ PositionedDirectional( top: 28.w, child: Row( mainAxisSize: MainAxisSize.min, children: [ head( url: AccountStorage() .getCurrentUser() ?.userProfile ?.userAvatar ?? "", width: 90.w, ), SizedBox(width: 15.w), head( url: ref.userProfile?.userAvatar ?? "", width: 90.w, ), ], ), ), Image.asset( "sc_images/person/sc_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( "sc_images/person/sc_icon_send_cp_requst_username_bg.png", ), fit: BoxFit.fill, ), ), child: Row( children: [ socialchatNickNameText( maxWidth: 100.w, AccountStorage() .getCurrentUser() ?.userProfile ?.userNickname ?? "", fontSize: 10.sp, fontWeight: FontWeight.w600, type: AccountStorage() .getCurrentUser() ?.userProfile ?.getVIP() ?.name ?? "", needScroll: (AccountStorage() .getCurrentUser() ?.userProfile ?.userNickname ?.characters .length ?? 0) > 8, ), SizedBox(width: 20.w), socialchatNickNameText( maxWidth: 100.w, ref.userProfile?.userNickname ?? "", fontSize: 10.sp, fontWeight: FontWeight.w600, type: ref.userProfile?.getVIP()?.name ?? "", needScroll: (ref.userProfile?.userNickname?.characters.length ?? 0) > 8, ), ], ), ), ), Container( padding: EdgeInsets.only(bottom: 12.w), margin: EdgeInsets.symmetric(horizontal: 18.w), decoration: BoxDecoration( image: DecorationImage( image: AssetImage( "sc_images/person/sc_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( SCAppLocalizations.of( context, )!.areYouSureYouWantToPartWaysWithYourCP, fontWeight: FontWeight.w500, textColor: Color(0xffFF79A1), maxLines: 3, fontSize: 14.sp, ), ), Container( margin: EdgeInsets.symmetric(horizontal: 20.w), alignment: AlignmentDirectional.center, child: text( SCAppLocalizations.of(context)!.partWaysTips, fontSize: 10.w, textColor: Color(0xffFE91B0), 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( "sc_images/person/sc_icon_send_cp_requst_ok_bg.png", ), fit: BoxFit.fill, ), ), child: text( SCAppLocalizations.of(context)!.cancel, fontSize: 18.sp, fontWeight: FontWeight.bold, textColor: Color(0xffDB5872), ), ), 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( "sc_images/person/sc_icon_send_cp_requst_cancel_bg.png", ), fit: BoxFit.fill, ), ), child: text( SCAppLocalizations.of(context)!.confirm, fontSize: 18.sp, fontWeight: FontWeight.bold, textColor: Colors.white, ), ), onTap: () { SCLoadingManager.show(); SCAccountRepository() .cpRelationshipDismissApply(ref.userProfile?.id ?? "") .then((result) { SmartDialog.dismiss(tag: "showPartWaysDialog"); SCTts.show( SCAppLocalizations.of( context, )!.operationSuccessful, ); SCLoadingManager.hide(); SCNavigatorUtils.popUntil( context, ModalRoute.withName(SCRoutes.home), ); }) .catchError((e) { SCLoadingManager.hide(); }); }, ), ], ), ], ), ); }, ); } }