From a6357675611670971e4e0f4edd631c6b1d8aef8d Mon Sep 17 00:00:00 2001 From: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Date: Sun, 31 Aug 2025 13:06:34 +0800 Subject: [PATCH] opt: scheme --- lib/pages/save_panel/view.dart | 19 +++++++------------ lib/utils/app_scheme.dart | 12 +++++++----- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/pages/save_panel/view.dart b/lib/pages/save_panel/view.dart index b325061f..6cb07500 100644 --- a/lib/pages/save_panel/view.dart +++ b/lib/pages/save_panel/view.dart @@ -68,7 +68,7 @@ class _SavePanelState extends State { bool showBottom = true; // item - dynamic get _item => widget.item; + Object get _item => widget.item; late String viewType = '查看'; late String itemType = '内容'; @@ -135,8 +135,6 @@ class _SavePanelState extends State { late final rootId = hasRoot ? reply.root : reply.id; late final anchor = hasRoot ? 'anchor=${reply.id}&' : ''; late final enterUri = parseDyn(dynItem); - viewType = '查看'; - itemType = '评论'; uri = switch (type) { 1 || 11 || 12 => 'bilibili://comment/detail/$type/${dynItem.basic!.ridStr}/$rootId/?${anchor}enterUri=$enterUri', @@ -331,19 +329,19 @@ class _SavePanelState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (_item is ReplyInfo) + if (_item case ReplyInfo reply) IgnorePointer( child: ReplyItemGrpc( - replyItem: _item, + replyItem: reply, replyLevel: 0, needDivider: false, upMid: widget.upMid, ), ) - else if (_item is DynamicItemModel) + else if (_item case DynamicItemModel dyn) IgnorePointer( child: DynamicPanel( - item: _item, + item: dyn, isDetail: true, isSave: true, maxWidth: maxWidth - 24, @@ -423,9 +421,9 @@ class _SavePanelState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, + spacing: 4, children: [ - if (uname?.isNotEmpty == - true) ...[ + if (uname?.isNotEmpty == true) Text( '@$uname', maxLines: 1, @@ -437,8 +435,6 @@ class _SavePanelState extends State { .primary, ), ), - const SizedBox(height: 4), - ], Text( '识别二维码,$viewType$itemType', textAlign: TextAlign.end, @@ -448,7 +444,6 @@ class _SavePanelState extends State { .onSurfaceVariant, ), ), - const SizedBox(height: 4), Text( DateUtil.longFormatDs .format( diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index db76d40e..0455ab29 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -133,11 +133,13 @@ class PiliScheme { IconButton( tooltip: '前往原视频', onPressed: () { - String? enterUri = uri - .toString() - .split('?') - .first; // to check - routePush(Uri.parse(enterUri)); + routePush( + Uri( + scheme: uri.scheme, + host: uri.host, + path: uri.path, + ), + ); }, icon: const Icon(Icons.open_in_new), ),