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

[BUG] Rendering Null value in Table. #1091

Closed dev-hann closed 1 year ago

dev-hann commented 2 years ago

Describe the bug:

I'm trying to render empty value in table. and When i use custom CSS Style has Issue.

HTML to reproduce the issue:

<table>
   <thead>
      <tr>
         <th>11</th>
         <th>12</th>
         <th>13</th>
         <th>14</th>
         <th>15</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td>21</td>
         <td>22</td>
         <td>23</td>
         <td>24</td>
         <td>25</td>
      </tr>
      <tr>
         <td>31</td>
         <td>32</td>
         <td>33</td>
         <td>34</td>
         <td></td>
      </tr>
   </tbody>
</table>

Html widget configuration:

Html(
   style: viewModel.style,
   data: markdown,
   customRenders: {
   tableMatcher(): tableRender(),
  },
);

Expected behavior:

Device details and Flutter/Dart/flutter_html versions:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.0.2, on Ubuntu 20.04.4 LTS 5.13.0-44-generic,locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version32.1.0-rc1) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2021.2) [✓] Connected device (2 available) [✓] HTTP Host Availability

flutter_html: ^3.0.0.-alpha.3 flutter_html_table: ^3.0.0.-alpha.3

Stacktrace/Logcat

EPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 256 pos 12:
'height.isFinite': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

  The relevant error-causing widget was:
    LayoutGrid
      LayoutGrid:file:///home/yoehwan/Documents/flutter_html/packages/flutter_html_table/lib/flutter_html_table.dart:161:10

Additional info: It's part of my CSS about table.

 table {
     padding: 0;
}
 table tr {
     border-top: 1px solid #cccccc;
     background-color: white;
     margin: 0;
     padding: 0;
}
 table tr:nth-child(2n) {
     background-color: #f8f8f8;
}
 table tr th {
     font-weight: bold;
     border: 1px solid #cccccc;
     text-align: left;
     margin: 0;
     padding: 6px 13px;
}
 table tr td {
     border: 1px solid #cccccc;
     text-align: left;
     margin: 0;
     padding: 6px 13px;
}
 table tr th :first-child, table tr td :first-child {
     margin-top: 0;
}
 table tr th :last-child, table tr td :last-child {
     margin-bottom: 0;
}

A picture of a cute animal (not mandatory but encouraged)

image

Sub6Resources commented 1 year ago

I can't reproduce the issue on 3.0.0-beta.1. Can you confirm that the latest version fixes your error?