🐛 Bug fixes, and fixes

This commit is contained in:
2025-06-04 01:59:17 +08:00
parent 088cb4d5a2
commit 9e9d8b6fab
14 changed files with 435 additions and 106 deletions

View File

@ -43,7 +43,23 @@ class AttachmentPreview extends StatelessWidget {
return CloudFileWidget(item: item.data);
} else if (item.data is XFile) {
if (item.type == UniversalFileType.image) {
return Image.file(File(item.data.path));
final file = item.data as XFile;
if (file.path.isEmpty) {
return FutureBuilder<Uint8List>(
future: file.readAsBytes(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Image.memory(snapshot.data!);
}
return const Center(
child: CircularProgressIndicator(),
);
},
);
}
return kIsWeb
? Image.network(file.path)
: Image.file(File(file.path));
} else {
return Center(
child: Text(