Open VaarunSinha opened 2 months ago
Widget _embedBuilder(BuildContext context, fleather.EmbedNode node) {
if (node.value.type == 'image') {
final String sourceType = node.value.data['source_type'];
final String source = node.value.data['source'];
if (sourceType == 'assets') {
return Padding(
// Caret takes 2 pixels, hence not symmetric padding values.
padding: const EdgeInsets.only(left: 4, right: 2, top: 2, bottom: 2),
child: Container(
width: 300,
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(source),
fit: BoxFit.cover,
),
),
),
);
} else if (source.startsWith('data:image')) {
final base64String = source.split(',').last;
final decodedBytes = base64Decode(base64String);
return Padding(
// Caret takes 2 pixels, hence not symmetric padding values.
padding: const EdgeInsets.only(left: 4, right: 2, top: 2, bottom: 2),
child: Container(
width: 300,
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: MemoryImage(decodedBytes),
fit: BoxFit.cover,
),
),
),
);
}
}
throw UnimplementedError();
}
It doesnt work with my own custom embed builder
I faced same/similar issue, @VaarunSinha did you maybe find some workaround?
@svjetlanovicF @VaarunSinha indeed, it is not possible to convert embeds at the moment, this PR should adress it when it lands #371
Steps to Reproduce
Environment
Logs