Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.79k stars 860 forks source link

[QUESTION] How to easily supply internal CSS rules #1245

Closed aytunch closed 1 year ago

aytunch commented 1 year ago

I can successfully render the html body using Html(data:xxx) but it lacks the css. The source web page I am trying to get uses internal CSS styles in the head. Is there a way to import the styles in raw string format and it works magically using this package? Just like the data property. I see that in order to use the style property, we need to give a map of <String, Style> So this means we can't just copy paste style elements from inspect pane. Or can we? Please clarify. Thanks for this package btw.

Sub6Resources commented 1 year ago

Simply appending your CSS within a <style> block at the beginning or end of your HTML blob that you pass to data should do the trick!