From ca12be53730bc02ee25c8eb974265de809f48b4c Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 26 Jul 2023 22:04:56 +0800 Subject: [PATCH] mod --- assets/images/noface.jpeg | Bin 0 -> 3719 bytes lib/common/widgets/custom_toast.dart | 2 +- lib/common/widgets/network_img_layer.dart | 4 +- lib/http/reply.dart | 2 +- lib/pages/dynamics/deatil/controller.dart | 30 +- lib/pages/dynamics/deatil/view.dart | 24 +- lib/pages/video/detail/introduction/view.dart | 269 +++++++++++------- .../introduction/widgets/action_item.dart | 33 ++- .../introduction/widgets/action_row_item.dart | 4 +- .../introduction/widgets/intro_detail.dart | 13 +- .../detail/introduction/widgets/menu_row.dart | 8 +- .../detail/introduction/widgets/season.dart | 9 +- lib/pages/video/detail/reply/controller.dart | 22 +- lib/pages/video/detail/reply/view.dart | 17 +- .../detail/reply/widgets/reply_item.dart | 4 +- .../video/detail/replyReply/controller.dart | 44 ++- lib/pages/video/detail/replyReply/view.dart | 23 +- pubspec.lock | 8 +- pubspec.yaml | 10 +- 19 files changed, 311 insertions(+), 215 deletions(-) create mode 100644 assets/images/noface.jpeg diff --git a/assets/images/noface.jpeg b/assets/images/noface.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..16639025550062031f37962882ee5e95570078f8 GIT binary patch literal 3719 zcmcImXH-*7w@x7R8W3J7p%;-3(m_BVGyy{|(xeHI7CO>ZPy|AeCK5zSC;_Dl2#QpV zf<$`ny@P-h`NFGQ*SFUFbAQ}t);ed_*)z}Hb7s$;=WOU~3P7s^)rJCqKmY)UZ-BE= zfEs|1;2h^qLOejkpmUHC6B7}Wk&=^>k&=;-Q_@h9Q&3Zokx_xEsA*_v!L;O*bo6wz z^!PsQISKH5CLxFvKarM#i~|4l|A?~>05B<_8c)8xYc<0BsGj4R^pj11OLT^kAJD~On3`B81J0mzhVFqfbsNP z5-`;pXCnYgLcASJ2nHwvP8n?KIDa$!e?Cc66^V@inbFWVEMfE;Hb+fg7~UO;7CPF? z8uTTRFiFTuj?MjX!qThrefX!dD0a_V$p5gXRAqs$cLv z6{vv7knmwlDrkOi&joDCK_60$>QFAS%svoL?s3jKRVqXI=hSo$pgep& zV-hT!n)90DgafWDJYU*bTAD*XfEyf__XIAn`0o{nr4K~s6-E5TgP5kIH=np$EqgP) z@+H69n;Q(2S*o3+AitmVH(81wQ?ZO zf%vgmmlg$GZwyZUNtxe?QuAvhDCR+CX2e>;36gU`P~YYnRwPNN-&fCXL%Cf%-n9>&dvPkQUpn9Na(|11t(%TE->8ALgs@q+fyIP74&Cx^qVQ_v#-CbSNjz8|V!>)UYiJC?h^(fzue=1P_g zUGQO`KweAL``JnEHNC!BeQgoNj)M!Vf~jM29Oa3?B+ zf4CI4=m!oKj*P47?^}s?y(*! zV>igfNGi2=`$%5cG4VcUQ2?rUu0+{xqD_i=cSJE&bB$#vI< zfkEy*8Gw%sTtUrh@Id-+4$=jRNS9{NNIQZT)w8VyWVGY6v=yb)#)TqG&($D(9Jw_hu&Vj_ZGE z^9^G~L?6{@W%$31))RW>shA@3^t4rcFxiz4fk`wVx_QSfC{xH|Y(Z9*-5lB!prNjV zX!mVJMcMvd-Z4wEcU7n4OTuGI%r<_3=CC1^-%vHec|LXDOAC3C6nEmCXPOauRI0HwrL?rePaJPED zb+*6^+XzXUF z5Hlavx=YeCEj{MBH+ZTIHn zo|I(qoCIIQz!hIvPr{1VQFo~l{ASw5x?LwHmmwk`hXHYBDfXq2sZi6c?d z62B`~{~m3&tu?Dl?jshSK><*NjA#-x92XhS>L&i-NtUiH$e|~3-4Z1?zwd?>`S|BP zry)8T5@n1n_3n~4^(LG18ku}dn&#oE(YwAOsAR1dy`WBPA!#4>C7*@DAcwQB%;)23 zNj;1E=SjuNVJEa$_bm4^`is)n_sR@J(a(yetK|}n`mSYz^2_sZ zU96Q{k4PvwUl6D3iS(^L(u(5$dTo$VLONZpBhQX7XacQ^NvaMQGqW}PtfSj>FGUOC z5Qvae9MvgqH0*ewo##pBeUS7+0Jq8yY0dBHL>xr^;D=U*a2Pr@j{#dfJ4D`N2!=uKTEzO5rTB8WxXH?)>lVe z`70aoy$6`ePLRQKGvZ3=bXk-NvEwVT(x#8PW!;6dd_g^&UaVi|*m4ssz3KuyxyYV& za6I3H*M9q=?MKhrNqlu=)rm+}NnWCCV)JZi}JHq9B~^rB{+m*OoNW{HK7`$AiLW|0QT6BBCnt70~y$ z_7cU1wauqVe?c}5DVtm`cdtljpgGTfI?1bXE8&J_R5N{N6!e|%TmYv?R*jUpiSM?_ zjrF?=cJ~crxy33sSC{_E!*iL4y_SX8C>`^q^uL!EN1z-!YS3z8KASym%;5NM=Bt+8 z9a&fz1?MF$9PzKvOetutDCwBp7S+8I|M;SS;@|S0xVhqST?jbP2PsAx$F*pA9N$q` zKewn@9-cw}#!pz*X2S7z6=Q5-8EZ^91B@a4VFO}SN721UNXt}=NU7QXT)*d@RT*OE zLoR#F^0@GOQ8WGA4=ZNEcJNfs{L!}i!@MCfu}ltfay8(@@FHIRvVNzf-?AtCZ1_L5 CsAuK? literal 0 HcmV?d00001 diff --git a/lib/common/widgets/custom_toast.dart b/lib/common/widgets/custom_toast.dart index 2c6d71d1..8dd62a51 100644 --- a/lib/common/widgets/custom_toast.dart +++ b/lib/common/widgets/custom_toast.dart @@ -11,7 +11,7 @@ class CustomToast extends StatelessWidget { EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 20), padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.8), + color: Theme.of(context).colorScheme.primaryContainer, borderRadius: BorderRadius.circular(20), ), child: Text(msg, diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart index 80ed4450..8c97c3fc 100644 --- a/lib/common/widgets/network_img_layer.dart +++ b/lib/common/widgets/network_img_layer.dart @@ -63,7 +63,9 @@ class NetworkImgLayer extends StatelessWidget { height: height ?? double.infinity, child: Center( child: Image.asset( - 'assets/images/loading.png', + type == 'avatar' + ? 'assets/images/noface.jpeg' + : 'assets/images/loading.png', width: 300, height: 300, )), diff --git a/lib/http/reply.dart b/lib/http/reply.dart index 9c40a357..1dbc1990 100644 --- a/lib/http/reply.dart +++ b/lib/http/reply.dart @@ -54,7 +54,7 @@ class ReplyHttp { if (res.data['code'] == 0) { return { 'status': true, - 'data': res.data['data'], + 'data': ReplyData.fromJson(res.data['data']), }; } else { Map errMap = { diff --git a/lib/pages/dynamics/deatil/controller.dart b/lib/pages/dynamics/deatil/controller.dart index 2992756b..c2e1abe5 100644 --- a/lib/pages/dynamics/deatil/controller.dart +++ b/lib/pages/dynamics/deatil/controller.dart @@ -2,6 +2,7 @@ import 'package:get/get.dart'; import 'package:pilipala/http/reply.dart'; import 'package:pilipala/models/common/reply_sort_type.dart'; import 'package:pilipala/models/video/reply/item.dart'; +import 'package:pilipala/utils/feed_back.dart'; class DynamicDetailController extends GetxController { DynamicDetailController(this.oid, this.type); @@ -41,32 +42,23 @@ class DynamicDetailController extends GetxController { sort: sortType.index, ); if (res['status']) { + List replies = res['data'].replies; acount.value = res['data'].page.acount; - if (res['data'].replies.isNotEmpty) { - currentPage = currentPage + 1; + if (replies.isNotEmpty) { + currentPage++; noMore.value = '加载中...'; - if (res['data'].replies.isEmpty) { + if (replies.length < 20) { noMore.value = '没有更多了'; - return; } } else { - if (currentPage == 0) { - noMore.value = '还没有评论'; - } else { - noMore.value = '没有更多了'; - return; - } + noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了'; } - List replies = res['data'].replies; if (reqType == 'init') { // 添加置顶回复 if (res['data'].upper.top != null) { - bool flag = false; - for (var i = 0; i < res['data'].topReplies.length; i++) { - if (res['data'].topReplies[i].rpid == res['data'].upper.top.rpid) { - flag = true; - } - } + bool flag = res['data'] + .topReplies + .any((reply) => reply.rpid == res['data'].upper.top.rpid); if (!flag) { replies.insert(0, res['data'].upper.top); } @@ -76,9 +68,6 @@ class DynamicDetailController extends GetxController { } else { replyList.addAll(replies); } - if (replyList.length == acount.value) { - noMore.value = '没有更多了'; - } } isLoadingMore = false; return res; @@ -86,6 +75,7 @@ class DynamicDetailController extends GetxController { // 排序搜索评论 queryBySort() { + feedBack(); switch (sortType) { case ReplySortType.time: sortType = ReplySortType.like; diff --git a/lib/pages/dynamics/deatil/view.dart b/lib/pages/dynamics/deatil/view.dart index 36c28680..692049ef 100644 --- a/lib/pages/dynamics/deatil/view.dart +++ b/lib/pages/dynamics/deatil/view.dart @@ -143,7 +143,7 @@ class _DynamicDetailPageState extends State { ), ), height: 45, - padding: const EdgeInsets.only(left: 15, right: 12), + padding: const EdgeInsets.only(left: 12, right: 6), child: Row( children: [ Obx( @@ -168,9 +168,11 @@ class _DynamicDetailPageState extends State { child: TextButton.icon( onPressed: () => _dynamicDetailController!.queryBySort(), - icon: const Icon(Icons.sort, size: 17), + icon: const Icon(Icons.sort, size: 16), label: Obx(() => Text( - _dynamicDetailController!.sortTypeLabel.value)), + _dynamicDetailController!.sortTypeLabel.value, + style: const TextStyle(fontSize: 13), + )), ), ) ], @@ -187,7 +189,8 @@ class _DynamicDetailPageState extends State { if (snapshot.data['status']) { // 请求成功 return Obx( - () => _dynamicDetailController!.replyList.isEmpty + () => _dynamicDetailController!.replyList.isEmpty && + _dynamicDetailController!.isLoadingMore ? SliverList( delegate: SliverChildBuilderDelegate((context, index) { @@ -210,9 +213,18 @@ class _DynamicDetailPageState extends State { .bottom + 100, child: Center( - child: Obx(() => Text( + child: Obx( + () => Text( _dynamicDetailController! - .noMore.value)), + .noMore.value, + style: TextStyle( + fontSize: 12, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), + ), ), ); } else { diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 247cf114..9b532931 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -16,6 +16,7 @@ import 'package:pilipala/utils/feed_back.dart'; import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/utils.dart'; +import 'widgets/action_item.dart'; import 'widgets/action_row_item.dart'; import 'widgets/fav_panel.dart'; import 'widgets/intro_detail.dart'; @@ -157,11 +158,10 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ? widget.videoDetail!.title : videoItem['title'], style: const TextStyle( - fontSize: 18, - letterSpacing: 0.3, + fontSize: 16, fontWeight: FontWeight.w500, ), - maxLines: 2, + maxLines: 1, overflow: TextOverflow.ellipsis, ), ), @@ -228,8 +228,8 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ], ), ), - const SizedBox(height: 6), - // 点赞收藏转发 + const SizedBox(height: 7), + // 点赞收藏转发 布局样式1 SingleChildScrollView( padding: const EdgeInsets.only(top: 7, bottom: 7), scrollDirection: Axis.horizontal, @@ -239,6 +239,8 @@ class _VideoInfoState extends State with TickerProviderStateMixin { videoDetailCtr, ), ), + // 点赞收藏转发 布局样式2 + // actionGrid(context, videoIntroController), // 合集 if (!widget.loadingStatus && widget.videoDetail!.ugcSeason != null) ...[ @@ -246,105 +248,103 @@ class _VideoInfoState extends State with TickerProviderStateMixin { widget.videoDetail!.pages!.first.cid, sheetHeight) ], GestureDetector( - onTap: () { - feedBack(); - int mid = !widget.loadingStatus - ? widget.videoDetail!.owner!.mid - : videoItem['owner'].mid; - String face = !widget.loadingStatus - ? widget.videoDetail!.owner!.face - : videoItem['owner'].face; - Get.toNamed('/member?mid=$mid', arguments: { - 'face': face, - 'heroTag': (mid + 99).toString() - }); - }, - child: Padding( - padding: const EdgeInsets.only( - top: 12, bottom: 12, left: 4, right: 4), - child: Row( - children: [ - NetworkImgLayer( - type: 'avatar', - src: !widget.loadingStatus - ? widget.videoDetail!.owner!.face - : videoItem['owner'].face, - width: 34, - height: 34, - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, - ), - const SizedBox(width: 10), - Text( - !widget.loadingStatus - ? widget.videoDetail!.owner!.name - : videoItem['owner'].name, - style: const TextStyle(fontSize: 13), - ), - const SizedBox(width: 10), - Text( - widget.loadingStatus - ? '-' - : Utils.numFormat(videoIntroController - .userStat['follower']), - style: TextStyle( - fontSize: t.textTheme.labelSmall!.fontSize, - color: t.colorScheme.outline), - ), - const Spacer(), - AnimatedOpacity( - opacity: widget.loadingStatus ? 0 : 1, - duration: const Duration(milliseconds: 150), - child: SizedBox( - height: 32, - child: Obx( - () => videoIntroController - .followStatus.isNotEmpty - ? TextButton( - onPressed: () => videoIntroController - .actionRelationMod(), - style: TextButton.styleFrom( - padding: const EdgeInsets.only( - left: 8, right: 8), - foregroundColor: - videoIntroController - .followStatus[ - 'attribute'] != - 0 - ? t.colorScheme.outline - : t.colorScheme.onPrimary, - backgroundColor: - videoIntroController - .followStatus[ - 'attribute'] != - 0 - ? t.colorScheme - .onInverseSurface - : t.colorScheme - .primary, // 设置按钮背景色 - ), - child: Text( - videoIntroController.followStatus[ - 'attribute'] != - 0 - ? '已关注' - : '关注', - style: TextStyle( - fontSize: t.textTheme - .labelMedium!.fontSize), - ), - ) - : ElevatedButton( - onPressed: () => videoIntroController - .actionRelationMod(), - child: const Text('关注'), + onTap: () { + feedBack(); + int mid = !widget.loadingStatus + ? widget.videoDetail!.owner!.mid + : videoItem['owner'].mid; + String face = !widget.loadingStatus + ? widget.videoDetail!.owner!.face + : videoItem['owner'].face; + Get.toNamed('/member?mid=$mid', arguments: { + 'face': face, + 'heroTag': (mid + 99).toString() + }); + }, + child: Padding( + padding: const EdgeInsets.only( + top: 12, bottom: 12, left: 4, right: 4), + child: Row( + children: [ + NetworkImgLayer( + type: 'avatar', + src: !widget.loadingStatus + ? widget.videoDetail!.owner!.face + : videoItem['owner'].face, + width: 34, + height: 34, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + const SizedBox(width: 10), + Text( + !widget.loadingStatus + ? widget.videoDetail!.owner!.name + : videoItem['owner'].name, + style: const TextStyle(fontSize: 13), + ), + const SizedBox(width: 6), + Text( + widget.loadingStatus + ? '-' + : Utils.numFormat( + videoIntroController.userStat['follower']), + style: TextStyle( + fontSize: t.textTheme.labelSmall!.fontSize, + color: t.colorScheme.outline), + ), + const Spacer(), + AnimatedOpacity( + opacity: widget.loadingStatus ? 0 : 1, + duration: const Duration(milliseconds: 150), + child: SizedBox( + height: 32, + child: Obx( + () => videoIntroController + .followStatus.isNotEmpty + ? TextButton( + onPressed: () => videoIntroController + .actionRelationMod(), + style: TextButton.styleFrom( + padding: const EdgeInsets.only( + left: 8, right: 8), + foregroundColor: + videoIntroController.followStatus[ + 'attribute'] != + 0 + ? t.colorScheme.outline + : t.colorScheme.onPrimary, + backgroundColor: videoIntroController + .followStatus[ + 'attribute'] != + 0 + ? t.colorScheme.onInverseSurface + : t.colorScheme + .primary, // 设置按钮背景色 ), - ), + child: Text( + videoIntroController.followStatus[ + 'attribute'] != + 0 + ? '已关注' + : '关注', + style: TextStyle( + fontSize: t.textTheme.labelMedium! + .fontSize), + ), + ) + : ElevatedButton( + onPressed: () => videoIntroController + .actionRelationMod(), + child: const Text('关注'), + ), ), ), - ], - ), - )), + ), + ], + ), + ), + ), ], ) : const SizedBox( @@ -357,6 +357,73 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ); } + Widget actionGrid(BuildContext context, videoIntroController) { + return LayoutBuilder(builder: (context, constraints) { + return Padding( + padding: const EdgeInsets.only(top: 6, bottom: 10), + child: SizedBox( + height: constraints.maxWidth / 5 * 0.8, + child: GridView.count( + primary: false, + padding: const EdgeInsets.all(0), + crossAxisCount: 5, + childAspectRatio: 1.25, + children: [ + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.thumbsUp), + selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp), + onTap: () => videoIntroController.actionLikeVideo(), + selectStatus: videoIntroController.hasLike.value, + loadingStatus: widget.loadingStatus, + text: !widget.loadingStatus + ? widget.videoDetail!.stat!.like!.toString() + : '-'), + ), + ActionItem( + icon: const Icon(FontAwesomeIcons.clock), + onTap: () => videoIntroController.actionShareVideo(), + selectStatus: false, + loadingStatus: widget.loadingStatus, + text: '稍后再看'), + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.b), + selectIcon: const Icon(FontAwesomeIcons.b), + onTap: () => videoIntroController.actionCoinVideo(), + selectStatus: videoIntroController.hasCoin.value, + loadingStatus: widget.loadingStatus, + text: !widget.loadingStatus + ? widget.videoDetail!.stat!.coin!.toString() + : '-'), + ), + Obx( + () => ActionItem( + icon: const Icon(FontAwesomeIcons.star), + selectIcon: const Icon(FontAwesomeIcons.solidStar), + // onTap: () => videoIntroController.actionFavVideo(), + onTap: () => showFavBottomSheet(), + selectStatus: videoIntroController.hasFav.value, + loadingStatus: widget.loadingStatus, + text: !widget.loadingStatus + ? widget.videoDetail!.stat!.favorite!.toString() + : '-'), + ), + ActionItem( + icon: const Icon(FontAwesomeIcons.shareFromSquare), + onTap: () => videoIntroController.actionShareVideo(), + selectStatus: false, + loadingStatus: widget.loadingStatus, + text: !widget.loadingStatus + ? widget.videoDetail!.stat!.share!.toString() + : '-'), + ], + ), + ), + ); + }); + } + Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) { return Row(children: [ Obx( diff --git a/lib/pages/video/detail/introduction/widgets/action_item.dart b/lib/pages/video/detail/introduction/widgets/action_item.dart index 789ceab6..a2e54b33 100644 --- a/lib/pages/video/detail/introduction/widgets/action_item.dart +++ b/lib/pages/video/detail/introduction/widgets/action_item.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:pilipala/common/constants.dart'; +import 'package:pilipala/utils/feed_back.dart'; class ActionItem extends StatelessWidget { final Icon? icon; @@ -22,7 +23,10 @@ class ActionItem extends StatelessWidget { @override Widget build(BuildContext context) { return InkWell( - onTap: () => onTap!(), + onTap: () => { + feedBack(), + onTap!(), + }, borderRadius: StyleString.mdRadius, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -30,20 +34,27 @@ class ActionItem extends StatelessWidget { const SizedBox(height: 4), selectStatus ? Icon(selectIcon!.icon!, - size: 21, color: Theme.of(context).primaryColor) + size: 18, color: Theme.of(context).colorScheme.primary) : Icon(icon!.icon!, - size: 21, color: Theme.of(context).colorScheme.outline), - const SizedBox(height: 4), + size: 18, color: Theme.of(context).colorScheme.outline), + const SizedBox(height: 6), AnimatedOpacity( opacity: loadingStatus! ? 0 : 1, duration: const Duration(milliseconds: 200), - child: Text( - text ?? '', - style: TextStyle( - color: selectStatus - ? Theme.of(context).primaryColor - : Theme.of(context).colorScheme.outline, - fontSize: Theme.of(context).textTheme.labelSmall?.fontSize), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(scale: animation, child: child); + }, + child: Text( + text ?? '', + key: ValueKey(text ?? ''), + style: TextStyle( + color: selectStatus + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.outline, + fontSize: Theme.of(context).textTheme.labelSmall!.fontSize), + ), ), ), ], diff --git a/lib/pages/video/detail/introduction/widgets/action_row_item.dart b/lib/pages/video/detail/introduction/widgets/action_row_item.dart index 5b940e0b..3aabe337 100644 --- a/lib/pages/video/detail/introduction/widgets/action_row_item.dart +++ b/lib/pages/video/detail/introduction/widgets/action_row_item.dart @@ -33,7 +33,7 @@ class ActionRowItem extends StatelessWidget { onTap!(), }, child: Padding( - padding: const EdgeInsets.fromLTRB(13, 6.5, 15, 6.3), + padding: const EdgeInsets.fromLTRB(15, 7, 15, 7), child: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -62,7 +62,7 @@ class ActionRowItem extends StatelessWidget { ? Theme.of(context).colorScheme.primary : null, fontSize: - Theme.of(context).textTheme.labelSmall!.fontSize), + Theme.of(context).textTheme.labelMedium!.fontSize), ), ), ), diff --git a/lib/pages/video/detail/introduction/widgets/intro_detail.dart b/lib/pages/video/detail/introduction/widgets/intro_detail.dart index 75bc9bd4..b61a73c5 100644 --- a/lib/pages/video/detail/introduction/widgets/intro_detail.dart +++ b/lib/pages/video/detail/introduction/widgets/intro_detail.dart @@ -51,23 +51,21 @@ class IntroDetail extends StatelessWidget { Text( videoDetail!.title, style: const TextStyle( - fontSize: 18, - letterSpacing: 0.5, + fontSize: 16, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 10), Row( children: [ - const SizedBox(width: 2), StatView( - theme: 'black', + theme: 'gray', view: videoDetail!.stat!.view, size: 'medium', ), const SizedBox(width: 10), StatDanMu( - theme: 'black', + theme: 'gray', danmu: videoDetail!.stat!.danmaku, size: 'medium', ), @@ -75,7 +73,10 @@ class IntroDetail extends StatelessWidget { Text( Utils.dateFormat(videoDetail!.pubdate, formatType: 'detail'), - style: const TextStyle(fontSize: 12), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.outline, + ), ), ], ), diff --git a/lib/pages/video/detail/introduction/widgets/menu_row.dart b/lib/pages/video/detail/introduction/widgets/menu_row.dart index 7832d7be..91af6fba 100644 --- a/lib/pages/video/detail/introduction/widgets/menu_row.dart +++ b/lib/pages/video/detail/introduction/widgets/menu_row.dart @@ -68,7 +68,7 @@ class MenuRow extends StatelessWidget { onTap!(), }, child: Container( - padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 5.5), + padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5), decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(30)), border: Border.all( @@ -85,7 +85,11 @@ class MenuRow extends StatelessWidget { duration: const Duration(milliseconds: 200), child: Text( text!, - style: const TextStyle(fontSize: 13), + style: TextStyle( + fontSize: 13, + color: selectStatus + ? Theme.of(context).colorScheme.onBackground + : Theme.of(context).colorScheme.outline), ), ), ], diff --git a/lib/pages/video/detail/introduction/widgets/season.dart b/lib/pages/video/detail/introduction/widgets/season.dart index 892fd7dc..1e5065ef 100644 --- a/lib/pages/video/detail/introduction/widgets/season.dart +++ b/lib/pages/video/detail/introduction/widgets/season.dart @@ -7,9 +7,10 @@ Widget seasonPanel(UgcSeason ugcSeason, cid, sheetHeight) { int currentIndex = episodes.indexWhere((e) => e.cid == cid); return Container( margin: const EdgeInsets.only( - top: 15, + top: 8, left: 2, right: 2, + bottom: 2, ), child: Material( color: Theme.of(context).colorScheme.onInverseSurface, @@ -88,11 +89,11 @@ Widget seasonPanel(UgcSeason ugcSeason, cid, sheetHeight) { Image.asset( 'assets/images/live.gif', color: Theme.of(context).colorScheme.primary, - height: 11, + height: 12, ), - const SizedBox(width: 4), + const SizedBox(width: 10), Text( - '${currentIndex + 1} / ${ugcSeason.epCount}', + '${currentIndex + 1}/${ugcSeason.epCount}', style: Theme.of(context).textTheme.labelMedium, ), const SizedBox(width: 6), diff --git a/lib/pages/video/detail/reply/controller.dart b/lib/pages/video/detail/reply/controller.dart index 09a910fe..95398649 100644 --- a/lib/pages/video/detail/reply/controller.dart +++ b/lib/pages/video/detail/reply/controller.dart @@ -33,23 +33,17 @@ class VideoReplyController extends GetxController { Future queryReplyList({type = 'init'}) async { isLoadingMore = true; - var res = replyLevel == '1' - ? await ReplyHttp.replyList( - oid: aid!, - pageNum: ++currentPage, - type: ReplyType.video.index, - sort: sortType.index, - ) - : await ReplyHttp.replyReplyList( - oid: aid!, - root: rpid!, - pageNum: ++currentPage, - type: ReplyType.video.index, - ); + var res = await ReplyHttp.replyList( + oid: aid!, + pageNum: currentPage + 1, + type: ReplyType.video.index, + sort: sortType.index, + ); if (res['status']) { List replies = res['data'].replies; if (replies.isNotEmpty) { - noMore.value = '加载中'; + currentPage++; + noMore.value = '加载中...'; if (replyList.length == res['data'].page.acount) { noMore.value = '没有更多了'; } diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 80c6fedf..7de0529e 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -167,10 +167,10 @@ class _VideoReplyPanelState extends State child: TextButton.icon( onPressed: () => _videoReplyController.queryBySort(), - icon: const Icon(Icons.sort, size: 15), + icon: const Icon(Icons.sort, size: 16), label: Obx(() => Text( _videoReplyController.sortTypeLabel.value, - style: const TextStyle(fontSize: 12), + style: const TextStyle(fontSize: 13), )), ), ) @@ -207,9 +207,18 @@ class _VideoReplyPanelState extends State EdgeInsets.only(bottom: bottom), height: bottom + 100, child: Center( - child: Obx(() => Text( + child: Obx( + () => Text( _videoReplyController - .noMore.value)), + .noMore.value, + style: TextStyle( + fontSize: 12, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), + ), ), ); } else { diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 23ca4208..fff3f42a 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -187,7 +187,9 @@ class ReplyItem extends StatelessWidget { TextSpan( children: [ if (replyItem!.isTop!) - const WidgetSpan(child: UpTag(tagText: 'TOP')), + const WidgetSpan( + alignment: PlaceholderAlignment.top, + child: UpTag(tagText: 'TOP')), buildContent(context, replyItem!, replyReply, null), ], ), diff --git a/lib/pages/video/detail/replyReply/controller.dart b/lib/pages/video/detail/replyReply/controller.dart index 15c95c76..7bad5069 100644 --- a/lib/pages/video/detail/replyReply/controller.dart +++ b/lib/pages/video/detail/replyReply/controller.dart @@ -17,7 +17,7 @@ class VideoReplyReplyController extends GetxController { // 当前页 int currentPage = 0; bool isLoadingMore = false; - RxBool noMore = false.obs; + RxString noMore = ''.obs; // 当前回复的回复 ReplyItemModel? currentReplyItem; @@ -38,27 +38,25 @@ class VideoReplyReplyController extends GetxController { } isLoadingMore = true; var res = await ReplyHttp.replyReplyList( - oid: aid!, - root: rpid!, - pageNum: currentPage + 1, - type: replyType.index); + oid: aid!, + root: rpid!, + pageNum: currentPage + 1, + type: replyType.index, + ); if (res['status']) { - res['data'] = ReplyData.fromJson(res['data']); - if (res['data'].replies.isNotEmpty) { - currentPage = currentPage + 1; - noMore.value = false; - } else { - if (currentPage == 0) { - } else { - noMore.value = true; - return; + List replies = res['data'].replies; + if (replies.isNotEmpty) { + noMore.value = '加载中...'; + if (replyList.length == res['data'].page.count) { + noMore.value = '没有更多了'; } + } else { + // 未登录状态replies可能返回null + noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了'; } - if (res['data'].replies.length >= res['data'].page.count) { - noMore.value = true; - } + currentPage++; if (type == 'init') { - List replies = res['data'].replies; + // List replies = res['data'].replies; // 添加置顶回复 // if (res['data'].upper.top != null) { // bool flag = false; @@ -71,12 +69,12 @@ class VideoReplyReplyController extends GetxController { // replies.insert(0, res['data'].upper.top); // } // } - replies.insertAll(0, res['data'].topReplies); - res['data'].replies = replies; - replyList.value = res['data'].replies!; + // replies.insertAll(0, res['data'].topReplies); + // res['data'].replies = replies; + replyList.value = replies; } else { - replyList.addAll(res['data'].replies!); - res['data'].replies.addAll(replyList); + replyList.addAll(replies); + // res['data'].replies.addAll(replyList); } } isLoadingMore = false; diff --git a/lib/pages/video/detail/replyReply/view.dart b/lib/pages/video/detail/replyReply/view.dart index fc086f59..c6c37495 100644 --- a/lib/pages/video/detail/replyReply/view.dart +++ b/lib/pages/video/detail/replyReply/view.dart @@ -85,12 +85,9 @@ class _VideoReplyReplyPanelState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '评论详情', - style: Theme.of(context).textTheme.titleMedium, - ), + const Text('评论详情'), IconButton( - icon: const Icon(Icons.close), + icon: const Icon(Icons.close, size: 20), onPressed: () { _videoReplyReplyController.currentPage = 0; widget.closePanel!(); @@ -115,7 +112,7 @@ class _VideoReplyReplyPanelState extends State { controller: _videoReplyReplyController.scrollController, slivers: [ if (widget.firstFloor != null) ...[ - const SliverToBoxAdapter(child: SizedBox(height: 10)), + // const SliverToBoxAdapter(child: SizedBox(height: 10)), SliverToBoxAdapter( child: ReplyItem( replyItem: widget.firstFloor, @@ -160,10 +157,16 @@ class _VideoReplyReplyPanelState extends State { 100, child: Center( child: Obx( - () => Text(_videoReplyReplyController - .noMore.value - ? '没有更多了' - : '加载中'), + () => Text( + _videoReplyReplyController + .noMore.value, + style: TextStyle( + fontSize: 12, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), ), ), ); diff --git a/pubspec.lock b/pubspec.lock index dcc96c89..c49e2ccd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -430,9 +430,11 @@ packages: flutter_meedu_media_kit: dependency: "direct main" description: - path: "/Users/rr/Desktop/code/flutter_meedu_media_kit/package" - relative: false - source: path + path: package + ref: feature-custom + resolved-ref: d1d6d62f0059ec3501e21c9a94e72dae827162e9 + url: "https://github.com/guozhigq/flutter_meedu_media_kit.git" + source: git version: "4.2.12" flutter_smart_dialog: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index 705bcabb..c33d717b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,11 +81,11 @@ dependencies: dismissible_page: ^1.0.2 # 媒体播放 flutter_meedu_media_kit: - path: /Users/rr/Desktop/code/flutter_meedu_media_kit/package - # git: - # url: https://github.com/guozhigq/flutter_meedu_media_kit.git - # ref: feature-custom - # path: package + # path: /Users/rr/Desktop/code/flutter_meedu_media_kit/package + git: + url: https://github.com/guozhigq/flutter_meedu_media_kit.git + ref: feature-custom + path: package custom_sliding_segmented_control: ^1.7.5 # 加密 crypto: ^3.0.3