From 5c3dce01800feba2570ef280edf82cb6f35dd734 Mon Sep 17 00:00:00 2001 From: realth000 Date: Sat, 17 Aug 2024 01:01:07 +0800 Subject: [PATCH] feat(*): Update widgets layout --- CHANGELOG.md | 1 + lib/features/forum/view/forum_page.dart | 2 +- lib/widgets/card/post_card/post_card.dart | 59 +++++++++++------------ 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 170cd160..c79ba99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - app:图片加载时显示占位图片的大小调整为80x80。 - app:更新app描述和版权页样式。 - app:去除各种卡片的高度,更符合Material 3。 +- app: 优化布局。 - 关于:更新版本号格式,更符合semver。 - 分区:某些情况下分区为空时显示登录按钮。 - 分区:分区内筛选帖子的选项现在会一直显示在帖子列表顶部。 diff --git a/lib/features/forum/view/forum_page.dart b/lib/features/forum/view/forum_page.dart index 5be386e2..14e7cd2d 100644 --- a/lib/features/forum/view/forum_page.dart +++ b/lib/features/forum/view/forum_page.dart @@ -307,7 +307,7 @@ class _ForumPageState extends State _buildNormalThreadFilterRow(context, state), Expanded( child: Padding( - padding: edgeInsetsL12T4R12B24, + padding: edgeInsetsL12T4R12, child: CustomScrollView( controller: _threadScrollController, physics: physics, diff --git a/lib/widgets/card/post_card/post_card.dart b/lib/widgets/card/post_card/post_card.dart index 69de3fea..429a0af9 100644 --- a/lib/widgets/card/post_card/post_card.dart +++ b/lib/widgets/card/post_card/post_card.dart @@ -341,39 +341,36 @@ class _PostCardState extends State Widget build(BuildContext context) { super.build(context); - return Padding( - padding: edgeInsetsL12R12B12, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Post author user info. - _buildAuthorRow(context), - // Last edit status. - if (widget.post.lastEditUsername != null && - widget.post.lastEditTime != null) - _buildLastEditInfoRow(context), - // Post body + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Post author user info. + _buildAuthorRow(context), + // Last edit status. + if (widget.post.lastEditUsername != null && + widget.post.lastEditTime != null) + _buildLastEditInfoRow(context), + // Post body + sizedBoxW12H12, + _buildPostBody(context), + // 红包 if any. + if (widget.post.locked.isNotEmpty) + ...widget.post.locked.where((e) => e.isValid()).map(LockedCard.new), + if (widget.post.packetUrl != null) ...[ sizedBoxW12H12, - _buildPostBody(context), - // 红包 if any. - if (widget.post.locked.isNotEmpty) - ...widget.post.locked.where((e) => e.isValid()).map(LockedCard.new), - if (widget.post.packetUrl != null) ...[ - sizedBoxW12H12, - PacketCard(widget.post.packetUrl!), - ], - // Rate status if any. - if (widget.post.rate != null) ...[ - sizedBoxW12H12, - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 712), - child: RateCard(widget.post.rate!), - ), - ], - // Context menu. - _buildContextMenu(context), + PacketCard(widget.post.packetUrl!), ], - ), + // Rate status if any. + if (widget.post.rate != null) ...[ + sizedBoxW12H12, + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 712), + child: RateCard(widget.post.rate!), + ), + ], + // Context menu. + _buildContextMenu(context), + ], ); }