From a4e63fe0e81ecd98d13605b2ebc740b2afe24995 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 12 Feb 2025 12:25:56 +0800 Subject: [PATCH] mod: video intro: show detailed owner info Closes #229 Signed-off-by: bggRGjQaUbCoE --- lib/http/member.dart | 9 +- .../video/detail/introduction/controller.dart | 4 +- lib/pages/video/detail/introduction/view.dart | 98 ++++++++++++++----- 3 files changed, 86 insertions(+), 25 deletions(-) diff --git a/lib/http/member.dart b/lib/http/member.dart index a286d7c1..a09a1411 100644 --- a/lib/http/member.dart +++ b/lib/http/member.dart @@ -334,8 +334,13 @@ class MemberHttp { } static Future memberCardInfo({int? mid}) async { - var res = await Request() - .get(Api.memberCardInfo, queryParameters: {'mid': mid, 'photo': true}); + var res = await Request().get( + Api.memberCardInfo, + queryParameters: { + 'mid': mid, + 'photo': false, + }, + ); if (res.data['code'] == 0) { return {'status': true, 'data': res.data['data']}; } else { diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 020e42a9..0fe74be1 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/utils.dart'; @@ -197,7 +198,8 @@ class VideoIntroController extends GetxController if (videoDetail.value.owner == null) { return; } - var result = await UserHttp.userStat(mid: videoDetail.value.owner!.mid!); + var result = + await MemberHttp.memberCardInfo(mid: videoDetail.value.owner!.mid!); if (result['status']) { userStat.value = result['data']; userStat.refresh(); diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index d580a80f..2f9b3cf4 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -332,15 +332,53 @@ class _VideoInfoState extends State with TickerProviderStateMixin { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - NetworkImgLayer( - type: 'avatar', - src: widget.loadingStatus - ? videoItem['owner']?.face ?? "" - : videoDetail.owner!.face, - width: 35, - height: 35, - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, + Obx( + () => Stack( + clipBehavior: Clip.none, + children: [ + NetworkImgLayer( + type: 'avatar', + src: videoIntroController.userStat + .value['card']?['face'] ?? + '', + width: 35, + height: 35, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + if ((videoIntroController.userStat + .value['card'] + ?['official_verify'] + ?['type'] ?? + -1) != + -1) + Positioned( + right: -2, + bottom: -2, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context) + .colorScheme + .surface, + ), + child: Icon( + Icons.offline_bolt, + color: videoIntroController + .userStat + .value[ + 'card']?['vip'] + ['status'] == + 0 + ? Colors.yellow + : Colors + .lightBlueAccent, + size: 14, + ), + ), + ), + ], + ), ), const SizedBox(width: 10), Expanded( @@ -348,23 +386,39 @@ class _VideoInfoState extends State with TickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - widget.loadingStatus - ? videoItem['owner']?.name ?? - "" - : videoDetail.owner!.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - // color: t.colorScheme.primary, + Obx( + () => Text( + videoIntroController.userStat + .value['card'] + ?['name'] ?? + "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + color: (videoIntroController + .userStat + .value['card']?['vip'] + ?[ + 'status'] ?? + -1) > + 0 && + (videoIntroController + .userStat + .value['card']?['vip'] + ?[ + 'type'] ?? + -1) == + 2 + ? context.vipColor + : null, + ), ), - // semanticsLabel: "UP主:${owner.name}", ), const SizedBox(height: 0), Obx( () => Text( - '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝', + '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}', style: TextStyle( fontSize: 12, color: t.colorScheme.outline, @@ -414,7 +468,7 @@ class _VideoInfoState extends State with TickerProviderStateMixin { fadeInDuration: Duration.zero, fadeOutDuration: Duration.zero, ), - const SizedBox(width: 5), + const SizedBox(width: 8), Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: