From 659455e50cdccbf8ec58b01ee2ed3349509a8068 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sat, 9 Nov 2024 02:02:36 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E8=A7=86=E9=A2=91=E4=BB=8B=E7=BB=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/introduction/detail/view.dart | 207 +++++++++--------- .../introduction/widgets/intro_detail.dart | 117 ++-------- 2 files changed, 127 insertions(+), 197 deletions(-) diff --git a/lib/pages/video/introduction/detail/view.dart b/lib/pages/video/introduction/detail/view.dart index 7a4baa0d1..8540214d0 100644 --- a/lib/pages/video/introduction/detail/view.dart +++ b/lib/pages/video/introduction/detail/view.dart @@ -171,19 +171,19 @@ class _VideoInfoState extends State with TickerProviderStateMixin { } // 视频介绍 - showIntroDetail() { - if (loadingStatus) { - return; - } - feedBack(); - showBottomSheet( - context: context, - enableDrag: true, - builder: (BuildContext context) { - return IntroDetail(videoDetail: widget.videoDetail!); - }, - ); - } + // showIntroDetail() { + // if (loadingStatus) { + // return; + // } + // feedBack(); + // showBottomSheet( + // context: context, + // enableDrag: true, + // builder: (BuildContext context) { + // return IntroDetail(videoDetail: widget.videoDetail!); + // }, + // ); + // } // 用户主页 onPushMember() { @@ -217,6 +217,7 @@ class _VideoInfoState extends State with TickerProviderStateMixin { builder: (BuildContext context, SliverConstraints constraints) { bool isHorizontal = constraints.crossAxisExtent > constraints.viewportMainAxisExtent * 1.25; + bool isExpanded = isHorizontal; return SliverPadding( padding: const EdgeInsets.only( left: StyleString.safeSpace, @@ -285,13 +286,25 @@ class _VideoInfoState extends State with TickerProviderStateMixin { Expanded(child: actionGrid(context, videoIntroController)), ] ]), - const SizedBox(height: 8), - GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () => showIntroDetail(), - child: Row(children: [ - Expanded( - child: Text( + ListTileTheme( + key: const PageStorageKey('视频信息'), + contentPadding: EdgeInsets.zero, + dense: true, + horizontalTitleGap: 0.0, + minLeadingWidth: 0, + minVerticalPadding: 0, + child: ExpansionTile( + initiallyExpanded: isHorizontal, + collapsedShape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(), + showTrailingIcon: false, + onExpansionChanged: (bool expanded) { + feedBack(); + setState(() { + isExpanded = expanded; + }); + }, + title: Text( widget.videoDetail?.title ?? videoItem['title'] ?? "", // !loadingStatus // ? "${widget.videoDetail?.title}" @@ -300,97 +313,88 @@ class _VideoInfoState extends State with TickerProviderStateMixin { fontSize: 16, fontWeight: FontWeight.w500, ), - maxLines: 2, + maxLines: isExpanded ? 999 : 2, overflow: TextOverflow.ellipsis, - )), - Icon( - Icons.arrow_forward_ios, - size: 16, - color: t.colorScheme.outline, ), - ]), - ), - Stack( - children: [ - GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () => showIntroDetail(), - child: Padding( - padding: const EdgeInsets.only(top: 7, bottom: 6), - child: Row( - children: [ - StatView( - theme: 'gray', - view: !loadingStatus - ? widget.videoDetail?.stat?.view ?? '-' - : videoItem['stat']?.view ?? '-', - size: 'medium', - ), - const SizedBox(width: 10), - StatDanMu( - theme: 'gray', - danmu: !loadingStatus - ? widget.videoDetail?.stat?.danmu ?? '-' - : videoItem['stat']?.danmu ?? '-', - size: 'medium', + subtitle: Padding( + padding: const EdgeInsets.only(top: 7), + child: Row( + children: [ + StatView( + theme: 'gray', + view: !loadingStatus + ? widget.videoDetail?.stat?.view ?? '-' + : videoItem['stat']?.view ?? '-', + size: 'medium', + ), + const SizedBox(width: 10), + StatDanMu( + theme: 'gray', + danmu: !loadingStatus + ? widget.videoDetail?.stat?.danmu ?? '-' + : videoItem['stat']?.danmu ?? '-', + size: 'medium', + ), + const SizedBox(width: 10), + Text( + Utils.dateFormat( + !loadingStatus + ? widget.videoDetail?.pubdate + : videoItem['pubdate'], + formatType: 'detail'), + style: TextStyle( + fontSize: 12, + color: t.colorScheme.outline, ), + ), + if (MineController.anonymity) ...[ const SizedBox(width: 10), - Text( - Utils.dateFormat( - !loadingStatus - ? widget.videoDetail?.pubdate - : videoItem['pubdate'], - formatType: 'detail'), - style: TextStyle( - fontSize: 12, - color: t.colorScheme.outline, - ), + Icon( + MdiIcons.incognito, + size: 15, + color: t.colorScheme.outline, + semanticLabel: '无痕', ), - if (MineController.anonymity) ...[ - const SizedBox(width: 10), - Icon( - MdiIcons.incognito, - size: 15, - color: t.colorScheme.outline, - semanticLabel: '无痕', - ), - ], - const SizedBox(width: 10), - if (videoIntroController.isShowOnlineTotal) - Obx( - () => Text( - '${videoIntroController.total.value}人在看', - style: TextStyle( - fontSize: 12, - color: t.colorScheme.outline, - ), + ], + const SizedBox(width: 10), + if (videoIntroController.isShowOnlineTotal) + Obx( + () => Text( + '${videoIntroController.total.value}人在看', + style: TextStyle( + fontSize: 12, + color: t.colorScheme.outline, ), ), - ], - ), + ), + const Spacer(), + if (enableAi) + Semantics( + label: 'AI总结', + child: GestureDetector( + onTap: () async { + final res = + await videoIntroController.aiConclusion(); + if (res['status']) { + showAiBottomSheet(); + } + }, + child: Image.asset('assets/images/ai.png', + height: 22), + )), + const SizedBox(width: 10), + ], ), ), - if (enableAi) - Positioned( - right: 10, - top: 6, - child: Semantics( - label: 'AI总结', - child: GestureDetector( - onTap: () async { - final res = - await videoIntroController.aiConclusion(); - if (res['status']) { - showAiBottomSheet(); - } - }, - child: - Image.asset('assets/images/ai.png', height: 22), - )), - ) - ], + children: [ + Row(children: [ + if (widget.videoDetail != null) + Expanded( + child: IntroDetail(videoDetail: widget.videoDetail)) + ]), + ], + ), ), - Obx( () => videoIntroController.queryVideoIntroData.value["status"] ? const SizedBox() @@ -406,6 +410,7 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ), ), ), + const SizedBox(height: 8), // 点赞收藏转发 布局样式1 // SingleChildScrollView( // padding: const EdgeInsets.only(top: 7, bottom: 7), diff --git a/lib/pages/video/introduction/widgets/intro_detail.dart b/lib/pages/video/introduction/widgets/intro_detail.dart index 61d582078..b3ecf1dae 100644 --- a/lib/pages/video/introduction/widgets/intro_detail.dart +++ b/lib/pages/video/introduction/widgets/intro_detail.dart @@ -15,102 +15,27 @@ class IntroDetail extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - color: Theme.of(context).colorScheme.background, - padding: const EdgeInsets.only(left: 14, right: 14), - height: Utils.getSheetHeight(context), - child: Column( - children: [ - InkWell( - onTap: () => Get.back(), - child: Container( - height: 35, - padding: const EdgeInsets.only(bottom: 2), - child: Center( - child: Container( - width: 32, - height: 3, - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primary, - borderRadius: - const BorderRadius.all(Radius.circular(3))), - ), - ), - ), - ), - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - videoDetail!.title, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 6), - Row( - children: [ - StatView( - theme: 'gray', - view: videoDetail!.stat!.view, - size: 'medium', - ), - const SizedBox(width: 10), - StatDanMu( - theme: 'gray', - danmu: videoDetail!.stat!.danmu, - size: 'medium', - ), - const SizedBox(width: 10), - Text( - Utils.dateFormat(videoDetail!.pubdate, - formatType: 'detail'), - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.outline, - ), - ), - ], - ), - const SizedBox(height: 20), - SizedBox( - width: double.infinity, - child: SelectableRegion( - focusNode: FocusNode(), - selectionControls: MaterialTextSelectionControls(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - videoDetail!.bvid!, - style: const TextStyle(fontSize: 13), - ), - const SizedBox(height: 4), - Text.rich( - style: const TextStyle( - height: 1.4, - // fontSize: 13, - ), - TextSpan( - children: [ - buildContent(context, videoDetail!), - ], - ), - ), - ], - ), - ), - ), - const SizedBox(height: 100), - ], - ), - ), - ) - ], - )); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + videoDetail!.bvid!, + style: const TextStyle(fontSize: 13), + ), + const SizedBox(height: 4), + Text.rich( + style: const TextStyle( + height: 1.4, + // fontSize: 13, + ), + TextSpan( + children: [ + buildContent(context, videoDetail!), + ], + ), + ), + ], + ); } InlineSpan buildContent(BuildContext context, content) {