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.8k stars 875 forks source link

Table html code are not shown "TABLE SECTION" #1098

Closed blue492 closed 2 years ago

blue492 commented 2 years ago

I'm using flutter_html: ^3.0.0-alpha.5, I used flutter_html: ^2.2.1 its same issue too.

Flutter_html don't present html text which contains tables, "TABLE SECTION" text is presented instead

How to fix it? Text example:

<div align="center">

<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
 <tbody><tr>
  <td valign="top" style="padding:4.5pt 0cm 9pt 0cm;">
  <div align="center">
  <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
   <tbody><tr>
    <td width="616" valign="top" style="width:462pt;padding:4.5pt 18pt 9pt 18pt;">
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
     <tbody><tr>
      <td valign="top" style="padding:0cm 0cm 0cm 0cm;">
      <h1 style="margin-top:0cm;margin-right:0cm;margin-bottom:12pt;margin-left:0cm;line-height:27pt;"><span style="font-size:21pt;font-family:'dsf dsg tyrty', sans-serif;color:#11100F;letter-spacing:-0.1pt;"> fdgfd fdh fdh fdhfdh</span></h1><p></p>
     <p></p>
      <p></p>
      </td>
      <td width="0" valign="top" style="width:0.3pt;padding:0cm 0cm 0cm 0cm;"></td>
     </tr>
    </tbody></table>
    </td>
   </tr>
  </tbody></table>
  </div>
  <p class="MsoNormal" align="center" style="text-align:center;line-height:15pt;"><span style="font-size:10.5pt;font-family:'Segoe UI', sans-serif;color:#11100F;"></span></p><p> </p>
  <div align="center">
  <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;border-spacing:0px;float:none;">
   <tbody><tr>
    <td width="616" valign="top" style="width:462pt;padding:9pt 18pt 9pt 18pt;">
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
     <tbody><tr>
      <td valign="top" style="padding:0cm 0cm 0cm 0cm;">
      <p class="MsoNormal" style="line-height:16.5pt;"><span style="font-size:12pt;font-family:'Segoe UI', sans-serif;color:#11100F;"> fdg fdg hgf jhgj sdfdsgdsg dsgsdg</span></p><p></p>
      </td>
      <td width="0" valign="top" style="width:0.3pt;padding:0cm 0cm 0cm 0cm;"></td>
     </tr>
    </tbody></table>
    </td>
   </tr>
  </tbody></table>
  </div>
  </td>
 </tr>
</tbody></table>

</div>

Thanks

erickok commented 2 years ago

Did you include the dependency according to the README?

blue492 commented 2 years ago

Did you include the dependency according to the README?

Which dependency you mean? and how to fix it?

Olanshow commented 2 years ago

read here https://github.com/Sub6Resources/flutter_html#flutter_html_table

blue492 commented 2 years ago

read here https://github.com/Sub6Resources/flutter_html#flutter_html_table

I have Html plugin widget in a Column I added dependency as described and added this in Html

  customRenders: {
                    tableMatcher(): tableRender(),
                  }

I got the following error message when I run it

======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
LayoutBuilder does not support returning intrinsic dimensions.

Calculating the intrinsic dimensions would require running the layout callback speculatively, which might mutate the live render object tree.
The relevant error-causing widget was: 
Olanshow commented 2 years ago

Where is your Html() located? Show your code

blue492 commented 2 years ago

Where is your Html() located? Show your code

// content_text is just string text

Widget content_show(){
     Card(
        margin: EdgeInsets.only(top: 10, bottom: 8, right: 15, left: 15 ),
        elevation: 3,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(17),), 

        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
             Html(data: content_text, shrinkWrap: true,
                  customRenders: {
                    tableMatcher(): tableRender(),
                  }
              ),

            ]);
}
erickok commented 2 years ago

My guess is that you have nested tables, which the library does not support. (but you did not show us the html you are using)

See #589 for that issue.

blue492 commented 2 years ago

My guess is that you have nested tables, which the library does not support. (but you did not show us the html you are using)

See #589 for that issue.

I pasted the html code above