⬆️ Support new attachments system

This commit is contained in:
2024-08-18 22:51:52 +08:00
parent 98749f42c0
commit 49f73f5f04
19 changed files with 154 additions and 151 deletions

View File

@ -20,7 +20,7 @@ class _PostEditorThumbnailDialogState extends State<PostEditorThumbnailDialog> {
showModalBottomSheet(
context: context,
builder: (context) => AttachmentEditorPopup(
usage: 'i.attachment',
pool: 'interactive',
singleMode: true,
imageOnly: true,
autoUpload: true,
@ -84,8 +84,7 @@ class _PostEditorThumbnailDialogState extends State<PostEditorThumbnailDialog> {
actions: [
TextButton(
onPressed: () {
widget.controller.thumbnail.value =
int.tryParse(_attachmentController.text);
widget.controller.thumbnail.value = _attachmentController.text;
Navigator.pop(context);
},
child: Text('confirm'.tr),

View File

@ -87,7 +87,7 @@ class _PostItemState extends State<PostItem> {
child: AspectRatio(
aspectRatio: 16 / 9,
child: AttachmentSelfContainedEntry(
id: widget.item.body['thumbnail'],
rid: widget.item.body['thumbnail'],
parentId: 'p${item.id}-thumbnail',
),
),
@ -292,8 +292,8 @@ class _PostItemState extends State<PostItem> {
@override
Widget build(BuildContext context) {
final List<int> attachments = item.body['attachments'] is List
? item.body['attachments']?.cast<int>()
final List<String> attachments = item.body['attachments'] is List
? item.body['attachments']?.cast<String>()
: List.empty();
final hasAttachment = attachments.isNotEmpty;