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

Embedded table has weird padding #310

Closed
skytect opened this issue Sep 8, 2020 · 4 comments
Closed

Embedded table has weird padding #310

skytect opened this issue Sep 8, 2020 · 4 comments
Assignees
Labels
question Further information is requested
Milestone

Comments

@skytect
Copy link

skytect commented Sep 8, 2020

<table>
   <tbody>
      <tr>
         <td>
            <table>
               <tbody>
                  <tr>
                     <td>a</td>
                  </tr>
                  <tr>
                     <td>bbbbbbbbbb</td>
                  </tr>
               </tbody>
            </table>
         </td>
      </tr>
   </tbody>
</table>

Expected Result
a
bbbbbbbbbb

Actual Result
a


bbbbbbbbbb



Apparently, this bug occurs in version 0.5.0+3 but not 0.4.3. Also, I found that the padding becomes larger as the number of bs increase. For instance, a single b would not cause this bug.

@daohoangson
Copy link
Owner

daohoangson commented Sep 8, 2020

Weird, it does look fine in my testing:

How did you configure the HtmlWidget?

@skytect
Copy link
Author

skytect commented Sep 9, 2020

Hmm, I was able to reproduce the bug with the following code in a new flutter project.

import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: HtmlWidget(
          '''<table>
   <tbody>
        <tr>
           <td>
              <table>
                 <tbody>
                    <tr>
                       <td>a</td>
                    </tr>
                    <tr>
                       <td>b</td>
                    </tr>
                 </tbody>
              </table>
           </td>
        </tr>
   </tbody>
</table>''',
        ),
      ),
    );
  }
}

@daohoangson
Copy link
Owner

Ah, you meant the table a stretched out like this?

Yes, this happens when the TABLE is the only thing in the HTML and the HtmlWidget is put inside something that enforces its height. This is considered a bug, I'll find a way to prevent it from happening.

For the mean time, there are two simple workarounds: If you have some other text or anything else in the HTML, it will be better:

Or you can put it inside a SingleChildScrollView:

@daohoangson daohoangson self-assigned this Sep 9, 2020
@daohoangson daohoangson added the bug Something isn't working label Sep 9, 2020
@daohoangson daohoangson added this to the 0.5.2 milestone Nov 27, 2020
@daohoangson
Copy link
Owner

Version 0.5.2 has a new TABLE implementation which doesn't have this issue. Please try upgrading and let me know if it works for you.

@daohoangson daohoangson added question Further information is requested and removed bug Something isn't working labels Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants