Attachment rendering

This commit is contained in:
2025-04-23 00:07:20 +08:00
parent 8bb365c974
commit 36905e0cd5
18 changed files with 519 additions and 113 deletions

View File

@ -3,15 +3,18 @@ import 'package:flutter/material.dart';
class UniversalImage extends StatelessWidget {
final String uri;
const UniversalImage({super.key, required this.uri});
final String? blurHash;
const UniversalImage({super.key, required this.uri, this.blurHash});
@override
Widget build(BuildContext context) {
return HtmlElementView(
viewType: 'native-image',
onPlatformViewCreated: (int viewId) {
final element = web.HTMLImageElement()..src = uri;
web.document.body!.append(element);
return HtmlElementView.fromTagName(
tagName: 'img',
onElementCreated: (element) {
element as web.HTMLImageElement;
element.src = uri;
element.style.width = '100%';
element.style.height = '100%';
},
);
}