mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 08:36:17 +08:00
This reverts commit 89a077be5c.
This commit is contained in:
committed by
GitHub
parent
89a077be5c
commit
db3b74e33f
@@ -269,28 +269,24 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
final maxWidth = constraints.maxWidth - 2 * padding - 24;
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: padding),
|
||||
child: SelectionArea(
|
||||
child: CustomScrollView(
|
||||
controller: _articleCtr.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildContent(theme, maxWidth),
|
||||
SelectionContainer.disabled(
|
||||
child: SliverToBoxAdapter(
|
||||
SliverToBoxAdapter(
|
||||
child: Divider(
|
||||
thickness: 8,
|
||||
color: theme.dividerColor
|
||||
.withValues(alpha: 0.05),
|
||||
color:
|
||||
theme.dividerColor.withValues(alpha: 0.05),
|
||||
),
|
||||
)),
|
||||
SelectionContainer.disabled(
|
||||
child: _buildReplyHeader(theme)),
|
||||
SelectionContainer.disabled(
|
||||
child: Obx(() => _buildReplyList(theme,
|
||||
_articleCtr.loadingState.value))),
|
||||
),
|
||||
_buildReplyHeader(theme),
|
||||
Obx(() => _buildReplyList(
|
||||
theme, _articleCtr.loadingState.value)),
|
||||
],
|
||||
),
|
||||
));
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Row(
|
||||
@@ -302,8 +298,7 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
builder: (context, constraints) {
|
||||
final maxWidth =
|
||||
constraints.maxWidth - padding / 4 - 24;
|
||||
return SelectionArea(
|
||||
child: CustomScrollView(
|
||||
return CustomScrollView(
|
||||
controller: _articleCtr.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
@@ -317,7 +312,7 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
sliver: _buildContent(theme, maxWidth),
|
||||
),
|
||||
],
|
||||
));
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -426,10 +421,10 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
?.pics?.isNotEmpty ==
|
||||
true)
|
||||
SliverToBoxAdapter(
|
||||
child: SelectionContainer.disabled(child: Builder(
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final pics = _articleCtr
|
||||
.opusData!.modules.moduleTop!.display!.album!.pics!;
|
||||
final pics = _articleCtr.opusData!.modules.moduleTop!
|
||||
.display!.album!.pics!;
|
||||
final length = pics.length;
|
||||
final first = pics.first;
|
||||
double height;
|
||||
@@ -461,7 +456,8 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => context.imageView(
|
||||
imgList: pics
|
||||
.map((e) => SourceModel(url: e.url!))
|
||||
.map(
|
||||
(e) => SourceModel(url: e.url!))
|
||||
.toList(),
|
||||
initialPage: index,
|
||||
),
|
||||
@@ -505,10 +501,10 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
],
|
||||
);
|
||||
},
|
||||
))),
|
||||
),
|
||||
),
|
||||
if (_articleCtr.summary.title != null)
|
||||
SelectionContainer.disabled(
|
||||
child: SliverToBoxAdapter(
|
||||
SliverToBoxAdapter(
|
||||
child: Text(
|
||||
_articleCtr.summary.title!,
|
||||
style: const TextStyle(
|
||||
@@ -516,9 +512,8 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
SelectionContainer.disabled(
|
||||
child: SliverToBoxAdapter(
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: GestureDetector(
|
||||
@@ -559,16 +554,15 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
if (_articleCtr.type != 'read' &&
|
||||
_articleCtr.opusData?.modules.moduleCollection != null)
|
||||
SelectionContainer.disabled(
|
||||
child: SliverToBoxAdapter(
|
||||
SliverToBoxAdapter(
|
||||
child: opusCollection(
|
||||
theme,
|
||||
_articleCtr.opusData!.modules.moduleCollection!,
|
||||
),
|
||||
)),
|
||||
),
|
||||
content,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -126,7 +126,8 @@ Widget htmlRender({
|
||||
margin: Margins.zero,
|
||||
),
|
||||
};
|
||||
return element != null
|
||||
return SelectionArea(
|
||||
child: element != null
|
||||
? Html.fromElement(
|
||||
documentElement: element,
|
||||
extensions: extensions,
|
||||
@@ -136,5 +137,6 @@ Widget htmlRender({
|
||||
data: html,
|
||||
extensions: extensions,
|
||||
style: style,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ class OpusContent extends StatelessWidget {
|
||||
switch (element.paraType) {
|
||||
case 1 || 4:
|
||||
final isQuote = element.paraType == 4;
|
||||
Widget widget = Text.rich(
|
||||
Widget widget = SelectionArea(
|
||||
child: Text.rich(
|
||||
textAlign: element.align == 1 ? TextAlign.center : null,
|
||||
TextSpan(
|
||||
children: element.text?.nodes?.map((item) {
|
||||
@@ -139,6 +140,7 @@ class OpusContent extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}).toList()),
|
||||
),
|
||||
);
|
||||
if (isQuote) {
|
||||
widget = Container(
|
||||
@@ -165,8 +167,7 @@ class OpusContent extends StatelessWidget {
|
||||
final height = width == null || pic.height == null
|
||||
? null
|
||||
: width * pic.height! / pic.width!;
|
||||
return SelectionContainer.disabled(
|
||||
child: Hero(
|
||||
return Hero(
|
||||
tag: pic.url!,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@@ -191,26 +192,25 @@ class OpusContent extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
} else {
|
||||
return SelectionContainer.disabled(
|
||||
child: imageView(
|
||||
return imageView(
|
||||
maxWidth,
|
||||
element.pic!.pics!
|
||||
.map((e) =>
|
||||
ImageModel(width: 1, height: 1, url: e.url!))
|
||||
.toList()));
|
||||
.map(
|
||||
(e) => ImageModel(width: 1, height: 1, url: e.url!))
|
||||
.toList());
|
||||
}
|
||||
case 3 when (element.line != null):
|
||||
return SelectionContainer.disabled(
|
||||
child: CachedNetworkImage(
|
||||
return CachedNetworkImage(
|
||||
width: maxWidth,
|
||||
fit: BoxFit.contain,
|
||||
height: element.line!.pic!.height?.toDouble(),
|
||||
imageUrl: Utils.thumbnailImgUrl(element.line!.pic!.url!),
|
||||
));
|
||||
);
|
||||
case 5 when (element.list != null):
|
||||
return Text.rich(
|
||||
return SelectionArea(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: element.list!.items?.indexed.map((entry) {
|
||||
return TextSpan(
|
||||
@@ -228,6 +228,7 @@ class OpusContent extends StatelessWidget {
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
case 6:
|
||||
return Material(
|
||||
@@ -527,7 +528,7 @@ class OpusContent extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
case 7 when (element.code != null):
|
||||
final highlight = Highlight()
|
||||
final Highlight highlight = Highlight()
|
||||
..registerLanguages(builtinAllLanguages);
|
||||
final HighlightResult result = highlight.highlightAuto(
|
||||
element.code!.content!,
|
||||
@@ -538,7 +539,7 @@ class OpusContent extends StatelessWidget {
|
||||
.replaceAll('language-', '')
|
||||
.replaceAll('like', ''),
|
||||
]);
|
||||
final renderer = TextSpanRenderer(
|
||||
final TextSpanRenderer renderer = TextSpanRenderer(
|
||||
const TextStyle(), builtinAllThemes['github']!);
|
||||
result.render(renderer);
|
||||
return Container(
|
||||
@@ -548,35 +549,41 @@ class OpusContent extends StatelessWidget {
|
||||
color: colorScheme.onInverseSurface,
|
||||
),
|
||||
width: double.infinity,
|
||||
child: Text.rich(renderer.span!),
|
||||
child: SelectionArea(child: Text.rich(renderer.span!)),
|
||||
);
|
||||
default:
|
||||
debugPrint('unknown type ${element.paraType}');
|
||||
if (element.text?.nodes?.isNotEmpty == true) {
|
||||
return Text.rich(
|
||||
return SelectionArea(
|
||||
child: Text.rich(
|
||||
textAlign: element.align == 1 ? TextAlign.center : null,
|
||||
TextSpan(
|
||||
children: element.text!.nodes!
|
||||
.map<TextSpan>((item) => _getSpan(item.word))
|
||||
.toList()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Text(
|
||||
return SelectionArea(
|
||||
child: Text(
|
||||
'不支持的类型 (${element.paraType})',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
return Text(
|
||||
return SelectionArea(
|
||||
child: Text(
|
||||
'错误的类型 $e',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -590,7 +597,7 @@ Widget moduleBlockedItem(
|
||||
BoxDecoration? bgImg() {
|
||||
return moduleBlocked.bgImg == null
|
||||
? null
|
||||
: (BoxDecoration(
|
||||
: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
image: CachedNetworkImageProvider(
|
||||
@@ -601,7 +608,7 @@ Widget moduleBlockedItem(
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
Widget icon(double width) {
|
||||
@@ -683,8 +690,7 @@ Widget moduleBlockedItem(
|
||||
),
|
||||
);
|
||||
}
|
||||
return SelectionContainer.disabled(
|
||||
child: Container(
|
||||
return Container(
|
||||
decoration: bgImg(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
@@ -720,7 +726,7 @@ Widget moduleBlockedItem(
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
Widget opusCollection(ThemeData theme, ModuleCollection item) {
|
||||
|
||||
@@ -25,14 +25,13 @@ class ReadOpus extends StatelessWidget {
|
||||
try {
|
||||
final item = ops![index];
|
||||
if (item.insert is String) {
|
||||
return Text(item.insert);
|
||||
return SelectableText(item.insert);
|
||||
}
|
||||
|
||||
if (item.insert is Insert) {
|
||||
InsertCard card = item.insert.card;
|
||||
if (card.url?.isNotEmpty == true) {
|
||||
return SelectionContainer.disabled(
|
||||
child: GestureDetector(
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
switch (item.attributes?.clazz) {
|
||||
case 'article-card card':
|
||||
@@ -61,7 +60,7 @@ class ReadOpus extends StatelessWidget {
|
||||
imageUrl: Utils.thumbnailImgUrl(card.url, 60),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user