Skip to content

Commit 2eedb3a

Browse files
committed
Remove 3.5 bottom padding and remove accidental change to main.dart
1 parent 5d2293e commit 2eedb3a

File tree

3 files changed

+19
-255
lines changed

3 files changed

+19
-255
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ A Flutter widget for rendering HTML and CSS as Flutter widgets.
7575

7676
- [MathML](#mathml)
7777

78+
- [Tex](#tex)
79+
7880
- [Table](#table)
7981

8082
- [Notes](#notes)
@@ -677,7 +679,7 @@ If you have a Tex string you'd like to render inside your HTML you can do that!
677679

678680
Use the custom `<tex>` tag inside your HTML, and place your **raw** Tex string inside. The package uses the same logic as MathML rendering above, but doesn't need to parse the string, of course.
679681

680-
The rendering error will also be called if your Tex string fails to render.
682+
The rendering error will also be called if your Tex string fails to render.
681683

682684
### Table
683685

example/lib/main.dart

Lines changed: 1 addition & 236 deletions
Original file line numberDiff line numberDiff line change
@@ -242,242 +242,7 @@ class _MyHomePageState extends State<MyHomePage> {
242242
),
243243
body: SingleChildScrollView(
244244
child: Html(
245-
data: """
246-
<style type="text/css">table { border:1px solid #B96F00; margin-top:10px; margin-bottom:10px; background-color:white; }
247-
td { border:1px solid #B96F00; font-size: 12pt; padding:1 3 1 5; }
248-
</style>
249-
<div class="Lorem Ipsum" style="text-align: center;">Lorem Ipsum<br />
250-
Lorem Ipsum<br />
251-
Lorem Ipsum<br />
252-
&nbsp;<br />
253-
Lorem Ipsum</div>
254-
255-
<div style="text-align: center;"></div>
256-
&nbsp;&nbsp;
257-
258-
<div style="text-align: justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum<br />
259-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum,<br />
260-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum;<br />
261-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum;<br />
262-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum;<br />
263-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum.<br />
264-
<br />
265-
Lorem Ipsum</div>
266-
267-
<table>
268-
<tbody>
269-
<tr>
270-
<td rowspan="3" style="text-align: justify;">Lorem Ipsum<br />
271-
NO</td>
272-
<td colspan="6" nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
273-
</tr>
274-
<tr>
275-
<td colspan="2" nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
276-
<td nowrap="nowrap" rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
277-
<td nowrap="nowrap" rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
278-
<td rowspan="2" style="text-align: justify;">Lorem Ipsum <br />
279-
</td>
280-
<td rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
281-
</tr>
282-
<tr>
283-
<td style="text-align: justify;">Lorem Ipsum</td>
284-
<td style="text-align: justify;">Lorem Ipsum</td>
285-
</tr>
286-
<tr>
287-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
288-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
289-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
290-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
291-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
292-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
293-
<td style="text-align: justify;">Lorem Ipsum</td>
294-
</tr>
295-
<tr>
296-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
297-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
298-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
299-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
300-
<td nowrap="nowrap" style="text-align: justify;">14.01.2021</td>
301-
<td nowrap="nowrap" style="text-align: justify;">260</td>
302-
<td style="text-align: justify;">Lorem Ipsum</td>
303-
</tr>
304-
<tr>
305-
<td nowrap="nowrap" style="text-align: justify;">3</td>
306-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
307-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
308-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
309-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
310-
<td nowrap="nowrap" style="text-align: justify;">200,00</td>
311-
<td style="text-align: justify;">Lorem Ipsum</td>
312-
</tr>
313-
<tr>
314-
<td nowrap="nowrap" style="text-align: justify;">4</td>
315-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
316-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
317-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
318-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
319-
<td nowrap="nowrap" style="text-align: justify;">648,00</td>
320-
<td style="text-align: justify;">Lorem Ipsum</td>
321-
</tr>
322-
<tr>
323-
<td nowrap="nowrap" style="text-align: justify;">5</td>
324-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
325-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
326-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
327-
<td nowrap="nowrap" style="text-align: justify;">09.09.2020</td>
328-
<td nowrap="nowrap" style="text-align: justify;">300,00</td>
329-
<td style="text-align: justify;">Lorem Ipsum</td>
330-
</tr>
331-
<tr>
332-
<td nowrap="nowrap" style="text-align: justify;">6</td>
333-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem IpsumLorem Lorem Ipsum</td>
334-
<td nowrap="nowrap" style="text-align: justify;">-</td>
335-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
336-
<td nowrap="nowrap" style="text-align: justify;">15.11.2019</td>
337-
<td nowrap="nowrap" style="text-align: justify;">16.262,33</td>
338-
<td style="text-align: justify;">Lorem IpsumLorem Ipsum</td>
339-
</tr>
340-
<tr>
341-
<td nowrap="nowrap" style="text-align: justify;">7</td>
342-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
343-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
344-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
345-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
346-
<td nowrap="nowrap" style="text-align: justify;">100,00</td>
347-
<td style="text-align: justify;">Lorem Ipsum</td>
348-
</tr>
349-
<tr>
350-
<td nowrap="nowrap" style="text-align: justify;">8</td>
351-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
352-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
353-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
354-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
355-
<td nowrap="nowrap" style="text-align: justify;">760,00</td>
356-
<td style="text-align: justify;">Lorem Ipsum</td>
357-
</tr>
358-
<tr>
359-
<td nowrap="nowrap" style="text-align: justify;">9</td>
360-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
361-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
362-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
363-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
364-
<td nowrap="nowrap" style="text-align: justify;">380,00</td>
365-
<td style="text-align: justify;">Lorem Ipsum</td>
366-
</tr>
367-
<tr>
368-
<td nowrap="nowrap" style="text-align: justify;">10</td>
369-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
370-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
371-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
372-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
373-
<td nowrap="nowrap" style="text-align: justify;">320,00</td>
374-
<td style="text-align: justify;">Lorem Ipsum</td>
375-
</tr>
376-
<tr>
377-
<td nowrap="nowrap" style="text-align: justify;">11</td>
378-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum.</td>
379-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
380-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
381-
<td nowrap="nowrap" style="text-align: justify;">17.02.2020</td>
382-
<td nowrap="nowrap" style="text-align: justify;">10.029.107,40</td>
383-
<td style="text-align: justify;">Lorem IpsumLorem Ipsum.</td>
384-
</tr>
385-
<tr>
386-
<td nowrap="nowrap" style="text-align: justify;">112</td>
387-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
388-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
389-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
390-
<td nowrap="nowrap" style="text-align: justify;">11.01.2021</td>
391-
<td nowrap="nowrap" style="text-align: justify;">220,00</td>
392-
<td style="text-align: justify;">Lorem Ipsum</td>
393-
</tr>
394-
</tbody>
395-
</table>
396-
397-
<div style="text-align: justify;">&nbsp;<br />
398-
Lorem Ipsum</div>
399-
400-
<table>
401-
<tbody>
402-
<tr>
403-
<td nowrap="nowrap" rowspan="3" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
404-
<td colspan="6" nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum / Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
405-
</tr>
406-
<tr>
407-
<td colspan="2" nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
408-
<td nowrap="nowrap" rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
409-
<td nowrap="nowrap" rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
410-
<td nowrap="nowrap" rowspan="2" style="text-align: justify;">Lorem Ipsum Lorem Ipsum<br />
411-
(TL)</td>
412-
<td rowspan="2" style="text-align: justify;">Lorem Ipsum</td>
413-
</tr>
414-
<tr>
415-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum/Lorem Ipsum - Lorem Ipsum</td>
416-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum/Lorem Ipsum/<br />
417-
Lorem Ipsum</td>
418-
</tr>
419-
<tr>
420-
<td nowrap="nowrap" style="text-align: justify;">1</td>
421-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum<br />
422-
Lorem Ipsum Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum.</td>
423-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
424-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
425-
<td nowrap="nowrap" style="text-align: justify;">02.10.2020</td>
426-
<td nowrap="nowrap" style="text-align: justify;">318</td>
427-
<td style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
428-
</tr>
429-
<tr>
430-
<td nowrap="nowrap" style="text-align: justify;">2</td>
431-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
432-
<td nowrap="nowrap" style="text-align: justify;">_</td>
433-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum<br />
434-
Lorem Ipsum</td>
435-
<td nowrap="nowrap" style="text-align: justify;">17.09.2020 25.09.2020</td>
436-
<td nowrap="nowrap" style="text-align: justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 520</td>
437-
<td style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
438-
</tr>
439-
<tr>
440-
<td nowrap="nowrap" style="text-align: justify;">3</td>
441-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum</td>
442-
<td nowrap="nowrap" style="text-align: justify;">_</td>
443-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
444-
<td nowrap="nowrap" style="text-align: justify;">17.01.2019</td>
445-
<td nowrap="nowrap" style="text-align: justify;">136.402,64</td>
446-
<td style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
447-
</tr>
448-
<tr>
449-
<td nowrap="nowrap" style="text-align: justify;">4</td>
450-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
451-
<td nowrap="nowrap" style="text-align: justify;">_</td>
452-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
453-
<td nowrap="nowrap" style="text-align: justify;">17.01.2019</td>
454-
<td nowrap="nowrap" style="text-align: justify;">55.745,56</td>
455-
<td style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
456-
</tr>
457-
<tr>
458-
<td nowrap="nowrap" style="text-align: justify;">5</td>
459-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum Lorem Ipsum Lorem Ipsum</td>
460-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
461-
<td nowrap="nowrap" style="text-align: justify;">Lorem Ipsum</td>
462-
<td nowrap="nowrap" style="text-align: justify;">09.01.2020</td>
463-
<td nowrap="nowrap" style="text-align: justify;">584.589,34</td>
464-
<td style="text-align: justify;">Lorem Ipsum/Lorem Ipsum Lorem Ipsum</td>
465-
</tr>
466-
</tbody>
467-
</table>
468-
469-
<div style="text-align: justify;">&nbsp;<br />
470-
&nbsp;<br />
471-
&nbsp;
472-
<style type="text/css">.Lorem Ipsum {
473-
text-align:center;
474-
font-size:16pt !important;
475-
column-span:all;
476-
font-weight:bold;
477-
}
478-
</style>
479-
</div>
480-
""",
245+
data: htmlData,
481246
//Optional parameters:
482247
customImageRenders: {
483248
networkSourceMatcher(domains: ["flutter.dev"]):

lib/src/replaced_element.dart

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -280,24 +280,21 @@ class MathElement extends ReplacedElement {
280280
if (element.localName == "math") {
281281
texStr = parseMathRecursive(element, r'');
282282
}
283-
return Padding(
284-
padding: const EdgeInsets.only(bottom: 3.5),
285-
child: Container(
286-
width: element.localName == "math" || element.parent!.localName == "body" ?
287-
MediaQuery.of(context.buildContext).size.width : null,
288-
child: Math.tex(
289-
texStr ?? '',
290-
mathStyle: element.parent!.localName != "body" ? MathStyle.text : MathStyle.display,
291-
textStyle: context.style.generateTextStyle(),
292-
onErrorFallback: (FlutterMathException e) {
293-
if (context.parser.onMathError != null) {
294-
return context.parser.onMathError!.call(texStr ?? '', e.message, e.messageWithType);
295-
} else {
296-
return Text(e.message);
297-
}
298-
},
299-
)
300-
),
283+
return Container(
284+
width: element.localName == "math" || element.parent!.localName == "body" ?
285+
MediaQuery.of(context.buildContext).size.width : null,
286+
child: Math.tex(
287+
texStr ?? '',
288+
mathStyle: element.parent!.localName != "body" ? MathStyle.text : MathStyle.display,
289+
textStyle: context.style.generateTextStyle(),
290+
onErrorFallback: (FlutterMathException e) {
291+
if (context.parser.onMathError != null) {
292+
return context.parser.onMathError!.call(texStr ?? '', e.message, e.messageWithType);
293+
} else {
294+
return Text(e.message);
295+
}
296+
},
297+
)
301298
);
302299
}
303300

0 commit comments

Comments
 (0)