Preload post quoted content

This commit is contained in:
LittleSheep 2024-12-12 00:48:03 +08:00
parent 018441ea0b
commit 717bccbf3f
2 changed files with 32 additions and 8 deletions

View File

@ -23,6 +23,11 @@ class SnPostContentProvider {
if (out[i].body['thumbnail'] != null) {
rids.add(out[i].body['thumbnail']);
}
if (out[i].repostTo != null) {
out[i] = out[i].copyWith(
repostTo: await _preloadRelatedDataSingle(out[i].repostTo!),
);
}
}
final attachments = await _attach.getMultiple(rids.toList());

View File

@ -637,8 +637,10 @@ class _PostQuoteContent extends StatelessWidget {
width: 1,
),
),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.only(top: 8),
child: Column(
children: [
Column(
children: [
_PostContentHeader(
data: child,
@ -647,6 +649,23 @@ class _PostQuoteContent extends StatelessWidget {
onDeleted: () {},
).padding(bottom: 4),
_PostContentBody(data: child),
if (child.visibility > 0) _PostVisibilityHint(data: child).padding(top: 4),
],
).padding(horizontal: 16),
if (child.preload?.attachments?.isNotEmpty ?? false)
ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
child: AttachmentList(
data: child.preload!.attachments!,
listPadding: const EdgeInsets.symmetric(horizontal: 12),
),
).padding(
top: 8,
bottom: (child.preload?.attachments?.length ?? 0) > 1 ? 12 : 0,
),
],
),
),