From 4de180c23aa214b7a6bbe20fc171ed23d93c5958 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 7 Apr 2025 18:20:45 +0800 Subject: [PATCH] opt: save panel Signed-off-by: bggRGjQaUbCoE --- lib/common/widgets/save_panel.dart | 140 ++++++++++-------- lib/pages/dynamics/detail/view.dart | 16 +- lib/pages/dynamics/widgets/content_panel.dart | 4 +- lib/pages/dynamics/widgets/dynamic_panel.dart | 4 +- lib/pages/dynamics/widgets/forward_panel.dart | 31 ++-- lib/pages/html/view.dart | 16 +- 6 files changed, 132 insertions(+), 79 deletions(-) diff --git a/lib/common/widgets/save_panel.dart b/lib/common/widgets/save_panel.dart index d326ab06..b39a3f57 100644 --- a/lib/common/widgets/save_panel.dart +++ b/lib/common/widgets/save_panel.dart @@ -131,7 +131,7 @@ class _SavePanelState extends State { late final rootId = hasRoot ? _item.root : _item.id; late final anchor = hasRoot ? 'anchor=${_item.id}&' : ''; late final enterUri = - 'bilibili://following/detail/${Get.parameters['id']}'; + 'bilibili://following/detail/${Get.parameters['id'] ?? Get.arguments?['id']}'; uri = 'bilibili://comment/detail/$type/$oid/$rootId/?${anchor}enterUri=$enterUri'; } catch (_) {} @@ -360,78 +360,94 @@ class _SavePanelState extends State { ], ), ), - Row( + Stack( + clipBehavior: Clip.none, children: [ - Image.asset( - 'assets/images/logo/logo_2.png', - width: 100, - color: Theme.of(context) - .colorScheme - .onSurfaceVariant, - ), - if (uri.isNotEmpty) ...[ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, + if (uri.isNotEmpty) + Align( + alignment: Alignment.centerRight, + child: Row( children: [ - if (uname?.isNotEmpty == true) ...[ - Text( - '@$uname', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Theme.of(context) - .colorScheme - .primary, - ), - ), - const SizedBox(height: 4), - ], - Text( - '识别二维码,$viewType$itemType', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .onSurfaceVariant, + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + if (uname?.isNotEmpty == true) ...[ + Text( + '@$uname', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .primary, + ), + ), + const SizedBox(height: 4), + ], + Text( + '识别二维码,$viewType$itemType', + textAlign: TextAlign.end, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSurfaceVariant, + ), + ), + const SizedBox(height: 4), + Text( + DateTime.now() + .toString() + .split('.') + .first, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 13, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), + ], ), ), - const SizedBox(height: 4), - Text( - DateTime.now() - .toString() - .split('.') - .first, - style: TextStyle( - fontSize: 13, - color: Theme.of(context) - .colorScheme - .outline, + Container( + width: 100, + height: 100, + padding: const EdgeInsets.all(12), + child: Container( + color: Get.isDarkMode + ? Colors.white + : Theme.of(context) + .colorScheme + .surface, + padding: const EdgeInsets.all(3), + child: PrettyQrView.data( + data: uri, + decoration: + const PrettyQrDecoration( + shape: PrettyQrRoundedSymbol( + borderRadius: BorderRadius.zero, + ), + ), + ), ), ), ], ), ), - Container( + Align( + alignment: Alignment.centerLeft, + child: Image.asset( + 'assets/images/logo/logo_2.png', width: 100, - height: 100, - padding: const EdgeInsets.all(12), - child: Container( - color: Get.isDarkMode - ? Colors.white - : Theme.of(context).colorScheme.surface, - padding: const EdgeInsets.all(3), - child: PrettyQrView.data( - data: uri, - decoration: const PrettyQrDecoration( - shape: PrettyQrRoundedSymbol( - borderRadius: BorderRadius.zero, - ), - ), - ), - ), + color: Theme.of(context) + .colorScheme + .onSurfaceVariant, ), - ], + ), ], ), ], diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index f1ea825e..01a6fd71 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -190,7 +190,13 @@ class _DynamicDetailPageState extends State ), ); if (this.context.orientation == Orientation.portrait) { - Get.to(replyReplyPage); + Get.to( + replyReplyPage, + routeName: 'dynamicDetail-Copy', + arguments: { + 'item': _dynamicDetailController.item, + }, + ); } else { ScaffoldState? scaffoldState = Scaffold.maybeOf(context); if (scaffoldState != null) { @@ -214,7 +220,13 @@ class _DynamicDetailPageState extends State ), ); } else { - Get.to(replyReplyPage); + Get.to( + replyReplyPage, + routeName: 'dynamicDetail-Copy', + arguments: { + 'item': _dynamicDetailController.item, + }, + ); } } }); diff --git a/lib/pages/dynamics/widgets/content_panel.dart b/lib/pages/dynamics/widgets/content_panel.dart index 50c9f8a4..b2aff21e 100644 --- a/lib/pages/dynamics/widgets/content_panel.dart +++ b/lib/pages/dynamics/widgets/content_panel.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'rich_node_panel.dart'; -Widget content(context, item, source, callback) { +Widget content(isSave, context, item, source, callback) { InlineSpan picsNodes() { return WidgetSpan( child: LayoutBuilder( @@ -55,7 +55,7 @@ Widget content(context, item, source, callback) { child: Text.rich( /// fix 默认20px高度 style: TextStyle( - fontSize: source == 'detail' ? 16 : 15, + fontSize: source == 'detail' && isSave != true ? 16 : 15, ), richNodes, maxLines: source == 'detail' ? null : 6, diff --git a/lib/pages/dynamics/widgets/dynamic_panel.dart b/lib/pages/dynamics/widgets/dynamic_panel.dart index f93b3dc7..7641fc5a 100644 --- a/lib/pages/dynamics/widgets/dynamic_panel.dart +++ b/lib/pages/dynamics/widgets/dynamic_panel.dart @@ -137,8 +137,8 @@ class DynamicPanel extends StatelessWidget { ), if (item!.modules!.moduleDynamic!.desc != null || item!.modules!.moduleDynamic!.major != null) - content(context, item, source, callback), - forWard(item, context, source, callback), + content(isSave, context, item, source, callback), + forWard(isSave, item, context, source, callback), const SizedBox(height: 2), if (source == null) ActionPanel(item: item), if (source == 'detail' && isSave != true) const SizedBox(height: 12), diff --git a/lib/pages/dynamics/widgets/forward_panel.dart b/lib/pages/dynamics/widgets/forward_panel.dart index acb6399a..70db5270 100644 --- a/lib/pages/dynamics/widgets/forward_panel.dart +++ b/lib/pages/dynamics/widgets/forward_panel.dart @@ -68,7 +68,8 @@ Widget _blockedItem(BuildContext context, item, source) { ); } -Widget forWard(item, BuildContext context, source, callback, {floor = 1}) { +Widget forWard(isSave, item, BuildContext context, source, callback, + {floor = 1}) { switch (item.type) { // 图文 case 'DYNAMIC_TYPE_DRAW': @@ -124,10 +125,16 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) { Text.rich( richNodes, // 被转发状态(floor=2) 隐藏 - maxLines: source == 'detail' && floor != 2 ? null : 4, - overflow: source == 'detail' && floor != 2 + maxLines: isSave == true ? null - : TextOverflow.ellipsis, + : source == 'detail' && floor != 2 + ? null + : 4, + overflow: isSave == true + ? null + : source == 'detail' && floor != 2 + ? null + : TextOverflow.ellipsis, ), if (hasPics) ...[ Text.rich( @@ -254,8 +261,8 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) { child: Container( padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8), color: Theme.of(context).dividerColor.withOpacity(0.08), - child: - forWard(item.orig, context, source, callback, floor: floor + 1), + child: forWard(isSave, item.orig, context, source, callback, + floor: floor + 1), ), ); // 直播 @@ -300,10 +307,16 @@ Widget forWard(item, BuildContext context, source, callback, {floor = 1}) { Text.rich( richNodes, // 被转发状态(floor=2) 隐藏 - maxLines: source == 'detail' && floor != 2 ? null : 4, - overflow: source == 'detail' && floor != 2 + maxLines: isSave == true ? null - : TextOverflow.ellipsis, + : source == 'detail' && floor != 2 + ? null + : 4, + overflow: isSave == true + ? null + : source == 'detail' && floor != 2 + ? null + : TextOverflow.ellipsis, ), ], ) diff --git a/lib/pages/html/view.dart b/lib/pages/html/view.dart index 3cbbe9d9..c4b0775d 100644 --- a/lib/pages/html/view.dart +++ b/lib/pages/html/view.dart @@ -187,7 +187,13 @@ class _HtmlRenderPageState extends State ), ); if (this.context.orientation == Orientation.portrait) { - Get.to(replyReplyPage); + Get.to( + replyReplyPage, + routeName: 'htmlRender-Copy', + arguments: { + 'id': _htmlRenderCtr.id, + }, + ); } else { ScaffoldState? scaffoldState = Scaffold.maybeOf(context); if (scaffoldState != null) { @@ -211,7 +217,13 @@ class _HtmlRenderPageState extends State ), ); } else { - Get.to(replyReplyPage); + Get.to( + replyReplyPage, + routeName: 'htmlRender-Copy', + arguments: { + 'id': _htmlRenderCtr.id, + }, + ); } } });