Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for sup and sub tags in addition to a new blockSpacing property #46

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,31 @@ class _MyHomePageState extends State<MyHomePage> {
<p>There isn't <i>really</i> a team...</p>
<h2>Installation</h2>
<p>You <u>cannot</u> install a nonexistent product!</p>
<h2>Don't ask me to find <em>x</em> in</h2>
<p>log<sub>2</sub>(<em>x</em><sup>2</sup> - 6<em>x</em>) = 3 + log<sub>2</sub>(1 - <em>x</em>)</p>
<div id="bdi_test">
<h3><code>bdi</code> and <code>bdo</code> Test:</h3>
<p>
In the example below, usernames are shown along with the number of points in a contest.
If the bdi element is not supported in the browser, the username of the Arabic user would confuse the text (the bidirectional algorithm would put the colon and the number "90" next to the word "User" rather than next to the word "points").
</p>

<ul>
<li>User <bdi>hrefs</bdi>: 60 points</li>
<li>User <bdi>jdoe</bdi>: 80 points</li>
<li>User <bdi>إيان</bdi>: 90 points</li>
<bdo dir="rtl">Swapped!</bdo>
<bdo dir="ltr">This text will go left to right!</bdo>
<bdo dir="rtl">With bdi: User <bdi>إيان</bdi>: 90 points</bdo>
<bdo dir="rtl">Without bdi: User إيان: 90 points</bdo>
<bdo dir="ltr">ltr w/ bdi: User <bdi>إيان</bdi>: 90 points</bdo>
<bdo dir="ltr">ltr w/o bdi: User إيان: 90 points</bdo>
</ul>
<h3><code>bdi</code> and <code>bdo</code> Test:</h3>
<p>
In the example below, usernames are shown along with the number of points in a contest.
If the bdi element is not supported in the browser, the username of the Arabic user would confuse the text (the bidirectional algorithm would put the colon and the number "90" next to the word "User" rather than next to the word "points").
</p>
<ul>
<li>User <bdi>hrefs</bdi>: 60 points</li>
<li>User <bdi>jdoe</bdi>: 80 points</li>
<li>User <bdi>إيان</bdi>: 90 points</li>
<bdo dir="rtl">Swapped!</bdo>
<bdo dir="ltr">This text will go left to right!</bdo>
<bdo dir="rtl">With bdi: User <bdi>إيان</bdi>: 90 points</bdo>
<bdo dir="rtl">Without bdi: User إيان: 90 points</bdo>
<bdo dir="ltr">ltr w/ bdi: User <bdi>إيان</bdi>: 90 points</bdo>
<bdo dir="ltr">ltr w/o bdi: User إيان: 90 points</bdo>
</ul>
</div>
<div>
<table>
<caption>This is the table's caption</caption>
<tr><th>Head 1</th><th>Head 2</th><th>Head 3</th></tr>
<tr><th>Head 1<sup>*</sup></th><th>Head 2</th><th>Head 3</th></tr>
<tr><td>Data 1</td><td>Long Data 2</td><td>Really, realllllly, long data 3</td></tr>
<tr><td>Data 1</td><td>Long <b>Data</b> 2</td><td>Really, realllllly, long data 3</td></tr>
<tr><td>Data 1</td><td>Long Data 2</td><td>Really, realllllly, long data 3</td></tr>
Expand Down
3 changes: 3 additions & 0 deletions lib/flutter_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Html extends StatelessWidget {
this.onLinkTap,
this.renderNewlines = false,
this.customRender,
this.blockSpacing,
this.useRichText = false,
}) : super(key: key);

Expand All @@ -22,6 +23,7 @@ class Html extends StatelessWidget {
final TextStyle defaultTextStyle;
final OnLinkTap onLinkTap;
final bool renderNewlines;
final double blockSpacing;
final bool useRichText;

/// Either return a custom widget for specific node types or return null to
Expand Down Expand Up @@ -51,6 +53,7 @@ class Html extends StatelessWidget {
renderNewlines: renderNewlines,
customRender: customRender,
html: data,
blockSpacing: blockSpacing,
),
),
);
Expand Down
Loading