Skip to content

Conversation

tneotia
Copy link
Contributor

@tneotia tneotia commented May 2, 2021

Fixes #593 and sort of addresses #207 (we still don't support all the styles given in the example in that issue).

image

Test HTML
<html>
<head>
<style>
body {
  background-color: lightblue;
}
</style>
<style>
h1 {
  color: white;
  text-align: center;
}
</style>
<style>
p {
  font-size: 20px;
}
</style>
</head>
<body>

<h1>My First CSS Example</h1>
<p style="color: blue;">This is a paragraph.</p>

</body>
</html>

Should we add a parameter to the Html widget to allow users to pass the external CSS as a string separate from the HTML data? Don't know if that would be useful but it wouldn't be difficult to implement at all. Done via Style.fromCSS function.

Also for some reason adding <head> to the document adds a space at the top of the doc, I don't know if the changes made in #646 will help that but I don't think so. Fixed

@erickok
Copy link
Contributor

erickok commented May 3, 2021

As for the tag occupying visible space, maybe render it explicitly as empty Container()?

@tneotia

This comment has been minimized.

tneotia added 2 commits May 3, 2021 12:21
…into feature/style-tag-support

� Conflicts:
�	lib/style.dart
@tneotia
Copy link
Contributor Author

tneotia commented May 3, 2021

Fixed the empty space issue with the recent commit - for some reason the <html> tag was rendered as a TextContentElement with " " as the text, so it didn't get flagged and removed as an "empty" TextContentElement.

Copy link
Contributor

@erickok erickok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but could you change all naming to camelCase?

@tneotia
Copy link
Contributor Author

tneotia commented May 12, 2021

@erickok done.

@erickok erickok merged commit 5de96d7 into Sub6Resources:master May 12, 2021
erickok added a commit to vrtdev/flutter_html that referenced this pull request Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style tag support

2 participants