From 68838f0b597c712f42a0b8d7b49f6255339e2771 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 7 Oct 2024 22:51:02 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E4=B8=93=E6=A0=8F=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/opus/view.dart | 2 +- lib/pages/read/controller.dart | 2 +- lib/pages/read/view.dart | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/pages/opus/view.dart b/lib/pages/opus/view.dart index 434a9405..42c0c419 100644 --- a/lib/pages/opus/view.dart +++ b/lib/pages/opus/view.dart @@ -157,7 +157,7 @@ class _OpusPageState extends State { Container( alignment: TextHelper.getAlignment(paragraph.align), margin: const EdgeInsets.only(bottom: 10), - child: Text.rich( + child: SelectableText.rich( TextSpan( children: paragraph.text?.nodes?.map((node) { return TextHelper.buildTextSpan( diff --git a/lib/pages/read/controller.dart b/lib/pages/read/controller.dart index 178ebfda..b580b964 100644 --- a/lib/pages/read/controller.dart +++ b/lib/pages/read/controller.dart @@ -20,7 +20,7 @@ class ReadPageController extends GetxController { super.onInit(); title.value = Get.parameters['title'] ?? ''; id = Get.parameters['id']!; - articleType = Get.parameters['articleType']!; + articleType = Get.parameters['articleType'] ?? 'read'; url = 'https://www.bilibili.com/read/cv$id'; scrollController.addListener(_scrollListener); fetchViewInfo(); diff --git a/lib/pages/read/view.dart b/lib/pages/read/view.dart index d37eeae5..710934eb 100644 --- a/lib/pages/read/view.dart +++ b/lib/pages/read/view.dart @@ -126,7 +126,6 @@ class _ReadPageState extends State { Widget _buildContent(ReadDataModel cvData) { final List picList = _extractPicList(cvData); final List imgList = extractDataSrc(cvData.readInfo!.content!); - return Padding( padding: EdgeInsets.fromLTRB( 16, 0, 16, MediaQuery.of(context).padding.bottom + 40), @@ -163,9 +162,11 @@ class _ReadPageState extends State { padding: const EdgeInsets.only(bottom: 20), child: _buildAuthorWidget(cvData), ), - HtmlRender( - htmlContent: cvData.readInfo!.content!, - imgList: imgList, + SelectionArea( + child: HtmlRender( + htmlContent: cvData.readInfo!.content!, + imgList: imgList, + ), ), ], ); @@ -206,7 +207,7 @@ class _ReadPageState extends State { return Container( alignment: TextHelper.getAlignment(paragraph.align), margin: const EdgeInsets.only(bottom: 10), - child: Text.rich( + child: SelectableText.rich( TextSpan( children: paragraph.text?.nodes?.map((node) { return TextHelper.buildTextSpan(node, paragraph.align, context);