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