From a0427c672b7f3ebab1d42ab5dfc575a209954407 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 15 Jul 2023 23:24:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A8=E6=80=81=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/dynamics/result.dart | 3 ++ lib/pages/dynamics/controller.dart | 8 ++-- lib/pages/dynamics/widgets/forward_panel.dart | 9 +++- lib/pages/dynamics/widgets/live_panel.dart | 5 +- .../dynamics/widgets/live_rcmd_panel.dart | 4 +- .../dynamics/widgets/rich_node_panel.dart | 6 ++- lib/pages/dynamics/widgets/up_panel.dart | 5 +- lib/pages/dynamics/widgets/video_panel.dart | 18 ++++--- lib/pages/member/controller.dart | 4 +- lib/pages/member/view.dart | 47 ++++++++++--------- 10 files changed, 67 insertions(+), 42 deletions(-) diff --git a/lib/models/dynamics/result.dart b/lib/models/dynamics/result.dart index ea799b60..643d8c96 100644 --- a/lib/models/dynamics/result.dart +++ b/lib/models/dynamics/result.dart @@ -572,17 +572,20 @@ class RichTextNodeItem { this.origText, this.text, this.type, + this.rid, }); Emoji? emoji; String? origText; String? text; String? type; + String? rid; RichTextNodeItem.fromJson(Map json) { emoji = json['emoji'] != null ? Emoji.fromJson(json['emoji']) : null; origText = json['orig_text']; text = json['text']; type = json['type']; + rid = json['rid']; } } diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index 6318dbc4..87f6da06 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -93,13 +93,11 @@ class DynamicsController extends GetxController { break; case 'DYNAMIC_TYPE_AV': String bvid = item.modules.moduleDynamic.major.archive.bvid; - int aid = item.modules.moduleDynamic.major.archive.aid; String cover = item.modules.moduleDynamic.major.archive.cover; - String heroTag = Utils.makeHeroTag(aid); try { int cid = await SearchHttp.ab2c(bvid: bvid); Get.toNamed('/video?bvid=$bvid&cid=$cid', - arguments: {'pic': cover, 'heroTag': heroTag}); + arguments: {'pic': cover, 'heroTag': bvid}); } catch (err) { SmartDialog.showToast(err.toString()); } @@ -136,6 +134,10 @@ class DynamicsController extends GetxController { 'heroTag': liveItem.roomId.toString() }); break; + + /// TODO + case 'DYNAMIC_TYPE_UGC_SEASON': + print('合集'); } } diff --git a/lib/pages/dynamics/widgets/forward_panel.dart b/lib/pages/dynamics/widgets/forward_panel.dart index d277245b..e9e290b3 100644 --- a/lib/pages/dynamics/widgets/forward_panel.dart +++ b/lib/pages/dynamics/widgets/forward_panel.dart @@ -1,6 +1,7 @@ // 转发 import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:get/get.dart'; import 'package:pilipala/utils/utils.dart'; import 'additional_panel.dart'; @@ -24,7 +25,9 @@ Widget forWard(item, context, ctr, source, {floor = 1}) { Row( children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed( + '/member?mid=${item.modules.moduleAuthor.mid}', + arguments: {'face': item.modules.moduleAuthor.face}), child: Text( '@${item.modules.moduleAuthor.name}', style: authorStyle, @@ -110,7 +113,9 @@ Widget forWard(item, context, ctr, source, {floor = 1}) { Row( children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed( + '/member?mid=${item.modules.moduleAuthor.mid}', + arguments: {'face': item.modules.moduleAuthor.face}), child: Text( '@${item.modules.moduleAuthor.name}', style: authorStyle, diff --git a/lib/pages/dynamics/widgets/live_panel.dart b/lib/pages/dynamics/widgets/live_panel.dart index 483a6ea4..d72994a9 100644 --- a/lib/pages/dynamics/widgets/live_panel.dart +++ b/lib/pages/dynamics/widgets/live_panel.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:pilipala/common/constants.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/utils/utils.dart'; @@ -16,7 +17,9 @@ Widget livePanel(item, context, {floor = 1}) { Row( children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed( + '/member?mid=${item.modules.moduleAuthor.mid}', + arguments: {'face': item.modules.moduleAuthor.face}), child: Text( '@${item.modules.moduleAuthor.name}', style: authorStyle, diff --git a/lib/pages/dynamics/widgets/live_rcmd_panel.dart b/lib/pages/dynamics/widgets/live_rcmd_panel.dart index b37abfbe..2b4dedac 100644 --- a/lib/pages/dynamics/widgets/live_rcmd_panel.dart +++ b/lib/pages/dynamics/widgets/live_rcmd_panel.dart @@ -23,7 +23,9 @@ Widget liveRcmdPanel(item, context, {floor = 1}) { Row( children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed( + '/member?mid=${item.modules.moduleAuthor.mid}', + arguments: {'face': item.modules.moduleAuthor.face}), child: Text( '@${item.modules.moduleAuthor.name}', style: authorStyle, diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index ad8d58d4..e617fac2 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; // 富文本 @@ -20,9 +21,10 @@ InlineSpan richNode(item, context) { mainAxisSize: MainAxisSize.min, children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed('/member?mid=${i.rid}', + arguments: {'face': null}), child: Text( - '${i.text}', + ' ${i.text}', style: authorStyle, ), ), diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index 0faa2af8..40ddfc45 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -164,8 +164,9 @@ class _UpPanelState extends State { padding: const EdgeInsets.only(left: 6, right: 6), isLabelVisible: data.type == 'live' || (data.type == 'up' && (data.hasUpdate ?? false)), - backgroundColor: - Theme.of(context).colorScheme.secondaryContainer, + backgroundColor: data.type == 'live' + ? Theme.of(context).colorScheme.secondaryContainer + : Theme.of(context).colorScheme.primary, child: NetworkImgLayer( width: 49, height: 49, diff --git a/lib/pages/dynamics/widgets/video_panel.dart b/lib/pages/dynamics/widgets/video_panel.dart index 63acd375..0b65a071 100644 --- a/lib/pages/dynamics/widgets/video_panel.dart +++ b/lib/pages/dynamics/widgets/video_panel.dart @@ -1,5 +1,6 @@ // 视频or合集 import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:pilipala/common/constants.dart'; import 'package:pilipala/common/widgets/badge.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; @@ -32,7 +33,9 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) { Row( children: [ GestureDetector( - onTap: () {}, + onTap: () => Get.toNamed( + '/member?mid=${item.modules.moduleAuthor.mid}', + arguments: {'face': item.modules.moduleAuthor.face}), child: Text( item.modules.moduleAuthor.type == null ? '@${item.modules.moduleAuthor.name}' @@ -76,11 +79,14 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) { double width = box.maxWidth; return Stack( children: [ - NetworkImgLayer( - type: floor == 1 ? 'emote' : null, - width: width, - height: width / StyleString.aspectRatio, - src: content.cover, + Hero( + tag: content.bvid, + child: NetworkImgLayer( + type: floor == 1 ? 'emote' : null, + width: width, + height: width / StyleString.aspectRatio, + src: content.cover, + ), ), if (content.badge != null && type == 'pgc') pBadge(content.badge['text'], context, 8.0, 10.0, null, null), diff --git a/lib/pages/member/controller.dart b/lib/pages/member/controller.dart index d3ac8069..66db2de4 100644 --- a/lib/pages/member/controller.dart +++ b/lib/pages/member/controller.dart @@ -19,8 +19,8 @@ class MemberController extends GetxController { super.onInit(); mid = int.parse(Get.parameters['mid']!); ownerMid = user.get(UserBoxKey.userMid); - face = Get.arguments['face']!; - heroTag = Get.arguments['heroTag']!; + face = Get.arguments['face'] ?? ''; + heroTag = Get.arguments['heroTag'] ?? ''; } // 获取用户信息 diff --git a/lib/pages/member/view.dart b/lib/pages/member/view.dart index 631313cc..e1d82f08 100644 --- a/lib/pages/member/view.dart +++ b/lib/pages/member/view.dart @@ -50,33 +50,34 @@ class _MemberPageState extends State flexibleSpace: FlexibleSpaceBar( background: Stack( children: [ - Positioned.fill( - bottom: 10, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fitWidth, - image: NetworkImage(_memberController.face!), - alignment: Alignment.topCenter, - isAntiAlias: true, + if (_memberController.face != null) + Positioned.fill( + bottom: 10, + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fitWidth, + image: NetworkImage(_memberController.face!), + alignment: Alignment.topCenter, + isAntiAlias: true, + ), ), - ), - foregroundDecoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context) - .colorScheme - .background - .withOpacity(0.44), - Theme.of(context).colorScheme.background, - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - stops: const [0.0, 0.46], + foregroundDecoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + Theme.of(context) + .colorScheme + .background + .withOpacity(0.44), + Theme.of(context).colorScheme.background, + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: const [0.0, 0.46], + ), ), ), ), - ), Positioned( left: 0, right: 0,