From 0df54fe6a553e7635e6c566cb82e28b24ba50e6e Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 26 Aug 2024 23:23:37 +0800 Subject: [PATCH] mod: fontweight --- lib/common/widgets/live_card.dart | 2 +- lib/common/widgets/video_card_h.dart | 175 +++++++++--------- lib/common/widgets/video_card_v.dart | 2 +- lib/pages/bangumi/widgets/bangumi_card_v.dart | 2 +- lib/pages/live/widgets/live_item.dart | 2 +- lib/pages/search/view.dart | 17 +- lib/pages/search_panel/view.dart | 3 +- .../detail/reply/widgets/reply_item.dart | 21 ++- lib/pages/video/detail/reply_reply/view.dart | 3 +- 9 files changed, 113 insertions(+), 114 deletions(-) diff --git a/lib/common/widgets/live_card.dart b/lib/common/widgets/live_card.dart index 7e6dee8d..1131f0dd 100644 --- a/lib/common/widgets/live_card.dart +++ b/lib/common/widgets/live_card.dart @@ -92,7 +92,7 @@ class LiveContent extends StatelessWidget { Text( liveItem.title as String, textAlign: TextAlign.start, - style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600), + style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w400), maxLines: 2, overflow: TextOverflow.ellipsis, ), diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index e26f4275..f9aa2409 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -44,94 +44,89 @@ class VideoCardH extends StatelessWidget { final String heroTag = Utils.makeHeroTag(aid); return Stack(children: [ Semantics( - label: Utils.videoItemSemantics(videoItem), - excludeSemantics: true, - child: GestureDetector( - onLongPress: () { - if (longPress != null) { - longPress!(); - } + label: Utils.videoItemSemantics(videoItem), + excludeSemantics: true, + child: InkWell( + borderRadius: BorderRadius.circular(12), + onLongPress: () { + if (longPress != null) { + longPress!(); + } + }, + onTap: () async { + if (type == 'ketang') { + SmartDialog.showToast('课堂视频暂不支持播放'); + return; + } + try { + final int cid = + videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid); + Get.toNamed('/video?bvid=$bvid&cid=$cid', + arguments: {'videoItem': videoItem, 'heroTag': heroTag}); + } catch (err) { + SmartDialog.showToast(err.toString()); + } + }, + child: LayoutBuilder( + builder: (BuildContext context, BoxConstraints boxConstraints) { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: StyleString.aspectRatio, + child: LayoutBuilder( + builder: (BuildContext context, + BoxConstraints boxConstraints) { + final double maxWidth = boxConstraints.maxWidth; + final double maxHeight = boxConstraints.maxHeight; + return Stack( + children: [ + Hero( + tag: heroTag, + child: NetworkImgLayer( + src: videoItem.pic as String, + width: maxWidth, + height: maxHeight, + ), + ), + if (videoItem.duration != 0) + PBadge( + text: Utils.timeFormat(videoItem.duration!), + right: 6.0, + bottom: 6.0, + type: 'gray', + ), + if (type != 'video') + PBadge( + text: type, + left: 6.0, + bottom: 6.0, + type: 'primary', + ), + // if (videoItem.rcmdReason != null && + // videoItem.rcmdReason.content != '') + // pBadge(videoItem.rcmdReason.content, context, + // 6.0, 6.0, null, null), + ], + ); + }, + ), + ), + VideoContent( + videoItem: videoItem, + source: source, + showOwner: showOwner, + showView: showView, + showDanmaku: showDanmaku, + showPubdate: showPubdate, + ) + ], + ); }, - // onLongPressEnd: (details) { - // if (longPressEnd != null) { - // longPressEnd!(); - // } - // }, - child: InkWell( - onTap: () async { - if (type == 'ketang') { - SmartDialog.showToast('课堂视频暂不支持播放'); - return; - } - try { - final int cid = videoItem.cid ?? - await SearchHttp.ab2c(aid: aid, bvid: bvid); - Get.toNamed('/video?bvid=$bvid&cid=$cid', - arguments: {'videoItem': videoItem, 'heroTag': heroTag}); - } catch (err) { - SmartDialog.showToast(err.toString()); - } - }, - child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints boxConstraints) { - return Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AspectRatio( - aspectRatio: StyleString.aspectRatio, - child: LayoutBuilder( - builder: (BuildContext context, - BoxConstraints boxConstraints) { - final double maxWidth = boxConstraints.maxWidth; - final double maxHeight = boxConstraints.maxHeight; - return Stack( - children: [ - Hero( - tag: heroTag, - child: NetworkImgLayer( - src: videoItem.pic as String, - width: maxWidth, - height: maxHeight, - ), - ), - if (videoItem.duration != 0) - PBadge( - text: Utils.timeFormat(videoItem.duration!), - right: 6.0, - bottom: 6.0, - type: 'gray', - ), - if (type != 'video') - PBadge( - text: type, - left: 6.0, - bottom: 6.0, - type: 'primary', - ), - // if (videoItem.rcmdReason != null && - // videoItem.rcmdReason.content != '') - // pBadge(videoItem.rcmdReason.content, context, - // 6.0, 6.0, null, null), - ], - ); - }, - ), - ), - VideoContent( - videoItem: videoItem, - source: source, - showOwner: showOwner, - showView: showView, - showDanmaku: showDanmaku, - showPubdate: showPubdate, - ) - ], - ); - }, - ), - ), - )), + ), + ), + ), if (source == 'normal') Positioned( bottom: 0, @@ -183,7 +178,7 @@ class VideoContent extends StatelessWidget { videoItem.title as String, textAlign: TextAlign.start, style: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize, height: 1.42, letterSpacing: 0.3, @@ -203,7 +198,7 @@ class VideoContent extends StatelessWidget { TextSpan( text: i['text'] as String, style: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, fontSize: Theme.of(context) .textTheme .bodyMedium! @@ -242,7 +237,7 @@ class VideoContent extends StatelessWidget { Expanded( flex: 0, child: Text( - "${pubdate} ${showOwner ? videoItem.owner.name : ''}", + "$pubdate ${showOwner ? videoItem.owner.name : ''}", maxLines: 1, style: TextStyle( fontWeight: FontWeight.w400, diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 423a6e48..9ec640ce 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -217,7 +217,7 @@ class VideoContent extends StatelessWidget { maxLines: 2, overflow: TextOverflow.ellipsis, style: const TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, height: 1.38, )), ), diff --git a/lib/pages/bangumi/widgets/bangumi_card_v.dart b/lib/pages/bangumi/widgets/bangumi_card_v.dart index acb98fd6..062a2a20 100644 --- a/lib/pages/bangumi/widgets/bangumi_card_v.dart +++ b/lib/pages/bangumi/widgets/bangumi_card_v.dart @@ -159,7 +159,7 @@ class BangumiContent extends StatelessWidget { bangumiItem.title, textAlign: TextAlign.start, style: const TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, letterSpacing: 0.3, ), maxLines: 1, diff --git a/lib/pages/live/widgets/live_item.dart b/lib/pages/live/widgets/live_item.dart index 5200952f..9ad23895 100644 --- a/lib/pages/live/widgets/live_item.dart +++ b/lib/pages/live/widgets/live_item.dart @@ -102,7 +102,7 @@ class LiveContent extends StatelessWidget { liveItem.title, textAlign: TextAlign.start, style: const TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, letterSpacing: 0.3, ), maxLines: 2, diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index ffeff4eb..a37940c8 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -103,25 +103,24 @@ class _SearchPageState extends State with RouteAware { } Widget _searchSuggest() { - SSearchController ssCtr = _searchController; return Obx( - () => ssCtr.searchSuggestList.isNotEmpty && - ssCtr.searchSuggestList.first.term != null && - ssCtr.controller.value.text != '' + () => _searchController.searchSuggestList.isNotEmpty && + _searchController.searchSuggestList.first.term != null && + _searchController.controller.value.text != '' ? ListView.builder( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: ssCtr.searchSuggestList.length, + itemCount: _searchController.searchSuggestList.length, itemBuilder: (context, index) { return InkWell( customBorder: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4), ), - onTap: () => ssCtr - .onClickKeyword(ssCtr.searchSuggestList[index].term!), + onTap: () => _searchController.onClickKeyword( + _searchController.searchSuggestList[index].term!), child: Padding( padding: const EdgeInsets.only(left: 20, top: 9, bottom: 9), - child: ssCtr.searchSuggestList[index].textRich, + child: _searchController.searchSuggestList[index].textRich, ), ); }, @@ -152,7 +151,7 @@ class _SearchPageState extends State with RouteAware { height: 34, child: TextButton.icon( style: ButtonStyle( - padding: MaterialStateProperty.all(const EdgeInsets.only( + padding: WidgetStateProperty.all(const EdgeInsets.only( left: 10, top: 6, bottom: 6, right: 10)), ), onPressed: () => ctr.queryHotSearchList(), diff --git a/lib/pages/search_panel/view.dart b/lib/pages/search_panel/view.dart index 9f47504b..53b06625 100644 --- a/lib/pages/search_panel/view.dart +++ b/lib/pages/search_panel/view.dart @@ -126,7 +126,8 @@ class _SearchPanelState extends State errMsg: '没有相关数据', fn: () { setState(() { - _searchPanelController.onSearch(); + _futureBuilderFuture = + _searchPanelController.onSearch(); }); }, ), diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index c322089a..b73d22cc 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -29,6 +29,7 @@ class ReplyItem extends StatelessWidget { this.showReplyRow = true, this.replyReply, this.replyType, + this.needDivider = true, super.key, }); final ReplyItemModel? replyItem; @@ -37,6 +38,7 @@ class ReplyItem extends StatelessWidget { final bool? showReplyRow; final Function? replyReply; final ReplyType? replyType; + final bool needDivider; @override Widget build(BuildContext context) { @@ -66,15 +68,16 @@ class ReplyItem extends StatelessWidget { padding: const EdgeInsets.fromLTRB(12, 14, 8, 5), child: content(context), ), - Divider( - indent: 55, - endIndent: 15, - height: 0.3, - color: Theme.of(context) - .colorScheme - .onInverseSurface - .withOpacity(0.5), - ) + if (needDivider) + Divider( + indent: 55, + endIndent: 15, + height: 0.3, + color: Theme.of(context) + .colorScheme + .onInverseSurface + .withOpacity(0.5), + ) ], ), ), diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index a1d18889..e593d37d 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -75,7 +75,7 @@ class _VideoReplyReplyPanelState extends State { return Container( height: widget.source == 'videoDetail' ? Utils.getSheetHeight(context) : null, - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, child: Column( children: [ if (widget.source == 'videoDetail') @@ -125,6 +125,7 @@ class _VideoReplyReplyPanelState extends State { }, replyType: widget.replyType, replyReply: (replyItem) => replyReply(replyItem), + needDivider: false, ), ), SliverToBoxAdapter(