From a9ceb04d0767f712f5b301ef4e14109c898ac407 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Thu, 10 Jul 2025 12:46:05 +0800 Subject: [PATCH] opt dyn post Signed-off-by: bggRGjQaUbCoE --- lib/pages/dynamics_create/view.dart | 93 ++++++++++++++--------------- lib/pages/dynamics_repost/view.dart | 15 +++-- 2 files changed, 52 insertions(+), 56 deletions(-) diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index f59ed357..30447b43 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -284,63 +284,60 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { ), ); - PreferredSizeWidget _buildAppBar(ThemeData theme) => PreferredSize( - preferredSize: const Size.fromHeight(66), - child: Padding( - padding: const EdgeInsets.all(16), - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.center, - children: [ - Align( - alignment: Alignment.centerLeft, - child: SizedBox( - width: 34, - height: 34, - child: IconButton( - tooltip: '返回', - style: ButtonStyle( - padding: WidgetStateProperty.all(EdgeInsets.zero), - backgroundColor: WidgetStateProperty.resolveWith( - (states) { - return theme.colorScheme.secondaryContainer; - }, - ), - ), - onPressed: Get.back, - icon: Icon( - Icons.arrow_back_outlined, - size: 18, - color: theme.colorScheme.onSecondaryContainer, + Widget _buildAppBar(ThemeData theme) => Container( + height: 66, + padding: const EdgeInsets.all(16), + child: Stack( + clipBehavior: Clip.none, + children: [ + Align( + alignment: Alignment.centerLeft, + child: SizedBox( + width: 34, + height: 34, + child: IconButton( + tooltip: '返回', + style: ButtonStyle( + padding: WidgetStateProperty.all(EdgeInsets.zero), + backgroundColor: WidgetStateProperty.resolveWith( + (states) { + return theme.colorScheme.secondaryContainer; + }, ), ), + onPressed: Get.back, + icon: Icon( + Icons.arrow_back_outlined, + size: 18, + color: theme.colorScheme.onSecondaryContainer, + ), ), ), - const Center( - child: Text( - '发布动态', - style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), - ), + ), + const Center( + child: Text( + '发布动态', + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), - Align( - alignment: Alignment.centerRight, - child: Obx( - () => FilledButton.tonal( - onPressed: enablePublish.value ? onPublish : null, - style: FilledButton.styleFrom( - tapTargetSize: MaterialTapTargetSize.shrinkWrap, - padding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 10, - ), - visualDensity: VisualDensity.compact, + ), + Align( + alignment: Alignment.centerRight, + child: Obx( + () => FilledButton.tonal( + onPressed: enablePublish.value ? onPublish : null, + style: FilledButton.styleFrom( + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: const EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, ), - child: Text(_publishTime.value == null ? '发布' : '定时发布'), + visualDensity: VisualDensity.compact, ), + child: Text(_publishTime.value == null ? '发布' : '定时发布'), ), ), - ], - ), + ), + ], ), ); diff --git a/lib/pages/dynamics_repost/view.dart b/lib/pages/dynamics_repost/view.dart index fa55489a..de33d3e2 100644 --- a/lib/pages/dynamics_repost/view.dart +++ b/lib/pages/dynamics_repost/view.dart @@ -83,7 +83,7 @@ class _RepostPanelState extends CommonRichTextPubPageState { mainAxisSize: _isMax ? MainAxisSize.max : MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - _isMax ? const SizedBox(height: 16) : const SizedBox(height: 10), + if (!_isMax) const SizedBox(height: 10), _buildAppBar(theme), if (_isMax) ...[ Expanded( @@ -237,7 +237,7 @@ class _RepostPanelState extends CommonRichTextPubPageState { borderSide: BorderSide.none, gapPadding: 0, ), - contentPadding: const EdgeInsets.symmetric(vertical: 10), + contentPadding: EdgeInsets.zero, ), // inputFormatters: [LengthLimitingTextInputFormatter(1000)], ), @@ -267,11 +267,10 @@ class _RepostPanelState extends CommonRichTextPubPageState { ], ) : Container( - height: 34, - padding: const EdgeInsets.symmetric(horizontal: 16), + height: 66, + padding: const EdgeInsets.all(16), child: Stack( clipBehavior: Clip.none, - alignment: Alignment.center, children: [ Align( alignment: Alignment.centerLeft, @@ -367,15 +366,15 @@ class _RepostPanelState extends CommonRichTextPubPageState { {"raw_text": ":", "type": 1, "biz_id": ""}, ...item.modules.moduleDynamic!.desc!.richTextNodes!.map( (e) { - int? type; - String? bizId; + int type; + String bizId; switch (e.type) { case 'RICH_TEXT_NODE_TYPE_EMOJI': type = 9; bizId = ''; case 'RICH_TEXT_NODE_TYPE_AT': type = 2; - bizId = e.rid; + bizId = e.rid ?? ''; case 'RICH_TEXT_NODE_TYPE_TEXT': default: type = 1;