build method
- BuildContext context,
- QuillController controller,
- Embed node,
- bool readOnly,
- bool inline,
- TextStyle? textStyle
override
Implementation
@override
Widget build(
BuildContext context,
QuillController controller,
Embed node,
bool readOnly,
bool inline,
TextStyle? textStyle,
) {
if (node.value.data == null) return Container();
final imageUrl = node.value.data.toString();
if (imageUrl.contains("firebasestorage.googleapis.com")) {
// This is a Firebase Storage image: no need to proxy it, so we can use
// the CachedNetworkImage widget. This is faster and more efficient.
return CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.contain,
placeholder: (_, __) => const SizedBox(
height: 96,
child: Center(child: CircularProgressIndicator()),
),
errorWidget: (_, __, ___) => SizedBox(
height: 96,
child: Center(child: Text(t.image.loadError)),
),
);
}
return Consumer(
builder: (context, ref, _) {
return CorsProxyImage(imageUrl: imageUrl);
},
);
}