flutter_html
flutter_html copied to clipboard
[QUESTION] how to make image not inline?
How do you make an img not inline?
I used ImageExtension() and wrap the image widget with GestureDetection to add onLongPressed
I want the image to be at the bottom of the text or add a new line before the image.
Example code:
SelectionArea(
child: Html(
data: data,
shrinkWrap: true,
style: {
"body": Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
fontSize: FontSize(16),
),
"p": Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
fontSize: FontSize(16),
),
},
extensions: [
ImageExtension(
builder: (extensionContext) {
final element = extensionContext.styledElement as ImageElement;
return GestureDetector(
onTap: (){
/// do stuff
},
onTap: (){
/// do other stuff
},
child: Image.network(
element.src,
),
);
},
)
],
),
);
PS: I have no HTML/CSS experience
use the style map to set the display to block